Home > Back-end >  Get U disk ID
Get U disk ID

Time:09-29

I want to use the VC for U disk ID, check a lot of data are all Delphi and VB, seems can be checked by the registry, or use the API to obtain U disk ID, but don't know what to do, wish someone would explain, thanks!

CodePudding user response:

A wooden one, a wooden one

CodePudding user response:

Or a wooden one

CodePudding user response:

Stick you find Delphi code, give you translation, programming of cb

CodePudding user response:

reference ksrsoft reply: 3/f
stick you find Delphi code, give you translation, programming of cb


The unit GetUSBID;

Interface

USES the
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

Type
TForm1=class (TForm)
For: TButton;
Procedure Button1Click (Sender: TObject);
Private
{Private declarations}
Public
{Public declarations}
end;

Var
Form1: TForm1;

Implementation

USES the USB;

{$R *. DFM}

Procedure TForm1. Button1Click (Sender: TObject);
Var
Drv, Pid: string;
The begin
Drv:=ExtractFileDrive (ParamStr (0));
If GetDriveType (PChar (Drv + '\')) & lt;> DRIVE_REMOVABLE then
Application. The MessageBox (' sorry, please put the program to the usb flash drive to use! 'and' Error ', MB_ICONHAND)
Else if GetUSBDiskID (Drv, Pid) then ShowMessage (Pid);
end;


The end.

CodePudding user response:

Did GetUSBDiskID this is a DLL function, the function definition of
To run the program needs support DLLS

CodePudding user response:

reference 5 floor ksrsoft reply:
GetUSBDiskID this is a DLL function, have the function definition of
Need to run the program DLL support


I'm from under CSDN download information, do not understand the Delphi, can give you the whole file hairpin?

CodePudding user response:

Just done, for example, 73 b60084b0 is pid, but not Windows 7, Windows xp can get

CodePudding user response:

refer to 7th floor ksrsoft response:
just do an example, the 73 b60084b0 is pid, but not Windows 7, Windows xp access to


Is that the teacher is to use what way to get, you can elaborate?

CodePudding user response:

The building Lord send a VB, need to use

CodePudding user response:

Oh, I got a
If you download a USBPhysic inside. The DLL to quote, then the same I can find online implementation is done with the DLL (of course, there are encapsulated into class)
Dependency Walker found out it is used to derive the two functions Init and GetUSBPhysicInfo
But it calls for more than N API
This is he call kernel32. DLL
The CloseHandle
CreateFileA
DeleteCriticalSection
DeviceIoControl
The EnterCriticalSection
ExitProcess
FlushFileBuffers
FreeEnvironmentStringsA
FreeEnvironmentStringsW
GetACP
GetCPInfo
GetCommandLineA
GetConsoleCP
GetConsoleMode
GetConsoleOutputCP
GetCurrentProcess
GetCurrentProcessId
GetCurrentThreadId
GetDriveTypeA
GetEnvironmentStrings
GetEnvironmentStringsW
GetFileType
GetLastError
GetLocaleInfoA
GetLogicalDriveStringsA
GetModuleFileNameA
GetModuleHandleA
GetOEMCP
GetProcAddress call
GetProcessHeap
GetStartupInfoA
The GetStdHandle
GetStringTypeA
GetStringTypeW
GetSystemTimeAsFileTime
The GetTickCount
GetVersionExA
HeapAlloc
HeapCreate
HeapDestroy
HeapFree
HeapReAlloc
HeapSize
InitializeCriticalSection
InterlockedDecrement
InterlockedIncrement
IsDebuggerPresent
LCMapStringA
LCMapStringW
LeaveCriticalSection
LoadLibraryA
MultiByteToWideChar
The QueryPerformanceCounter
RaiseException
RtlUnwind
SetErrorMode
SetFilePointer
SetHandleCount
SetLastError
SetStdHandle
SetUnhandledExceptionFilter
Sleep
The TerminateProcess
TlsAlloc
TlsFree
TlsGetValue
TlsSetValue
UnhandledExceptionFilter
VirtualAlloc
VirtualFree
WideCharToMultiByte
WriteConsoleA
WriteConsoleW
WriteFile
It follows the core functions seems not too simple, or old honest practical DLL
The level of the building Lord should know how to reference external DLL export functions of
Public Declare Function Init Lib "USBPhysic. DLL" (ByVal sUser As String, ByVal sRegCode As String) As Long
Public Declare Function GetUSBPhysicInfo Lib "USBPhysic. DLL" (ByVal diskIndex As Long, ByVal infotypes As Long, ByVal pHddInfo As String) As Long

I will not help to C,,
  • Related