mirror of
https://github.com/qilingframework/qiling.git
synced 2026-10-12 02:21:40 +00:00
Fix #1433
This commit is contained in:
+11
-4
@@ -153,7 +153,10 @@ class QlOsUtils:
|
||||
|
||||
va_list = __dup(va_args, orig_args)
|
||||
|
||||
read_string = self.read_wstring if wstring else self.read_cstring
|
||||
read_str = {
|
||||
False: self.read_cstring,
|
||||
True: self.read_wstring
|
||||
}
|
||||
|
||||
def __repl(m: re.Match) -> str:
|
||||
"""Convert printf format string tokens into Python's.
|
||||
@@ -187,9 +190,13 @@ class QlOsUtils:
|
||||
typ = m['type']
|
||||
arg = next(va_list)
|
||||
|
||||
if typ in 'sS':
|
||||
if typ == 's':
|
||||
typ = 's'
|
||||
arg = read_string(arg)
|
||||
arg = read_str[wstring](arg)
|
||||
|
||||
elif typ == 'S':
|
||||
typ = 's'
|
||||
arg = read_str[not wstring](arg)
|
||||
|
||||
elif typ == 'Z':
|
||||
# note: ANSI_STRING and UNICODE_STRING have identical layout
|
||||
@@ -197,7 +204,7 @@ class QlOsUtils:
|
||||
|
||||
with ucstr_struct.ref(self.ql.mem, arg) as ucstr_obj:
|
||||
typ = 's'
|
||||
arg = read_string(ucstr_obj.Buffer)
|
||||
arg = read_str[wstring](ucstr_obj.Buffer)
|
||||
|
||||
elif typ == 'p':
|
||||
pound = '#'
|
||||
|
||||
Reference in New Issue
Block a user