diff options
| author | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2015-07-02 16:13:33 +0200 |
|---|---|---|
| committer | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2015-07-02 16:14:14 +0200 |
| commit | 6e9e58aef34a466753ca66eeb4058ce6652d98bd (patch) | |
| tree | 6fe6075532508126af4e47f47741436ca5caa42a | |
| parent | f489ea360c38792bc4c382f25c0a0439307f6156 (diff) | |
| download | miasm-6e9e58aef34a466753ca66eeb4058ce6652d98bd.tar.gz miasm-6e9e58aef34a466753ca66eeb4058ce6652d98bd.zip | |
Win_api: Support null file mapping
| -rw-r--r-- | miasm2/os_dep/win_api_x86_32.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/miasm2/os_dep/win_api_x86_32.py b/miasm2/os_dep/win_api_x86_32.py index 62254a66..5c0f3b8e 100644 --- a/miasm2/os_dep/win_api_x86_32.py +++ b/miasm2/os_dep/win_api_x86_32.py @@ -23,6 +23,7 @@ import time import string import logging from zlib import crc32 +from StringIO import StringIO try: from Crypto.Hash import MD5, SHA @@ -2175,10 +2176,18 @@ def kernel32_CreateFileMapping(jitter, funcname, get_str): "dwmaximumsizelow", "lpname"]) # f = get_str(jitter, args.lpname) if args.lpname else None - if not args.hfile in winobjs.handle_pool: - raise ValueError('unknown handle') + if args.hfile == 0xffffffff: + # Create null mapping + if args.dwmaximumsizehigh: + raise NotImplementedError("Untested case") + hmap = StringIO("\x00"*args.dwmaximumsizelow) + hmap_handle = winobjs.handle_pool.add('filemem', hmap) - ret = winobjs.handle_pool.add('filemapping', args.hfile) + ret = winobjs.handle_pool.add('filemapping', hmap_handle) + else: + if not args.hfile in winobjs.handle_pool: + raise ValueError('unknown handle') + ret = winobjs.handle_pool.add('filemapping', args.hfile) jitter.func_ret_stdcall(ret_ad, ret) |