I am trying to find the value of the digitalproductid for Windows on a 64bit machine with a 32bit application. I know about WOW6432bit information but I cannot figure out how to change my code to match what needs to happen. Any suggestions is appreciated. Thank you!
Try
Dim regKey As RegistryKey
'GET THE WINDOWS DIGITAL PRODUCT ID
If frmComputerSummary.txtArchitecture.Text.Contains("x86") Or frmComputerSummary.txtArchitecture.Text.Contains("X86") Then
regKey = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, frmComputerSummary.txtComputerName.Text).OpenSubKey("SOFTWARE\Microsoft\Windows NT\CurrentVersion")
Else
regKey = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, frmComputerSummary.txtComputerName.Text).OpenSubKey("SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion")
End If
Dim digiID As Byte()
digiID = regKey.GetValue("DigitalProductId")
'CONVERT THE DIGITAL PRODUCT ID TO A STRING VALUE
' Dim strDigiID As String
' strDigiID = BitConverter.ToString(digiID)
'TO PASS DIGITAL PRODUCT ID AS STRING UNCOMMENT THE ABOVE 2 LINES AND PUT THAT IN THE DECODEDIGITALPRODUCTID FUNCTION TO PASS ON
'CALL THE FUNCTION TO DECODE THE PRODUCT ID AND PASS THE DIGITALPRODUCTID STRING TO IT
DecodeDigitalProductID(digiID, "Windows")
txtVersionPurchased.Text = frmComputerSummary.txtOS.Text
Catch EX As Exception
If EX.ToString.Contains("Value Cannot Be Null") Then
Me.txtKeyCode.Text = "Not Available - No Digital Product ID Found"
End If
MsgBox(EX.Message)
End Try
The error just keeps telling me that my digiID is null meaning that it cannot find the 64bit system's digitalproductid. I cannot change the assembly to 64bit as it will mess with our environment for deployment. So is there any other way to get the digitalproductid via remote registry or am I putting the 'WOW' part in the wrong spot? Thank you!
This post has been edited by Atli: 12 October 2012 - 12:38 PM
Reason for edit:: Use [code] tags when posting code.

New Topic/Question
Reply



MultiQuote


|