[WIN32K]
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Fri, 2 Nov 2012 13:50:31 +0000 (13:50 +0000)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Fri, 2 Nov 2012 13:50:31 +0000 (13:50 +0000)
- Remove the now unneeded CSR messaging support.
- CsrInit() goes away also and the usage of the CsrProcess is replaced by that of gpepCSRSS.

[WINSRV]
- Use a DLL instance for loading resources, instead of calling GetModuleHandle.

[KERNEL32/NTDLL]
- Remove unneeded variables.

svn path=/branches/ros-csrss/; revision=57665

16 files changed:
dll/ntdll/include/ntdllp.h
dll/win32/kernel32/include/kernel32.h
win32ss/CMakeLists.txt
win32ss/gdi/ntgdi/gdikdbgext.c
win32ss/user/ntuser/csr.c [deleted file]
win32ss/user/ntuser/csr.h [deleted file]
win32ss/user/ntuser/desktop.c
win32ss/user/ntuser/hook.c
win32ss/user/ntuser/menu.c
win32ss/user/ntuser/ntuser.c
win32ss/user/ntuser/ntuser.h
win32ss/user/ntuser/simplecall.c
win32ss/user/winsrv/init.c
win32ss/user/winsrv/shutdown.c
win32ss/user/winsrv/winsrv.h
win32ss/win32kp.h

index 0880b27..606b5fc 100644 (file)
@@ -162,7 +162,5 @@ LdrpLoadImportModule(IN PWSTR DllPath OPTIONAL,
 VOID
 NTAPI
 LdrpFinalizeAndDeallocateDataTableEntry(IN PLDR_DATA_TABLE_ENTRY Entry);
-                     
-extern HANDLE WindowsApiPort;
 
 /* EOF */
index 715a3d3..5cad670 100644 (file)
@@ -155,7 +155,6 @@ typedef struct _BASEP_ACTCTX_BLOCK
 #define BASEP_GET_MODULE_HANDLE_EX_PARAMETER_VALIDATION_SUCCESS  2
 #define BASEP_GET_MODULE_HANDLE_EX_PARAMETER_VALIDATION_CONTINUE 3
 
-
 extern PBASE_STATIC_SERVER_DATA BaseStaticServerData;
 
 typedef
@@ -164,8 +163,6 @@ DWORD
     HANDLE hProcess,
     DWORD dwMilliseconds);
 
-
-extern BOOLEAN InWindows;
 extern WaitForInputIdleType UserWaitForInputIdleRoutine;
 
 /* GLOBAL VARIABLES **********************************************************/
