Skip to content

Commit 513bdee

Browse files
committed
Use binary mode on Windows host for emulation of non-Windows operatins systems
1 parent 6fe3fa4 commit 513bdee

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

qiling/os/posix/const_mapping.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,15 @@ def _constant_mapping(bits: int, d_map: Mapping[str, int], ret: MutableSequence[
3434

3535

3636
def ql_open_flag_mapping(ql: Qiling, flags):
37-
def flag_mapping(flags, mapping_name, mapping_from, mapping_to):
37+
def flag_mapping(flags, mapping_name, mapping_from, mapping_to, host_os, virt_os):
3838
ret = 0
3939
for n in mapping_name:
4040
if mapping_from[n] is None or mapping_to[n] is None:
4141
continue
4242
if (flags & mapping_from[n]) == mapping_from[n]:
4343
ret = ret | mapping_to[n]
44+
if (host_os == QL_OS.WINDOWS and virt_os != QL_OS.WINDOWS):
45+
ret = ret | mapping_to['O_BINARY']
4446
return ret
4547

4648
f = {}
@@ -86,7 +88,7 @@ def flag_mapping(flags, mapping_name, mapping_from, mapping_to):
8688
if f == t:
8789
return flags
8890

89-
return flag_mapping(flags, open_flags_name, f, t)
91+
return flag_mapping(flags, open_flags_name, f, t, host_os, virt_os)
9092

9193

9294
def mmap_flag_mapping(flags):

0 commit comments

Comments
 (0)