Alexandre Julliard : kernel32: Move Get/SetProcessDword to kernel16.c.

Alexandre Julliard julliard at winehq.org
Thu Oct 8 08:57:12 CDT 2009


Module: wine
Branch: master
Commit: e0ce6dc32eb81660b19bfd6dfd739fb296b38159
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e0ce6dc32eb81660b19bfd6dfd739fb296b38159

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Oct  7 20:49:22 2009 +0200

kernel32: Move Get/SetProcessDword to kernel16.c.

---

 dlls/kernel32/kernel16.c       |  115 ++++++++++++++++++++++++++++++++++++++++
 dlls/kernel32/krnl386.exe.spec |    4 +-
 dlls/kernel32/process.c        |  107 +------------------------------------
 3 files changed, 119 insertions(+), 107 deletions(-)

diff --git a/dlls/kernel32/kernel16.c b/dlls/kernel32/kernel16.c
index e298aa3..3acb932 100644
--- a/dlls/kernel32/kernel16.c
+++ b/dlls/kernel32/kernel16.c
@@ -25,6 +25,7 @@
 #include "winbase.h"
 #include "winternl.h"
 #include "wownt32.h"
+#include "wine/winuser16.h"
 
 #include "kernel_private.h"
 #include "kernel16_private.h"
@@ -32,6 +33,10 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(module);
 
+extern DWORD WINAPI GetProcessFlags( DWORD processid );
+
+static DWORD process_dword;
+
 /**************************************************************************
  *		DllEntryPoint   (KERNEL.669)
  */
@@ -580,6 +585,116 @@ DWORD WINAPI MapProcessHandle( HANDLE hProcess )
 }
 
 /***********************************************************************
+ *           SetProcessDword    (KERNEL.484)
+ * 'Of course you cannot directly access Windows internal structures'
+ */
+void WINAPI SetProcessDword16( DWORD dwProcessID, INT offset, DWORD value )
+{
+    TRACE("(%d, %d)\n", dwProcessID, offset );
+
+    if (dwProcessID && dwProcessID != GetCurrentProcessId())
+    {
+        ERR("%d: process %x not accessible\n", offset, dwProcessID);
+        return;
+    }
+
+    switch ( offset )
+    {
+    case GPD_APP_COMPAT_FLAGS:
+    case GPD_LOAD_DONE_EVENT:
+    case GPD_HINSTANCE16:
+    case GPD_WINDOWS_VERSION:
+    case GPD_THDB:
+    case GPD_PDB:
+    case GPD_STARTF_SHELLDATA:
+    case GPD_STARTF_HOTKEY:
+    case GPD_STARTF_SHOWWINDOW:
+    case GPD_STARTF_SIZE:
+    case GPD_STARTF_POSITION:
+    case GPD_STARTF_FLAGS:
+    case GPD_PARENT:
+    case GPD_FLAGS:
+        ERR("Not allowed to modify offset %d\n", offset );
+        break;
+    case GPD_USERDATA:
+        process_dword = value;
+        break;
+    default:
+        ERR("Unknown offset %d\n", offset );
+        break;
+    }
+}
+
+/***********************************************************************
+ *           GetProcessDword    (KERNEL.485)
+ * 'Of course you cannot directly access Windows internal structures'
+ */
+DWORD WINAPI GetProcessDword16( DWORD dwProcessID, INT offset )
+{
+    DWORD               x, y;
+    STARTUPINFOW        siw;
+
+    TRACE("(%d, %d)\n", dwProcessID, offset );
+
+    if (dwProcessID && dwProcessID != GetCurrentProcessId())
+    {
+        ERR("%d: process %x not accessible\n", offset, dwProcessID);
+        return 0;
+    }
+
+    switch ( offset )
+    {
+    case GPD_APP_COMPAT_FLAGS:
+        return GetAppCompatFlags16(0);
+    case GPD_LOAD_DONE_EVENT:
+        return 0;
+    case GPD_HINSTANCE16:
+        return GetTaskDS16();
+    case GPD_WINDOWS_VERSION:
+        return GetExeVersion16();
+    case GPD_THDB:
+        return (DWORD_PTR)NtCurrentTeb() - 0x10 /* FIXME */;
+    case GPD_PDB:
+        return (DWORD_PTR)NtCurrentTeb()->Peb; /* FIXME: truncating a pointer */
+    case GPD_STARTF_SHELLDATA: /* return stdoutput handle from startupinfo ??? */
+        GetStartupInfoW(&siw);
+        return HandleToULong(siw.hStdOutput);
+    case GPD_STARTF_HOTKEY: /* return stdinput handle from startupinfo ??? */
+        GetStartupInfoW(&siw);
+        return HandleToULong(siw.hStdInput);
+    case GPD_STARTF_SHOWWINDOW:
+        GetStartupInfoW(&siw);
+        return siw.wShowWindow;
+    case GPD_STARTF_SIZE:
+        GetStartupInfoW(&siw);
+        x = siw.dwXSize;
+        if ( (INT)x == CW_USEDEFAULT ) x = CW_USEDEFAULT16;
+        y = siw.dwYSize;
+        if ( (INT)y == CW_USEDEFAULT ) y = CW_USEDEFAULT16;
+        return MAKELONG( x, y );
+    case GPD_STARTF_POSITION:
+        GetStartupInfoW(&siw);
+        x = siw.dwX;
+        if ( (INT)x == CW_USEDEFAULT ) x = CW_USEDEFAULT16;
+        y = siw.dwY;
+        if ( (INT)y == CW_USEDEFAULT ) y = CW_USEDEFAULT16;
+        return MAKELONG( x, y );
+    case GPD_STARTF_FLAGS:
+        GetStartupInfoW(&siw);
+        return siw.dwFlags;
+    case GPD_PARENT:
+        return 0;
+    case GPD_FLAGS:
+        return GetProcessFlags(0);
+    case GPD_USERDATA:
+        return process_dword;
+    default:
+        ERR("Unknown offset %d\n", offset );
+        return 0;
+    }
+}
+
+/***********************************************************************
  *           FreeLibrary32 (KERNEL.486)
  */
 BOOL WINAPI FreeLibrary32_16( HINSTANCE module )
