mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 06:33:01 +00:00
[NTDLL]
Fix CsrCaptureTimeout (verified against Windows Server 2003). [KERNEL32-CSRSRV-BASESRV-CONSRV-WINSRV] Clean the code: remove unuseful comments and dprints, reorganize a little bit few source files. svn path=/branches/ros-csrss/; revision=58453
This commit is contained in:
parent
fa34f9c8ee
commit
c708f46621
27 changed files with 760 additions and 1006 deletions
|
@ -263,7 +263,7 @@ CsrCaptureTimeout(IN ULONG Milliseconds,
|
||||||
if (Milliseconds == -1) return NULL;
|
if (Milliseconds == -1) return NULL;
|
||||||
|
|
||||||
/* Convert to relative ticks */
|
/* Convert to relative ticks */
|
||||||
Timeout->QuadPart = Int32x32To64(Milliseconds, -100000);
|
Timeout->QuadPart = Int32x32To64(Milliseconds, -10000);
|
||||||
return Timeout;
|
return Timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -173,10 +173,10 @@ NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
CsrpConnectToServer(IN PWSTR ObjectDirectory)
|
CsrpConnectToServer(IN PWSTR ObjectDirectory)
|
||||||
{
|
{
|
||||||
|
NTSTATUS Status;
|
||||||
ULONG PortNameLength;
|
ULONG PortNameLength;
|
||||||
UNICODE_STRING PortName;
|
UNICODE_STRING PortName;
|
||||||
LARGE_INTEGER CsrSectionViewSize;
|
LARGE_INTEGER CsrSectionViewSize;
|
||||||
NTSTATUS Status;
|
|
||||||
HANDLE CsrSectionHandle;
|
HANDLE CsrSectionHandle;
|
||||||
PORT_VIEW LpcWrite;
|
PORT_VIEW LpcWrite;
|
||||||
REMOTE_PORT_VIEW LpcRead;
|
REMOTE_PORT_VIEW LpcRead;
|
||||||
|
|
|
@ -840,8 +840,6 @@ AllocConsole(VOID)
|
||||||
PCSR_CAPTURE_BUFFER CaptureBuffer;
|
PCSR_CAPTURE_BUFFER CaptureBuffer;
|
||||||
SIZE_T Length = 0;
|
SIZE_T Length = 0;
|
||||||
|
|
||||||
DPRINT1("AllocConsole\n");
|
|
||||||
|
|
||||||
if (Parameters->ConsoleHandle)
|
if (Parameters->ConsoleHandle)
|
||||||
{
|
{
|
||||||
DPRINT1("AllocConsole: Allocating a console to a process already having one\n");
|
DPRINT1("AllocConsole: Allocating a console to a process already having one\n");
|
||||||
|
@ -1572,8 +1570,7 @@ IntGetConsoleTitle(LPVOID lpConsoleTitle, DWORD nSize, BOOL bUnicode)
|
||||||
PCONSOLE_GETSETCONSOLETITLE TitleRequest = &ApiMessage.Data.TitleRequest;
|
PCONSOLE_GETSETCONSOLETITLE TitleRequest = &ApiMessage.Data.TitleRequest;
|
||||||
PCSR_CAPTURE_BUFFER CaptureBuffer;
|
PCSR_CAPTURE_BUFFER CaptureBuffer;
|
||||||
|
|
||||||
if (nSize == 0)
|
if (nSize == 0) return 0;
|
||||||
return 0;
|
|
||||||
|
|
||||||
TitleRequest->Length = nSize * (bUnicode ? 1 : sizeof(WCHAR));
|
TitleRequest->Length = nSize * (bUnicode ? 1 : sizeof(WCHAR));
|
||||||
CaptureBuffer = CsrAllocateCaptureBuffer(1, TitleRequest->Length);
|
CaptureBuffer = CsrAllocateCaptureBuffer(1, TitleRequest->Length);
|
||||||
|
@ -1996,8 +1993,6 @@ AttachConsole(DWORD dwProcessId)
|
||||||
CONSOLE_API_MESSAGE ApiMessage;
|
CONSOLE_API_MESSAGE ApiMessage;
|
||||||
PCONSOLE_ATTACHCONSOLE AttachConsoleRequest = &ApiMessage.Data.AttachConsoleRequest;
|
PCONSOLE_ATTACHCONSOLE AttachConsoleRequest = &ApiMessage.Data.AttachConsoleRequest;
|
||||||
|
|
||||||
DPRINT1("AttachConsole(%lu)\n", dwProcessId);
|
|
||||||
|
|
||||||
if (Parameters->ConsoleHandle)
|
if (Parameters->ConsoleHandle)
|
||||||
{
|
{
|
||||||
DPRINT1("AttachConsole: Attaching a console to a process already having one\n");
|
DPRINT1("AttachConsole: Attaching a console to a process already having one\n");
|
||||||
|
|
|
@ -186,21 +186,6 @@ IntGetConsoleInput(HANDLE hConsoleInput,
|
||||||
|
|
||||||
/* Error out */
|
/* Error out */
|
||||||
BaseSetLastNTError(ApiMessage.Status);
|
BaseSetLastNTError(ApiMessage.Status);
|
||||||
|
|
||||||
/*********
|
|
||||||
// BaseSetLastNTError(Status); ????
|
|
||||||
if (GetInputRequest->InputsRead == 0)
|
|
||||||
{
|
|
||||||
/\* we couldn't read a single record, fail *\/
|
|
||||||
BaseSetLastNTError(Status);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/\* FIXME - fail gracefully in case we already read at least one record? *\/
|
|
||||||
// break;
|
|
||||||
}
|
|
||||||
*********/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Release the capture buffer */
|
/* Release the capture buffer */
|
||||||
|
@ -310,7 +295,7 @@ IntReadConsoleOutputCode(HANDLE hConsoleOutput,
|
||||||
PCONSOLE_READOUTPUTCODE ReadOutputCodeRequest = &ApiMessage.Data.ReadOutputCodeRequest;
|
PCONSOLE_READOUTPUTCODE ReadOutputCodeRequest = &ApiMessage.Data.ReadOutputCodeRequest;
|
||||||
PCSR_CAPTURE_BUFFER CaptureBuffer;
|
PCSR_CAPTURE_BUFFER CaptureBuffer;
|
||||||
ULONG SizeBytes, CodeSize;
|
ULONG SizeBytes, CodeSize;
|
||||||
DWORD /*CodesRead = 0,*/ BytesRead;
|
DWORD CodesRead;
|
||||||
|
|
||||||
/* Determine the needed size */
|
/* Determine the needed size */
|
||||||
switch (CodeType)
|
switch (CodeType)
|
||||||
|
@ -363,13 +348,13 @@ IntReadConsoleOutputCode(HANDLE hConsoleOutput,
|
||||||
/* Check for success */
|
/* Check for success */
|
||||||
if (NT_SUCCESS(Status) || NT_SUCCESS(Status = ApiMessage.Status))
|
if (NT_SUCCESS(Status) || NT_SUCCESS(Status = ApiMessage.Status))
|
||||||
{
|
{
|
||||||
BytesRead = ReadOutputCodeRequest->CodesRead * CodeSize;
|
CodesRead = ReadOutputCodeRequest->CodesRead;
|
||||||
memcpy(pCode, ReadOutputCodeRequest->pCode.pCode, BytesRead);
|
memcpy(pCode, ReadOutputCodeRequest->pCode.pCode, CodesRead * CodeSize);
|
||||||
|
|
||||||
// ReadOutputCodeRequest->ReadCoord = ReadOutputCodeRequest->EndCoord;
|
// ReadOutputCodeRequest->ReadCoord = ReadOutputCodeRequest->EndCoord;
|
||||||
|
|
||||||
if (lpNumberOfCodesRead != NULL)
|
if (lpNumberOfCodesRead != NULL)
|
||||||
*lpNumberOfCodesRead = ReadOutputCodeRequest->CodesRead;
|
*lpNumberOfCodesRead = CodesRead;
|
||||||
|
|
||||||
bRet = TRUE;
|
bRet = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -407,9 +392,7 @@ IntWriteConsole(HANDLE hConsoleOutput,
|
||||||
CONSOLE_API_MESSAGE ApiMessage;
|
CONSOLE_API_MESSAGE ApiMessage;
|
||||||
PCONSOLE_WRITECONSOLE WriteConsoleRequest = &ApiMessage.Data.WriteConsoleRequest;
|
PCONSOLE_WRITECONSOLE WriteConsoleRequest = &ApiMessage.Data.WriteConsoleRequest;
|
||||||
PCSR_CAPTURE_BUFFER CaptureBuffer;
|
PCSR_CAPTURE_BUFFER CaptureBuffer;
|
||||||
// USHORT nChars;
|
ULONG CharSize;
|
||||||
ULONG /* SizeBytes, */ CharSize;
|
|
||||||
// DWORD Written = 0;
|
|
||||||
|
|
||||||
/* Determine the needed size */
|
/* Determine the needed size */
|
||||||
CharSize = (bUnicode ? sizeof(WCHAR) : sizeof(CHAR));
|
CharSize = (bUnicode ? sizeof(WCHAR) : sizeof(CHAR));
|
||||||
|
@ -435,39 +418,16 @@ IntWriteConsole(HANDLE hConsoleOutput,
|
||||||
WriteConsoleRequest->OutputHandle = hConsoleOutput;
|
WriteConsoleRequest->OutputHandle = hConsoleOutput;
|
||||||
WriteConsoleRequest->Unicode = bUnicode;
|
WriteConsoleRequest->Unicode = bUnicode;
|
||||||
|
|
||||||
// while (nNumberOfCharsToWrite > 0) {
|
|
||||||
//// nChars = (USHORT)min(nNumberOfCharsToWrite, CSRSS_MAX_WRITE_CONSOLE / CharSize);
|
|
||||||
// nChars = nNumberOfCharsToWrite;
|
|
||||||
// WriteConsoleRequest->NrCharactersToWrite = nChars;
|
|
||||||
|
|
||||||
// SizeBytes = nChars * CharSize;
|
|
||||||
|
|
||||||
// memcpy(WriteConsoleRequest->Buffer, lpBuffer, SizeBytes);
|
|
||||||
|
|
||||||
/* Call the server */
|
/* Call the server */
|
||||||
Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
|
Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
|
||||||
CaptureBuffer,
|
CaptureBuffer,
|
||||||
CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepWriteConsole),
|
CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepWriteConsole),
|
||||||
sizeof(CONSOLE_WRITECONSOLE));
|
sizeof(CONSOLE_WRITECONSOLE));
|
||||||
/** FIXME: Added in 47359 for pausing
|
|
||||||
|
|
||||||
if (Status == STATUS_PENDING)
|
|
||||||
{
|
|
||||||
WaitForSingleObject(WriteConsoleRequest->UnpauseEvent, INFINITE);
|
|
||||||
CloseHandle(WriteConsoleRequest->UnpauseEvent);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
**/
|
|
||||||
/* Check for success */
|
/* Check for success */
|
||||||
if (NT_SUCCESS(Status) || NT_SUCCESS(Status = ApiMessage.Status))
|
if (NT_SUCCESS(Status) || NT_SUCCESS(Status = ApiMessage.Status))
|
||||||
{
|
{
|
||||||
// nNumberOfCharsToWrite -= nChars;
|
|
||||||
// lpBuffer = (PVOID)((ULONG_PTR)lpBuffer + (ULONG_PTR)SizeBytes);
|
|
||||||
// Written += WriteConsoleRequest->NrCharactersWritten;
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (lpNumberOfCharsWritten != NULL)
|
if (lpNumberOfCharsWritten != NULL)
|
||||||
// *lpNumberOfCharsWritten = Written;
|
|
||||||
*lpNumberOfCharsWritten = WriteConsoleRequest->NrCharactersWritten;
|
*lpNumberOfCharsWritten = WriteConsoleRequest->NrCharactersWritten;
|
||||||
|
|
||||||
bRet = TRUE;
|
bRet = TRUE;
|
||||||
|
@ -651,16 +611,9 @@ IntWriteConsoleOutputCode(HANDLE hConsoleOutput,
|
||||||
CONSOLE_API_MESSAGE ApiMessage;
|
CONSOLE_API_MESSAGE ApiMessage;
|
||||||
PCONSOLE_WRITEOUTPUTCODE WriteOutputCodeRequest = &ApiMessage.Data.WriteOutputCodeRequest;
|
PCONSOLE_WRITEOUTPUTCODE WriteOutputCodeRequest = &ApiMessage.Data.WriteOutputCodeRequest;
|
||||||
PCSR_CAPTURE_BUFFER CaptureBuffer;
|
PCSR_CAPTURE_BUFFER CaptureBuffer;
|
||||||
ULONG CodeSize; //, nChars;
|
ULONG CodeSize;
|
||||||
// ULONG SizeBytes;
|
|
||||||
// DWORD Written = 0;
|
|
||||||
|
|
||||||
/* Determine the needed size */
|
/* Determine the needed size */
|
||||||
/*
|
|
||||||
CodeSize = (bUnicode ? sizeof(WCHAR) : sizeof(CHAR));
|
|
||||||
nChars = min(nLength, CSRSS_MAX_WRITE_CONSOLE_OUTPUT_CHAR / CodeSize);
|
|
||||||
SizeBytes = nChars * CodeSize;
|
|
||||||
*/
|
|
||||||
switch (CodeType)
|
switch (CodeType)
|
||||||
{
|
{
|
||||||
case CODE_ASCII:
|
case CODE_ASCII:
|
||||||
|
@ -690,12 +643,6 @@ IntWriteConsoleOutputCode(HANDLE hConsoleOutput,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
/\* Allocate space in the Buffer *\/
|
|
||||||
CsrAllocateMessagePointer(CaptureBuffer,
|
|
||||||
SizeBytes,
|
|
||||||
(PVOID*)&WriteOutputCodeRequest->pCode.pCode);
|
|
||||||
*/
|
|
||||||
/* Capture the buffer to write */
|
/* Capture the buffer to write */
|
||||||
CsrCaptureMessageBuffer(CaptureBuffer,
|
CsrCaptureMessageBuffer(CaptureBuffer,
|
||||||
(PVOID)pCode,
|
(PVOID)pCode,
|
||||||
|
@ -707,10 +654,7 @@ IntWriteConsoleOutputCode(HANDLE hConsoleOutput,
|
||||||
WriteOutputCodeRequest->CodeType = CodeType;
|
WriteOutputCodeRequest->CodeType = CodeType;
|
||||||
WriteOutputCodeRequest->Coord = dwWriteCoord;
|
WriteOutputCodeRequest->Coord = dwWriteCoord;
|
||||||
|
|
||||||
WriteOutputCodeRequest->Length = nLength; // (WORD)min(nLength, nChars);
|
WriteOutputCodeRequest->Length = nLength;
|
||||||
// BytesWrite = WriteOutputCodeRequest->Length * CodeSize;
|
|
||||||
|
|
||||||
// memcpy(WriteOutputCodeRequest->pCode.pCode, pCode, BytesWrite);
|
|
||||||
|
|
||||||
/* Call the server */
|
/* Call the server */
|
||||||
Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
|
Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
|
||||||
|
@ -721,14 +665,9 @@ IntWriteConsoleOutputCode(HANDLE hConsoleOutput,
|
||||||
/* Check for success */
|
/* Check for success */
|
||||||
if (NT_SUCCESS(Status) || NT_SUCCESS(Status = ApiMessage.Status))
|
if (NT_SUCCESS(Status) || NT_SUCCESS(Status = ApiMessage.Status))
|
||||||
{
|
{
|
||||||
// nLength -= WriteOutputCodeRequest->NrCharactersWritten;
|
|
||||||
// pCode = (PVOID)((ULONG_PTR)pCode + /*(ULONG_PTR)(*/WriteOutputCodeRequest->NrCharactersWritten * CodeSize/*)*/);
|
|
||||||
// Written += WriteOutputCodeRequest->NrCharactersWritten;
|
|
||||||
|
|
||||||
// WriteOutputCodeRequest->Coord = WriteOutputCodeRequest->EndCoord;
|
// WriteOutputCodeRequest->Coord = WriteOutputCodeRequest->EndCoord;
|
||||||
|
|
||||||
if (lpNumberOfCodesWritten != NULL)
|
if (lpNumberOfCodesWritten != NULL)
|
||||||
// *lpNumberOfCodesWritten = Written;
|
|
||||||
// *lpNumberOfCodesWritten = WriteOutputCodeRequest->NrCharactersWritten;
|
// *lpNumberOfCodesWritten = WriteOutputCodeRequest->NrCharactersWritten;
|
||||||
*lpNumberOfCodesWritten = WriteOutputCodeRequest->Length;
|
*lpNumberOfCodesWritten = WriteOutputCodeRequest->Length;
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,7 @@ typedef struct _CSR_API_MESSAGE
|
||||||
{
|
{
|
||||||
PCSR_CAPTURE_BUFFER CsrCaptureData;
|
PCSR_CAPTURE_BUFFER CsrCaptureData;
|
||||||
CSR_API_NUMBER ApiNumber;
|
CSR_API_NUMBER ApiNumber;
|
||||||
ULONG Status; // ReturnValue; // NTSTATUS Status
|
NTSTATUS Status; // ReturnValue;
|
||||||
ULONG Reserved;
|
ULONG Reserved;
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
typedef VOID (CALLBACK * BASE_PROCESS_CREATE_NOTIFY_ROUTINE)(PVOID);
|
typedef VOID (CALLBACK * BASE_PROCESS_CREATE_NOTIFY_ROUTINE)(PVOID);
|
||||||
|
|
||||||
NTSTATUS WINAPI BaseSetProcessCreateNotify(BASE_PROCESS_CREATE_NOTIFY_ROUTINE);
|
NTSTATUS WINAPI BaseSetProcessCreateNotify(BASE_PROCESS_CREATE_NOTIFY_ROUTINE);
|
||||||
// CSR_SERVER_DLL_INIT(ServerDllInitialization);
|
|
||||||
|
|
||||||
typedef struct _NLS_USER_INFO
|
typedef struct _NLS_USER_INFO
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,8 +15,7 @@
|
||||||
#define BASESRV_SERVERDLL_INDEX 1
|
#define BASESRV_SERVERDLL_INDEX 1
|
||||||
#define BASESRV_FIRST_API_NUMBER 0
|
#define BASESRV_FIRST_API_NUMBER 0
|
||||||
|
|
||||||
// Windows NT 4 table, adapted from http://j00ru.vexillium.org/csrss_list/api_list.html#Windows_NT
|
// Windows Server 2003 table from http://j00ru.vexillium.org/csrss_list/api_list.html#Windows_2k3
|
||||||
// It is for testing purposes. After that I will update it to 2k3 version and add stubs.
|
|
||||||
typedef enum _BASESRV_API_NUMBER
|
typedef enum _BASESRV_API_NUMBER
|
||||||
{
|
{
|
||||||
BasepCreateProcess = BASESRV_FIRST_API_NUMBER,
|
BasepCreateProcess = BASESRV_FIRST_API_NUMBER,
|
||||||
|
@ -35,8 +34,7 @@ typedef enum _BASESRV_API_NUMBER
|
||||||
BasepGetProcessShutdownParam,
|
BasepGetProcessShutdownParam,
|
||||||
// BasepNlsSetUserInfo,
|
// BasepNlsSetUserInfo,
|
||||||
// BasepNlsSetMultipleUserInfo,
|
// BasepNlsSetMultipleUserInfo,
|
||||||
// BasepNlsCreateSortSection,
|
// BasepNlsCreateSection,
|
||||||
// BasepNlsPreserveSection,
|
|
||||||
// BasepSetVDMCurDirs,
|
// BasepSetVDMCurDirs,
|
||||||
// BasepGetVDMCurDirs,
|
// BasepGetVDMCurDirs,
|
||||||
// BasepBatNotification,
|
// BasepBatNotification,
|
||||||
|
@ -44,6 +42,12 @@ typedef enum _BASESRV_API_NUMBER
|
||||||
BasepSoundSentryNotification,
|
BasepSoundSentryNotification,
|
||||||
// BasepRefreshIniFileMapping,
|
// BasepRefreshIniFileMapping,
|
||||||
BasepDefineDosDevice,
|
BasepDefineDosDevice,
|
||||||
|
// BasepSetTermsrvAppInstallMode,
|
||||||
|
// BasepNlsUpdateCacheCount,
|
||||||
|
// BasepSetTermsrvClientTimeZone,
|
||||||
|
// BasepSxsCreateActivationContext,
|
||||||
|
// BasepRegisterThread,
|
||||||
|
// BasepNlsGetUserInfo,
|
||||||
|
|
||||||
BasepMaxApiNumber
|
BasepMaxApiNumber
|
||||||
} BASESRV_API_NUMBER, *PBASESRV_API_NUMBER;
|
} BASESRV_API_NUMBER, *PBASESRV_API_NUMBER;
|
||||||
|
@ -180,7 +184,7 @@ typedef struct _BASE_API_MESSAGE
|
||||||
|
|
||||||
PCSR_CAPTURE_BUFFER CsrCaptureData;
|
PCSR_CAPTURE_BUFFER CsrCaptureData;
|
||||||
CSR_API_NUMBER ApiNumber;
|
CSR_API_NUMBER ApiNumber;
|
||||||
ULONG Status; // ReturnValue; // NTSTATUS Status
|
NTSTATUS Status; // ReturnValue;
|
||||||
ULONG Reserved;
|
ULONG Reserved;
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,9 +15,8 @@
|
||||||
#define CONSRV_SERVERDLL_INDEX 2
|
#define CONSRV_SERVERDLL_INDEX 2
|
||||||
#define CONSRV_FIRST_API_NUMBER 512
|
#define CONSRV_FIRST_API_NUMBER 512
|
||||||
|
|
||||||
// Windows 2k3 tables, adapted from http://j00ru.vexillium.org/csrss_list/api_list.html#Windows_2k3
|
// Windows Server 2003 table from http://j00ru.vexillium.org/csrss_list/api_list.html#Windows_2k3
|
||||||
// plus a little bit of Windows 7. It is for testing purposes. After that I will add stubs.
|
// plus a little bit of Windows 7.
|
||||||
// Some names are also deduced from the subsystems/win32/csrss/csrsrv/server.c ones.
|
|
||||||
typedef enum _CONSRV_API_NUMBER
|
typedef enum _CONSRV_API_NUMBER
|
||||||
{
|
{
|
||||||
ConsolepOpenConsole = CONSRV_FIRST_API_NUMBER,
|
ConsolepOpenConsole = CONSRV_FIRST_API_NUMBER,
|
||||||
|
@ -564,7 +563,7 @@ typedef struct _CONSOLE_API_MESSAGE
|
||||||
|
|
||||||
PCSR_CAPTURE_BUFFER CsrCaptureData;
|
PCSR_CAPTURE_BUFFER CsrCaptureData;
|
||||||
CSR_API_NUMBER ApiNumber;
|
CSR_API_NUMBER ApiNumber;
|
||||||
ULONG Status; // ReturnValue; // NTSTATUS Status
|
NTSTATUS Status; // ReturnValue;
|
||||||
ULONG Reserved;
|
ULONG Reserved;
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,8 +15,7 @@
|
||||||
#define USERSRV_SERVERDLL_INDEX 3
|
#define USERSRV_SERVERDLL_INDEX 3
|
||||||
#define USERSRV_FIRST_API_NUMBER 1024
|
#define USERSRV_FIRST_API_NUMBER 1024
|
||||||
|
|
||||||
// CSR_SERVER_DLL_INIT(UserServerDllInitialization);
|
// Windows Server 2003 table from http://j00ru.vexillium.org/csrss_list/api_list.html#Windows_2k3
|
||||||
|
|
||||||
typedef enum _USERSRV_API_NUMBER
|
typedef enum _USERSRV_API_NUMBER
|
||||||
{
|
{
|
||||||
UserpExitWindowsEx = USERSRV_FIRST_API_NUMBER,
|
UserpExitWindowsEx = USERSRV_FIRST_API_NUMBER,
|
||||||
|
@ -70,7 +69,7 @@ typedef struct _USER_API_MESSAGE
|
||||||
|
|
||||||
PCSR_CAPTURE_BUFFER CsrCaptureData;
|
PCSR_CAPTURE_BUFFER CsrCaptureData;
|
||||||
CSR_API_NUMBER ApiNumber;
|
CSR_API_NUMBER ApiNumber;
|
||||||
ULONG Status; // ReturnValue; // NTSTATUS Status
|
NTSTATUS Status; // ReturnValue;
|
||||||
ULONG Reserved;
|
ULONG Reserved;
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,8 +4,10 @@ include_directories(${REACTOS_SOURCE_DIR}/include/reactos/subsys)
|
||||||
spec2def(basesrv.dll basesrv.spec)
|
spec2def(basesrv.dll basesrv.spec)
|
||||||
|
|
||||||
list(APPEND SOURCE
|
list(APPEND SOURCE
|
||||||
|
dosdev.c
|
||||||
init.c
|
init.c
|
||||||
server.c
|
proc.c
|
||||||
|
sndsntry.c
|
||||||
basesrv.rc
|
basesrv.rc
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/basesrv.def)
|
${CMAKE_CURRENT_BINARY_DIR}/basesrv.def)
|
||||||
|
|
||||||
|
|
|
@ -29,16 +29,22 @@ extern HANDLE BaseSrvHeap;
|
||||||
extern HANDLE BaseSrvSharedHeap;
|
extern HANDLE BaseSrvSharedHeap;
|
||||||
extern PBASE_STATIC_SERVER_DATA BaseStaticServerData;
|
extern PBASE_STATIC_SERVER_DATA BaseStaticServerData;
|
||||||
|
|
||||||
|
/* dosdev.c */
|
||||||
|
VOID BaseInitDefineDosDevice(VOID);
|
||||||
VOID BaseCleanupDefineDosDevice(VOID);
|
VOID BaseCleanupDefineDosDevice(VOID);
|
||||||
|
|
||||||
|
CSR_API(BaseSrvDefineDosDevice);
|
||||||
|
|
||||||
|
/* proc.c */
|
||||||
|
CSR_API(BaseSrvGetTempFile);
|
||||||
CSR_API(BaseSrvCreateProcess);
|
CSR_API(BaseSrvCreateProcess);
|
||||||
CSR_API(BaseSrvCreateThread);
|
CSR_API(BaseSrvCreateThread);
|
||||||
CSR_API(BaseSrvGetTempFile);
|
|
||||||
CSR_API(BaseSrvExitProcess);
|
CSR_API(BaseSrvExitProcess);
|
||||||
CSR_API(BaseSrvGetProcessShutdownParam);
|
CSR_API(BaseSrvGetProcessShutdownParam);
|
||||||
CSR_API(BaseSrvSetProcessShutdownParam);
|
CSR_API(BaseSrvSetProcessShutdownParam);
|
||||||
|
|
||||||
|
/* sndsntry.c */
|
||||||
CSR_API(BaseSrvSoundSentryNotification);
|
CSR_API(BaseSrvSoundSentryNotification);
|
||||||
CSR_API(BaseSrvDefineDosDevice);
|
|
||||||
|
|
||||||
#endif // __BASESRV_H__
|
#endif // __BASESRV_H__
|
||||||
|
|
||||||
|
|
|
@ -1,305 +1,44 @@
|
||||||
/*
|
/*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS/Win32 Base enviroment Subsystem Server
|
* PROJECT: ReactOS/Win32 Base enviroment Subsystem Server
|
||||||
* FILE: subsystems/win/basesrv/server.c
|
* FILE: subsystems/win/basesrv/dosdev.c
|
||||||
* PURPOSE: Server APIs
|
* PURPOSE: DOS Devices Management
|
||||||
* PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca@sfr.fr)
|
* PROGRAMMERS: Pierre Schweitzer (pierre.schweitzer@reactos.org)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* INCLUDES *******************************************************************/
|
||||||
|
|
||||||
#include "basesrv.h"
|
#include "basesrv.h"
|
||||||
|
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
CSR_API(BaseSrvCreateProcess)
|
/* GLOBALS ********************************************************************/
|
||||||
{
|
|
||||||
NTSTATUS Status;
|
typedef struct _BASE_DOS_DEVICE_HISTORY_ENTRY
|
||||||
PBASE_CREATE_PROCESS CreateProcessRequest = &((PBASE_API_MESSAGE)ApiMessage)->Data.CreateProcessRequest;
|
|
||||||
HANDLE ProcessHandle, ThreadHandle;
|
|
||||||
PCSR_THREAD CsrThread;
|
|
||||||
PCSR_PROCESS Process;
|
|
||||||
ULONG Flags = 0, VdmPower = 0, DebugFlags = 0;
|
|
||||||
|
|
||||||
/* Get the current client thread */
|
|
||||||
CsrThread = CsrGetClientThread();
|
|
||||||
ASSERT(CsrThread != NULL);
|
|
||||||
|
|
||||||
Process = CsrThread->Process;
|
|
||||||
|
|
||||||
/* Extract the flags out of the process handle */
|
|
||||||
Flags = (ULONG_PTR)CreateProcessRequest->ProcessHandle & 3;
|
|
||||||
CreateProcessRequest->ProcessHandle = (HANDLE)((ULONG_PTR)CreateProcessRequest->ProcessHandle & ~3);
|
|
||||||
|
|
||||||
/* Duplicate the process handle */
|
|
||||||
Status = NtDuplicateObject(Process->ProcessHandle,
|
|
||||||
CreateProcessRequest->ProcessHandle,
|
|
||||||
NtCurrentProcess(),
|
|
||||||
&ProcessHandle,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
DUPLICATE_SAME_ACCESS);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
DPRINT1("Failed to duplicate process handle\n");
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Duplicate the thread handle */
|
|
||||||
Status = NtDuplicateObject(Process->ProcessHandle,
|
|
||||||
CreateProcessRequest->ThreadHandle,
|
|
||||||
NtCurrentProcess(),
|
|
||||||
&ThreadHandle,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
DUPLICATE_SAME_ACCESS);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
DPRINT1("Failed to duplicate process handle\n");
|
|
||||||
NtClose(ProcessHandle);
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* See if this is a VDM process */
|
|
||||||
if (VdmPower)
|
|
||||||
{
|
|
||||||
/* Request VDM powers */
|
|
||||||
Status = NtSetInformationProcess(ProcessHandle,
|
|
||||||
ProcessWx86Information,
|
|
||||||
&VdmPower,
|
|
||||||
sizeof(VdmPower));
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
DPRINT1("Failed to get VDM powers\n");
|
|
||||||
NtClose(ProcessHandle);
|
|
||||||
NtClose(ThreadHandle);
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Flags conversion. FIXME: More need conversion */
|
|
||||||
if (CreateProcessRequest->CreationFlags & CREATE_NEW_PROCESS_GROUP)
|
|
||||||
{
|
|
||||||
DebugFlags |= CsrProcessCreateNewGroup;
|
|
||||||
}
|
|
||||||
if ((Flags & 2) == 0)
|
|
||||||
{
|
|
||||||
/* We are launching a console process */
|
|
||||||
DebugFlags |= CsrProcessIsConsoleApp;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* FIXME: SxS Stuff */
|
|
||||||
|
|
||||||
/* Call CSRSRV to create the CSR_PROCESS structure and the first CSR_THREAD */
|
|
||||||
Status = CsrCreateProcess(ProcessHandle,
|
|
||||||
ThreadHandle,
|
|
||||||
&CreateProcessRequest->ClientId,
|
|
||||||
Process->NtSession,
|
|
||||||
DebugFlags,
|
|
||||||
NULL);
|
|
||||||
if (Status == STATUS_THREAD_IS_TERMINATING)
|
|
||||||
{
|
|
||||||
DPRINT1("Thread already dead\n");
|
|
||||||
|
|
||||||
/* Set the special reply value so we don't reply this message back */
|
|
||||||
*ReplyCode = CsrReplyDeadClient;
|
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check for other failures */
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
DPRINT1("Failed to create process/thread structures: %lx\n", Status);
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* FIXME: Should notify user32 */
|
|
||||||
|
|
||||||
/* FIXME: VDM vodoo */
|
|
||||||
|
|
||||||
/* Return the result of this operation */
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
CSR_API(BaseSrvCreateThread)
|
|
||||||
{
|
|
||||||
NTSTATUS Status;
|
|
||||||
PBASE_CREATE_THREAD CreateThreadRequest = &((PBASE_API_MESSAGE)ApiMessage)->Data.CreateThreadRequest;
|
|
||||||
PCSR_THREAD CurrentThread;
|
|
||||||
HANDLE ThreadHandle;
|
|
||||||
PCSR_PROCESS CsrProcess;
|
|
||||||
|
|
||||||
/* Get the current CSR thread */
|
|
||||||
CurrentThread = CsrGetClientThread();
|
|
||||||
if (!CurrentThread)
|
|
||||||
{
|
|
||||||
DPRINT1("Server Thread TID: [%lx.%lx]\n",
|
|
||||||
CreateThreadRequest->ClientId.UniqueProcess,
|
|
||||||
CreateThreadRequest->ClientId.UniqueThread);
|
|
||||||
return STATUS_SUCCESS; // server-to-server
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get the CSR Process for this request */
|
|
||||||
CsrProcess = CurrentThread->Process;
|
|
||||||
if (CsrProcess->ClientId.UniqueProcess !=
|
|
||||||
CreateThreadRequest->ClientId.UniqueProcess)
|
|
||||||
{
|
|
||||||
/* This is a remote thread request -- is it within the server itself? */
|
|
||||||
if (CreateThreadRequest->ClientId.UniqueProcess == NtCurrentTeb()->ClientId.UniqueProcess)
|
|
||||||
{
|
|
||||||
/* Accept this without any further work */
|
|
||||||
return STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get the real CSR Process for the remote thread's process */
|
|
||||||
Status = CsrLockProcessByClientId(CreateThreadRequest->ClientId.UniqueProcess,
|
|
||||||
&CsrProcess);
|
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Duplicate the thread handle so we can own it */
|
|
||||||
Status = NtDuplicateObject(CurrentThread->Process->ProcessHandle,
|
|
||||||
CreateThreadRequest->ThreadHandle,
|
|
||||||
NtCurrentProcess(),
|
|
||||||
&ThreadHandle,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
DUPLICATE_SAME_ACCESS);
|
|
||||||
if (NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
/* Call CSRSRV to tell it about the new thread */
|
|
||||||
Status = CsrCreateThread(CsrProcess,
|
|
||||||
ThreadHandle,
|
|
||||||
&CreateThreadRequest->ClientId,
|
|
||||||
TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Unlock the process and return */
|
|
||||||
if (CsrProcess != CurrentThread->Process) CsrUnlockProcess(CsrProcess);
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
CSR_API(BaseSrvGetTempFile)
|
|
||||||
{
|
|
||||||
static UINT CsrGetTempFileUnique = 0;
|
|
||||||
PBASE_GET_TEMP_FILE GetTempFile = &((PBASE_API_MESSAGE)ApiMessage)->Data.GetTempFile;
|
|
||||||
|
|
||||||
/* Return 16-bits ID */
|
|
||||||
GetTempFile->UniqueID = (++CsrGetTempFileUnique & 0xFFFF);
|
|
||||||
|
|
||||||
DPRINT("Returning: %u\n", GetTempFile->UniqueID);
|
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
CSR_API(BaseSrvExitProcess)
|
|
||||||
{
|
|
||||||
PCSR_THREAD CsrThread = CsrGetClientThread();
|
|
||||||
ASSERT(CsrThread != NULL);
|
|
||||||
|
|
||||||
/* Set the special reply value so we don't reply this message back */
|
|
||||||
*ReplyCode = CsrReplyDeadClient;
|
|
||||||
|
|
||||||
/* Remove the CSR_THREADs and CSR_PROCESS */
|
|
||||||
return CsrDestroyProcess(&CsrThread->ClientId,
|
|
||||||
(NTSTATUS)((PBASE_API_MESSAGE)ApiMessage)->Data.ExitProcessRequest.uExitCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
CSR_API(BaseSrvGetProcessShutdownParam)
|
|
||||||
{
|
|
||||||
PBASE_GET_PROCESS_SHUTDOWN_PARAMS GetShutdownParametersRequest = &((PBASE_API_MESSAGE)ApiMessage)->Data.GetShutdownParametersRequest;
|
|
||||||
PCSR_THREAD CsrThread = CsrGetClientThread();
|
|
||||||
ASSERT(CsrThread);
|
|
||||||
|
|
||||||
GetShutdownParametersRequest->Level = CsrThread->Process->ShutdownLevel;
|
|
||||||
GetShutdownParametersRequest->Flags = CsrThread->Process->ShutdownFlags;
|
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
CSR_API(BaseSrvSetProcessShutdownParam)
|
|
||||||
{
|
|
||||||
PBASE_SET_PROCESS_SHUTDOWN_PARAMS SetShutdownParametersRequest = &((PBASE_API_MESSAGE)ApiMessage)->Data.SetShutdownParametersRequest;
|
|
||||||
PCSR_THREAD CsrThread = CsrGetClientThread();
|
|
||||||
ASSERT(CsrThread);
|
|
||||||
|
|
||||||
CsrThread->Process->ShutdownLevel = SetShutdownParametersRequest->Level;
|
|
||||||
CsrThread->Process->ShutdownFlags = SetShutdownParametersRequest->Flags;
|
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***
|
|
||||||
*** Sound sentry
|
|
||||||
***/
|
|
||||||
|
|
||||||
typedef BOOL (WINAPI *PUSER_SOUND_SENTRY)(VOID);
|
|
||||||
BOOL NTAPI FirstSoundSentry(VOID);
|
|
||||||
|
|
||||||
PUSER_SOUND_SENTRY _UserSoundSentry = FirstSoundSentry;
|
|
||||||
|
|
||||||
BOOL
|
|
||||||
NTAPI
|
|
||||||
FailSoundSentry(VOID)
|
|
||||||
{
|
|
||||||
/* In case the function can't be found/is unimplemented */
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL
|
|
||||||
NTAPI
|
|
||||||
FirstSoundSentry(VOID)
|
|
||||||
{
|
|
||||||
UNICODE_STRING DllString = RTL_CONSTANT_STRING(L"winsrv");
|
|
||||||
STRING FuncString = RTL_CONSTANT_STRING("_UserSoundSentry");
|
|
||||||
HANDLE DllHandle;
|
|
||||||
NTSTATUS Status;
|
|
||||||
PUSER_SOUND_SENTRY NewSoundSentry = FailSoundSentry;
|
|
||||||
|
|
||||||
/* Load winsrv manually */
|
|
||||||
Status = LdrGetDllHandle(NULL, NULL, &DllString, &DllHandle);
|
|
||||||
if (NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
/* If it was found, get SoundSentry export */
|
|
||||||
Status = LdrGetProcedureAddress(DllHandle,
|
|
||||||
&FuncString,
|
|
||||||
0,
|
|
||||||
(PVOID*)&NewSoundSentry);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set it as the callback for the future, and call it */
|
|
||||||
_UserSoundSentry = NewSoundSentry;
|
|
||||||
return _UserSoundSentry();
|
|
||||||
}
|
|
||||||
|
|
||||||
CSR_API(BaseSrvSoundSentryNotification)
|
|
||||||
{
|
|
||||||
/* Call the API and see if it succeeds */
|
|
||||||
return _UserSoundSentry() ? STATUS_SUCCESS : STATUS_ACCESS_DENIED;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***
|
|
||||||
*** Dos Devices (C) Pierre Schweitzer (pierre.schweitzer@reactos.org)
|
|
||||||
***/
|
|
||||||
|
|
||||||
typedef struct tagBASE_DOS_DEVICE_HISTORY_ENTRY
|
|
||||||
{
|
{
|
||||||
|
LIST_ENTRY Entry;
|
||||||
UNICODE_STRING Device;
|
UNICODE_STRING Device;
|
||||||
UNICODE_STRING Target;
|
UNICODE_STRING Target;
|
||||||
LIST_ENTRY Entry;
|
|
||||||
} BASE_DOS_DEVICE_HISTORY_ENTRY, *PBASE_DOS_DEVICE_HISTORY_ENTRY;
|
} BASE_DOS_DEVICE_HISTORY_ENTRY, *PBASE_DOS_DEVICE_HISTORY_ENTRY;
|
||||||
|
|
||||||
LIST_ENTRY DosDeviceHistory;
|
static RTL_CRITICAL_SECTION BaseDefineDosDeviceCritSec;
|
||||||
RTL_CRITICAL_SECTION BaseDefineDosDeviceCritSec;
|
static LIST_ENTRY DosDeviceHistory;
|
||||||
|
|
||||||
|
/* PRIVATE FUNCTIONS **********************************************************/
|
||||||
|
|
||||||
|
VOID BaseInitDefineDosDevice(VOID)
|
||||||
|
{
|
||||||
|
RtlInitializeCriticalSection(&BaseDefineDosDeviceCritSec);
|
||||||
|
InitializeListHead(&DosDeviceHistory);
|
||||||
|
}
|
||||||
|
|
||||||
VOID BaseCleanupDefineDosDevice(VOID)
|
VOID BaseCleanupDefineDosDevice(VOID)
|
||||||
{
|
{
|
||||||
PLIST_ENTRY Entry, ListHead;
|
PLIST_ENTRY Entry, ListHead;
|
||||||
PBASE_DOS_DEVICE_HISTORY_ENTRY HistoryEntry;
|
PBASE_DOS_DEVICE_HISTORY_ENTRY HistoryEntry;
|
||||||
|
|
||||||
(void) RtlDeleteCriticalSection(&BaseDefineDosDeviceCritSec);
|
RtlDeleteCriticalSection(&BaseDefineDosDeviceCritSec);
|
||||||
|
|
||||||
ListHead = &DosDeviceHistory;
|
ListHead = &DosDeviceHistory;
|
||||||
Entry = ListHead->Flink;
|
Entry = ListHead->Flink;
|
||||||
|
@ -314,20 +53,26 @@ VOID BaseCleanupDefineDosDevice(VOID)
|
||||||
if (HistoryEntry)
|
if (HistoryEntry)
|
||||||
{
|
{
|
||||||
if (HistoryEntry->Target.Buffer)
|
if (HistoryEntry->Target.Buffer)
|
||||||
(void) RtlFreeHeap(BaseSrvHeap,
|
{
|
||||||
|
RtlFreeHeap(BaseSrvHeap,
|
||||||
0,
|
0,
|
||||||
HistoryEntry->Target.Buffer);
|
HistoryEntry->Target.Buffer);
|
||||||
|
}
|
||||||
if (HistoryEntry->Device.Buffer)
|
if (HistoryEntry->Device.Buffer)
|
||||||
(void) RtlFreeHeap(BaseSrvHeap,
|
{
|
||||||
|
RtlFreeHeap(BaseSrvHeap,
|
||||||
0,
|
0,
|
||||||
HistoryEntry->Device.Buffer);
|
HistoryEntry->Device.Buffer);
|
||||||
(void) RtlFreeHeap(BaseSrvHeap,
|
}
|
||||||
|
RtlFreeHeap(BaseSrvHeap,
|
||||||
0,
|
0,
|
||||||
HistoryEntry);
|
HistoryEntry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* PUBLIC SERVER APIS *********************************************************/
|
||||||
|
|
||||||
CSR_API(BaseSrvDefineDosDevice)
|
CSR_API(BaseSrvDefineDosDevice)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
@ -369,13 +114,13 @@ CSR_API(BaseSrvDefineDosDevice)
|
||||||
/* Validate the flags */
|
/* Validate the flags */
|
||||||
if ( (dwFlags & 0xFFFFFFF0) ||
|
if ( (dwFlags & 0xFFFFFFF0) ||
|
||||||
((dwFlags & DDD_EXACT_MATCH_ON_REMOVE) &&
|
((dwFlags & DDD_EXACT_MATCH_ON_REMOVE) &&
|
||||||
! (dwFlags & DDD_REMOVE_DEFINITION)) )
|
!(dwFlags & DDD_REMOVE_DEFINITION)) )
|
||||||
{
|
{
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = RtlEnterCriticalSection(&BaseDefineDosDeviceCritSec);
|
Status = RtlEnterCriticalSection(&BaseDefineDosDeviceCritSec);
|
||||||
if (! NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("RtlEnterCriticalSection() failed (Status %lx)\n",
|
DPRINT1("RtlEnterCriticalSection() failed (Status %lx)\n",
|
||||||
Status);
|
Status);
|
||||||
|
@ -388,14 +133,14 @@ CSR_API(BaseSrvDefineDosDevice)
|
||||||
RtlUpcaseUnicodeString(&RequestDeviceName,
|
RtlUpcaseUnicodeString(&RequestDeviceName,
|
||||||
&DefineDosDeviceRequest->DeviceName,
|
&DefineDosDeviceRequest->DeviceName,
|
||||||
TRUE);
|
TRUE);
|
||||||
if (! NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
_SEH2_LEAVE;
|
_SEH2_LEAVE;
|
||||||
|
|
||||||
RequestLinkTarget = &DefineDosDeviceRequest->TargetName;
|
RequestLinkTarget = &DefineDosDeviceRequest->TargetName;
|
||||||
lpBuffer = (PWSTR) RtlAllocateHeap(BaseSrvHeap,
|
lpBuffer = (PWSTR) RtlAllocateHeap(BaseSrvHeap,
|
||||||
HEAP_ZERO_MEMORY,
|
HEAP_ZERO_MEMORY,
|
||||||
RequestDeviceName.MaximumLength + 5 * sizeof(WCHAR));
|
RequestDeviceName.MaximumLength + 5 * sizeof(WCHAR));
|
||||||
if (! lpBuffer)
|
if (!lpBuffer)
|
||||||
{
|
{
|
||||||
DPRINT1("Failed to allocate memory\n");
|
DPRINT1("Failed to allocate memory\n");
|
||||||
Status = STATUS_NO_MEMORY;
|
Status = STATUS_NO_MEMORY;
|
||||||
|
@ -420,7 +165,7 @@ CSR_API(BaseSrvDefineDosDevice)
|
||||||
Status = NtQuerySymbolicLinkObject(LinkHandle,
|
Status = NtQuerySymbolicLinkObject(LinkHandle,
|
||||||
&LinkTarget,
|
&LinkTarget,
|
||||||
&Length);
|
&Length);
|
||||||
if (! NT_SUCCESS(Status) &&
|
if (!NT_SUCCESS(Status) &&
|
||||||
Status == STATUS_BUFFER_TOO_SMALL)
|
Status == STATUS_BUFFER_TOO_SMALL)
|
||||||
{
|
{
|
||||||
LinkTarget.Length = 0;
|
LinkTarget.Length = 0;
|
||||||
|
@ -429,7 +174,7 @@ CSR_API(BaseSrvDefineDosDevice)
|
||||||
RtlAllocateHeap(BaseSrvHeap,
|
RtlAllocateHeap(BaseSrvHeap,
|
||||||
HEAP_ZERO_MEMORY,
|
HEAP_ZERO_MEMORY,
|
||||||
Length);
|
Length);
|
||||||
if (! LinkTarget.Buffer)
|
if (!LinkTarget.Buffer)
|
||||||
{
|
{
|
||||||
DPRINT1("Failed to allocate memory\n");
|
DPRINT1("Failed to allocate memory\n");
|
||||||
Status = STATUS_NO_MEMORY;
|
Status = STATUS_NO_MEMORY;
|
||||||
|
@ -441,7 +186,7 @@ CSR_API(BaseSrvDefineDosDevice)
|
||||||
&Length);
|
&Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("NtQuerySymbolicLinkObject(%wZ) failed (Status %lx)\n",
|
DPRINT1("NtQuerySymbolicLinkObject(%wZ) failed (Status %lx)\n",
|
||||||
&DeviceName, Status);
|
&DeviceName, Status);
|
||||||
|
@ -456,7 +201,7 @@ CSR_API(BaseSrvDefineDosDevice)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (dwFlags & DDD_EXACT_MATCH_ON_REMOVE)
|
if (dwFlags & DDD_EXACT_MATCH_ON_REMOVE)
|
||||||
Matched = ! RtlCompareUnicodeString(RequestLinkTarget,
|
Matched = !RtlCompareUnicodeString(RequestLinkTarget,
|
||||||
&LinkTarget,
|
&LinkTarget,
|
||||||
TRUE);
|
TRUE);
|
||||||
else
|
else
|
||||||
|
@ -470,10 +215,12 @@ CSR_API(BaseSrvDefineDosDevice)
|
||||||
/* Current symlink target macthed and there is nothing to revert to */
|
/* Current symlink target macthed and there is nothing to revert to */
|
||||||
RequestLinkTarget = NULL;
|
RequestLinkTarget = NULL;
|
||||||
}
|
}
|
||||||
else if (Matched && ! IsListEmpty(ListHead))
|
else if (Matched && !IsListEmpty(ListHead))
|
||||||
{
|
{
|
||||||
/* Fetch the first history entry we come across for the device name */
|
/*
|
||||||
/* This will become the current symlink target for the device name */
|
* Fetch the first history entry we come across for the device name.
|
||||||
|
* This will become the current symlink target for the device name.
|
||||||
|
*/
|
||||||
Matched = FALSE;
|
Matched = FALSE;
|
||||||
Entry = ListHead->Flink;
|
Entry = ListHead->Flink;
|
||||||
while (Entry != ListHead)
|
while (Entry != ListHead)
|
||||||
|
@ -483,7 +230,7 @@ CSR_API(BaseSrvDefineDosDevice)
|
||||||
BASE_DOS_DEVICE_HISTORY_ENTRY,
|
BASE_DOS_DEVICE_HISTORY_ENTRY,
|
||||||
Entry);
|
Entry);
|
||||||
Matched =
|
Matched =
|
||||||
! RtlCompareUnicodeString(&RequestDeviceName,
|
!RtlCompareUnicodeString(&RequestDeviceName,
|
||||||
&HistoryEntry->Device,
|
&HistoryEntry->Device,
|
||||||
FALSE);
|
FALSE);
|
||||||
if (Matched)
|
if (Matched)
|
||||||
|
@ -497,13 +244,15 @@ CSR_API(BaseSrvDefineDosDevice)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Nothing to revert to so delete the symlink */
|
/* Nothing to revert to so delete the symlink */
|
||||||
if (! Matched)
|
if (!Matched)
|
||||||
RequestLinkTarget = NULL;
|
RequestLinkTarget = NULL;
|
||||||
}
|
}
|
||||||
else if (! Matched)
|
else if (!Matched)
|
||||||
{
|
{
|
||||||
/* Locate a previous symlink target as we did not get a hit earlier */
|
/*
|
||||||
/* If we find one we need to remove it */
|
* Locate a previous symlink target as we did not get
|
||||||
|
* a hit earlier. If we find one we need to remove it.
|
||||||
|
*/
|
||||||
Entry = ListHead->Flink;
|
Entry = ListHead->Flink;
|
||||||
while (Entry != ListHead)
|
while (Entry != ListHead)
|
||||||
{
|
{
|
||||||
|
@ -512,10 +261,10 @@ CSR_API(BaseSrvDefineDosDevice)
|
||||||
BASE_DOS_DEVICE_HISTORY_ENTRY,
|
BASE_DOS_DEVICE_HISTORY_ENTRY,
|
||||||
Entry);
|
Entry);
|
||||||
Matched =
|
Matched =
|
||||||
! RtlCompareUnicodeString(&RequestDeviceName,
|
!RtlCompareUnicodeString(&RequestDeviceName,
|
||||||
&HistoryEntry->Device,
|
&HistoryEntry->Device,
|
||||||
FALSE);
|
FALSE);
|
||||||
if (! Matched)
|
if (!Matched)
|
||||||
{
|
{
|
||||||
HistoryEntry = NULL;
|
HistoryEntry = NULL;
|
||||||
Entry = Entry->Flink;
|
Entry = Entry->Flink;
|
||||||
|
@ -525,7 +274,7 @@ CSR_API(BaseSrvDefineDosDevice)
|
||||||
Matched = FALSE;
|
Matched = FALSE;
|
||||||
if (dwFlags & DDD_EXACT_MATCH_ON_REMOVE)
|
if (dwFlags & DDD_EXACT_MATCH_ON_REMOVE)
|
||||||
{
|
{
|
||||||
if (! RtlCompareUnicodeString(RequestLinkTarget,
|
if (!RtlCompareUnicodeString(RequestLinkTarget,
|
||||||
&HistoryEntry->Target,
|
&HistoryEntry->Target,
|
||||||
TRUE))
|
TRUE))
|
||||||
{
|
{
|
||||||
|
@ -549,7 +298,7 @@ CSR_API(BaseSrvDefineDosDevice)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Leave existing symlink as is */
|
/* Leave existing symlink as is */
|
||||||
if (! Matched)
|
if (!Matched)
|
||||||
Status = STATUS_OBJECT_NAME_NOT_FOUND;
|
Status = STATUS_OBJECT_NAME_NOT_FOUND;
|
||||||
else
|
else
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
|
@ -562,7 +311,7 @@ CSR_API(BaseSrvDefineDosDevice)
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = NtMakeTemporaryObject(LinkHandle);
|
Status = NtMakeTemporaryObject(LinkHandle);
|
||||||
if (! NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("NtMakeTemporaryObject(%wZ) failed (Status %lx)\n",
|
DPRINT1("NtMakeTemporaryObject(%wZ) failed (Status %lx)\n",
|
||||||
&DeviceName, Status);
|
&DeviceName, Status);
|
||||||
|
@ -571,7 +320,7 @@ CSR_API(BaseSrvDefineDosDevice)
|
||||||
|
|
||||||
Status = NtClose(LinkHandle);
|
Status = NtClose(LinkHandle);
|
||||||
LinkHandle = NULL;
|
LinkHandle = NULL;
|
||||||
if (! NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("NtClose(%wZ) failed (Status %lx)\n",
|
DPRINT1("NtClose(%wZ) failed (Status %lx)\n",
|
||||||
&DeviceName, Status);
|
&DeviceName, Status);
|
||||||
|
@ -580,7 +329,7 @@ CSR_API(BaseSrvDefineDosDevice)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Don't create symlink if we don't have a target */
|
/* Don't create symlink if we don't have a target */
|
||||||
if (! RequestLinkTarget || RequestLinkTarget->Length == 0)
|
if (!RequestLinkTarget || RequestLinkTarget->Length == 0)
|
||||||
_SEH2_LEAVE;
|
_SEH2_LEAVE;
|
||||||
|
|
||||||
if (AddHistory)
|
if (AddHistory)
|
||||||
|
@ -589,7 +338,7 @@ CSR_API(BaseSrvDefineDosDevice)
|
||||||
RtlAllocateHeap(BaseSrvHeap,
|
RtlAllocateHeap(BaseSrvHeap,
|
||||||
HEAP_ZERO_MEMORY,
|
HEAP_ZERO_MEMORY,
|
||||||
sizeof(BASE_DOS_DEVICE_HISTORY_ENTRY));
|
sizeof(BASE_DOS_DEVICE_HISTORY_ENTRY));
|
||||||
if (! HistoryEntry)
|
if (!HistoryEntry)
|
||||||
{
|
{
|
||||||
DPRINT1("Failed to allocate memory\n");
|
DPRINT1("Failed to allocate memory\n");
|
||||||
Status = STATUS_NO_MEMORY;
|
Status = STATUS_NO_MEMORY;
|
||||||
|
@ -600,7 +349,7 @@ CSR_API(BaseSrvDefineDosDevice)
|
||||||
RtlAllocateHeap(BaseSrvHeap,
|
RtlAllocateHeap(BaseSrvHeap,
|
||||||
HEAP_ZERO_MEMORY,
|
HEAP_ZERO_MEMORY,
|
||||||
LinkTarget.Length);
|
LinkTarget.Length);
|
||||||
if (! HistoryEntry->Target.Buffer)
|
if (!HistoryEntry->Target.Buffer)
|
||||||
{
|
{
|
||||||
DPRINT1("Failed to allocate memory\n");
|
DPRINT1("Failed to allocate memory\n");
|
||||||
Status = STATUS_NO_MEMORY;
|
Status = STATUS_NO_MEMORY;
|
||||||
|
@ -616,7 +365,7 @@ CSR_API(BaseSrvDefineDosDevice)
|
||||||
RtlAllocateHeap(BaseSrvHeap,
|
RtlAllocateHeap(BaseSrvHeap,
|
||||||
HEAP_ZERO_MEMORY,
|
HEAP_ZERO_MEMORY,
|
||||||
RequestDeviceName.Length);
|
RequestDeviceName.Length);
|
||||||
if (! HistoryEntry->Device.Buffer)
|
if (!HistoryEntry->Device.Buffer)
|
||||||
{
|
{
|
||||||
DPRINT1("Failed to allocate memory\n");
|
DPRINT1("Failed to allocate memory\n");
|
||||||
Status = STATUS_NO_MEMORY;
|
Status = STATUS_NO_MEMORY;
|
||||||
|
@ -678,7 +427,7 @@ CSR_API(BaseSrvDefineDosDevice)
|
||||||
SecurityDescriptor = RtlAllocateHeap(BaseSrvHeap,
|
SecurityDescriptor = RtlAllocateHeap(BaseSrvHeap,
|
||||||
0,
|
0,
|
||||||
SECURITY_DESCRIPTOR_MIN_LENGTH + Length);
|
SECURITY_DESCRIPTOR_MIN_LENGTH + Length);
|
||||||
if (! SecurityDescriptor)
|
if (!SecurityDescriptor)
|
||||||
{
|
{
|
||||||
DPRINT1("Failed to allocate memory\n");
|
DPRINT1("Failed to allocate memory\n");
|
||||||
Status = STATUS_NO_MEMORY;
|
Status = STATUS_NO_MEMORY;
|
||||||
|
@ -688,32 +437,30 @@ CSR_API(BaseSrvDefineDosDevice)
|
||||||
Dacl = (PACL)((ULONG_PTR)SecurityDescriptor + SECURITY_DESCRIPTOR_MIN_LENGTH);
|
Dacl = (PACL)((ULONG_PTR)SecurityDescriptor + SECURITY_DESCRIPTOR_MIN_LENGTH);
|
||||||
Status = RtlCreateSecurityDescriptor(SecurityDescriptor,
|
Status = RtlCreateSecurityDescriptor(SecurityDescriptor,
|
||||||
SECURITY_DESCRIPTOR_REVISION);
|
SECURITY_DESCRIPTOR_REVISION);
|
||||||
if (! NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("RtlCreateSecurityDescriptor() failed (Status %lx)\n",
|
DPRINT1("RtlCreateSecurityDescriptor() failed (Status %lx)\n", Status);
|
||||||
Status);
|
|
||||||
_SEH2_LEAVE;
|
_SEH2_LEAVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = RtlCreateAcl(Dacl,
|
Status = RtlCreateAcl(Dacl,
|
||||||
Length,
|
Length,
|
||||||
ACL_REVISION);
|
ACL_REVISION);
|
||||||
if (! NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("RtlCreateAcl() failed (Status %lx)\n",
|
DPRINT1("RtlCreateAcl() failed (Status %lx)\n", Status);
|
||||||
Status);
|
|
||||||
_SEH2_LEAVE;
|
_SEH2_LEAVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
(void) RtlAddAccessAllowedAce(Dacl,
|
RtlAddAccessAllowedAce(Dacl,
|
||||||
ACL_REVISION,
|
ACL_REVISION,
|
||||||
GENERIC_ALL,
|
GENERIC_ALL,
|
||||||
SystemSid);
|
SystemSid);
|
||||||
(void) RtlAddAccessAllowedAce(Dacl,
|
RtlAddAccessAllowedAce(Dacl,
|
||||||
ACL_REVISION,
|
ACL_REVISION,
|
||||||
GENERIC_ALL,
|
GENERIC_ALL,
|
||||||
AdminSid);
|
AdminSid);
|
||||||
(void) RtlAddAccessAllowedAce(Dacl,
|
RtlAddAccessAllowedAce(Dacl,
|
||||||
ACL_REVISION,
|
ACL_REVISION,
|
||||||
STANDARD_RIGHTS_READ,
|
STANDARD_RIGHTS_READ,
|
||||||
WorldSid);
|
WorldSid);
|
||||||
|
@ -722,10 +469,9 @@ CSR_API(BaseSrvDefineDosDevice)
|
||||||
TRUE,
|
TRUE,
|
||||||
Dacl,
|
Dacl,
|
||||||
FALSE);
|
FALSE);
|
||||||
if (! NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("RtlSetDaclSecurityDescriptor() failed (Status %lx)\n",
|
DPRINT1("RtlSetDaclSecurityDescriptor() failed (Status %lx)\n", Status);
|
||||||
Status);
|
|
||||||
_SEH2_LEAVE;
|
_SEH2_LEAVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -741,7 +487,7 @@ CSR_API(BaseSrvDefineDosDevice)
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
Status = NtMakePermanentObject(LinkHandle);
|
Status = NtMakePermanentObject(LinkHandle);
|
||||||
if (! NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("NtMakePermanentObject(%wZ) failed (Status %lx)\n",
|
DPRINT1("NtMakePermanentObject(%wZ) failed (Status %lx)\n",
|
||||||
&DeviceName, Status);
|
&DeviceName, Status);
|
||||||
|
@ -755,39 +501,48 @@ CSR_API(BaseSrvDefineDosDevice)
|
||||||
}
|
}
|
||||||
_SEH2_FINALLY
|
_SEH2_FINALLY
|
||||||
{
|
{
|
||||||
(void) RtlLeaveCriticalSection(&BaseDefineDosDeviceCritSec);
|
RtlLeaveCriticalSection(&BaseDefineDosDeviceCritSec);
|
||||||
if (DeviceName.Buffer)
|
if (DeviceName.Buffer)
|
||||||
(void) RtlFreeHeap(BaseSrvHeap,
|
{
|
||||||
|
RtlFreeHeap(BaseSrvHeap,
|
||||||
0,
|
0,
|
||||||
DeviceName.Buffer);
|
DeviceName.Buffer);
|
||||||
|
}
|
||||||
if (LinkTarget.Buffer)
|
if (LinkTarget.Buffer)
|
||||||
(void) RtlFreeHeap(BaseSrvHeap,
|
{
|
||||||
|
RtlFreeHeap(BaseSrvHeap,
|
||||||
0,
|
0,
|
||||||
LinkTarget.Buffer);
|
LinkTarget.Buffer);
|
||||||
|
}
|
||||||
if (SecurityDescriptor)
|
if (SecurityDescriptor)
|
||||||
(void) RtlFreeHeap(BaseSrvHeap,
|
{
|
||||||
|
RtlFreeHeap(BaseSrvHeap,
|
||||||
0,
|
0,
|
||||||
SecurityDescriptor);
|
SecurityDescriptor);
|
||||||
if (LinkHandle)
|
}
|
||||||
(void) NtClose(LinkHandle);
|
|
||||||
if (SystemSid)
|
if (LinkHandle) NtClose(LinkHandle);
|
||||||
(void) RtlFreeSid(SystemSid);
|
if (SystemSid) RtlFreeSid(SystemSid);
|
||||||
if (AdminSid)
|
if (AdminSid) RtlFreeSid(AdminSid);
|
||||||
(void) RtlFreeSid(AdminSid);
|
if (WorldSid) RtlFreeSid(WorldSid);
|
||||||
if (WorldSid)
|
|
||||||
(void) RtlFreeSid(WorldSid);
|
|
||||||
RtlFreeUnicodeString(&RequestDeviceName);
|
RtlFreeUnicodeString(&RequestDeviceName);
|
||||||
|
|
||||||
if (HistoryEntry)
|
if (HistoryEntry)
|
||||||
{
|
{
|
||||||
if (HistoryEntry->Target.Buffer)
|
if (HistoryEntry->Target.Buffer)
|
||||||
(void) RtlFreeHeap(BaseSrvHeap,
|
{
|
||||||
|
RtlFreeHeap(BaseSrvHeap,
|
||||||
0,
|
0,
|
||||||
HistoryEntry->Target.Buffer);
|
HistoryEntry->Target.Buffer);
|
||||||
|
}
|
||||||
if (HistoryEntry->Device.Buffer)
|
if (HistoryEntry->Device.Buffer)
|
||||||
(void) RtlFreeHeap(BaseSrvHeap,
|
{
|
||||||
|
RtlFreeHeap(BaseSrvHeap,
|
||||||
0,
|
0,
|
||||||
HistoryEntry->Device.Buffer);
|
HistoryEntry->Device.Buffer);
|
||||||
(void) RtlFreeHeap(BaseSrvHeap,
|
}
|
||||||
|
RtlFreeHeap(BaseSrvHeap,
|
||||||
0,
|
0,
|
||||||
HistoryEntry);
|
HistoryEntry);
|
||||||
}
|
}
|
||||||
|
@ -798,17 +553,4 @@ CSR_API(BaseSrvDefineDosDevice)
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* PUBLIC API *****************************************************************/
|
|
||||||
|
|
||||||
NTSTATUS NTAPI BaseSetProcessCreateNotify(IN BASE_PROCESS_CREATE_NOTIFY_ROUTINE ProcessCreateNotifyProc)
|
|
||||||
{
|
|
||||||
DPRINT("BASESRV: %s(%08lx) called\n", __FUNCTION__, ProcessCreateNotifyProc);
|
|
||||||
return STATUS_NOT_IMPLEMENTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
|
@ -6,25 +6,23 @@
|
||||||
* PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca@sfr.fr)
|
* PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca@sfr.fr)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* INCLUDES *******************************************************************/
|
||||||
|
|
||||||
#include "basesrv.h"
|
#include "basesrv.h"
|
||||||
|
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
HANDLE DllHandle = NULL;
|
/* GLOBALS ********************************************************************/
|
||||||
HANDLE BaseApiPort = NULL;
|
|
||||||
|
HANDLE BaseSrvDllInstance = NULL;
|
||||||
|
|
||||||
/* Memory */
|
/* Memory */
|
||||||
HANDLE BaseSrvHeap = NULL; // Our own heap.
|
HANDLE BaseSrvHeap = NULL; // Our own heap.
|
||||||
HANDLE BaseSrvSharedHeap = NULL; // Shared heap with CSR. (CsrSrvSharedSectionHeap)
|
HANDLE BaseSrvSharedHeap = NULL; // Shared heap with CSR. (CsrSrvSharedSectionHeap)
|
||||||
PBASE_STATIC_SERVER_DATA BaseStaticServerData = NULL; // Data that we can share amongst processes. Initialized inside BaseSrvSharedHeap.
|
PBASE_STATIC_SERVER_DATA BaseStaticServerData = NULL; // Data that we can share amongst processes. Initialized inside BaseSrvSharedHeap.
|
||||||
|
|
||||||
extern LIST_ENTRY DosDeviceHistory;
|
// Windows Server 2003 table from http://j00ru.vexillium.org/csrss_list/api_list.html#Windows_2k3
|
||||||
extern RTL_CRITICAL_SECTION BaseDefineDosDeviceCritSec;
|
|
||||||
|
|
||||||
// Windows NT 4 tables, adapted from http://j00ru.vexillium.org/csrss_list/api_list.html#Windows_NT
|
|
||||||
// It is for testing purposes. After that I will update it to 2k3 version and add stubs.
|
|
||||||
// Some names are also deduced from the subsystems/win32/csrss/csrsrv/server.c ones.
|
|
||||||
PCSR_API_ROUTINE BaseServerApiDispatchTable[BasepMaxApiNumber] =
|
PCSR_API_ROUTINE BaseServerApiDispatchTable[BasepMaxApiNumber] =
|
||||||
{
|
{
|
||||||
BaseSrvCreateProcess,
|
BaseSrvCreateProcess,
|
||||||
|
@ -43,45 +41,54 @@ PCSR_API_ROUTINE BaseServerApiDispatchTable[BasepMaxApiNumber] =
|
||||||
BaseSrvGetProcessShutdownParam,
|
BaseSrvGetProcessShutdownParam,
|
||||||
// BaseSrvNlsSetUserInfo,
|
// BaseSrvNlsSetUserInfo,
|
||||||
// BaseSrvNlsSetMultipleUserInfo,
|
// BaseSrvNlsSetMultipleUserInfo,
|
||||||
// BaseSrvNlsCreateSortSection,
|
// BaseSrvNlsCreateSection,
|
||||||
// BaseSrvNlsPreserveSection,
|
|
||||||
// BaseSrvSetVDMCurDirs,
|
// BaseSrvSetVDMCurDirs,
|
||||||
// BaseSrvGetVDMCurDirs,
|
// BaseSrvGetVDMCurDirs,
|
||||||
// BaseSrvBatNotification,
|
// BaseSrvBatNotification,
|
||||||
// BaseSrvRegisterWowExec,
|
// BaseSrvRegisterWowExec,
|
||||||
BaseSrvSoundSentryNotification,
|
BaseSrvSoundSentryNotification,
|
||||||
// BaseSrvRefreshIniFileMapping,
|
// BaseSrvRefreshIniFileMapping,
|
||||||
BaseSrvDefineDosDevice
|
BaseSrvDefineDosDevice,
|
||||||
|
// BaseSrvSetTermsrvAppInstallMode,
|
||||||
|
// BaseSrvNlsUpdateCacheCount,
|
||||||
|
// BaseSrvSetTermsrvClientTimeZone,
|
||||||
|
// BaseSrvSxsCreateActivationContext,
|
||||||
|
// BaseSrvRegisterThread,
|
||||||
|
// BaseSrvNlsGetUserInfo,
|
||||||
};
|
};
|
||||||
|
|
||||||
BOOLEAN BaseServerApiServerValidTable[BasepMaxApiNumber] =
|
BOOLEAN BaseServerApiServerValidTable[BasepMaxApiNumber] =
|
||||||
{
|
{
|
||||||
TRUE, // SrvCreateProcess,
|
TRUE, // BaseSrvCreateProcess
|
||||||
TRUE, // SrvCreateThread,
|
TRUE, // BaseSrvCreateThread
|
||||||
TRUE, // SrvGetTempFile,
|
TRUE, // BaseSrvGetTempFile
|
||||||
FALSE, // SrvExitProcess,
|
FALSE, // BaseSrvExitProcess
|
||||||
// FALSE, // SrvDebugProcess,
|
// FALSE, // BaseSrvDebugProcess
|
||||||
// TRUE, // SrvCheckVDM,
|
// TRUE, // BaseSrvCheckVDM
|
||||||
// TRUE, // SrvUpdateVDMEntry
|
// TRUE, // BaseSrvUpdateVDMEntry
|
||||||
// TRUE, // SrvGetNextVDMCommand
|
// TRUE, // BaseSrvGetNextVDMCommand
|
||||||
// TRUE, // SrvExitVDM
|
// TRUE, // BaseSrvExitVDM
|
||||||
// TRUE, // SrvIsFirstVDM
|
// TRUE, // BaseSrvIsFirstVDM
|
||||||
// TRUE, // SrvGetVDMExitCode
|
// TRUE, // BaseSrvGetVDMExitCode
|
||||||
// TRUE, // SrvSetReenterCount
|
// TRUE, // BaseSrvSetReenterCount
|
||||||
TRUE, // SrvSetProcessShutdownParam
|
TRUE, // BaseSrvSetProcessShutdownParam
|
||||||
TRUE, // SrvGetProcessShutdownParam
|
TRUE, // BaseSrvGetProcessShutdownParam
|
||||||
// TRUE, // SrvNlsSetUserInfo
|
// TRUE, // BaseSrvNlsSetUserInfo
|
||||||
// TRUE, // SrvNlsSetMultipleUserInfo
|
// TRUE, // BaseSrvNlsSetMultipleUserInfo
|
||||||
// TRUE, // SrvNlsCreateSortSection
|
// TRUE, // BaseSrvNlsCreateSection
|
||||||
// TRUE, // SrvNlsPreserveSection
|
// TRUE, // BaseSrvSetVDMCurDirs
|
||||||
// TRUE, // SrvSetVDMCurDirs
|
// TRUE, // BaseSrvGetVDMCurDirs
|
||||||
// TRUE, // SrvGetVDMCurDirs
|
// TRUE, // BaseSrvBatNotification
|
||||||
// TRUE, // SrvBatNotification
|
// TRUE, // BaseSrvRegisterWowExec
|
||||||
// TRUE, // SrvRegisterWowExec
|
TRUE, // BaseSrvSoundSentryNotification
|
||||||
TRUE, // SrvSoundSentryNotification
|
// TRUE, // BaseSrvRefreshIniFileMapping
|
||||||
// TRUE, // SrvRefreshIniFileMapping
|
TRUE, // BaseSrvDefineDosDevice
|
||||||
TRUE, // SrvDefineDosDevice
|
// FALSE, // BaseSrvSetTermsrvAppInstallMode
|
||||||
// FALSE
|
// FALSE, // BaseSrvNlsUpdateCacheCount
|
||||||
|
// FALSE, // BaseSrvSetTermsrvClientTimeZone
|
||||||
|
// FALSE, // BaseSrvSxsCreateActivationContext
|
||||||
|
// FALSE, // BaseSrvRegisterThread
|
||||||
|
// FALSE, // BaseSrvNlsGetUserInfo
|
||||||
};
|
};
|
||||||
|
|
||||||
PCHAR BaseServerApiNameTable[BasepMaxApiNumber] =
|
PCHAR BaseServerApiNameTable[BasepMaxApiNumber] =
|
||||||
|
@ -102,16 +109,20 @@ PCHAR BaseServerApiNameTable[BasepMaxApiNumber] =
|
||||||
"BaseGetProcessShutdownParam",
|
"BaseGetProcessShutdownParam",
|
||||||
// "BaseNlsSetUserInfo",
|
// "BaseNlsSetUserInfo",
|
||||||
// "BaseNlsSetMultipleUserInfo",
|
// "BaseNlsSetMultipleUserInfo",
|
||||||
// "BaseNlsCreateSortSection",
|
// "BaseNlsCreateSection",
|
||||||
// "BaseNlsPreserveSection",
|
|
||||||
// "BaseSetVDMCurDirs",
|
// "BaseSetVDMCurDirs",
|
||||||
// "BaseGetVDMCurDirs",
|
// "BaseGetVDMCurDirs",
|
||||||
// "BaseBatNotification",
|
// "BaseBatNotification",
|
||||||
// "BaseRegisterWowExec",
|
// "BaseRegisterWowExec",
|
||||||
"BaseSoundSentryNotification",
|
"BaseSoundSentryNotification",
|
||||||
// "BaseSrvRefreshIniFileMapping"
|
// "BaseRefreshIniFileMapping",
|
||||||
"BaseDefineDosDevice",
|
"BaseDefineDosDevice",
|
||||||
// NULL
|
// "BaseSetTermsrvAppInstallMode",
|
||||||
|
// "BaseNlsUpdateCacheCount",
|
||||||
|
// "BaseSetTermsrvClientTimeZone",
|
||||||
|
// "BaseSxsCreateActivationContext",
|
||||||
|
// "BaseRegisterThread",
|
||||||
|
// "BaseNlsGetUserInfo",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -269,7 +280,7 @@ BaseInitializeStaticServerData(IN PCSR_SERVER_DLL LoadedServerDll)
|
||||||
{0}
|
{0}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Initialize memory */
|
/* Initialize the memory */
|
||||||
BaseSrvHeap = RtlGetProcessHeap(); // Initialize our own heap.
|
BaseSrvHeap = RtlGetProcessHeap(); // Initialize our own heap.
|
||||||
BaseSrvSharedHeap = LoadedServerDll->SharedSection; // Get the CSR shared heap.
|
BaseSrvSharedHeap = LoadedServerDll->SharedSection; // Get the CSR shared heap.
|
||||||
|
|
||||||
|
@ -505,45 +516,8 @@ BaseInitializeStaticServerData(IN PCSR_SERVER_DLL LoadedServerDll)
|
||||||
LoadedServerDll->SharedSection = BaseStaticServerData;
|
LoadedServerDll->SharedSection = BaseStaticServerData;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
VOID WINAPI BaseStaticServerThread(PVOID x)
|
|
||||||
{
|
|
||||||
// NTSTATUS Status = STATUS_SUCCESS;
|
|
||||||
PPORT_MESSAGE Request = (PPORT_MESSAGE)x;
|
|
||||||
PPORT_MESSAGE Reply = NULL;
|
|
||||||
ULONG MessageType = 0;
|
|
||||||
|
|
||||||
DPRINT("BASESRV: %s called\n", __FUNCTION__);
|
|
||||||
|
|
||||||
MessageType = Request->u2.s2.Type;
|
|
||||||
DPRINT("BASESRV: %s received a message (Type=%d)\n",
|
|
||||||
__FUNCTION__, MessageType);
|
|
||||||
switch (MessageType)
|
|
||||||
{
|
|
||||||
default:
|
|
||||||
Reply = Request;
|
|
||||||
/\* Status =*\/ NtReplyPort(BaseApiPort, Reply);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
CSR_SERVER_DLL_INIT(ServerDllInitialization)
|
CSR_SERVER_DLL_INIT(ServerDllInitialization)
|
||||||
{
|
{
|
||||||
// NTSTATUS Status = STATUS_SUCCESS;
|
|
||||||
|
|
||||||
/*
|
|
||||||
DPRINT("BASSRV: %s(%ld,...) called\n", __FUNCTION__, ArgumentCount);
|
|
||||||
|
|
||||||
BaseApiPort = CsrQueryApiPort ();
|
|
||||||
Status = CsrAddStaticServerThread(BaseStaticServerThread);
|
|
||||||
if (NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
//TODO initialize the BASE server
|
|
||||||
}
|
|
||||||
return STATUS_SUCCESS;
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Setup the DLL Object */
|
/* Setup the DLL Object */
|
||||||
LoadedServerDll->ApiBase = BASESRV_FIRST_API_NUMBER; // ApiNumberBase
|
LoadedServerDll->ApiBase = BASESRV_FIRST_API_NUMBER; // ApiNumberBase
|
||||||
LoadedServerDll->HighestApiSupported = BasepMaxApiNumber; // MaxApiNumber
|
LoadedServerDll->HighestApiSupported = BasepMaxApiNumber; // MaxApiNumber
|
||||||
|
@ -553,10 +527,14 @@ CSR_SERVER_DLL_INIT(ServerDllInitialization)
|
||||||
LoadedServerDll->SizeOfProcessData = 0;
|
LoadedServerDll->SizeOfProcessData = 0;
|
||||||
LoadedServerDll->ConnectCallback = NULL;
|
LoadedServerDll->ConnectCallback = NULL;
|
||||||
LoadedServerDll->DisconnectCallback = NULL;
|
LoadedServerDll->DisconnectCallback = NULL;
|
||||||
|
LoadedServerDll->ShutdownProcessCallback = NULL;
|
||||||
|
|
||||||
|
BaseSrvDllInstance = LoadedServerDll->ServerHandle;
|
||||||
|
|
||||||
BaseInitializeStaticServerData(LoadedServerDll);
|
BaseInitializeStaticServerData(LoadedServerDll);
|
||||||
|
|
||||||
RtlInitializeCriticalSection(&BaseDefineDosDeviceCritSec);
|
/* Initialize DOS devices management */
|
||||||
InitializeListHead(&DosDeviceHistory);
|
BaseInitDefineDosDevice();
|
||||||
|
|
||||||
/* All done */
|
/* All done */
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
@ -568,14 +546,11 @@ DllMain(IN HINSTANCE hInstanceDll,
|
||||||
IN DWORD dwReason,
|
IN DWORD dwReason,
|
||||||
IN LPVOID lpReserved)
|
IN LPVOID lpReserved)
|
||||||
{
|
{
|
||||||
|
UNREFERENCED_PARAMETER(hInstanceDll);
|
||||||
UNREFERENCED_PARAMETER(dwReason);
|
UNREFERENCED_PARAMETER(dwReason);
|
||||||
UNREFERENCED_PARAMETER(lpReserved);
|
UNREFERENCED_PARAMETER(lpReserved);
|
||||||
|
|
||||||
if (DLL_PROCESS_ATTACH == dwReason)
|
if (DLL_PROCESS_DETACH == dwReason)
|
||||||
{
|
|
||||||
DllHandle = hInstanceDll;
|
|
||||||
}
|
|
||||||
else if (DLL_PROCESS_DETACH == dwReason)
|
|
||||||
{
|
{
|
||||||
BaseCleanupDefineDosDevice();
|
BaseCleanupDefineDosDevice();
|
||||||
}
|
}
|
||||||
|
|
246
subsystems/win/basesrv/proc.c
Normal file
246
subsystems/win/basesrv/proc.c
Normal file
|
@ -0,0 +1,246 @@
|
||||||
|
/*
|
||||||
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
|
* PROJECT: ReactOS/Win32 Base enviroment Subsystem Server
|
||||||
|
* FILE: subsystems/win/basesrv/proc.c
|
||||||
|
* PURPOSE: Process and Thread Management
|
||||||
|
* PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* INCLUDES *******************************************************************/
|
||||||
|
|
||||||
|
#include "basesrv.h"
|
||||||
|
|
||||||
|
#define NDEBUG
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
/* PUBLIC SERVER APIS *********************************************************/
|
||||||
|
|
||||||
|
CSR_API(BaseSrvGetTempFile)
|
||||||
|
{
|
||||||
|
static UINT CsrGetTempFileUnique = 0;
|
||||||
|
PBASE_GET_TEMP_FILE GetTempFile = &((PBASE_API_MESSAGE)ApiMessage)->Data.GetTempFile;
|
||||||
|
|
||||||
|
/* Return 16-bits ID */
|
||||||
|
GetTempFile->UniqueID = (++CsrGetTempFileUnique & 0xFFFF);
|
||||||
|
|
||||||
|
DPRINT("Returning: %u\n", GetTempFile->UniqueID);
|
||||||
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
CSR_API(BaseSrvCreateProcess)
|
||||||
|
{
|
||||||
|
NTSTATUS Status;
|
||||||
|
PBASE_CREATE_PROCESS CreateProcessRequest = &((PBASE_API_MESSAGE)ApiMessage)->Data.CreateProcessRequest;
|
||||||
|
HANDLE ProcessHandle, ThreadHandle;
|
||||||
|
PCSR_THREAD CsrThread;
|
||||||
|
PCSR_PROCESS Process;
|
||||||
|
ULONG Flags = 0, VdmPower = 0, DebugFlags = 0;
|
||||||
|
|
||||||
|
/* Get the current client thread */
|
||||||
|
CsrThread = CsrGetClientThread();
|
||||||
|
ASSERT(CsrThread != NULL);
|
||||||
|
|
||||||
|
Process = CsrThread->Process;
|
||||||
|
|
||||||
|
/* Extract the flags out of the process handle */
|
||||||
|
Flags = (ULONG_PTR)CreateProcessRequest->ProcessHandle & 3;
|
||||||
|
CreateProcessRequest->ProcessHandle = (HANDLE)((ULONG_PTR)CreateProcessRequest->ProcessHandle & ~3);
|
||||||
|
|
||||||
|
/* Duplicate the process handle */
|
||||||
|
Status = NtDuplicateObject(Process->ProcessHandle,
|
||||||
|
CreateProcessRequest->ProcessHandle,
|
||||||
|
NtCurrentProcess(),
|
||||||
|
&ProcessHandle,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
DUPLICATE_SAME_ACCESS);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("Failed to duplicate process handle\n");
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Duplicate the thread handle */
|
||||||
|
Status = NtDuplicateObject(Process->ProcessHandle,
|
||||||
|
CreateProcessRequest->ThreadHandle,
|
||||||
|
NtCurrentProcess(),
|
||||||
|
&ThreadHandle,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
DUPLICATE_SAME_ACCESS);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("Failed to duplicate process handle\n");
|
||||||
|
NtClose(ProcessHandle);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* See if this is a VDM process */
|
||||||
|
if (VdmPower)
|
||||||
|
{
|
||||||
|
/* Request VDM powers */
|
||||||
|
Status = NtSetInformationProcess(ProcessHandle,
|
||||||
|
ProcessWx86Information,
|
||||||
|
&VdmPower,
|
||||||
|
sizeof(VdmPower));
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("Failed to get VDM powers\n");
|
||||||
|
NtClose(ProcessHandle);
|
||||||
|
NtClose(ThreadHandle);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Flags conversion. FIXME: More need conversion */
|
||||||
|
if (CreateProcessRequest->CreationFlags & CREATE_NEW_PROCESS_GROUP)
|
||||||
|
{
|
||||||
|
DebugFlags |= CsrProcessCreateNewGroup;
|
||||||
|
}
|
||||||
|
if ((Flags & 2) == 0)
|
||||||
|
{
|
||||||
|
/* We are launching a console process */
|
||||||
|
DebugFlags |= CsrProcessIsConsoleApp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* FIXME: SxS Stuff */
|
||||||
|
|
||||||
|
/* Call CSRSRV to create the CSR_PROCESS structure and the first CSR_THREAD */
|
||||||
|
Status = CsrCreateProcess(ProcessHandle,
|
||||||
|
ThreadHandle,
|
||||||
|
&CreateProcessRequest->ClientId,
|
||||||
|
Process->NtSession,
|
||||||
|
DebugFlags,
|
||||||
|
NULL);
|
||||||
|
if (Status == STATUS_THREAD_IS_TERMINATING)
|
||||||
|
{
|
||||||
|
DPRINT1("Thread already dead\n");
|
||||||
|
|
||||||
|
/* Set the special reply value so we don't reply this message back */
|
||||||
|
*ReplyCode = CsrReplyDeadClient;
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check for other failures */
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("Failed to create process/thread structures: %lx\n", Status);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* FIXME: Should notify user32 */
|
||||||
|
|
||||||
|
/* FIXME: VDM vodoo */
|
||||||
|
|
||||||
|
/* Return the result of this operation */
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
CSR_API(BaseSrvCreateThread)
|
||||||
|
{
|
||||||
|
NTSTATUS Status;
|
||||||
|
PBASE_CREATE_THREAD CreateThreadRequest = &((PBASE_API_MESSAGE)ApiMessage)->Data.CreateThreadRequest;
|
||||||
|
PCSR_THREAD CurrentThread;
|
||||||
|
HANDLE ThreadHandle;
|
||||||
|
PCSR_PROCESS CsrProcess;
|
||||||
|
|
||||||
|
/* Get the current CSR thread */
|
||||||
|
CurrentThread = CsrGetClientThread();
|
||||||
|
if (!CurrentThread)
|
||||||
|
{
|
||||||
|
DPRINT1("Server Thread TID: [%lx.%lx]\n",
|
||||||
|
CreateThreadRequest->ClientId.UniqueProcess,
|
||||||
|
CreateThreadRequest->ClientId.UniqueThread);
|
||||||
|
return STATUS_SUCCESS; // server-to-server
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get the CSR Process for this request */
|
||||||
|
CsrProcess = CurrentThread->Process;
|
||||||
|
if (CsrProcess->ClientId.UniqueProcess !=
|
||||||
|
CreateThreadRequest->ClientId.UniqueProcess)
|
||||||
|
{
|
||||||
|
/* This is a remote thread request -- is it within the server itself? */
|
||||||
|
if (CreateThreadRequest->ClientId.UniqueProcess == NtCurrentTeb()->ClientId.UniqueProcess)
|
||||||
|
{
|
||||||
|
/* Accept this without any further work */
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get the real CSR Process for the remote thread's process */
|
||||||
|
Status = CsrLockProcessByClientId(CreateThreadRequest->ClientId.UniqueProcess,
|
||||||
|
&CsrProcess);
|
||||||
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Duplicate the thread handle so we can own it */
|
||||||
|
Status = NtDuplicateObject(CurrentThread->Process->ProcessHandle,
|
||||||
|
CreateThreadRequest->ThreadHandle,
|
||||||
|
NtCurrentProcess(),
|
||||||
|
&ThreadHandle,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
DUPLICATE_SAME_ACCESS);
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
/* Call CSRSRV to tell it about the new thread */
|
||||||
|
Status = CsrCreateThread(CsrProcess,
|
||||||
|
ThreadHandle,
|
||||||
|
&CreateThreadRequest->ClientId,
|
||||||
|
TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Unlock the process and return */
|
||||||
|
if (CsrProcess != CurrentThread->Process) CsrUnlockProcess(CsrProcess);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
CSR_API(BaseSrvExitProcess)
|
||||||
|
{
|
||||||
|
PCSR_THREAD CsrThread = CsrGetClientThread();
|
||||||
|
ASSERT(CsrThread != NULL);
|
||||||
|
|
||||||
|
/* Set the special reply value so we don't reply this message back */
|
||||||
|
*ReplyCode = CsrReplyDeadClient;
|
||||||
|
|
||||||
|
/* Remove the CSR_THREADs and CSR_PROCESS */
|
||||||
|
return CsrDestroyProcess(&CsrThread->ClientId,
|
||||||
|
(NTSTATUS)((PBASE_API_MESSAGE)ApiMessage)->Data.ExitProcessRequest.uExitCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
CSR_API(BaseSrvGetProcessShutdownParam)
|
||||||
|
{
|
||||||
|
PBASE_GET_PROCESS_SHUTDOWN_PARAMS GetShutdownParametersRequest = &((PBASE_API_MESSAGE)ApiMessage)->Data.GetShutdownParametersRequest;
|
||||||
|
PCSR_THREAD CsrThread = CsrGetClientThread();
|
||||||
|
ASSERT(CsrThread);
|
||||||
|
|
||||||
|
GetShutdownParametersRequest->Level = CsrThread->Process->ShutdownLevel;
|
||||||
|
GetShutdownParametersRequest->Flags = CsrThread->Process->ShutdownFlags;
|
||||||
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
CSR_API(BaseSrvSetProcessShutdownParam)
|
||||||
|
{
|
||||||
|
PBASE_SET_PROCESS_SHUTDOWN_PARAMS SetShutdownParametersRequest = &((PBASE_API_MESSAGE)ApiMessage)->Data.SetShutdownParametersRequest;
|
||||||
|
PCSR_THREAD CsrThread = CsrGetClientThread();
|
||||||
|
ASSERT(CsrThread);
|
||||||
|
|
||||||
|
CsrThread->Process->ShutdownLevel = SetShutdownParametersRequest->Level;
|
||||||
|
CsrThread->Process->ShutdownFlags = SetShutdownParametersRequest->Flags;
|
||||||
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PUBLIC API *****************************************************************/
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
BaseSetProcessCreateNotify(IN BASE_PROCESS_CREATE_NOTIFY_ROUTINE ProcessCreateNotifyProc)
|
||||||
|
{
|
||||||
|
DPRINT("BASESRV: %s(%08lx) called\n", __FUNCTION__, ProcessCreateNotifyProc);
|
||||||
|
return STATUS_NOT_IMPLEMENTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* EOF */
|
67
subsystems/win/basesrv/sndsntry.c
Normal file
67
subsystems/win/basesrv/sndsntry.c
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
/*
|
||||||
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
|
* PROJECT: ReactOS/Win32 Base enviroment Subsystem Server
|
||||||
|
* FILE: subsystems/win/basesrv/sndsntry.c
|
||||||
|
* PURPOSE: Sound Sentry Notifications
|
||||||
|
* PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* INCLUDES *******************************************************************/
|
||||||
|
|
||||||
|
#include "basesrv.h"
|
||||||
|
|
||||||
|
#define NDEBUG
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
/* GLOBALS ********************************************************************/
|
||||||
|
|
||||||
|
typedef BOOL (WINAPI *PUSER_SOUND_SENTRY)(VOID);
|
||||||
|
BOOL NTAPI FirstSoundSentry(VOID);
|
||||||
|
|
||||||
|
static PUSER_SOUND_SENTRY _UserSoundSentry = FirstSoundSentry;
|
||||||
|
|
||||||
|
/* PRIVATE FUNCTIONS **********************************************************/
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
NTAPI
|
||||||
|
FailSoundSentry(VOID)
|
||||||
|
{
|
||||||
|
/* In case the function can't be found/is unimplemented */
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
NTAPI
|
||||||
|
FirstSoundSentry(VOID)
|
||||||
|
{
|
||||||
|
UNICODE_STRING DllString = RTL_CONSTANT_STRING(L"winsrv");
|
||||||
|
STRING FuncString = RTL_CONSTANT_STRING("_UserSoundSentry");
|
||||||
|
HANDLE DllHandle;
|
||||||
|
NTSTATUS Status;
|
||||||
|
PUSER_SOUND_SENTRY NewSoundSentry = FailSoundSentry;
|
||||||
|
|
||||||
|
/* Load winsrv manually */
|
||||||
|
Status = LdrGetDllHandle(NULL, NULL, &DllString, &DllHandle);
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
/* If it was found, get SoundSentry export */
|
||||||
|
Status = LdrGetProcedureAddress(DllHandle,
|
||||||
|
&FuncString,
|
||||||
|
0,
|
||||||
|
(PVOID*)&NewSoundSentry);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set it as the callback for the future, and call it */
|
||||||
|
_UserSoundSentry = NewSoundSentry;
|
||||||
|
return _UserSoundSentry();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PUBLIC SERVER APIS *********************************************************/
|
||||||
|
|
||||||
|
CSR_API(BaseSrvSoundSentryNotification)
|
||||||
|
{
|
||||||
|
/* Call the API and see if it succeeds */
|
||||||
|
return (_UserSoundSentry() ? STATUS_SUCCESS : STATUS_ACCESS_DENIED);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* EOF */
|
|
@ -1,8 +1,8 @@
|
||||||
/*
|
/*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
* FILE: subsys/csrss/include/api.h
|
* FILE: subsystems/win32/csrsrv/api.h
|
||||||
* PURPOSE: CSRSS API interface
|
* PURPOSE: CSRSS Internal API
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
|
@ -40,7 +40,7 @@
|
||||||
#include <sm/smmsg.h>
|
#include <sm/smmsg.h>
|
||||||
|
|
||||||
/* Internal CSRSS Header */
|
/* Internal CSRSS Header */
|
||||||
#include "include/api.h"
|
#include "api.h"
|
||||||
|
|
||||||
/* Defines */
|
/* Defines */
|
||||||
#define SM_REG_KEY \
|
#define SM_REG_KEY \
|
||||||
|
|
|
@ -46,8 +46,6 @@
|
||||||
|
|
||||||
extern HINSTANCE ConSrvDllInstance;
|
extern HINSTANCE ConSrvDllInstance;
|
||||||
extern HANDLE ConSrvHeap;
|
extern HANDLE ConSrvHeap;
|
||||||
// extern HANDLE BaseSrvSharedHeap;
|
|
||||||
// extern PBASE_STATIC_SERVER_DATA BaseStaticServerData;
|
|
||||||
|
|
||||||
/* Object type magic numbers */
|
/* Object type magic numbers */
|
||||||
#define CONIO_INPUT_BUFFER_MAGIC 0x00000001 // --> Input-type handles
|
#define CONIO_INPUT_BUFFER_MAGIC 0x00000001 // --> Input-type handles
|
||||||
|
|
|
@ -749,7 +749,7 @@ ConSrvConnect(IN PCSR_PROCESS CsrProcess,
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
WINAPI
|
NTAPI
|
||||||
ConSrvDisconnect(PCSR_PROCESS Process)
|
ConSrvDisconnect(PCSR_PROCESS Process)
|
||||||
{
|
{
|
||||||
PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(Process);
|
PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(Process);
|
||||||
|
|
|
@ -6,23 +6,23 @@
|
||||||
* PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca@sfr.fr)
|
* PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca@sfr.fr)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* INCLUDES *******************************************************************/
|
||||||
|
|
||||||
#include "consrv.h"
|
#include "consrv.h"
|
||||||
#include "conio.h"
|
#include "conio.h"
|
||||||
|
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
|
/* GLOBALS ********************************************************************/
|
||||||
|
|
||||||
HINSTANCE ConSrvDllInstance = NULL;
|
HINSTANCE ConSrvDllInstance = NULL;
|
||||||
// HANDLE BaseApiPort = NULL;
|
|
||||||
|
|
||||||
/* Memory */
|
/* Memory */
|
||||||
HANDLE ConSrvHeap = NULL; // Our own heap.
|
HANDLE ConSrvHeap = NULL; // Our own heap.
|
||||||
// HANDLE BaseSrvSharedHeap = NULL; // Shared heap with CSR. (CsrSrvSharedSectionHeap)
|
|
||||||
// PBASE_STATIC_SERVER_DATA BaseStaticServerData = NULL; // Data that we can share amongst processes. Initialized inside BaseSrvSharedHeap.
|
|
||||||
|
|
||||||
// Windows 2k3 tables, adapted from http://j00ru.vexillium.org/csrss_list/api_list.html#Windows_2k3
|
// Windows Server 2003 table from http://j00ru.vexillium.org/csrss_list/api_list.html#Windows_2k3
|
||||||
// plus a little bit of Windows 7. It is for testing purposes. After that I will add stubs.
|
// plus a little bit of Windows 7.
|
||||||
// Some names are also deduced from the subsystems/win32/csrss/csrsrv/server.c ones.
|
|
||||||
PCSR_API_ROUTINE ConsoleServerApiDispatchTable[ConsolepMaxApiNumber] =
|
PCSR_API_ROUTINE ConsoleServerApiDispatchTable[ConsolepMaxApiNumber] =
|
||||||
{
|
{
|
||||||
SrvOpenConsole,
|
SrvOpenConsole,
|
||||||
|
@ -111,7 +111,7 @@ PCSR_API_ROUTINE ConsoleServerApiDispatchTable[ConsolepMaxApiNumber] =
|
||||||
SrvGetConsoleSelectionInfo,
|
SrvGetConsoleSelectionInfo,
|
||||||
SrvGetConsoleProcessList,
|
SrvGetConsoleProcessList,
|
||||||
SrvGetConsoleHistory,
|
SrvGetConsoleHistory,
|
||||||
SrvSetConsoleHistory
|
SrvSetConsoleHistory,
|
||||||
};
|
};
|
||||||
|
|
||||||
BOOLEAN ConsoleServerApiServerValidTable[ConsolepMaxApiNumber] =
|
BOOLEAN ConsoleServerApiServerValidTable[ConsolepMaxApiNumber] =
|
||||||
|
@ -203,8 +203,6 @@ BOOLEAN ConsoleServerApiServerValidTable[ConsolepMaxApiNumber] =
|
||||||
FALSE, // SrvGetConsoleProcessList,
|
FALSE, // SrvGetConsoleProcessList,
|
||||||
FALSE, // SrvGetConsoleHistory,
|
FALSE, // SrvGetConsoleHistory,
|
||||||
FALSE, // SrvSetConsoleHistory
|
FALSE, // SrvSetConsoleHistory
|
||||||
|
|
||||||
// FALSE
|
|
||||||
};
|
};
|
||||||
|
|
||||||
PCHAR ConsoleServerApiNameTable[ConsolepMaxApiNumber] =
|
PCHAR ConsoleServerApiNameTable[ConsolepMaxApiNumber] =
|
||||||
|
@ -295,161 +293,16 @@ PCHAR ConsoleServerApiNameTable[ConsolepMaxApiNumber] =
|
||||||
"GetConsoleSelectionInfo",
|
"GetConsoleSelectionInfo",
|
||||||
"GetConsoleProcessList",
|
"GetConsoleProcessList",
|
||||||
"GetConsoleHistory",
|
"GetConsoleHistory",
|
||||||
"SetConsoleHistory"
|
"SetConsoleHistory",
|
||||||
|
|
||||||
// NULL
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
PCSR_API_ROUTINE ConSrvApiDefinitions[] =
|
|
||||||
{
|
|
||||||
CsrGetHandle,
|
|
||||||
CsrGetHandle,
|
|
||||||
CsrCloseHandle,
|
|
||||||
CsrVerifyHandle,
|
|
||||||
CsrDuplicateHandle,
|
|
||||||
CsrGetInputWaitHandle,
|
|
||||||
CsrFillOutputChar,
|
|
||||||
CsrReadInputEvent,
|
|
||||||
CsrWriteConsoleOutputChar,
|
|
||||||
CsrWriteConsoleOutputAttrib,
|
|
||||||
CsrFillOutputAttrib,
|
|
||||||
CsrSetTextAttrib,
|
|
||||||
CsrWriteConsoleOutput,
|
|
||||||
CsrFlushInputBuffer,
|
|
||||||
CsrReadConsoleOutputChar,
|
|
||||||
CsrReadConsoleOutputAttrib,
|
|
||||||
CsrExitReactos,
|
|
||||||
CsrHardwareStateProperty,
|
|
||||||
CsrCreateDesktop,
|
|
||||||
CsrShowDesktop,
|
|
||||||
CsrHideDesktop,
|
|
||||||
CsrSetLogonNotifyWindow,
|
|
||||||
CsrRegisterLogonProcess,
|
|
||||||
CsrGenerateCtrlEvent,
|
|
||||||
};
|
|
||||||
|
|
||||||
static CSRSS_API_DEFINITION ConSrvApiDefinitions[] =
|
|
||||||
{
|
|
||||||
CSRSS_DEFINE_API(GET_INPUT_HANDLE, CsrGetHandle),
|
|
||||||
CSRSS_DEFINE_API(GET_OUTPUT_HANDLE, CsrGetHandle),
|
|
||||||
CSRSS_DEFINE_API(CLOSE_HANDLE, CsrCloseHandle),
|
|
||||||
CSRSS_DEFINE_API(VERIFY_HANDLE, CsrVerifyHandle),
|
|
||||||
CSRSS_DEFINE_API(DUPLICATE_HANDLE, CsrDuplicateHandle),
|
|
||||||
CSRSS_DEFINE_API(GET_INPUT_WAIT_HANDLE, CsrGetInputWaitHandle),
|
|
||||||
CSRSS_DEFINE_API(WRITE_CONSOLE, CsrWriteConsole),
|
|
||||||
CSRSS_DEFINE_API(READ_CONSOLE, CsrReadConsole),
|
|
||||||
CSRSS_DEFINE_API(ALLOC_CONSOLE, CsrAllocConsole),
|
|
||||||
CSRSS_DEFINE_API(FREE_CONSOLE, CsrFreeConsole),
|
|
||||||
CSRSS_DEFINE_API(SCREEN_BUFFER_INFO, CsrGetScreenBufferInfo),
|
|
||||||
CSRSS_DEFINE_API(SET_CURSOR, CsrSetCursor),
|
|
||||||
CSRSS_DEFINE_API(FILL_OUTPUT, CsrFillOutputChar),
|
|
||||||
CSRSS_DEFINE_API(READ_INPUT, CsrReadInputEvent),
|
|
||||||
CSRSS_DEFINE_API(WRITE_CONSOLE_OUTPUT_CHAR, CsrWriteConsoleOutputChar),
|
|
||||||
CSRSS_DEFINE_API(WRITE_CONSOLE_OUTPUT_ATTRIB, CsrWriteConsoleOutputAttrib),
|
|
||||||
CSRSS_DEFINE_API(FILL_OUTPUT_ATTRIB, CsrFillOutputAttrib),
|
|
||||||
CSRSS_DEFINE_API(GET_CURSOR_INFO, CsrGetCursorInfo),
|
|
||||||
CSRSS_DEFINE_API(SET_CURSOR_INFO, CsrSetCursorInfo),
|
|
||||||
CSRSS_DEFINE_API(SET_ATTRIB, CsrSetTextAttrib),
|
|
||||||
CSRSS_DEFINE_API(GET_CONSOLE_MODE, CsrGetConsoleMode),
|
|
||||||
CSRSS_DEFINE_API(SET_CONSOLE_MODE, CsrSetConsoleMode),
|
|
||||||
CSRSS_DEFINE_API(CREATE_SCREEN_BUFFER, CsrCreateScreenBuffer),
|
|
||||||
CSRSS_DEFINE_API(SET_SCREEN_BUFFER, CsrSetScreenBuffer),
|
|
||||||
CSRSS_DEFINE_API(SET_TITLE, CsrSetTitle),
|
|
||||||
CSRSS_DEFINE_API(GET_TITLE, CsrGetTitle),
|
|
||||||
CSRSS_DEFINE_API(WRITE_CONSOLE_OUTPUT, CsrWriteConsoleOutput),
|
|
||||||
CSRSS_DEFINE_API(FLUSH_INPUT_BUFFER, CsrFlushInputBuffer),
|
|
||||||
CSRSS_DEFINE_API(SCROLL_CONSOLE_SCREEN_BUFFER, CsrScrollConsoleScreenBuffer),
|
|
||||||
CSRSS_DEFINE_API(READ_CONSOLE_OUTPUT_CHAR, CsrReadConsoleOutputChar),
|
|
||||||
CSRSS_DEFINE_API(READ_CONSOLE_OUTPUT_ATTRIB, CsrReadConsoleOutputAttrib),
|
|
||||||
CSRSS_DEFINE_API(GET_NUM_INPUT_EVENTS, CsrGetNumberOfConsoleInputEvents),
|
|
||||||
CSRSS_DEFINE_API(EXIT_REACTOS, CsrExitReactos),
|
|
||||||
CSRSS_DEFINE_API(PEEK_CONSOLE_INPUT, CsrPeekConsoleInput),
|
|
||||||
CSRSS_DEFINE_API(READ_CONSOLE_OUTPUT, CsrReadConsoleOutput),
|
|
||||||
CSRSS_DEFINE_API(WRITE_CONSOLE_INPUT, CsrWriteConsoleInput),
|
|
||||||
CSRSS_DEFINE_API(SETGET_CONSOLE_HW_STATE, CsrHardwareStateProperty),
|
|
||||||
CSRSS_DEFINE_API(GET_CONSOLE_WINDOW, CsrGetConsoleWindow),
|
|
||||||
CSRSS_DEFINE_API(CREATE_DESKTOP, CsrCreateDesktop),
|
|
||||||
CSRSS_DEFINE_API(SHOW_DESKTOP, CsrShowDesktop),
|
|
||||||
CSRSS_DEFINE_API(HIDE_DESKTOP, CsrHideDesktop),
|
|
||||||
CSRSS_DEFINE_API(SET_CONSOLE_ICON, CsrSetConsoleIcon),
|
|
||||||
CSRSS_DEFINE_API(SET_LOGON_NOTIFY_WINDOW, CsrSetLogonNotifyWindow),
|
|
||||||
CSRSS_DEFINE_API(REGISTER_LOGON_PROCESS, CsrRegisterLogonProcess),
|
|
||||||
CSRSS_DEFINE_API(GET_CONSOLE_CP, CsrGetConsoleCodePage),
|
|
||||||
CSRSS_DEFINE_API(SET_CONSOLE_CP, CsrSetConsoleCodePage),
|
|
||||||
CSRSS_DEFINE_API(GET_CONSOLE_OUTPUT_CP, CsrGetConsoleOutputCodePage),
|
|
||||||
CSRSS_DEFINE_API(SET_CONSOLE_OUTPUT_CP, CsrSetConsoleOutputCodePage),
|
|
||||||
CSRSS_DEFINE_API(GET_PROCESS_LIST, CsrGetProcessList),
|
|
||||||
CSRSS_DEFINE_API(ADD_CONSOLE_ALIAS, CsrAddConsoleAlias),
|
|
||||||
CSRSS_DEFINE_API(GET_CONSOLE_ALIAS, CsrGetConsoleAlias),
|
|
||||||
CSRSS_DEFINE_API(GET_ALL_CONSOLE_ALIASES, CsrGetAllConsoleAliases),
|
|
||||||
CSRSS_DEFINE_API(GET_ALL_CONSOLE_ALIASES_LENGTH, CsrGetAllConsoleAliasesLength),
|
|
||||||
CSRSS_DEFINE_API(GET_CONSOLE_ALIASES_EXES, CsrGetConsoleAliasesExes),
|
|
||||||
CSRSS_DEFINE_API(GET_CONSOLE_ALIASES_EXES_LENGTH, CsrGetConsoleAliasesExesLength),
|
|
||||||
CSRSS_DEFINE_API(GENERATE_CTRL_EVENT, CsrGenerateCtrlEvent),
|
|
||||||
CSRSS_DEFINE_API(SET_SCREEN_BUFFER_SIZE, CsrSetScreenBufferSize),
|
|
||||||
CSRSS_DEFINE_API(GET_CONSOLE_SELECTION_INFO, CsrGetConsoleSelectionInfo),
|
|
||||||
CSRSS_DEFINE_API(GET_COMMAND_HISTORY_LENGTH, CsrGetCommandHistoryLength),
|
|
||||||
CSRSS_DEFINE_API(GET_COMMAND_HISTORY, CsrGetCommandHistory),
|
|
||||||
CSRSS_DEFINE_API(EXPUNGE_COMMAND_HISTORY, CsrExpungeCommandHistory),
|
|
||||||
CSRSS_DEFINE_API(SET_HISTORY_NUMBER_COMMANDS, CsrSetHistoryNumberCommands),
|
|
||||||
CSRSS_DEFINE_API(GET_HISTORY_INFO, CsrGetHistoryInfo),
|
|
||||||
CSRSS_DEFINE_API(SET_HISTORY_INFO, CsrSetHistoryInfo),
|
|
||||||
{ 0, 0, NULL }
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/* FUNCTIONS ******************************************************************/
|
/* FUNCTIONS ******************************************************************/
|
||||||
|
|
||||||
/*
|
|
||||||
VOID WINAPI ConsoleStaticServerThread(PVOID x)
|
|
||||||
{
|
|
||||||
// NTSTATUS Status = STATUS_SUCCESS;
|
|
||||||
PPORT_MESSAGE Request = (PPORT_MESSAGE)x;
|
|
||||||
PPORT_MESSAGE Reply = NULL;
|
|
||||||
ULONG MessageType = 0;
|
|
||||||
|
|
||||||
DPRINT("BASESRV: %s called\n", __FUNCTION__);
|
|
||||||
|
|
||||||
MessageType = Request->u2.s2.Type;
|
|
||||||
DPRINT("BASESRV: %s received a message (Type=%d)\n",
|
|
||||||
__FUNCTION__, MessageType);
|
|
||||||
switch (MessageType)
|
|
||||||
{
|
|
||||||
default:
|
|
||||||
Reply = Request;
|
|
||||||
/\* Status = *\/ NtReplyPort(BaseApiPort, Reply);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
CSR_SERVER_DLL_INIT(ConServerDllInitialization)
|
CSR_SERVER_DLL_INIT(ConServerDllInitialization)
|
||||||
{
|
{
|
||||||
/*
|
/* Initialize the memory */
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
ConSrvHeap = RtlGetProcessHeap();
|
||||||
|
|
||||||
DPRINT("BASSRV: %s(%ld,...) called\n", __FUNCTION__, ArgumentCount);
|
|
||||||
|
|
||||||
// Get the listening port from csrsrv.dll
|
|
||||||
BaseApiPort = CsrQueryApiPort();
|
|
||||||
if (BaseApiPort == NULL) return STATUS_UNSUCCESSFUL;
|
|
||||||
|
|
||||||
// Register our message dispatcher
|
|
||||||
Status = CsrAddStaticServerThread(ConsoleStaticServerThread);
|
|
||||||
if (NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
//TODO initialize the BASE server
|
|
||||||
}
|
|
||||||
return STATUS_SUCCESS;
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Initialize memory */
|
|
||||||
ConSrvHeap = RtlGetProcessHeap(); // Initialize our own heap.
|
|
||||||
// BaseSrvSharedHeap = LoadedServerDll->SharedSection; // Get the CSR shared heap.
|
|
||||||
// LoadedServerDll->SharedSection = BaseStaticServerData;
|
|
||||||
|
|
||||||
ConSrvInitConsoleSupport();
|
ConSrvInitConsoleSupport();
|
||||||
|
|
||||||
|
@ -464,6 +317,7 @@ CSR_SERVER_DLL_INIT(ConServerDllInitialization)
|
||||||
LoadedServerDll->DisconnectCallback = ConSrvDisconnect;
|
LoadedServerDll->DisconnectCallback = ConSrvDisconnect;
|
||||||
LoadedServerDll->NewProcessCallback = ConSrvNewProcess;
|
LoadedServerDll->NewProcessCallback = ConSrvNewProcess;
|
||||||
// LoadedServerDll->HardErrorCallback = ConSrvHardError;
|
// LoadedServerDll->HardErrorCallback = ConSrvHardError;
|
||||||
|
LoadedServerDll->ShutdownProcessCallback = NULL;
|
||||||
|
|
||||||
ConSrvDllInstance = LoadedServerDll->ServerHandle;
|
ConSrvDllInstance = LoadedServerDll->ServerHandle;
|
||||||
|
|
||||||
|
@ -477,6 +331,7 @@ DllMain(IN HINSTANCE hInstanceDll,
|
||||||
IN DWORD dwReason,
|
IN DWORD dwReason,
|
||||||
IN LPVOID lpReserved)
|
IN LPVOID lpReserved)
|
||||||
{
|
{
|
||||||
|
UNREFERENCED_PARAMETER(hInstanceDll);
|
||||||
UNREFERENCED_PARAMETER(dwReason);
|
UNREFERENCED_PARAMETER(dwReason);
|
||||||
UNREFERENCED_PARAMETER(lpReserved);
|
UNREFERENCED_PARAMETER(lpReserved);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -8,7 +8,7 @@ spec2def(winsrv.dll winsrv.spec)
|
||||||
list(APPEND SOURCE
|
list(APPEND SOURCE
|
||||||
harderror.c
|
harderror.c
|
||||||
init.c
|
init.c
|
||||||
server.c
|
register.c
|
||||||
shutdown.c
|
shutdown.c
|
||||||
winsrv.rc
|
winsrv.rc
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/winsrv.def)
|
${CMAKE_CURRENT_BINARY_DIR}/winsrv.def)
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
* Timo Kreuzer (timo.kreuzer@reactos.org)
|
* Timo Kreuzer (timo.kreuzer@reactos.org)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* INCLUDES ******************************************************************/
|
/* INCLUDES *******************************************************************/
|
||||||
|
|
||||||
#include "winsrv.h"
|
#include "winsrv.h"
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
#define IDTRYAGAIN 10
|
#define IDTRYAGAIN 10
|
||||||
#define IDCONTINUE 11
|
#define IDCONTINUE 11
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS ******************************************************************/
|
||||||
|
|
||||||
static
|
static
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
@ -509,7 +509,7 @@ CsrpMessageBox(
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
WINAPI
|
WINAPI
|
||||||
Win32CsrHardError(
|
UserServerHardError(
|
||||||
IN PCSR_THREAD ThreadData,
|
IN PCSR_THREAD ThreadData,
|
||||||
IN PHARDERROR_MSG Message)
|
IN PHARDERROR_MSG Message)
|
||||||
{
|
{
|
||||||
|
@ -583,3 +583,4 @@ Win32CsrHardError(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* EOF */
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
* Hermes Belusca-Maito (hermes.belusca@sfr.fr)
|
* Hermes Belusca-Maito (hermes.belusca@sfr.fr)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* INCLUDES *******************************************************************/
|
||||||
|
|
||||||
#include "winsrv.h"
|
#include "winsrv.h"
|
||||||
|
|
||||||
/* Public Win32K Headers */
|
/* Public Win32K Headers */
|
||||||
|
@ -16,15 +18,14 @@
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
HINSTANCE UserSrvDllInstance = NULL;
|
/* GLOBALS ********************************************************************/
|
||||||
// HANDLE WinSrvApiPort = NULL;
|
|
||||||
|
HINSTANCE UserServerDllInstance = NULL;
|
||||||
|
|
||||||
/* Memory */
|
/* Memory */
|
||||||
HANDLE UserSrvHeap = NULL; // Our own heap.
|
HANDLE UserServerHeap = NULL; // Our own heap.
|
||||||
// HANDLE BaseSrvSharedHeap = NULL; // Shared heap with CSR. (CsrSrvSharedSectionHeap)
|
|
||||||
// PBASE_STATIC_SERVER_DATA BaseStaticServerData = NULL; // Data that we can share amongst processes. Initialized inside BaseSrvSharedHeap.
|
|
||||||
|
|
||||||
|
|
||||||
|
// Windows Server 2003 table from http://j00ru.vexillium.org/csrss_list/api_list.html#Windows_2k3
|
||||||
PCSR_API_ROUTINE UserServerApiDispatchTable[UserpMaxApiNumber] =
|
PCSR_API_ROUTINE UserServerApiDispatchTable[UserpMaxApiNumber] =
|
||||||
{
|
{
|
||||||
SrvExitWindowsEx,
|
SrvExitWindowsEx,
|
||||||
|
@ -42,7 +43,7 @@ PCSR_API_ROUTINE UserServerApiDispatchTable[UserpMaxApiNumber] =
|
||||||
// SrvGetSetShutdownBlockReason, // Added in Vista
|
// SrvGetSetShutdownBlockReason, // Added in Vista
|
||||||
|
|
||||||
/// HACK: ReactOS-specific
|
/// HACK: ReactOS-specific
|
||||||
RosSetLogonNotifyWindow
|
RosSetLogonNotifyWindow,
|
||||||
};
|
};
|
||||||
|
|
||||||
BOOLEAN UserServerApiServerValidTable[UserpMaxApiNumber] =
|
BOOLEAN UserServerApiServerValidTable[UserpMaxApiNumber] =
|
||||||
|
@ -63,8 +64,6 @@ BOOLEAN UserServerApiServerValidTable[UserpMaxApiNumber] =
|
||||||
|
|
||||||
/// HACK: ReactOS-specific
|
/// HACK: ReactOS-specific
|
||||||
FALSE, // RosSetLogonNotifyWindow
|
FALSE, // RosSetLogonNotifyWindow
|
||||||
|
|
||||||
// FALSE
|
|
||||||
};
|
};
|
||||||
|
|
||||||
PCHAR UserServerApiNameTable[UserpMaxApiNumber] =
|
PCHAR UserServerApiNameTable[UserpMaxApiNumber] =
|
||||||
|
@ -85,35 +84,17 @@ PCHAR UserServerApiNameTable[UserpMaxApiNumber] =
|
||||||
|
|
||||||
/// HACK: ReactOS-specific
|
/// HACK: ReactOS-specific
|
||||||
"RosSetLogonNotifyWindow",
|
"RosSetLogonNotifyWindow",
|
||||||
|
|
||||||
// NULL
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* FUNCTIONS ******************************************************************/
|
/* FUNCTIONS ******************************************************************/
|
||||||
|
|
||||||
/*
|
// PUSER_SOUND_SENTRY. Used in basesrv.dll
|
||||||
VOID WINAPI UserStaticServerThread(PVOID x)
|
BOOL WINAPI _UserSoundSentry(VOID)
|
||||||
{
|
{
|
||||||
// NTSTATUS Status = STATUS_SUCCESS;
|
// TODO: Do something.
|
||||||
PPORT_MESSAGE Request = (PPORT_MESSAGE)x;
|
return TRUE;
|
||||||
PPORT_MESSAGE Reply = NULL;
|
|
||||||
ULONG MessageType = 0;
|
|
||||||
|
|
||||||
DPRINT("WINSRV: %s(%08lx) called\n", __FUNCTION__, x);
|
|
||||||
|
|
||||||
MessageType = Request->u2.s2.Type;
|
|
||||||
DPRINT("WINSRV: %s(%08lx) received a message (Type=%d)\n",
|
|
||||||
__FUNCTION__, x, MessageType);
|
|
||||||
switch (MessageType)
|
|
||||||
{
|
|
||||||
default:
|
|
||||||
Reply = Request;
|
|
||||||
/\* Status = *\/ NtReplyPort(WinSrvApiPort, Reply);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
ULONG
|
ULONG
|
||||||
InitializeVideoAddressSpace(VOID)
|
InitializeVideoAddressSpace(VOID)
|
||||||
|
@ -290,26 +271,6 @@ CreateSystemThreads(PVOID pParam)
|
||||||
|
|
||||||
CSR_SERVER_DLL_INIT(UserServerDllInitialization)
|
CSR_SERVER_DLL_INIT(UserServerDllInitialization)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
|
||||||
|
|
||||||
DPRINT("WINSRV: %s called\n", __FUNCTION__);
|
|
||||||
|
|
||||||
// Get the listening port from csrsrv.dll
|
|
||||||
WinSrvApiPort = CsrQueryApiPort ();
|
|
||||||
if (NULL == WinSrvApiPort)
|
|
||||||
{
|
|
||||||
return STATUS_UNSUCCESSFUL;
|
|
||||||
}
|
|
||||||
// Register our message dispatcher
|
|
||||||
Status = CsrAddStaticServerThread (UserStaticServerThread);
|
|
||||||
if (NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
//TODO: perform the real user server internal initialization here
|
|
||||||
}
|
|
||||||
return Status;
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*** From win32csr... ***/
|
/*** From win32csr... ***/
|
||||||
HANDLE ServerThread;
|
HANDLE ServerThread;
|
||||||
CLIENT_ID ClientId;
|
CLIENT_ID ClientId;
|
||||||
|
@ -317,11 +278,10 @@ CSR_SERVER_DLL_INIT(UserServerDllInitialization)
|
||||||
UINT i;
|
UINT i;
|
||||||
/*** END - From win32csr... ***/
|
/*** END - From win32csr... ***/
|
||||||
|
|
||||||
/* Initialize memory */
|
/* Initialize the memory */
|
||||||
UserSrvHeap = RtlGetProcessHeap(); // Initialize our own heap.
|
UserServerHeap = RtlGetProcessHeap();
|
||||||
// BaseSrvSharedHeap = LoadedServerDll->SharedSection; // Get the CSR shared heap.
|
|
||||||
// LoadedServerDll->SharedSection = BaseStaticServerData;
|
|
||||||
|
|
||||||
|
/* Initialize the video */
|
||||||
CsrpInitVideo();
|
CsrpInitVideo();
|
||||||
NtUserInitialize(0, NULL, NULL);
|
NtUserInitialize(0, NULL, NULL);
|
||||||
PrivateCsrssManualGuiCheck(0);
|
PrivateCsrssManualGuiCheck(0);
|
||||||
|
@ -334,9 +294,11 @@ CSR_SERVER_DLL_INIT(UserServerDllInitialization)
|
||||||
LoadedServerDll->NameTable = UserServerApiNameTable;
|
LoadedServerDll->NameTable = UserServerApiNameTable;
|
||||||
LoadedServerDll->SizeOfProcessData = 0;
|
LoadedServerDll->SizeOfProcessData = 0;
|
||||||
LoadedServerDll->ConnectCallback = NULL;
|
LoadedServerDll->ConnectCallback = NULL;
|
||||||
// LoadedServerDll->DisconnectCallback = Win32CsrReleaseConsole;
|
LoadedServerDll->DisconnectCallback = NULL;
|
||||||
// LoadedServerDll->NewProcessCallback = Win32CsrDuplicateHandleTable;
|
LoadedServerDll->HardErrorCallback = UserServerHardError;
|
||||||
LoadedServerDll->HardErrorCallback = Win32CsrHardError;
|
LoadedServerDll->ShutdownProcessCallback = NULL;
|
||||||
|
|
||||||
|
UserServerDllInstance = LoadedServerDll->ServerHandle;
|
||||||
|
|
||||||
/*** From win32csr... See r54125 ***/
|
/*** From win32csr... See r54125 ***/
|
||||||
/* Start the Raw Input Thread and the Desktop Thread */
|
/* Start the Raw Input Thread and the Desktop Thread */
|
||||||
|
@ -357,28 +319,20 @@ CSR_SERVER_DLL_INIT(UserServerDllInitialization)
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// PUSER_SOUND_SENTRY. Used in basesrv.dll
|
|
||||||
BOOL WINAPI _UserSoundSentry(VOID)
|
|
||||||
{
|
|
||||||
// Do something.
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
WINAPI
|
WINAPI
|
||||||
DllMain(IN HINSTANCE hInstanceDll,
|
DllMain(IN HINSTANCE hInstanceDll,
|
||||||
IN DWORD dwReason,
|
IN DWORD dwReason,
|
||||||
IN LPVOID lpReserved)
|
IN LPVOID lpReserved)
|
||||||
{
|
{
|
||||||
|
UNREFERENCED_PARAMETER(hInstanceDll);
|
||||||
UNREFERENCED_PARAMETER(dwReason);
|
UNREFERENCED_PARAMETER(dwReason);
|
||||||
UNREFERENCED_PARAMETER(lpReserved);
|
UNREFERENCED_PARAMETER(lpReserved);
|
||||||
|
|
||||||
if (DLL_PROCESS_ATTACH == dwReason)
|
if (DLL_PROCESS_ATTACH == dwReason)
|
||||||
{
|
{
|
||||||
UserSrvDllInstance = hInstanceDll;
|
DPRINT1("WINSRV - HACK: Use keyboard hook hack\n");
|
||||||
|
|
||||||
/*** HACK from win32csr... ***/
|
/*** HACK from win32csr... ***/
|
||||||
|
|
||||||
//
|
//
|
||||||
// HACK HACK HACK ReactOS to BOOT! Initialization BUG ALERT! See bug 5655.
|
// HACK HACK HACK ReactOS to BOOT! Initialization BUG ALERT! See bug 5655.
|
||||||
//
|
//
|
||||||
|
|
93
win32ss/user/winsrv/register.c
Normal file
93
win32ss/user/winsrv/register.c
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
/*
|
||||||
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
|
* PROJECT: ReactOS User API Server DLL
|
||||||
|
* FILE: win32ss/user/winsrv/register.c
|
||||||
|
* PURPOSE: Register logon window and services process
|
||||||
|
* PROGRAMMERS: Eric Kohl
|
||||||
|
* Hermes Belusca-Maito (hermes.belusca@sfr.fr)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* INCLUDES *******************************************************************/
|
||||||
|
|
||||||
|
#include "winsrv.h"
|
||||||
|
|
||||||
|
#define NDEBUG
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
/* GLOBALS ********************************************************************/
|
||||||
|
|
||||||
|
static BOOLEAN ServicesProcessIdValid = FALSE;
|
||||||
|
static ULONG_PTR ServicesProcessId = 0;
|
||||||
|
|
||||||
|
HWND LogonNotifyWindow = NULL;
|
||||||
|
ULONG_PTR LogonProcessId = 0;
|
||||||
|
|
||||||
|
/* PUBLIC SERVER APIS *********************************************************/
|
||||||
|
|
||||||
|
CSR_API(SrvRegisterLogonProcess)
|
||||||
|
{
|
||||||
|
PCSRSS_REGISTER_LOGON_PROCESS RegisterLogonProcessRequest = &((PUSER_API_MESSAGE)ApiMessage)->Data.RegisterLogonProcessRequest;
|
||||||
|
|
||||||
|
if (RegisterLogonProcessRequest->Register)
|
||||||
|
{
|
||||||
|
if (LogonProcessId != 0)
|
||||||
|
return STATUS_LOGON_SESSION_EXISTS;
|
||||||
|
|
||||||
|
LogonProcessId = RegisterLogonProcessRequest->ProcessId;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (ApiMessage->Header.ClientId.UniqueProcess != (HANDLE)LogonProcessId)
|
||||||
|
{
|
||||||
|
DPRINT1("Current logon process 0x%x, can't deregister from process 0x%x\n",
|
||||||
|
LogonProcessId, ApiMessage->Header.ClientId.UniqueProcess);
|
||||||
|
return STATUS_NOT_LOGON_PROCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
LogonProcessId = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// HACK: ReactOS-specific
|
||||||
|
CSR_API(RosSetLogonNotifyWindow)
|
||||||
|
{
|
||||||
|
PCSRSS_SET_LOGON_NOTIFY_WINDOW SetLogonNotifyWindowRequest = &((PUSER_API_MESSAGE)ApiMessage)->Data.SetLogonNotifyWindowRequest;
|
||||||
|
DWORD WindowCreator;
|
||||||
|
|
||||||
|
if (0 == GetWindowThreadProcessId(SetLogonNotifyWindowRequest->LogonNotifyWindow,
|
||||||
|
&WindowCreator))
|
||||||
|
{
|
||||||
|
DPRINT1("Can't get window creator\n");
|
||||||
|
return STATUS_INVALID_HANDLE;
|
||||||
|
}
|
||||||
|
if (WindowCreator != LogonProcessId)
|
||||||
|
{
|
||||||
|
DPRINT1("Trying to register window not created by winlogon as notify window\n");
|
||||||
|
return STATUS_ACCESS_DENIED;
|
||||||
|
}
|
||||||
|
|
||||||
|
LogonNotifyWindow = SetLogonNotifyWindowRequest->LogonNotifyWindow;
|
||||||
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
CSR_API(SrvRegisterServicesProcess)
|
||||||
|
{
|
||||||
|
PCSRSS_REGISTER_SERVICES_PROCESS RegisterServicesProcessRequest = &((PUSER_API_MESSAGE)ApiMessage)->Data.RegisterServicesProcessRequest;
|
||||||
|
|
||||||
|
if (ServicesProcessIdValid == TRUE)
|
||||||
|
{
|
||||||
|
/* Only accept a single call */
|
||||||
|
return STATUS_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ServicesProcessId = RegisterServicesProcessRequest->ProcessId;
|
||||||
|
ServicesProcessIdValid = TRUE;
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* EOF */
|
|
@ -1,43 +0,0 @@
|
||||||
/*
|
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
|
||||||
* PROJECT: ReactOS User API Server DLL
|
|
||||||
* FILE: win32ss/user/winsrv/server.c
|
|
||||||
* PURPOSE: Server APIs
|
|
||||||
* PROGRAMMERS: Eric Kohl
|
|
||||||
* Hermes Belusca-Maito (hermes.belusca@sfr.fr)
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* INCLUDES ******************************************************************/
|
|
||||||
|
|
||||||
#include "winsrv.h"
|
|
||||||
|
|
||||||
#define NDEBUG
|
|
||||||
#include <debug.h>
|
|
||||||
|
|
||||||
|
|
||||||
/* GLOBALS *******************************************************************/
|
|
||||||
|
|
||||||
static BOOLEAN ServicesProcessIdValid = FALSE;
|
|
||||||
static ULONG_PTR ServicesProcessId = 0;
|
|
||||||
|
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
|
||||||
|
|
||||||
CSR_API(SrvRegisterServicesProcess)
|
|
||||||
{
|
|
||||||
PCSRSS_REGISTER_SERVICES_PROCESS RegisterServicesProcessRequest = &((PUSER_API_MESSAGE)ApiMessage)->Data.RegisterServicesProcessRequest;
|
|
||||||
|
|
||||||
if (ServicesProcessIdValid == TRUE)
|
|
||||||
{
|
|
||||||
/* Only accept a single call */
|
|
||||||
return STATUS_INVALID_PARAMETER;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ServicesProcessId = RegisterServicesProcessRequest->ProcessId;
|
|
||||||
ServicesProcessIdValid = TRUE;
|
|
||||||
return STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* EOF */
|
|
|
@ -6,7 +6,7 @@
|
||||||
* PROGRAMMERS:
|
* PROGRAMMERS:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* INCLUDES ******************************************************************/
|
/* INCLUDES *******************************************************************/
|
||||||
|
|
||||||
#include "winsrv.h"
|
#include "winsrv.h"
|
||||||
#include <sddl.h>
|
#include <sddl.h>
|
||||||
|
@ -14,70 +14,7 @@
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
|
/* GLOBALS ********************************************************************/
|
||||||
static HWND LogonNotifyWindow = NULL;
|
|
||||||
static ULONG_PTR LogonProcessId = 0;
|
|
||||||
|
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
|
||||||
|
|
||||||
/*
|
|
||||||
NTSTATUS FASTCALL
|
|
||||||
Win32CsrEnumProcesses(CSRSS_ENUM_PROCESS_PROC EnumProc,
|
|
||||||
PVOID Context)
|
|
||||||
{
|
|
||||||
return CsrEnumProcesses(EnumProc, Context);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
CSR_API(SrvRegisterLogonProcess)
|
|
||||||
{
|
|
||||||
PCSRSS_REGISTER_LOGON_PROCESS RegisterLogonProcessRequest = &((PUSER_API_MESSAGE)ApiMessage)->Data.RegisterLogonProcessRequest;
|
|
||||||
|
|
||||||
if (RegisterLogonProcessRequest->Register)
|
|
||||||
{
|
|
||||||
if (LogonProcessId != 0)
|
|
||||||
return STATUS_LOGON_SESSION_EXISTS;
|
|
||||||
|
|
||||||
LogonProcessId = RegisterLogonProcessRequest->ProcessId;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (ApiMessage->Header.ClientId.UniqueProcess != (HANDLE)LogonProcessId)
|
|
||||||
{
|
|
||||||
DPRINT1("Current logon process 0x%x, can't deregister from process 0x%x\n",
|
|
||||||
LogonProcessId, ApiMessage->Header.ClientId.UniqueProcess);
|
|
||||||
return STATUS_NOT_LOGON_PROCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
LogonProcessId = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// HACK: ReactOS-specific
|
|
||||||
CSR_API(RosSetLogonNotifyWindow)
|
|
||||||
{
|
|
||||||
PCSRSS_SET_LOGON_NOTIFY_WINDOW SetLogonNotifyWindowRequest = &((PUSER_API_MESSAGE)ApiMessage)->Data.SetLogonNotifyWindowRequest;
|
|
||||||
DWORD WindowCreator;
|
|
||||||
|
|
||||||
if (0 == GetWindowThreadProcessId(SetLogonNotifyWindowRequest->LogonNotifyWindow,
|
|
||||||
&WindowCreator))
|
|
||||||
{
|
|
||||||
DPRINT1("Can't get window creator\n");
|
|
||||||
return STATUS_INVALID_HANDLE;
|
|
||||||
}
|
|
||||||
if (WindowCreator != LogonProcessId)
|
|
||||||
{
|
|
||||||
DPRINT1("Trying to register window not created by winlogon as notify window\n");
|
|
||||||
return STATUS_ACCESS_DENIED;
|
|
||||||
}
|
|
||||||
|
|
||||||
LogonNotifyWindow = SetLogonNotifyWindowRequest->LogonNotifyWindow;
|
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef struct tagSHUTDOWN_SETTINGS
|
typedef struct tagSHUTDOWN_SETTINGS
|
||||||
{
|
{
|
||||||
|
@ -114,6 +51,38 @@ typedef struct tagNOTIFY_CONTEXT
|
||||||
#define QUERY_RESULT_ERROR 3
|
#define QUERY_RESULT_ERROR 3
|
||||||
#define QUERY_RESULT_FORCE 4
|
#define QUERY_RESULT_FORCE 4
|
||||||
|
|
||||||
|
typedef void (WINAPI *INITCOMMONCONTROLS_PROC)(void);
|
||||||
|
|
||||||
|
typedef struct tagMESSAGE_CONTEXT
|
||||||
|
{
|
||||||
|
HWND Wnd;
|
||||||
|
UINT Msg;
|
||||||
|
WPARAM wParam;
|
||||||
|
LPARAM lParam;
|
||||||
|
DWORD Timeout;
|
||||||
|
} MESSAGE_CONTEXT, *PMESSAGE_CONTEXT;
|
||||||
|
|
||||||
|
typedef struct tagPROCESS_ENUM_CONTEXT
|
||||||
|
{
|
||||||
|
UINT ProcessCount;
|
||||||
|
PCSR_PROCESS *ProcessData;
|
||||||
|
TOKEN_ORIGIN TokenOrigin;
|
||||||
|
DWORD ShellProcess;
|
||||||
|
DWORD CsrssProcess;
|
||||||
|
} PROCESS_ENUM_CONTEXT, *PPROCESS_ENUM_CONTEXT;
|
||||||
|
|
||||||
|
|
||||||
|
/* FUNCTIONS ******************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
NTSTATUS FASTCALL
|
||||||
|
Win32CsrEnumProcesses(CSRSS_ENUM_PROCESS_PROC EnumProc,
|
||||||
|
PVOID Context)
|
||||||
|
{
|
||||||
|
return CsrEnumProcesses(EnumProc, Context);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
static void FASTCALL
|
static void FASTCALL
|
||||||
UpdateProgressBar(HWND ProgressBar, PNOTIFY_CONTEXT NotifyContext)
|
UpdateProgressBar(HWND ProgressBar, PNOTIFY_CONTEXT NotifyContext)
|
||||||
{
|
{
|
||||||
|
@ -147,14 +116,14 @@ EndNowDlgProc(HWND Dlg, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||||
TitleLength = SendMessageW(NotifyContext->WndClient, WM_GETTEXTLENGTH,
|
TitleLength = SendMessageW(NotifyContext->WndClient, WM_GETTEXTLENGTH,
|
||||||
0, 0) +
|
0, 0) +
|
||||||
GetWindowTextLengthW(Dlg);
|
GetWindowTextLengthW(Dlg);
|
||||||
Title = HeapAlloc(UserSrvHeap, 0, (TitleLength + 1) * sizeof(WCHAR));
|
Title = HeapAlloc(UserServerHeap, 0, (TitleLength + 1) * sizeof(WCHAR));
|
||||||
if (NULL != Title)
|
if (NULL != Title)
|
||||||
{
|
{
|
||||||
Len = GetWindowTextW(Dlg, Title, TitleLength + 1);
|
Len = GetWindowTextW(Dlg, Title, TitleLength + 1);
|
||||||
SendMessageW(NotifyContext->WndClient, WM_GETTEXT,
|
SendMessageW(NotifyContext->WndClient, WM_GETTEXT,
|
||||||
TitleLength + 1 - Len, (LPARAM) (Title + Len));
|
TitleLength + 1 - Len, (LPARAM) (Title + Len));
|
||||||
SetWindowTextW(Dlg, Title);
|
SetWindowTextW(Dlg, Title);
|
||||||
HeapFree(UserSrvHeap, 0, Title);
|
HeapFree(UserServerHeap, 0, Title);
|
||||||
}
|
}
|
||||||
ProgressBar = GetDlgItem(Dlg, IDC_PROGRESS);
|
ProgressBar = GetDlgItem(Dlg, IDC_PROGRESS);
|
||||||
SendMessageW(ProgressBar, PBM_SETRANGE32, 0,
|
SendMessageW(ProgressBar, PBM_SETRANGE32, 0,
|
||||||
|
@ -206,8 +175,6 @@ EndNowDlgProc(HWND Dlg, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef void (WINAPI *INITCOMMONCONTROLS_PROC)(void);
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
CallInitCommonControls()
|
CallInitCommonControls()
|
||||||
{
|
{
|
||||||
|
@ -215,21 +182,13 @@ CallInitCommonControls()
|
||||||
HMODULE Lib;
|
HMODULE Lib;
|
||||||
INITCOMMONCONTROLS_PROC InitProc;
|
INITCOMMONCONTROLS_PROC InitProc;
|
||||||
|
|
||||||
if (Initialized)
|
if (Initialized) return;
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Lib = LoadLibraryW(L"COMCTL32.DLL");
|
Lib = LoadLibraryW(L"COMCTL32.DLL");
|
||||||
if (NULL == Lib)
|
if (NULL == Lib) return;
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
InitProc = (INITCOMMONCONTROLS_PROC) GetProcAddress(Lib, "InitCommonControls");
|
InitProc = (INITCOMMONCONTROLS_PROC) GetProcAddress(Lib, "InitCommonControls");
|
||||||
if (NULL == InitProc)
|
if (NULL == InitProc) return;
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
(*InitProc)();
|
(*InitProc)();
|
||||||
|
|
||||||
|
@ -245,7 +204,7 @@ EndNowThreadProc(LPVOID Parameter)
|
||||||
SetThreadDesktop(NotifyContext->Desktop);
|
SetThreadDesktop(NotifyContext->Desktop);
|
||||||
SwitchDesktop(NotifyContext->Desktop);
|
SwitchDesktop(NotifyContext->Desktop);
|
||||||
CallInitCommonControls();
|
CallInitCommonControls();
|
||||||
NotifyContext->Dlg = CreateDialogParam(UserSrvDllInstance,
|
NotifyContext->Dlg = CreateDialogParam(UserServerDllInstance,
|
||||||
MAKEINTRESOURCE(IDD_END_NOW), NULL,
|
MAKEINTRESOURCE(IDD_END_NOW), NULL,
|
||||||
EndNowDlgProc, (LPARAM) NotifyContext);
|
EndNowDlgProc, (LPARAM) NotifyContext);
|
||||||
if (NULL == NotifyContext->Dlg)
|
if (NULL == NotifyContext->Dlg)
|
||||||
|
@ -266,15 +225,6 @@ EndNowThreadProc(LPVOID Parameter)
|
||||||
return Msg.wParam;
|
return Msg.wParam;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct tagMESSAGE_CONTEXT
|
|
||||||
{
|
|
||||||
HWND Wnd;
|
|
||||||
UINT Msg;
|
|
||||||
WPARAM wParam;
|
|
||||||
LPARAM lParam;
|
|
||||||
DWORD Timeout;
|
|
||||||
} MESSAGE_CONTEXT, *PMESSAGE_CONTEXT;
|
|
||||||
|
|
||||||
static DWORD WINAPI
|
static DWORD WINAPI
|
||||||
SendQueryEndSession(LPVOID Parameter)
|
SendQueryEndSession(LPVOID Parameter)
|
||||||
{
|
{
|
||||||
|
@ -487,7 +437,7 @@ DtbgIsDesktopVisible(VOID)
|
||||||
return VisibleDesktopWindow != NULL;
|
return VisibleDesktopWindow != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: Find another way to do it. */
|
/* TODO: Find an other way to do it. */
|
||||||
#if 0
|
#if 0
|
||||||
VOID FASTCALL
|
VOID FASTCALL
|
||||||
ConioConsoleCtrlEventTimeout(DWORD Event, PCSR_PROCESS ProcessData, DWORD Timeout)
|
ConioConsoleCtrlEventTimeout(DWORD Event, PCSR_PROCESS ProcessData, DWORD Timeout)
|
||||||
|
@ -527,7 +477,7 @@ NotifyAndTerminateProcess(PCSR_PROCESS ProcessData,
|
||||||
|
|
||||||
if (0 == (Flags & EWX_FORCE))
|
if (0 == (Flags & EWX_FORCE))
|
||||||
{
|
{
|
||||||
// TODO: Find in an other way whether or not the process has a console.
|
// TODO: Find an other way whether or not the process has a console.
|
||||||
#if 0
|
#if 0
|
||||||
if (NULL != ProcessData->Console)
|
if (NULL != ProcessData->Console)
|
||||||
{
|
{
|
||||||
|
@ -596,15 +546,6 @@ NotifyAndTerminateProcess(PCSR_PROCESS ProcessData,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct tagPROCESS_ENUM_CONTEXT
|
|
||||||
{
|
|
||||||
UINT ProcessCount;
|
|
||||||
PCSR_PROCESS *ProcessData;
|
|
||||||
TOKEN_ORIGIN TokenOrigin;
|
|
||||||
DWORD ShellProcess;
|
|
||||||
DWORD CsrssProcess;
|
|
||||||
} PROCESS_ENUM_CONTEXT, *PPROCESS_ENUM_CONTEXT;
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
static NTSTATUS WINAPI
|
static NTSTATUS WINAPI
|
||||||
ExitReactosProcessEnum(PCSR_PROCESS ProcessData, PVOID Data)
|
ExitReactosProcessEnum(PCSR_PROCESS ProcessData, PVOID Data)
|
||||||
|
@ -661,7 +602,7 @@ ExitReactosProcessEnum(PCSR_PROCESS ProcessData, PVOID Data)
|
||||||
{
|
{
|
||||||
ProcessData->ShutdownLevel = 0;
|
ProcessData->ShutdownLevel = 0;
|
||||||
}
|
}
|
||||||
NewData = HeapAlloc(UserSrvHeap, 0, (Context->ProcessCount + 1)
|
NewData = HeapAlloc(UserServerHeap, 0, (Context->ProcessCount + 1)
|
||||||
* sizeof(PCSR_PROCESS));
|
* sizeof(PCSR_PROCESS));
|
||||||
if (NULL == NewData)
|
if (NULL == NewData)
|
||||||
{
|
{
|
||||||
|
@ -671,7 +612,7 @@ ExitReactosProcessEnum(PCSR_PROCESS ProcessData, PVOID Data)
|
||||||
{
|
{
|
||||||
memcpy(NewData, Context->ProcessData,
|
memcpy(NewData, Context->ProcessData,
|
||||||
Context->ProcessCount * sizeof(PCSR_PROCESS));
|
Context->ProcessCount * sizeof(PCSR_PROCESS));
|
||||||
HeapFree(UserSrvHeap, 0, Context->ProcessData);
|
HeapFree(UserServerHeap, 0, Context->ProcessData);
|
||||||
}
|
}
|
||||||
Context->ProcessData = NewData;
|
Context->ProcessData = NewData;
|
||||||
Context->ProcessData[Context->ProcessCount] = ProcessData;
|
Context->ProcessData[Context->ProcessCount] = ProcessData;
|
||||||
|
@ -709,7 +650,7 @@ ProcessDataCompare(const void *Elem1, const void *Elem2)
|
||||||
}
|
}
|
||||||
|
|
||||||
static DWORD FASTCALL
|
static DWORD FASTCALL
|
||||||
GetShutdownSetting(HKEY DesktopKey, LPCWSTR ValueName, DWORD DefaultValue)
|
GetShutdownSettings(HKEY DesktopKey, LPCWSTR ValueName, DWORD DefaultValue)
|
||||||
{
|
{
|
||||||
BYTE ValueBuffer[16];
|
BYTE ValueBuffer[16];
|
||||||
LONG ErrCode;
|
LONG ErrCode;
|
||||||
|
@ -723,7 +664,7 @@ GetShutdownSetting(HKEY DesktopKey, LPCWSTR ValueName, DWORD DefaultValue)
|
||||||
&ValueSize);
|
&ValueSize);
|
||||||
if (ERROR_SUCCESS != ErrCode)
|
if (ERROR_SUCCESS != ErrCode)
|
||||||
{
|
{
|
||||||
DPRINT("GetShutdownSetting for %S failed with error code %ld\n",
|
DPRINT("GetShutdownSettings for %S failed with error code %ld\n",
|
||||||
ValueName, ErrCode);
|
ValueName, ErrCode);
|
||||||
return DefaultValue;
|
return DefaultValue;
|
||||||
}
|
}
|
||||||
|
@ -775,7 +716,7 @@ LoadShutdownSettings(PSID Sid, PSHUTDOWN_SETTINGS ShutdownSettings)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
KeyName = HeapAlloc(UserSrvHeap, 0,
|
KeyName = HeapAlloc(UserServerHeap, 0,
|
||||||
(wcslen(StringSid) + wcslen(Subkey) + 1) *
|
(wcslen(StringSid) + wcslen(Subkey) + 1) *
|
||||||
sizeof(WCHAR));
|
sizeof(WCHAR));
|
||||||
if (NULL == KeyName)
|
if (NULL == KeyName)
|
||||||
|
@ -791,7 +732,7 @@ LoadShutdownSettings(PSID Sid, PSHUTDOWN_SETTINGS ShutdownSettings)
|
||||||
ErrCode = RegOpenKeyExW(HKEY_USERS, KeyName, 0, KEY_QUERY_VALUE, &DesktopKey);
|
ErrCode = RegOpenKeyExW(HKEY_USERS, KeyName, 0, KEY_QUERY_VALUE, &DesktopKey);
|
||||||
if (KeyName != InitialKeyName)
|
if (KeyName != InitialKeyName)
|
||||||
{
|
{
|
||||||
HeapFree(UserSrvHeap, 0, KeyName);
|
HeapFree(UserServerHeap, 0, KeyName);
|
||||||
}
|
}
|
||||||
if (ERROR_SUCCESS != ErrCode)
|
if (ERROR_SUCCESS != ErrCode)
|
||||||
{
|
{
|
||||||
|
@ -799,12 +740,12 @@ LoadShutdownSettings(PSID Sid, PSHUTDOWN_SETTINGS ShutdownSettings)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ShutdownSettings->AutoEndTasks = (BOOL) GetShutdownSetting(DesktopKey, L"AutoEndTasks",
|
ShutdownSettings->AutoEndTasks = (BOOL) GetShutdownSettings(DesktopKey, L"AutoEndTasks",
|
||||||
(DWORD) DEFAULT_AUTO_END_TASKS);
|
(DWORD) DEFAULT_AUTO_END_TASKS);
|
||||||
ShutdownSettings->HungAppTimeout = GetShutdownSetting(DesktopKey,
|
ShutdownSettings->HungAppTimeout = GetShutdownSettings(DesktopKey,
|
||||||
L"HungAppTimeout",
|
L"HungAppTimeout",
|
||||||
DEFAULT_HUNG_APP_TIMEOUT);
|
DEFAULT_HUNG_APP_TIMEOUT);
|
||||||
ShutdownSettings->WaitToKillAppTimeout = GetShutdownSetting(DesktopKey,
|
ShutdownSettings->WaitToKillAppTimeout = GetShutdownSettings(DesktopKey,
|
||||||
L"WaitToKillAppTimeout",
|
L"WaitToKillAppTimeout",
|
||||||
DEFAULT_WAIT_TO_KILL_APP_TIMEOUT);
|
DEFAULT_WAIT_TO_KILL_APP_TIMEOUT);
|
||||||
|
|
||||||
|
@ -862,7 +803,7 @@ InternalExitReactos(DWORD ProcessId, DWORD ThreadId, UINT Flags)
|
||||||
{
|
{
|
||||||
if (sizeof(FixedUserInfo) < ReturnLength)
|
if (sizeof(FixedUserInfo) < ReturnLength)
|
||||||
{
|
{
|
||||||
UserInfo = HeapAlloc(UserSrvHeap, 0, ReturnLength);
|
UserInfo = HeapAlloc(UserServerHeap, 0, ReturnLength);
|
||||||
if (NULL == UserInfo)
|
if (NULL == UserInfo)
|
||||||
{
|
{
|
||||||
DPRINT1("Unable to allocate %u bytes for user info\n",
|
DPRINT1("Unable to allocate %u bytes for user info\n",
|
||||||
|
@ -875,7 +816,7 @@ InternalExitReactos(DWORD ProcessId, DWORD ThreadId, UINT Flags)
|
||||||
{
|
{
|
||||||
DPRINT1("GetTokenInformation failed with error %d\n",
|
DPRINT1("GetTokenInformation failed with error %d\n",
|
||||||
GetLastError());
|
GetLastError());
|
||||||
HeapFree(UserSrvHeap, 0, UserInfo);
|
HeapFree(UserServerHeap, 0, UserInfo);
|
||||||
CloseHandle(CallerToken);
|
CloseHandle(CallerToken);
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
@ -895,7 +836,7 @@ InternalExitReactos(DWORD ProcessId, DWORD ThreadId, UINT Flags)
|
||||||
LoadShutdownSettings(UserInfo->User.Sid, &ShutdownSettings);
|
LoadShutdownSettings(UserInfo->User.Sid, &ShutdownSettings);
|
||||||
if (UserInfo != (TOKEN_USER *) FixedUserInfo)
|
if (UserInfo != (TOKEN_USER *) FixedUserInfo)
|
||||||
{
|
{
|
||||||
HeapFree(UserSrvHeap, 0, UserInfo);
|
HeapFree(UserServerHeap, 0, UserInfo);
|
||||||
}
|
}
|
||||||
Context.CsrssProcess = GetCurrentProcessId();
|
Context.CsrssProcess = GetCurrentProcessId();
|
||||||
ShellWnd = GetShellWindow();
|
ShellWnd = GetShellWindow();
|
||||||
|
@ -917,7 +858,7 @@ InternalExitReactos(DWORD ProcessId, DWORD ThreadId, UINT Flags)
|
||||||
Status);
|
Status);
|
||||||
if (NULL != Context.ProcessData)
|
if (NULL != Context.ProcessData)
|
||||||
{
|
{
|
||||||
HeapFree(UserSrvHeap, 0, Context.ProcessData);
|
HeapFree(UserServerHeap, 0, Context.ProcessData);
|
||||||
}
|
}
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -942,7 +883,7 @@ InternalExitReactos(DWORD ProcessId, DWORD ThreadId, UINT Flags)
|
||||||
/* Cleanup */
|
/* Cleanup */
|
||||||
if (NULL != Context.ProcessData)
|
if (NULL != Context.ProcessData)
|
||||||
{
|
{
|
||||||
HeapFree(UserSrvHeap, 0, Context.ProcessData);
|
HeapFree(UserServerHeap, 0, Context.ProcessData);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
@ -978,6 +919,9 @@ UserExitReactos(DWORD UserProcessId, UINT Flags)
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* PUBLIC SERVER APIS *********************************************************/
|
||||||
|
|
||||||
CSR_API(SrvExitWindowsEx)
|
CSR_API(SrvExitWindowsEx)
|
||||||
{
|
{
|
||||||
PCSRSS_EXIT_REACTOS ExitReactosRequest = &((PUSER_API_MESSAGE)ApiMessage)->Data.ExitReactosRequest;
|
PCSRSS_EXIT_REACTOS ExitReactosRequest = &((PUSER_API_MESSAGE)ApiMessage)->Data.ExitReactosRequest;
|
||||||
|
|
|
@ -30,19 +30,17 @@
|
||||||
#include <ndk/psfuncs.h>
|
#include <ndk/psfuncs.h>
|
||||||
#include <ndk/rtlfuncs.h>
|
#include <ndk/rtlfuncs.h>
|
||||||
|
|
||||||
|
/* PSEH for SEH Support */
|
||||||
|
#include <pseh/pseh2.h>
|
||||||
|
|
||||||
/* External Winlogon Header */
|
/* External Winlogon Header */
|
||||||
#include <winlogon.h>
|
#include <winlogon.h>
|
||||||
|
|
||||||
/* CSRSS Header */
|
/* CSRSS Header */
|
||||||
#include <csr/csrsrv.h>
|
#include <csr/csrsrv.h>
|
||||||
|
|
||||||
/* PSEH for SEH Support */
|
|
||||||
#include <pseh/pseh2.h>
|
|
||||||
|
|
||||||
/* USER Headers */
|
/* USER Headers */
|
||||||
#include <win/winmsg.h>
|
#include <win/winmsg.h>
|
||||||
// #include <win/base.h>
|
|
||||||
// #include <win/windows.h>
|
|
||||||
|
|
||||||
/* Public Win32 Headers */
|
/* Public Win32 Headers */
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
|
@ -50,46 +48,27 @@
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
|
|
||||||
extern HINSTANCE UserSrvDllInstance;
|
extern HINSTANCE UserServerDllInstance;
|
||||||
extern HANDLE UserSrvHeap;
|
extern HANDLE UserServerHeap;
|
||||||
// extern HANDLE BaseSrvSharedHeap;
|
|
||||||
// extern PBASE_STATIC_SERVER_DATA BaseStaticServerData;
|
extern HWND LogonNotifyWindow;
|
||||||
|
extern ULONG_PTR LogonProcessId;
|
||||||
|
|
||||||
/* init.c */
|
/* init.c */
|
||||||
BOOL WINAPI _UserSoundSentry(VOID);
|
BOOL WINAPI _UserSoundSentry(VOID);
|
||||||
|
|
||||||
/* harderror.c */
|
/* harderror.c */
|
||||||
VOID
|
VOID WINAPI UserServerHardError(IN PCSR_THREAD ThreadData,
|
||||||
WINAPI
|
|
||||||
Win32CsrHardError(IN PCSR_THREAD ThreadData,
|
|
||||||
IN PHARDERROR_MSG Message);
|
IN PHARDERROR_MSG Message);
|
||||||
|
|
||||||
|
/* register.c */
|
||||||
/* shutdown.c */
|
|
||||||
CSR_API(SrvExitWindowsEx);
|
|
||||||
// CSR_API(CsrRegisterSystemClasses);
|
|
||||||
CSR_API(SrvRegisterServicesProcess);
|
CSR_API(SrvRegisterServicesProcess);
|
||||||
CSR_API(SrvRegisterLogonProcess);
|
CSR_API(SrvRegisterLogonProcess);
|
||||||
|
|
||||||
/// HACK: ReactOS-specific
|
/// HACK: ReactOS-specific
|
||||||
CSR_API(RosSetLogonNotifyWindow);
|
CSR_API(RosSetLogonNotifyWindow);
|
||||||
|
|
||||||
|
/* shutdown.c */
|
||||||
/*****************************
|
CSR_API(SrvExitWindowsEx);
|
||||||
|
|
||||||
/\*
|
|
||||||
typedef VOID (WINAPI *CSR_CLEANUP_OBJECT_PROC)(Object_t *Object);
|
|
||||||
|
|
||||||
typedef struct tagCSRSS_OBJECT_DEFINITION
|
|
||||||
{
|
|
||||||
LONG Type;
|
|
||||||
CSR_CLEANUP_OBJECT_PROC CsrCleanupObjectProc;
|
|
||||||
} CSRSS_OBJECT_DEFINITION, *PCSRSS_OBJECT_DEFINITION;
|
|
||||||
*\/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
*****************************/
|
|
||||||
|
|
||||||
#endif // __WINSRV_H__
|
#endif // __WINSRV_H__
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue