|
-
Oct 25th, 2001, 09:34 AM
#1
Thread Starter
Lively Member
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.
-
Nov 5th, 2001, 01:17 PM
#2
What hardware information are you looking for? This will get you the hard drives unique serial number (if that is any help).
VB Code:
Private Declare Function GetVolumeInformation Lib _
"kernel32.dll" Alias "GetVolumeInformationA" (ByVal _
lpRootPathName As String, ByVal lpVolumeNameBuffer As _
String, ByVal nVolumeNameSize As Integer, _
lpVolumeSerialNumber As Long, lpMaximumComponentLength _
As Long, lpFileSystemFlags As Long, ByVal _
lpFileSystemNameBuffer As String, ByVal _
nFileSystemNameSize As Long) As Long
Private Function GetSerialNumber(strDrive As String) As Long
Dim SerialNum As Long
Dim Res As Long
Dim Temp1 As String
Dim Temp2 As String
Temp1 = String$(255, Chr$(0))
Temp2 = String$(255, Chr$(0))
Res = GetVolumeInformation(strDrive, Temp1, _
Len(Temp1), SerialNum, 0, 0, Temp2, Len(Temp2))
GetSerialNumber = SerialNum
End Function
'Add this code To the Command button or sub routine/function
Private Sub Command1_Click()
Call MsgBox(GetSerialNumber("C:\"))
End Sub
-
Nov 5th, 2001, 01:31 PM
#3
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
-
Nov 5th, 2001, 01:39 PM
#4
Thread Starter
Lively Member
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.
-
Nov 5th, 2001, 02:07 PM
#5
PowerPoster
I am not sure about this, but the unique serial no is changed every time you reformat the Hard disk.
-
Nov 5th, 2001, 02:59 PM
#6
Thread Starter
Lively Member
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.
-
Nov 5th, 2001, 02:59 PM
#7
I believe it's the volume label that can be/is changed.
The serial # is fixed by the manufacturer.
-
Nov 5th, 2001, 03:05 PM
#8
PowerPoster
No, Volume Label is an obvious thing. Even the Serial no gets changed.
-
Nov 5th, 2001, 03:14 PM
#9
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.
-
Nov 5th, 2001, 03:18 PM
#10
PowerPoster
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.
-
Nov 13th, 2001, 12:32 PM
#11
Fanatic Member
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 
-
Nov 15th, 2001, 03:39 PM
#12
Junior Member
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?
-
Nov 15th, 2001, 05:30 PM
#13
Thread Starter
Lively Member
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.
-
Nov 16th, 2001, 09:39 AM
#14
Member
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
-
Nov 16th, 2001, 09:58 AM
#15
Thread Starter
Lively Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|