共用方式為


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)

另請參閱