diff options
| author | Adrien Guinet <adrien@guinet.me> | 2017-10-31 08:16:17 +0100 |
|---|---|---|
| committer | Camille Mougey <commial@gmail.com> | 2017-10-31 08:16:17 +0100 |
| commit | 33dccf7012673882bef35b9afd9fb986881a8168 (patch) | |
| tree | d3f31c219a4ed5227c3a08d0003bc4b9a4494e37 /miasm2/os_dep/linux_stdlib.py | |
| parent | 1e1b3282704700328d23a96d4da402715f554f9e (diff) | |
| download | miasm-33dccf7012673882bef35b9afd9fb986881a8168.tar.gz miasm-33dccf7012673882bef35b9afd9fb986881a8168.zip | |
Various Win32 API additions/fixes (#616)
Various Win32 API additions/fixes
* add a get_size method to Miasm heap object, which allows the
implementation of mscvrt_realloc
* add the concept of "current directory", with the default value being
arbitrary set to "c:\tmp", which allows the implementation of
{Get,Set}CurrentDirecrtory
* various other methods implemented:
- advapi32_RegCloseKey
- advapi32_RegCreateKeyW
- advapi32_RegSetValueExA
- advapi32_RegSetValueExW
- kernel32_GetProcessHeap
- msvcrt_delete
- msvcrt_fprintf
- msvcrt_fwrite
- msvcrt__mbscpy
- msvcrt_new
- msvcrt_realloc
- msvcrt_sprintf
- msvcrt_srand
- msvcrt_strrchr
- msvcrt_swprintf
- msvcrt_wcscat
- msvcrt_wcscmp
- msvcrt_wcscpy
- msvcrt__wcsicmp
- msvcrt_wcslen
- msvcrt_wcsncpy
- msvcrt__wcsnicmp
- msvcrt_wcsrchr
Diffstat (limited to 'miasm2/os_dep/linux_stdlib.py')
| -rw-r--r-- | miasm2/os_dep/linux_stdlib.py | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/miasm2/os_dep/linux_stdlib.py b/miasm2/os_dep/linux_stdlib.py index 9e68454c..d0e281a1 100644 --- a/miasm2/os_dep/linux_stdlib.py +++ b/miasm2/os_dep/linux_stdlib.py @@ -4,6 +4,7 @@ from sys import stdout from string import printable from miasm2.os_dep.common import heap +from miasm2.os_dep.common import get_fmt_args as _get_fmt_args class c_linobjs(object): @@ -104,28 +105,7 @@ def xxx_puts(jitter): def get_fmt_args(jitter, fmt, cur_arg): - output = "" - while True: - char = jitter.vm.get_mem(fmt, 1) - fmt += 1 - if char == '\x00': - break - if char == '%': - token = '%' - while True: - char = jitter.vm.get_mem(fmt, 1) - fmt += 1 - token += char - if char.lower() in '%cdfsux': - break - if token.endswith('s'): - arg = jitter.get_str_ansi(jitter.get_arg_n_systemv(cur_arg)) - else: - arg = jitter.get_arg_n_systemv(cur_arg) - char = token % arg - cur_arg += 1 - output += char - return output + return _get_fmt_args(fmt, cur_arg, jitter.get_str_ansi, jitter.get_arg_n_systemv) def xxx_snprintf(jitter): |