473,511 Members | 12,017 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Machine serial Number

1 New Member
Machine serial Number
Aug 3 '07 #1
9 2234
hariharanmca
1,977 Top Contributor
Machine serial Number
post your query in detail with
front-end, back-end versions.

explain your prolem then post what you had tryed.
Aug 3 '07 #2
Austen
23 New Member
post your query in detail with
front-end, back-end versions.

explain your prolem then post what you had tryed.

i want to protect my application without using any dongle. so i have to to get the hardware id. but hardware id like hdd id will change after format. cpu id also can change in BIOS. the best way is to get the get the serial number? how to get the manufacturer serial number?


thanks
Aug 4 '07 #3
Killer42
8,435 Recognized Expert Expert
i want to protect my application without using any dongle. so i have to to get the hardware id. but hardware id like hdd id will change after format. cpu id also can change in BIOS. the best way is to get the get the serial number? how to get the manufacturer serial number?
I don't think you can get it reliably. There was such a public outcry that Intel went back to switching it off by default. Nobody wants to have their PC tracked.

P.S. This sounds like a question for the Miscellaneous Questions or Software Development forum, as it really goes beyond a particular programming language.
Aug 5 '07 #4
Austen
23 New Member
I don't think you can get it reliably. There was such a public outcry that Intel went back to switching it off by default. Nobody wants to have their PC tracked.

P.S. This sounds like a question for the Miscellaneous Questions or Software Development forum, as it really goes beyond a particular programming language.

i also looking for how to get the hard disk serial number. unfortunately to say that, i couldnt get it. only can get the volumn number. but... if you really need and willing to pay for the solution, you can visit ionwork.com. its about 50USD.
however, hopefully someone can write the program to get the serial number and share with us.
Sep 4 '07 #5
Rajkumar GS
4 New Member
Hi,

One of best way to configure a tool to run only on a particular machine is using the MANUFACTURER SERIAL NUMBER OF THE HARD DISK, which is UNIQUE.

GetVolumeInformation will return ONLY the volume serial number, which keeps changing on format.

Use the following code to retrieve Model Number, Serial Number and Firmware Revision of a hard disk.

Here by I am providing the Class file code & vb file code.

