mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 16:36:33 +00:00
[BASESRV]
- Compile basesrv and add headers. Some other things are missing yet. svn path=/branches/ros-csrss/; revision=57589
This commit is contained in:
parent
518cb1c247
commit
6144173cdf
6 changed files with 568 additions and 392 deletions
|
@ -1,17 +1,84 @@
|
|||
/*** Public header for BASESRV and the rest ***/
|
||||
|
||||
#ifndef __INCLUDE_WIN_BASE_H
|
||||
#define __INCLUDE_WIN_BASE_H
|
||||
#ifndef __BASE_H__
|
||||
#define __BASE_H__
|
||||
|
||||
//#include <csr/protocol.h>
|
||||
|
||||
/* Base Server */
|
||||
#pragma once
|
||||
|
||||
typedef VOID (CALLBACK * BASE_PROCESS_CREATE_NOTIFY_ROUTINE)(PVOID);
|
||||
|
||||
NTSTATUS WINAPI BaseSetProcessCreateNotify (BASE_PROCESS_CREATE_NOTIFY_ROUTINE);
|
||||
CSR_SERVER_DLL_INIT(ServerDllInitialization);
|
||||
|
||||
#endif // __INCLUDE_WIN_BASE_H
|
||||
|
||||
|
||||
typedef struct _NLS_USER_INFO
|
||||
{
|
||||
WCHAR iCountry[80];
|
||||
WCHAR sCountry[80];
|
||||
WCHAR sList[80];
|
||||
WCHAR iMeasure[80];
|
||||
WCHAR iPaperSize[80];
|
||||
WCHAR sDecimal[80];
|
||||
WCHAR sThousand[80];
|
||||
WCHAR sGrouping[80];
|
||||
WCHAR iDigits[80];
|
||||
WCHAR iLZero[80];
|
||||
WCHAR iNegNumber[80];
|
||||
WCHAR sNativeDigits[80];
|
||||
WCHAR iDigitSubstitution[80];
|
||||
WCHAR sCurrency[80];
|
||||
WCHAR sMonDecSep[80];
|
||||
WCHAR sMonThouSep[80];
|
||||
WCHAR sMonGrouping[80];
|
||||
WCHAR iCurrDigits[80];
|
||||
WCHAR iCurrency[80];
|
||||
WCHAR iNegCurr[80];
|
||||
WCHAR sPosSign[80];
|
||||
WCHAR sNegSign[80];
|
||||
WCHAR sTimeFormat[80];
|
||||
WCHAR s1159[80];
|
||||
WCHAR s2359[80];
|
||||
WCHAR sShortDate[80];
|
||||
WCHAR sYearMonth[80];
|
||||
WCHAR sLongDate[80];
|
||||
WCHAR iCalType[80];
|
||||
WCHAR iFirstDay[80];
|
||||
WCHAR iFirstWeek[80];
|
||||
WCHAR sLocale[80];
|
||||
WCHAR sLocaleName[85];
|
||||
LCID UserLocaleId;
|
||||
LUID InteractiveUserLuid;
|
||||
CHAR InteractiveUserSid[68]; // SECURITY_MAX_SID_SIZE to make ROS happy
|
||||
ULONG ulCacheUpdateCount;
|
||||
} NLS_USER_INFO, *PNLS_USER_INFO;
|
||||
|
||||
|
||||
typedef struct _BASE_STATIC_SERVER_DATA
|
||||
{
|
||||
UNICODE_STRING WindowsDirectory;
|
||||
UNICODE_STRING WindowsSystemDirectory;
|
||||
UNICODE_STRING NamedObjectDirectory;
|
||||
USHORT WindowsMajorVersion;
|
||||
USHORT WindowsMinorVersion;
|
||||
USHORT BuildNumber;
|
||||
USHORT CSDNumber;
|
||||
USHORT RCNumber;
|
||||
WCHAR CSDVersion[128];
|
||||
SYSTEM_BASIC_INFORMATION SysInfo;
|
||||
SYSTEM_TIMEOFDAY_INFORMATION TimeOfDay;
|
||||
PVOID IniFileMapping;
|
||||
NLS_USER_INFO NlsUserInfo;
|
||||
BOOLEAN DefaultSeparateVDM;
|
||||
BOOLEAN IsWowTaskReady;
|
||||
UNICODE_STRING WindowsSys32x86Directory;
|
||||
BOOLEAN fTermsrvAppInstallMode;
|
||||
TIME_ZONE_INFORMATION tziTermsrvClientTimeZone;
|
||||
KSYSTEM_TIME ktTermsrvClientBias;
|
||||
ULONG TermsrvClientTimeZoneId;
|
||||
BOOLEAN LUIDDeviceMapsEnabled;
|
||||
ULONG TermsrvClientTimeZoneChangeNum;
|
||||
} BASE_STATIC_SERVER_DATA, *PBASE_STATIC_SERVER_DATA;
|
||||
|
||||
#endif // __BASE_H__
|
||||
|
||||
/* EOF */
|
||||
|
|
200
include/reactos/subsys/win/basemsg.h
Normal file
200
include/reactos/subsys/win/basemsg.h
Normal file
|
@ -0,0 +1,200 @@
|
|||
|
||||
#ifndef __BASEMSG_H__
|
||||
#define __BASEMSG_H__
|
||||
|
||||
#pragma once
|
||||
|
||||
#define BASESRV_SERVERDLL_INDEX 1
|
||||
#define BASESRV_FIRST_API_NUMBER 0
|
||||
|
||||
// Windows NT 4 table, 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.
|
||||
typedef enum _BASESRV_API_NUMBER
|
||||
{
|
||||
BasepCreateProcess = BASESRV_FIRST_API_NUMBER,
|
||||
BasepCreateThread,
|
||||
BasepGetTempFile,
|
||||
BasepExitProcess,
|
||||
// BasepDebugProcess,
|
||||
// BasepCheckVDM,
|
||||
// BasepUpdateVDMEntry,
|
||||
// BasepGetNextVDMCommand,
|
||||
// BasepExitVDM,
|
||||
// BasepIsFirstVDM,
|
||||
// BasepGetVDMExitCode,
|
||||
// BasepSetReenterCount,
|
||||
BasepSetProcessShutdownParam,
|
||||
BasepGetProcessShutdownParam,
|
||||
// BasepNlsSetUserInfo,
|
||||
// BasepNlsSetMultipleUserInfo,
|
||||
// BasepNlsCreateSortSection,
|
||||
// BasepNlsPreserveSection,
|
||||
// BasepSetVDMCurDirs,
|
||||
// BasepGetVDMCurDirs,
|
||||
// BasepBatNotification,
|
||||
// BasepRegisterWowExec,
|
||||
BasepSoundSentryNotification,
|
||||
// BasepRefreshIniFileMapping,
|
||||
BasepDefineDosDevice,
|
||||
|
||||
BasepMaxApiNumber
|
||||
} BASESRV_API_NUMBER, *PBASESRV_API_NUMBER;
|
||||
|
||||
typedef struct _BASE_SXS_CREATEPROCESS_MSG
|
||||
{
|
||||
ULONG Flags;
|
||||
ULONG ProcessParameterFlags;
|
||||
HANDLE FileHandle;
|
||||
UNICODE_STRING SxsWin32ExePath;
|
||||
UNICODE_STRING SxsNtExePath;
|
||||
SIZE_T OverrideManifestOffset;
|
||||
ULONG OverrideManifestSize;
|
||||
SIZE_T OverridePolicyOffset;
|
||||
ULONG OverridePolicySize;
|
||||
PVOID PEManifestAddress;
|
||||
ULONG PEManifestSize;
|
||||
UNICODE_STRING CultureFallbacks;
|
||||
ULONG Unknown[7];
|
||||
UNICODE_STRING AssemblyName;
|
||||
} BASE_SXS_CREATEPROCESS_MSG, *PBASE_SXS_CREATEPROCESS_MSG;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
//
|
||||
// NT-type structure (BASE_CREATEPROCESS_MSG)
|
||||
//
|
||||
HANDLE ProcessHandle;
|
||||
HANDLE ThreadHandle;
|
||||
CLIENT_ID ClientId;
|
||||
ULONG CreationFlags;
|
||||
ULONG VdmBinaryType;
|
||||
ULONG VdmTask;
|
||||
HANDLE hVDM;
|
||||
BASE_SXS_CREATEPROCESS_MSG Sxs;
|
||||
PVOID PebAddressNative;
|
||||
ULONG PebAddressWow64;
|
||||
USHORT ProcessorArchitecture;
|
||||
|
||||
//
|
||||
// ReactOS Data
|
||||
//
|
||||
BOOL bInheritHandles;
|
||||
} BASE_CREATE_PROCESS, *PBASE_CREATE_PROCESS;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CLIENT_ID ClientId;
|
||||
HANDLE ThreadHandle;
|
||||
} BASE_CREATE_THREAD, *PBASE_CREATE_THREAD;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT uExitCode;
|
||||
} BASE_EXIT_PROCESS, *PBASE_EXIT_PROCESS;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT UniqueID;
|
||||
} BASE_GET_TEMP_FILE, *PBASE_GET_TEMP_FILE;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ULONG iTask;
|
||||
HANDLE ConsoleHandle;
|
||||
ULONG BinaryType;
|
||||
HANDLE WaitObjectForParent;
|
||||
HANDLE StdIn;
|
||||
HANDLE StdOut;
|
||||
HANDLE StdErr;
|
||||
ULONG CodePage;
|
||||
ULONG dwCreationFlags;
|
||||
PCHAR CmdLine;
|
||||
PCHAR appName;
|
||||
PCHAR PifFile;
|
||||
PCHAR CurDirectory;
|
||||
PCHAR Env;
|
||||
ULONG EnvLen;
|
||||
PVOID StartupInfo;
|
||||
PCHAR Desktop;
|
||||
ULONG DesktopLen;
|
||||
PCHAR Title;
|
||||
ULONG TitleLen;
|
||||
PCHAR Reserved;
|
||||
ULONG ReservedLen;
|
||||
USHORT CmdLen;
|
||||
USHORT AppLen;
|
||||
USHORT PifLen;
|
||||
USHORT CurDirectoryLen;
|
||||
USHORT CurDrive;
|
||||
USHORT VDMState;
|
||||
} BASE_CHECK_VDM, *PBASE_CHECK_VDM;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ULONG iTask;
|
||||
ULONG BinaryType;
|
||||
HANDLE ConsoleHandle;
|
||||
HANDLE VDMProcessHandle;
|
||||
HANDLE WaitObjectForParent;
|
||||
USHORT EntryIndex;
|
||||
USHORT VDMCreationState;
|
||||
} BASE_UPDATE_VDM_ENTRY, *PBASE_UPDATE_VDM_ENTRY;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
HANDLE ConsoleHandle;
|
||||
HANDLE hParent;
|
||||
ULONG ExitCode;
|
||||
} BASE_GET_VDM_EXIT_CODE, *PBASE_GET_VDM_EXIT_CODE;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
DWORD Level;
|
||||
DWORD Flags;
|
||||
} BASE_SET_PROCESS_SHUTDOWN_PARAMS, *PBASE_SET_PROCESS_SHUTDOWN_PARAMS;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
DWORD Level;
|
||||
DWORD Flags;
|
||||
} BASE_GET_PROCESS_SHUTDOWN_PARAMS, *PBASE_GET_PROCESS_SHUTDOWN_PARAMS;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ULONG VideoMode;
|
||||
} BASE_SOUND_SENTRY, *PBASE_SOUND_SENTRY;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UNICODE_STRING DeviceName;
|
||||
UNICODE_STRING TargetName;
|
||||
DWORD dwFlags;
|
||||
} BASE_DEFINE_DOS_DEVICE, *PBASE_DEFINE_DOS_DEVICE;
|
||||
|
||||
typedef struct _BASE_API_MESSAGE
|
||||
{
|
||||
PORT_MESSAGE Header;
|
||||
|
||||
PCSR_CAPTURE_BUFFER CsrCaptureData;
|
||||
CSR_API_NUMBER ApiNumber;
|
||||
ULONG Status;
|
||||
ULONG Reserved;
|
||||
union
|
||||
{
|
||||
BASE_CREATE_PROCESS CreateProcessRequest;
|
||||
BASE_CREATE_THREAD CreateThreadRequest;
|
||||
BASE_EXIT_PROCESS ExitProcessRequest; // CSRSS_TERMINATE_PROCESS TerminateProcessRequest;
|
||||
BASE_GET_TEMP_FILE GetTempFile;
|
||||
BASE_CHECK_VDM CheckVdm;
|
||||
BASE_UPDATE_VDM_ENTRY UpdateVdmEntry;
|
||||
BASE_GET_VDM_EXIT_CODE GetVdmExitCode;
|
||||
BASE_SET_PROCESS_SHUTDOWN_PARAMS SetShutdownParametersRequest; // CSRSS_SET_SHUTDOWN_PARAMETERS
|
||||
BASE_GET_PROCESS_SHUTDOWN_PARAMS GetShutdownParametersRequest; // CSRSS_GET_SHUTDOWN_PARAMETERS
|
||||
BASE_SOUND_SENTRY SoundSentryRequest;
|
||||
BASE_DEFINE_DOS_DEVICE DefineDosDeviceRequest;
|
||||
} Data;
|
||||
} BASE_API_MESSAGE, *PBASE_API_MESSAGE;
|
||||
|
||||
#endif // __BASEMSG_H__
|
||||
|
||||
/* EOF */
|
|
@ -1,6 +1,5 @@
|
|||
|
||||
include_directories(${REACTOS_SOURCE_DIR}/subsystems/win32/csrss/include
|
||||
${REACTOS_SOURCE_DIR}/include/reactos/subsys)
|
||||
include_directories(${REACTOS_SOURCE_DIR}/include/reactos/subsys)
|
||||
|
||||
spec2def(basesrv.dll basesrv.spec)
|
||||
|
||||
|
@ -14,7 +13,7 @@ add_library(basesrv SHARED ${SOURCE})
|
|||
|
||||
target_link_libraries(basesrv ${PSEH_LIB})
|
||||
|
||||
set_module_type(basesrv win32dll)
|
||||
set_module_type(basesrv nativedll) # win32dll
|
||||
|
||||
add_importlibs(basesrv ntdll csrsrv)
|
||||
|
||||
|
|
|
@ -1,289 +1,38 @@
|
|||
/*** Private header for BASESRV ***/
|
||||
|
||||
#ifndef __BASESRV_H__
|
||||
#define __BASESRV_H__
|
||||
|
||||
#pragma once
|
||||
|
||||
/* PSDK/NDK Headers */
|
||||
#include <stdio.h>
|
||||
#define WIN32_NO_STATUS
|
||||
#include <windows.h>
|
||||
|
||||
#define NTOS_MODE_USER
|
||||
#include <ndk/ntndk.h>
|
||||
|
||||
/* CSRSS Header */
|
||||
#include <csrss/server.h>
|
||||
|
||||
#include <csr/csrsrv.h>
|
||||
|
||||
/* BASE Headers */
|
||||
#include <win/basemsg.h>
|
||||
#include <win/base.h>
|
||||
|
||||
|
||||
extern HANDLE BaseSrvHeap;
|
||||
extern HANDLE BaseSrvSharedHeap;
|
||||
extern PBASE_STATIC_SERVER_DATA BaseStaticServerData;
|
||||
|
||||
#define BASESRV_SERVERDLL_INDEX 1
|
||||
#define BASESRV_FIRST_API_NUMBER 0
|
||||
VOID BaseCleanupDefineDosDevice(VOID);
|
||||
|
||||
CSR_API(BaseSrvCreateProcess);
|
||||
CSR_API(BaseSrvCreateThread);
|
||||
CSR_API(BaseSrvGetTempFile);
|
||||
CSR_API(BaseSrvExitProcess);
|
||||
CSR_API(BaseSrvGetProcessShutdownParam);
|
||||
CSR_API(BaseSrvSetProcessShutdownParam);
|
||||
CSR_API(BaseSrvSoundSentryNotification);
|
||||
CSR_API(BaseSrvDefineDosDevice);
|
||||
|
||||
// Windows NT 4 table, 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.
|
||||
typedef enum _BASESRV_API_NUMBER
|
||||
{
|
||||
BasepCreateProcess = BASESRV_FIRST_API_NUMBER,
|
||||
BasepCreateThread,
|
||||
BasepGetTempFile,
|
||||
BasepExitProcess,
|
||||
// BasepDebugProcess,
|
||||
BasepCheckVDM,
|
||||
BasepUpdateVDMEntry,
|
||||
// BasepGetNextVDMCommand,
|
||||
// BasepExitVDM,
|
||||
// BasepIsFirstVDM,
|
||||
BasepGetVDMExitCode,
|
||||
// BasepSetReenterCount,
|
||||
BasepSetProcessShutdownParam,
|
||||
BasepGetProcessShutdownParam,
|
||||
// BasepNlsSetUserInfo,
|
||||
// BasepNlsSetMultipleUserInfo,
|
||||
// BasepNlsCreateSortSection,
|
||||
// BasepNlsPreserveSection,
|
||||
// BasepSetVDMCurDirs,
|
||||
// BasepGetVDMCurDirs,
|
||||
// BasepBatNotification,
|
||||
// BasepRegisterWowExec,
|
||||
BasepSoundSentryNotification,
|
||||
// BasepRefreshIniFileMapping,
|
||||
BasepDefineDosDevice,
|
||||
|
||||
BasepMaxApiNumber
|
||||
} BASESRV_API_NUMBER, *PBASESRV_API_NUMBER;
|
||||
|
||||
|
||||
typedef struct _BASE_SXS_CREATEPROCESS_MSG
|
||||
{
|
||||
ULONG Flags;
|
||||
ULONG ProcessParameterFlags;
|
||||
HANDLE FileHandle;
|
||||
UNICODE_STRING SxsWin32ExePath;
|
||||
UNICODE_STRING SxsNtExePath;
|
||||
SIZE_T OverrideManifestOffset;
|
||||
ULONG OverrideManifestSize;
|
||||
SIZE_T OverridePolicyOffset;
|
||||
ULONG OverridePolicySize;
|
||||
PVOID PEManifestAddress;
|
||||
ULONG PEManifestSize;
|
||||
UNICODE_STRING CultureFallbacks;
|
||||
ULONG Unknown[7];
|
||||
UNICODE_STRING AssemblyName;
|
||||
} BASE_SXS_CREATEPROCESS_MSG, *PBASE_SXS_CREATEPROCESS_MSG;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
//
|
||||
// NT-type structure (BASE_CREATEPROCESS_MSG)
|
||||
//
|
||||
HANDLE ProcessHandle;
|
||||
HANDLE ThreadHandle;
|
||||
CLIENT_ID ClientId;
|
||||
ULONG CreationFlags;
|
||||
ULONG VdmBinaryType;
|
||||
ULONG VdmTask;
|
||||
HANDLE hVDM;
|
||||
BASE_SXS_CREATEPROCESS_MSG Sxs;
|
||||
PVOID PebAddressNative;
|
||||
ULONG PebAddressWow64;
|
||||
USHORT ProcessorArchitecture;
|
||||
|
||||
//
|
||||
// ReactOS Data
|
||||
//
|
||||
BOOL bInheritHandles;
|
||||
} BASE_CREATE_PROCESS, *PBASE_CREATE_PROCESS;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CLIENT_ID ClientId;
|
||||
HANDLE ThreadHandle;
|
||||
} BASE_CREATE_THREAD, *PBASE_CREATE_THREAD;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT uExitCode;
|
||||
} BASE_EXIT_PROCESS, *PBASE_EXIT_PROCESS;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT UniqueID;
|
||||
} BASE_GET_TEMP_FILE, *PBASE_GET_TEMP_FILE;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ULONG iTask;
|
||||
HANDLE ConsoleHandle;
|
||||
ULONG BinaryType;
|
||||
HANDLE WaitObjectForParent;
|
||||
HANDLE StdIn;
|
||||
HANDLE StdOut;
|
||||
HANDLE StdErr;
|
||||
ULONG CodePage;
|
||||
ULONG dwCreationFlags;
|
||||
PCHAR CmdLine;
|
||||
PCHAR appName;
|
||||
PCHAR PifFile;
|
||||
PCHAR CurDirectory;
|
||||
PCHAR Env;
|
||||
ULONG EnvLen;
|
||||
PVOID StartupInfo;
|
||||
PCHAR Desktop;
|
||||
ULONG DesktopLen;
|
||||
PCHAR Title;
|
||||
ULONG TitleLen;
|
||||
PCHAR Reserved;
|
||||
ULONG ReservedLen;
|
||||
USHORT CmdLen;
|
||||
USHORT AppLen;
|
||||
USHORT PifLen;
|
||||
USHORT CurDirectoryLen;
|
||||
USHORT CurDrive;
|
||||
USHORT VDMState;
|
||||
} BASE_CHECK_VDM, *PBASE_CHECK_VDM;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ULONG iTask;
|
||||
ULONG BinaryType;
|
||||
HANDLE ConsoleHandle;
|
||||
HANDLE VDMProcessHandle;
|
||||
HANDLE WaitObjectForParent;
|
||||
USHORT EntryIndex;
|
||||
USHORT VDMCreationState;
|
||||
} BASE_UPDATE_VDM_ENTRY, *PBASE_UPDATE_VDM_ENTRY;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
HANDLE ConsoleHandle;
|
||||
HANDLE hParent;
|
||||
ULONG ExitCode;
|
||||
} BASE_GET_VDM_EXIT_CODE, *PBASE_GET_VDM_EXIT_CODE;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
DWORD Level;
|
||||
DWORD Flags;
|
||||
} BASE_SET_PROCESS_SHUTDOWN_PARAMS, *PBASE_SET_PROCESS_SHUTDOWN_PARAMS;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
DWORD Level;
|
||||
DWORD Flags;
|
||||
} BASE_GET_PROCESS_SHUTDOWN_PARAMS, *PBASE_GET_PROCESS_SHUTDOWN_PARAMS;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ULONG VideoMode;
|
||||
} BASE_SOUND_SENTRY, *PBASE_SOUND_SENTRY;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UNICODE_STRING DeviceName;
|
||||
UNICODE_STRING TargetName;
|
||||
DWORD dwFlags;
|
||||
} BASE_DEFINE_DOS_DEVICE, *PBASE_DEFINE_DOS_DEVICE;
|
||||
|
||||
|
||||
typedef struct _BASE_API_MESSAGE
|
||||
{
|
||||
PORT_MESSAGE Header;
|
||||
|
||||
PCSR_CAPTURE_BUFFER CsrCaptureData;
|
||||
CSR_API_NUMBER ApiNumber;
|
||||
ULONG Status;
|
||||
ULONG Reserved;
|
||||
union
|
||||
{
|
||||
BASE_CREATE_PROCESS CreateProcessRequest;
|
||||
BASE_CREATE_THREAD CreateThreadRequest;
|
||||
BASE_EXIT_PROCESS ExitProcessRequest; // CSRSS_TERMINATE_PROCESS TerminateProcessRequest;
|
||||
BASE_GET_TEMP_FILE GetTempFile;
|
||||
BASE_CHECK_VDM CheckVdm;
|
||||
BASE_UPDATE_VDM_ENTRY UpdateVdmEntry;
|
||||
BASE_GET_VDM_EXIT_CODE GetVdmExitCode;
|
||||
BASE_SET_PROCESS_SHUTDOWN_PARAMS SetShutdownParametersRequest; // CSRSS_SET_SHUTDOWN_PARAMETERS
|
||||
BASE_GET_PROCESS_SHUTDOWN_PARAMS GetShutdownParametersRequest; // CSRSS_GET_SHUTDOWN_PARAMETERS
|
||||
BASE_SOUND_SENTRY SoundSentryRequest;
|
||||
BASE_DEFINE_DOS_DEVICE DefineDosDeviceRequest;
|
||||
} Data;
|
||||
} BASE_API_MESSAGE, *PBASE_API_MESSAGE;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct _NLS_USER_INFO
|
||||
{
|
||||
WCHAR iCountry[80];
|
||||
WCHAR sCountry[80];
|
||||
WCHAR sList[80];
|
||||
WCHAR iMeasure[80];
|
||||
WCHAR iPaperSize[80];
|
||||
WCHAR sDecimal[80];
|
||||
WCHAR sThousand[80];
|
||||
WCHAR sGrouping[80];
|
||||
WCHAR iDigits[80];
|
||||
WCHAR iLZero[80];
|
||||
WCHAR iNegNumber[80];
|
||||
WCHAR sNativeDigits[80];
|
||||
WCHAR iDigitSubstitution[80];
|
||||
WCHAR sCurrency[80];
|
||||
WCHAR sMonDecSep[80];
|
||||
WCHAR sMonThouSep[80];
|
||||
WCHAR sMonGrouping[80];
|
||||
WCHAR iCurrDigits[80];
|
||||
WCHAR iCurrency[80];
|
||||
WCHAR iNegCurr[80];
|
||||
WCHAR sPosSign[80];
|
||||
WCHAR sNegSign[80];
|
||||
WCHAR sTimeFormat[80];
|
||||
WCHAR s1159[80];
|
||||
WCHAR s2359[80];
|
||||
WCHAR sShortDate[80];
|
||||
WCHAR sYearMonth[80];
|
||||
WCHAR sLongDate[80];
|
||||
WCHAR iCalType[80];
|
||||
WCHAR iFirstDay[80];
|
||||
WCHAR iFirstWeek[80];
|
||||
WCHAR sLocale[80];
|
||||
WCHAR sLocaleName[85];
|
||||
LCID UserLocaleId;
|
||||
LUID InteractiveUserLuid;
|
||||
CHAR InteractiveUserSid[68]; // SECURITY_MAX_SID_SIZE to make ROS happy
|
||||
ULONG ulCacheUpdateCount;
|
||||
} NLS_USER_INFO, *PNLS_USER_INFO;
|
||||
|
||||
|
||||
typedef struct _BASE_STATIC_SERVER_DATA
|
||||
{
|
||||
UNICODE_STRING WindowsDirectory;
|
||||
UNICODE_STRING WindowsSystemDirectory;
|
||||
UNICODE_STRING NamedObjectDirectory;
|
||||
USHORT WindowsMajorVersion;
|
||||
USHORT WindowsMinorVersion;
|
||||
USHORT BuildNumber;
|
||||
USHORT CSDNumber;
|
||||
USHORT RCNumber;
|
||||
WCHAR CSDVersion[128];
|
||||
SYSTEM_BASIC_INFORMATION SysInfo;
|
||||
SYSTEM_TIMEOFDAY_INFORMATION TimeOfDay;
|
||||
PVOID IniFileMapping;
|
||||
NLS_USER_INFO NlsUserInfo;
|
||||
BOOLEAN DefaultSeparateVDM;
|
||||
BOOLEAN IsWowTaskReady;
|
||||
UNICODE_STRING WindowsSys32x86Directory;
|
||||
BOOLEAN fTermsrvAppInstallMode;
|
||||
TIME_ZONE_INFORMATION tziTermsrvClientTimeZone;
|
||||
KSYSTEM_TIME ktTermsrvClientBias;
|
||||
ULONG TermsrvClientTimeZoneId;
|
||||
BOOLEAN LUIDDeviceMapsEnabled;
|
||||
ULONG TermsrvClientTimeZoneChangeNum;
|
||||
} BASE_STATIC_SERVER_DATA, *PBASE_STATIC_SERVER_DATA;
|
||||
|
||||
#endif // __BASESRV_H__
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -14,6 +14,11 @@
|
|||
HANDLE DllHandle = NULL;
|
||||
HANDLE BaseApiPort = NULL;
|
||||
|
||||
/* Memory */
|
||||
HANDLE BaseSrvHeap = 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.
|
||||
|
||||
extern LIST_ENTRY DosDeviceHistory;
|
||||
extern RTL_CRITICAL_SECTION BaseDefineDosDeviceCritSec;
|
||||
|
||||
|
@ -27,12 +32,12 @@ PCSR_API_ROUTINE BaseServerApiDispatchTable[BasepMaxApiNumber] =
|
|||
BaseSrvGetTempFile,
|
||||
BaseSrvExitProcess,
|
||||
// BaseSrvDebugProcess,
|
||||
BaseSrvCheckVDM,
|
||||
BaseSrvUpdateVDMEntry,
|
||||
// BaseSrvCheckVDM,
|
||||
// BaseSrvUpdateVDMEntry,
|
||||
// BaseSrvGetNextVDMCommand,
|
||||
// BaseSrvExitVDM,
|
||||
// BaseSrvIsFirstVDM,
|
||||
BaseSrvGetVDMExitCode,
|
||||
// BaseSrvGetVDMExitCode,
|
||||
// BaseSrvSetReenterCount,
|
||||
BaseSrvSetProcessShutdownParam,
|
||||
BaseSrvGetProcessShutdownParam,
|
||||
|
@ -56,12 +61,12 @@ BOOLEAN BaseServerApiServerValidTable[BasepMaxApiNumber] =
|
|||
TRUE, // SrvGetTempFile,
|
||||
FALSE, // SrvExitProcess,
|
||||
// FALSE, // SrvDebugProcess,
|
||||
TRUE, // SrvCheckVDM,
|
||||
TRUE, // SrvUpdateVDMEntry
|
||||
// TRUE, // SrvCheckVDM,
|
||||
// TRUE, // SrvUpdateVDMEntry
|
||||
// TRUE, // SrvGetNextVDMCommand
|
||||
// TRUE, // SrvExitVDM
|
||||
// TRUE, // SrvIsFirstVDM
|
||||
TRUE, // SrvGetVDMExitCode
|
||||
// TRUE, // SrvGetVDMExitCode
|
||||
// TRUE, // SrvSetReenterCount
|
||||
TRUE, // SrvSetProcessShutdownParam
|
||||
TRUE, // SrvGetProcessShutdownParam
|
||||
|
@ -86,12 +91,12 @@ PCHAR BaseServerApiNameTable[BasepMaxApiNumber] =
|
|||
"BaseGetTempFile",
|
||||
"BaseExitProcess",
|
||||
// "BaseDebugProcess",
|
||||
"BaseCheckVDM",
|
||||
"BaseUpdateVDMEntry",
|
||||
// "BaseCheckVDM",
|
||||
// "BaseUpdateVDMEntry",
|
||||
// "BaseGetNextVDMCommand",
|
||||
// "BaseExitVDM",
|
||||
// "BaseIsFirstVDM",
|
||||
"BaseGetVDMExitCode",
|
||||
// "BaseGetVDMExitCode",
|
||||
// "BaseSetReenterCount",
|
||||
"BaseSetProcessShutdownParam",
|
||||
"BaseGetProcessShutdownParam",
|
||||
|
@ -112,9 +117,126 @@ PCHAR BaseServerApiNameTable[BasepMaxApiNumber] =
|
|||
|
||||
/* FUNCTIONS ******************************************************************/
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
CreateBaseAcls(OUT PACL* Dacl,
|
||||
OUT PACL* RestrictedDacl)
|
||||
{
|
||||
PSID SystemSid, WorldSid, RestrictedSid;
|
||||
SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY};
|
||||
SID_IDENTIFIER_AUTHORITY WorldAuthority = {SECURITY_WORLD_SID_AUTHORITY};
|
||||
NTSTATUS Status;
|
||||
// UCHAR KeyValueBuffer[0x40];
|
||||
// PKEY_VALUE_PARTIAL_INFORMATION KeyValuePartialInfo;
|
||||
// UNICODE_STRING KeyName;
|
||||
// ULONG ProtectionMode = 0;
|
||||
ULONG AclLength; // , ResultLength;
|
||||
// HANDLE hKey;
|
||||
// OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
|
||||
/* Open the Session Manager Key */
|
||||
/*
|
||||
RtlInitUnicodeString(&KeyName, SM_REG_KEY);
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&KeyName,
|
||||
OBJ_CASE_INSENSITIVE,
|
||||
NULL,
|
||||
NULL);
|
||||
Status = NtOpenKey(&hKey, KEY_READ, &ObjectAttributes);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
/\* Read the key value *\/
|
||||
RtlInitUnicodeString(&KeyName, L"ProtectionMode");
|
||||
Status = NtQueryValueKey(hKey,
|
||||
&KeyName,
|
||||
KeyValuePartialInformation,
|
||||
KeyValueBuffer,
|
||||
sizeof(KeyValueBuffer),
|
||||
&ResultLength);
|
||||
|
||||
/\* Make sure it's what we expect it to be *\/
|
||||
KeyValuePartialInfo = (PKEY_VALUE_PARTIAL_INFORMATION)KeyValueBuffer;
|
||||
if ((NT_SUCCESS(Status)) && (KeyValuePartialInfo->Type == REG_DWORD) &&
|
||||
(*(PULONG)KeyValuePartialInfo->Data))
|
||||
{
|
||||
/\* Save the Protection Mode *\/
|
||||
// ProtectionMode = *(PULONG)KeyValuePartialInfo->Data;
|
||||
}
|
||||
|
||||
/\* Close the handle *\/
|
||||
NtClose(hKey);
|
||||
}
|
||||
*/
|
||||
|
||||
/* Allocate the System SID */
|
||||
Status = RtlAllocateAndInitializeSid(&NtAuthority,
|
||||
1, SECURITY_LOCAL_SYSTEM_RID,
|
||||
0, 0, 0, 0, 0, 0, 0,
|
||||
&SystemSid);
|
||||
ASSERT(NT_SUCCESS(Status));
|
||||
|
||||
/* Allocate the World SID */
|
||||
Status = RtlAllocateAndInitializeSid(&WorldAuthority,
|
||||
1, SECURITY_WORLD_RID,
|
||||
0, 0, 0, 0, 0, 0, 0,
|
||||
&WorldSid);
|
||||
ASSERT(NT_SUCCESS(Status));
|
||||
|
||||
/* Allocate the restricted SID */
|
||||
Status = RtlAllocateAndInitializeSid(&NtAuthority,
|
||||
1, SECURITY_RESTRICTED_CODE_RID,
|
||||
0, 0, 0, 0, 0, 0, 0,
|
||||
&RestrictedSid);
|
||||
ASSERT(NT_SUCCESS(Status));
|
||||
|
||||
/* Allocate one ACL with 3 ACEs each for one SID */
|
||||
AclLength = sizeof(ACL) + 3 * sizeof(ACCESS_ALLOWED_ACE) +
|
||||
RtlLengthSid(SystemSid) +
|
||||
RtlLengthSid(RestrictedSid) +
|
||||
RtlLengthSid(WorldSid);
|
||||
*Dacl = RtlAllocateHeap(BaseSrvHeap, 0, AclLength);
|
||||
ASSERT(*Dacl != NULL);
|
||||
|
||||
/* Set the correct header fields */
|
||||
Status = RtlCreateAcl(*Dacl, AclLength, ACL_REVISION2);
|
||||
ASSERT(NT_SUCCESS(Status));
|
||||
|
||||
/* Give the appropriate rights to each SID */
|
||||
/* FIXME: Should check SessionId/ProtectionMode */
|
||||
Status = RtlAddAccessAllowedAce(*Dacl, ACL_REVISION2, DIRECTORY_QUERY | DIRECTORY_TRAVERSE | DIRECTORY_CREATE_OBJECT | DIRECTORY_CREATE_SUBDIRECTORY | READ_CONTROL, WorldSid);
|
||||
ASSERT(NT_SUCCESS(Status));
|
||||
Status = RtlAddAccessAllowedAce(*Dacl, ACL_REVISION2, DIRECTORY_ALL_ACCESS, SystemSid);
|
||||
ASSERT(NT_SUCCESS(Status));
|
||||
Status = RtlAddAccessAllowedAce(*Dacl, ACL_REVISION2, DIRECTORY_TRAVERSE, RestrictedSid);
|
||||
ASSERT(NT_SUCCESS(Status));
|
||||
|
||||
/* Now allocate the restricted DACL */
|
||||
*RestrictedDacl = RtlAllocateHeap(BaseSrvHeap, 0, AclLength);
|
||||
ASSERT(*RestrictedDacl != NULL);
|
||||
|
||||
/* Initialize it */
|
||||
Status = RtlCreateAcl(*RestrictedDacl, AclLength, ACL_REVISION2);
|
||||
ASSERT(NT_SUCCESS(Status));
|
||||
|
||||
/* And add the same ACEs as before */
|
||||
/* FIXME: Not really fully correct */
|
||||
Status = RtlAddAccessAllowedAce(*RestrictedDacl, ACL_REVISION2, DIRECTORY_QUERY | DIRECTORY_TRAVERSE | DIRECTORY_CREATE_OBJECT | DIRECTORY_CREATE_SUBDIRECTORY | READ_CONTROL, WorldSid);
|
||||
ASSERT(NT_SUCCESS(Status));
|
||||
Status = RtlAddAccessAllowedAce(*RestrictedDacl, ACL_REVISION2, DIRECTORY_ALL_ACCESS, SystemSid);
|
||||
ASSERT(NT_SUCCESS(Status));
|
||||
Status = RtlAddAccessAllowedAce(*RestrictedDacl, ACL_REVISION2, DIRECTORY_TRAVERSE, RestrictedSid);
|
||||
ASSERT(NT_SUCCESS(Status));
|
||||
|
||||
/* The SIDs are captured, can free them now */
|
||||
RtlFreeHeap(BaseSrvHeap, 0, SystemSid);
|
||||
RtlFreeHeap(BaseSrvHeap, 0, WorldSid);
|
||||
RtlFreeHeap(BaseSrvHeap, 0, RestrictedSid);
|
||||
return Status;
|
||||
}
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
BasepFakeStaticServerData(VOID)
|
||||
BaseInitializeStaticServerData(IN PCSR_SERVER_DLL LoadedServerDll)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
WCHAR Buffer[MAX_PATH];
|
||||
|
@ -147,6 +269,10 @@ BasepFakeStaticServerData(VOID)
|
|||
{0}
|
||||
};
|
||||
|
||||
/* Initialize memory */
|
||||
BaseSrvHeap = RtlGetProcessHeap(); // Initialize our own heap.
|
||||
BaseSrvSharedHeap = LoadedServerDll->SharedSection; // Get the CSR shared heap.
|
||||
|
||||
/* Get the session ID */
|
||||
SessionId = NtCurrentPeb()->SessionId;
|
||||
|
||||
|
@ -175,7 +301,7 @@ BasepFakeStaticServerData(VOID)
|
|||
RtlInitUnicodeString(&BnoString, Buffer);
|
||||
|
||||
/* Allocate the server data */
|
||||
BaseStaticServerData = RtlAllocateHeap(CsrSrvSharedSectionHeap,
|
||||
BaseStaticServerData = RtlAllocateHeap(BaseSrvSharedHeap,
|
||||
HEAP_ZERO_MEMORY,
|
||||
sizeof(BASE_STATIC_SERVER_DATA));
|
||||
ASSERT(BaseStaticServerData != NULL);
|
||||
|
@ -191,7 +317,7 @@ BasepFakeStaticServerData(VOID)
|
|||
|
||||
/* Make a shared heap copy of the Windows directory */
|
||||
BaseStaticServerData->WindowsDirectory = BaseSrvWindowsDirectory;
|
||||
HeapBuffer = RtlAllocateHeap(CsrSrvSharedSectionHeap,
|
||||
HeapBuffer = RtlAllocateHeap(BaseSrvSharedHeap,
|
||||
0,
|
||||
BaseSrvWindowsDirectory.MaximumLength);
|
||||
ASSERT(HeapBuffer);
|
||||
|
@ -202,7 +328,7 @@ BasepFakeStaticServerData(VOID)
|
|||
|
||||
/* Make a shared heap copy of the System directory */
|
||||
BaseStaticServerData->WindowsSystemDirectory = BaseSrvWindowsSystemDirectory;
|
||||
HeapBuffer = RtlAllocateHeap(CsrSrvSharedSectionHeap,
|
||||
HeapBuffer = RtlAllocateHeap(BaseSrvSharedHeap,
|
||||
0,
|
||||
BaseSrvWindowsSystemDirectory.MaximumLength);
|
||||
ASSERT(HeapBuffer);
|
||||
|
@ -220,7 +346,7 @@ BasepFakeStaticServerData(VOID)
|
|||
BaseStaticServerData->NamedObjectDirectory = BnoString;
|
||||
BaseStaticServerData->NamedObjectDirectory.MaximumLength = BnoString.Length +
|
||||
sizeof(UNICODE_NULL);
|
||||
HeapBuffer = RtlAllocateHeap(CsrSrvSharedSectionHeap,
|
||||
HeapBuffer = RtlAllocateHeap(BaseSrvSharedHeap,
|
||||
0,
|
||||
BaseStaticServerData->NamedObjectDirectory.MaximumLength);
|
||||
ASSERT(HeapBuffer);
|
||||
|
@ -272,7 +398,7 @@ BasepFakeStaticServerData(VOID)
|
|||
BaseStaticServerData->IsWowTaskReady = FALSE;
|
||||
|
||||
/* Allocate a security descriptor and create it */
|
||||
BnoSd = RtlAllocateHeap(CsrHeap, 0, 1024);
|
||||
BnoSd = RtlAllocateHeap(BaseSrvHeap, 0, 1024);
|
||||
ASSERT(BnoSd);
|
||||
Status = RtlCreateSecurityDescriptor(BnoSd, SECURITY_DESCRIPTOR_REVISION);
|
||||
ASSERT(NT_SUCCESS(Status));
|
||||
|
@ -376,13 +502,14 @@ BasepFakeStaticServerData(VOID)
|
|||
}
|
||||
|
||||
/* Finally, set the pointer */
|
||||
CsrSrvSharedStaticServerData[CSR_CONSOLE] = BaseStaticServerData;
|
||||
// CsrSrvSharedStaticServerData[CSR_CONSOLE] = BaseStaticServerData;
|
||||
LoadedServerDll->SharedSection = BaseStaticServerData;
|
||||
}
|
||||
|
||||
|
||||
VOID WINAPI BaseStaticServerThread(PVOID x)
|
||||
{
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
// NTSTATUS Status = STATUS_SUCCESS;
|
||||
PPORT_MESSAGE Request = (PPORT_MESSAGE)x;
|
||||
PPORT_MESSAGE Reply = NULL;
|
||||
ULONG MessageType = 0;
|
||||
|
@ -396,7 +523,7 @@ VOID WINAPI BaseStaticServerThread(PVOID x)
|
|||
{
|
||||
default:
|
||||
Reply = Request;
|
||||
Status = NtReplyPort(BaseApiPort, Reply);
|
||||
/* Status =*/ NtReplyPort(BaseApiPort, Reply);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -427,8 +554,7 @@ CSR_SERVER_DLL_INIT(ServerDllInitialization)
|
|||
LoadedServerDll->SizeOfProcessData = 0;
|
||||
LoadedServerDll->ConnectCallback = NULL;
|
||||
LoadedServerDll->DisconnectCallback = NULL;
|
||||
|
||||
BasepFakeStaticServerData();
|
||||
BaseInitializeStaticServerData(LoadedServerDll);
|
||||
|
||||
RtlInitializeCriticalSection(&BaseDefineDosDeviceCritSec);
|
||||
InitializeListHead(&DosDeviceHistory);
|
||||
|
|
|
@ -12,15 +12,44 @@
|
|||
#include <debug.h>
|
||||
|
||||
|
||||
extern NTSTATUS CallProcessCreated(PCSR_PROCESS, PCSR_PROCESS); // TODO: Import it from csrsrv/init.c
|
||||
// extern NTSTATUS CallProcessCreated(PCSR_PROCESS, PCSR_PROCESS); // TODO: Import it from csrsrv/init.c
|
||||
// Remove it and correct csrsrv instead...
|
||||
#if 0
|
||||
NTSTATUS
|
||||
CallProcessCreated(IN PCSR_PROCESS SourceProcessData,
|
||||
IN PCSR_PROCESS TargetProcessData)
|
||||
{
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
ULONG i;
|
||||
PCSR_SERVER_DLL ServerDll;
|
||||
|
||||
DPRINT("CSR: %s called\n", __FUNCTION__);
|
||||
|
||||
/* Notify the Server DLLs */
|
||||
for (i = 0; i < CSR_SERVER_DLL_MAX; i++)
|
||||
{
|
||||
/* Get the current Server DLL */
|
||||
ServerDll = CsrLoadedServerDll[i];
|
||||
|
||||
/* Make sure it's valid and that it has callback */
|
||||
if ((ServerDll) && (ServerDll->NewProcessCallback))
|
||||
{
|
||||
Status = ServerDll->NewProcessCallback(SourceProcessData, TargetProcessData);
|
||||
}
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
#endif
|
||||
|
||||
CSR_API(BaseSrvCreateProcess)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
PBASE_CREATE_PROCESS CreateProcessRequest = &((PBASE_API_MESSAGE)ApiMessage)->Data.CreateProcessRequest;
|
||||
HANDLE ProcessHandle, ThreadHandle;
|
||||
PCSR_THREAD CsrThread;
|
||||
PCSR_PROCESS Process, NewProcess;
|
||||
ULONG Flags, VdmPower = 0, DebugFlags = 0;
|
||||
PCSR_PROCESS Process; // , NewProcess;
|
||||
ULONG /* Flags, */ VdmPower = 0, DebugFlags = 0;
|
||||
|
||||
/* Get the current client thread */
|
||||
CsrThread = CsrGetClientThread();
|
||||
|
@ -29,12 +58,12 @@ CSR_API(BaseSrvCreateProcess)
|
|||
Process = CsrThread->Process;
|
||||
|
||||
/* Extract the flags out of the process handle */
|
||||
Flags = (ULONG_PTR)ApiMessage->Data.CreateProcessRequest.ProcessHandle & 3;
|
||||
ApiMessage->Data.CreateProcessRequest.ProcessHandle = (HANDLE)((ULONG_PTR)ApiMessage->Data.CreateProcessRequest.ProcessHandle & ~3);
|
||||
// Flags = (ULONG_PTR)CreateProcessRequest->ProcessHandle & 3;
|
||||
CreateProcessRequest->ProcessHandle = (HANDLE)((ULONG_PTR)CreateProcessRequest->ProcessHandle & ~3);
|
||||
|
||||
/* Duplicate the process handle */
|
||||
Status = NtDuplicateObject(Process->ProcessHandle,
|
||||
ApiMessage->Data.CreateProcessRequest.ProcessHandle,
|
||||
CreateProcessRequest->ProcessHandle,
|
||||
NtCurrentProcess(),
|
||||
&ProcessHandle,
|
||||
0,
|
||||
|
@ -48,7 +77,7 @@ CSR_API(BaseSrvCreateProcess)
|
|||
|
||||
/* Duplicate the thread handle */
|
||||
Status = NtDuplicateObject(Process->ProcessHandle,
|
||||
ApiMessage->Data.CreateProcessRequest.ThreadHandle,
|
||||
CreateProcessRequest->ThreadHandle,
|
||||
NtCurrentProcess(),
|
||||
&ThreadHandle,
|
||||
0,
|
||||
|
@ -79,7 +108,7 @@ CSR_API(BaseSrvCreateProcess)
|
|||
}
|
||||
|
||||
/* Convert some flags. FIXME: More need conversion */
|
||||
if (ApiMessage->Data.CreateProcessRequest.CreationFlags & CREATE_NEW_PROCESS_GROUP)
|
||||
if (CreateProcessRequest->CreationFlags & CREATE_NEW_PROCESS_GROUP)
|
||||
{
|
||||
DebugFlags |= CsrProcessCreateNewGroup;
|
||||
}
|
||||
|
@ -89,7 +118,7 @@ CSR_API(BaseSrvCreateProcess)
|
|||
/* Call CSRSRV to create the CSR_PROCESS structure and the first CSR_THREAD */
|
||||
Status = CsrCreateProcess(ProcessHandle,
|
||||
ThreadHandle,
|
||||
&ApiMessage->Data.CreateProcessRequest.ClientId,
|
||||
&CreateProcessRequest->ClientId,
|
||||
Process->NtSession,
|
||||
DebugFlags,
|
||||
NULL);
|
||||
|
@ -111,16 +140,18 @@ CSR_API(BaseSrvCreateProcess)
|
|||
/* FIXME: VDM vodoo */
|
||||
|
||||
/* ReactOS Compatibility */
|
||||
Status = CsrLockProcessByClientId(ApiMessage->Data.CreateProcessRequest.ClientId.UniqueProcess, &NewProcess);
|
||||
#if 0
|
||||
Status = CsrLockProcessByClientId(CreateProcessRequest->ClientId.UniqueProcess, &NewProcess);
|
||||
ASSERT(Status == STATUS_SUCCESS);
|
||||
if (!(ApiMessage->Data.CreateProcessRequest.CreationFlags & (CREATE_NEW_CONSOLE | DETACHED_PROCESS)))
|
||||
if (!(CreateProcessRequest->CreationFlags & (CREATE_NEW_CONSOLE | DETACHED_PROCESS)))
|
||||
{
|
||||
NewProcess->ParentConsole = Process->Console;
|
||||
NewProcess->bInheritHandles = ApiMessage->Data.CreateProcessRequest.bInheritHandles;
|
||||
NewProcess->bInheritHandles = CreateProcessRequest->bInheritHandles;
|
||||
}
|
||||
RtlInitializeCriticalSection(&NewProcess->HandleTableLock);
|
||||
CallProcessCreated(Process, NewProcess);
|
||||
CsrUnlockProcess(NewProcess);
|
||||
#endif
|
||||
|
||||
/* Return the result of this operation */
|
||||
return Status;
|
||||
|
@ -128,9 +159,10 @@ CSR_API(BaseSrvCreateProcess)
|
|||
|
||||
CSR_API(BaseSrvCreateThread)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
PBASE_CREATE_THREAD CreateThreadRequest = &((PBASE_API_MESSAGE)ApiMessage)->Data.CreateThreadRequest;
|
||||
PCSR_THREAD CurrentThread;
|
||||
HANDLE ThreadHandle;
|
||||
NTSTATUS Status;
|
||||
PCSR_PROCESS CsrProcess;
|
||||
|
||||
/* Get the current CSR thread */
|
||||
|
@ -138,32 +170,32 @@ CSR_API(BaseSrvCreateThread)
|
|||
if (!CurrentThread)
|
||||
{
|
||||
DPRINT1("Server Thread TID: [%lx.%lx]\n",
|
||||
ApiMessage->Data.CreateThreadRequest.ClientId.UniqueProcess,
|
||||
ApiMessage->Data.CreateThreadRequest.ClientId.UniqueThread);
|
||||
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 !=
|
||||
ApiMessage->Data.CreateThreadRequest.ClientId.UniqueProcess)
|
||||
CreateThreadRequest->ClientId.UniqueProcess)
|
||||
{
|
||||
/* This is a remote thread request -- is it within the server itself? */
|
||||
if (ApiMessage->Data.CreateThreadRequest.ClientId.UniqueProcess == NtCurrentTeb()->ClientId.UniqueProcess)
|
||||
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(ApiMessage->Data.CreateThreadRequest.ClientId.UniqueProcess,
|
||||
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,
|
||||
ApiMessage->Data.CreateThreadRequest.ThreadHandle,
|
||||
CreateThreadRequest->ThreadHandle,
|
||||
NtCurrentProcess(),
|
||||
&ThreadHandle,
|
||||
0,
|
||||
|
@ -174,7 +206,7 @@ CSR_API(BaseSrvCreateThread)
|
|||
/* Call CSRSRV to tell it about the new thread */
|
||||
Status = CsrCreateThread(CsrProcess,
|
||||
ThreadHandle,
|
||||
&ApiMessage->Data.CreateThreadRequest.ClientId);
|
||||
&CreateThreadRequest->ClientId);
|
||||
}
|
||||
|
||||
/* Unlock the process and return */
|
||||
|
@ -185,11 +217,12 @@ CSR_API(BaseSrvCreateThread)
|
|||
CSR_API(BaseSrvGetTempFile)
|
||||
{
|
||||
static UINT CsrGetTempFileUnique = 0;
|
||||
PBASE_GET_TEMP_FILE GetTempFile = &((PBASE_API_MESSAGE)ApiMessage)->Data.GetTempFile;
|
||||
|
||||
/* Return 16-bits ID */
|
||||
ApiMessage->Data.GetTempFile.UniqueID = (++CsrGetTempFileUnique & 0xFFFF);
|
||||
GetTempFile->UniqueID = (++CsrGetTempFileUnique & 0xFFFF);
|
||||
|
||||
DPRINT("Returning: %u\n", ApiMessage->Data.GetTempFile.UniqueID);
|
||||
DPRINT("Returning: %u\n", GetTempFile->UniqueID);
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
@ -204,27 +237,29 @@ CSR_API(BaseSrvExitProcess)
|
|||
|
||||
/* Remove the CSR_THREADs and CSR_PROCESS */
|
||||
return CsrDestroyProcess(&CsrThread->ClientId,
|
||||
(NTSTATUS)ApiMessage->Data.TerminateProcessRequest.uExitCode);
|
||||
(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);
|
||||
|
||||
ApiMessage->Data.GetShutdownParametersRequest.Level = CsrThread->Process->ShutdownLevel;
|
||||
ApiMessage->Data.GetShutdownParametersRequest.Flags = CsrThread->Process->ShutdownFlags;
|
||||
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 = ApiMessage->Data.SetShutdownParametersRequest.Level;
|
||||
CsrThread->Process->ShutdownFlags = ApiMessage->Data.SetShutdownParametersRequest.Flags;
|
||||
CsrThread->Process->ShutdownLevel = SetShutdownParametersRequest->Level;
|
||||
CsrThread->Process->ShutdownFlags = SetShutdownParametersRequest->Flags;
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
@ -284,21 +319,56 @@ CSR_API(BaseSrvSoundSentryNotification)
|
|||
*** Dos Devices (C) Pierre Schweitzer (pierre.schweitzer@reactos.org)
|
||||
***/
|
||||
|
||||
typedef struct tagCSRSS_DOS_DEVICE_HISTORY_ENTRY
|
||||
typedef struct tagBASE_DOS_DEVICE_HISTORY_ENTRY
|
||||
{
|
||||
UNICODE_STRING Device;
|
||||
UNICODE_STRING Target;
|
||||
LIST_ENTRY Entry;
|
||||
} CSRSS_DOS_DEVICE_HISTORY_ENTRY, *PCSRSS_DOS_DEVICE_HISTORY_ENTRY;
|
||||
} BASE_DOS_DEVICE_HISTORY_ENTRY, *PBASE_DOS_DEVICE_HISTORY_ENTRY;
|
||||
|
||||
LIST_ENTRY DosDeviceHistory;
|
||||
RTL_CRITICAL_SECTION BaseDefineDosDeviceCritSec;
|
||||
|
||||
VOID BaseCleanupDefineDosDevice(VOID)
|
||||
{
|
||||
PLIST_ENTRY Entry, ListHead;
|
||||
PBASE_DOS_DEVICE_HISTORY_ENTRY HistoryEntry;
|
||||
|
||||
(void) RtlDeleteCriticalSection(&BaseDefineDosDeviceCritSec);
|
||||
|
||||
ListHead = &DosDeviceHistory;
|
||||
Entry = ListHead->Flink;
|
||||
while (Entry != ListHead)
|
||||
{
|
||||
HistoryEntry = (PBASE_DOS_DEVICE_HISTORY_ENTRY)
|
||||
CONTAINING_RECORD(Entry,
|
||||
BASE_DOS_DEVICE_HISTORY_ENTRY,
|
||||
Entry);
|
||||
Entry = Entry->Flink;
|
||||
|
||||
if (HistoryEntry)
|
||||
{
|
||||
if (HistoryEntry->Target.Buffer)
|
||||
(void) RtlFreeHeap(BaseSrvHeap,
|
||||
0,
|
||||
HistoryEntry->Target.Buffer);
|
||||
if (HistoryEntry->Device.Buffer)
|
||||
(void) RtlFreeHeap(BaseSrvHeap,
|
||||
0,
|
||||
HistoryEntry->Device.Buffer);
|
||||
(void) RtlFreeHeap(BaseSrvHeap,
|
||||
0,
|
||||
HistoryEntry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CSR_API(BaseSrvDefineDosDevice)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
PBASE_DEFINE_DOS_DEVICE DefineDosDeviceRequest = &((PBASE_API_MESSAGE)ApiMessage)->Data.DefineDosDeviceRequest;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
HANDLE LinkHandle = NULL;
|
||||
NTSTATUS Status;
|
||||
UNICODE_STRING DeviceName = {0};
|
||||
UNICODE_STRING RequestDeviceName = {0};
|
||||
UNICODE_STRING LinkTarget = {0};
|
||||
|
@ -312,7 +382,7 @@ CSR_API(BaseSrvDefineDosDevice)
|
|||
PSID SystemSid;
|
||||
PSID WorldSid;
|
||||
ULONG SidLength;
|
||||
PCSRSS_DOS_DEVICE_HISTORY_ENTRY HistoryEntry;
|
||||
PBASE_DOS_DEVICE_HISTORY_ENTRY HistoryEntry;
|
||||
PLIST_ENTRY Entry;
|
||||
PLIST_ENTRY ListHead;
|
||||
BOOLEAN Matched, AddHistory;
|
||||
|
@ -320,16 +390,16 @@ CSR_API(BaseSrvDefineDosDevice)
|
|||
PWSTR lpBuffer;
|
||||
|
||||
DPRINT("CsrDefineDosDevice entered, Flags:%d, DeviceName:%wZ, TargetName:%wZ\n",
|
||||
ApiMessage->Data.DefineDosDeviceRequest.dwFlags,
|
||||
&ApiMessage->Data.DefineDosDeviceRequest.DeviceName,
|
||||
&ApiMessage->Data.DefineDosDeviceRequest.TargetName);
|
||||
DefineDosDeviceRequest->dwFlags,
|
||||
&DefineDosDeviceRequest->DeviceName,
|
||||
&DefineDosDeviceRequest->TargetName);
|
||||
|
||||
Matched = AddHistory = FALSE;
|
||||
HistoryEntry = NULL;
|
||||
AdminSid = SystemSid = WorldSid = NULL;
|
||||
SecurityDescriptor = NULL;
|
||||
ListHead = &DosDeviceHistory;
|
||||
dwFlags = ApiMessage->Data.DefineDosDeviceRequest.dwFlags;
|
||||
dwFlags = DefineDosDeviceRequest->dwFlags;
|
||||
|
||||
/* Validate the flags */
|
||||
if ( (dwFlags & 0xFFFFFFF0) ||
|
||||
|
@ -351,14 +421,13 @@ CSR_API(BaseSrvDefineDosDevice)
|
|||
{
|
||||
Status =
|
||||
RtlUpcaseUnicodeString(&RequestDeviceName,
|
||||
&ApiMessage->Data.DefineDosDeviceRequest.DeviceName,
|
||||
&DefineDosDeviceRequest->DeviceName,
|
||||
TRUE);
|
||||
if (! NT_SUCCESS(Status))
|
||||
_SEH2_LEAVE;
|
||||
|
||||
RequestLinkTarget =
|
||||
&ApiMessage->Data.DefineDosDeviceRequest.TargetName;
|
||||
lpBuffer = (PWSTR) RtlAllocateHeap(Win32CsrApiHeap,
|
||||
RequestLinkTarget = &DefineDosDeviceRequest->TargetName;
|
||||
lpBuffer = (PWSTR) RtlAllocateHeap(BaseSrvHeap,
|
||||
HEAP_ZERO_MEMORY,
|
||||
RequestDeviceName.MaximumLength + 5 * sizeof(WCHAR));
|
||||
if (! lpBuffer)
|
||||
|
@ -392,7 +461,7 @@ CSR_API(BaseSrvDefineDosDevice)
|
|||
LinkTarget.Length = 0;
|
||||
LinkTarget.MaximumLength = Length;
|
||||
LinkTarget.Buffer = (PWSTR)
|
||||
RtlAllocateHeap(Win32CsrApiHeap,
|
||||
RtlAllocateHeap(BaseSrvHeap,
|
||||
HEAP_ZERO_MEMORY,
|
||||
Length);
|
||||
if (! LinkTarget.Buffer)
|
||||
|
@ -444,9 +513,9 @@ CSR_API(BaseSrvDefineDosDevice)
|
|||
Entry = ListHead->Flink;
|
||||
while (Entry != ListHead)
|
||||
{
|
||||
HistoryEntry = (PCSRSS_DOS_DEVICE_HISTORY_ENTRY)
|
||||
HistoryEntry = (PBASE_DOS_DEVICE_HISTORY_ENTRY)
|
||||
CONTAINING_RECORD(Entry,
|
||||
CSRSS_DOS_DEVICE_HISTORY_ENTRY,
|
||||
BASE_DOS_DEVICE_HISTORY_ENTRY,
|
||||
Entry);
|
||||
Matched =
|
||||
! RtlCompareUnicodeString(&RequestDeviceName,
|
||||
|
@ -473,9 +542,9 @@ CSR_API(BaseSrvDefineDosDevice)
|
|||
Entry = ListHead->Flink;
|
||||
while (Entry != ListHead)
|
||||
{
|
||||
HistoryEntry = (PCSRSS_DOS_DEVICE_HISTORY_ENTRY)
|
||||
HistoryEntry = (PBASE_DOS_DEVICE_HISTORY_ENTRY)
|
||||
CONTAINING_RECORD(Entry,
|
||||
CSRSS_DOS_DEVICE_HISTORY_ENTRY,
|
||||
BASE_DOS_DEVICE_HISTORY_ENTRY,
|
||||
Entry);
|
||||
Matched =
|
||||
! RtlCompareUnicodeString(&RequestDeviceName,
|
||||
|
@ -551,10 +620,10 @@ CSR_API(BaseSrvDefineDosDevice)
|
|||
|
||||
if (AddHistory)
|
||||
{
|
||||
HistoryEntry = (PCSRSS_DOS_DEVICE_HISTORY_ENTRY)
|
||||
RtlAllocateHeap(Win32CsrApiHeap,
|
||||
HistoryEntry = (PBASE_DOS_DEVICE_HISTORY_ENTRY)
|
||||
RtlAllocateHeap(BaseSrvHeap,
|
||||
HEAP_ZERO_MEMORY,
|
||||
sizeof(CSRSS_DOS_DEVICE_HISTORY_ENTRY));
|
||||
sizeof(BASE_DOS_DEVICE_HISTORY_ENTRY));
|
||||
if (! HistoryEntry)
|
||||
{
|
||||
DPRINT1("Failed to allocate memory\n");
|
||||
|
@ -563,7 +632,7 @@ CSR_API(BaseSrvDefineDosDevice)
|
|||
}
|
||||
|
||||
HistoryEntry->Target.Buffer =
|
||||
RtlAllocateHeap(Win32CsrApiHeap,
|
||||
RtlAllocateHeap(BaseSrvHeap,
|
||||
HEAP_ZERO_MEMORY,
|
||||
LinkTarget.Length);
|
||||
if (! HistoryEntry->Target.Buffer)
|
||||
|
@ -579,7 +648,7 @@ CSR_API(BaseSrvDefineDosDevice)
|
|||
&LinkTarget);
|
||||
|
||||
HistoryEntry->Device.Buffer =
|
||||
RtlAllocateHeap(Win32CsrApiHeap,
|
||||
RtlAllocateHeap(BaseSrvHeap,
|
||||
HEAP_ZERO_MEMORY,
|
||||
RequestDeviceName.Length);
|
||||
if (! HistoryEntry->Device.Buffer)
|
||||
|
@ -641,7 +710,7 @@ CSR_API(BaseSrvDefineDosDevice)
|
|||
RtlLengthSid(WorldSid);
|
||||
Length = sizeof(ACL) + SidLength + 3 * sizeof(ACCESS_ALLOWED_ACE);
|
||||
|
||||
SecurityDescriptor = RtlAllocateHeap(Win32CsrApiHeap,
|
||||
SecurityDescriptor = RtlAllocateHeap(BaseSrvHeap,
|
||||
0,
|
||||
SECURITY_DESCRIPTOR_MIN_LENGTH + Length);
|
||||
if (! SecurityDescriptor)
|
||||
|
@ -723,15 +792,15 @@ CSR_API(BaseSrvDefineDosDevice)
|
|||
{
|
||||
(void) RtlLeaveCriticalSection(&BaseDefineDosDeviceCritSec);
|
||||
if (DeviceName.Buffer)
|
||||
(void) RtlFreeHeap(Win32CsrApiHeap,
|
||||
(void) RtlFreeHeap(BaseSrvHeap,
|
||||
0,
|
||||
DeviceName.Buffer);
|
||||
if (LinkTarget.Buffer)
|
||||
(void) RtlFreeHeap(Win32CsrApiHeap,
|
||||
(void) RtlFreeHeap(BaseSrvHeap,
|
||||
0,
|
||||
LinkTarget.Buffer);
|
||||
if (SecurityDescriptor)
|
||||
(void) RtlFreeHeap(Win32CsrApiHeap,
|
||||
(void) RtlFreeHeap(BaseSrvHeap,
|
||||
0,
|
||||
SecurityDescriptor);
|
||||
if (LinkHandle)
|
||||
|
@ -746,14 +815,14 @@ CSR_API(BaseSrvDefineDosDevice)
|
|||
if (HistoryEntry)
|
||||
{
|
||||
if (HistoryEntry->Target.Buffer)
|
||||
(void) RtlFreeHeap(Win32CsrApiHeap,
|
||||
(void) RtlFreeHeap(BaseSrvHeap,
|
||||
0,
|
||||
HistoryEntry->Target.Buffer);
|
||||
if (HistoryEntry->Device.Buffer)
|
||||
(void) RtlFreeHeap(Win32CsrApiHeap,
|
||||
(void) RtlFreeHeap(BaseSrvHeap,
|
||||
0,
|
||||
HistoryEntry->Device.Buffer);
|
||||
(void) RtlFreeHeap(Win32CsrApiHeap,
|
||||
(void) RtlFreeHeap(BaseSrvHeap,
|
||||
0,
|
||||
HistoryEntry);
|
||||
}
|
||||
|
@ -764,40 +833,6 @@ CSR_API(BaseSrvDefineDosDevice)
|
|||
return Status;
|
||||
}
|
||||
|
||||
VOID BaseCleanupDefineDosDevice(VOID)
|
||||
{
|
||||
PLIST_ENTRY Entry, ListHead;
|
||||
PCSRSS_DOS_DEVICE_HISTORY_ENTRY HistoryEntry;
|
||||
|
||||
(void) RtlDeleteCriticalSection(&BaseDefineDosDeviceCritSec);
|
||||
|
||||
ListHead = &DosDeviceHistory;
|
||||
Entry = ListHead->Flink;
|
||||
while (Entry != ListHead)
|
||||
{
|
||||
HistoryEntry = (PCSRSS_DOS_DEVICE_HISTORY_ENTRY)
|
||||
CONTAINING_RECORD(Entry,
|
||||
CSRSS_DOS_DEVICE_HISTORY_ENTRY,
|
||||
Entry);
|
||||
Entry = Entry->Flink;
|
||||
|
||||
if (HistoryEntry)
|
||||
{
|
||||
if (HistoryEntry->Target.Buffer)
|
||||
(void) RtlFreeHeap(Win32CsrApiHeap,
|
||||
0,
|
||||
HistoryEntry->Target.Buffer);
|
||||
if (HistoryEntry->Device.Buffer)
|
||||
(void) RtlFreeHeap(Win32CsrApiHeap,
|
||||
0,
|
||||
HistoryEntry->Device.Buffer);
|
||||
(void) RtlFreeHeap(Win32CsrApiHeap,
|
||||
0,
|
||||
HistoryEntry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue