Improved shared user page

Initialized windows and system directories

svn path=/trunk/; revision=1301
This commit is contained in:
Eric Kohl 2000-08-15 12:44:47 +00:00
parent f2e0104287
commit b4cd061025
12 changed files with 108 additions and 51 deletions

View file

@ -255,4 +255,11 @@ typedef struct _KINTERRUPT
KIRQL SynchLevel;
} KINTERRUPT, *PKINTERRUPT;
typedef struct _KSYSTEM_TIME
{
ULONG LowPart;
LONG High1Part;
LONG High2Part;
} KSYSTEM_TIME, *PKSYSTEM_TIME;
#endif /* __INCLUDE_DDK_KETYPES_H */

View file

@ -6,14 +6,15 @@
#define UNIMPLEMENTED DbgPrint("%s at %s:%d is unimplemented\n",__FUNCTION__,__FILE__,__LINE__);
#ifdef NDEBUG
#define DPRINT(args...)
#define DPRINT(args...)
#define CHECKPOINT
#else
#define DPRINT(args...) do { DbgPrint("(KERNEL32:%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0);
#define CHECKPOINT do { DbgPrint("(KERNEL32:%s:%d) Checkpoint\n",__FILE__,__LINE__); } while(0);
#endif
#define DPRINT1(args...) do { DbgPrint("(KERNEL32:%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0);
#define DPRINT1(args...) do { DbgPrint("(KERNEL32:%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0);
#define CHECKPOINT1 do { DbgPrint("(KERNEL32:%s:%d) Checkpoint\n",__FILE__,__LINE__); } while(0);
#define MAGIC(c1,c2,c3,c4) ((c1) + ((c2)<<8) + ((c3)<<16) + ((c4)<<24))
@ -34,14 +35,6 @@ extern WINBOOL bIsFileApiAnsi;
/* FUNCTION PROTOTYPES ********************************************************/
BOOL __ErrorReturnFalse(ULONG ErrorCode);
PVOID __ErrorReturnNull(ULONG ErrorCode);
BOOL KERNEL32_AnsiToUnicode(PWSTR DestStr,
LPCSTR SrcStr,
ULONG MaxLen);
PWSTR InternalAnsiToUnicode(PWSTR Out, LPCSTR In, ULONG MaxLength);
BOOLEAN STDCALL IsConsoleHandle(HANDLE Handle);
WINBOOL STDCALL CloseConsoleHandle(HANDLE Handle);

View file

@ -1,10 +1,47 @@
#ifndef __INCLUDE_NAPI_SHARED_DATA_H
#define __INCLUDE_NAPI_SHARED_DATA_H
#define PROCESSOR_FEATURES_MAX 64
typedef enum _ALTERNATIVE_ARCHITECTURE_TYPE
{
StandardDesign,
NEC98x86,
EndAlternatives
} ALTERNATIVE_ARCHITECTURE_TYPE;
typedef struct _KUSER_SHARED_DATA
{
ULONG TickCountLow;
volatile ULONG TickCountLow;
ULONG TickCountMultiplier;
volatile KSYSTEM_TIME InterruptTime;
volatile KSYSTEM_TIME SystemTime;
volatile KSYSTEM_TIME TimeZoneBias;
USHORT ImageNumberLow;
USHORT ImageNumberHigh;
WCHAR NtSystemRoot[260];
ULONG DosDeviceMap;
ULONG CryptoExponent;
ULONG TimeZoneId;
UCHAR DosDeviceDriveType[32];
NT_PRODUCT_TYPE NtProductType;
BOOLEAN ProductTypeIsValid;
ULONG NtMajorVersion;
ULONG NtMinorVersion;
BOOLEAN ProcessorFeatures[PROCESSOR_FEATURES_MAX];
// NT5 / Win2k specific ??
ULONG Reserved1;
ULONG Reserved3;
volatile ULONG TimeSlip;
ALTERNATIVE_ARCHITECTURE_TYPE AlternativeArchitecture;
ULONG SuiteMask;
#ifdef REMOTE_BOOT
ULONG SystemFlags;
UCHAR RemoteBootServerPath[260];
#endif
BOOLEAN KdDebuggerEnabled;
} KUSER_SHARED_DATA, *PKUSER_SHARED_DATA;
#define KERNEL_SHARED_DATA_BASE (0xFFDF0000)

View file

@ -39,6 +39,12 @@ typedef enum _SECTION_INHERIT {
ViewUnmap = 2
} SECTION_INHERIT;
typedef enum _NT_PRODUCT_TYPE
{
NtProductWinNt = 1,
NtProductLanManNt,
NtProductServer
} NT_PRODUCT_TYPE, *PNT_PRODUCT_TYPE;
/* File information for IRP_MJ_QUERY_INFORMATION (and SET) */
typedef enum _FILE_INFORMATION_CLASS

