Execution of the function DisplayRegistrationStr always generates an exception.
I am using the example in topic 'Integrate Licensing support in C++ applications' (http://www.advancedinstaller.com/user-g ... using.html).
Sample C++ code below:
Code: Select all
void CMFCApplication1Dlg::OnBnClickedButton1()
{
HMODULE hModule = ::LoadLibrary(L"Trial.dll");
if(hModule == NULL)
return; // Missing Trial DLL;
typedef UINT(__stdcall * TrialFcn)(LPCSTR, HWND);
TrialFcn displayRegProc = reinterpret_cast<TrialFcn>(::GetProcAddress(hModule, "DisplayRegistrationStr"));
if(displayRegProc == NULL)
{
::FreeLibrary(hModule);
return; // Missing Trial DLL;
}
// Return values:
// "0" - the application is registered (a valid license key was found/entered);
// "2" - the application is in trial mode;
int ret = displayRegProc(aKeyCode, (HWND)this->GetSafeHwnd());
::FreeLibrary(hModule);
}
Code: Select all
First-chance exception at 0x0F0649A2 (Trial.dll) in MFCApplication1.exe: 0xC0000005: Access violation reading location 0x00000020.
Unhandled exception at 0x0F0649A2 (Trial.dll) in MFCApplication1.exe: 0xC000041D: Wystąpił nieoczekiwany wyjątek podczas wywołania zwrotnego użytkownika.
Code: Select all
0F064994 mov eax,dword ptr [ebx+18h]
0F064997 mov eax,dword ptr [eax+edi*4]
0F06499A jmp 0F06498D
0F06499C push ebx
0F06499D mov ebx,ecx
0F06499F push ebp
0F0649A0 push esi
0F0649A1 push edi
0F0649A2 mov esi,dword ptr [ebx+20h] <<<<< this line generate an exeption; ebx is always 0
0F0649A5 xor edi,edi
0F0649A7 sub esi,dword ptr [ebx+1Ch]
0F0649AA sar esi,2
0F0649AD test esi,esi
0F0649AF je 0F0649E5
0F0649B1 mov ebp,dword ptr [esp+14h]
0F0649B5 cmp dword ptr [ebp+14h],8
0F0649B9 jb 0F0649C0
0F0649BB mov ecx,dword ptr [ebp]
0F0649BE jmp 0F0649C2
What am I doing wrong?
FOLLOW US
Get the latest news in Application Packaging