about summary refs log tree commit diff stats
path: root/miasm/os_dep/win_api_x86_32.py
diff options
context:
space:
mode:
author_Frky <3105926+Frky@users.noreply.github.com>2020-05-26 17:12:41 +0200
committerGitHub <noreply@github.com>2020-05-26 17:12:41 +0200
commit1be6521807689c4734aeff19788be39d2ac33c49 (patch)
treed2927568311decb44a93bbdf45f80973ce9f0a6c /miasm/os_dep/win_api_x86_32.py
parenta6b9595681ff3f1faf021fd5edd14138dce93b26 (diff)
downloadfocaccia-miasm-1be6521807689c4734aeff19788be39d2ac33c49.tar.gz
focaccia-miasm-1be6521807689c4734aeff19788be39d2ac33c49.zip
Fix bug in kernel32_GetStartupInfo
Extend the structure size to fit with the documentation
Diffstat (limited to 'miasm/os_dep/win_api_x86_32.py')
-rw-r--r--miasm/os_dep/win_api_x86_32.py32
1 files changed, 30 insertions, 2 deletions
diff --git a/miasm/os_dep/win_api_x86_32.py b/miasm/os_dep/win_api_x86_32.py
index 46f5783c..4d5b5002 100644
--- a/miasm/os_dep/win_api_x86_32.py
+++ b/miasm/os_dep/win_api_x86_32.py
@@ -2384,10 +2384,38 @@ def user32_GetKeyboardType(jitter):
 
 
 def kernel32_GetStartupInfo(jitter, funcname, set_str):
-    ret_ad, args = jitter.func_args_stdcall(["ptr"])
+    """
+        void GetStartupInfo(
+          LPSTARTUPINFOW lpStartupInfo
+        );
 
-    s = b"\x00" * 0x2c + b"\x81\x00\x00\x00" + b"\x0a"
+        Retrieves the contents of the STARTUPINFO structure that was specified
+        when the calling process was created.
+
+        typedef struct _STARTUPINFOA {
+          /* 00000000 */ DWORD  cb;
+          /* 00000004 */ LPSTR  lpReserved;
+          /* 00000008 */ LPSTR  lpDesktop;
+          /* 0000000C */ LPSTR  lpTitle;
+          /* 00000010 */ DWORD  dwX;
+          /* 00000014 */ DWORD  dwY;
+          /* 00000018 */ DWORD  dwXSize;
+          /* 0000001C */ DWORD  dwYSize;
+          /* 00000020 */ DWORD  dwXCountChars;
+          /* 00000024 */ DWORD  dwYCountChars;
+          /* 00000028 */ DWORD  dwFillAttribute;
+          /* 0000002C */ DWORD  dwFlags;
+          /* 00000030 */ WORD   wShowWindow;
+          /* 00000032 */ WORD   cbReserved2;
+          /* 00000034 */ LPBYTE lpReserved2;
+          /* 00000038 */ HANDLE hStdInput;
+          /* 0000003C */ HANDLE hStdOutput;
+          /* 00000040 */ HANDLE hStdError;
+        } STARTUPINFOA, *LPSTARTUPINFOA;
 
+    """
+    ret_ad, args = jitter.func_args_stdcall(["ptr"])
+    s = b"\x00" * 0x2c + b"\x81\x00\x00\x00" + b"\x0a" + b"\x00" * 0x13
     jitter.vm.set_mem(args.ptr, s)
     jitter.func_ret_stdcall(ret_ad, args.ptr)