Registriert seit: 16. Jan 2004
Ort: Bendorf
5.219 Beiträge
Delphi 10.2 Tokyo Professional
|
Re: Union Übersetzung nach Pascal
12. Mär 2007, 20:24
Delphi-Quellcode:
procedure TForm1.Button6Click(Sender: TObject);
var H: THandle;
P: PDRIVE_LAYOUT_INFORMATION_EX;
outBytes: Cardinal;
Size: Cardinal;
begin
H := CreateFile('\\.\PhysicalDrive0', GENERIC_READ or GENERIC_WRITE,
FILE_SHARE_READ or FILE_SHARE_WRITE, nil, OPEN_EXISTING, 0, 0);
Size := SizeOf(_DRIVE_LAYOUT_INFORMATION_EX) + SizeOf(_PARTITION_INFORMATION_EX) * 31;
GetMem(P, Size);
Try
FillChar(P^, Size, 0);
If DeviceIoControl(H, IOCTL_DISK_GET_DRIVE_LAYOUT_EX, nil, 0,
P, Size, OutBytes, nil) Then
ShowMessage('Klappt')
Else ShowMessage(SysErrorMessage(GetLastError));
Finally
FreeMem(P);
End;
CloseHandle(H);
end;
Das sagt mir: 'klappt'
OutBytes = 4656
Werte von P sind die selben wie sonst auch...
Michael "Programmers talk about software development on weekends, vacations, and over meals not because they lack imagination,
but because their imagination reveals worlds that others cannot see."
|
|
Zitat
|