kernel32/tests: Use inline implementation of NtCurrentTeb for process tests.

Sebastian Lackner sebastian at fds-team.de
Mon Jul 18 09:24:59 CDT 2016


Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
---
 dlls/kernel32/tests/process.c |   22 +++++-----------------
 1 file changed, 5 insertions(+), 17 deletions(-)

diff --git a/dlls/kernel32/tests/process.c b/dlls/kernel32/tests/process.c
index ad7885c..8a135ef 100644
--- a/dlls/kernel32/tests/process.c
+++ b/dlls/kernel32/tests/process.c
@@ -70,7 +70,6 @@ static BOOL   (WINAPI *pVirtualFreeEx)(HANDLE, LPVOID, SIZE_T, DWORD);
 static BOOL   (WINAPI *pQueryFullProcessImageNameA)(HANDLE hProcess, DWORD dwFlags, LPSTR lpExeName, PDWORD lpdwSize);
 static BOOL   (WINAPI *pQueryFullProcessImageNameW)(HANDLE hProcess, DWORD dwFlags, LPWSTR lpExeName, PDWORD lpdwSize);
 static DWORD  (WINAPI *pK32GetProcessImageFileNameA)(HANDLE,LPSTR,DWORD);
-static struct _TEB * (WINAPI *pNtCurrentTeb)(void);
 static HANDLE (WINAPI *pCreateJobObjectW)(LPSECURITY_ATTRIBUTES sa, LPCWSTR name);
 static BOOL   (WINAPI *pAssignProcessToJobObject)(HANDLE job, HANDLE process);
 static BOOL   (WINAPI *pIsProcessInJob)(HANDLE process, HANDLE job, PBOOL result);
@@ -226,7 +225,6 @@ static BOOL init(void)
     hkernel32 = GetModuleHandleA("kernel32");
     hntdll    = GetModuleHandleA("ntdll.dll");
 
-    pNtCurrentTeb = (void *)GetProcAddress(hntdll, "NtCurrentTeb");
     pNtQueryInformationProcess = (void *)GetProcAddress(hntdll, "NtQueryInformationProcess");
 
     pGetNativeSystemInfo = (void *) GetProcAddress(hkernel32, "GetNativeSystemInfo");
@@ -297,6 +295,7 @@ static void WINETEST_PRINTF_ATTR(2,3) childPrintf(HANDLE h, const char* fmt, ...
  */
 static void     doChild(const char* file, const char* option)
 {
+    RTL_USER_PROCESS_PARAMETERS *params = NtCurrentTeb()->Peb->ProcessParameters;
     STARTUPINFOA        siA;
     STARTUPINFOW        siW;
     int                 i;
@@ -325,15 +324,10 @@ static void     doChild(const char* file, const char* option)
                 siA.dwFlags, siA.wShowWindow,
                 (DWORD_PTR)siA.hStdInput, (DWORD_PTR)siA.hStdOutput, (DWORD_PTR)siA.hStdError);
 
-    if (pNtCurrentTeb)
-    {
-        RTL_USER_PROCESS_PARAMETERS *params = pNtCurrentTeb()->Peb->ProcessParameters;
-
-        /* check the console handles in the TEB */
-        childPrintf(hFile, "[TEB]\nhStdInput=%lu\nhStdOutput=%lu\nhStdError=%lu\n\n",
-                    (DWORD_PTR)params->hStdInput, (DWORD_PTR)params->hStdOutput,
-                    (DWORD_PTR)params->hStdError);
-    }
+    /* check the console handles in the TEB */
+    childPrintf(hFile, "[TEB]\nhStdInput=%lu\nhStdOutput=%lu\nhStdError=%lu\n\n",
+                (DWORD_PTR)params->hStdInput, (DWORD_PTR)params->hStdOutput,
+                (DWORD_PTR)params->hStdError);
 
     /* since GetStartupInfoW is only implemented in win2k,
      * zero out before calling so we can notice the difference
@@ -2874,12 +2868,6 @@ static void test_StartupNoConsole(void)
     STARTUPINFOA        startup;
     PROCESS_INFORMATION info;
 
-    if (!pNtCurrentTeb)
-    {
-        win_skip( "NtCurrentTeb not supported\n" );
-        return;
-    }
-
     memset(&startup, 0, sizeof(startup));
     startup.cb = sizeof(startup);
     startup.dwFlags = STARTF_USESHOWWINDOW;
-- 
2.8.0



More information about the wine-patches mailing list