I am pasting the code of the class file opened by notepad here by
---------------------------------------------------------------
Expand|Select|Wrap|Line Numbers
  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4.   Persistable = 0  'NotPersistable
  5.   DataBindingBehavior = 0  'vbNone
  6.   DataSourceBehavior  = 0  'vbNone
  7.   MTSTransactionMode  = 0  'NotAnMTSObject
  8. END
  9. Attribute VB_Name = "HDSN"
  10. Attribute VB_GlobalNameSpace = False
  11. Attribute VB_Creatable = True
  12. Attribute VB_PredeclaredId = False
  13. Attribute VB_Exposed = False
  14. Attribute VB_Ext_KEY = "SavedWithClassBuilder6" ,"Yes"
  15. Attribute VB_Ext_KEY = "Top_Level" ,"Yes"
  16. Option Explicit
  17.  
  18. ' Antonio Giuliana, 2001-2003
  19.  
  20. ' Costanti per l'individuazione della versione di OS
  21. Private Const VER_PLATFORM_WIN32S = 0
  22. Private Const VER_PLATFORM_WIN32_WINDOWS = 1
  23. Private Const VER_PLATFORM_WIN32_NT = 2
  24.  
  25. ' Costanti per la comunicazione con il driver IDE
  26. Private Const DFP_RECEIVE_DRIVE_DATA = &H7C088
  27.  
  28. ' Costanti per la CreateFile
  29. Private Const FILE_SHARE_READ = &H1
  30. Private Const FILE_SHARE_WRITE = &H2
  31. Private Const GENERIC_READ = &H80000000
  32. Private Const GENERIC_WRITE = &H40000000
  33. Private Const OPEN_EXISTING = 3
  34. Private Const CREATE_NEW = 1
  35.  
  36. ' Enumerazione dei comandi per la CmnGetHDData
  37. Private Enum HDINFO
  38.     HD_MODEL_NUMBER
  39.     HD_SERIAL_NUMBER
  40.     HD_FIRMWARE_REVISION
  41. End Enum
  42.  
  43. ' Struttura per l'individuazione della versione di OS
  44. Private Type OSVERSIONINFO
  45.     dwOSVersionInfoSize As Long
  46.     dwMajorVersion As Long
  47.     dwMinorVersion As Long
  48.     dwBuildNumber As Long
  49.     dwPlatformId As Long
  50.     szCSDVersion As String * 128
  51. End Type
  52.  
  53. ' Struttura per il campo irDriveRegs della struttura SENDCMDINPARAMS
  54. Private Type IDEREGS
  55.     bFeaturesReg As Byte
  56.     bSectorCountReg As Byte
  57.     bSectorNumberReg As Byte
  58.     bCylLowReg As Byte
  59.     bCylHighReg As Byte
  60.     bDriveHeadReg As Byte
  61.     bCommandReg As Byte
  62.     bReserved As Byte
  63. End Type
  64.  
  65. ' Struttura per l'I/O dei comandi al driver IDE
  66. Private Type SENDCMDINPARAMS
  67.     cBufferSize As Long
  68.     irDriveRegs As IDEREGS
  69.     bDriveNumber As Byte
  70.     bReserved(1 To 3) As Byte
  71.     dwReserved(1 To 4) As Long
  72. End Type
  73.  
  74. ' Struttura per il campo DStatus della struttura SENDCMDOUTPARAMS
  75. Private Type DRIVERSTATUS
  76.     bDriveError As Byte
  77.     bIDEStatus As Byte
  78.     bReserved(1 To 2) As Byte
  79.     dwReserved(1 To 2) As Long
  80. End Type
  81.  
  82. ' Struttura per l'I/O dei comandi al driver IDE
  83. Private Type SENDCMDOUTPARAMS
  84.     cBufferSize As Long
  85.     DStatus As DRIVERSTATUS     ' ovvero DriverStatus
  86.     bBuffer(1 To 512) As Byte
  87. End Type
  88.  
  89. ' Per ottenere la versione del SO
  90. Private Declare Function GetVersionEx _
  91.     Lib "kernel32" Alias "GetVersionExA" _
  92.     (lpVersionInformation As OSVERSIONINFO) As Long
  93.  
  94. ' Per ottenere un handle al device IDE
  95. Private Declare Function CreateFile _
  96.     Lib "kernel32" Alias "CreateFileA" _
  97.     (ByVal lpFileName As String, _
  98.     ByVal dwDesiredAccess As Long, _
  99.     ByVal dwShareMode As Long, _
  100.     ByVal lpSecurityAttributes As Long, _
  101.     ByVal dwCreationDisposition As Long, _
  102.     ByVal dwFlagsAndAttributes As Long, _
  103.     ByVal hTemplateFile As Long) As Long
  104.  
  105. ' Per chiudere l'handle del device IDE
  106. Private Declare Function CloseHandle _
  107.     Lib "kernel32" _
  108.     (ByVal hObject As Long) As Long
  109.  
  110. ' Per comunicare con il driver IDE
  111. Private Declare Function DeviceIoControl _
  112.     Lib "kernel32" _
  113.     (ByVal hDevice As Long, _
  114.     ByVal dwIoControlCode As Long, _
  115.     lpInBuffer As Any, _
  116.     ByVal nInBufferSize As Long, _
  117.     lpOutBuffer As Any, _
  118.     ByVal nOutBufferSize As Long, _
  119.     lpBytesReturned As Long, _
  120.     ByVal lpOverlapped As Long) As Long
  121.  
  122. ' Per azzerare buffer di scambio dati
  123. Private Declare Sub ZeroMemory _
  124.     Lib "kernel32" Alias "RtlZeroMemory" _
  125.     (dest As Any, _
  126.     ByVal numBytes As Long)
  127.  
  128. ' Per copiare porzioni di memoria
  129. Private Declare Sub CopyMemory _
  130.     Lib "kernel32" Alias "RtlMoveMemory" _
  131.     (Destination As Any, _
  132.     Source As Any, _
  133.     ByVal Length As Long)
  134.  
  135. Private Declare Function GetLastError _
  136.     Lib "kernel32" () As Long
  137.  
  138. Private mvarCurrentDrive As Byte    ' Drive corrente
  139. Private mvarPlatform As String      ' Piattaforma usata
  140.  
  141. Public Property Get Copyright() As String
  142.  
  143.     ' Copyright
  144.     Copyright = "HDSN Vrs. 1.00, (C) Antonio Giuliana, 2001-2003"
  145.  
  146. End Property
  147.  
  148. ' Metodo GetModelNumber
  149. Public Function GetModelNumber() As String
  150.  
  151.     ' Ottiene il ModelNumber
  152.     GetModelNumber = CmnGetHDData(HD_MODEL_NUMBER)
  153.  
  154. End Function
  155.  
  156. ' Metodo GetSerialNumber
  157. Public Function GetSerialNumber() As String
  158.  
  159.     ' Ottiene il SerialNumber
  160.     GetSerialNumber = CmnGetHDData(HD_SERIAL_NUMBER)
  161.  
  162. End Function
  163.  
  164. ' Metodo GetFirmwareRevision
  165. Public Function GetFirmwareRevision() As String
  166.  
  167.     ' Ottiene la FirmwareRevision
  168.     GetFirmwareRevision = CmnGetHDData(HD_FIRMWARE_REVISION)
  169.  
  170. End Function
  171.  
  172. ' Proprieta' CurrentDrive
  173. Public Property Let CurrentDrive(ByVal vData As Byte)
  174.  
  175.     ' Controllo numero di drive fisico IDE
  176.     If vData < 0 Or vData > 3 Then
  177.         Err.Raise 10000, , "Illegal drive number"   ' IDE drive 0..3
  178.     End If
  179.  
  180.     ' Nuovo drive da considerare
  181.     mvarCurrentDrive = vData
  182.  
  183. End Property
  184.  
  185. ' Proprieta' CurrentDrive
  186. Public Property Get CurrentDrive() As Byte
  187.  
  188.     ' Restituisce drive fisico corrente (IDE 0..3)
  189.     CurrentDrive = mvarCurrentDrive
  190.  
  191. End Property
  192.  
  193. ' Proprieta' Platform
  194. Public Property Get Platform() As String
  195.  
  196.     ' Restituisce tipo OS
  197.     Platform = mvarPlatform
  198.  
  199. End Property
  200.  
  201. Private Sub Class_Initialize()
  202.  
  203.     ' Individuazione del tipo di OS
  204.     Dim OS As OSVERSIONINFO
  205.  
  206.     OS.dwOSVersionInfoSize = Len(OS)
  207.     Call GetVersionEx(OS)
  208.     mvarPlatform = "Unk"
  209.     Select Case OS.dwPlatformId
  210.         Case Is = VER_PLATFORM_WIN32S
  211.             mvarPlatform = "32S"                ' Win32S
  212.         Case Is = VER_PLATFORM_WIN32_WINDOWS
  213.             If OS.dwMinorVersion = 0 Then
  214.                 mvarPlatform = "W95"            ' Win 95
  215.             Else
  216.                 mvarPlatform = "W98"            ' Win 98
  217.             End If
  218.         Case Is = VER_PLATFORM_WIN32_NT
  219.             mvarPlatform = "WNT"                ' Win NT/2000
  220.     End Select
  221.  
  222. End Sub
  223.  
  224. Private Function CmnGetHDData(hdi As HDINFO) As String
  225.  
  226.     ' Rilevazione proprieta' IDE
  227.  
  228.     Dim bin As SENDCMDINPARAMS
  229.     Dim bout As SENDCMDOUTPARAMS
  230.     Dim hdh As Long
  231.     Dim br As Long
  232.     Dim ix As Long
  233.     Dim hddfr As Long
  234.     Dim hddln As Long
  235.     Dim s As String
  236.  
  237.     Select Case hdi             ' Selezione tipo caratteristica richiesta
  238.         Case HD_MODEL_NUMBER
  239.             hddfr = 55          ' Posizione nel buffer del ModelNumber
  240.             hddln = 40          ' Lunghezza nel buffer del ModelNumber
  241.         Case HD_SERIAL_NUMBER
  242.             hddfr = 21          ' Posizione nel buffer del SerialNumber
  243.             hddln = 20          ' Lunghezza nel buffer del SerialNumber
  244.         Case HD_FIRMWARE_REVISION
  245.             hddfr = 47          ' Posizione nel buffer del FirmwareRevision
  246.             hddln = 8           ' Lunghezza nel buffer del FirmwareRevision
  247.         Case Else
  248.             Err.Raise 10001, "Illegal HD Data type" ' Altre informazioni non disponibili 
  249.  
  250. (Evoluzione futura)
  251.     End Select
  252.  
  253.     Select Case mvarPlatform
  254.         Case "WNT"
  255.             ' Per Win NT/2000 apertura handle al drive fisico
  256.             hdh = CreateFile("\\.\PhysicalDrive" & mvarCurrentDrive, _
  257.                 GENERIC_READ + GENERIC_WRITE, FILE_SHARE_READ + FILE_SHARE_WRITE, _
  258.                 0, OPEN_EXISTING, 0, 0)
  259.         Case "W95", "W98"
  260.             ' Per Win 9X apertura handle al driver SMART
  261.             ' (in \WINDOWS\SYSTEM da spostare in \WINDOWS\SYSTEM\IOSUBSYS)
  262.             ' che comunica con il driver IDE
  263.             hdh = CreateFile("\\.\Smartvsd", _
  264.                 0, 0, 0, CREATE_NEW, 0, 0)
  265.         Case Else
  266.             ' Piattaforma non supportata (Win32S)
  267.             Err.Raise 10002, , "Illegal platform (only WNT, W98 or W95)"    ' Altre piattaforme 
  268.  
  269. non gestite
  270.     End Select
  271.     ' Controllo validità handle
  272.     If hdh = 0 Then
  273.         Err.Raise 10003, , "Error on CreateFile"
  274.     End If
  275.  
  276.     ' Azzeramento strutture per l'I/O da driver
  277.     ZeroMemory bin, Len(bin)
  278.     ZeroMemory bout, Len(bout)
  279.  
  280.     ' Preparazione parametri struttura di richiesta al driver
  281.     With bin
  282.         .bDriveNumber = mvarCurrentDrive
  283.         .cBufferSize = 512
  284.         With .irDriveRegs
  285.             If (mvarCurrentDrive And 1) Then
  286.                 .bDriveHeadReg = &HB0
  287.             Else
  288.                 .bDriveHeadReg = &HA0
  289.             End If
  290.             .bCommandReg = &HEC
  291.             .bSectorCountReg = 1
  292.             .bSectorNumberReg = 1
  293.         End With
  294.     End With
  295.  
  296.     ' Richiesta al driver
  297.     DeviceIoControl hdh, DFP_RECEIVE_DRIVE_DATA, _
  298.                     bin, Len(bin), bout, Len(bout), br, 0
  299.  
  300.     ' Formazione stringa di risposta
  301.     ' da buffer di uscita
  302.     ' L'ordine dei byte e' invertito
  303.     s = ""
  304.     For ix = hddfr To hddfr + hddln - 1 Step 2
  305.         If bout.bBuffer(ix + 1) = 0 Then Exit For
  306.         s = s & Chr(bout.bBuffer(ix + 1))
  307.         If bout.bBuffer(ix) = 0 Then Exit For
  308.         s = s & Chr(bout.bBuffer(ix))
  309.     Next ix
  310.  
  311.     ' Chiusura handle
  312.     CloseHandle hdh
  313.  
  314.     ' Restituzione informazione richiesta
  315.     CmnGetHDData = Trim(s)
  316.  
  317. End Function
