Ricardo Santiago wrote: function GetSerNumber: String; type HDINFO = record InfoLevel: Word; sNumber: LongInt; vName: array [0..21] of byte; end; var hdID: pointer; oseg, oofs: word; snum: Longint; begin GetMem(hdid, sizeof(HDInfo)); oseg := Seg(hdid^); oofs := Ofs(hdid^); asm mov ah, 69h mov al, 00h mov bl, 00h {* 0=default, 1=A, 2=B, etc *} mov bh, 00h push ds mov ds, oseg mov dx, oofs int 21H pop ds end; snum := HDInfo(hdid^).sNumber ; FreeMem(hdid, sizeof(HDInfo)); result := IntToStr(sNum); end; ------------------------------------------------------------------ Richard, Do you happen to know how to do this in 32-bit, specifically in D3? I ran this thru Delphi 3 and it blew up. I even tried removing the segment/offset stuff and just throwing down the pointer to the HDInfo structure in the ds register and you can imagine what happened there - bloooom. thanks, joe
|