我来将lhz的答案细化一下:
这里有一段关于在保护模式下进行INT 13H调用的例子,请你参考,可能
适合你的情况,我在NT下没有试验过,但应该有效:
.
.
type
DIOC_REGISTERS=record
REG_EBX,REG_EDX,REG_ECX,REG_EAX,REG_EDI,REG_ESI,REG_FLAGS
WORD;
end;
.
.
var
REG
IOC_REGISTERS;
HDEVICE:HWND;
FRESULT:BOOLEAN;
CB
WORD;
BUFF:ARRAY [1..512] OF BYTE;
t0: PSECURITYATTRIBUTES;
t1: POVERLAPPED;
t2: integer;
begin
t0:=nil;
t1:=nil;
HDEVICE:=CreateFile('//./VWIN32',0,0,t0,0,0,0);
if HDEVICE=INVALID_HANDLE_VALUE then
exit;
REG.REG_EAX:=2*256+1; //读1个扇区
REG.REG_ECX:=21*256+10; //第21道第10扇区
REG.REG_EDX:=0; //0面
REG.REG_EBX:=DWORD(@BUFF); //缓冲区地址
REG.REG_FLAGS:=1;
FRESULT:=DeviceIoConrol(HDEVICE,4,@REG,SIZEOF(DIOC_REGISTERS),
@REG,SIZEOF(DIOC_REGISTERS),t2,t1);
CloseHandle(HDEVICE);
IF (REG.REG_EAX AND $8000)=$8000 THEN
MessagesBox(0,'驱动器中无磁盘!','严重错误',16);
end;
.
.
我曾用此法编写过一个磁盘加密程序,效果比较好。