I was able to do this in the past on previous occasions and now it does not work.
The program just doesn't open.
Form1_Load:
Dim Test as String = ""
Dim Test2 as String = ""
EP_RegLoadKeyA(Test, Test2)
Me.Text = "Licensed to: " + Test
No longer functions at all. It used to state who the license was for...
The program opens without the protection on it, but once protected, it never actually opens. Windows Event Viewer shows that it crashed.
UPDATE: Now in further investigation... it appears if I put the application through ILMerge it works after... what's going on here?
Pulling License Data results in crash of program
Re: Pulling License Data results in crash of program
Hi, sorry, is it Visual Basic 6?
Can you change the code to this:
Can you change the code to this:
Code: Select all
Dim Test as String
Dim Test2 as String
If EP_RegLoadKeyA(Test, Test2) Then
Me.Text = "Licensed to: " + Test
EndIf
Re: Pulling License Data results in crash of program
I will try that, but if I use ILMerge on the application and not even merging it with anything else, it works with the same code I posted above. It's just very strange.
I'm using newer VB.NET, not VB6.
Target = .NETFramework4+
I'm using newer VB.NET, not VB6.
Target = .NETFramework4+
Re: Pulling License Data results in crash of program
For VB.NET to load a registration name and key, use functions EP_RegistrationLoadKeyA or EP_RegistrationLoadKeyW (depending on Registration Features - Common - Unicode option) from Enigma_IDE.vb.
It looks as following:
It looks as following:
Code: Select all
Public Shared Function EP_RegistrationLoadKeyA(ByRef Name As String, ByRef Key As String) As Boolean
Name = InlineAssignHelper(Key, String.Empty)
Dim namelen As Integer = 0, keylen As Integer = 0
If EP_RegLoadKeyEx(IntPtr.Zero, namelen, IntPtr.Zero, keylen) <> LOADKEY_REGINFONOTFOUND Then
Dim namebuf As Byte() = New Byte(namelen - 1) {}
Dim keybuf As Byte() = New Byte(keylen - 1) {}
If EP_RegLoadKeyEx(Marshal.UnsafeAddrOfPinnedArrayElement(namebuf, 0), namelen, Marshal.UnsafeAddrOfPinnedArrayElement(keybuf, 0), keylen) = LOADKEY_SUCCEEDED Then
Name = Encoding.ASCII.GetString(namebuf)
Key = Encoding.ASCII.GetString(keybuf)
Return True
End If
End If
Return False
End Function