procedure ReadMBR;
const
BytesPerSector = 512;
SectorCount = 1;
SectorStart = 0;
drive = '\\.\PHYSICALDRIVE0';
var
str: String;
p,pp: PChar;
i: Cardinal;
hDriveHandle:THandle;
begin
hDriveHandle := CreateFile(drive, GENERIC_ALL, FILE_SHARE_READ or FILE_SHARE_WRITE,
nil, OPEN_EXISTING, 0, 0);
if (hDriveHandle <> INVALID_HANDLE_VALUE) then
begin
p := allocmem(SectorCount * ByteSPerSector);
pp := allocmem(SectorCount * ByteSPerSector);
FileSeek(hDriveHandle, SectorStart * BytesPerSector, 0);
if FileRead(hDriveHandle, p[0], SectorCount * BytesperSector)<>
SectorCount * BytesperSector then
raise Exception.Create('Read Error!');
str :='';
for i := 0 to 512 - 1 do
begin
str := str + Format('%.2x', [integer(p[i])]);
if i mod 16 = 15 then
str := str + #13;
end;ShowMessage(str);
FreeMem(p, SectorCount * BytesperSector);
Closehandle(hDriveHandle); end;
end;
为什么在域里面的用户就不能读不出来而在管理员下就可以读出来?怎么解决。域里面的用户的权限为USER
const
BytesPerSector = 512;
SectorCount = 1;
SectorStart = 0;
drive = '\\.\PHYSICALDRIVE0';
var
str: String;
p,pp: PChar;
i: Cardinal;
hDriveHandle:THandle;
begin
hDriveHandle := CreateFile(drive, GENERIC_ALL, FILE_SHARE_READ or FILE_SHARE_WRITE,
nil, OPEN_EXISTING, 0, 0);
if (hDriveHandle <> INVALID_HANDLE_VALUE) then
begin
p := allocmem(SectorCount * ByteSPerSector);
pp := allocmem(SectorCount * ByteSPerSector);
FileSeek(hDriveHandle, SectorStart * BytesPerSector, 0);
if FileRead(hDriveHandle, p[0], SectorCount * BytesperSector)<>
SectorCount * BytesperSector then
raise Exception.Create('Read Error!');
str :='';
for i := 0 to 512 - 1 do
begin
str := str + Format('%.2x', [integer(p[i])]);
if i mod 16 = 15 then
str := str + #13;
end;ShowMessage(str);
FreeMem(p, SectorCount * BytesperSector);
Closehandle(hDriveHandle); end;
end;
为什么在域里面的用户就不能读不出来而在管理员下就可以读出来?怎么解决。域里面的用户的权限为USER
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货