diff --git a/dlls/kernel32/krnl386.exe.spec b/dlls/kernel32/krnl386.exe.spec
index b43c874..60560c5 100644
--- a/dlls/kernel32/krnl386.exe.spec
+++ b/dlls/kernel32/krnl386.exe.spec
@@ -386,8 +386,8 @@
 481 pascal -ret16 _LeaveWin16Lock() _LeaveWin16Lock
 482 pascal LoadSystemLibrary32(str) LoadLibrary32_16   # FIXME!
 483 pascal MapProcessHandle(long) MapProcessHandle
-484 pascal SetProcessDword(long s_word long) SetProcessDword
-485 pascal GetProcessDword(long s_word) GetProcessDword
+484 pascal SetProcessDword(long s_word long) SetProcessDword16
+485 pascal GetProcessDword(long s_word) GetProcessDword16
 486 pascal FreeLibrary32(long) FreeLibrary32_16
 487 pascal GetModuleFileName32(long str word) GetModuleFileName32_16
 488 pascal GetModuleHandle32(str) GetModuleHandle32_16
diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c
index 4d8f2f7..df09558 100644
--- a/dlls/kernel32/process.c
+++ b/dlls/kernel32/process.c
@@ -74,7 +74,6 @@ static UINT process_error_mode;
 
 static DWORD shutdown_flags = 0;
 static DWORD shutdown_priority = 0x280;
-static DWORD process_dword;
 static BOOL is_wow64;
 
 HMODULE kernel32_handle = 0;
