about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCaroline Leman <CarolineLe@users.noreply.github.com>2020-05-18 13:09:02 +0200
committerCaroline Leman <CarolineLe@users.noreply.github.com>2020-05-18 14:04:55 +0200
commit8eaba0bd8accc4965d6f0a50747453edd4a9300c (patch)
treecd1dbab2163bb32991e1da9e97a46d6342e34f19
parent9d73a9baa14e6062250a56a95182dc23de3ba779 (diff)
downloadmiasm-8eaba0bd8accc4965d6f0a50747453edd4a9300c.tar.gz
miasm-8eaba0bd8accc4965d6f0a50747453edd4a9300c.zip
Win_api: fix kernel32_MultiByteToWideChar
According to the documentation, if cchWideChar is 0, then
the required size for the buffer indicated by lpWideCharStr
is returned.
-rw-r--r--miasm/os_dep/win_api_x86_32.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/miasm/os_dep/win_api_x86_32.py b/miasm/os_dep/win_api_x86_32.py
index 67178f05..ac2d5f09 100644
--- a/miasm/os_dep/win_api_x86_32.py
+++ b/miasm/os_dep/win_api_x86_32.py
@@ -1644,7 +1644,8 @@ def kernel32_MultiByteToWideChar(jitter):
                                              "cchwidechar"])
     src = get_win_str_a(jitter, args.lpmultibytestr)
     l = len(src) + 1
-    set_win_str_w(jitter, args.lpwidecharstr, src)
+    if args.cchwidechar != 0:
+        set_win_str_w(jitter, args.lpwidecharstr, src)
     jitter.func_ret_stdcall(ret_ad, l)