Note that there are some explanatory texts on larger screens.

plurals
  1. POGet Real HDD Serial Number with Delphi
    primarykey
    data
    text
    <p>I am trying to make delphi program Server And Client so To Secure my App and To Make Sure all user are under control i should give them a unique Key that can't be change to not lose them Handle, So i think it should be HDD Serial Number + Bios SN , but i remember that Bios Can Be Change When remove motherboard Battery so it will not be work . so my choose now is HDD Real serial number i am try this code below to get it but it didn'r work </p> <pre><code> unit Unit2; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls,WbemScripting_TLB,ActiveX; type TForm4 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form4: TForm4; implementation {$R *.dfm} function GetWMIstring (wmiHost, wmiClass, wmiProperty : string):string; var // These are all needed for the WMI querying process Locator: ISWbemLocator; Services: ISWbemServices; SObject: ISWbemObject; ObjSet: ISWbemObjectSet; SProp: ISWbemProperty; Enum: IEnumVariant; Value: Cardinal; TempObj: OleVariant; SN: string; begin try Locator := CoSWbemLocator.Create; // Create the Location object // Connect to the WMI service, with the root\cimv2 namespace Services := Locator.ConnectServer(wmiHost, 'root\cimv2', '', '', '','', 0, nil); ObjSet := Services.ExecQuery('SELECT * FROM '+wmiClass, 'WQL', wbemFlagReturnImmediately and wbemFlagForwardOnly , nil); Enum := (ObjSet._NewEnum) as IEnumVariant; while (Enum.Next(1, TempObj, Value) = S_OK) do begin SObject := IUnknown(tempObj) as ISWBemObject; SProp := SObject.Properties_.Item(wmiProperty, 0); if VarIsNull(SProp.Get_Value) then result := '' else begin SN := SProp.Get_Value; result := SN; end; end; except // Trap any exceptions (Not having WMI installed will cause one!) on exception do result := ''; end; end; procedure TForm4.Button1Click(Sender: TObject); var x:string; Y:string; begin X:=GetWMIstring('','Win32_BIOS','SerialNumber'); Y:=GetWMIstring('','Win32_DiskDrive"','SerialNumber') ; ShowMessage(x+';'+y); end; end. </code></pre> <p>*<strong><em>so please can any one correct my Code or Give me another idea Best regard's</em>*</strong> </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload