 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
h4c0r-BG Master Cheater
Reputation: 0
Joined: 29 Nov 2006 Posts: 449 Location: The yogurt country
|
Posted: Mon Nov 05, 2007 10:37 am Post subject: [Delphi] Help about GetVolumeInformation |
|
|
procedure TForm1.Button1Click(Sender: TObject);
| Quote: | var
SerialNum : pdword;
Buffer : array [0..255] of char;
MaxCompLength, FileSystemFlags : dword;
result: string;
begin
GetVolumeInformation('D:\', Buffer, SizeOf(Buffer),
SerialNum, MaxCompLength,
FileSystemFlags, nil, 0);
Label1.Caption:=inttostr(serialnum^);
end; |
The problem is that i can't get the HD serial number.
I sent the program to my friends and all of us get:
label1.caption ----> 2346224467
How to fix this? It is not possible the serial to be the same on different computers. =/ _________________
|
|
| Back to top |
|
 |
Renkokuken GO Moderator
Reputation: 4
Joined: 22 Oct 2006 Posts: 3249
|
Posted: Mon Nov 05, 2007 11:08 am Post subject: |
|
|
Check this example usage, better of not declaring as a PDWORD.
| Code: | var
fileSysFlags: DWORD;
maxCompLen : DWORD;
serNum : DWORD;
begin
GetVolumeInformation(PChar(<INSERTDISK>+':\'), nil, 0, @serNum,
maxCompLen, fileSysFlags, nil, 0) |
Taken from : Here. |
|
| Back to top |
|
 |
appalsap Moderator
Reputation: 0
Joined: 27 Apr 2006 Posts: 6753 Location: Pakistan
|
Posted: Mon Nov 05, 2007 11:22 am Post subject: |
|
|
| Code: |
program HSerial;
{$APPTYPE CONSOLE}
uses
SysUtils, Windows;
var
CurrentDrive: pchar;
SerialNumber, Blah: Cardinal;
begin
try
CurrentDrive := PChar(ExtractFileDrive(GetCurrentDir)+'\');
if GetVolumeInformation(CurrentDrive, nil, 0, @SerialNumber, Blah, Blah, nil, 0) then
WriteLn('Serial Number: ' + IntToStr(SerialNumber))
else
WriteLn('Unable to retrieve serial number! This may help: ' + IntToStr(GetLastError));
ReadLn;
except
on E:Exception do
Writeln(E.Classname, ': ', E.Message);
end;
end.
|
Your problem was you declared a pointer to some memory that doesn't exist, so you will get whatever crap was on the stack at the time. _________________
|
|
| Back to top |
|
 |
h4c0r-BG Master Cheater
Reputation: 0
Joined: 29 Nov 2006 Posts: 449 Location: The yogurt country
|
Posted: Mon Nov 05, 2007 12:06 pm Post subject: |
|
|
Thank you appalsap. It was a nice copy/pasteable code. ^^ _________________
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|