In the form, place a combobox with values 0,1,2,3 represents Primary Master, Primary Slave,

Secondary Master & Secondary Slave HDDs.

Code is
Expand|Select|Wrap|Line Numbers
  1. Dim h As HDSN
  2.  
  3. Private Sub cmdGo_Click()
  4.  
  5.     Dim hT As Long
  6.     Dim uW() As Byte
  7.     Dim dW() As Byte
  8.     Dim pW() As Byte
  9.  
  10.     Set h = New HDSN
  11.  
  12.     With h
  13.         .CurrentDrive = Val(cbDrive.Text)
  14.  
  15.         lstInfo.Clear
  16.         lstInfo.AddItem "Current drive: " & .CurrentDrive
  17.         lstInfo.AddItem ""
  18.         lstInfo.AddItem "Model number: " & .GetModelNumber
  19.         lstInfo.AddItem "Serial number: " & .GetSerialNumber
  20.         lstInfo.AddItem "Firmware Revision: " & .GetFirmwareRevision
  21.         lstInfo.AddItem ""
  22.         lstInfo.AddItem "Copyright: " & .Copyright
  23.     End With
  24.  
  25.     Set h = Nothing
  26.  
  27. End Sub
  28.  
  29. Private Sub Form_Load()
  30.     cbDrive.ListIndex = 0
  31. End Sub
