[HELP] Getting Windows Product ID

Posts 1–15 of 16 · Page 1 of 2
[HELP] Getting Windows Product ID
How Would i make a form that tells u the Windows Product ID

(eg) Button1 gets clicked then textBox1 tells u the Windows product ID
Windows product ID?

Do you mean HWID?
No lolland, HWID is PC specific and exisits on all machines (including non windows OS) he physically means your Windows OEM or Standard Product key, it is quite simple actually.

This is not my code, but should help, it is MSDN and modified by a programmer named Brandon

[php]
Public Function GetProductKey(ByVal KeyPath As String, ByVal ValueName As String) As String

Dim HexBuf As Object = My.Computer.Registry.GetValue(KeyPath, ValueName, 0)

If HexBuf Is Nothing Then Return "N/A"

Dim tmp As String = ""

For l As Integer = LBound(HexBuf) To UBound(HexBuf)
tmp = tmp & " " & Hex(HexBuf(l))
Next

Dim StartOffset As Integer = 52
Dim EndOffset As Integer = 67
Dim Digits(24) As String

Digits(0) = "B" : Digits(1) = "C" : Digits(2) = "D" : Digits(3) = "F"
Digits(4) = "G" : Digits(5) = "H" : Digits(6) = "J" : Digits(7) = "K"
Digits(8) = "M" : Digits(9) = "P" : Digits(10) = "Q" : Digits(11) = "R"
Digits(12) = "T" : Digits(13) = "V" : Digits(14) = "W" : Digits(15) = "X"
Digits(16) = "Y" : Digits(17) = "2" : Digits(18) = "3" : Digits(19) = "4"
Digits(20) = "6" : Digits(21) = "7" : Digits(22) = "8" : Digits(23) = "9"

Dim dLen As Integer = 29
Dim sLen As Integer = 15
Dim HexDigitalPID(15) As String
Dim Des(30) As String

Dim tmp2 As String = ""

For i = StartOffset To EndOffset
HexDigitalPID(i - StartOffset) = HexBuf(i)
tmp2 = tmp2 & " " & Hex(HexDigitalPID(i - StartOffset))
Next

Dim KEYSTRING As String = ""

For i As Integer = dLen - 1 To 0 Step -1
If ((i + 1) Mod 6) = 0 Then
Des(i) = "-"
KEYSTRING = KEYSTRING & "-"
Else
Dim HN As Integer = 0
For N As Integer = (sLen - 1) To 0 Step -1
Dim Value As Integer = ((HN * 2 ^ 8) Or HexDigitalPID(N))
HexDigitalPID(N) = Value \ 24
HN = (Value Mod 24)

Next

Des(i) = Digits(HN)
KEYSTRING = KEYSTRING & Digits(HN)
End If
Next

Return StrReverse(KEYSTRING)

End Function
[/php]

Just create a module, add this code then call the function inside your source.

Example

For windows XP
[php]
'the key location is
GetProductKey("HKEY_LOCAL_MACHINE\SOFTWARE\Microso ft\Windows NT\CurrentVersion\", "DigitalProductId")
[/php]

You can also use some basic code to determine what version of windows is running then use Google to find out the registry location




Thanks NextGen1 Was really helpful

it said
Statement is Not Valid In NameSpace
Quote Originally Posted by GameTrainerMaker View Post
Thanks NextGen1 Was really helpful

it said
Statement is Not Valid In NameSpace
He made an error in the code, try it now.
Not a problem , anytime.
i already put the " P " on public once i C&Ped it, but it still said :S
Yeah, Forgot the P in Public function.

Statement not valid in namespace however means you put the code above the
Public Class yada, it should be in between Public Class ModuleName and End Class.
Quote Originally Posted by NextGen1 View Post
Yeah, Forgot the P in Public function.

Statement not valid in namespace however means you put the code above the
Public Class yada, it should be in between Public Class ModuleName and End Class.
lol Namespace sounds kinda c++ like
A namespace is universal, not language specific btw.
Quote Originally Posted by Jason View Post
A namespace is universal, not language specific btw.
but i mean in every c++ program it is using namespace
Quote Originally Posted by qddW$#%^jtyjtyj View Post
but i mean in every c++ program it is using namespace
Only uses it 1 time in the beginning: using namespace std;
or if you're coding more advanced there are a few others you need :O
Guys, this is vb section, not c++
Quote Originally Posted by SpamFag View Post
Guys, this is vb section, not c++
did you miss something?
Quote Originally Posted by 'Bruno View Post
did you miss something?
Probably the part where you get a brain
Posts 1–15 of 16 · Page 1 of 2
This thread is closed for replies.

Similar Threads

Talk with us