Author: hbelusca
Date: Thu Oct 25 22:14:46 2012
New Revision: 57620
URL:
http://svn.reactos.org/svn/reactos?rev=57620&view=rev
Log:
[CONSRV/WINSRV]
- Fix structures usage and headers inclusions.
- Make winsrv compile.
- Deactivate some code related to processes enumeration (for testing purposes).
Modified:
branches/ros-csrss/subsystems/win32/csrsrv/procsup.c
branches/ros-csrss/win32ss/user/consrv/consrv.h
branches/ros-csrss/win32ss/user/win32csr/win32csr.h
branches/ros-csrss/win32ss/user/winsrv/CMakeLists.txt
branches/ros-csrss/win32ss/user/winsrv/init.c
branches/ros-csrss/win32ss/user/winsrv/server.c
branches/ros-csrss/win32ss/user/winsrv/shutdown.c
branches/ros-csrss/win32ss/user/winsrv/winsrv.h
Modified: branches/ros-csrss/subsystems/win32/csrsrv/procsup.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/subsystems/win32/csrs…
==============================================================================
--- branches/ros-csrss/subsystems/win32/csrsrv/procsup.c [iso-8859-1] (original)
+++ branches/ros-csrss/subsystems/win32/csrsrv/procsup.c [iso-8859-1] Thu Oct 25 22:14:46
2012
@@ -1365,7 +1365,7 @@
return Status;
}
-/* FIXME: Temporary hack. This is really "CsrShutdownProcess", mostly. Used by
win32csr */
+/* FIXME: Temporary hack. This is really "CsrShutdownProcess", mostly. Used by
winsrv */
#if 0
NTSTATUS
WINAPI
Modified: branches/ros-csrss/win32ss/user/consrv/consrv.h
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/c…
==============================================================================
--- branches/ros-csrss/win32ss/user/consrv/consrv.h [iso-8859-1] (original)
+++ branches/ros-csrss/win32ss/user/consrv/consrv.h [iso-8859-1] Thu Oct 25 22:14:46 2012
@@ -31,6 +31,7 @@
/* Shared header with console.dll */
#include "console.h"
+
extern HANDLE ConSrvHeap;
// extern HANDLE BaseSrvSharedHeap;
Modified: branches/ros-csrss/win32ss/user/win32csr/win32csr.h
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/win32csr…
==============================================================================
--- branches/ros-csrss/win32ss/user/win32csr/win32csr.h [iso-8859-1] (original)
+++ branches/ros-csrss/win32ss/user/win32csr/win32csr.h [iso-8859-1] Thu Oct 25 22:14:46
2012
@@ -13,7 +13,6 @@
#include <windows.h>
#define NTOS_MODE_USER
#include <ndk/ntndk.h>
-#include <psapi.h>
/* External Winlogon Header */
#include <winlogon.h>
Modified: branches/ros-csrss/win32ss/user/winsrv/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/winsrv/C…
==============================================================================
--- branches/ros-csrss/win32ss/user/winsrv/CMakeLists.txt [iso-8859-1] (original)
+++ branches/ros-csrss/win32ss/user/winsrv/CMakeLists.txt [iso-8859-1] Thu Oct 25 22:14:46
2012
@@ -15,7 +15,7 @@
add_library(winsrv SHARED ${SOURCE})
-# target_link_libraries(winsrv win32ksys ${PSEH_LIB}) # win32ksys because of NtUser...()
+target_link_libraries(winsrv win32ksys ${PSEH_LIB}) # win32ksys because of NtUser...()
set_module_type(winsrv win32dll)
Modified: branches/ros-csrss/win32ss/user/winsrv/init.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/winsrv/i…
==============================================================================
--- branches/ros-csrss/win32ss/user/winsrv/init.c [iso-8859-1] (original)
+++ branches/ros-csrss/win32ss/user/winsrv/init.c [iso-8859-1] Thu Oct 25 22:14:46 2012
@@ -8,6 +8,10 @@
*/
#include "winsrv.h"
+
+/* Public Win32K Headers */
+// For calling NtUser...()
+#include <ntuser.h>
#define NDEBUG
#include <debug.h>
Modified: branches/ros-csrss/win32ss/user/winsrv/server.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/winsrv/s…
==============================================================================
--- branches/ros-csrss/win32ss/user/winsrv/server.c [iso-8859-1] (original)
+++ branches/ros-csrss/win32ss/user/winsrv/server.c [iso-8859-1] Thu Oct 25 22:14:46 2012
@@ -25,6 +25,8 @@
CSR_API(SrvRegisterServicesProcess)
{
+ PCSRSS_REGISTER_SERVICES_PROCESS RegisterServicesProcessRequest =
&((PUSER_API_MESSAGE)ApiMessage)->Data.RegisterServicesProcessRequest;
+
if (ServicesProcessIdValid == TRUE)
{
/* Only accept a single call */
@@ -32,7 +34,7 @@
}
else
{
- ServicesProcessId =
(ULONG_PTR)ApiMessage->Data.RegisterServicesProcessRequest.ProcessId;
+ ServicesProcessId = (ULONG_PTR)RegisterServicesProcessRequest->ProcessId;
ServicesProcessIdValid = TRUE;
return STATUS_SUCCESS;
}
Modified: branches/ros-csrss/win32ss/user/winsrv/shutdown.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/winsrv/s…
==============================================================================
--- branches/ros-csrss/win32ss/user/winsrv/shutdown.c [iso-8859-1] (original)
+++ branches/ros-csrss/win32ss/user/winsrv/shutdown.c [iso-8859-1] Thu Oct 25 22:14:46
2012
@@ -15,29 +15,32 @@
#include <debug.h>
-
static HWND LogonNotifyWindow = NULL;
static HANDLE LogonProcess = NULL;
/* FUNCTIONS *****************************************************************/
+/*
NTSTATUS FASTCALL
Win32CsrEnumProcesses(CSRSS_ENUM_PROCESS_PROC EnumProc,
PVOID Context)
{
return CsrEnumProcesses(EnumProc, Context);
}
+*/
CSR_API(SrvRegisterLogonProcess)
{
- if (ApiMessage->Data.RegisterLogonProcessRequest.Register)
+ PCSRSS_REGISTER_LOGON_PROCESS RegisterLogonProcessRequest =
&((PUSER_API_MESSAGE)ApiMessage)->Data.RegisterLogonProcessRequest;
+
+ if (RegisterLogonProcessRequest->Register)
{
if (0 != LogonProcess)
{
return STATUS_LOGON_SESSION_EXISTS;
}
- LogonProcess = ApiMessage->Data.RegisterLogonProcessRequest.ProcessId;
+ LogonProcess = RegisterLogonProcessRequest->ProcessId;
}
else
{
@@ -55,9 +58,10 @@
CSR_API(CsrSetLogonNotifyWindow)
{
+ PCSRSS_SET_LOGON_NOTIFY_WINDOW SetLogonNotifyWindowRequest =
&((PUSER_API_MESSAGE)ApiMessage)->Data.SetLogonNotifyWindowRequest;
DWORD WindowCreator;
- if (0 ==
GetWindowThreadProcessId(ApiMessage->Data.SetLogonNotifyWindowRequest.LogonNotifyWindow,
+ if (0 == GetWindowThreadProcessId(SetLogonNotifyWindowRequest->LogonNotifyWindow,
&WindowCreator))
{
DPRINT1("Can't get window creator\n");
@@ -69,7 +73,7 @@
return STATUS_ACCESS_DENIED;
}
- LogonNotifyWindow =
ApiMessage->Data.SetLogonNotifyWindowRequest.LogonNotifyWindow;
+ LogonNotifyWindow = SetLogonNotifyWindowRequest->LogonNotifyWindow;
return STATUS_SUCCESS;
}
@@ -142,14 +146,14 @@
TitleLength = SendMessageW(NotifyContext->WndClient, WM_GETTEXTLENGTH,
0, 0) +
GetWindowTextLengthW(Dlg);
- Title = HeapAlloc(Win32CsrApiHeap, 0, (TitleLength + 1) * sizeof(WCHAR));
+ Title = HeapAlloc(UserSrvHeap, 0, (TitleLength + 1) * sizeof(WCHAR));
if (NULL != Title)
{
Len = GetWindowTextW(Dlg, Title, TitleLength + 1);
SendMessageW(NotifyContext->WndClient, WM_GETTEXT,
TitleLength + 1 - Len, (LPARAM) (Title + Len));
SetWindowTextW(Dlg, Title);
- HeapFree(Win32CsrApiHeap, 0, Title);
+ HeapFree(UserSrvHeap, 0, Title);
}
ProgressBar = GetDlgItem(Dlg, IDC_PROGRESS);
SendMessageW(ProgressBar, PBM_SETRANGE32, 0,
@@ -467,6 +471,48 @@
return TRUE;
}
+/*** Taken from win32ss/user/win32csr/desktopbg.c ***/
+BOOL FASTCALL
+DtbgIsDesktopVisible(VOID)
+{
+ HWND VisibleDesktopWindow = GetDesktopWindow(); // DESKTOPWNDPROC
+
+ if (VisibleDesktopWindow != NULL &&
+ !IsWindowVisible(VisibleDesktopWindow))
+ {
+ VisibleDesktopWindow = NULL;
+ }
+
+ return VisibleDesktopWindow != NULL;
+}
+/****************************************************/
+
+/*** Taken from win32ss/user/consrv/console.c ***/
+/* TODO: Find another way to do it. */
+VOID FASTCALL
+ConioConsoleCtrlEventTimeout(DWORD Event, PCSR_PROCESS ProcessData, DWORD Timeout)
+{
+ HANDLE Thread;
+
+ DPRINT("ConioConsoleCtrlEvent Parent ProcessId = %x\n",
ProcessData->ClientId.UniqueProcess);
+
+ if (ProcessData->CtrlDispatcher)
+ {
+
+ Thread = CreateRemoteThread(ProcessData->ProcessHandle, NULL, 0,
+ (LPTHREAD_START_ROUTINE)
ProcessData->CtrlDispatcher,
+ UlongToPtr(Event), 0, NULL);
+ if (NULL == Thread)
+ {
+ DPRINT1("Failed thread creation (Error: 0x%x)\n", GetLastError());
+ return;
+ }
+ WaitForSingleObject(Thread, Timeout);
+ CloseHandle(Thread);
+ }
+}
+/************************************************/
+
static BOOL FASTCALL
NotifyAndTerminateProcess(PCSR_PROCESS ProcessData,
PSHUTDOWN_SETTINGS ShutdownSettings,
@@ -555,6 +601,7 @@
DWORD CsrssProcess;
} PROCESS_ENUM_CONTEXT, *PPROCESS_ENUM_CONTEXT;
+#if 0
static NTSTATUS WINAPI
ExitReactosProcessEnum(PCSR_PROCESS ProcessData, PVOID Data)
{
@@ -610,7 +657,7 @@
{
ProcessData->ShutdownLevel = 0;
}
- NewData = HeapAlloc(Win32CsrApiHeap, 0, (Context->ProcessCount + 1)
+ NewData = HeapAlloc(UserSrvHeap, 0, (Context->ProcessCount + 1)
* sizeof(PCSR_PROCESS));
if (NULL == NewData)
{
@@ -620,7 +667,7 @@
{
memcpy(NewData, Context->ProcessData,
Context->ProcessCount * sizeof(PCSR_PROCESS));
- HeapFree(Win32CsrApiHeap, 0, Context->ProcessData);
+ HeapFree(UserSrvHeap, 0, Context->ProcessData);
}
Context->ProcessData = NewData;
Context->ProcessData[Context->ProcessCount] = ProcessData;
@@ -629,6 +676,7 @@
return STATUS_SUCCESS;
}
+#endif
static int
ProcessDataCompare(const void *Elem1, const void *Elem2)
@@ -723,7 +771,7 @@
}
else
{
- KeyName = HeapAlloc(Win32CsrApiHeap, 0,
+ KeyName = HeapAlloc(UserSrvHeap, 0,
(wcslen(StringSid) + wcslen(Subkey) + 1) *
sizeof(WCHAR));
if (NULL == KeyName)
@@ -739,7 +787,7 @@
ErrCode = RegOpenKeyExW(HKEY_USERS, KeyName, 0, KEY_QUERY_VALUE, &DesktopKey);
if (KeyName != InitialKeyName)
{
- HeapFree(Win32CsrApiHeap, 0, KeyName);
+ HeapFree(UserSrvHeap, 0, KeyName);
}
if (ERROR_SUCCESS != ErrCode)
{
@@ -810,7 +858,7 @@
{
if (sizeof(FixedUserInfo) < ReturnLength)
{
- UserInfo = HeapAlloc(Win32CsrApiHeap, 0, ReturnLength);
+ UserInfo = HeapAlloc(UserSrvHeap, 0, ReturnLength);
if (NULL == UserInfo)
{
DPRINT1("Unable to allocate %u bytes for user info\n",
@@ -823,7 +871,7 @@
{
DPRINT1("GetTokenInformation failed with error %d\n",
GetLastError());
- HeapFree(Win32CsrApiHeap, 0, UserInfo);
+ HeapFree(UserSrvHeap, 0, UserInfo);
CloseHandle(CallerToken);
return STATUS_UNSUCCESSFUL;
}
@@ -843,7 +891,7 @@
LoadShutdownSettings(UserInfo->User.Sid, &ShutdownSettings);
if (UserInfo != (TOKEN_USER *) FixedUserInfo)
{
- HeapFree(Win32CsrApiHeap, 0, UserInfo);
+ HeapFree(UserSrvHeap, 0, UserInfo);
}
Context.CsrssProcess = GetCurrentProcessId();
ShellWnd = GetShellWindow();
@@ -858,14 +906,14 @@
Context.ShellProcess = 0;
}
- Status = Win32CsrEnumProcesses(ExitReactosProcessEnum, &Context);
+ // Status = Win32CsrEnumProcesses(ExitReactosProcessEnum, &Context);
if (! NT_SUCCESS(Status))
{
DPRINT1("Failed to enumerate registered processes, status 0x%x\n",
Status);
if (NULL != Context.ProcessData)
{
- HeapFree(Win32CsrApiHeap, 0, Context.ProcessData);
+ HeapFree(UserSrvHeap, 0, Context.ProcessData);
}
return Status;
}
@@ -890,7 +938,7 @@
/* Cleanup */
if (NULL != Context.ProcessData)
{
- HeapFree(Win32CsrApiHeap, 0, Context.ProcessData);
+ HeapFree(UserSrvHeap, 0, Context.ProcessData);
}
return Status;
@@ -928,16 +976,18 @@
CSR_API(SrvExitWindowsEx)
{
- if (0 == (ApiMessage->Data.ExitReactosRequest.Flags & EWX_INTERNAL_FLAG))
+ PCSRSS_EXIT_REACTOS ExitReactosRequest =
&((PUSER_API_MESSAGE)ApiMessage)->Data.ExitReactosRequest;
+
+ if (0 == (ExitReactosRequest->Flags & EWX_INTERNAL_FLAG))
{
return UserExitReactos((DWORD_PTR) ApiMessage->Header.ClientId.UniqueProcess,
- ApiMessage->Data.ExitReactosRequest.Flags);
+ ExitReactosRequest->Flags);
}
else
{
return InternalExitReactos((DWORD_PTR)
ApiMessage->Header.ClientId.UniqueProcess,
(DWORD_PTR)
ApiMessage->Header.ClientId.UniqueThread,
- ApiMessage->Data.ExitReactosRequest.Flags);
+ ExitReactosRequest->Flags);
}
}
Modified: branches/ros-csrss/win32ss/user/winsrv/winsrv.h
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/winsrv/w…
==============================================================================
--- branches/ros-csrss/win32ss/user/winsrv/winsrv.h [iso-8859-1] (original)
+++ branches/ros-csrss/win32ss/user/winsrv/winsrv.h [iso-8859-1] Thu Oct 25 22:14:46 2012
@@ -19,6 +19,9 @@
// #include <stdio.h>
+/* External Winlogon Header */
+#include <winlogon.h>
+
/* CSRSS Header */
#include <csr/csrsrv.h>
@@ -27,8 +30,15 @@
// #include <win/base.h>
// #include <win/windows.h>
+/* Public Win32 Headers */
+#include <commctrl.h>
+
#include "resource.h"
+
+extern HANDLE UserSrvHeap;
+// extern HANDLE BaseSrvSharedHeap;
+// extern PBASE_STATIC_SERVER_DATA BaseStaticServerData;
/* init.c */
BOOL WINAPI _UserSoundSentry(VOID);