Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. access violation 0xC0000005 when calling func in dll

access violation 0xC0000005 when calling func in dll

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    suninwater
    wrote on last edited by
    #1

    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 1 Reply Last reply
    0
    • S suninwater

      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 Offline
      I Offline
      ian mariano
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups