mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-02 12:23:31 +00:00
Fixed Nt/ZwCreatePagingFile() prototype.
svn path=/trunk/; revision=2736
This commit is contained in:
+13
-14
@@ -1,5 +1,5 @@
|
||||
|
||||
/* $Id: zw.h,v 1.49 2002/02/06 01:22:32 ekohl Exp $
|
||||
/* $Id: zw.h,v 1.50 2002/03/18 16:14:45 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
@@ -728,29 +728,28 @@ ZwCreateMutant(
|
||||
/*
|
||||
* FUNCTION: Creates a paging file.
|
||||
* ARGUMENTS:
|
||||
* PageFileName = Name of the pagefile
|
||||
* MinimumSize = Specifies the minimum size
|
||||
* MaximumSize = Specifies the maximum size
|
||||
* ActualSize(OUT) = Specifies the actual size
|
||||
* FileName = Name of the pagefile
|
||||
* InitialSize = Specifies the initial size in bytes
|
||||
* MaximumSize = Specifies the maximum size in bytes
|
||||
* Reserved = Reserved for future use
|
||||
* RETURNS: Status
|
||||
*/
|
||||
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NtCreatePagingFile(
|
||||
IN PUNICODE_STRING PageFileName,
|
||||
IN ULONG MiniumSize,
|
||||
IN ULONG MaxiumSize,
|
||||
OUT PULONG ActualSize
|
||||
IN PUNICODE_STRING FileName,
|
||||
IN PLARGE_INTEGER InitialSize,
|
||||
IN PLARGE_INTEGER MaxiumSize,
|
||||
IN ULONG Reserved
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
ZwCreatePagingFile(
|
||||
IN PUNICODE_STRING PageFileName,
|
||||
IN ULONG MiniumSize,
|
||||
IN ULONG MaxiumSize,
|
||||
OUT PULONG ActualSize
|
||||
IN PUNICODE_STRING FileName,
|
||||
IN PLARGE_INTEGER InitialSize,
|
||||
IN PLARGE_INTEGER MaxiumSize,
|
||||
IN ULONG Reserved
|
||||
);
|
||||
|
||||
/*
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: pagefile.c,v 1.17 2002/02/08 02:57:07 chorns Exp $
|
||||
/* $Id: pagefile.c,v 1.18 2002/03/18 16:15:08 ekohl Exp $
|
||||
*
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/mm/pagefile.c
|
||||
@@ -42,8 +42,8 @@ typedef struct _PAGINGFILE
|
||||
{
|
||||
LIST_ENTRY PagingFileListEntry;
|
||||
PFILE_OBJECT FileObject;
|
||||
ULONG MaximumSize;
|
||||
ULONG CurrentSize;
|
||||
LARGE_INTEGER MaximumSize;
|
||||
LARGE_INTEGER CurrentSize;
|
||||
ULONG FreePages;
|
||||
ULONG UsedPages;
|
||||
PULONG AllocMap;
|
||||
@@ -61,6 +61,9 @@ static PPAGINGFILE PagingFileList[MAX_PAGING_FILES];
|
||||
/* Lock for examining the list of paging files */
|
||||
static KSPIN_LOCK PagingFileListLock;
|
||||
|
||||
/* Number of paging files */
|
||||
static ULONG MiPagingFileCount;
|
||||
|
||||
/* Number of pages that are available for swapping */
|
||||
static ULONG MiFreeSwapPages;
|
||||
|
||||
@@ -192,6 +195,7 @@ MmInitPagingFile(VOID)
|
||||
{
|
||||
PagingFileList[i] = NULL;
|
||||
}
|
||||
MiPagingFileCount = 0;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
@@ -359,11 +363,11 @@ NTSTATUS STDCALL MmDumpToPagingFile(PCONTEXT Context,
|
||||
}
|
||||
#endif
|
||||
|
||||
NTSTATUS STDCALL
|
||||
NtCreatePagingFile(IN PUNICODE_STRING PageFileName,
|
||||
IN ULONG MinimumSize,
|
||||
IN ULONG MaximumSize,
|
||||
OUT PULONG ActualSize)
|
||||
NTSTATUS STDCALL
|
||||
NtCreatePagingFile(IN PUNICODE_STRING FileName,
|
||||
IN PLARGE_INTEGER InitialSize,
|
||||
IN PLARGE_INTEGER MaximumSize,
|
||||
IN ULONG Reserved)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
@@ -375,13 +379,17 @@ NtCreatePagingFile(IN PUNICODE_STRING PageFileName,
|
||||
ULONG AllocMapSize;
|
||||
ULONG i;
|
||||
PVOID Buffer;
|
||||
LARGE_INTEGER ByteOffset;
|
||||
|
||||
DPRINT("NtCreatePagingFile(PageFileName %wZ, MinimumSize %d)\n",
|
||||
PageFileName, MinimumSize);
|
||||
DPRINT("NtCreatePagingFile(FileName %wZ, InitialSize %I64d)\n",
|
||||
FileName, InitialSize->QuadPart);
|
||||
|
||||
if (MiPagingFileCount >= MAX_PAGING_FILES)
|
||||
{
|
||||
return(STATUS_TOO_MANY_PAGING_FILES);
|
||||
}
|
||||
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
PageFileName,
|
||||
FileName,
|
||||
0,
|
||||
NULL,
|
||||
NULL);
|
||||
@@ -407,7 +415,6 @@ NtCreatePagingFile(IN PUNICODE_STRING PageFileName,
|
||||
|
||||
Buffer = ExAllocatePool(NonPagedPool, 4096);
|
||||
memset(Buffer, 0, 4096);
|
||||
ByteOffset.QuadPart = MinimumSize * 4096;
|
||||
Status = NtWriteFile(FileHandle,
|
||||
NULL,
|
||||
NULL,
|
||||
@@ -415,7 +422,7 @@ NtCreatePagingFile(IN PUNICODE_STRING PageFileName,
|
||||
&IoStatus,
|
||||
Buffer,
|
||||
4096,
|
||||
&ByteOffset,
|
||||
InitialSize,
|
||||
NULL);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
@@ -446,12 +453,13 @@ NtCreatePagingFile(IN PUNICODE_STRING PageFileName,
|
||||
}
|
||||
|
||||
PagingFile->FileObject = FileObject;
|
||||
PagingFile->MaximumSize = PagingFile->CurrentSize = MinimumSize;
|
||||
PagingFile->FreePages = MinimumSize;
|
||||
PagingFile->MaximumSize.QuadPart = MaximumSize->QuadPart;
|
||||
PagingFile->CurrentSize.QuadPart = InitialSize->QuadPart;
|
||||
PagingFile->FreePages = InitialSize->QuadPart / PAGESIZE;
|
||||
PagingFile->UsedPages = 0;
|
||||
KeInitializeSpinLock(&PagingFile->AllocMapLock);
|
||||
|
||||
AllocMapSize = (MinimumSize / 32) + 1;
|
||||
AllocMapSize = (PagingFile->FreePages / 32) + 1;
|
||||
PagingFile->AllocMap = ExAllocatePool(NonPagedPool,
|
||||
AllocMapSize * sizeof(ULONG));
|
||||
PagingFile->AllocMapSize = AllocMapSize;
|
||||
@@ -472,7 +480,8 @@ NtCreatePagingFile(IN PUNICODE_STRING PageFileName,
|
||||
break;
|
||||
}
|
||||
}
|
||||
MiFreeSwapPages = MiFreeSwapPages + MinimumSize;
|
||||
MiFreeSwapPages = MiFreeSwapPages + PagingFile->FreePages;
|
||||
MiPagingFileCount++;
|
||||
KeReleaseSpinLock(&PagingFileListLock, oldIrql);
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
|
||||
+260
-336
@@ -1,4 +1,4 @@
|
||||
/* $Id: init.c,v 1.30 2002/02/08 02:57:10 chorns Exp $
|
||||
/* $Id: init.c,v 1.31 2002/03/18 16:16:47 ekohl Exp $
|
||||
*
|
||||
* init.c - Session Manager initialization
|
||||
*
|
||||
@@ -58,106 +58,32 @@ PWSTR SmSystemEnvironment = NULL;
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
#if 0
|
||||
static VOID
|
||||
SmCreatePagingFiles (VOID)
|
||||
{
|
||||
UNICODE_STRING FileName;
|
||||
ULONG ulCurrentSize;
|
||||
ULONG i, j;
|
||||
CHAR FileNameBufA[255];
|
||||
ANSI_STRING FileNameA;
|
||||
NTSTATUS Status;
|
||||
HANDLE FileHandle;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
IO_STATUS_BLOCK Iosb;
|
||||
LARGE_INTEGER Offset;
|
||||
static CHAR Buffer[4096];
|
||||
BOOL Found = FALSE;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
for (j = 0; j < 4; j++)
|
||||
{
|
||||
sprintf(FileNameBufA, "\\Device\\Harddisk%d\\Partition%d", i, j);
|
||||
RtlInitAnsiString(&FileNameA, FileNameBufA);
|
||||
RtlAnsiStringToUnicodeString(&FileName, &FileNameA, TRUE);
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&FileName,
|
||||
0,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
Status = ZwOpenFile(&FileHandle,
|
||||
FILE_ALL_ACCESS,
|
||||
&ObjectAttributes,
|
||||
&Iosb,
|
||||
0,
|
||||
0);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Offset.QuadPart = 0;
|
||||
Status = ZwReadFile(FileHandle,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
&Iosb,
|
||||
Buffer,
|
||||
4096,
|
||||
&Offset,
|
||||
NULL);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DbgPrint("SM: Failed to read first page of partition\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (memcmp(&Buffer[4096 - 10], "SWAP-SPACE", 10) == 0 ||
|
||||
memcmp(&Buffer[4096 - 10], "SWAPSPACE2", 10) == 0)
|
||||
{
|
||||
DbgPrint("SM: Found swap space at %s\n", FileNameA);
|
||||
Found = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
ZwClose(FileHandle);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
static VOID
|
||||
SmCreatePagingFiles (VOID)
|
||||
{
|
||||
UNICODE_STRING FileName;
|
||||
ULONG ulCurrentSize;
|
||||
LARGE_INTEGER InitialSize;
|
||||
LARGE_INTEGER MaximumSize;
|
||||
NTSTATUS Status;
|
||||
|
||||
/* FIXME: Read file names from registry */
|
||||
|
||||
RtlInitUnicodeString (&FileName,
|
||||
L"\\SystemRoot\\pagefile.sys");
|
||||
|
||||
Status = NtCreatePagingFile (&FileName,
|
||||
50,
|
||||
80,
|
||||
&ulCurrentSize);
|
||||
|
||||
InitialSize.QuadPart = 50 * 4096;
|
||||
MaximumSize.QuadPart = 80 * 4096;
|
||||
|
||||
Status = NtCreatePagingFile(&FileName,
|
||||
&InitialSize,
|
||||
&MaximumSize,
|
||||
0);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
PrintString("SM: Failed to create paging file (Status was 0x%.8X)\n", Status);
|
||||
}
|
||||
}
|
||||
#else
|
||||
static VOID
|
||||
SmCreatePagingFiles (VOID)
|
||||
{
|
||||
/* Nothing. */
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static VOID
|
||||
SmInitDosDevices(VOID)
|
||||
@@ -336,73 +262,80 @@ SmSetEnvironmentVariables (VOID)
|
||||
|
||||
BOOL InitSessionManager (HANDLE Children[])
|
||||
{
|
||||
NTSTATUS Status;
|
||||
UNICODE_STRING UnicodeString;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
UNICODE_STRING CmdLineW;
|
||||
PRTL_USER_PROCESS_PARAMETERS ProcessParameters;
|
||||
RTL_PROCESS_INFO ProcessInfo;
|
||||
HANDLE CsrssInitEvent;
|
||||
HANDLE WindowsDirectory;
|
||||
WCHAR UnicodeBuffer[MAX_PATH];
|
||||
PKUSER_SHARED_DATA SharedUserData =
|
||||
(PKUSER_SHARED_DATA)USER_SHARED_DATA_BASE;
|
||||
NTSTATUS Status;
|
||||
UNICODE_STRING UnicodeString;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
UNICODE_STRING CmdLineW;
|
||||
PRTL_USER_PROCESS_PARAMETERS ProcessParameters;
|
||||
RTL_PROCESS_INFO ProcessInfo;
|
||||
HANDLE CsrssInitEvent;
|
||||
HANDLE WindowsDirectory;
|
||||
WCHAR UnicodeBuffer[MAX_PATH];
|
||||
PKUSER_SHARED_DATA SharedUserData =
|
||||
(PKUSER_SHARED_DATA)USER_SHARED_DATA_BASE;
|
||||
|
||||
/*
|
||||
* FIXME: The '\Windows' directory is created by csrss.exe but
|
||||
* win32k.sys needs it at intialization and it is loaded
|
||||
* before csrss.exe
|
||||
*/
|
||||
/*
|
||||
* FIXME: The '\Windows' directory is created by csrss.exe but
|
||||
* win32k.sys needs it at intialization and it is loaded
|
||||
* before csrss.exe
|
||||
*/
|
||||
|
||||
/*
|
||||
* Create the '\Windows' directory
|
||||
*/
|
||||
RtlInitUnicodeString(
|
||||
&UnicodeString,
|
||||
L"\\Windows");
|
||||
/*
|
||||
* Create the '\Windows' directory
|
||||
*/
|
||||
RtlInitUnicodeString(&UnicodeString,
|
||||
L"\\Windows");
|
||||
|
||||
InitializeObjectAttributes(
|
||||
&ObjectAttributes,
|
||||
&UnicodeString,
|
||||
0,
|
||||
NULL,
|
||||
NULL);
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&UnicodeString,
|
||||
0,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
Status = ZwCreateDirectoryObject(
|
||||
&WindowsDirectory,
|
||||
0,
|
||||
&ObjectAttributes);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DisplayString (L"SM: Could not create \\Windows directory!\n");
|
||||
return FALSE;
|
||||
}
|
||||
Status = ZwCreateDirectoryObject(&WindowsDirectory,
|
||||
0,
|
||||
&ObjectAttributes);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DisplayString(L"SM: Could not create \\Windows directory!\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Create the "\SmApiPort" object (LPC) */
|
||||
RtlInitUnicodeString (&UnicodeString,
|
||||
L"\\SmApiPort");
|
||||
InitializeObjectAttributes (&ObjectAttributes,
|
||||
&UnicodeString,
|
||||
PORT_ALL_ACCESS,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
Status = NtCreatePort (&SmApiPort,
|
||||
&ObjectAttributes,
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
/* Create the "\SmApiPort" object (LPC) */
|
||||
RtlInitUnicodeString(&UnicodeString,
|
||||
L"\\SmApiPort");
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&UnicodeString,
|
||||
PORT_ALL_ACCESS,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
Status = NtCreatePort(&SmApiPort,
|
||||
&ObjectAttributes,
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
DisplayString (L"SM: \\SmApiPort created...\n");
|
||||
DisplayString (L"SM: \\SmApiPort created...\n");
|
||||
#endif
|
||||
|
||||
/* Create two threads for "\SmApiPort" */
|
||||
|
||||
/* Create two threads for "\SmApiPort" */
|
||||
RtlCreateUserThread(NtCurrentProcess(),
|
||||
NULL,
|
||||
FALSE,
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
(PTHREAD_START_ROUTINE)SmApiThread,
|
||||
(PVOID)SmApiPort,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
RtlCreateUserThread (NtCurrentProcess (),
|
||||
NULL,
|
||||
FALSE,
|
||||
@@ -414,213 +347,204 @@ BOOL InitSessionManager (HANDLE Children[])
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
RtlCreateUserThread (NtCurrentProcess (),
|
||||
NULL,
|
||||
FALSE,
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
(PTHREAD_START_ROUTINE)SmApiThread,
|
||||
(PVOID)SmApiPort,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
/* Create the system environment */
|
||||
Status = RtlCreateEnvironment (FALSE,
|
||||
&SmSystemEnvironment);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
/* Create the system environment */
|
||||
Status = RtlCreateEnvironment(FALSE,
|
||||
&SmSystemEnvironment);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
#ifndef NDEBUG
|
||||
DisplayString (L"SM: System Environment created\n");
|
||||
DisplayString (L"SM: System Environment created\n");
|
||||
#endif
|
||||
|
||||
/* Define symbolic links to kernel devices (MS-DOS names) */
|
||||
SmInitDosDevices();
|
||||
|
||||
/* FIXME: Run all programs in the boot execution list */
|
||||
|
||||
/* FIXME: Process the file rename list */
|
||||
|
||||
/* FIXME: Load the well known DLLs */
|
||||
|
||||
/* Create paging files */
|
||||
SmCreatePagingFiles ();
|
||||
|
||||
/* Load remaining registry hives */
|
||||
NtInitializeRegistry (FALSE);
|
||||
|
||||
/* Set environment variables from registry */
|
||||
SmSetEnvironmentVariables ();
|
||||
/* Define symbolic links to kernel devices (MS-DOS names) */
|
||||
SmInitDosDevices();
|
||||
|
||||
/* Load the kernel mode driver win32k.sys */
|
||||
RtlInitUnicodeString (&CmdLineW,
|
||||
L"\\SystemRoot\\system32\\drivers\\win32k.sys");
|
||||
Status = NtLoadDriver (&CmdLineW);
|
||||
|
||||
/* FIXME: Run all programs in the boot execution list */
|
||||
// SmRunBootApps();
|
||||
|
||||
/* FIXME: Process the file rename list */
|
||||
// SmProcessFileRenameList();
|
||||
|
||||
/* FIXME: Load the well known DLLs */
|
||||
// SmPreloadDlls();
|
||||
|
||||
/* Create paging files */
|
||||
SmCreatePagingFiles();
|
||||
|
||||
/* Load remaining registry hives */
|
||||
NtInitializeRegistry(FALSE);
|
||||
|
||||
/* Set environment variables from registry */
|
||||
SmSetEnvironmentVariables();
|
||||
|
||||
/* Load the kernel mode driver win32k.sys */
|
||||
RtlInitUnicodeString(&CmdLineW,
|
||||
L"\\SystemRoot\\system32\\drivers\\win32k.sys");
|
||||
Status = NtLoadDriver(&CmdLineW);
|
||||
#if 0
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
/* Run csrss.exe */
|
||||
RtlInitUnicodeString(&UnicodeString,
|
||||
L"\\CsrssInitDone");
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&UnicodeString,
|
||||
EVENT_ALL_ACCESS,
|
||||
0,
|
||||
NULL);
|
||||
Status = NtCreateEvent(&CsrssInitEvent,
|
||||
EVENT_ALL_ACCESS,
|
||||
&ObjectAttributes,
|
||||
TRUE,
|
||||
FALSE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DbgPrint("Failed to create csrss notification event\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* Start the Win32 subsystem (csrss.exe)
|
||||
*/
|
||||
|
||||
/* initialize executable path */
|
||||
wcscpy(UnicodeBuffer, L"\\??\\");
|
||||
wcscat(UnicodeBuffer, SharedUserData->NtSystemRoot);
|
||||
wcscat(UnicodeBuffer, L"\\system32\\csrss.exe");
|
||||
RtlInitUnicodeString (&UnicodeString,
|
||||
UnicodeBuffer);
|
||||
|
||||
RtlCreateProcessParameters (&ProcessParameters,
|
||||
&UnicodeString,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
SmSystemEnvironment,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
Status = RtlCreateUserProcess (&UnicodeString,
|
||||
OBJ_CASE_INSENSITIVE,
|
||||
ProcessParameters,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
FALSE,
|
||||
NULL,
|
||||
NULL,
|
||||
&ProcessInfo);
|
||||
|
||||
RtlDestroyProcessParameters (ProcessParameters);
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DisplayString (L"SM: Loading csrss.exe failed!\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
NtWaitForSingleObject(CsrssInitEvent,
|
||||
FALSE,
|
||||
NULL);
|
||||
|
||||
Children[CHILD_CSRSS] = ProcessInfo.ProcessHandle;
|
||||
|
||||
/*
|
||||
* Start the logon process (winlogon.exe)
|
||||
*/
|
||||
|
||||
/* initialize executable path */
|
||||
wcscpy(UnicodeBuffer, L"\\??\\");
|
||||
wcscat(UnicodeBuffer, SharedUserData->NtSystemRoot);
|
||||
wcscat(UnicodeBuffer, L"\\system32\\winlogon.exe");
|
||||
RtlInitUnicodeString (&UnicodeString,
|
||||
UnicodeBuffer);
|
||||
|
||||
RtlCreateProcessParameters(&ProcessParameters,
|
||||
&UnicodeString,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
SmSystemEnvironment,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
Status = RtlCreateUserProcess(&UnicodeString,
|
||||
OBJ_CASE_INSENSITIVE,
|
||||
ProcessParameters,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
FALSE,
|
||||
NULL,
|
||||
NULL,
|
||||
&ProcessInfo);
|
||||
|
||||
RtlDestroyProcessParameters(ProcessParameters);
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DisplayString(L"SM: Loading winlogon.exe failed!\n");
|
||||
NtTerminateProcess(Children[CHILD_CSRSS],
|
||||
0);
|
||||
return FALSE;
|
||||
}
|
||||
Children[CHILD_WINLOGON] = ProcessInfo.ProcessHandle;
|
||||
|
||||
/* Create the \DbgSsApiPort object (LPC) */
|
||||
RtlInitUnicodeString (&UnicodeString,
|
||||
L"\\DbgSsApiPort");
|
||||
InitializeObjectAttributes (&ObjectAttributes,
|
||||
&UnicodeString,
|
||||
PORT_ALL_ACCESS,
|
||||
NULL,
|
||||
NULL);
|
||||
/* Run csrss.exe */
|
||||
RtlInitUnicodeString(&UnicodeString,
|
||||
L"\\CsrssInitDone");
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&UnicodeString,
|
||||
EVENT_ALL_ACCESS,
|
||||
0,
|
||||
NULL);
|
||||
Status = NtCreateEvent(&CsrssInitEvent,
|
||||
EVENT_ALL_ACCESS,
|
||||
&ObjectAttributes,
|
||||
TRUE,
|
||||
FALSE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DbgPrint("Failed to create csrss notification event\n");
|
||||
}
|
||||
|
||||
Status = NtCreatePort (&DbgSsApiPort,
|
||||
&ObjectAttributes,
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
/*
|
||||
* Start the Win32 subsystem (csrss.exe)
|
||||
*/
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
/* initialize executable path */
|
||||
wcscpy(UnicodeBuffer, L"\\??\\");
|
||||
wcscat(UnicodeBuffer, SharedUserData->NtSystemRoot);
|
||||
wcscat(UnicodeBuffer, L"\\system32\\csrss.exe");
|
||||
RtlInitUnicodeString(&UnicodeString,
|
||||
UnicodeBuffer);
|
||||
|
||||
RtlCreateProcessParameters(&ProcessParameters,
|
||||
&UnicodeString,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
SmSystemEnvironment,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
Status = RtlCreateUserProcess(&UnicodeString,
|
||||
OBJ_CASE_INSENSITIVE,
|
||||
ProcessParameters,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
FALSE,
|
||||
NULL,
|
||||
NULL,
|
||||
&ProcessInfo);
|
||||
|
||||
RtlDestroyProcessParameters (ProcessParameters);
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DisplayString(L"SM: Loading csrss.exe failed!\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
NtWaitForSingleObject(CsrssInitEvent,
|
||||
FALSE,
|
||||
NULL);
|
||||
|
||||
Children[CHILD_CSRSS] = ProcessInfo.ProcessHandle;
|
||||
|
||||
/*
|
||||
* Start the logon process (winlogon.exe)
|
||||
*/
|
||||
|
||||
/* initialize executable path */
|
||||
wcscpy(UnicodeBuffer, L"\\??\\");
|
||||
wcscat(UnicodeBuffer, SharedUserData->NtSystemRoot);
|
||||
wcscat(UnicodeBuffer, L"\\system32\\winlogon.exe");
|
||||
RtlInitUnicodeString(&UnicodeString,
|
||||
UnicodeBuffer);
|
||||
|
||||
RtlCreateProcessParameters(&ProcessParameters,
|
||||
&UnicodeString,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
SmSystemEnvironment,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
Status = RtlCreateUserProcess(&UnicodeString,
|
||||
OBJ_CASE_INSENSITIVE,
|
||||
ProcessParameters,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
FALSE,
|
||||
NULL,
|
||||
NULL,
|
||||
&ProcessInfo);
|
||||
|
||||
RtlDestroyProcessParameters(ProcessParameters);
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DisplayString(L"SM: Loading winlogon.exe failed!\n");
|
||||
NtTerminateProcess(Children[CHILD_CSRSS],
|
||||
0);
|
||||
return FALSE;
|
||||
}
|
||||
Children[CHILD_WINLOGON] = ProcessInfo.ProcessHandle;
|
||||
|
||||
/* Create the \DbgSsApiPort object (LPC) */
|
||||
RtlInitUnicodeString(&UnicodeString,
|
||||
L"\\DbgSsApiPort");
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&UnicodeString,
|
||||
PORT_ALL_ACCESS,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
Status = NtCreatePort(&DbgSsApiPort,
|
||||
&ObjectAttributes,
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
#ifndef NDEBUG
|
||||
DisplayString (L"SM: DbgSsApiPort created...\n");
|
||||
DisplayString(L"SM: DbgSsApiPort created...\n");
|
||||
#endif
|
||||
|
||||
/* Create the \DbgUiApiPort object (LPC) */
|
||||
RtlInitUnicodeString (&UnicodeString,
|
||||
L"\\DbgUiApiPort");
|
||||
InitializeObjectAttributes (&ObjectAttributes,
|
||||
&UnicodeString,
|
||||
PORT_ALL_ACCESS,
|
||||
NULL,
|
||||
NULL);
|
||||
/* Create the \DbgUiApiPort object (LPC) */
|
||||
RtlInitUnicodeString(&UnicodeString,
|
||||
L"\\DbgUiApiPort");
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&UnicodeString,
|
||||
PORT_ALL_ACCESS,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
Status = NtCreatePort (&DbgUiApiPort,
|
||||
&ObjectAttributes,
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
Status = NtCreatePort(&DbgUiApiPort,
|
||||
&ObjectAttributes,
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
#ifndef NDEBUG
|
||||
DisplayString (L"SM: DbgUiApiPort created...\n");
|
||||
DisplayString (L"SM: DbgUiApiPort created...\n");
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
||||
Reference in New Issue
Block a user