[KERNEL32]

Use some existing #define'd constants.

[CSRSRV-BASESRV]
- Add CSR version define (based from BASESRV version define).
- Add missing BASESRV structures, taken from https://code.google.com/p/ontl/source/browse/branches/devel/ntl/nt/csr.hxx (OpenNT Native Template Library).

svn path=/trunk/; revision=59779
This commit is contained in:
Hermès Bélusca-Maïto 2013-08-19 17:50:27 +00:00
parent 519595d9c4
commit 4203172aa0
10 changed files with 164 additions and 78 deletions

View file

@ -107,7 +107,7 @@ CsrpConnectToServer(IN PWSTR ObjectDirectory)
SecurityQos.EffectiveOnly = TRUE;
/* Setup the connection info */
ConnectionInfo.Version = 0x10000;
ConnectionInfo.Version = CSRSRV_VERSION;
/* Create a SID for us */
Status = RtlAllocateAndInitializeSid(&NtSidAuthority,

View file

@ -157,7 +157,7 @@ DefineDosDeviceW(
}
else
{
DefineDosDeviceRequest->dwFlags = dwFlags;
DefineDosDeviceRequest->Flags = dwFlags;
CsrCaptureMessageBuffer(CaptureBuffer,
(PVOID)DeviceUpcaseNameU.Buffer,
@ -174,11 +174,11 @@ DefineDosDeviceW(
CsrCaptureMessageBuffer(CaptureBuffer,
(PVOID)NtTargetPathU.Buffer,
NtTargetPathU.Length,
(PVOID*)&DefineDosDeviceRequest->TargetName.Buffer);
(PVOID*)&DefineDosDeviceRequest->TargetPath.Buffer);
}
DefineDosDeviceRequest->TargetName.Length =
DefineDosDeviceRequest->TargetPath.Length =
NtTargetPathU.Length;
DefineDosDeviceRequest->TargetName.MaximumLength =
DefineDosDeviceRequest->TargetPath.MaximumLength =
NtTargetPathU.Length;
Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,

View file

@ -92,7 +92,7 @@ GetTempFileNameW(IN LPCWSTR lpPathName,
CHAR IDString[5];
WCHAR * TempFileName;
BASE_API_MESSAGE ApiMessage;
PBASE_GET_TEMP_FILE GetTempFile = &ApiMessage.Data.GetTempFile;
PBASE_GET_TEMP_FILE GetTempFile = &ApiMessage.Data.GetTempFileRequest;
DWORD FileAttributes, LastError;
UNICODE_STRING PathNameString, PrefixString;
static const WCHAR Ext[] = { L'.', 't', 'm', 'p', UNICODE_NULL };

View file

@ -963,13 +963,13 @@ GetProcessShutdownParameters(OUT LPDWORD lpdwLevel,
{
NTSTATUS Status;
BASE_API_MESSAGE ApiMessage;
PBASE_GET_PROCESS_SHUTDOWN_PARAMS GetShutdownParametersRequest = &ApiMessage.Data.GetShutdownParametersRequest;
PBASE_GETSET_PROCESS_SHUTDOWN_PARAMS ShutdownParametersRequest = &ApiMessage.Data.ShutdownParametersRequest;
/* Ask CSRSS for shutdown information */
Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
NULL,
CSR_CREATE_API_NUMBER(BASESRV_SERVERDLL_INDEX, BasepGetProcessShutdownParam),
sizeof(BASE_GET_PROCESS_SHUTDOWN_PARAMS));
sizeof(BASE_GETSET_PROCESS_SHUTDOWN_PARAMS));
if (!NT_SUCCESS(Status))
{
/* Return the failure from CSRSS */
@ -978,8 +978,8 @@ GetProcessShutdownParameters(OUT LPDWORD lpdwLevel,
}
/* Get the data back */
*lpdwLevel = GetShutdownParametersRequest->Level;
*lpdwFlags = GetShutdownParametersRequest->Flags;
*lpdwLevel = ShutdownParametersRequest->ShutdownLevel;
*lpdwFlags = ShutdownParametersRequest->ShutdownFlags;
return TRUE;
}
@ -993,15 +993,15 @@ SetProcessShutdownParameters(IN DWORD dwLevel,
{
NTSTATUS Status;
BASE_API_MESSAGE ApiMessage;
PBASE_SET_PROCESS_SHUTDOWN_PARAMS SetShutdownParametersRequest = &ApiMessage.Data.SetShutdownParametersRequest;
PBASE_GETSET_PROCESS_SHUTDOWN_PARAMS ShutdownParametersRequest = &ApiMessage.Data.ShutdownParametersRequest;
/* Write the data into the CSRSS request and send it */
SetShutdownParametersRequest->Level = dwLevel;
SetShutdownParametersRequest->Flags = dwFlags;
ShutdownParametersRequest->ShutdownLevel = dwLevel;
ShutdownParametersRequest->ShutdownFlags = dwFlags;
Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
NULL,
CSR_CREATE_API_NUMBER(BASESRV_SERVERDLL_INDEX, BasepSetProcessShutdownParam),
sizeof(BASE_SET_PROCESS_SHUTDOWN_PARAMS));
sizeof(BASE_GETSET_PROCESS_SHUTDOWN_PARAMS));
if (!NT_SUCCESS(Status))
{
/* Return the failure from CSRSS */
@ -2426,7 +2426,7 @@ CreateProcessInternalW(IN HANDLE hUserToken,
/* Set message structures */
CreateProcessMsg = &CsrMsg.Data.CreateProcessRequest;
VdmMsg = &CsrMsg.Data.CheckVdm;
VdmMsg = &CsrMsg.Data.CheckVDMRequest;
/* Clear the more complex structures by zeroing out their entire memory */
RtlZeroMemory(&Context, sizeof(Context));

View file

@ -2,7 +2,7 @@
* PROJECT: ReactOS Win32 Base API
* LICENSE: GPL - See COPYING in the top level directory
* FILE: dll/win32/kernel32/client/vdm.c
* PURPOSE: Virtual Dos Machine (VDM) Support
* PURPOSE: Virtual DOS Machines (VDM) Support
* PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
*/
@ -49,17 +49,18 @@ BaseIsDosApplication(IN PUNICODE_STRING PathName,
/* Is it a .com? */
String.Length = BaseDotComSuffixName.Length;
String.Buffer = &PathName->Buffer[(PathName->Length - String.Length) / sizeof(WCHAR)];
if (RtlEqualUnicodeString(&String, &BaseDotComSuffixName, TRUE)) return 2;
if (RtlEqualUnicodeString(&String, &BaseDotComSuffixName, TRUE)) return BINARY_TYPE_COM;
/* Is it a .pif? */
String.Length = BaseDotPifSuffixName.Length;
String.Buffer = &PathName->Buffer[(PathName->Length - String.Length) / sizeof(WCHAR)];
if (RtlEqualUnicodeString(&String, &BaseDotPifSuffixName, TRUE)) return 3;
if (RtlEqualUnicodeString(&String, &BaseDotPifSuffixName, TRUE)) return BINARY_TYPE_PIF;
/* Is it an exe? */
String.Length = BaseDotExeSuffixName.Length;
String.Buffer = &PathName->Buffer[(PathName->Length - String.Length) / sizeof(WCHAR)];
if (RtlEqualUnicodeString(&String, &BaseDotExeSuffixName, TRUE)) return 1;
if (RtlEqualUnicodeString(&String, &BaseDotExeSuffixName, TRUE)) return BINARY_TYPE_EXE;
return 0;
}

View file

@ -32,13 +32,6 @@ typedef enum _CSRSRV_API_NUMBER
} CSRSRV_API_NUMBER, *PCSRSRV_API_NUMBER;
/*
typedef struct _CSR_API_NUMBER
{
WORD Index;
WORD Subsystem;
} CSR_API_NUMBER, *PCSR_API_NUMBER;
*/
typedef ULONG CSR_API_NUMBER;
#define CSR_CREATE_API_NUMBER(ServerId, ApiId) \
@ -64,6 +57,8 @@ typedef struct _CSR_CONNECTION_INFO
HANDLE ProcessId;
} CSR_CONNECTION_INFO, *PCSR_CONNECTION_INFO;
#define CSRSRV_VERSION 0x10000
// We must have a size at most equal to the maximum acceptable LPC data size.
C_ASSERT(sizeof(CSR_CONNECTION_INFO) <= LPC_MAX_DATA_LENGTH);

View file

@ -52,6 +52,21 @@ typedef enum _BASESRV_API_NUMBER
BasepMaxApiNumber
} BASESRV_API_NUMBER, *PBASESRV_API_NUMBER;
typedef struct
{
ULONG ExpectedVersion;
HANDLE DefaultObjectDirectory;
ULONG WindowsVersion;
ULONG CurrentVersion;
ULONG DebugFlags;
WCHAR WindowsDirectory[MAX_PATH];
WCHAR WindowsSystemDirectory[MAX_PATH];
} BASESRV_API_CONNECTINFO, *PBASESRV_API_CONNECTINFO;
#define BASESRV_VERSION 0x10000
typedef struct _BASE_SXS_CREATEPROCESS_MSG
{
ULONG Flags;
@ -94,11 +109,6 @@ typedef struct
HANDLE ThreadHandle;
} BASE_CREATE_THREAD, *PBASE_CREATE_THREAD;
typedef struct
{
UINT uExitCode;
} BASE_EXIT_PROCESS, *PBASE_EXIT_PROCESS;
typedef struct
{
UINT UniqueID;
@ -106,28 +116,33 @@ typedef struct
typedef struct
{
ULONG iTask;
UINT uExitCode;
} BASE_EXIT_PROCESS, *PBASE_EXIT_PROCESS;
typedef struct
{
ULONG iTask;
HANDLE ConsoleHandle;
ULONG BinaryType;
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;
ULONG CodePage;
ULONG dwCreationFlags;
PCHAR CmdLine;
PCHAR appName;
PCHAR PifFile;
PCHAR CurDirectory;
PCHAR Env;
ULONG EnvLen;
LPSTARTUPINFOA StartupInfo;
PCHAR Desktop;
ULONG DesktopLen;
PCHAR Title;
ULONG TitleLen;
PCHAR Reserved;
ULONG ReservedLen;
USHORT CmdLen;
USHORT AppLen;
USHORT PifLen;
@ -138,8 +153,8 @@ typedef struct
typedef struct
{
ULONG iTask;
ULONG BinaryType;
ULONG iTask;
ULONG BinaryType;
HANDLE ConsoleHandle;
HANDLE VDMProcessHandle;
HANDLE WaitObjectForParent;
@ -147,24 +162,87 @@ typedef struct
USHORT VDMCreationState;
} BASE_UPDATE_VDM_ENTRY, *PBASE_UPDATE_VDM_ENTRY;
typedef struct
{
ULONG iTask;
HANDLE ConsoleHandle;
HANDLE WaitObjectForVDM;
HANDLE StdIn;
HANDLE StdOut;
HANDLE StdErr;
ULONG CodePage;
ULONG dwCreationFlags;
ULONG ExitCode;
PCHAR CmdLine;
PCHAR AppName;
PCHAR PifFile;
PCHAR CurDirectory;
PCHAR Env;
ULONG EnvLen;
LPSTARTUPINFOA StartupInfo;
PCHAR Desktop;
ULONG DesktopLen;
PCHAR Title;
ULONG TitleLen;
PCHAR Reserved;
ULONG ReservedLen;
USHORT CurrentDrive;
USHORT CmdLen;
USHORT AppLen;
USHORT PifLen;
USHORT CurDirectoryLen;
USHORT VDMState;
ULONG fComingFromBat;
} BASE_GET_NEXT_VDM_COMMAND, *PBASE_GET_NEXT_VDM_COMMAND;
typedef struct
{
HANDLE ConsoleHandle;
ULONG iWowTask;
HANDLE WaitObjectForVDM;
} BASE_EXIT_VDM, *PBASE_EXIT_VDM;
typedef struct
{
ULONG FirstVDM;
} BASE_IS_FIRST_VDM, *PBASE_IS_FIRST_VDM;
typedef struct
{
HANDLE ConsoleHandle;
HANDLE hParent;
ULONG ExitCode;
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;
HANDLE ConsoleHandle;
ULONG fIncDec;
} BASE_SET_REENTER_COUNT, *PBASE_SET_REENTER_COUNT;
typedef struct
{
DWORD Level;
DWORD Flags;
} BASE_GET_PROCESS_SHUTDOWN_PARAMS, *PBASE_GET_PROCESS_SHUTDOWN_PARAMS;
ULONG ShutdownLevel;
ULONG ShutdownFlags;
} BASE_GETSET_PROCESS_SHUTDOWN_PARAMS, *PBASE_GETSET_PROCESS_SHUTDOWN_PARAMS;
typedef struct
{
HANDLE ConsoleHandle;
PCHAR lpszzCurDirs;
ULONG cchCurDirs;
} BASE_GETSET_VDM_CURDIRS, *PBASE_GETSET_VDM_CURDIRS;
typedef struct
{
HANDLE ConsoleHandle;
ULONG fBeginEnd;
} BASE_BAT_NOTIFICATION, *PBASE_BAT_NOTIFICATION;
typedef struct
{
HANDLE hwndWowExec;
} BASE_REGISTER_WOWEXEC, *PBASE_REGISTER_WOWEXEC;
typedef struct
{
@ -173,9 +251,14 @@ typedef struct
typedef struct
{
UNICODE_STRING IniFileName;
} BASE_REFRESH_INIFILE_MAPPING, *PBASE_REFRESH_INIFILE_MAPPING;
typedef struct
{
ULONG Flags;
UNICODE_STRING DeviceName;
UNICODE_STRING TargetName;
DWORD dwFlags;
UNICODE_STRING TargetPath;
} BASE_DEFINE_DOS_DEVICE, *PBASE_DEFINE_DOS_DEVICE;
typedef struct _BASE_API_MESSAGE
@ -190,14 +273,21 @@ typedef struct _BASE_API_MESSAGE
{
BASE_CREATE_PROCESS CreateProcessRequest;
BASE_CREATE_THREAD CreateThreadRequest;
BASE_GET_TEMP_FILE GetTempFileRequest;
BASE_EXIT_PROCESS ExitProcessRequest;
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;
BASE_GET_PROCESS_SHUTDOWN_PARAMS GetShutdownParametersRequest;
BASE_CHECK_VDM CheckVDMRequest;
BASE_UPDATE_VDM_ENTRY UpdateVDMEntryRequest;
BASE_GET_NEXT_VDM_COMMAND GetNextVDMCommandRequest;
BASE_EXIT_VDM ExitVDMRequest;
BASE_IS_FIRST_VDM IsFirstVDMRequest;
BASE_GET_VDM_EXIT_CODE GetVDMExitCodeRequest;
BASE_SET_REENTER_COUNT SetReenterCountRequest;
BASE_GETSET_PROCESS_SHUTDOWN_PARAMS ShutdownParametersRequest;
BASE_GETSET_VDM_CURDIRS VDMCurrentDirsRequest;
BASE_BAT_NOTIFICATION BatNotificationRequest;
BASE_REGISTER_WOWEXEC RegisterWowExecRequest;
BASE_SOUND_SENTRY SoundSentryRequest;
BASE_REFRESH_INIFILE_MAPPING RefreshIniFileMappingRequest;
BASE_DEFINE_DOS_DEVICE DefineDosDeviceRequest;
} Data;
} BASE_API_MESSAGE, *PBASE_API_MESSAGE;

View file

@ -99,17 +99,17 @@ CSR_API(BaseSrvDefineDosDevice)
DWORD dwFlags;
PWSTR lpBuffer;
DPRINT("BaseSrvDefineDosDevice entered, Flags:%d, DeviceName:%wZ, TargetName:%wZ\n",
DefineDosDeviceRequest->dwFlags,
DPRINT("BaseSrvDefineDosDevice entered, Flags:%d, DeviceName:%wZ, TargetPath:%wZ\n",
DefineDosDeviceRequest->Flags,
&DefineDosDeviceRequest->DeviceName,
&DefineDosDeviceRequest->TargetName);
&DefineDosDeviceRequest->TargetPath);
Matched = AddHistory = FALSE;
HistoryEntry = NULL;
AdminSid = SystemSid = WorldSid = NULL;
SecurityDescriptor = NULL;
ListHead = &DosDeviceHistory;
dwFlags = DefineDosDeviceRequest->dwFlags;
dwFlags = DefineDosDeviceRequest->Flags;
/* Validate the flags */
if ( (dwFlags & 0xFFFFFFF0) ||
@ -136,7 +136,7 @@ CSR_API(BaseSrvDefineDosDevice)
if (!NT_SUCCESS(Status))
_SEH2_LEAVE;
RequestLinkTarget = &DefineDosDeviceRequest->TargetName;
RequestLinkTarget = &DefineDosDeviceRequest->TargetPath;
lpBuffer = (PWSTR)RtlAllocateHeap(BaseSrvHeap,
HEAP_ZERO_MEMORY,
RequestDeviceName.MaximumLength + 5 * sizeof(WCHAR));

View file

@ -18,7 +18,7 @@
CSR_API(BaseSrvGetTempFile)
{
static UINT BaseGetTempFileUnique = 0;
PBASE_GET_TEMP_FILE GetTempFile = &((PBASE_API_MESSAGE)ApiMessage)->Data.GetTempFile;
PBASE_GET_TEMP_FILE GetTempFile = &((PBASE_API_MESSAGE)ApiMessage)->Data.GetTempFileRequest;
/* Return 16-bits ID */
GetTempFile->UniqueID = (++BaseGetTempFileUnique & 0xFFFF);
@ -211,24 +211,24 @@ CSR_API(BaseSrvExitProcess)
CSR_API(BaseSrvGetProcessShutdownParam)
{
PBASE_GET_PROCESS_SHUTDOWN_PARAMS GetShutdownParametersRequest = &((PBASE_API_MESSAGE)ApiMessage)->Data.GetShutdownParametersRequest;
PBASE_GETSET_PROCESS_SHUTDOWN_PARAMS ShutdownParametersRequest = &((PBASE_API_MESSAGE)ApiMessage)->Data.ShutdownParametersRequest;
PCSR_THREAD CsrThread = CsrGetClientThread();
ASSERT(CsrThread);
GetShutdownParametersRequest->Level = CsrThread->Process->ShutdownLevel;
GetShutdownParametersRequest->Flags = CsrThread->Process->ShutdownFlags;
ShutdownParametersRequest->ShutdownLevel = CsrThread->Process->ShutdownLevel;
ShutdownParametersRequest->ShutdownFlags = CsrThread->Process->ShutdownFlags;
return STATUS_SUCCESS;
}
CSR_API(BaseSrvSetProcessShutdownParam)
{
PBASE_SET_PROCESS_SHUTDOWN_PARAMS SetShutdownParametersRequest = &((PBASE_API_MESSAGE)ApiMessage)->Data.SetShutdownParametersRequest;
PBASE_GETSET_PROCESS_SHUTDOWN_PARAMS ShutdownParametersRequest = &((PBASE_API_MESSAGE)ApiMessage)->Data.ShutdownParametersRequest;
PCSR_THREAD CsrThread = CsrGetClientThread();
ASSERT(CsrThread);
CsrThread->Process->ShutdownLevel = SetShutdownParametersRequest->Level;
CsrThread->Process->ShutdownFlags = SetShutdownParametersRequest->Flags;
CsrThread->Process->ShutdownLevel = ShutdownParametersRequest->ShutdownLevel;
CsrThread->Process->ShutdownFlags = ShutdownParametersRequest->ShutdownFlags;
return STATUS_SUCCESS;
}

View file

@ -2,7 +2,7 @@
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Base API Server DLL
* FILE: subsystems/win/basesrv/vdm.c
* PURPOSE: Virtual DOS Machines Management
* PURPOSE: Virtual DOS Machines (VDM) Support
* PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca@sfr.fr)
*/