الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

serial number الخاص بالقرص الصلب

مغلق
بدأه Borland في 14 يونيو 2005 · 4 رد · 736 مشاهدة · في لغة Delphi
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم ورحمة الله وبركاته

كيف حالكم أخوتي أرجو أن تكونوا بصحة جيدة

احتاج الكود الذي عن طريقه اعرف الـ serial number الخاص بالقرص الصلب

#2

السلام عليكم اخ Borland يتم الحصول على Hardware serial number باستخدام تابع API التالي

وهذا شرح عنه:

BOOL GetVolumeInformation(

LPCTSTR lpRootPathName, // address of root directory of the file system

LPTSTR lpVolumeNameBuffer, // address of name of the volume

DWORD nVolumeNameSize, // length of lpVolumeNameBuffer

LPDWORD lpVolumeSerialNumber, // address of volume serial number

LPDWORD lpMaximumComponentLength, // address of system's maximum filename length

LPDWORD lpFileSystemFlags, // address of file system flags

LPTSTR lpFileSystemNameBuffer, // address of name of file system

DWORD nFileSystemNameSize // length of lpFileSystemNameBuffer

);

Parameters

lpRootPathName

Points to a string that contains the root directory of the volume to be described. If this parameter is NULL, the root of the current directory is used. If this parameter is a UNC name, you must follow it with an additional backslash. For example, you would specify \\MyServer\MyShare as \\MyServer\MyShare\.

lpVolumeNameBuffer

Points to a buffer that receives the name of the specified volume.

nVolumeNameSize

Specifies the length, in characters, of the volume name buffer. This parameter is ignored if the volume name buffer is not supplied.

lpVolumeSerialNumber

Points to a variable that receives the volume serial number. This parameter can be NULL if the serial number is not required.

lpMaximumComponentLength

Points to a doubleword value that receives the maximum length, in characters, of a filename component supported by the specified file system. A filename component is that portion of a filename between backslashes.

The value stored in variable pointed to by *lpMaximumComponentLength is used to indicate that long names are supported by the specified file system. For example, for a FAT file system supporting long names, the function stores the value 255, rather than the previous 8.3 indicator. Long names can also be supported on systems that use the New Technology file system.

lpFileSystemFlags

Points to a doubleword that receives flags associated with the specified file system. This parameter can be any combination of the following flags, with one exception: FS_FILE_COMPRESSION and FS_VOL_IS_COMPRESSED are mutually exclusive.

Value Meaning

FS_CASE_IS_PRESERVED If this flag is set, the file system preserves the case of filenames when it places a name on disk.

FS_CASE_SENSITIVE If this flag is set, the file system supports case-sensitive filenames.

FS_UNICODE_STORED_ON_DISK If this flag is set, the file system supports Unicode in filenames as they appear on disk.

FS_PERSISTENT_ACLS If this flag is set, the file system preserves and enforces ACLs. For example, NTFS preserves and enforces ACLs, and FAT does not.

FS_FILE_COMPRESSION The file system supports file-based compression.

FS_VOL_IS_COMPRESSED The specified volume is a compressed volume; for example, a DoubleSpace volume.

lpFileSystemNameBuffer

Points to a buffer that receives the name of the file system (such as FAT or NTFS).

nFileSystemNameSize

Specifies the length, in characters, of the file system name buffer. This parameter is ignored if the file system name buffer is not supplied.

Example:

Function InternalGetHardwareID: String;var
  pdw: pDWord;
  mc, fl: dword;
  SerialNum:DWord;
Begin
  Result := '';
  New( pdw );
  GetVolumeInformation( PChar( 'C:\' ), Nil, 0, pdw, mc, fl, Nil, 0 );
  SerialNum := pdw^;
  Result:= IntToStr(Serialnum);
End;

procedure TForm1.Button1Click(Sender: TObject);
begin
  ShowMessage(InternalGetHardwareID);
end;

رب اجعلني مقيم الصلاة ومن ذريتي ربنا وتقبل دعاء.

لا تنسى: "العقل مثل العضلة كلما استخدمته أكثر كلما ازدادت قوته"

#3

السلام عليكم ورحمة الله وبركاته

مشكور أخي waeldalol على الرد وسلمت يداك يارب حجرب الكود وبعدين يصير خير إن شاء الله

#4

السلام عليكم ورحمة الله وبركاته

مشكور أخي زبطت معاي بارك الله بيك

#5

الاخ Borland بماذا ستستفيد من الحصول على رقم الهارد التسلسلي

اذا كنت تريد ذلك لحماية برنامجك فلدي كمبوننت جاهزة لهذا!

رب اجعلني مقيم الصلاة ومن ذريتي ربنا وتقبل دعاء.

لا تنسى: "العقل مثل العضلة كلما استخدمته أكثر كلما ازدادت قوته"

هذا الموضوع مغلق.

مواضيع مشابهة