Note that there are some explanatory texts on larger screens.

plurals
  1. POError throwing on Target CPU: x86
    primarykey
    data
    text
    <p>I got a problem with this function i use to retrieve the product key from my computer.</p> <pre><code> 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 = String.Empty For l As Integer = LBound(CType(HexBuf, Array)) To UBound(CType(HexBuf, Array)) tmp = tmp &amp; " " &amp; Hex(CByte(AscW(HexBuf.ToString(1)))) 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 = String.Empty Dim notbuffer As Array = CType(HexBuf, Array) For i = StartOffset To EndOffset HexDigitalPID(i - StartOffset) = notbuffer.GetValue(i).ToString tmp2 = tmp2 &amp; " " &amp; Hex(HexDigitalPID(i - StartOffset)) Next Dim KEYSTRING As String = String.Empty For i As Integer = dLen - 1 To 0 Step -1 If ((i + 1) Mod 6) = 0 Then Des(i) = "-" KEYSTRING = KEYSTRING &amp; "-" Else Dim HN As Integer = 0 For N As Integer = (sLen - 1) To 0 Step -1 Dim Value As Integer = CInt(CLng((HN * 2 ^ 8)) Or CLng(HexDigitalPID(N))) HexDigitalPID(N) = (Value \ 24).ToString HN = (Value Mod 24) Next Des(i) = Digits(HN) KEYSTRING = KEYSTRING &amp; Digits(HN) End If Next Return StrReverse(KEYSTRING) End Function </code></pre> <p>This works well if i compile using x64 or AnyCPU architecture, but if i put x86 (which is what i want) it throws me this error: <a href="http://i.imgur.com/Kfpa7mh.png" rel="nofollow">http://i.imgur.com/Kfpa7mh.png</a></p> <p>It says: "Cannot associate the object type System.Int32 to System.Array" I can't figure out the problem, i can't do a for Next with that arguments? Why this works with x64 and AnyCPU (Still x64 since i got a 64-bit OS) and not x86?</p> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload