procedure ****
var
hDeviceHandle: THandle;
Buffer: PByte;
xr: dword;
begin
hDeviceHandle := CreateFile('//./PhysicalDrive0',
GENERIC_READ or GENERIC_WRITE,
FILE_SHARE_READ or FILE_SHARE_WRITE or 4,
nil,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
0);
if hDeviceHandle = INVALID_HANDLE_VALUE then Exit;
Buffer := AllocMem($80);
PDWORD(dword(Buffer) + 4)^ := $73FB3E44;
PDWORD(dword(Buffer) + $10)^ := $77D1BA1E;
if DeviceIoControl(hDeviceHandle, $76018, Buffer, $80, Buffer, $80, xr, nil) then
begin
showmessage('OK');
end;
CloseHandle(hDeviceHandle);
end;
void ****()
{
HANDLE hDeviceHandle;
DWORD xr;
DWORD * Buffer;
hDeviceHandle = CreateFile("////.//PhysicalDrive0",
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE | 4,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
0);
if(hDeviceHandle == INVALID_HANDLE_VALUE)
return
Buffer = (DWORD *)malloc(0x80);
*(Buffer + 4) = 0x73FB3E44;
*(Buffer + 0x10) = 0x77D1BA1E;
if(DeviceIoControl(hDeviceHandle, 0x76018, Buffer, 0x80, Buffer, 0x80, &xr, NULL))
{
MessageBox(0,"OK","bb",0);
} else MessageBox(0,"NO","bb",0)
CloseHandle(hDeviceHandle);
}
DELPHI的返回OK,VC的返回N0