mirror of
https://github.com/reactos/reactos.git
synced 2025-06-13 04:48:31 +00:00
[CSRSS]: Remove unneeded initialization code, and move Win32k.sys related initailization to win32csr. Note that the "VDM IVT" stuff should move to videoprt's handler for IRP_MJ_CREATE, and opening the "\\DISPLAY1" needs to go in Win32k.sys (under NtUserInitialize I think).
[BOOT REGISTRY]: Cleanup subsystem entries to match Windows. svn path=/trunk/; revision=55590
This commit is contained in:
parent
9829c56509
commit
bc5bf60461
6 changed files with 156 additions and 284 deletions
|
@ -1074,12 +1074,10 @@ HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management","Pagin
|
||||||
; Subsystems
|
; Subsystems
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Debug",0x00020000,""
|
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Debug",0x00020000,""
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Kmode",0x00020000,"%SystemRoot%\system32\win32k.sys"
|
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Kmode",0x00020000,"%SystemRoot%\system32\win32k.sys"
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Optional",0x00010000,"Posix","Os2","Vms"
|
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Optional",0x00010000,"Posix"
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Os2",0x00020000,"%SystemRoot%\system32\csr.exe ObjectDirectory=\OS2 SharedSection=128 Windows=Off SubSystemType=Text ServerDll=os2srv,1 ProfileControl=Off RequestThreads=2 MaxRequestThreads=2 Sessions=Off"
|
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Posix",0x00020000,"%SystemRoot%\system32\psxss.exe"
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Posix",0x00020000,"%SystemRoot%\system32\csr.exe ObjectDirectory=\POSIX SharedSection=128 Windows=Off SubSystemType=Text ServerDll=psxsrv,1 ProfileControl=Off RequestThreads=2 MaxRequestThreads=2 Sessions=Off"
|
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Required",0x00010000,"Debug","Windows"
|
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Required",0x00010000,"Debug","Windows"
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Vms",0x00020000,"%SystemRoot%\system32\csr.exe ObjectDirectory=\VMS SharedSection=128 Windows=Off SubSystemType=Text ServerDll=vmssrv,1 ProfileControl=Off RequestThreads=2 MaxRequestThreads=2 Sessions=Off"
|
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Windows",0x00020000,"%SystemRoot%\system32\csrss.exe ObjectDirectory=\Windows SharedSection=1024,12288,512 Windows=On SubSystemType=Windows ServerDll=basesrv,1 ServerDll=winsrv:UserServerDllInitialization,3 ServerDll=winsrv:ConServerDllInitialization,2 ProfileControl=Off MaxRequestThreads=16"
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Windows",0x00020000,"%SystemRoot%\system32\csrss.exe"
|
|
||||||
|
|
||||||
; WOW Support
|
; WOW Support
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Wow","",0x00000000,""
|
HKLM,"SYSTEM\CurrentControlSet\Control\Wow","",0x00000000,""
|
||||||
|
|
|
@ -790,12 +790,10 @@ HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management",,0x000
|
||||||
; Subsystems
|
; Subsystems
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Debug",0x00020000,""
|
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Debug",0x00020000,""
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Kmode",0x00020000,"%SystemRoot%\system32\win32k.sys"
|
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Kmode",0x00020000,"%SystemRoot%\system32\win32k.sys"
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Optional",0x00010000,"Posix","Os2","Vms"
|
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Optional",0x00010000,"Posix"
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Os2",0x00020000,"%SystemRoot%\system32\csr.exe ObjectDirectory=\OS2 SharedSection=128 Windows=Off SubSystemType=Text ServerDll=os2srv,1 ProfileControl=Off RequestThreads=2 MaxRequestThreads=2 Sessions=Off"
|
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Posix",0x00020000,"%SystemRoot%\system32\psxss.exe"
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Posix",0x00020000,"%SystemRoot%\system32\csr.exe ObjectDirectory=\POSIX SharedSection=128 Windows=Off SubSystemType=Text ServerDll=psxsrv,1 ProfileControl=Off RequestThreads=2 MaxRequestThreads=2 Sessions=Off"
|
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Required",0x00010000,"Debug","Windows"
|
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Required",0x00010000,"Debug","Windows"
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Vms",0x00020000,"%SystemRoot%\system32\csr.exe ObjectDirectory=\VMS SharedSection=128 Windows=Off SubSystemType=Text ServerDll=vmssrv,1 ProfileControl=Off RequestThreads=2 MaxRequestThreads=2 Sessions=Off"
|
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Windows",0x00020000,"%SystemRoot%\system32\csrss.exe ObjectDirectory=\Windows SharedSection=1024,12288,512 Windows=On SubSystemType=Windows ServerDll=basesrv,1 ServerDll=winsrv:UserServerDllInitialization,3 ServerDll=winsrv:ConServerDllInitialization,2 ProfileControl=Off MaxRequestThreads=16"
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Windows",0x00020000,"%SystemRoot%\system32\csrss.exe"
|
|
||||||
|
|
||||||
; WOW Support
|
; WOW Support
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Wow","",0x00000000,""
|
HKLM,"SYSTEM\CurrentControlSet\Control\Wow","",0x00000000,""
|
||||||
|
|
|
@ -1225,12 +1225,10 @@ HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management",,0x000
|
||||||
; Subsystems
|
; Subsystems
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Debug",0x00020000,""
|
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Debug",0x00020000,""
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Kmode",0x00020000,"%SystemRoot%\system32\win32k.sys"
|
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Kmode",0x00020000,"%SystemRoot%\system32\win32k.sys"
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Optional",0x00010000,"Posix","Os2","Vms"
|
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Optional",0x00010000,"Posix"
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Os2",0x00020000,"%SystemRoot%\system32\csr.exe ObjectDirectory=\OS2 SharedSection=128 Windows=Off SubSystemType=Text ServerDll=os2srv,1 ProfileControl=Off RequestThreads=2 MaxRequestThreads=2 Sessions=Off"
|
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Posix",0x00020000,"%SystemRoot%\system32\psxss.exe"
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Posix",0x00020000,"%SystemRoot%\system32\csr.exe ObjectDirectory=\POSIX SharedSection=128 Windows=Off SubSystemType=Text ServerDll=psxsrv,1 ProfileControl=Off RequestThreads=2 MaxRequestThreads=2 Sessions=Off"
|
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Required",0x00010000,"Debug","Windows"
|
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Required",0x00010000,"Debug","Windows"
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Vms",0x00020000,"%SystemRoot%\system32\csr.exe ObjectDirectory=\VMS SharedSection=128 Windows=Off SubSystemType=Text ServerDll=vmssrv,1 ProfileControl=Off RequestThreads=2 MaxRequestThreads=2 Sessions=Off"
|
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Windows",0x00020000,"%SystemRoot%\system32\csrss.exe ObjectDirectory=\Windows SharedSection=1024,12288,512 Windows=On SubSystemType=Windows ServerDll=basesrv,1 ServerDll=winsrv:UserServerDllInitialization,3 ServerDll=winsrv:ConServerDllInitialization,2 ProfileControl=Off MaxRequestThreads=16"
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Subsystems","Windows",0x00020000,"%SystemRoot%\system32\csrss.exe"
|
|
||||||
|
|
||||||
; WOW Support
|
; WOW Support
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Wow","",0x00000000,""
|
HKLM,"SYSTEM\CurrentControlSet\Control\Wow","",0x00000000,""
|
||||||
|
|
|
@ -27,113 +27,6 @@ HANDLE hApiPort = (HANDLE) 0;
|
||||||
|
|
||||||
/* PRIVATE FUNCTIONS **********************************************************/
|
/* PRIVATE FUNCTIONS **********************************************************/
|
||||||
|
|
||||||
ULONG
|
|
||||||
InitializeVideoAddressSpace(VOID)
|
|
||||||
{
|
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
|
||||||
UNICODE_STRING PhysMemName = RTL_CONSTANT_STRING(L"\\Device\\PhysicalMemory");
|
|
||||||
NTSTATUS Status;
|
|
||||||
HANDLE PhysMemHandle;
|
|
||||||
PVOID BaseAddress;
|
|
||||||
LARGE_INTEGER Offset;
|
|
||||||
SIZE_T ViewSize;
|
|
||||||
CHAR IVTAndBda[1024+256];
|
|
||||||
|
|
||||||
/* Free the 1MB pre-reserved region. In reality, ReactOS should simply support us mapping the view into the reserved area, but it doesn't. */
|
|
||||||
BaseAddress = 0;
|
|
||||||
ViewSize = 1024 * 1024;
|
|
||||||
Status = ZwFreeVirtualMemory(NtCurrentProcess(),
|
|
||||||
&BaseAddress,
|
|
||||||
&ViewSize,
|
|
||||||
MEM_RELEASE);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
DPRINT1("Couldn't unmap reserved memory (%x)\n", Status);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Open the physical memory section */
|
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
|
||||||
&PhysMemName,
|
|
||||||
0,
|
|
||||||
NULL,
|
|
||||||
NULL);
|
|
||||||
Status = ZwOpenSection(&PhysMemHandle,
|
|
||||||
SECTION_ALL_ACCESS,
|
|
||||||
&ObjectAttributes);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
DPRINT1("Couldn't open \\Device\\PhysicalMemory\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Map the BIOS and device registers into the address space */
|
|
||||||
Offset.QuadPart = 0xa0000;
|
|
||||||
ViewSize = 0x100000 - 0xa0000;
|
|
||||||
BaseAddress = (PVOID)0xa0000;
|
|
||||||
Status = ZwMapViewOfSection(PhysMemHandle,
|
|
||||||
NtCurrentProcess(),
|
|
||||||
&BaseAddress,
|
|
||||||
0,
|
|
||||||
ViewSize,
|
|
||||||
&Offset,
|
|
||||||
&ViewSize,
|
|
||||||
ViewUnmap,
|
|
||||||
0,
|
|
||||||
PAGE_EXECUTE_READWRITE);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
DPRINT1("Couldn't map physical memory (%x)\n", Status);
|
|
||||||
ZwClose(PhysMemHandle);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Close physical memory section handle */
|
|
||||||
ZwClose(PhysMemHandle);
|
|
||||||
|
|
||||||
if (BaseAddress != (PVOID)0xa0000)
|
|
||||||
{
|
|
||||||
DPRINT1("Couldn't map physical memory at the right address (was %x)\n",
|
|
||||||
BaseAddress);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Allocate some low memory to use for the non-BIOS
|
|
||||||
* parts of the v86 mode address space
|
|
||||||
*/
|
|
||||||
BaseAddress = (PVOID)0x1;
|
|
||||||
ViewSize = 0xa0000 - 0x1000;
|
|
||||||
Status = ZwAllocateVirtualMemory(NtCurrentProcess(),
|
|
||||||
&BaseAddress,
|
|
||||||
0,
|
|
||||||
&ViewSize,
|
|
||||||
MEM_RESERVE | MEM_COMMIT,
|
|
||||||
PAGE_EXECUTE_READWRITE);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
DPRINT1("Failed to allocate virtual memory (Status %x)\n", Status);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (BaseAddress != (PVOID)0x0)
|
|
||||||
{
|
|
||||||
DPRINT1("Failed to allocate virtual memory at right address (was %x)\n",
|
|
||||||
BaseAddress);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get the real mode IVT and BDA from the kernel */
|
|
||||||
Status = NtVdmControl(VdmInitialize, IVTAndBda);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
DPRINT1("NtVdmControl failed (status %x)\n", Status);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return success */
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static NTSTATUS FASTCALL
|
static NTSTATUS FASTCALL
|
||||||
CsrpAddServerProcs(CSRPLUGIN_SERVER_PROCS *Procs)
|
CsrpAddServerProcs(CSRPLUGIN_SERVER_PROCS *Procs)
|
||||||
{
|
{
|
||||||
|
@ -260,43 +153,6 @@ CsrpCreateObjectDirectory (int argc, char ** argv, char ** envp)
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************
|
|
||||||
* CsrpInitVideo/3
|
|
||||||
*
|
|
||||||
* TODO: we need a virtual device for sessions other than
|
|
||||||
* TODO: the console one
|
|
||||||
*/
|
|
||||||
static NTSTATUS
|
|
||||||
CsrpInitVideo (int argc, char ** argv, char ** envp)
|
|
||||||
{
|
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
|
||||||
UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\??\\DISPLAY1");
|
|
||||||
IO_STATUS_BLOCK Iosb;
|
|
||||||
HANDLE VideoHandle = (HANDLE) 0;
|
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
|
||||||
|
|
||||||
DPRINT("CSR: %s called\n", __FUNCTION__);
|
|
||||||
|
|
||||||
InitializeVideoAddressSpace();
|
|
||||||
|
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
|
||||||
&DeviceName,
|
|
||||||
0,
|
|
||||||
NULL,
|
|
||||||
NULL);
|
|
||||||
Status = NtOpenFile(&VideoHandle,
|
|
||||||
FILE_ALL_ACCESS,
|
|
||||||
&ObjectAttributes,
|
|
||||||
&Iosb,
|
|
||||||
0,
|
|
||||||
0);
|
|
||||||
if (NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
NtClose(VideoHandle);
|
|
||||||
}
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* CsrpInitWin32Csr/3
|
* CsrpInitWin32Csr/3
|
||||||
*
|
*
|
||||||
|
@ -604,52 +460,6 @@ CsrpRegisterSubsystem (int argc, char ** argv, char ** envp)
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
/**********************************************************************
|
|
||||||
* CsrpLoadKernelModeDriver/3
|
|
||||||
*/
|
|
||||||
static NTSTATUS
|
|
||||||
CsrpLoadKernelModeDriver (int argc, char ** argv, char ** envp)
|
|
||||||
{
|
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
|
||||||
WCHAR Data [MAX_PATH + 1];
|
|
||||||
ULONG DataLength = sizeof Data;
|
|
||||||
ULONG DataType = 0;
|
|
||||||
//UNICODE_STRING Environment;
|
|
||||||
|
|
||||||
|
|
||||||
DPRINT1("SM: %s called\n", __FUNCTION__);
|
|
||||||
|
|
||||||
|
|
||||||
//EnvpToUnicodeString (envp, & Environment);
|
|
||||||
Status = SmLookupSubsystem (L"Kmode",
|
|
||||||
Data,
|
|
||||||
& DataLength,
|
|
||||||
& DataType,
|
|
||||||
NULL);
|
|
||||||
//RtlFreeUnicodeString (& Environment);
|
|
||||||
if((STATUS_SUCCESS == Status) && (DataLength > sizeof Data[0]))
|
|
||||||
{
|
|
||||||
WCHAR ImagePath [MAX_PATH + 1] = {0};
|
|
||||||
UNICODE_STRING ModuleName;
|
|
||||||
|
|
||||||
wcscpy (ImagePath, L"\\SYSTEMROOT\\system32\\win32k.sys");
|
|
||||||
// wcscat (ImagePath, Data);
|
|
||||||
RtlInitUnicodeString (& ModuleName, ImagePath);
|
|
||||||
Status = NtSetSystemInformation(/* FIXME: SystemLoadAndCallImage */
|
|
||||||
SystemExtendServiceTableInformation,
|
|
||||||
& ModuleName,
|
|
||||||
sizeof ModuleName);
|
|
||||||
if(!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
DPRINT1("WIN: %s: loading Kmode failed (Status=0x%08lx)\n",
|
|
||||||
__FUNCTION__, Status);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* CsrpCreateApiPort/2
|
* CsrpCreateApiPort/2
|
||||||
*/
|
*/
|
||||||
|
@ -673,75 +483,6 @@ CsrpApiRegisterDef (int argc, char ** argv, char ** envp)
|
||||||
return CsrApiRegisterDefinitions(NativeDefinitions);
|
return CsrApiRegisterDefinitions(NativeDefinitions);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************
|
|
||||||
* CsrpCCTS/2
|
|
||||||
*/
|
|
||||||
static NTSTATUS
|
|
||||||
CsrpCCTS (int argc, char ** argv, char ** envp)
|
|
||||||
{
|
|
||||||
ULONG Dummy;
|
|
||||||
ULONG DummyLength = sizeof(Dummy);
|
|
||||||
return CsrClientConnectToServer(L"\\Windows",
|
|
||||||
0, &Dummy, &DummyLength, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**********************************************************************
|
|
||||||
* CsrpRunWinlogon/0
|
|
||||||
*
|
|
||||||
* Start the logon process (winlogon.exe).
|
|
||||||
*
|
|
||||||
* TODO: this should be moved in CsrpCreateSession/x (one per session)
|
|
||||||
* TODO: in its own desktop (one logon desktop per winstation).
|
|
||||||
*/
|
|
||||||
static NTSTATUS
|
|
||||||
CsrpRunWinlogon (int argc, char ** argv, char ** envp)
|
|
||||||
{
|
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
|
||||||
UNICODE_STRING ImagePath;
|
|
||||||
UNICODE_STRING CommandLine;
|
|
||||||
PRTL_USER_PROCESS_PARAMETERS ProcessParameters = NULL;
|
|
||||||
RTL_USER_PROCESS_INFORMATION ProcessInfo;
|
|
||||||
|
|
||||||
|
|
||||||
DPRINT("CSR: %s called\n", __FUNCTION__);
|
|
||||||
if (g_ModernSm) return STATUS_SUCCESS;
|
|
||||||
|
|
||||||
/* initialize the process parameters */
|
|
||||||
RtlInitUnicodeString (& ImagePath, L"\\SystemRoot\\system32\\winlogon.exe");
|
|
||||||
RtlInitUnicodeString (& CommandLine, L"");
|
|
||||||
RtlCreateProcessParameters(& ProcessParameters,
|
|
||||||
& ImagePath,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
& CommandLine,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL);
|
|
||||||
/* Create the winlogon process */
|
|
||||||
Status = RtlCreateUserProcess (& ImagePath,
|
|
||||||
OBJ_CASE_INSENSITIVE,
|
|
||||||
ProcessParameters,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
FALSE,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
& ProcessInfo);
|
|
||||||
/* Cleanup */
|
|
||||||
RtlDestroyProcessParameters (ProcessParameters);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
DPRINT1("SM: %s: loading winlogon.exe failed (Status=%08lx)\n",
|
|
||||||
__FUNCTION__, Status);
|
|
||||||
}
|
|
||||||
|
|
||||||
ZwResumeThread(ProcessInfo.ThreadHandle, NULL);
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
static NTSTATUS
|
static NTSTATUS
|
||||||
CsrpCreateHardErrorPort (int argc, char ** argv, char ** envp)
|
CsrpCreateHardErrorPort (int argc, char ** argv, char ** envp)
|
||||||
{
|
{
|
||||||
|
@ -755,19 +496,15 @@ struct {
|
||||||
CSR_INIT_ROUTINE EntryPoint;
|
CSR_INIT_ROUTINE EntryPoint;
|
||||||
PCHAR ErrorMessage;
|
PCHAR ErrorMessage;
|
||||||
} InitRoutine [] = {
|
} InitRoutine [] = {
|
||||||
{TRUE, CsrpCreateBNODirectory, "create base named objects directory"},
|
{TRUE, CsrpCreateBNODirectory, "create base named objects directory"},
|
||||||
{TRUE, CsrpCreateHeap, "create the CSR heap"},
|
{TRUE, CsrpCreateHeap, "create the CSR heap"},
|
||||||
{TRUE, CsrpCreateApiPort, "create the api port \\Windows\\ApiPort"},
|
{TRUE, CsrpCreateApiPort, "create the api port \\Windows\\ApiPort"},
|
||||||
{TRUE, CsrpCreateHardErrorPort, "create the hard error port"},
|
{TRUE, CsrpCreateHardErrorPort, "create the hard error port"},
|
||||||
{TRUE, CsrpCreateObjectDirectory,"create the object directory \\Windows"},
|
{TRUE, CsrpCreateObjectDirectory,"create the object directory \\Windows"},
|
||||||
// {TRUE, CsrpLoadKernelModeDriver, "load Kmode driver"},
|
|
||||||
{TRUE, CsrpInitVideo, "initialize video"},
|
|
||||||
{TRUE, CsrpApiRegisterDef, "initialize api definitions"},
|
{TRUE, CsrpApiRegisterDef, "initialize api definitions"},
|
||||||
{TRUE, CsrpCCTS, "connect client to server"},
|
|
||||||
{TRUE, CsrpInitWin32Csr, "load usermode dll"},
|
{TRUE, CsrpInitWin32Csr, "load usermode dll"},
|
||||||
{TRUE, CsrpCreateCallbackPort, "create the callback port \\Windows\\SbApiPort"},
|
{TRUE, CsrpCreateCallbackPort, "create the callback port \\Windows\\SbApiPort"},
|
||||||
{TRUE, CsrpRegisterSubsystem, "register with SM"},
|
{TRUE, CsrpRegisterSubsystem, "register with SM"},
|
||||||
{TRUE, CsrpRunWinlogon, "run WinLogon"},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* PUBLIC FUNCTIONS ***********************************************************/
|
/* PUBLIC FUNCTIONS ***********************************************************/
|
||||||
|
@ -799,7 +536,6 @@ CsrServerInitialization(ULONG ArgumentCount,
|
||||||
}
|
}
|
||||||
if (CallInitComplete())
|
if (CallInitComplete())
|
||||||
{
|
{
|
||||||
Status = SmCompleteSession (hSmApiPort,hSbApiPort,hApiPort);
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -109,6 +109,149 @@ KeyboardHookProc(
|
||||||
return CallNextHookEx(hhk, nCode, wParam, lParam);
|
return CallNextHookEx(hhk, nCode, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ULONG
|
||||||
|
InitializeVideoAddressSpace(VOID)
|
||||||
|
{
|
||||||
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
|
UNICODE_STRING PhysMemName = RTL_CONSTANT_STRING(L"\\Device\\PhysicalMemory");
|
||||||
|
NTSTATUS Status;
|
||||||
|
HANDLE PhysMemHandle;
|
||||||
|
PVOID BaseAddress;
|
||||||
|
LARGE_INTEGER Offset;
|
||||||
|
SIZE_T ViewSize;
|
||||||
|
CHAR IVTAndBda[1024+256];
|
||||||
|
|
||||||
|
/* Free the 1MB pre-reserved region. In reality, ReactOS should simply support us mapping the view into the reserved area, but it doesn't. */
|
||||||
|
BaseAddress = 0;
|
||||||
|
ViewSize = 1024 * 1024;
|
||||||
|
Status = ZwFreeVirtualMemory(NtCurrentProcess(),
|
||||||
|
&BaseAddress,
|
||||||
|
&ViewSize,
|
||||||
|
MEM_RELEASE);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("Couldn't unmap reserved memory (%x)\n", Status);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Open the physical memory section */
|
||||||
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
|
&PhysMemName,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
NULL);
|
||||||
|
Status = ZwOpenSection(&PhysMemHandle,
|
||||||
|
SECTION_ALL_ACCESS,
|
||||||
|
&ObjectAttributes);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("Couldn't open \\Device\\PhysicalMemory\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Map the BIOS and device registers into the address space */
|
||||||
|
Offset.QuadPart = 0xa0000;
|
||||||
|
ViewSize = 0x100000 - 0xa0000;
|
||||||
|
BaseAddress = (PVOID)0xa0000;
|
||||||
|
Status = ZwMapViewOfSection(PhysMemHandle,
|
||||||
|
NtCurrentProcess(),
|
||||||
|
&BaseAddress,
|
||||||
|
0,
|
||||||
|
ViewSize,
|
||||||
|
&Offset,
|
||||||
|
&ViewSize,
|
||||||
|
ViewUnmap,
|
||||||
|
0,
|
||||||
|
PAGE_EXECUTE_READWRITE);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("Couldn't map physical memory (%x)\n", Status);
|
||||||
|
ZwClose(PhysMemHandle);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Close physical memory section handle */
|
||||||
|
ZwClose(PhysMemHandle);
|
||||||
|
|
||||||
|
if (BaseAddress != (PVOID)0xa0000)
|
||||||
|
{
|
||||||
|
DPRINT1("Couldn't map physical memory at the right address (was %x)\n",
|
||||||
|
BaseAddress);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Allocate some low memory to use for the non-BIOS
|
||||||
|
* parts of the v86 mode address space
|
||||||
|
*/
|
||||||
|
BaseAddress = (PVOID)0x1;
|
||||||
|
ViewSize = 0xa0000 - 0x1000;
|
||||||
|
Status = ZwAllocateVirtualMemory(NtCurrentProcess(),
|
||||||
|
&BaseAddress,
|
||||||
|
0,
|
||||||
|
&ViewSize,
|
||||||
|
MEM_RESERVE | MEM_COMMIT,
|
||||||
|
PAGE_EXECUTE_READWRITE);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("Failed to allocate virtual memory (Status %x)\n", Status);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (BaseAddress != (PVOID)0x0)
|
||||||
|
{
|
||||||
|
DPRINT1("Failed to allocate virtual memory at right address (was %x)\n",
|
||||||
|
BaseAddress);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get the real mode IVT and BDA from the kernel */
|
||||||
|
Status = NtVdmControl(VdmInitialize, IVTAndBda);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("NtVdmControl failed (status %x)\n", Status);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return success */
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
* CsrpInitVideo/3
|
||||||
|
*
|
||||||
|
* TODO: we need a virtual device for sessions other than
|
||||||
|
* TODO: the console one
|
||||||
|
*/
|
||||||
|
NTSTATUS
|
||||||
|
CsrpInitVideo (VOID)
|
||||||
|
{
|
||||||
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
|
UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\??\\DISPLAY1");
|
||||||
|
IO_STATUS_BLOCK Iosb;
|
||||||
|
HANDLE VideoHandle = (HANDLE) 0;
|
||||||
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
DPRINT("CSR: %s called\n", __FUNCTION__);
|
||||||
|
|
||||||
|
InitializeVideoAddressSpace();
|
||||||
|
|
||||||
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
|
&DeviceName,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
NULL);
|
||||||
|
Status = NtOpenFile(&VideoHandle,
|
||||||
|
FILE_ALL_ACCESS,
|
||||||
|
&ObjectAttributes,
|
||||||
|
&Iosb,
|
||||||
|
0,
|
||||||
|
0);
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
NtClose(VideoHandle);
|
||||||
|
}
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL WINAPI
|
||||||
DllMain(HANDLE hDll,
|
DllMain(HANDLE hDll,
|
||||||
DWORD dwReason,
|
DWORD dwReason,
|
||||||
|
@ -200,6 +343,8 @@ Win32CsrInitialization(PCSRSS_API_DEFINITION *ApiDefinitions,
|
||||||
|
|
||||||
CsrExports = *Exports;
|
CsrExports = *Exports;
|
||||||
Win32CsrApiHeap = CsrssApiHeap;
|
Win32CsrApiHeap = CsrssApiHeap;
|
||||||
|
|
||||||
|
CsrpInitVideo();
|
||||||
|
|
||||||
NtUserInitialize(0, NULL, NULL);
|
NtUserInitialize(0, NULL, NULL);
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,7 @@
|
||||||
#define WIN32_NO_STATUS
|
#define WIN32_NO_STATUS
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#define NTOS_MODE_USER
|
#define NTOS_MODE_USER
|
||||||
#include <ndk/mmtypes.h>
|
#include <ndk/ntndk.h>
|
||||||
#include <ndk/mmfuncs.h>
|
|
||||||
#include <ndk/obfuncs.h>
|
|
||||||
#include <ndk/umfuncs.h>
|
|
||||||
#include <psapi.h>
|
#include <psapi.h>
|
||||||
|
|
||||||
/* External Winlogon Header */
|
/* External Winlogon Header */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue