Results 1 to 15 of 15

Thread: Microsoft Product Activation

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2001
    Posts
    115

    Cool Microsoft Product Activation

    Hi All,

    Does anyone have the sample code to implement the anti-piracy protection like MPA ? What i really need to know is how to retrieve the unique hardware info for a machine and how to generate the confirmation code for that machine. Thanks.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    What hardware information are you looking for? This will get you the hard drives unique serial number (if that is any help).
    VB Code:
    1. Private Declare Function GetVolumeInformation Lib _
    2.         "kernel32.dll" Alias "GetVolumeInformationA" (ByVal _
    3.         lpRootPathName As String, ByVal lpVolumeNameBuffer As _
    4.         String, ByVal nVolumeNameSize As Integer, _
    5.         lpVolumeSerialNumber As Long, lpMaximumComponentLength _
    6.         As Long, lpFileSystemFlags As Long, ByVal _
    7.         lpFileSystemNameBuffer As String, ByVal _
    8.         nFileSystemNameSize As Long) As Long
    9.  
    10. Private Function GetSerialNumber(strDrive As String) As Long
    11.     Dim SerialNum As Long
    12.     Dim Res As Long
    13.     Dim Temp1 As String
    14.     Dim Temp2 As String
    15.     Temp1 = String$(255, Chr$(0))
    16.     Temp2 = String$(255, Chr$(0))
    17.     Res = GetVolumeInformation(strDrive, Temp1, _
    18.             Len(Temp1), SerialNum, 0, 0, Temp2, Len(Temp2))
    19.     GetSerialNumber = SerialNum
    20. End Function
    21.  
    22. 'Add this code To the Command button or sub routine/function
    23.  
    24. Private Sub Command1_Click()
    25.     Call MsgBox(GetSerialNumber("C:\"))
    26. End Sub

  3. #3
    jim mcnamara
    Guest
    What is usually done is to take machine specific information - Hack gave you a way to do that - then put it into some kind of GUID-like string or other long hex string.

    Also, consider just generating a list of GUID's, then have your program check any of them.


    Sample code to make a GUID with no input. From allapi.net
    Code:
    Private Declare Function CoCreateGuid Lib "ole32" (id As Any) As Long
    Private Sub Form_Load()
        MsgBox "Generated GUID: " + CreateGUID
    End Sub
    Public Function CreateGUID() As String
        Dim id(0 To 15) As Byte
        Dim Cnt As Long, GUID As String
        If CoCreateGuid(id(0)) = 0 Then
            For Cnt = 0 To 15
                CreateGUID = CreateGUID + IIf(id(Cnt) < 16, "0", "") + Hex$(id(Cnt))
            Next Cnt
            CreateGUID = Left$(CreateGUID, 8) + "-" + Mid$(CreateGUID, 9, 4) + "-" + Mid$(CreateGUID, 13, 4) + "-" + Mid$(CreateGUID, 17, 4) + "-" + Right$(CreateGUID, 12)
        Else
            MsgBox "Error while creating GUID!"
        End If
    End Function

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jan 2001
    Posts
    115
    Thanks guys. My intention is to protect my software by applying one copy one machine, just like MPA. I got pretty good idea from your reply. Thanks a lot.

  5. #5
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288
    I am not sure about this, but the unique serial no is changed every time you reformat the Hard disk.

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Jan 2001
    Posts
    115
    Yes. But if the hardware is changed, then the software has to be reinstalled, just like office XP. Formatting C drive should be considered as hardware change. Anyway, formatting C drive is not a frequent task. If user does so, then he has to get new confirmation key. I actually uses the SN# of C as Machine ID for testing purpose. I think it is simple. Thanks.

  7. #7
    jim mcnamara
    Guest
    I believe it's the volume label that can be/is changed.
    The serial # is fixed by the manufacturer.

  8. #8
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288
    No, Volume Label is an obvious thing. Even the Serial no gets changed.

  9. #9
    jim mcnamara
    Guest
    Well.

    I disagree based on experience - not direct knowledge of formatting. I had to low-level format 20 hard disks because the hardware guy was gone. Talk about boring. At any rate - the serial #'s did not change because we kept inventory based on serial #. I had to enter info about each one - before & after the format & rebuild.

    It really doesn't matter. Just my experience. YMMV.

  10. #10
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288
    Then it seems that I might be confused in this matter. We had discussed this matter once earlier also, and quite a few of them had the same experience. But It might be that I am confused right now as that post was quite a long time back.

  11. #11
    Fanatic Member Kzin's Avatar
    Join Date
    Dec 2000
    Posts
    611
    Originally posted by jim mcnamara
    Well.

    I disagree based on experience - not direct knowledge of formatting. I had to low-level format 20 hard disks because the hardware guy was gone. Talk about boring. At any rate - the serial #'s did not change because we kept inventory based on serial #. I had to enter info about each one - before & after the format & rebuild.

    It really doesn't matter. Just my experience. YMMV.
    We've also found that on some taiwanese OEM hardware the HDD numbers were the same
    Looking for a friendly intelligent chat forum? Visit the white-hart.net

  12. #12
    Junior Member
    Join Date
    Nov 2001
    Posts
    23
    interesting guys!

    But how do the customer get a new valid key?
    he calls you, give you the S/N of his HD and you generate one?

  13. #13

    Thread Starter
    Lively Member
    Join Date
    Jan 2001
    Posts
    115

    Cool

    he calls you, give you the S/N of his HD and you generate one?
    Yes, customer needs to contact the software provider. But in stead of directly asking the customer to provide the hardware parameters, the software itself will generate an encoded string based on the specified hardware info. on the user's machine. Customer should not be aware of what' kind of info is collected and how the encoded string is generated. After getting that string, software provider will return the customer a confirmation key to match that encoded string to keep the software running. That's is my understanding.

  14. #14
    Member
    Join Date
    Apr 2001
    Location
    Emden, Germany
    Posts
    63
    Let me tell you something as annoyed Microsoft user. I hate this product activation garbage. People who play around with their computer quite a lot have to call Microsoft/your company quite a lot. This is definitely annoying.
    Use a hardware key instead. That also provides good anti-piracy protection and does not make your customers angry.
    WIN 2000 Prof. / WIN 98 / WIN 95, IE6.0, Mathematica 4.0
    Visual Studio Enterprise 6.0 sp5

  15. #15

    Thread Starter
    Lively Member
    Join Date
    Jan 2001
    Posts
    115
    Use a hardware key instead. That also provides good anti-piracy protection and does not make your customers angry.
    Yes, i understand that MPA will cause some problems. But hardware key is also sort of pain . My company's software right now is using hardware key attached to LPT. I got a lot of complain about the key compatible issues with printers. The worst thing is some notebooks even don't have the LPT port, USB port only. From my point of view, it all depends on how critic of the information you collect. I am not going to collect very detail info about the machine. Maybe just the SN of C driver that is hardly changed . Since the users of my software are only small group of people with limited computer knowledge, i think it should work. Anyway, thank you for your suggestion.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width