access violation 0xC0000005 when calling func in dll
-
access violation 0xC0000005 when calling func in dll hi,guys: ask for your kind help. thanks in advance. typedef int (WINAPI * _DLL_FOO)(int, char **, int, char **, LPDCL, LPUSERFUNCTIONS); ...... _DLL_FOO m_PFoo; ...... LoadLibrary successfully。 m_PFoo = (_DLL_FOO)GetProcAddress(m_hDll, "Foo"); //successfully 326: retval = (*m_PFoo)(infc, infv, exfc, exfv, m_lpDCL, m_lpUserFunctions); 004440D2 mov esi,esp 004440D4 mov eax,dword ptr [ebp-4] 004440D7 mov ecx,dword ptr [eax+0B8h] 004440DD push ecx 004440DE mov edx,dword ptr [ebp-4] 004440E1 mov eax,dword ptr [edx+0BCh] 004440E7 push eax 004440E8 mov ecx,dword ptr [ebp-10h] 004440EB push ecx 004440EC mov edx,dword ptr [ebp-8] 004440EF push edx 004440F0 mov eax,dword ptr [ebp-14h] 004440F3 push eax 004440F4 mov ecx,dword ptr [ebp-0Ch] 004440F7 push ecx 004440F8 mov edx,dword ptr [ebp-4] 004440FB call dword ptr [edx+0B0h] <== here access violation 0xC0000005 00444101 cmp esi,esp 00444103 call __chkesp (00451fa0) 00444108 mov dword ptr [ebp-11Ch],eax 327: when failure edx+0B0h == 0x009796b0 009796b0:B0 D4 11 02 CD CD CD CD 38 7B 14 00 78 A4 14 00 00 00 11 02 CD CD CD CD 38 7B 14 00 78 A4 14 00 The address of func m_PFoo is 0x0211D4B0, it's all right. What 's the problem with my program and how to fix it ? Thank you very much !
-
access violation 0xC0000005 when calling func in dll hi,guys: ask for your kind help. thanks in advance. typedef int (WINAPI * _DLL_FOO)(int, char **, int, char **, LPDCL, LPUSERFUNCTIONS); ...... _DLL_FOO m_PFoo; ...... LoadLibrary successfully。 m_PFoo = (_DLL_FOO)GetProcAddress(m_hDll, "Foo"); //successfully 326: retval = (*m_PFoo)(infc, infv, exfc, exfv, m_lpDCL, m_lpUserFunctions); 004440D2 mov esi,esp 004440D4 mov eax,dword ptr [ebp-4] 004440D7 mov ecx,dword ptr [eax+0B8h] 004440DD push ecx 004440DE mov edx,dword ptr [ebp-4] 004440E1 mov eax,dword ptr [edx+0BCh] 004440E7 push eax 004440E8 mov ecx,dword ptr [ebp-10h] 004440EB push ecx 004440EC mov edx,dword ptr [ebp-8] 004440EF push edx 004440F0 mov eax,dword ptr [ebp-14h] 004440F3 push eax 004440F4 mov ecx,dword ptr [ebp-0Ch] 004440F7 push ecx 004440F8 mov edx,dword ptr [ebp-4] 004440FB call dword ptr [edx+0B0h] <== here access violation 0xC0000005 00444101 cmp esi,esp 00444103 call __chkesp (00451fa0) 00444108 mov dword ptr [ebp-11Ch],eax 327: when failure edx+0B0h == 0x009796b0 009796b0:B0 D4 11 02 CD CD CD CD 38 7B 14 00 78 A4 14 00 00 00 11 02 CD CD CD CD 38 7B 14 00 78 A4 14 00 The address of func m_PFoo is 0x0211D4B0, it's all right. What 's the problem with my program and how to fix it ? Thank you very much !
I don't think you need that pointer to call the function since it's already a pointer, so 326 becomes:
retval = (m_PFoo)(infc, infv, exfc, exfv, m_lpDCL, m_lpUserFunctions);
Ian Mariano - http://www.ian-space.com/
"We are all wave equations in the information matrix of the universe" - me