File tree Expand file tree Collapse file tree 1 file changed +21
-11
lines changed
libmwemu/src/emu/winapi64 Expand file tree Collapse file tree 1 file changed +21
-11
lines changed Original file line number Diff line number Diff line change @@ -2767,17 +2767,28 @@ pub fn FindActCtxSectionStringW(emu: &mut emu::Emu) {
27672767}
27682768
27692769fn GetModuleHandleA ( emu : & mut emu:: Emu ) {
2770- let module_name = emu. maps . read_string ( emu. regs . rcx ) ;
2771- let handle = get_library_handle ( emu, & module_name) ;
2770+ let module_name_ptr = emu. regs . rcx ;
2771+ let module_name: String ;
2772+
2773+ if module_name_ptr == 0 {
2774+ module_name = "self" . to_string ( ) ;
2775+ emu. regs . rax = match emu. maps . get_base ( ) {
2776+ Some ( base) => base,
2777+ None => helper:: handler_create ( & module_name) ,
2778+ }
2779+ } else {
2780+ let module_name = emu. maps . read_string ( module_name_ptr) ;
2781+ let handle = get_library_handle ( emu, & module_name) ;
27722782
2773- log:: info!(
2774- "{}** {} kernel32!GetModuleHandleA module_name: {} handle: 0x{:x} {}" ,
2775- emu. colors. light_red,
2776- emu. pos,
2777- module_name,
2778- handle,
2779- emu. colors. nc
2780- ) ;
2783+ log:: info!(
2784+ "{}** {} kernel32!GetModuleHandleA module_name: {} handle: 0x{:x} {}" ,
2785+ emu. colors. light_red,
2786+ emu. pos,
2787+ module_name,
2788+ handle,
2789+ emu. colors. nc
2790+ ) ;
2791+ }
27812792
27822793 emu. regs . rax = handle;
27832794}
@@ -2797,4 +2808,3 @@ fn GetModuleHandleW(emu: &mut emu::Emu) {
27972808
27982809 emu. regs . rax = handle;
27992810}
2800-
You can’t perform that action at this time.
0 commit comments