- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我在研究 ZeuS 恶意软件时遇到了 source code :
HMODULE _getKernel32Handle(void)
{
#if defined _WIN64
return NULL; //FIXME
#else
__asm
{
cld //clear the direction flag for the loop
mov edx, fs:[0x30] //get a pointer to the PEB
mov edx, [edx + 0x0C] //get PEB-> Ldr
mov edx, [edx + 0x14] //get the first module from the InMemoryOrder module list
next_mod:
mov esi, [edx + 0x28] //get pointer to modules name (unicode string)
mov ecx, 24 //the length we want to check
xor edi, edi //clear edi which will store the hash of the module name
loop_modname:
xor eax, eax //clear eax
lodsb //read in the next byte of the name
cmp al, 'a' //some versions of Windows use lower case module names
jl not_lowercase
sub al, 0x20 //if so normalise to uppercase
not_lowercase:
ror edi, 13 //rotate right our hash value
add edi, eax //add the next byte of the name to the hash
loop loop_modname //loop until we have read enough
cmp edi, 0x6A4ABC5B //compare the hash with that of KERNEL32.DLL
mov eax, [edx + 0x10] //get this modules base address
mov edx, [edx] //get the next module
jne next_mod //if it doesn't match, process the next module
};
#endif
}
逻辑如下:
fs
段寄存器(32 位 Windows 将 TEB 存储在那里)PEB
的指针>PEB_LDR_DATA
的指针(包含有关进程已加载模块的信息)InMemoryOrder
列表"kernel32.dll"
进行比较为什么 GetModuleHandle
的使用在那里不合适?
最佳答案
代码片段正在尝试获取 kernel32.dll 的模块句柄(即基地址),可能是因为它还没有此模块的句柄。 GetModuleHandle从 kernel32.dll 导出。当您不知道其地址时,您无法调用函数。
关于c++ - 编写自定义 GetModuleHandle 函数的原因是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37027248/
我正在阅读 ,它描述了 GetModuleHandle() API 如下: 当您调用此函数时,您会传递一个以零结尾的字符串,该字符串指定加载到调用进程地址空间中的可执行文件或 DLL 文件的名称。 如
DWORD baseAddress = (DWORD) GetModuleHandle(NULL); 如果我将该代码放入 DLL 并将其注入(inject)到进程中,那么它似乎等于注入(inject)
标题真的解释了这一切,我有一个进程进入另一个进程。我需要能够在这个程序上为某个不是 Windows 标准的 DLL 获取模块句柄,而且我没有主程序的源代码。 我需要使用它来调用带有 GetProcAd
我在研究 ZeuS 恶意软件时遇到了 source code : HMODULE _getKernel32Handle(void) { #if defined _WIN64 return NULL
有没有办法在 Linux 上通过 GetModuleHandle(NULL) 将该句柄传递给 dlsym 3 最佳答案 documentation对于 dlopen(3) 状态: The functi
在使用 Windows API 进行编程时,我总是将 WinMain 中的 HINSTANCE 立即设为全局变量。如果我想做一个 OK 按钮,我会这样做(给定全局 HINSTANCE g_hInsta
一旦加载到内存中,我正在尝试获取我的进程的图像库。据我了解,您可以调用 GetModuleHandle 来获取图像库。我的问题是,返回的句柄是否基本上指向 IMAGE_DOS_HEADER 结构,以便
我只是想根据一个很可能类似于“somefile.exe”的字符串来获取模块信息。 MODULEINFO GetModuleInfo(char *szModule) { MODULEINFO m
一旦我的进程加载到内存中,我就试图获取它的图像库。据我了解,您可以调用 GetModuleHandle 来获取图像库。我的问题是,返回的句柄是否实质上指向 IMAGE_DOS_HEADER 结构,以便
我是 C++ 的新手,即使我知道文件存在,这段代码总是返回 NULL: HMODULE hModule = GetModuleHandle(TEXT("C:\\Users\\Steve\\Deskto
我在我的函数中使用了 GetModuleHandle。每次我执行操作时都会调用该函数。我想知道该函数是否被一次又一次地调用,GetModuleHandle 是否会导致任何句柄泄漏(堆栈溢出或内存泄漏或
我正在开发一个与 native DLL 交互的 Web 服务,我使用 LoadLibrary/GetModuleHandle/FreeLIbrary 和 GetProcAddress 来动态加载/卸载
我正在尝试在 Windows Phone 8.0 native C++ 库上加载 winsock dll。 HMODULE ws2mod = GetModuleHandle("ws2_32.dll"
我正在尝试使用 Python 的 C 类型来调用 kernel32 库上的 GetModuleHandleA。我想获得该库的句柄,以便我可以使用它来调用 LoadLibraryA 的 GetProcA
这是我的代码: function GetProcedureAddress(var P: FARPROC; const ModuleName, ProcName: AnsiString): Boolea
这个问题在这里已经有了答案: GetModuleHandle(), for a DLL in another process (1 个回答) 关闭 4 年前。 我正在尝试获取由 notepad.ex
当使用下面的代码时,似乎即使我将 TheFST.dll 链接到调试信息 (/DEBUG),我也无法在断点处停止函数 setSecurityRetriever。 调用 GetModuleHandle 时
我使用的是 Windows 7 Professional x64。 我需要 Hook DefWindowProcW 过程。但是当我尝试通过 GetProcAddress() 获取它的地址时,它返回位于
在许多情况下加载一些较新的 API 会使用这样的构造: (FARPROC&)pfnZwQueryVirtualMemory = ::GetProcAddress(::GetModuleHandle(L
我是一名优秀的程序员,十分优秀!