summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/modules/pe_get_module_handle.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/modules/pe_get_module_handle.c b/src/modules/pe_get_module_handle.c
index 0efb1eb..64e804b 100644
--- a/src/modules/pe_get_module_handle.c
+++ b/src/modules/pe_get_module_handle.c
@@ -26,7 +26,7 @@ void * pe_get_first_module_handle(void)
return peb_ldr_tbl_entry->dll_base;
}
-pe_api
+
void * pe_get_module_handle(const wchar16_t * name)
{
wchar16_t * src;
@@ -52,21 +52,26 @@ void * pe_get_module_handle(const wchar16_t * name)
if (ldr_tbl_entry->base_dll_name.strlen == len)
dst = (wchar16_t *)ldr_tbl_entry->base_dll_name.buffer;
+
else if (ldr_tbl_entry->full_dll_name.strlen == len)
dst = (wchar16_t *)ldr_tbl_entry->full_dll_name.buffer;
+
else
dst = (wchar16_t *)0;
+
if ((intptr_t)(dst)) {
src = (wchar16_t *)name;
match = 0;
while ((match < len)
- && ((pe_impl_utf16_char_to_lower(*src)) == (pe_impl_utf16_char_to_lower(*dst)))) {
- src = (wchar16_t *)pe_va_from_rva(src,sizeof(wchar16_t));
- dst = (wchar16_t *)pe_va_from_rva(dst,sizeof(wchar16_t));
- match+=sizeof(wchar16_t);
- }
+ && ((pe_impl_utf16_char_to_lower(*src))
+ == (pe_impl_utf16_char_to_lower(*dst)))) {
+ src = (wchar16_t *)pe_va_from_rva(src,sizeof(wchar16_t));
+ dst = (wchar16_t *)pe_va_from_rva(dst,sizeof(wchar16_t));
+ match+=sizeof(wchar16_t);
+ }
+
if (match == len)
return ldr_tbl_entry->dll_base;
@@ -75,6 +80,5 @@ void * pe_get_module_handle(const wchar16_t * name)
plist_current = plist_current->flink;
} while (plist_current != plist_head);
- /* address not found */
return 0;
}