@@ -2537,114 +2536,12 @@ DWORD WINAPI GetProcessFlags( DWORD processid )
 
 
 /***********************************************************************
- *           GetProcessDword    (KERNEL.485)
  *           GetProcessDword    (KERNEL32.18)
- * 'Of course you cannot directly access Windows internal structures'
  */
 DWORD WINAPI GetProcessDword( DWORD dwProcessID, INT offset )
 {
-    DWORD               x, y;
-    STARTUPINFOW        siw;
-
-    TRACE("(%d, %d)\n", dwProcessID, offset );
-
-    if (dwProcessID && dwProcessID != GetCurrentProcessId())
-    {
-        ERR("%d: process %x not accessible\n", offset, dwProcessID);
-        return 0;
-    }
-
-    switch ( offset )
-    {
-    case GPD_APP_COMPAT_FLAGS:
-        return GetAppCompatFlags16(0);
-    case GPD_LOAD_DONE_EVENT:
-        return 0;
-    case GPD_HINSTANCE16:
-        return GetTaskDS16();
-    case GPD_WINDOWS_VERSION:
-        return GetExeVersion16();
-    case GPD_THDB:
-        return (DWORD_PTR)NtCurrentTeb() - 0x10 /* FIXME */;
-    case GPD_PDB:
-        return (DWORD_PTR)NtCurrentTeb()->Peb; /* FIXME: truncating a pointer */
-    case GPD_STARTF_SHELLDATA: /* return stdoutput handle from startupinfo ??? */
-        GetStartupInfoW(&siw);
-        return HandleToULong(siw.hStdOutput);
-    case GPD_STARTF_HOTKEY: /* return stdinput handle from startupinfo ??? */
-        GetStartupInfoW(&siw);
-        return HandleToULong(siw.hStdInput);
-    case GPD_STARTF_SHOWWINDOW:
-        GetStartupInfoW(&siw);
-        return siw.wShowWindow;
-    case GPD_STARTF_SIZE:
-        GetStartupInfoW(&siw);
-        x = siw.dwXSize;
-        if ( (INT)x == CW_USEDEFAULT ) x = CW_USEDEFAULT16;
-        y = siw.dwYSize;
-        if ( (INT)y == CW_USEDEFAULT ) y = CW_USEDEFAULT16;
-        return MAKELONG( x, y );
-    case GPD_STARTF_POSITION:
-        GetStartupInfoW(&siw);
-        x = siw.dwX;
-        if ( (INT)x == CW_USEDEFAULT ) x = CW_USEDEFAULT16;
-        y = siw.dwY;
-        if ( (INT)y == CW_USEDEFAULT ) y = CW_USEDEFAULT16;
-        return MAKELONG( x, y );
-    case GPD_STARTF_FLAGS:
-        GetStartupInfoW(&siw);
-        return siw.dwFlags;
-    case GPD_PARENT:
-        return 0;
-    case GPD_FLAGS:
-        return GetProcessFlags(0);
-    case GPD_USERDATA:
-        return process_dword;
-    default:
-        ERR("Unknown offset %d\n", offset );
-        return 0;
-    }
-}
-
-/***********************************************************************
- *           SetProcessDword    (KERNEL.484)
- * 'Of course you cannot directly access Windows internal structures'
- */
-void WINAPI SetProcessDword( DWORD dwProcessID, INT offset, DWORD value )
-{
-    TRACE("(%d, %d)\n", dwProcessID, offset );
-
-    if (dwProcessID && dwProcessID != GetCurrentProcessId())
-    {
-        ERR("%d: process %x not accessible\n", offset, dwProcessID);
-        return;
-    }
-
-    switch ( offset )
-    {
-    case GPD_APP_COMPAT_FLAGS:
-    case GPD_LOAD_DONE_EVENT:
-    case GPD_HINSTANCE16:
-    case GPD_WINDOWS_VERSION:
-    case GPD_THDB:
-    case GPD_PDB:
-    case GPD_STARTF_SHELLDATA:
-    case GPD_STARTF_HOTKEY:
-    case GPD_STARTF_SHOWWINDOW:
-    case GPD_STARTF_SIZE:
-    case GPD_STARTF_POSITION:
-    case GPD_STARTF_FLAGS:
-    case GPD_PARENT:
-    case GPD_FLAGS:
-        ERR("Not allowed to modify offset %d\n", offset );
-        break;
-    case GPD_USERDATA:
-        process_dword = value;
-        break;
-    default:
-        ERR("Unknown offset %d\n", offset );
-        break;
-    }
+    FIXME( "(%d, %d): not supported\n", dwProcessID, offset );
+    return 0;
 }
 
 




More information about the wine-cvs mailing list