Jo Hey Leute...
Hab ein kleines Problem mit dem Windows Key.
Also ich lese ihn so aus:
Code:
Public Function WindowsProductKey() As String
Dim RegKey As RegistryKey = _
Registry.LocalMachine.OpenSubKey("Software\Microsoft\Windows NT\CurrentVersion", False)
Dim bytDPID() As Byte = RegKey.GetValue("DigitalProductID")
Dim bytKey(14) As Byte
Array.Copy(bytDPID, 52, bytKey, 0, 15)
Dim strChar As String = "BCDFGHJKMPQRTVWXY2346789"
Dim strKey As String = ""
For j As Integer = 0 To 24
Dim nCur As Short = 0
For i As Integer = 14 To 0 Step -1
nCur = CShort(nCur * 256 Xor bytKey(i))
bytKey(i) = CByte(Int(nCur / 24))
nCur = CShort(nCur Mod 24)
Next
strKey = strChar.Substring(nCur, 1) & strKey
Next
For i As Integer = 4 To 1 Step -1
strKey = strKey.Insert(i * 5, "-")
Next
RegKey.Close()
Return strKey
End Function
Das klappt auch perfekt, jedoch nur wenn die erstellte Anwendung in 64Bit läuft. Also nicht im Virtelluellen 32 Bit Mode...
Wenn ich die Exe als 32 Bit erstelle klappt auch alles, nur liefert die Variable bytDPID() Nothing zurück. Aber als 64Bit anwendung funktioniert es perfket.
Was ist da der unterschied?