Getprocaddress Error Codes
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more what is getprocaddress about Stack Overflow the company Business Learn more about hiring developers or posting getprocaddress failed. last error is 127 ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack getprocaddress c++ example Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up GetProcAddress() failing, error 127 up vote 0 down vote favorite Here's loadlibrary failed with error 127 my DLL code: #include std::cout< Forum Visual C++ & C++ Programming Visual C++ Programming Error 127 on a getProcAddress call If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register or Login before you can post: click the register link above to proceed. error_proc_not_found To start viewing messages, select the forum that you want to visit from the selection below. Results 1 to 5 of 5 Thread: getlasterror 127 Error 127 on a getProcAddress call Tweet Thread Tools Show Printable Version Email this Page… Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode June 5th, 2009,05:27 AM #1 Unull View Profile http://stackoverflow.com/questions/25877507/getprocaddress-failing-error-127 View Forum Posts Junior Member Join Date Jun 2009 Posts 6 Error 127 on a getProcAddress call Hello, I´m developing an application to hook mouse click using Visual Studio 2005. I´ve created a DLL called bloq_mouse.dll. To create this DLL I wrote an bloq_mouse.h defining the functions to be exportable: #define DLLEXPORT __declspec(dllexport) std::vector< std:air< POINT , POINT > > coords; DLLEXPORT int loadBloqCoords(const char config[_MAX_PATH]); DLLEXPORT LRESULT CALLBACK mouseHookProc(int nCode, WPARAM wParam, LPARAM lParam); I http://forums.codeguru.com/showthread.php?478450-Error-127-on-a-getProcAddress-call also created an .def file : LIBRARY bloq_mouse EXPORTS loadBloqCoords mouseHookProc And then, in a separate project, I´ve created an executable with this code: hinstDLL = LoadLibraryA("bloq_mouse.dll"); if( hinstDLL == NULL ) { //send error message } FARPROC lpfnGetProcess = GetProcAddress(hinstDLL, "loadBloqCoords"); if(lpfnGetProcess == NULL ) { //send error message } The DLL seems to load succesfully (I copied it in the executable´s project dir) but when I try to access loadBloqCoords function I get an 127 error (cannot find the proccess). I´m new with DLL making and accessing, Can Anyone Help Me? Thanks. Reply With Quote June 5th, 2009,08:28 AM #2 Paul McKenzie View Profile View Forum Posts Elite Member Power Poster Join Date Apr 1999 Posts 27,449 Re: Error 127 on a getProcAddress call Originally Posted by Unull The DLL seems to load succesfully (I copied it in the executable´s project dir) but when I try to access loadBloqCoords function I get an 127 error (cannot find the proccess). Always check using a utility such as Dependency Walker (depends.exe) or dumpbin to ensure that the actual function name you're trying to get the address of is actually exported using that very same name. More than likely, the function wasn't exported, or it was exported with a decorated name (not the name you're calling GetProcAddress() with). Regards, Paul McKenzie Reply With Quote June 5th, is successful (does not http://www.cplusplus.com/forum/windows/44641/ return NULL), however GetProcAddress fails (returns NULL). 1Getprocaddress Return Null
Getprocaddress Ordinal
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
if(hook_setup_func == NULL) { HINSTANCE hook_instance; if(((hook_instance = LoadLibrary(_T("hook.dll"))) != NULL) && ((hook_uninstall_func = (hook_uninstall_type)GetProcAddress(hook_instance,"hook_uninstall")) != NULL) && ((hook_install_func = (hook_install_type)GetProcAddress(hook_instance,"hook_install")) != NULL)) { if((hook_setup_func = (hook_setup_type)GetProcAddress(hook_instance,"hook_setup")) == NULL) { throw std::runtime_error("Couldn't install the hook, case error 127 1"); } } else { //this throws error throw std::runtime_error("Couldn't install the hook, case 2"); } } here's the corressponding declaration: 1
2
3
4
5
6
typedef void (*hook_setup_type)(HWND, BOOL); typedef BOOL (*hook_install_type)(); typedef void (*hook_uninstall_type)(); hook_setup_type hook_setup_func; hook_install_type hook_install_func; hook_uninstall_type hook_uninstall_func; and in the dll file: 1
2
3
4
5
getprocaddress error codes __declspec(dllexport) void hook_setup(HWND hwnd, BOOL use_the_hook); __declspec(dllexport) BOOL hook_install(); __declspec(dllexport) void hook_uninstall(); EDIT: error code is 127 any ideas why it fails? Best regards, Yours3!f Last edited on Jun 11, 2011 at 7:16pm UTC Jun 11, 2011 at 7:55pm UTC Xander314 (1383) Have you put the DLL lines inside 1
2
3
extern "C" { } Otherwise, the symbol names are "scrambled" by the compiler (they have a load of numbers and symbols stuck on depending on return type, etc). Thus they are not called what you expect without the extern "C" bit. Jun 11, 2011 at 8:02pm UTC Yours3lf (91) thank you Xander314, extern "C" solved the problem :) Topic archived. No new replies allowed. C++ Information Tutorials Reference Articles Forum Forum BeginnersWindows ProgrammingUNIX/Linux ProgrammingGeneral C++ ProgrammingLoungeJobs Home page | Privacy policy