Updated CREDITS

Work on security
Updated heap code from wine implementation
Implemented kernel/user shared data page

svn path=/trunk/; revision=1297
This commit is contained in:
David Welch 2000-08-12 19:33:23 +00:00
parent 70a09d673c
commit 3ae3b46dcd
29 changed files with 1725 additions and 654 deletions

View file

@ -12,3 +12,10 @@ Jason Filby (jasonfilby@yahoo.com)
Brian Palmer (brianp@sginet.com)
Phillip Susi (phreak@iag.net)
Paolo Pantaleo (paolopan@freemail.it)
Casper S. Hornstrup (chorns@users.sourceforge.net)
Source and inspiration from
WINE (http://www.winehq.com)
WinFree (http://www.stack.nl/~onno/win32/)
Linux (http://www.kernel.org)

View file

@ -6,7 +6,7 @@
# Select your host
#
#HOST = mingw32-linux
#HOST = mingw32-windows
HOST = mingw32-windows
include rules.mak
@ -14,7 +14,7 @@ include rules.mak
# Required to run the system
#
COMPONENTS = iface_native iface_additional ntoskrnl
DLLS = ntdll kernel32 crtdll advapi32 fmifs gdi32
DLLS = ntdll kernel32 crtdll advapi32 fmifs gdi32 secur32
SUBSYS = smss win32k csrss
#
@ -44,7 +44,7 @@ NET_DRIVERS = ndis tcpip tditest
KERNEL_SERVICES = $(DEVICE_DRIVERS) $(FS_DRIVERS) $(NET_DRIVERS)
APPS = args hello shell test cat bench apc shm lpc thread event file gditest \
pteb consume
pteb consume dump_shared_data
# objdir

View file

@ -0,0 +1,130 @@
/* $Id: lsass.h,v 1.1 2000/08/12 19:33:18 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: include/lsass/lsass.h
* PURPOSE: LSASS API declarations
* UPDATE HISTORY:
* Created 05/08/00
*/
#ifndef __INCLUDE_LSASS_LSASS_H
#define __INCLUDE_LSASS_LSASS_H
#include <ntos.h>
#include <lsass/ntsecapi.h>
#include <napi/lpc.h>
#define LSASS_REQUEST_REGISTER_LOGON_PROCESS (1)
#define LSASS_REQUEST_CALL_AUTHENTICATION_PACKAGE (2)
#define LSASS_REQUEST_DEREGISTER_LOGON_PROCESS (3)
#define LSASS_REQUEST_LOGON_USER (4)
#define LSASS_REQUEST_LOOKUP_AUTHENTICATION_PACKAGE (5)
#define LSASS_REQUEST_MAXIMUM (6)
typedef struct _LSASS_LOOKUP_AUTHENTICATION_PACKAGE_REQUEST
{
ULONG PackageNameLength;
WCHAR PackageName[0];
} LSASS_LOOKUP_AUTHENTICATION_PACKAGE_REQUEST,
*PLSASS_LOOKUP_AUTHENTICATION_PACKAGE_REQUEST;
typedef struct _LSASS_LOOKUP_AUTHENTICATION_PACKAGE_REPLY
{
ULONG Package;
} LSASS_LOOKUP_AUTHENTICATION_PACKAGE_REPLY,
*PLSASS_LOOKUP_AUTHENTICATION_PACKAGE_REPLY;
typedef struct _LSASS_DEREGISTER_LOGON_PROCESS_REQUEST
{
} LSASS_DEREGISTER_LOGON_PROCESS_REQUEST,
*PLSASS_DEREGISTER_LOGON_PROCES_REQUEST;
typedef struct _LSASS_DEREGISTER_LOGON_PROCESS_REPLY
{
} LSASS_DEREGISTER_LOGON_PROCESS_REPLY,
*PLSASS_DEREGISTER_LOGON_PROCESS_REPLY;
typedef struct _LSASS_CALL_AUTHENTICATION_PACKAGE_REQUEST
{
ULONG AuthenticationPackage;
ULONG InBufferLength;
UCHAR InBuffer[0];
} LSASS_CALL_AUTHENTICATION_PACKAGE_REQUEST,
*PLSASS_CALL_AUTHENTICATION_PACKAGE_REQUEST;
typedef struct _LSASS_CALL_AUTHENTICATION_PACKAGE_REPLY
{
ULONG OutBufferLength;
UCHAR OutBuffer[0];
} LSASS_CALL_AUTHENTICATION_PACKAGE_REPLY,
*PLSASS_CALL_AUTHENTICATION_PACKAGE_REPLY;
typedef struct _LSASS_LOGON_USER_REQUEST
{
ULONG OriginNameLength;
PWSTR OriginName;
SECURITY_LOGON_TYPE LogonType;
ULONG AuthenticationPackage;
PVOID AuthenticationInformation;
ULONG AuthenticationInformationLength;
ULONG LocalGroupsCount;
PSID_AND_ATTRIBUTES LocalGroups;
TOKEN_SOURCE SourceContext;
UCHAR Data[1];
} LSASS_LOGON_USER_REQUEST, *PLSASS_LOGON_USER_REQUEST;
typedef struct _LSASS_LOGON_USER_REPLY
{
PVOID ProfileBuffer;
ULONG ProfileBufferLength;
LUID LogonId;
HANDLE Token;
QUOTA_LIMITS Quotas;
NTSTATUS SubStatus;
UCHAR Data[1];
} LSASS_LOGON_USER_REPLY, *PLSASS_LOGON_USER_REPLY;
typedef struct _LSASS_REGISTER_LOGON_PROCESS_REQUEST
{
ULONG Length;
WCHAR LogonProcessNameBuffer[127];
} LSASS_REGISTER_LOGON_PROCESS_REQUEST, *PLSASS_REGISTER_LOGON_PROCESS_REQUEST;
typedef struct _LSASS_REGISTER_LOGON_PROCESS_REPLY
{
LSA_OPERATIONAL_MODE OperationalMode;
} LSASS_REGISTER_LOGON_PROCESS_REPLY, *PLSASS_REGISTER_LOGON_PROCESS_REPLY;
typedef struct _LSASS_REQUEST
{
LPC_MESSAGE_HEADER Header;
ULONG Type;
union
{
LSASS_REGISTER_LOGON_PROCESS_REQUEST RegisterLogonProcessRequest;
LSASS_LOGON_USER_REQUEST LogonUserRequest;
LSASS_CALL_AUTHENTICATION_PACKAGE_REQUEST
CallAuthenticationPackageRequest;
LSASS_DEREGISTER_LOGON_PROCESS_REPLY DeregisterLogonProcessRequest;
LSASS_LOOKUP_AUTHENTICATION_PACKAGE_REQUEST
LookupAuthenticationPackageRequest;
} d;
} LSASS_REQUEST, *PLSASS_REQUEST;
typedef struct _LSASS_REPLY
{
LPC_MESSAGE_HEADER Header;
NTSTATUS Status;
union
{
LSASS_REGISTER_LOGON_PROCESS_REPLY RegisterLogonProcessReply;
LSASS_LOGON_USER_REPLY LogonUserReply;
LSASS_CALL_AUTHENTICATION_PACKAGE_REPLY CallAuthenticationPackageReply;
LSASS_DEREGISTER_LOGON_PROCESS_REPLY DeregisterLogonProcessReply;
LSASS_LOOKUP_AUTHENTICATION_PACKAGE_REPLY
LookupAuthenticationPackageReply;
} d;
} LSASS_REPLY, *PLSASS_REPLY;
#endif /* __INCLUDE_LSASS_LSASS_H */

View file

@ -0,0 +1,32 @@
/* $Id: ntsecapi.h,v 1.1 2000/08/12 19:33:18 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: include/lsass/ntsecpai.h
* PURPOSE: LSASS API declarations
* UPDATE HISTORY:
* Created 05/08/00
*/
#ifndef __INCLUDE_LSASS_NTSECAPI_H
#define __INCLUDE_LSASS_NTSECAPI_H
#define SECURITY_LOGON_INTERACTIVE (2)
#define SECURITY_LOGON_NETWORK (3)
#define SECURITY_LOGON_BATCH (4)
#define SECURITY_LOGON_SERVICE (5)
#define SECURITY_LOGON_PROXY (6)
#define SECURITY_LOGON_UNLOCK (7)
typedef ULONG SECURITY_LOGON_TYPE;
typedef struct _LSA_STRING
{
USHORT Length;
USHORT MaximumLength;
PWSTR Buffer;
} LSA_STRING, *PLSA_STRING;
typedef ULONG LSA_OPERATIONAL_MODE, *PLSA_OPERATIONAL_MODE;
#endif /* __INCLUDE_LSASS_NTSECAPI_H */

View file

@ -0,0 +1,13 @@
#ifndef __INCLUDE_NAPI_SHARED_DATA_H
#define __INCLUDE_NAPI_SHARED_DATA_H
typedef struct _KUSER_SHARED_DATA
{
ULONG TickCountLow;
ULONG TickCountMultiplier;
} KUSER_SHARED_DATA, *PKUSER_SHARED_DATA;
#define KERNEL_SHARED_DATA_BASE (0xFFDF0000)
#define USER_SHARED_DATA_BASE (0x7FFE0000)
#endif /* __INCLUDE_NAPI_SHARED_DATA_H */

View file

@ -12,10 +12,3 @@ cp services/dd/ide/ide.sys $1
cp ntoskrnl/ntoskrnl.exe $1/reactos/system32/
cp services/fs/vfat/vfatfs.sys $1/reactos/system32/drivers/
cp services/dd/ide/ide.sys $1/reactos/system32/drivers/
#cp services/dd/floppy/floppy.sys $1/reactos/system32/drivers/
cp services/dd/keyboard/keyboard.sys $1/reactos/system32/drivers
cp services/dd/blue/blue.sys $1/reactos/system32/drivers
#cp services/dd/vga/miniport/vgamp.sys $1/reactos/system32/drivers
#cp services/dd/vga/display/vgaddi.dll $1/reactos/system32/drivers
#cp services/dd/vidport/vidport.sys $1/reactos/system32/drivers
cp services/fs/minix/minixfs.sys $1/reactos/system32/drivers

View file

@ -3,6 +3,13 @@ mkdir -p $1/reactos/system32
mkdir -p $1/reactos/system32/drivers
mkdir -p $1/reactos/bin
./install-system.sh $1
cp services/dd/floppy/floppy.sys $1/reactos/system32/drivers/
cp services/dd/keyboard/keyboard.sys $1/reactos/system32/drivers
cp services/dd/blue/blue.sys $1/reactos/system32/drivers
cp services/dd/vga/miniport/vgamp.sys $1/reactos/system32/drivers
cp services/dd/vga/display/vgaddi.dll $1/reactos/system32/drivers
cp services/dd/vidport/vidport.sys $1/reactos/system32/drivers
cp services/fs/minix/minixfs.sys $1/reactos/system32/drivers
cp apps/shell/shell.exe $1/reactos/system32
cp lib/ntdll/ntdll.dll $1/reactos/system32
cp lib/kernel32/kernel32.dll $1/reactos/system32
@ -28,3 +35,4 @@ cp apps/file/file.exe $1/reactos/bin
cp apps/pteb/pteb.exe $1/reactos/bin
cp apps/consume/consume.exe $1/reactos/bin
cp apps/float/float.exe $1/reactos/bin
cp apps/dump_shared_data/dump_shared_data.exe $1/reactos/bin

View file

@ -1,4 +1,4 @@
# $Id: makefile,v 1.36 2000/08/11 12:32:04 ekohl Exp $
# $Id: makefile,v 1.37 2000/08/12 19:33:18 dwelch Exp $
#
# ReactOS Operating System
#
@ -157,5 +157,6 @@ else
$(CP) $(TARGET).dll ../../$(DIST_DIR)/dlls/$(TARGET).dll
endif
WITH_DEBUGGING=yes
WARNINGS_ARE_ERRORS = yes

View file

@ -1,4 +1,4 @@
/* $Id: startup.c,v 1.28 2000/08/11 12:34:58 ekohl Exp $
/* $Id: startup.c,v 1.29 2000/08/12 19:33:18 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -22,14 +22,14 @@
#include <ntdll/ntdll.h>
VOID RtlpInitProcessHeaps (PPEB Peb);
VOID RtlInitializeHeapManager (VOID);
/* GLOBALS *******************************************************************/
DLL LdrDllListHead;
extern unsigned int _image_base__;
CRITICAL_SECTION PebLock;
static CRITICAL_SECTION PebLock;
ULONG NtGlobalFlag = 0;
@ -97,6 +97,7 @@ LdrInitializeThunk (ULONG Unknown1,
NTHeaders = (PIMAGE_NT_HEADERS)(ImageBase + PEDosHeader->e_lfanew);
/* create process heap */
RtlInitializeHeapManager();
Peb->ProcessHeap = RtlCreateHeap(0,
(PVOID)HEAP_BASE,
NTHeaders->OptionalHeader.SizeOfHeapCommit,
@ -109,9 +110,6 @@ LdrInitializeThunk (ULONG Unknown1,
ZwTerminateProcess(NtCurrentProcess(),STATUS_UNSUCCESSFUL);
}
/* initialize process heaps support */
RtlpInitProcessHeaps (Peb);
/* initalize peb lock support */
RtlInitializeCriticalSection (&PebLock);
Peb->FastPebLock = &PebLock;

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,85 @@
# $Id: Makefile,v 1.1 2000/08/12 19:33:19 dwelch Exp $
#
# ReactOS Operating System
#
TARGET = secur32
SECUR32_BASE = 0x10000000
BASE_CFLAGS = -I../../include
CFLAGS = $(CFLAGS)
include ../../rules.mak
ifneq ($(HOST),mingw32-windows)
ifneq ($(HOST),mingw32-linux)
DLLTARGET=$(TARGET).a
else
DLLTARGET=$(TARGET).dll
endif
else
DLLTARGET=$(TARGET).dll
endif
all: $(DLLTARGET)
OBJECTS = lsa.o dllmain.o
ifeq ($(DOSCLI),yes)
CLEAN_FILES = $(OBJECTS) \
$(TARGET).o $(TARGET).a junk.tmp base.tmp temp.exp \
$(TARGET).dll $(TARGET).sym $(TARGET).coff
else
CLEAN_FILES = $(OBJECTS) \
$(TARGET).o $(TARGET).a junk.tmp base.tmp temp.exp \
$(TARGET).dll $(TARGET).sym $(TARGET).coff
endif
$(TARGET).coff: $(TARGET).rc ../../include/reactos/resource.h
$(TARGET).a: $(OBJECTS)
$(AR) csr $(TARGET).a $(OBJECTS)
$(TARGET).dll: $(DLLMAIN) $(OBJECTS) $(TARGET).def
$(LD) \
-r $(OBJECTS) \
-o $(TARGET).o
$(DLLTOOL) \
--dllname $(TARGET).dll \
--def $(TARGET).def \
--kill-at \
--output-lib $(TARGET).a
$(CC) \
-mdll \
-o junk.tmp \
-Wl,--base-file,base.tmp \
$(TARGET).o \
../ntdll/ntdll.a
- $(RM) junk.tmp
$(DLLTOOL) \
--dllname $(TARGET).dll \
--base-file base.tmp \
--output-exp temp.exp \
--def $(TARGET).edf
- $(RM) base.tmp
$(CC) \
-mdll \
-o $(TARGET).dll \
$(TARGET).o \
../ntdll/ntdll.a \
-Wl,--image-base,$(SECUR32_BASE) \
-Wl,--file-alignment,0x1000 \
-Wl,--section-alignment,0x1000 \
-Wl,temp.exp
- $(RM) temp.exp
$(NM) --numeric-sort $(TARGET).dll > $(TARGET).sym
clean: $(CLEAN_FILES:%=%_clean)
$(CLEAN_FILES:%=%_clean): %_clean:
- $(RM) $*
.PHONY: clean $(CLEAN_FILES:%=%_clean)
WARNINGS_ARE_ERRORS = yes

View file

@ -0,0 +1,42 @@
/* $Id: dllmain.c,v 1.1 2000/08/12 19:33:19 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/secur32/lsa.c
* PURPOSE: Client-side LSA functions
* UPDATE HISTORY:
* Created 05/08/00
*/
/* INCLUDES ******************************************************************/
#include <windows.h>
#include <ntos.h>
/* GLOBALS *******************************************************************/
HANDLE Secur32Heap;
/* FUNCTIONS *****************************************************************/
WINBOOL STDCALL DllMain(HINSTANCE hInstance, ULONG Reason, PVOID Reserved)
{
switch (Reason)
{
case DLL_PROCESS_ATTACH:
Secur32Heap = RtlCreateHeap(0, NULL, 4096, 0, NULL, NULL);
if (Secur32Heap == 0)
{
return(FALSE);
}
break;
case DLL_PROCESS_DETACH:
if (!RtlDestroyHeap(Secur32Heap))
{
return(FALSE);
}
break;
}
return(TRUE);
}

309
reactos/lib/secur32/lsa.c Normal file
View file

@ -0,0 +1,309 @@
/* $Id: lsa.c,v 1.1 2000/08/12 19:33:19 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/secur32/lsa.c
* PURPOSE: Client-side LSA functions
* UPDATE HISTORY:
* Created 05/08/00
*/
/* INCLUDES ******************************************************************/
#include <windows.h>
#include <ddk/ntddk.h>
#include <napi/lpc.h>
#include <lsass/lsass.h>
/* GLOBALS *******************************************************************/
extern HANDLE Secur32Heap;
/* FUNCTIONS *****************************************************************/
NTSTATUS STDCALL
LsaDeregisterLogonProcess(HANDLE LsaHandle)
{
LSASS_REQUEST Request;
LSASS_REPLY Reply;
NTSTATUS Status;
Request.Header.DataSize = 0;
Request.Header.MessageSize = sizeof(LSASS_REQUEST);
Request.Type = LSASS_REQUEST_DEREGISTER_LOGON_PROCESS;
Status = NtRequestWaitReplyPort(LsaHandle,
&Request.Header,
&Reply.Header);
if (!NT_SUCCESS(Status))
{
return(Status);
}
if (!NT_SUCCESS(Reply.Status))
{
return(Reply.Status);
}
return(Status);
}
NTSTATUS STDCALL
LsaConnectUntrusted(PHANDLE LsaHandle)
{
return(STATUS_UNSUCCESSFUL);
}
NTSTATUS STDCALL
LsaCallAuthenticationPackage(HANDLE LsaHandle,
ULONG AuthenticationPackage,
PVOID ProtocolSubmitBuffer,
ULONG SubmitBufferLength,
PVOID* ProtocolReturnBuffer,
PULONG ReturnBufferLength,
PNTSTATUS ProtocolStatus)
{
PLSASS_REQUEST Request;
PLSASS_REPLY Reply;
UCHAR RawRequest[MAX_MESSAGE_DATA];
UCHAR RawReply[MAX_MESSAGE_DATA];
NTSTATUS Status;
ULONG OutBufferSize;
Request = (PLSASS_REQUEST)RawRequest;
Reply = (PLSASS_REPLY)RawReply;
Request->Header.DataSize = sizeof(LSASS_REQUEST) + SubmitBufferLength -
sizeof(LPC_MESSAGE_HEADER);
Request->Header.MessageSize =
Request->Header.DataSize + sizeof(LPC_MESSAGE_HEADER);
Request->Type = LSASS_REQUEST_CALL_AUTHENTICATION_PACKAGE;
Request->d.CallAuthenticationPackageRequest.AuthenticationPackage =
AuthenticationPackage;
Request->d.CallAuthenticationPackageRequest.InBufferLength =
SubmitBufferLength;
memcpy(Request->d.CallAuthenticationPackageRequest.InBuffer,
ProtocolSubmitBuffer,
SubmitBufferLength);
Status = NtRequestWaitReplyPort(LsaHandle,
&Request->Header,
&Reply->Header);
if (!NT_SUCCESS(Status))
{
return(Status);
}
if (!NT_SUCCESS(Reply->Status))
{
return(Reply->Status);
}
OutBufferSize = Reply->d.CallAuthenticationPackageReply.OutBufferLength;
*ProtocolReturnBuffer = RtlAllocateHeap(Secur32Heap,
0,
OutBufferSize);
*ReturnBufferLength = OutBufferSize;
memcpy(*ProtocolReturnBuffer,
Reply->d.CallAuthenticationPackageReply.OutBuffer,
*ReturnBufferLength);
return(Status);
}
NTSTATUS STDCALL
LsaFreeReturnBuffer(PVOID Buffer)
{
return(RtlFreeHeap(Secur32Heap, 0, Buffer));
}
NTSTATUS STDCALL
LsaLookupAuthenticationPackage(HANDLE LsaHandle,
PLSA_STRING PackageName,
PULONG AuthenticationPackage)
{
NTSTATUS Status;
PLSASS_REQUEST Request;
UCHAR RawRequest[MAX_MESSAGE_DATA];
LSASS_REPLY Reply;
Request = (PLSASS_REQUEST)RawRequest;
Request->Header.DataSize = sizeof(LSASS_REQUEST) + PackageName->Length -
sizeof(LPC_MESSAGE_HEADER);
Request->Header.MessageSize = Request->Header.DataSize +
sizeof(LPC_MESSAGE_HEADER);
Request->Type = LSASS_REQUEST_LOOKUP_AUTHENTICATION_PACKAGE;
Status = NtRequestWaitReplyPort(LsaHandle,
&Request->Header,
&Reply.Header);
if (!NT_SUCCESS(Status))
{
return(Status);
}
if (!NT_SUCCESS(Reply.Status))
{
return(Reply.Status);
}
*AuthenticationPackage = Reply.d.LookupAuthenticationPackageReply.Package;
return(Reply.Status);
}
NTSTATUS STDCALL
LsaLogonUser(HANDLE LsaHandle,
PLSA_STRING OriginName,
SECURITY_LOGON_TYPE LogonType,
ULONG AuthenticationPackage,
PVOID AuthenticationInformation,
ULONG AuthenticationInformationLength,
PTOKEN_GROUPS LocalGroups,
PTOKEN_SOURCE SourceContext,
PVOID* ProfileBuffer,
PULONG ProfileBufferLength,
PLUID LogonId,
PHANDLE Token,
PQUOTA_LIMITS Quotas,
PNTSTATUS SubStatus)
{
ULONG RequestLength;
ULONG CurrentLength;
PLSASS_REQUEST Request;
UCHAR RawMessage[MAX_MESSAGE_DATA];
PLSASS_REPLY Reply;
UCHAR RawReply[MAX_MESSAGE_DATA];
NTSTATUS Status;
RequestLength = sizeof(LSASS_REQUEST) - sizeof(LPC_MESSAGE_HEADER);
RequestLength = RequestLength + (OriginName->Length * sizeof(WCHAR));
RequestLength = RequestLength + AuthenticationInformationLength;
RequestLength = RequestLength +
(LocalGroups->GroupCount * sizeof(SID_AND_ATTRIBUTES));
CurrentLength = 0;
Request = (PLSASS_REQUEST)RawMessage;
Request->d.LogonUserRequest.OriginNameLength = OriginName->Length;
Request->d.LogonUserRequest.OriginName = (PWSTR)&RawMessage[CurrentLength];
memcpy((PWSTR)&RawMessage[CurrentLength],
OriginName->Buffer,
OriginName->Length * sizeof(WCHAR));
CurrentLength = CurrentLength + (OriginName->Length * sizeof(WCHAR));
Request->d.LogonUserRequest.LogonType = LogonType;
Request->d.LogonUserRequest.AuthenticationPackage =
AuthenticationPackage;
Request->d.LogonUserRequest.AuthenticationInformation =
(PVOID)&RawMessage[CurrentLength];
Request->d.LogonUserRequest.AuthenticationInformationLength =
AuthenticationInformationLength;
memcpy((PVOID)&RawMessage[CurrentLength],
AuthenticationInformation,
AuthenticationInformationLength);
CurrentLength = CurrentLength + AuthenticationInformationLength;
Request->d.LogonUserRequest.LocalGroupsCount = LocalGroups->GroupCount;
Request->d.LogonUserRequest.LocalGroups =
(PSID_AND_ATTRIBUTES)&RawMessage[CurrentLength];
memcpy((PSID_AND_ATTRIBUTES)&RawMessage[CurrentLength],
LocalGroups->Groups,
LocalGroups->GroupCount * sizeof(SID_AND_ATTRIBUTES));
Request->d.LogonUserRequest.SourceContext = *SourceContext;
Request->Type = LSASS_REQUEST_LOGON_USER;
Request->Header.DataSize = RequestLength - sizeof(LPC_MESSAGE_HEADER);
Request->Header.MessageSize = RequestLength + sizeof(LPC_MESSAGE_HEADER);
Reply = (PLSASS_REPLY)RawReply;
Status = NtRequestWaitReplyPort(LsaHandle,
&Request->Header,
&Reply->Header);
if (!NT_SUCCESS(Status))
{
return(Status);
}
*SubStatus = Reply->d.LogonUserReply.SubStatus;
if (!NT_SUCCESS(Reply->Status))
{
return(Status);
}
*ProfileBuffer = RtlAllocateHeap(Secur32Heap,
0,
Reply->d.LogonUserReply.ProfileBufferLength);
memcpy(*ProfileBuffer,
(PVOID)((ULONG)Reply->d.LogonUserReply.Data +
(ULONG)Reply->d.LogonUserReply.ProfileBuffer),
Reply->d.LogonUserReply.ProfileBufferLength);
*LogonId = Reply->d.LogonUserReply.LogonId;
*Token = Reply->d.LogonUserReply.Token;
memcpy(Quotas,
&Reply->d.LogonUserReply.Quotas,
sizeof(Reply->d.LogonUserReply.Quotas));
return(Status);
}
NTSTATUS STDCALL
LsaRegisterLogonProcess(PLSA_STRING LsaLogonProcessName,
PHANDLE Handle,
PLSA_OPERATIONAL_MODE OperationalMode)
{
UNICODE_STRING Portname;
ULONG ConnectInfoLength;
NTSTATUS Status;
LSASS_REQUEST Request;
LSASS_REPLY Reply;
RtlInitUnicodeString(&Portname, L"\\SeLsaCommandPort");
ConnectInfoLength = 0;
Status = NtConnectPort(Handle,
&Portname,
NULL,
NULL,
NULL,
NULL,
NULL,
&ConnectInfoLength);
if (!NT_SUCCESS(Status))
{
return(Status);
}
Request.Type = LSASS_REQUEST_REGISTER_LOGON_PROCESS;
Request.Header.DataSize = sizeof(LSASS_REQUEST) -
sizeof(LPC_MESSAGE_HEADER);
Request.Header.MessageSize = sizeof(LSASS_REQUEST);
Request.d.RegisterLogonProcessRequest.Length = LsaLogonProcessName->Length;
wcscpy(Request.d.RegisterLogonProcessRequest.LogonProcessNameBuffer,
LsaLogonProcessName->Buffer);
Status = NtRequestWaitReplyPort(*Handle,
&Request.Header,
&Reply.Header);
if (!NT_SUCCESS(Status))
{
NtClose(*Handle);
*Handle = INVALID_HANDLE_VALUE;
return(Status);
}
if (!NT_SUCCESS(Reply.Status))
{
NtClose(*Handle);
*Handle = INVALID_HANDLE_VALUE;
return(Status);
}
*OperationalMode = Reply.d.RegisterLogonProcessReply.OperationalMode;
return(Reply.Status);
}

View file

@ -0,0 +1,9 @@
LIBRARY SECUR32.DLL
EXPORTS
LsaRegisterLogonProcess@12
LsaLogonUser@56
LsaDeregisterLogonProcess@4
LsaConnectUntrusted@4
LsaLookupAuthenticationPackage@12
LsaFreeReturnBuffer@4
LsaCallAuthenticationPackage@28

View file

@ -0,0 +1,9 @@
LIBRARY KERNEL32.DLL
EXPORTS
LsaRegisterLogonProcess=LsaRegisterLogonProcess@12
LsaLogonUser=LsaLogonUser@56
LsaDeregisterLogonProcess=LsaDeregisterLogonProcess@4
LsaConnectUntrusted=LsaConnectUntrusted@4
LsaLookupAuthenticationPackage=LsaLookupAuthenticationPackage@12
LsaFreeReturnBuffer=LsaFreeReturnBuffer@4
LsaCallAuthenticationPackage=LsaCallAuthenticationPackage@28

View file

@ -0,0 +1,38 @@
#include <defines.h>
#include <reactos/resource.h>
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
VS_VERSION_INFO VERSIONINFO
FILEVERSION RES_UINT_FV_MAJOR,RES_UINT_FV_MINOR,RES_UINT_FV_REVISION,RES_UINT_FV_BUILD
PRODUCTVERSION RES_UINT_PV_MAJOR,RES_UINT_PV_MINOR,RES_UINT_PV_REVISION,RES_UINT_PV_BUILD
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", RES_STR_COMPANY_NAME
VALUE "FileDescription", "W32 subsystem kernel\0"
VALUE "FileVersion", RES_STR_FILE_VERSION
VALUE "InternalName", "kernel32\0"
VALUE "LegalCopyright", RES_STR_LEGAL_COPYRIGHT
VALUE "OriginalFilename", "kernel32.dll\0"
VALUE "ProductName", RES_STR_PRODUCT_NAME
VALUE "ProductVersion", RES_STR_PRODUCT_VERSION
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END

View file

@ -34,7 +34,7 @@ org 100h
;
BITS 16
%define NDEBUG 1
;%define NDEBUG 1
%macro DPRINT 1+
%ifndef NDEBUG

View file

@ -1,4 +1,4 @@
/* $Id: misc.c,v 1.4 2000/04/09 15:58:13 ekohl Exp $
/* $Id: misc.c,v 1.5 2000/08/12 19:33:20 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -14,8 +14,7 @@
/* FUNCTIONS ****************************************************************/
VOID
STDCALL
VOID STDCALL
HalHandleNMI (ULONG Unused)
{
UCHAR ucStatus;
@ -35,16 +34,18 @@ HalHandleNMI (ULONG Unused)
KeEnterKernelDebugger ();
}
VOID
STDCALL
VOID STDCALL
HalProcessorIdle (VOID)
{
#if 1
__asm__("sti\n\t" \
"hlt\n\t");
#else
#endif
}
ULONG
FASTCALL
ULONG FASTCALL
HalSystemVectorDispatchEntry (
ULONG Unknown1,
ULONG Unknown2,
@ -54,8 +55,7 @@ HalSystemVectorDispatchEntry (
return 0;
}
VOID
STDCALL
VOID STDCALL
KeFlushWriteBuffer (
VOID
)
@ -63,8 +63,7 @@ KeFlushWriteBuffer (
return;
}
VOID
STDCALL
VOID STDCALL
HalReportResourceUsage (
VOID
)
@ -94,4 +93,4 @@ HalReportResourceUsage (
return;
}
/* EOF */
/* EOF */

View file

@ -1,4 +1,4 @@
/* $Id: reboot.c,v 1.4 2000/03/19 13:34:47 ekohl Exp $
/* $Id: reboot.c,v 1.5 2000/08/12 19:33:20 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -47,12 +47,15 @@ HalReboot (VOID)
outb_p (0x64, 0xfe);
/* stop the processor */
#if 1
__asm__("hlt\n");
#else
for(;;);
#endif
}
VOID
STDCALL
VOID STDCALL
HalReturnToFirmware (
ULONG Action
)

View file

@ -26,6 +26,7 @@ enum
MEMORY_AREA_RESERVE,
MEMORY_AREA_SECTION_VIEW_RESERVE,
MEMORY_AREA_CACHE_SEGMENT,
MEMORY_AREA_SHARED_DATA,
};
#define PAGE_TO_SECTION_PAGE_DIRECTORY_OFFSET(x) \

View file

@ -1,4 +1,4 @@
/* $Id: kdebug.c,v 1.12 2000/07/01 18:25:00 ekohl Exp $
/* $Id: kdebug.c,v 1.13 2000/08/12 19:33:21 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -311,16 +311,17 @@ KdPollBreakIn (
return Result;
}
VOID
STDCALL
KeEnterKernelDebugger (
VOID
)
VOID STDCALL
KeEnterKernelDebugger (VOID)
{
HalDisplayString ("\n\n *** Entered kernel debugger ***\n");
#if 1
for (;;)
__asm__("hlt\n\t");
#else
for(;;);
#endif
}
/* EOF */

View file

@ -1,4 +1,4 @@
/* $Id: bug.c,v 1.13 2000/07/02 10:49:30 ekohl Exp $
/* $Id: bug.c,v 1.14 2000/08/12 19:33:21 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -32,8 +32,7 @@ VOID KeInitializeBugCheck(VOID)
InBugCheck = 0;
}
BOOLEAN
STDCALL
BOOLEAN STDCALL
KeDeregisterBugCheckCallback (
PKBUGCHECK_CALLBACK_RECORD CallbackRecord
)
@ -41,8 +40,7 @@ KeDeregisterBugCheckCallback (
UNIMPLEMENTED;
}
BOOLEAN
STDCALL
BOOLEAN STDCALL
KeRegisterBugCheckCallback (
PKBUGCHECK_CALLBACK_RECORD CallbackRecord,
PKBUGCHECK_CALLBACK_ROUTINE CallbackRoutine,
@ -59,8 +57,7 @@ KeRegisterBugCheckCallback (
return(TRUE);
}
VOID
STDCALL
VOID STDCALL
KeBugCheckEx (
ULONG BugCheckCode,
ULONG BugCheckParameter1,
@ -81,18 +78,19 @@ KeBugCheckEx (
DbgPrint("Bug detected (code %x param %x %x %x %x)\n",BugCheckCode,
BugCheckParameter1,BugCheckParameter2,BugCheckParameter3,
BugCheckParameter4);
PsDumpThreads();
// PsDumpThreads();
KeDumpStackFrames(&((&BugCheckCode)[-1]),64);
#if 1
for(;;)
__asm__("hlt\n\t"); //PJS: use HLT instruction, rather than busy wait
#else
for(;;);
#endif
}
VOID
STDCALL
KeBugCheck (
ULONG BugCheckCode
)
VOID STDCALL
KeBugCheck (ULONG BugCheckCode)
/*
* FUNCTION: Brings the system down in a controlled manner when an
* inconsistency that might otherwise cause corruption has been detected
@ -109,12 +107,16 @@ KeBugCheck (
for(;;);
}
InBugCheck = 1;
PsDumpThreads();
// PsDumpThreads();
KeDumpStackFrames(&((&BugCheckCode)[-1]), 80);
#if 1
for(;;)
{
__asm__("hlt\n\t");
}
#else
for(;;);
#endif
}
/* EOF */

View file

@ -1,4 +1,4 @@
/* $Id: loader.c,v 1.59 2000/07/19 14:18:18 dwelch Exp $
/* $Id: loader.c,v 1.60 2000/08/12 19:33:21 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -182,7 +182,7 @@ static VOID LdrLoadAutoConfigDriver (LPWSTR RelativeDriverName)
if (!NT_SUCCESS(Status))
{
DbgPrint("driver load failed, status (%x)\n", Status);
KeBugCheck(0);
// KeBugCheck(0);
}
}
@ -200,9 +200,14 @@ VOID LdrLoadAutoConfigDrivers (VOID)
LdrLoadAutoConfigDriver( L"blue.sys" );
/*
* Floppy disk driver
*
*/
// LdrLoadAutoConfigDriver(L"floppy.sys");
LdrLoadAutoConfigDriver(L"vidport.sys");
/*
*
*/
LdrLoadAutoConfigDriver(L"vgamp.sys");
/*
* Minix filesystem driver
@ -714,6 +719,7 @@ LdrPEProcessModule(PVOID ModuleLoadBase, PUNICODE_STRING pModuleName)
else
{
DbgPrint("Unresolved kernel symbol: %s\n", pName);
return(NULL);
}
ImportAddressList++;
FunctionNameList++;

View file

@ -1,4 +1,4 @@
/* $Id: mm.c,v 1.34 2000/07/07 10:30:56 dwelch Exp $
/* $Id: mm.c,v 1.35 2000/08/12 19:33:22 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top directory
* PROJECT: ReactOS kernel
@ -33,6 +33,7 @@
PVOID EXPORTED MmUserProbeAddress = NULL;
PVOID EXPORTED MmHighestUserAddress = NULL;
MM_STATS MmStats;
extern PVOID MmSharedDataPagePhysicalAddress;
/* FUNCTIONS ****************************************************************/
@ -196,6 +197,14 @@ NTSTATUS MmNotPresentFault(KPROCESSOR_MODE Mode,
(PVOID)Address);
break;
case MEMORY_AREA_SHARED_DATA:
MmSetPage(PsGetCurrentProcess(),
(PVOID)PAGE_ROUND_DOWN(Address),
PAGE_READONLY,
(ULONG)MmSharedDataPagePhysicalAddress);
Status = STATUS_SUCCESS;
break;
default:
Status = STATUS_UNSUCCESSFUL;
break;

View file

@ -1,4 +1,4 @@
/* $Id: mminit.c,v 1.4 2000/07/19 14:18:19 dwelch Exp $
/* $Id: mminit.c,v 1.5 2000/08/12 19:33:22 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top directory
* PROJECT: ReactOS kernel
@ -24,6 +24,7 @@
#include <internal/io.h>
#include <internal/ps.h>
#include <internal/mmhal.h>
#include <napi/shared_data.h>
#define NDEBUG
#include <internal/debug.h>
@ -52,6 +53,9 @@ static MEMORY_AREA* kernel_text_desc = NULL;
static MEMORY_AREA* kernel_data_desc = NULL;
static MEMORY_AREA* kernel_param_desc = NULL;
static MEMORY_AREA* kernel_pool_desc = NULL;
static MEMORY_AREA* kernel_shared_data_desc = NULL;
PVOID MmSharedDataPagePhysicalAddress = NULL;
/* FUNCTIONS ****************************************************************/
@ -139,7 +143,25 @@ VOID MmInitVirtualMemory(PLOADER_PARAMETER_BLOCK bp, ULONG LastKernelAddress)
Length,
0,
&kernel_pool_desc);
DPRINT1("Creating shared data page\n");
BaseAddress = (PVOID)KERNEL_SHARED_DATA_BASE;
Length = PAGESIZE;
MmCreateMemoryArea(NULL,
MmGetKernelAddressSpace(),
MEMORY_AREA_SYSTEM,
&BaseAddress,
Length,
0,
&kernel_shared_data_desc);
MmSharedDataPagePhysicalAddress = MmAllocPage(0);
MmSetPage(NULL,
(PVOID)KERNEL_SHARED_DATA_BASE,
PAGE_READWRITE,
(ULONG)MmSharedDataPagePhysicalAddress);
((PKUSER_SHARED_DATA)KERNEL_SHARED_DATA_BASE)->TickCountLow = 0xdeadbeef;
DPRINT1("Finished creating shared data page\n");
// MmDumpMemoryAreas();
DPRINT("MmInitVirtualMemory() done\n");
}

View file

@ -188,10 +188,10 @@ NTSTATUS STDCALL NtTerminateProcess(IN HANDLE ProcessHandle,
}
PiTerminateProcessThreads(Process, ExitStatus);
if( PsGetCurrentThread()->ThreadsProcess == Process )
if (PsGetCurrentThread()->ThreadsProcess == Process)
{
ObDereferenceObject( Process );
PsTerminateCurrentThread( ExitStatus );
ObDereferenceObject(Process);
PsTerminateCurrentThread(ExitStatus);
}
ObDereferenceObject(Process);
return(STATUS_SUCCESS);

View file

@ -1,4 +1,4 @@
/* $Id: process.c,v 1.51 2000/07/07 00:49:02 phreak Exp $
/* $Id: process.c,v 1.52 2000/08/12 19:33:22 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -25,6 +25,7 @@
#include <internal/port.h>
#include <napi/dbg.h>
#include <internal/dbg.h>
#include <napi/shared_data.h>
#define NDEBUG
#include <internal/debug.h>
@ -356,6 +357,8 @@ NTSTATUS STDCALL NtCreateProcess (OUT PHANDLE ProcessHandle,
PVOID Peb;
PEPORT DebugPort;
PEPORT ExceptionPort;
PVOID BaseAddress;
PMEMORY_AREA MemoryArea;
DPRINT("NtCreateProcess(ObjectAttributes %x)\n",ObjectAttributes);
@ -446,7 +449,26 @@ NTSTATUS STDCALL NtCreateProcess (OUT PHANDLE ProcessHandle,
/*
* Now we have created the process proper
*/
/*
* Create the shared data page
*/
MmLockAddressSpace(&Process->AddressSpace);
BaseAddress = (PVOID)USER_SHARED_DATA_BASE;
Status = MmCreateMemoryArea(Process,
&Process->AddressSpace,
MEMORY_AREA_SHARED_DATA,
&BaseAddress,
PAGESIZE,
PAGE_READONLY,
&MemoryArea);
MmUnlockAddressSpace(&Process->AddressSpace);
if (!NT_SUCCESS(Status))
{
DPRINT1("Failed to create shared data page\n");
KeBugCheck(0);
}
/*
* Map ntdll
*/

View file

@ -1,16 +1,16 @@
# $Id: makefile,v 1.2 1999/08/29 13:45:06 dwelch Exp $
# $Id: makefile,v 1.3 2000/08/12 19:33:23 dwelch Exp $
#
# Logon/login Application
#
# ReactOS Operating System
#
TARGET=winlogon
TARGET = winlogon
BASE_CFLAGS = -I../../include
OBJECTS = $(TARGET).o init.o $(TARGET).coff
OBJECTS = winlogon.o $(TARGET).coff
LIBS = ../../lib/ntdll/ntdll.a
LIBS = -lkernel32 ../../lib/ntdll/ntdll.a
all: $(TARGET).exe
@ -27,12 +27,11 @@ clean:
$(TARGET).coff: $(TARGET).rc
$(RC) $(TARGET).rc $(TARGET).coff
$(TARGET).exe: $(OBJECTS) $(LIBS)
$(LD) \
$(TARGET).exe: $(OBJECTS)
$(CC) \
$(OBJECTS) \
$(LIBS) \
-o $(TARGET).exe \
--subsystem native
-o $(TARGET).exe
$(NM) --numeric-sort $(TARGET).exe > $(TARGET).sym
include ../../rules.mak

View file

@ -1,4 +1,4 @@
/* $Id: winlogon.c,v 1.5 1999/11/20 21:53:53 ekohl Exp $
/* $Id: winlogon.c,v 1.6 2000/08/12 19:33:23 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -11,316 +11,234 @@
/* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
//#include <stdio.h>
#include <ntos.h>
#include <windows.h>
#include <stdio.h>
#include <lsass/ntsecapi.h>
#include <wchar.h>
/* GLOBALS ******************************************************************/
HANDLE SM = INVALID_HANDLE_VALUE; /* SM API LPC port */
HANDLE SasEvent = INVALID_HANDLE_VALUE; /* int 0x19 */
/* FUNCTIONS *****************************************************************/
/***********************************************************************
* SmTerminationRequestHandler
*/
VOID
STDCALL
SmTerminationRequestHandler (VOID)
BOOLEAN StartServices(VOID)
{
/* Should winlogon perform any action
* before committing suicide?
*/
NtTerminateProcess(
NtCurrentProcess(),
0
);
HANDLE ServicesInitEvent;
BOOLEAN Result;
STARTUPINFO StartupInfo;
PROCESS_INFORMATION ProcessInformation;
ServicesInitEvent = CreateEvent(NULL,
TRUE,
FALSE,
"\\ServicesInitDone");
if (ServicesInitEvent == NULL)
{
DbgPrint("Failed to create services notification event\n");
return(FALSE);
}
/* Start the Win32 subsystem (csrss.exe) */
DbgPrint("WL: Executing services.exe\n");
StartupInfo.cb = sizeof(StartupInfo);
StartupInfo.lpReserved = NULL;
StartupInfo.lpDesktop = NULL;
StartupInfo.lpTitle = NULL;
StartupInfo.dwFlags = 0;
StartupInfo.cbReserved2 = 0;
StartupInfo.lpReserved2 = 0;
Result = CreateProcess("C:\\reactos\\system32\\services.exe",
NULL,
NULL,
NULL,
FALSE,
DETACHED_PROCESS,
NULL,
NULL,
&StartupInfo,
&ProcessInformation);
if (!Result)
{
DbgPrint("WL: Failed to execute services\n");
return(FALSE);
}
DbgPrint("WL: Waiting for services\n");
WaitForSingleObject(ServicesInitEvent, INFINITE);
DbgPrint("WL: Finished waiting for services\n");
return(TRUE);
}
/***********************************************************************
* HasSystemGui
*
* DESCRIPTION
* Call the Session Manager to know if user I/O is via a GUI or
* via a CUI.
*
* RETURN VALUE
* TRUE GUI active
* FALSE CUI only
*/
BOOL
HasSystemGui (VOID)
BOOLEAN StartLsass(VOID)
{
/* FIXME: call smss.exe to know, since it
* controls environment subsystem servers
* waking up. ReactOS has only text mode
* now, therefore we can answer (EA.19990608).
*/
return FALSE; /* NO GUI */
HANDLE LsassInitEvent;
BOOLEAN Result;
STARTUPINFO StartupInfo;
PROCESS_INFORMATION ProcessInformation;
LsassInitEvent = CreateEvent(NULL,
TRUE,
FALSE,
"\\LsassInitDone");
if (LsassInitEvent == NULL)
{
DbgPrint("Failed to create lsass notification event\n");
return(FALSE);
}
/* Start the Win32 subsystem (csrss.exe) */
DbgPrint("WL: Executing lsass.exe\n");
StartupInfo.cb = sizeof(StartupInfo);
StartupInfo.lpReserved = NULL;
StartupInfo.lpDesktop = NULL;
StartupInfo.lpTitle = NULL;
StartupInfo.dwFlags = 0;
StartupInfo.cbReserved2 = 0;
StartupInfo.lpReserved2 = 0;
Result = CreateProcess("C:\\reactos\\system32\\lsass.exe",
NULL,
NULL,
NULL,
FALSE,
DETACHED_PROCESS,
NULL,
NULL,
&StartupInfo,
&ProcessInformation);
if (!Result)
{
DbgPrint("WL: Failed to execute lsass\n");
return(FALSE);
}
DbgPrint("WL: Waiting for lsass\n");
WaitForSingleObject(LsassInitEvent, INFINITE);
DbgPrint("WL: Finished waiting for lsass\n");
return(TRUE);
}
/***********************************************************************
* HasSystemActiveSession
*
* DESCRIPTION
* Call the Session Manager to know if there is already an active
* session.
*
* RETURN VALUE
* TRUE a session is active
* FALSE no sessions
*/
BOOL
HasSystemActiveSession (VOID)
VOID DoLoginUser(PCHAR Name, PCHAR Password)
{
/* FIXME: call smss.exe to know */
return FALSE; /* NO SESSIONS */
PROCESS_INFORMATION ProcessInformation;
STARTUPINFO StartupInfo;
BOOLEAN Result;
StartupInfo.cb = sizeof(StartupInfo);
StartupInfo.lpReserved = NULL;
StartupInfo.lpDesktop = NULL;
StartupInfo.lpTitle = NULL;
StartupInfo.dwFlags = 0;
StartupInfo.cbReserved2 = 0;
StartupInfo.lpReserved2 = 0;
Result = CreateProcess("C:\\reactos\\system32\\shell.exe",
NULL,
NULL,
NULL,
FALSE,
DETACHED_PROCESS,
NULL,
NULL,
&StartupInfo,
&ProcessInformation);
if (!Result)
{
DbgPrint("WL: Failed to execute user shell\n");
return;
}
WaitForSingleObject(ProcessInformation.hProcess, INFINITE);
}
/***********************************************************************
* GuiLogin
*
* DESCRIPTION
* Graphical login procedure
*
* NOTE
* Read values from
*
* HKEY_LOCAL-MACHINE
* SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon
*
*/
VOID
GuiLogin (VOID)
int STDCALL
WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nShowCmd)
{
/* FIXME: Open logon dialog */
#if 0
LSA_STRING ProcessName;
NTSTATUS Status;
HANDLE LsaHandle;
LSA_OPERATIONAL_MODE Mode;
#endif
CHAR LoginPrompt[] = "login:";
CHAR PasswordPrompt[] = "password:";
ULONG Result;
CHAR LoginName[255];
CHAR Password[255];
ULONG i;
/*
* FIXME: Create WindowStations here. At the moment lsass and services
* share ours
*/
StartLsass();
StartServices();
/* FIXME: What name does the real WinLogon use? */
#if 0
RtlInitUnicodeString((PUNICODE_STRING)&ProcessName, L"WinLogon");
Status = LsaRegisterLogonProcess(&ProcessName, &LsaHandle, &Mode);
if (!NT_SUCCESS(Status))
{
DbgPrint("WL: Failed to connect to lsass\n");
return(1);
}
#endif
/* smss wouldn't have created a console for us */
AllocConsole();
/* Main loop */
for (;;)
{
/* Display login prompt */
WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE),
LoginPrompt,
wcslen(LoginPrompt),
&Result,
NULL);
i = 0;
do
{
ReadConsole(GetStdHandle(STD_INPUT_HANDLE),
&LoginName[i],
1,
&Result,
NULL);
i++;
} while (LoginName[i - 1] != '\n');
LoginName[i - 1] = 0;
/* Display password prompt */
WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE),
PasswordPrompt,
wcslen(PasswordPrompt),
&Result,
NULL);
i = 0;
do
{
ReadConsole(GetStdHandle(STD_INPUT_HANDLE),
&Password[i],
1,
&Result,
NULL);
i++;
} while (Password[i - 1] != '\n');
Password[i - 1] =0;
DoLoginUser(LoginName, Password);
}
}
/***********************************************************************
* GuiMonitor
*
* DESCRIPTION
* Graphical monitor procedure
*/
VOID
GuiMonitor (VOID)
{
/* FIXME: Open Monitor dialog */
}
/***********************************************************************
* CuiLogin
*
* DESCRIPTION
* Text mode (console) login procedure
*
* NOTE
* Read values from
*
* HKEY_LOCAL-MACHINE
* SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon
*
*/
VOID
CuiLogin (VOID)
{
char username[255];
char password[255];
/* FIXME: to be used ntdll.dll only? */
printf("Winlogon\n");
printf("login: ");
fgets(username, 255, stdin);
printf("Password: ");
fgets(password, 255, stdin);
/*
*
*/
NtCreateProcess(
L"\\\\??\\C:\\reactos\\system\\userinit.exe",
);
/*
* Security issue: buffers are cleared.
*/
NtZeroMemory(username, sizeof username);
NtZeroMemory(password, sizeof password);
}
/***********************************************************************
* CuiMonitor
*
* DESCRIPTION
* Text mode (console) Monitor procedure
*/
VOID
CuiMonitor (VOID)
{
WCHAR HostName [64];
WCHAR UserName [64];
WCHAR FormattedDate [64];
WCHAR InputKey = L'\0';
/* FIXME: query the system to get these info */
wcscpy( HostName, L"BACH" );
wcscpy( UserName, L"Administrator" );
/* FIXME: use locale info to format */
NtGetSystemTime(
);
/* Print info and Monitor menu */
NtDisplayString(L"\
ReactOS Security:\n\
\tYou are logged on as %s/%s\n\
\yLogon date: %s\n\n\
Use the Task Manager to close an application that is not responding.\n\n\
1) Lock Workstation\n\
2) Change Password\n\
3) Logoff...\n\
4) Task Manager...\n\
5) Shut Down...\n\
6) Cancel\n\n? ",
HostName,
UserName,
FormattedDate
);
while (TRUE)
{
/* FIXME: get a char and perform the requested action */
switch (InputKey)
{
case L'1':
DisplayString(L"Workstation locked...\n");
return;
case L'2':
DisplayString(L"Changing Password:\n");
return;
case L'3':
DisplayString(L"Logging off...\n");
return;
case L'4':
DisplayString(L"Task Manager:\n");
return;
case L'5':
DisplayString(L"Shutting Down:\n");
DisplayString(L"1) Shutdown\n");
DisplayString(L"2) Restart\n");
DisplayString(L"3) Logoff\n");
DisplayString(L"4) Cancel\n");
return;
case 27L: /* ESC */
case L'6':
return;
default:
DisplayString(L"Invalid key (1-6).\n");
}
}
}
HANDLE
ConnectToSmApiPort(VOID)
{
HANDLE PortHandle;
NTSTATUS Status = STATUS_SUCCESS;
UNICODE_STRING SmApiPort;
LPWSTR PortName = L"\\SmApiPort";
OBJECT_ATTRIBUTES PortAttributes = {0};
SmApiPort.Length = wcslen(PortName) * sizeof (WCHAR);
SmApiPort.MaxLength = SmApiPort.Length + sizeof (WCHAR);
SmApiPort.Buffer = PortName;
Status = NtConnectPort(
& PortHandle,
& SmApiPort,
& PortAttributes, /* FIXME: ? */
0, /* FIXME: ? */
0, /* FIXME: ? */
0, /* FIXME: ? */
0, /* FIXME: ? */
0x00010000 /* FIXME: ? */
);
return (NT_SUCCESS(Status))
? PortHandle
: INVALID_HANDLE_VALUE;
}
/* Native process entry point */
void
NtProcessStartup( PSTARTUP_ARGUMENT StartupArgument )
{
NTSTATUS Status = STATUS_SUCCESS;
/* FIXME: connnect to the Session Manager
* for LPC calls
*/
SM = ConnectToSmApiPort();
if (INVALID_HANDLE_VALUE == SM)
{
NtTerminateProcess(
NtCurrentProcess(),
0 /* FIXME: return a proper value to SM */
);
}
/* FIXME: register a termination callback
* for smss.exe
*/
/* ??? register SmTerminationRequestHandler */
/* FIXME: hook Ctrl+Alt+Del (int 0x19)
* (SAS = Secure Attention Sequence)
*/
/* ??? SasEvent = ? */
while (TRUE)
{
/*
* Make the main thread wait
* for SAS indefinitely.
*/
NtWaitForSingleObject(
SasEvent
/* ... */
);
/*
* If there is no local session, begin
* the logon procedure; otherwise open
* the monitor dialog.
*/
if (TRUE == HasSystemActiveSession())
{
/* MONITOR */
if (TRUE == HasSystemGui())
{
/* GUI active: monitor in graphical mode */
GuiMonitor();
continue;
}
/* No GUI: monitor in text mode */
CuiMonitor();
continue;
}
/* LOGON */
if (TRUE == HasSystemGui())
{
/* GUI active, login in graphical mode */
GuiLogin();
continue;
}
/* No GUI, login in console mode */
CuiLogin();
}
}
/* EOF */