BOOL DeviceIoControl(HANDLE Handle, DWORD Code, LPVOID BufferEntree, DWORD TailleBufferEntree, LPVOID BufferSortie, DWORD TailleBufferSortie, LPDWORD TailleBufferSortieUtilisee, LPOVERLAPPED Inutile);
Le code de l'opération Code est le plus souvent :
#include <windows.h>
#include <winbase.h>
#include <winioct.h>
HFILE Handle;
DWORD NbOctetsRetournes;
memset(&Informations, 0, sizeof(OFSTRUCT));
Handle=OpenFile("MonUnite", &Informations, OF_EXIST);
if (Handle==-1)
{
...
}
...
if (!DeviceIoControl((HANDLE)Handle, IOCTL_STORAGE_EJECT_MEDIA, NULL, 0, NULL,0, &NbOctetsRetournes, NULL))
{
...
}
...
Le résultat est Faux en cas d'échec.