Skip to content

Commit

Permalink
Added GlobalFlags
Browse files Browse the repository at this point in the history
  • Loading branch information
sacx committed Dec 14, 2022
1 parent ad77fd7 commit 813dccd
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions speakeasy/winenv/api/usermode/kernel32.py
Original file line number Diff line number Diff line change
Expand Up @@ -1958,6 +1958,26 @@ def GlobalSize(self, emu, argv, ctx={}):

return size

@apihook('GlobalFlags', argc=1)
def GlobalFlags(self, emu, argv, ctx={}):
'''
UINT GlobalFlags(
[in] HGLOBAL hMem
);
'''
hMem, = argv
flags = 0
for mmap in emu.get_mem_maps():
if hMem == mmap.get_base():
flags = mmap.get_flags()
emu.set_last_error(windefs.ERROR_SUCCESS)

if not flags:
emu.set_last_error(windefs.ERROR_INVALID_PARAMETER)
flags = 0x8000 #GMEM_INVALID_HANDLE

return flags

@apihook('LocalAlloc', argc=2)
def LocalAlloc(self, emu, argv, ctx={}):
'''
Expand Down

0 comments on commit 813dccd

Please sign in to comment.