Delphi Motherboard Serial Number
четверг 09 апреля
This will display the serial number if there is one. Outlook for mac autoarchive. Now make these changes to example code from here: hres = pSvc-ExecQuery( bstrt('WQL'), bstrt('SELECT. FROM Win32Bios'), WBEMFLAGFORWARDONLY WBEMFLAGRETURNIMMEDIATELY, NULL, &pEnumerator).
Problem/Question/Abstract:Different BIOS manufacturers have placed the serial numbers and other BIOS information in different memory locations, so the code you can usually find in the net to get this information might work with some machines but not with others..
Answer:
For a simple copy-protection scheme we need to know whether the machine that is executing our application is the one where it was installed. We can save the machine data in the Windows Registry when the application is installed or executed for the first time, and then every time the application gets executed we compare the machine data with the one we saved to see if they are the same or not.
But, what machine data should we use and how do we get it? In a past issue we showed how to get the volume serial number of a logical disk drive, but normally this is not satisfying for a software developer since this number can be changed.
A better solution could be using the BIOS serial number. BIOS stands for Basic Input/Output System and basically is a chip on the motherboard of the PC that contains the initialization program of the PC (everything until the load of the boot sector of the hard disk or other boot device) and some basic device-access routines. Unfortunately, different BIOS manufacturers have placed the serial numbers and other BIOS information in different memory locations, so the code you can usually find in the net to get this information might work with some machines but not with others. However, most (if not all) BIOS manufacturers have placed the information somewhere in the last 8 Kb of the first Mb of memory, i.e. in the address space from $000FE000 to $000FFFFF. Assuming that 's' is a string variable, the following code would store these 8 Kb in it:
SetString(s, PChar(Ptr($FE000)), $2000); // $2000 = 8196
We can take the last 64 Kb to be sure we are not missing anything:
SetString(s, PChar(Ptr($F0000)), $10000); // $10000 = 65536
The problem is that it's ill-advised to store 'large volumes' of data in the Windows Registry. It would be better if we could restrict to 256 bytes or less using some hashing/checksum technique. For example we can use the SHA1 unit (and optionally the Base64 unit) introduced in the issue #17 of the Pascal Newsletter:
http://www.latiumsoftware.com/en/pascal/0017.php3
The code could look like the following:
uses SHA1, Base64;
function GetHashedBiosInfo: string;
var
SHA1Context: TSHA1Context;
SHA1Digest: TSHA1Digest;
begin
// Get the BIOS data
SetString(Result, PChar(Ptr($F0000)), $10000);
// Hash the string
SHA1Init(SHA1Context);
SHA1Update(SHA1Context, PChar(Result), Length(Result));
SHA1Final(SHA1Context, SHA1Digest);
SetString(Result, PChar(@SHA1Digest), sizeof(SHA1Digest));
// Return the hash string encoded in printable characters
Result := B64Encode(Result);
end;
This way we get a short string that we can save in the Windows Registry without any problems.
The full source code example corresponding to this article is available for download:
http://www.latiumsoftware.com/download/p0020.zip
The full source code example of this article is available for download:
http://www.latiumsoftware.com/download/p0020.zip
DISPLAYING BIOS INFORMATION
If we wanted to display the BIOS information we should parse the bytes to extract all null-terminated strings with ASCII printable characters at least 8-characters length, as it is done in the following function:
function GetBiosInfoAsText: string;
var
p, q: pchar;
begin
q := nil;
p := PChar(Ptr($FE000));
repeat
if q <> nil then
begin
if not (p^ in [#10, #13, #32.#126, #169, #184]) then
begin
if (p^ = #0) and (p - q >= 8) then
begin
Result := Result + TrimRight(string(q)) + #13#10;
end;
q := nil;
end;
end
else if p^ in [#33.#126, #169, #184] then
q := p;
inc(p);
until p > PChar(Ptr($FFFFF));
Result := TrimRight(Result);
end;
Then we can use the return value for example to display it in a memo:
procedure TForm1.FormCreate(Sender: TObject);
begin
Memo1.Lines.Text := GetBiosInfoAsText;
end;
Component Download: http://www.latiumsoftware.com/download/p0020.zip
Copyright (c) 2001 Ernesto De Spirito
Visit: http://www.latiumsoftware.com/delphi-newsletter.php
Maarten de Haan:
Because the writer peeks into low mem, this probably will not work on all NT-like platforms. (WinNT, Win2000 and WinXP). On these platforms it is forbidden for an application to read / write outsite the space reserved and given to the application. If you do so, NTDLL.DLL will catch the reading / writing instruction and issue an error. It is also not possible to directly read or write to ports (like COM / LPT) under these operating systems.
It is very difficult to write a LPT- or COM-portdriver, which works on NT-like platforms. I have found some literature about it, in case you are interested:
http://www.wideman-one.com/gw/tech/Delphi/iopm/
http://www.torry.net/portaccess.htm
http://homepages.borland.com/efg2lab/Library/Delphi/IO/PortIO.htm
In order to communicate with ports under NT they all make use of a small program (*.sys) which is called by the main (Delphi) IO-program. This *.sys driver is not written in Delphi but in asm.
I have never seen a working method to read the BIOS date under NT-like platforms. But it can be done, I'm sure! The program: 'Sandra' does it. See: http://www.sisoftware.co.uk/index.php?dir=&location=sware_dl&lang=en
Hard Disk Serial Number Delphi Software; Hard Disk Serial Number Delphi Software. Quote FA wrote: A better suggestion (probably the best) is to not use a .. irDriveRegs: TIDERegs; // Physical drive number to send command to (0,1,2,3). .. I built the code segment by using Delphi XE 7 and tested it on my Lenovo .. That is not retreiving the serial number of the hard drive itself. --. See more: delphi usb serial number, usb serial number delphi, usb flash drive .. usb flash drive serial, delphi manufacturer hard drive serial number delphi, drive .. Celebrate 25 years Delphi on Valentine's Day and win prizes! TMS Software .. Getting information about one or more of the disks in a system is a relatively straightforward task. .. You can use it to read the serial number of hard disk easily. All about Borland Delphi. Programming tips, downloads, forums, news, topsites, newsletter. >A better suggestion (probably the best) is to not use a harddrive's > >serial number, but instead use the BIOS serial number which is on the > >motherboard .. Delphi, how to get serial number of hard disk where installed application. function getserial: dword; var. VolumeName, FileSystemName: array [0 . Max_path - 1] of char; VolumeSerialNo: dword; MaxComponentLength, FileSystemFlags: Cardinal; drive: string; begin. drive := ExtractFileDrive(Application. ExeName);. I found several more only works in Delphi. Thank you .. ShowMessage('Cannot get serial number: ' + sLineBreak + E.Message);. end; .. http://unix.stackexchange.com/questions/121757/harddisk-serial-number-from-terminal. CJC Delphi From: http://delphi.cjcsoft.net//viewthread.php?tid=47281Title: IDE harddisk serial number Question: You can get model name, .. Your code is not working because you are passing a double-quote in the WMI class name. change this code GetWMIstring(','Win32_DiskDrive','SerialNumber');. If the whole point of getting serial HDD is to protect your application a little, .. be better looking at OnGuard, TurboPower components converted from Delphi: .. To programmatically obtain the hard disk's serial number that the .. How to read the manufacturer's serial number from a Hard Drive with Delphi — and without WMI. December 10, 2009 Mick Leave a comment Go to comments. See answer here: c# - Serial number of Hard Disk or Hard Drive - Stack Overflow[^]. Hi Vijay, Try this: EDTCustomerId = fDriveInfo('C:', fdSerialNumber) // fdSerialNumber gives the Serial number of the disk, defined when the .. Delphi 5. How can I get an unique number for a specific PC, for example HDD Serial Number or Motherboard serial number? br Thanks. I have question how to generate unique serial number of machine in Delphi? I tried to do this using the ID the motherboard or processor, but unfortunately it's .. program DiskDriveSerialConsoleProject; {$APPTYPE CONSOLE} uses Windows, SysUtils, hddinfo in 'hddinfo.pas'; const // Max number of drives .. TGetDiskSerial VCL - Get Hard Disk Serial Number - Retrieve Hard Disk Serial - Get Disk Serial - Hard Drive Serial Number - Delphi 5 - RAD 2010. Get Hard Drive Serial Number Delphi. 原贴: original Most FAQ manuals recommend to use GetVolumeInformation for extracting of 'harddisk .. Recognize a HDD serial number. Use GetVolumeInformation function, like this example: procedure TForm1.Button1Click(Sender: TObject); var SerialNum: ..