index 164a161..25e4df5 100644 (file)
@@ -103,7 +103,6 @@ list(APPEND SOURCE
     user/ntuser/caret.c
     user/ntuser/class.c
     user/ntuser/clipboard.c
-    user/ntuser/csr.c
     user/ntuser/defwnd.c
     user/ntuser/desktop.c
     user/ntuser/display.c
index 6cd3d57..9118b31 100644 (file)
@@ -14,7 +14,6 @@
 
 extern PENTRY gpentHmgr;
 extern PULONG gpaulRefCount;
-extern PEPROCESS gpepCSRSS;
 extern ULONG gulFirstUnused;
 
 
diff --git a/win32ss/user/ntuser/csr.c b/win32ss/user/ntuser/csr.c
deleted file mode 100644 (file)
index 0334f10..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/* 
- * COPYRIGHT:        See COPYING in the top level directory
- * PROJECT:          ReactOS kernel
- * PURPOSE:          Interface to csrss
- * FILE:             subsys/win32k/ntuser/csr.c
- * PROGRAMER:        Ge van Geldorp (ge@gse.nl)
- */
-
-#include <win32k.h>
-DBG_DEFAULT_CHANNEL(UserMisc);
-
-static HANDLE WindowsApiPort = NULL;
-PEPROCESS CsrProcess = NULL;
-
-NTSTATUS FASTCALL
-CsrInit(void)
-{
-   NTSTATUS Status;
-   UNICODE_STRING PortName;
-   ULONG ConnectInfoLength;
-   SECURITY_QUALITY_OF_SERVICE Qos;   
-
-   ERR("CsrInit\n");
-
-   RtlInitUnicodeString(&PortName, L"\\Windows\\ApiPort");
-   ConnectInfoLength = 0;
-   Qos.Length = sizeof(Qos);
-   Qos.ImpersonationLevel = SecurityDelegation;
-   Qos.ContextTrackingMode = SECURITY_STATIC_TRACKING;
-   Qos.EffectiveOnly = FALSE;
-
-   CsrProcess = PsGetCurrentProcess();
-   ERR("CsrInit - CsrProcess = 0x%p\n", CsrProcess);
-
-   Status = ZwConnectPort(&WindowsApiPort,
-                          &PortName,
-                          &Qos,
-                          NULL,
-                          NULL,
-                          NULL,
-                          NULL,
-                          &ConnectInfoLength);
-   if (!NT_SUCCESS(Status))
-   {
-      ERR("CsrInit - Status = 0x%p\n", Status);
-      return Status;
-   }
-
-   return STATUS_SUCCESS;
-}
-
-/* EOF */
diff --git a/win32ss/user/ntuser/csr.h b/win32ss/user/ntuser/csr.h
deleted file mode 100644 (file)
index a5eb221..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/* $Id$
- *
- * COPYRIGHT:        See COPYING in the top level directory
- * PROJECT:          ReactOS kernel
- * PURPOSE:          Interface to csrss
- * FILE:             subsys/win32k/include/csr.h
- * PROGRAMER:        Ge van Geldorp (ge@gse.nl)
- */
-
-#pragma once
-
-extern PEPROCESS CsrProcess;
-
-NTSTATUS FASTCALL CsrInit(void);
-
-/* EOF */
index 41f56ad..742a4fc 100644 (file)
@@ -2024,7 +2024,7 @@ NtUserSetThreadDesktop(HDESK hDesktop)
    // FIXME: IntSetThreadDesktop validates the desktop handle, it should happen
    // here too and set the NT error level. Q. Is it necessary to have the validation
    // in IntSetThreadDesktop? Is it needed there too?
-   if (hDesktop || (!hDesktop && CsrProcess == PsGetCurrentProcess()))
+   if (hDesktop || (!hDesktop && PsGetCurrentProcess() == gpepCSRSS))
       ret = IntSetThreadDesktop(hDesktop, FALSE);
 
    UserLeave();
index 2c43691..11d5cac 100644 (file)
@@ -94,7 +94,7 @@ IntHookModuleUnloaded(PDESKTOP pdesk, int iHookID, HHOOK hHook)
 
     ERR("IntHookModuleUnloaded: iHookID=%d\n", iHookID);
 
-    ppiCsr = PsGetProcessWin32Process(CsrProcess);
+    ppiCsr = PsGetProcessWin32Process(gpepCSRSS);
 
     ListEntry = pdesk->PtiList.Flink;
     while(ListEntry != &pdesk->PtiList)
@@ -147,7 +147,7 @@ UserRegisterUserApiHook(
     PPROCESSINFO ppiCsr;
 
     pti = PsGetCurrentThreadWin32Thread();
-    ppiCsr = PsGetProcessWin32Process(CsrProcess);
+    ppiCsr = PsGetProcessWin32Process(gpepCSRSS);
 
     /* Fail if the api hook is already registered */
     if(gpsi->dwSRVIFlags & SRVINFO_APIHOOK)
index fe870b8..40c37aa 100644 (file)
@@ -1522,14 +1522,13 @@ HMENU FASTCALL UserCreateMenu(BOOL PopupMenu)
    NTSTATUS Status;
    PEPROCESS CurrentProcess = PsGetCurrentProcess();
 
-   if (CsrProcess != CurrentProcess)
+   if (gpepCSRSS != CurrentProcess)
    {
       /*
-       * CsrProcess does not have a Win32WindowStation
-          *
-          */
+       * gpepCSRSS does not have a Win32WindowStation
+       */
 
-      Status = IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation,
+      Status = IntValidateWindowStationHandle(CurrentProcess->Win32WindowStation,
                      KernelMode,
                      0,
                      &WinStaObject);
index edf6fb1..8385b33 100644 (file)
@@ -20,7 +20,7 @@ ATOM AtomFlashWndState; // Window Flash State atom.
 BOOL gbInitialized;
 HINSTANCE hModClient = NULL;
 BOOL ClientPfnInit = FALSE;
-PEPROCESS gpepCSRSS;
+PEPROCESS gpepCSRSS = NULL;
 
 /* PRIVATE FUNCTIONS *********************************************************/
 
@@ -133,8 +133,6 @@ UserInitialize(
 
     NtUserUpdatePerUserSystemParameters(0, TRUE);
 
-    CsrInit();
-
     if (gpsi->hbrGray == NULL)
     {
        hPattern55AABitmap = GreCreateBitmap(8, 8, 1, 1, (LPBYTE)wPattern55AA);
index aab3ba3..d74e9c9 100644 (file)
@@ -15,6 +15,7 @@ extern PTHREADINFO gptiCurrent;
 extern PPROCESSINFO gppiList;
 extern PPROCESSINFO ppiScrnSaver;
 extern PPROCESSINFO gppiInputProvider;
+extern PEPROCESS gpepCSRSS;
 
 INIT_FUNCTION NTSTATUS NTAPI InitUserImpl(VOID);
 VOID FASTCALL CleanupUserImpl(VOID);
index b68bf06..cc0e6a9 100644 (file)
@@ -334,7 +334,7 @@ NtUserCallOneParam(
           BOOL Ret = TRUE;
           PPROCESSINFO ppi;
           PDWORD pdwLayout;
-          if ( PsGetCurrentProcess() == CsrProcess)
+          if ( PsGetCurrentProcess() == gpepCSRSS)
           {
              EngSetLastError(ERROR_INVALID_ACCESS);
              RETURN(FALSE);
index d1f8429..957df9a 100644 (file)
@@ -16,7 +16,7 @@
 #define NDEBUG
 #include <debug.h>
 
-HANDLE DllHandle = NULL;
+HINSTANCE UserSrvDllInstance = NULL;
 // HANDLE WinSrvApiPort = NULL;
 
 /* Memory */
@@ -357,7 +357,7 @@ BOOL WINAPI _UserSoundSentry(VOID)
 
 BOOL
 WINAPI
-DllMain(IN HANDLE hDll,
+DllMain(IN HINSTANCE hInstanceDll,
         IN DWORD dwReason,
         IN LPVOID lpReserved)
 {
@@ -366,7 +366,7 @@ DllMain(IN HANDLE hDll,
 
     if (DLL_PROCESS_ATTACH == dwReason)
     {
-        DllHandle = hDll;
+        UserSrvDllInstance = hInstanceDll;
 
 /*** HACK from win32csr... ***/
 
index a7934cd..b1904df 100644 (file)
@@ -244,7 +244,7 @@ EndNowThreadProc(LPVOID Parameter)
     SetThreadDesktop(NotifyContext->Desktop);
     SwitchDesktop(NotifyContext->Desktop);
     CallInitCommonControls();
-    NotifyContext->Dlg = CreateDialogParam(GetModuleHandleW(L"win32csr"),
+    NotifyContext->Dlg = CreateDialogParam(UserSrvDllInstance,
                                            MAKEINTRESOURCE(IDD_END_NOW), NULL,
                                            EndNowDlgProc, (LPARAM) NotifyContext);
     if (NULL == NotifyContext->Dlg)
index 191c093..88e8a3b 100644 (file)
@@ -36,6 +36,7 @@
 #include "resource.h"
 
 
+extern HINSTANCE UserSrvDllInstance;
 extern HANDLE UserSrvHeap;
 // extern HANDLE BaseSrvSharedHeap;
 // extern PBASE_STATIC_SERVER_DATA BaseStaticServerData;
index b553e5c..daca022 100644 (file)
@@ -100,7 +100,6 @@ typedef struct _DESKTOP *PDESKTOP;
 #include "user/ntuser/vis.h"
 #include "user/ntuser/userfuncs.h"
 #include "user/ntuser/scroll.h"
-#include "user/ntuser/csr.h"
 #include "user/ntuser/winpos.h"
 #include "user/ntuser/callback.h"