IOCTL_STORAGE_GET_MEDIA_SERIAL_NUMBER IOCTL (winioctl.h)

检索 USB 设备的序列号。

若要执行此操作,请使用以下参数调用 DeviceIoControl 函数。

BOOL DeviceIoControl(
  (HANDLE) hDevice,                         // handle to device
  IOCTL_STORAGE_GET_MEDIA_SERIAL_NUMBER,    // dwIoControlCode
  NULL,                                     // lpInBuffer
  0,                                        // nInBufferSize
  (LPVOID) lpOutBuffer,                     // output buffer
  (DWORD) nOutBufferSize,                   // size of output buffer
  (LPDWORD) lpBytesReturned,                // number of bytes returned
  (LPOVERLAPPED) lpOverlapped               // OVERLAPPED structure
);

要求

   
最低受支持的客户端 Windows XP
最低受支持的服务器 Windows Server 2003
标头 winioctl.h (包括 Windows.h)

另请参阅