WIN98,NT下均适用。
var s:string;
h=CreateFile("////.//E:",GENERIC_READ,0,NULL,OPEN_EXISTING,0,NULL);
if(h==INVALID_HANDLE_VALUE) then RaiseLastWin32Error();
DWORD n;
PREVENT_MEDIA_REMOVAL s={true};
if(!DeviceIoControl(h,IOCTL_STORAGE_MEDIA_REMOVAL,&s,sizeof s,NULL,0,&n,NULL))
then RaiseLastWin32Error();
CloseHandle(h);