getprocaddress

GetProcAddress function in C++

痴心易碎 提交于 2019-11-27 19:51:15
Hello guys: I've loaded my DLL in my project but whenever I use the GetProcAddress function. it returns NULL! what should I do? I use this function ( double GetNumber(double x) ) in "MYDLL.dll" Here is a code which I used: typedef double (*LPGETNUMBER)(double Nbr); HINSTANCE hDLL = NULL; LPGETNUMBER lpGetNumber; hDLL = LoadLibrary(L"MYDLL.DLL"); lpGetNumber = (LPGETNUMBER)GetProcAddress((HMODULE)hDLL, "GetNumber"); Checking return codes and calling GetLastError() will set you free. You should be checking return codes twice here. You are actually checking return codes zero times. hDLL =

缓冲区溢出攻击

耗尽温柔 提交于 2019-11-27 16:38:29
缓冲区溢出是目前最常见的一种安全问题,操作系统以及应用程序大都存在缓冲区溢出漏洞。缓冲区是一段连续内存空间,具有固定的长度。缓冲区溢出是由编程错误引起的,当程序向缓冲区内写入的数据超过了缓冲区的容量,就发生了缓冲区溢出,缓冲区之外的内存单元被程序“非法”修改。 一般情况下,缓冲区溢出导致应用程序的错误或者运行中止,但是,攻击者利用程序中的漏洞,精心设计出一段入侵程序代码,覆盖缓冲区之外的内存单元,这些程序代码就可以被CPU所执行,从而获取系统的控制权。 8.1 缓冲区溢出攻击原理 1. 局部变量与堆栈的关系 在一个程序中,会声明各种变量。静态全局变量是位于数据段并且在程序开始运行的时候被初始化,而局部变量则在堆栈中分配,只在该函数内部有效。 如果局部变量使用不当,会造成缓冲区溢出漏洞。例如,以下程序将命令行的第1个参数拷贝到buf局部变量中。 int main(int argc, char **argv) { char buf[80]; strcpy(buf, argv[1]); } 在一次函数调用中,堆栈中将被依次压入:参数、返回地址。如果函数有局部变量,接下来,就在堆栈中开辟相应的空间(SUB ESP,x)以构造变量。函数执行结束时,恢复堆栈到函数调用的地址,弹出返回地址到EIP以继续执行程序。 例如,调用函数main(int argc, char **argv)时

GetProcAddress function in C++

99封情书 提交于 2019-11-27 04:23:06
问题 Hello guys: I've loaded my DLL in my project but whenever I use the GetProcAddress function. it returns NULL! what should I do? I use this function ( double GetNumber(double x) ) in "MYDLL.dll" Here is a code which I used: typedef double (*LPGETNUMBER)(double Nbr); HINSTANCE hDLL = NULL; LPGETNUMBER lpGetNumber; hDLL = LoadLibrary(L"MYDLL.DLL"); lpGetNumber = (LPGETNUMBER)GetProcAddress((HMODULE)hDLL, "GetNumber"); 回答1: Checking return codes and calling GetLastError() will set you free. You

Load 32bit DLL library in 64bit application

别等时光非礼了梦想. 提交于 2019-11-26 18:54:42
Is there a way to load a 32bit DLL library (something with the same usage as LoadLibrary) I would like to use that function along with GetProcAddress. I looked at WOW, but it does not seem to offer the functionality. The functionality should exist, since tools like DependencyWalker are able to read the symbols of a 32bit dll even though its 64bits. thanks John Knoeller Sorry, but you can only load a 32bit DLL into a 64 bit process when you are loading the dll as a datafile. You can't execute the code. http://support.microsoft.com/kb/282423 Microsoft recommends that you use interprocess COM to

Load 32bit DLL library in 64bit application

二次信任 提交于 2019-11-26 05:35:05
问题 Is there a way to load a 32bit DLL library (something with the same usage as LoadLibrary) I would like to use that function along with GetProcAddress. I looked at WOW, but it does not seem to offer the functionality. The functionality should exist, since tools like DependencyWalker are able to read the symbols of a 32bit dll even though its 64bits. thanks 回答1: Sorry, but you can only load a 32bit DLL into a 64 bit process when you are loading the dll as a datafile. You can't execute the code.