M
M42
Unregistered / Unconfirmed
GUEST, unregistred user!
type
TDIOC_REGISTERS = packed record
reg_EBX: DWORD;
reg_EDX: DWORD;
reg_ECX: DWORD;
reg_EAX: DWORD;
reg_EDI: DWORD;
reg_ESI: DWORD;
reg_Flags: DWORD;
end;
TTransfer = record
StartSector: Longint;
SectorCount: Word;
Buffer: Longint;
end;
const
VWIN32_DIOC_DOS_DRIVEINFO = 6;
function myproc:boolean;
var
hDevice: thandle;
reg: TDIOC_REGISTERS;
fResult: boolean;
cb: dword;
transfer: ttransfer;
buf: array[0..511] of char;
const
nDrive = 3; // Drive C:
begin
hDevice := CreateFile('//./VWIN32', GENERIC_READ or GENERIC_WRITE,
FILE_SHARE_READ or FILE_SHARE_WRITE,
nil, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, 0);
if hdevice = INVALID_HANDLE_VALUE then exit;
transfer.StartSector := 0;
transfer.SectorCount := 1;
transfer.Buffer := longint(@buf);
reg.reg_ESI := 0;
reg.reg_EAX := $7305;
reg.reg_EBX := longint(@transfer);
reg.reg_ECX := $FFFFFFFF;
reg.reg_EDX := ndrive;
reg.reg_Flags := 0;
Result := DeviceIoControl(hDevice, VWIN32_DIOC_DOS_DRIVEINFO,
@reg, sizeof(reg), @reg, sizeof(reg), cb, 0);
CloseHandle(hDevice);
end;
TDIOC_REGISTERS = packed record
reg_EBX: DWORD;
reg_EDX: DWORD;
reg_ECX: DWORD;
reg_EAX: DWORD;
reg_EDI: DWORD;
reg_ESI: DWORD;
reg_Flags: DWORD;
end;
TTransfer = record
StartSector: Longint;
SectorCount: Word;
Buffer: Longint;
end;
const
VWIN32_DIOC_DOS_DRIVEINFO = 6;
function myproc:boolean;
var
hDevice: thandle;
reg: TDIOC_REGISTERS;
fResult: boolean;
cb: dword;
transfer: ttransfer;
buf: array[0..511] of char;
const
nDrive = 3; // Drive C:
begin
hDevice := CreateFile('//./VWIN32', GENERIC_READ or GENERIC_WRITE,
FILE_SHARE_READ or FILE_SHARE_WRITE,
nil, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, 0);
if hdevice = INVALID_HANDLE_VALUE then exit;
transfer.StartSector := 0;
transfer.SectorCount := 1;
transfer.Buffer := longint(@buf);
reg.reg_ESI := 0;
reg.reg_EAX := $7305;
reg.reg_EBX := longint(@transfer);
reg.reg_ECX := $FFFFFFFF;
reg.reg_EDX := ndrive;
reg.reg_Flags := 0;
Result := DeviceIoControl(hDevice, VWIN32_DIOC_DOS_DRIVEINFO,
@reg, sizeof(reg), @reg, sizeof(reg), cb, 0);
CloseHandle(hDevice);
end;