View file

@ -1,4 +1,4 @@
/* $Id: rtl.h,v 1.18 2000/08/11 12:30:18 ekohl Exp $
/* $Id: rtl.h,v 1.19 2000/08/15 12:37:46 ekohl Exp $
*
*/
@ -176,7 +176,7 @@ RtlGetLongestNtPathLength (
ULONG STDCALL RtlGetNtGlobalFlags(VOID);
BOOLEAN STDCALL RtlGetNtProductType(PULONG ProductType);
BOOLEAN STDCALL RtlGetNtProductType(PNT_PRODUCT_TYPE ProductType);
ULONG
STDCALL

View file

@ -1,4 +1,4 @@
/* $Id: curdir.c,v 1.25 2000/06/03 14:47:31 ea Exp $
/* $Id: curdir.c,v 1.26 2000/08/15 12:38:26 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
@ -22,7 +22,6 @@
/* GLOBAL VARIABLES **********************************************************/
/* FIXME initialize them on startup !! */
UNICODE_STRING SystemDirectory;
UNICODE_STRING WindowsDirectory;

View file

@ -1,4 +1,4 @@
/* $Id: dllmain.c,v 1.12 2000/07/06 14:34:48 dwelch Exp $
/* $Id: dllmain.c,v 1.13 2000/08/15 12:39:18 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
@ -11,23 +11,29 @@
#include <ddk/ntddk.h>
#include <ntdll/csr.h>
#include <napi/shared_data.h>
#include <windows.h>
#include <wchar.h>
#define NDEBUG
#include <kernel32/kernel32.h>
extern UNICODE_STRING SystemDirectory;
extern UNICODE_STRING WindowsDirectory;
WINBOOL STDCALL DllMain (HANDLE hInst,
ULONG ul_reason_for_call,
LPVOID lpReserved);
BOOL WINAPI DllMainCRTStartup(HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
{
return(DllMain(hDll,dwReason,lpReserved));
}
WINBOOL STDCALL DllMain(HANDLE hInst,
ULONG ul_reason_for_call,
LPVOID lpReserved)
@ -40,7 +46,9 @@ WINBOOL STDCALL DllMain(HANDLE hInst,
case DLL_PROCESS_ATTACH:
{
NTSTATUS Status;
PKUSER_SHARED_DATA SharedUserData =
(PKUSER_SHARED_DATA)USER_SHARED_DATA_BASE;
DPRINT("DLL_PROCESS_ATTACH\n");
/*
* Connect to the csrss server
@ -51,6 +59,22 @@ WINBOOL STDCALL DllMain(HANDLE hInst,
DbgPrint("Failed to connect to csrss.exe: expect trouble\n");
// ZwTerminateProcess(NtCurrentProcess(), Status);
}
/*
* Initialize WindowsDirectory and SystemDirectory
*/
DPRINT("NtSystemRoot: %S\n",
SharedUserData->NtSystemRoot);
RtlCreateUnicodeString (&WindowsDirectory,
SharedUserData->NtSystemRoot);
SystemDirectory.MaximumLength = WindowsDirectory.MaximumLength + 18;
SystemDirectory.Length = WindowsDirectory.Length + 18;
SystemDirectory.Buffer = RtlAllocateHeap (RtlGetProcessHeap (),
0,
SystemDirectory.MaximumLength);
wcscpy (SystemDirectory.Buffer, WindowsDirectory.Buffer);
wcscat (SystemDirectory.Buffer, L"\\System32");
break;
}
case DLL_PROCESS_DETACH:

View file