--------------------------------------------------------------------
Hope this will help you...
Thanks
Raj
Dec 12 '07 #6
Killer42
8,435 Recognized Expert Expert
One of best way to configure a tool to run only on a particular machine is using the MANUFACTURER SERIAL NUMBER OF THE HARD DISK, which is UNIQUE. ...
Perhaps so. But don't forget to allow for cases where a HDD is replaced. They don't last forever. That's one of the things that makes "activation" such a pain.
Dec 13 '07 #7
Rajkumar GS
4 New Member
Perhaps so. But don't forget to allow for cases where a HDD is replaced. They don't last forever. That's one of the things that makes "activation" such a pain.

Hi,

Yes, that's the ONLY problem where client can cheat us!

Do you have any !dea to overcome this?

Raj
Dec 14 '07 #8
Killer42
8,435 Recognized Expert Expert
Do you have any !dea to overcome this?
Yes. Don't bother with the whole copy-protection farce. It just increases your development costs without any real benefit to anybody.
Dec 15 '07 #9
ragav33333
3 New Member
Hi.

I am also searching for the same concept. Do you know any means? Please send, very urgent.
Dec 18 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

21
42984
by: Gavin | last post by:
Hi, I'm a newbie to programming of any kind. I have posted this to other groups in a hope to get a response from anyone. Can any one tell me how to make my VB program read the Bios serial number...
3
5330
by: ^CeFoS^ | last post by:
Hi to everybody, due to I want to use the serial port of a server machine through an applet allocated in html document. > Then one application will run in the server machine and using > the serial...
5
2662
by: | last post by:
Hi, Do memory sticks have serial numbers like harddrives? If so how can I get this, I want to uniquely identify a memory stick (removable drive) for authentication. Thanks
79
13963
by: Klaus Bonadt | last post by:
In order to protect software from being copied without licence, I would like to use something like a key, which fits only to the current system. The serial number of the CPU or the current...
8
2610
by: Nitin | last post by:
Hello, We are trying to figure out how to get a unique identifier for a machine. Our application is a C# windows application that talks to our server via a webservice. Every time our webservice...
0
946
by: Joby | last post by:
Dear All, I am very new to web technologies. I am working on .NET compact framework(Pocket PC application). I put my probleme in front of you. I have a server, where i am hosting my web page. When...
18
7305
by: JJ | last post by:
Now I know this question has been asked many times, but I cannot seem to find a good site which summarises the methods possible in vb .net. I am after a way of producing a unique serial number...
9
20648
by: Nebojsa4 | last post by:
Hi. First, sorry on my weak English to all. Qusetion: How to read (in VB) Manufacturer serial number of Hard disk drive? Not volume/serial number of C:, D:, etc. partitons. For reading...
0
7148
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7367
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7430
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7517
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5673
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5072
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3230
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1581
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
790
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.