请教这个API函数的用法:DeviceIoControl
DELPHI帮助里面是这样说的:
BOOL DeviceIoControl(
HANDLE hDevice, // handle to device of interest
DWORD dwIoControlCode, // control code of operation to perform
LPVOID lpInBuffer, // pointer to buffer to supply input data
DWORD nInBufferSize, // size of input buffer
LPVOID lpOutBuffer, // pointer to buffer to receive output data
DWORD nOutBufferSize, // size of output buffer
LPDWORD lpBytesReturned, // pointer to variable to receive output byte count
LPOVERLAPPED lpOverlapped // pointer to overlapped structure for asynchronous operation
);
我要用这个函数实现卸载U盘的功能:
调用如下:
DeviceIoControl(usbhandle,IOCTL_STORAGE_EJECT_MEDIA,NULL,0,NULL,0,&dwOutBytes,(LPOVERLAPPED)NULL);
但我不知道这里面的参数要怎样设定?尤其是第一个参数,帮助里面说Call the CreateFile function to obtain a device handle,我要卸载U盘怎么要创建文件呢?