getprocaddress

Calling WinSock functions using LoadLibrary and GetProcAddress

主宰稳场 提交于 2019-12-11 07:09:25
问题 Basically I have a header file like this: #if WIN32 typedef DWORD (WSAAPI *SocketStartup) (WORD wVersionRequested, LPWSADATA lpWSAData); typedef SOCKET (WINAPI *MakeSocket)(IN int af, IN int type, IN int protocol, IN LPWSAPROTOCOL_INFOW lpProtocolInfo, IN GROUP g, IN DWORD dwFlags ); typedef DWORD (WINAPI *SocketSendFunc) (IN SOCKET s,__in_bcount(len) const char FAR * buf, IN int len,IN int flags); typedef DWORD (WINAPI *GetLastSocketErrorFunc)(); typedef DWORD (WINAPI *ShutdownSocketFunc)

GetProcAddress returns NULL

主宰稳场 提交于 2019-12-11 03:17:33
问题 I have to use a simple function from a DLL; I am able to load the library but GetProcAddress returns NULL. I think I understood name mangling but maybe I'm doing something wrong. Thanks (Code follows, asap I'll add other information required): mydll.h #ifdef MYDLL_EXPORTS #define MYDLL_API extern "C" __declspec(dllexport) #else #define MYDLL_API extern "C" __declspec(dllimport) #endif MYDLL_API void testFunction(void); MYDLL_API LRESULT CALLBACK mouseProc(int nCode, WPARAM wParam, LPARAM

Addresses of Delphi and C++ WinAPI functions differ when they shouldn't

孤人 提交于 2019-12-11 00:05:02
问题 In C++, if you try to get a function pointer of a Windows API function, that pointer points to the same address you would get if you used GetProcAddress on the name of that function and it's respective module. For example: &MessageBoxA == GetProcAddress("User32.dll", "MessageBoxA"); would be true . However, in Delphi, that is not the case. This code: @MessageBoxA = GetProcAddress('User32.dll', 'MessageBoxA'); Would not be true , and in my test, @MessageBoxA was 0x0040bd18 while the equivalent

Regarding GetProcAddress

回眸只為那壹抹淺笑 提交于 2019-12-08 12:02:50
问题 I have got MyDll.dll and its function defined as below void pascal Myfunction(BOOL); when I'm trying to use the function in another project i am unable get the address of the function with GetProcAddress() . Here is my code: void callMyDll() { HINSTANCE hDll; hDll=LoadLibrary(_T("MyDll.dll"); if(hDll!=NULL) { cout<<"\n DLL Loaded \n"; } else cout<<"\n DLL Not loaded\n" typedef void (__stdcall *MyFunction)(bool) Myfunction mf1 = (MyFunction) GetProcAddress(hDll, "MyFunction"); if (mf1!=NULL)

Make a VB-dll and load it in C++ application

狂风中的少年 提交于 2019-12-07 14:32:44
问题 I have a problem I've been struggeling with for a full week now, and I'm not able to solve it by myself. I've been googeling, and searching in all kind of forums... I have found lots of "this might work", tried it, but no, no success. If anyone have any clue, please, please, help me! I'v got, from an external source, lots of classes and functions written in VB that I need to be able to use from a C++ application. My first though was: no problem, I turn the VB code into a dll, and load it from

Error: QOpenGLShader: could not create shader - when compiling QtQuick applications with Qt5.2 Mingw OpenGL

匿名 (未验证) 提交于 2019-12-03 02:30:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I've downloaded and installed "Qt 5.2 mingw (opengl and x86)" version. When i run Qt projects with this version of Qt, there is no problem. But when i run a Qt Quick application, the program crash and following messages log in debug: getProcAddress: Unable to resolve 'glGenRenderbuffers' getProcAddress: Unable to resolve 'glGenRenderbuffersOES' getProcAddress: Unable to resolve 'glGenRenderbuffersARB' getProcAddress: Unable to resolve 'glGenRenderbuffersEXT' getProcAddress: Unable to resolve 'glBindRenderbuffer' getProcAddress: Unable to

GetModuleHandle(), for a DLL in another process

江枫思渺然 提交于 2019-12-01 11:04:23
The title explains this all really, I have a process tapping into another process. I need to be able to GetModuleHandle, on this program for a certain DLL which isn't Windows standard, and I don't have the source code to the main program. I need to use it to call an exported function with GetProcAddress and in the end use it in CreateRemoteThread to remotely start a task on that program. Is there anyway I can get a ModuleHandle from another program, instead of the local program it is creating the remote thread with? Thanks. Smith_61 I see three possible solutions to this. As far as I know,

GetModuleHandle(), for a DLL in another process

南楼画角 提交于 2019-12-01 07:36:40
问题 The title explains this all really, I have a process tapping into another process. I need to be able to GetModuleHandle, on this program for a certain DLL which isn't Windows standard, and I don't have the source code to the main program. I need to use it to call an exported function with GetProcAddress and in the end use it in CreateRemoteThread to remotely start a task on that program. Is there anyway I can get a ModuleHandle from another program, instead of the local program it is creating

C++代码注入

我们两清 提交于 2019-12-01 02:38:05
一、C++代码注入原则: 在注入代码中不允许使用API。 在注入代码中不允许使用全局变量。 在注入代码中不允许使用字符串(编译时也被当做全局变量)。 在注入代码中不允许使用函数嵌套。 二、注入代码编写思路: 在本进程通过获取 LoadLibraryA 与 GetProcess 函数的地址。 涉及一组参数,里面包括 {函数地址、模块地址、函数名、传递参数}。 传入进去后,利用LoadLibraryA 与 GetProcess 函数,在注入代码中直接现场"加载模块-获取函数-调用",来达到调用API的目的。 三、编写过程的几个坑: 使用typedef定义函数指针,先在msdn搜索函数原型,复制过去,将名字定义成指针并大写。 申请内存时的权限,参数的内存使用 PAGE_READWRITE权限;代码的内存使用PAGE_EXECUTE_READWRITE权限,否则代码无法被执行。 一定要预先在msdn上搜索确定函数要加载的模块以及函数名,这一步很容易出错。如果出错只能调试被注入程序获取结果,比较麻烦。 四、olldbg调试思路: 在 "选项-调试设置-事件"中勾选“中断于新线程”。 注入后就可以在新线程上一步步进行调试。 五、源代码(练习了两套,一套是注入MessageBoxA,另一套是注入CreateFileA) 1 // 代码注入.cpp : 此文件包含 "main" 函数

GetProcAddress cannot find my functions

喜你入骨 提交于 2019-11-29 11:28:47
I made a DLL with a function named "render()" and I want to load it dynamically to my application, but GetProcAddress cannot find it. Here's the DLL .h: #ifdef D3D_API_EXPORTS #define D3D_API_API __declspec(dllexport) #else #define D3D_API_API __declspec(dllimport) #endif D3D_API_API void render(); And here's DLL .cpp: #include "stdafx.h" #include "D3D_API.h" #include <iostream> D3D_API_API void render() { std::cout << "method called." << std::endl; } Here's the application that tries to use that function: #include "stdafx.h" #include <windows.h> #include <iostream> int _tmain(int argc, _TCHAR