Merge pull request #1064 from nmantani/fix-windows-flag-mapping

Fix ql_open_flag_mapping for Linux binary emulation on Windows
This commit is contained in:
kj.xwings.l
2022-01-13 14:51:55 +08:00
committed by GitHub
2 changed files with 22 additions and 0 deletions
+18
View File
@@ -533,6 +533,24 @@ freebsd_x86_open_flags = {
'O_LARGEFILE': None
}
windows_x86_open_flags = {
'O_RDONLY': 0x0,
'O_WRONLY': 0x1,
'O_RDWR': 0x2,
'O_NONBLOCK': None,
'O_APPEND': 0x8,
'O_ASYNC': None,
'O_SYNC': None,
'O_NOFOLLOW': None,
'O_CREAT': 0x100,
'O_TRUNC': 0x200,
'O_EXCL': 0x400,
'O_NOCTTY': None,
'O_DIRECTORY': None,
'O_BINARY': 0x8000,
'O_LARGEFILE': None
}
qnx_arm64_open_flags = {
'O_RDONLY' : 0x00000,
'O_WRONLY' : 0x00001,
+4
View File
@@ -64,6 +64,8 @@ def ql_open_flag_mapping(ql: Qiling, flags):
f = macos_x86_open_flags
elif ql.ostype == QL_OS.FREEBSD:
f = freebsd_x86_open_flags
elif ql.ostype == QL_OS.WINDOWS:
f = windows_x86_open_flags
elif ql.ostype == QL_OS.QNX:
f = qnx_arm64_open_flags
@@ -73,6 +75,8 @@ def ql_open_flag_mapping(ql: Qiling, flags):
t = macos_x86_open_flags
elif ql.platform_os == QL_OS.FREEBSD:
t = freebsd_x86_open_flags
elif ql.platform_os == QL_OS.WINDOWS:
t = windows_x86_open_flags
if f == t:
return flags