mirror of
https://github.com/reactos/reactos.git
synced 2024-09-12 05:43:24 +00:00
First draft of a ScmNamedPipeListenerThread implementation.
Some debug noise from winlogon and as always edited an ignore file. svn path=/trunk/; revision=3898
This commit is contained in:
parent
e464b1cd43
commit
70544cdae0
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: services.c,v 1.9 2002/10/20 14:54:34 ekohl Exp $
|
/* $Id: services.c,v 1.10 2002/12/27 13:54:28 robd Exp $
|
||||||
*
|
*
|
||||||
* service control manager
|
* service control manager
|
||||||
*
|
*
|
||||||
|
@ -53,14 +53,14 @@ void
|
||||||
PrintString(char* fmt,...)
|
PrintString(char* fmt,...)
|
||||||
{
|
{
|
||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
char buffer[512];
|
char buffer[512];
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
vsprintf(buffer, fmt, ap);
|
vsprintf(buffer, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
OutputDebugStringA(buffer);
|
OutputDebugStringA(buffer);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,169 +68,192 @@ PrintString(char* fmt,...)
|
||||||
BOOL
|
BOOL
|
||||||
ScmCreateStartEvent(PHANDLE StartEvent)
|
ScmCreateStartEvent(PHANDLE StartEvent)
|
||||||
{
|
{
|
||||||
HANDLE hEvent;
|
HANDLE hEvent;
|
||||||
|
|
||||||
hEvent = CreateEvent(NULL,
|
hEvent = CreateEvent(NULL,
|
||||||
TRUE,
|
TRUE,
|
||||||
FALSE,
|
FALSE,
|
||||||
_T("SvcctrlStartEvent_A3725DX"));
|
_T("SvcctrlStartEvent_A3725DX"));
|
||||||
if (hEvent == NULL)
|
if (hEvent == NULL) {
|
||||||
{
|
if (GetLastError() == ERROR_ALREADY_EXISTS) {
|
||||||
if (GetLastError() == ERROR_ALREADY_EXISTS)
|
hEvent = OpenEvent(EVENT_ALL_ACCESS,
|
||||||
{
|
FALSE,
|
||||||
hEvent = OpenEvent(EVENT_ALL_ACCESS,
|
_T("SvcctrlStartEvent_A3725DX"));
|
||||||
FALSE,
|
if (hEvent == NULL) {
|
||||||
_T("SvcctrlStartEvent_A3725DX"));
|
return FALSE;
|
||||||
if (hEvent == NULL)
|
}
|
||||||
{
|
} else {
|
||||||
return(FALSE);
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return(FALSE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
*StartEvent = hEvent;
|
||||||
*StartEvent = hEvent;
|
return TRUE;
|
||||||
|
|
||||||
return(TRUE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
ScmNamedPipeHandleRequest(
|
ScmNamedPipeHandleRequest(
|
||||||
PVOID Request,
|
PVOID Request,
|
||||||
DWORD RequestSize,
|
DWORD RequestSize,
|
||||||
PVOID Reply,
|
PVOID Reply,
|
||||||
LPDWORD ReplySize)
|
LPDWORD ReplySize)
|
||||||
{
|
{
|
||||||
DbgPrint("SCM READ: %s\n", Request);
|
DbgPrint("SCM READ: %s\n", Request);
|
||||||
|
|
||||||
*ReplySize = 0;
|
*ReplySize = 0;
|
||||||
|
return FALSE;
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DWORD
|
DWORD
|
||||||
WINAPI
|
WINAPI
|
||||||
ScmNamedPipeThread(
|
ScmNamedPipeThread(LPVOID Context)
|
||||||
LPVOID Context)
|
|
||||||
{
|
{
|
||||||
CHAR chRequest[PIPE_BUFSIZE];
|
CHAR chRequest[PIPE_BUFSIZE];
|
||||||
CHAR chReply[PIPE_BUFSIZE];
|
CHAR chReply[PIPE_BUFSIZE];
|
||||||
DWORD cbReplyBytes;
|
DWORD cbReplyBytes;
|
||||||
DWORD cbBytesRead;
|
DWORD cbBytesRead;
|
||||||
DWORD cbWritten;
|
DWORD cbWritten;
|
||||||
BOOL fSuccess;
|
BOOL fSuccess;
|
||||||
HANDLE hPipe;
|
HANDLE hPipe;
|
||||||
|
|
||||||
DPRINT("Accepting SCM commands through named pipe\n");
|
hPipe = (HANDLE)Context;
|
||||||
|
|
||||||
hPipe = (HANDLE)Context;
|
DPRINT("ScmNamedPipeThread(%x) - Accepting SCM commands through named pipe\n", hPipe);
|
||||||
|
|
||||||
for (;;)
|
for (;;) {
|
||||||
{
|
fSuccess = ReadFile(hPipe,
|
||||||
fSuccess = ReadFile(
|
&chRequest,
|
||||||
hPipe,
|
PIPE_BUFSIZE,
|
||||||
&chRequest,
|
&cbBytesRead,
|
||||||
PIPE_BUFSIZE,
|
NULL);
|
||||||
&cbBytesRead,
|
if (!fSuccess || cbBytesRead == 0) {
|
||||||
NULL);
|
break;
|
||||||
if (!fSuccess || cbBytesRead == 0)
|
}
|
||||||
{
|
if (ScmNamedPipeHandleRequest(&chRequest, cbBytesRead, &chReply, &cbReplyBytes)) {
|
||||||
break;
|
fSuccess = WriteFile(hPipe,
|
||||||
|
&chReply,
|
||||||
|
cbReplyBytes,
|
||||||
|
&cbWritten,
|
||||||
|
NULL);
|
||||||
|
if (!fSuccess || cbReplyBytes != cbWritten) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
DPRINT("ScmNamedPipeThread(%x) - Disconnecting named pipe connection\n", hPipe);
|
||||||
if (ScmNamedPipeHandleRequest(&chRequest, cbBytesRead, &chReply, &cbReplyBytes))
|
FlushFileBuffers(hPipe);
|
||||||
{
|
DisconnectNamedPipe(hPipe);
|
||||||
fSuccess = WriteFile(
|
CloseHandle(hPipe);
|
||||||
hPipe,
|
DPRINT("ScmNamedPipeThread(%x) - Done.\n", hPipe);
|
||||||
&chReply,
|
return ERROR_SUCCESS;
|
||||||
cbReplyBytes,
|
|
||||||
&cbWritten,
|
|
||||||
NULL);
|
|
||||||
if (!fSuccess || cbReplyBytes != cbWritten)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FlushFileBuffers(hPipe);
|
|
||||||
DisconnectNamedPipe(hPipe);
|
|
||||||
CloseHandle(hPipe);
|
|
||||||
|
|
||||||
return ERROR_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL ScmCreateNamedPipe(VOID)
|
BOOL ScmCreateNamedPipe(VOID)
|
||||||
{
|
{
|
||||||
DWORD dwThreadId;
|
DWORD dwThreadId;
|
||||||
BOOL fConnected;
|
BOOL fConnected;
|
||||||
HANDLE hThread;
|
HANDLE hThread;
|
||||||
HANDLE hPipe;
|
HANDLE hPipe;
|
||||||
|
|
||||||
hPipe = CreateNamedPipe("\\\\.\\pipe\\Ntsvcs",
|
DPRINT("ScmCreateNamedPipe() - CreateNamedPipe(\"\\\\.\\pipe\\Ntsvcs\")\n");
|
||||||
PIPE_ACCESS_DUPLEX,
|
|
||||||
PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT,
|
hPipe = CreateNamedPipe("\\\\.\\pipe\\Ntsvcs",
|
||||||
PIPE_UNLIMITED_INSTANCES,
|
PIPE_ACCESS_DUPLEX,
|
||||||
PIPE_BUFSIZE,
|
PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT,
|
||||||
PIPE_BUFSIZE,
|
PIPE_UNLIMITED_INSTANCES,
|
||||||
PIPE_TIMEOUT,
|
PIPE_BUFSIZE,
|
||||||
NULL);
|
PIPE_BUFSIZE,
|
||||||
if (hPipe == INVALID_HANDLE_VALUE)
|
PIPE_TIMEOUT,
|
||||||
{
|
NULL);
|
||||||
DPRINT("CreateNamedPipe() failed (%d)\n", GetLastError());
|
if (hPipe == INVALID_HANDLE_VALUE) {
|
||||||
return(FALSE);
|
DPRINT("CreateNamedPipe() failed (%d)\n", GetLastError());
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
fConnected = ConnectNamedPipe(hPipe,
|
DPRINT("CreateNamedPipe() - calling ConnectNamedPipe(%x)\n", hPipe);
|
||||||
NULL) ? TRUE : (GetLastError() == ERROR_PIPE_CONNECTED);
|
fConnected = ConnectNamedPipe(hPipe,
|
||||||
if (fConnected)
|
NULL) ? TRUE : (GetLastError() == ERROR_PIPE_CONNECTED);
|
||||||
{
|
DPRINT("CreateNamedPipe() - ConnectNamedPipe() returned %d\n", fConnected);
|
||||||
DPRINT("Pipe connected\n");
|
|
||||||
|
|
||||||
hThread = CreateThread(NULL,
|
if (fConnected) {
|
||||||
0,
|
DPRINT("Pipe connected\n");
|
||||||
ScmNamedPipeThread,
|
hThread = CreateThread(NULL,
|
||||||
(LPVOID)hPipe,
|
0,
|
||||||
0,
|
ScmNamedPipeThread,
|
||||||
&dwThreadId);
|
(LPVOID)hPipe,
|
||||||
if (!hThread)
|
0,
|
||||||
{
|
&dwThreadId);
|
||||||
DPRINT("Could not create thread (%d)\n", GetLastError());
|
if (!hThread) {
|
||||||
|
DPRINT("Could not create thread (%d)\n", GetLastError());
|
||||||
DisconnectNamedPipe(hPipe);
|
DisconnectNamedPipe(hPipe);
|
||||||
CloseHandle(hPipe);
|
CloseHandle(hPipe);
|
||||||
return(FALSE);
|
DPRINT("CreateNamedPipe() - returning FALSE\n");
|
||||||
}
|
return FALSE;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
DPRINT("Pipe not connected\n");
|
||||||
|
CloseHandle(hPipe);
|
||||||
|
DPRINT("CreateNamedPipe() - returning FALSE\n");
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
else
|
DPRINT("CreateNamedPipe() - returning TRUE\n");
|
||||||
{
|
return TRUE;
|
||||||
DPRINT("Pipe not connected\n");
|
|
||||||
|
|
||||||
CloseHandle(hPipe);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DWORD
|
||||||
|
WINAPI
|
||||||
|
ScmNamedPipeListenerThread(LPVOID Context)
|
||||||
|
{
|
||||||
|
// HANDLE hPipe;
|
||||||
|
DPRINT("ScmNamedPipeListenerThread(%x) - aka SCM.\n", Context);
|
||||||
|
|
||||||
|
// hPipe = (HANDLE)Context;
|
||||||
|
for (;;) {
|
||||||
|
PrintString("SCM: Waiting for connection on named pipe...\n");
|
||||||
|
/* Create named pipe */
|
||||||
|
if (!ScmCreateNamedPipe()) {
|
||||||
|
PrintString("\nSCM: Failed to create named pipe\n");
|
||||||
|
break;
|
||||||
|
//ExitThread(0);
|
||||||
|
}
|
||||||
|
PrintString("\nSCM: named pipe session created.\n");
|
||||||
|
Sleep(10);
|
||||||
|
}
|
||||||
|
DPRINT("\n\nWARNING: ScmNamedPipeListenerThread(%x) - Aborted.\n\n", Context);
|
||||||
|
return ERROR_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL StartScmNamedPipeThreadListener(void)
|
||||||
|
{
|
||||||
|
DWORD dwThreadId;
|
||||||
|
HANDLE hThread;
|
||||||
|
|
||||||
|
hThread = CreateThread(NULL,
|
||||||
|
0,
|
||||||
|
ScmNamedPipeListenerThread,
|
||||||
|
NULL, /*(LPVOID)hPipe,*/
|
||||||
|
0,
|
||||||
|
&dwThreadId);
|
||||||
|
|
||||||
|
if (!hThread) {
|
||||||
|
PrintString("SERVICES: Could not create thread (Status %lx)\n", GetLastError());
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
int STDCALL
|
int STDCALL
|
||||||
WinMain(HINSTANCE hInstance,
|
WinMain(HINSTANCE hInstance,
|
||||||
HINSTANCE hPrevInstance,
|
HINSTANCE hPrevInstance,
|
||||||
LPSTR lpCmdLine,
|
LPSTR lpCmdLine,
|
||||||
int nShowCmd)
|
int nShowCmd)
|
||||||
{
|
{
|
||||||
HANDLE hScmStartEvent;
|
HANDLE hScmStartEvent;
|
||||||
HANDLE hEvent;
|
HANDLE hEvent;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
PrintString("Service Control Manager\n");
|
PrintString("SERVICES: Service Control Manager\n");
|
||||||
|
|
||||||
/* Create start event */
|
/* Create start event */
|
||||||
if (!ScmCreateStartEvent(&hScmStartEvent))
|
if (!ScmCreateStartEvent(&hScmStartEvent))
|
||||||
|
@ -239,6 +262,7 @@ WinMain(HINSTANCE hInstance,
|
||||||
ExitThread(0);
|
ExitThread(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PrintString("SERVICES: created start event with handle %x.\n", hScmStartEvent);
|
||||||
|
|
||||||
/* FIXME: more initialization */
|
/* FIXME: more initialization */
|
||||||
|
|
||||||
|
@ -247,7 +271,7 @@ WinMain(HINSTANCE hInstance,
|
||||||
Status = ScmCreateServiceDataBase();
|
Status = ScmCreateServiceDataBase();
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
PrintString("ScmCreateServiceDataBase() failed (Status %lx)\n", Status);
|
PrintString("SERVICES: failed to create SCM database (Status %lx)\n", Status);
|
||||||
ExitThread(0);
|
ExitThread(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,12 +279,20 @@ WinMain(HINSTANCE hInstance,
|
||||||
ScmGetBootAndSystemDriverState();
|
ScmGetBootAndSystemDriverState();
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* Create named pipe */
|
PrintString("SERVICES: Attempting to create named pipe...\n");
|
||||||
if (!ScmCreateNamedPipe())
|
/* Create named pipe */
|
||||||
{
|
if (!ScmCreateNamedPipe()) {
|
||||||
PrintString("SERVICES: Failed to create named pipe\n");
|
PrintString("SERVICES: Failed to create named pipe\n");
|
||||||
ExitThread(0);
|
ExitThread(0);
|
||||||
}
|
}
|
||||||
|
PrintString("SERVICES: named pipe created successfully.\n");
|
||||||
|
#else
|
||||||
|
PrintString("SERVICES: Attempting to create named pipe listener...\n");
|
||||||
|
if (!StartScmNamedPipeThreadListener()) {
|
||||||
|
PrintString("SERVICES: Failed to create named pipe listener thread.\n");
|
||||||
|
ExitThread(0);
|
||||||
|
}
|
||||||
|
PrintString("SERVICES: named pipe listener thread created.\n");
|
||||||
#endif
|
#endif
|
||||||
/* FIXME: create listener thread for pipe */
|
/* FIXME: create listener thread for pipe */
|
||||||
|
|
||||||
|
@ -285,12 +317,13 @@ WinMain(HINSTANCE hInstance,
|
||||||
|
|
||||||
PrintString("SERVICES: Running.\n");
|
PrintString("SERVICES: Running.\n");
|
||||||
|
|
||||||
|
#if 1
|
||||||
hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
|
hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||||
WaitForSingleObject(hEvent, INFINITE);
|
WaitForSingleObject(hEvent, INFINITE);
|
||||||
#if 0
|
#else
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
NtYieldExecution();
|
NtYieldExecution();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: winlogon.c,v 1.12 2002/09/08 10:23:48 chorns Exp $
|
/* $Id: winlogon.c,v 1.13 2002/12/27 13:54:28 robd Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
|
|
||||||
#define NDEBUG
|
#define DBG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
/* GLOBALS ******************************************************************/
|
/* GLOBALS ******************************************************************/
|
||||||
|
@ -64,39 +64,51 @@ BOOLEAN StartServices(VOID)
|
||||||
StartupInfo.cbReserved2 = 0;
|
StartupInfo.cbReserved2 = 0;
|
||||||
StartupInfo.lpReserved2 = 0;
|
StartupInfo.lpReserved2 = 0;
|
||||||
|
|
||||||
|
PrintString("WL: Creating new process - \"services.exe\".\n");
|
||||||
|
|
||||||
Result = CreateProcess(CommandLine,
|
Result = CreateProcess(CommandLine,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
FALSE,
|
FALSE,
|
||||||
DETACHED_PROCESS,
|
DETACHED_PROCESS,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
&StartupInfo,
|
&StartupInfo,
|
||||||
&ProcessInformation);
|
&ProcessInformation);
|
||||||
if (!Result)
|
if (!Result)
|
||||||
{
|
{
|
||||||
PrintString("WL: Failed to execute services\n");
|
PrintString("WL: Failed to execute services\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* wait for event creation (by SCM) for max. 20 seconds */
|
/* wait for event creation (by SCM) for max. 20 seconds */
|
||||||
for (Count = 0; Count < 20; Count++)
|
for (Count = 0; Count < 20; Count++)
|
||||||
{
|
{
|
||||||
Sleep(1000);
|
Sleep(1000);
|
||||||
|
|
||||||
ServicesInitEvent = OpenEvent(EVENT_ALL_ACCESS, //SYNCHRONIZE,
|
//DbgPrint("WL: Attempting to open event \"SvcctrlStartEvent_A3725DX\"\n");
|
||||||
FALSE,
|
ServicesInitEvent = OpenEvent(EVENT_ALL_ACCESS, //SYNCHRONIZE,
|
||||||
"SvcctrlStartEvent_A3725DX");
|
FALSE,
|
||||||
if (ServicesInitEvent != NULL)
|
"SvcctrlStartEvent_A3725DX");
|
||||||
{
|
if (ServicesInitEvent != NULL)
|
||||||
break;
|
{
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ServicesInitEvent == NULL)
|
||||||
|
{
|
||||||
|
DbgPrint("WL: Failed to open event \"SvcctrlStartEvent_A3725DX\"\n");
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* wait for event signalization */
|
/* wait for event signalization */
|
||||||
|
//DbgPrint("WL: Waiting forever on event handle: %x\n", ServicesInitEvent);
|
||||||
WaitForSingleObject(ServicesInitEvent, INFINITE);
|
WaitForSingleObject(ServicesInitEvent, INFINITE);
|
||||||
|
//DbgPrint("WL: Closing event object \"SvcctrlStartEvent_A3725DX\"\n");
|
||||||
CloseHandle(ServicesInitEvent);
|
CloseHandle(ServicesInitEvent);
|
||||||
|
DbgPrint("WL: StartServices() Done.\n");
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -110,14 +122,14 @@ BOOLEAN StartLsass(VOID)
|
||||||
CHAR CommandLine[MAX_PATH];
|
CHAR CommandLine[MAX_PATH];
|
||||||
|
|
||||||
LsassInitEvent = CreateEvent(NULL,
|
LsassInitEvent = CreateEvent(NULL,
|
||||||
TRUE,
|
TRUE,
|
||||||
FALSE,
|
FALSE,
|
||||||
"\\LsassInitDone");
|
"\\LsassInitDone");
|
||||||
|
|
||||||
if (LsassInitEvent == NULL)
|
if (LsassInitEvent == NULL)
|
||||||
{
|
{
|
||||||
DbgPrint("Failed to create lsass notification event\n");
|
DbgPrint("WL: Failed to create lsass notification event\n");
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Start the local security authority subsystem (lsass.exe) */
|
/* Start the local security authority subsystem (lsass.exe) */
|
||||||
|
@ -134,19 +146,19 @@ BOOLEAN StartLsass(VOID)
|
||||||
StartupInfo.lpReserved2 = 0;
|
StartupInfo.lpReserved2 = 0;
|
||||||
|
|
||||||
Result = CreateProcess(CommandLine,
|
Result = CreateProcess(CommandLine,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
FALSE,
|
FALSE,
|
||||||
DETACHED_PROCESS,
|
DETACHED_PROCESS,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
&StartupInfo,
|
&StartupInfo,
|
||||||
&ProcessInformation);
|
&ProcessInformation);
|
||||||
if (!Result)
|
if (!Result)
|
||||||
{
|
{
|
||||||
DbgPrint("WL: Failed to execute lsass\n");
|
DbgPrint("WL: Failed to execute lsass\n");
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT("WL: Waiting for lsass\n");
|
DPRINT("WL: Waiting for lsass\n");
|
||||||
|
@ -178,19 +190,19 @@ VOID DoLoginUser(PCHAR Name, PCHAR Password)
|
||||||
StartupInfo.lpReserved2 = 0;
|
StartupInfo.lpReserved2 = 0;
|
||||||
|
|
||||||
Result = CreateProcess(CommandLine,
|
Result = CreateProcess(CommandLine,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
FALSE,
|
FALSE,
|
||||||
DETACHED_PROCESS,
|
DETACHED_PROCESS,
|
||||||
NULL,
|
NULL,
|
||||||
CurrentDirectory,
|
CurrentDirectory,
|
||||||
&StartupInfo,
|
&StartupInfo,
|
||||||
&ProcessInformation);
|
&ProcessInformation);
|
||||||
if (!Result)
|
if (!Result)
|
||||||
{
|
{
|
||||||
DbgPrint("WL: Failed to execute user shell\n");
|
DbgPrint("WL: Failed to execute user shell\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
WaitForSingleObject(ProcessInformation.hProcess, INFINITE);
|
WaitForSingleObject(ProcessInformation.hProcess, INFINITE);
|
||||||
CloseHandle( ProcessInformation.hProcess );
|
CloseHandle( ProcessInformation.hProcess );
|
||||||
|
@ -199,9 +211,9 @@ VOID DoLoginUser(PCHAR Name, PCHAR Password)
|
||||||
|
|
||||||
int STDCALL
|
int STDCALL
|
||||||
WinMain(HINSTANCE hInstance,
|
WinMain(HINSTANCE hInstance,
|
||||||
HINSTANCE hPrevInstance,
|
HINSTANCE hPrevInstance,
|
||||||
LPSTR lpCmdLine,
|
LPSTR lpCmdLine,
|
||||||
int nShowCmd)
|
int nShowCmd)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
LSA_STRING ProcessName;
|
LSA_STRING ProcessName;
|
||||||
|
@ -230,7 +242,7 @@ WinMain(HINSTANCE hInstance,
|
||||||
CreateWindowStationW(L"WinSta0", 0, GENERIC_ALL, NULL);
|
CreateWindowStationW(L"WinSta0", 0, GENERIC_ALL, NULL);
|
||||||
if (InteractiveWindowStation == NULL)
|
if (InteractiveWindowStation == NULL)
|
||||||
{
|
{
|
||||||
DbgPrint("Failed to create window station (0x%X)\n", GetLastError());
|
DbgPrint("WL: Failed to create window station (0x%X)\n", GetLastError());
|
||||||
NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED, 0, 0, 0, 0, 0);
|
NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED, 0, 0, 0, 0, 0);
|
||||||
ExitProcess(1);
|
ExitProcess(1);
|
||||||
}
|
}
|
||||||
|
@ -245,40 +257,40 @@ WinMain(HINSTANCE hInstance,
|
||||||
*/
|
*/
|
||||||
ApplicationDesktop =
|
ApplicationDesktop =
|
||||||
CreateDesktopW(L"Default",
|
CreateDesktopW(L"Default",
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
0, /* FIXME: Set some flags */
|
0, /* FIXME: Set some flags */
|
||||||
GENERIC_ALL,
|
GENERIC_ALL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create the winlogon desktop
|
* Create the winlogon desktop
|
||||||
*/
|
*/
|
||||||
WinlogonDesktop = CreateDesktopW(L"Winlogon",
|
WinlogonDesktop = CreateDesktopW(L"Winlogon",
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
0, /* FIXME: Set some flags */
|
0, /* FIXME: Set some flags */
|
||||||
GENERIC_ALL,
|
GENERIC_ALL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create the screen saver desktop
|
* Create the screen saver desktop
|
||||||
*/
|
*/
|
||||||
ScreenSaverDesktop = CreateDesktopW(L"Screen-Saver",
|
ScreenSaverDesktop = CreateDesktopW(L"Screen-Saver",
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
0, /* FIXME: Set some flags */
|
0, /* FIXME: Set some flags */
|
||||||
GENERIC_ALL,
|
GENERIC_ALL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Switch to winlogon desktop
|
* Switch to winlogon desktop
|
||||||
*/
|
*/
|
||||||
/* FIXME: Do start up in the application desktop for now. */
|
/* FIXME: Do start up in the application desktop for now. */
|
||||||
Status = NtSetInformationProcess(NtCurrentProcess(),
|
Status = NtSetInformationProcess(NtCurrentProcess(),
|
||||||
ProcessDesktop,
|
ProcessDesktop,
|
||||||
&ApplicationDesktop,
|
&ApplicationDesktop,
|
||||||
sizeof(ApplicationDesktop));
|
sizeof(ApplicationDesktop));
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DbgPrint("WL: Cannot set default desktop for winlogon.\n");
|
DbgPrint("WL: Cannot set default desktop for winlogon.\n");
|
||||||
|
@ -287,15 +299,23 @@ WinMain(HINSTANCE hInstance,
|
||||||
Success = SwitchDesktop(ApplicationDesktop);
|
Success = SwitchDesktop(ApplicationDesktop);
|
||||||
if (!Success)
|
if (!Success)
|
||||||
{
|
{
|
||||||
DbgPrint("Cannot switch to Winlogon desktop (0x%X)\n", GetLastError());
|
DbgPrint("WL: Cannot switch to Winlogon desktop (0x%X)\n", GetLastError());
|
||||||
}
|
}
|
||||||
|
|
||||||
AllocConsole();
|
AllocConsole();
|
||||||
SetConsoleTitle( "Winlogon" );
|
SetConsoleTitle( "Winlogon" );
|
||||||
/* start system processes (services.exe & lsass.exe) */
|
/* start system processes (services.exe & lsass.exe) */
|
||||||
StartServices();
|
Success = StartServices();
|
||||||
|
if (!Success)
|
||||||
|
{
|
||||||
|
DbgPrint("WL: Failed to Start Services (0x%X)\n", GetLastError());
|
||||||
|
}
|
||||||
#if 0
|
#if 0
|
||||||
StartLsass();
|
Success = StartLsass();
|
||||||
|
if (!Success)
|
||||||
|
{
|
||||||
|
DbgPrint("WL: Failed to Start Security System (0x%X)\n", GetLastError());
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* FIXME: What name does the real WinLogon use? */
|
/* FIXME: What name does the real WinLogon use? */
|
||||||
|
@ -304,8 +324,8 @@ WinMain(HINSTANCE hInstance,
|
||||||
Status = LsaRegisterLogonProcess(&ProcessName, &LsaHandle, &Mode);
|
Status = LsaRegisterLogonProcess(&ProcessName, &LsaHandle, &Mode);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DbgPrint("WL: Failed to connect to lsass\n");
|
DbgPrint("WL: Failed to connect to lsass\n");
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -321,38 +341,38 @@ WinMain(HINSTANCE hInstance,
|
||||||
#if 0
|
#if 0
|
||||||
/* Display login prompt */
|
/* Display login prompt */
|
||||||
WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE),
|
WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE),
|
||||||
LoginPrompt,
|
LoginPrompt,
|
||||||
strlen(LoginPrompt), // wcslen(LoginPrompt),
|
strlen(LoginPrompt), // wcslen(LoginPrompt),
|
||||||
&Result,
|
&Result,
|
||||||
NULL);
|
NULL);
|
||||||
i = 0;
|
i = 0;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
ReadConsole(GetStdHandle(STD_INPUT_HANDLE),
|
ReadConsole(GetStdHandle(STD_INPUT_HANDLE),
|
||||||
&LoginName[i],
|
&LoginName[i],
|
||||||
1,
|
1,
|
||||||
&Result,
|
&Result,
|
||||||
NULL);
|
NULL);
|
||||||
i++;
|
i++;
|
||||||
} while (LoginName[i - 1] != '\n');
|
} while (LoginName[i - 1] != '\n');
|
||||||
LoginName[i - 1] = 0;
|
LoginName[i - 1] = 0;
|
||||||
|
|
||||||
/* Display password prompt */
|
/* Display password prompt */
|
||||||
WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE),
|
WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE),
|
||||||
PasswordPrompt,
|
PasswordPrompt,
|
||||||
strlen(PasswordPrompt), // wcslen(PasswordPrompt),
|
strlen(PasswordPrompt), // wcslen(PasswordPrompt),
|
||||||
&Result,
|
&Result,
|
||||||
NULL);
|
NULL);
|
||||||
i = 0;
|
i = 0;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
ReadConsole(GetStdHandle(STD_INPUT_HANDLE),
|
ReadConsole(GetStdHandle(STD_INPUT_HANDLE),
|
||||||
&Password[i],
|
&Password[i],
|
||||||
1,
|
1,
|
||||||
&Result,
|
&Result,
|
||||||
NULL);
|
NULL);
|
||||||
i++;
|
i++;
|
||||||
} while (Password[i - 1] != '\n');
|
} while (Password[i - 1] != '\n');
|
||||||
Password[i - 1] =0;
|
Password[i - 1] =0;
|
||||||
#endif
|
#endif
|
||||||
DoLoginUser(LoginName, Password);
|
DoLoginUser(LoginName, Password);
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
base.tmp
|
base.tmp
|
||||||
junk.tmp
|
junk.tmp
|
||||||
temp.exp
|
temp.exp
|
||||||
win32k.coff
|
|
||||||
win32k.sys
|
win32k.sys
|
||||||
|
win32k.nostrip.sys
|
||||||
|
win32k.coff
|
||||||
|
win32k.sym
|
||||||
*.d
|
*.d
|
||||||
*.o
|
*.o
|
||||||
*.sym
|
|
||||||
|
|
Loading…
Reference in a new issue