@ -1,4 +1,4 @@
/* $Id: error.c,v 1.13 2000/04/25 23:22:53 ea Exp $
/* $Id: error.c,v 1.14 2000/08/15 12:39:18 ekohl Exp $
*
* reactos/lib/kernel32/misc/error.c
*
@ -18,7 +18,7 @@ SetLastErrorByStatus (
NTSTATUS Status
)
{
DWORD Error = RtlNtStatusToDosError (Status);
DWORD Error = RtlNtStatusToDosError (Status);
SetLastError (Error);
return (Error);
}
@ -41,20 +41,6 @@ GetLastError (VOID)
}
BOOL
__ErrorReturnFalse (ULONG ErrorCode)
{
return(FALSE);
}
PVOID
__ErrorReturnNull (ULONG ErrorCode)
{
return(NULL);
}
WINBOOL
STDCALL
Beep (DWORD dwFreq, DWORD dwDuration)

View file

@ -1,4 +1,4 @@
; $Id: ntdll.def,v 1.60 2000/08/11 17:30:20 ea Exp $
; $Id: ntdll.def,v 1.61 2000/08/15 12:40:19 ekohl Exp $
;
; ReactOS Operating System
;
@ -266,6 +266,8 @@ NtYieldExecution@0
;PfxInitialize
;PfxInsertPrefix
;PfxRemovePrefix
;PropertyLengthAsVariant
;RestoreEm87Context
;RtlAbortRXact
RtlAbsoluteToSelfRelativeSD@12
RtlAcquirePebLock@0
@ -602,6 +604,7 @@ RtlxAnsiStringToUnicodeSize@4
RtlxOemStringToUnicodeSize@4
RtlxUnicodeStringToAnsiSize@4
RtlxUnicodeStringToOemSize@4
;SaveEm87Context
ZwAcceptConnectPort@24
ZwAccessCheck@32
ZwAccessCheckAndAuditAlarm@44

View file

@ -1,4 +1,4 @@
; $Id: ntdll.edf,v 1.49 2000/08/11 17:30:20 ea Exp $
; $Id: ntdll.edf,v 1.50 2000/08/15 12:40:19 ekohl Exp $
;
; ReactOS Operating System
;
@ -48,6 +48,7 @@ LdrLoadDll
;LdrShutdownProcess
;LdrShutdownThread
LdrUnloadDll
;LdrVerifyImageMatchesChecksum
NlsAnsiCodePage DATA
NlsMbCodePageTag DATA
NlsMbOemCodePageTag DATA
@ -265,6 +266,8 @@ NtYieldExecution=NtYieldExecution@0
;PfxInitialize
;PfxInsertPrefix
;PfxRemovePrefix
;PropertyLengthAsVariant
;RestoreEm87Context
;RtlAbortRXact
RtlAbsoluteToSelfRelativeSD=RtlAbsoluteToSelfRelativeSD@12
RtlAcquirePebLock=RtlAcquirePebLock@0
@ -600,6 +603,7 @@ RtlxAnsiStringToUnicodeSize=RtlxAnsiStringToUnicodeSize@4
RtlxOemStringToUnicodeSize=RtlxOemStringToUnicodeSize@4
RtlxUnicodeStringToAnsiSize=RtlxUnicodeStringToAnsiSize@4
RtlxUnicodeStringToOemSize=RtlxUnicodeStringToOemSize@4
;SaveEm87Context
ZwAcceptConnectPort=ZwAcceptConnectPort@24
ZwAccessCheck=ZwAccessCheck@32
ZwAccessCheckAndAuditAlarm=ZwAccessCheckAndAuditAlarm@44

View file

@ -1,4 +1,4 @@
/* $Id: misc.c,v 1.1 2000/08/11 12:35:47 ekohl Exp $
/* $Id: misc.c,v 1.2 2000/08/15 12:41:13 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -13,11 +13,11 @@
#include <ddk/ntddk.h>
#include <ntdll/rtl.h>
#include <napi/shared_data.h>
/* GLOBALS ******************************************************************/
extern ULONG NtGlobalFlag;
static ULONG NtProductType = 0;
/* FUNCTIONS ****************************************************************/
@ -69,19 +69,9 @@ RtlGetNtGlobalFlags(VOID)
*/
BOOLEAN STDCALL
RtlGetNtProductType(PULONG ProductType)
RtlGetNtProductType(PNT_PRODUCT_TYPE ProductType)
{
if (NtProductType != 0)
{
*ProductType = NtProductType;
return TRUE;
}
/* FIXME: read product type from registry */
NtProductType = 1; /* Workstation */
*ProductType = NtProductType;
*ProductType = ((PKUSER_SHARED_DATA)USER_SHARED_DATA_BASE)->NtProductType;
return TRUE;
}

View file

@ -1,4 +1,4 @@
/* $Id: main.c,v 1.56 2000/07/30 18:22:34 dwelch Exp $
/* $Id: main.c,v 1.57 2000/08/15 12:44:47 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -26,6 +26,7 @@
#include <internal/mmhal.h>
#include <internal/i386/segment.h>
#include <napi/shared_data.h>
//#define NDEBUG
#include <internal/debug.h>
@ -186,6 +187,13 @@ void _main (PLOADER_PARAMETER_BLOCK LoaderBlock)
NULL,
NULL);
/* set system root in shared user page */
wcscpy (((PKUSER_SHARED_DATA)KERNEL_SHARED_DATA_BASE)->NtSystemRoot,
L"C:\\reactos");
((PKUSER_SHARED_DATA)KERNEL_SHARED_DATA_BASE)->NtProductType = NtProductWinNt;
/*
* Launch initial process
*/