Added import of REG_EXPAND_SZ registry values.

Added media change support.
Added 'BootExecute'-feature to smss.
Added autochk dummy application.

svn path=/trunk/; revision=2976
This commit is contained in:
Eric Kohl 2002-05-24 07:52:09 +00:00
parent 890bc030ff
commit dffbf01285
11 changed files with 466 additions and 180 deletions

View file

@ -64,7 +64,7 @@ STORAGE_DRIVERS = class2 scsiport atapi disk cdrom
# system applications (required for startup) # system applications (required for startup)
# #
#SYS_APPS = lsass #SYS_APPS = lsass
SYS_APPS = services shell winlogon SYS_APPS = services shell winlogon autochk
#readfile #readfile
APPS = args hello test cat bench apc shm lpc thread event file gditest \ APPS = args hello test cat bench apc shm lpc thread event file gditest \

View file

@ -52,6 +52,7 @@ copy services\storage\scsiport\scsiport.sys %ROS_INSTALL%\system32\drivers
copy services\storage\cdrom\cdrom.sys %ROS_INSTALL%\system32\drivers copy services\storage\cdrom\cdrom.sys %ROS_INSTALL%\system32\drivers
copy services\storage\disk\disk.sys %ROS_INSTALL%\system32\drivers copy services\storage\disk\disk.sys %ROS_INSTALL%\system32\drivers
copy services\storage\class2\class2.sys %ROS_INSTALL%\system32\drivers copy services\storage\class2\class2.sys %ROS_INSTALL%\system32\drivers
copy apps\system\autochk\autochk.exe %ROS_INSTALL%\system32
copy apps\system\shell\shell.exe %ROS_INSTALL%\system32 copy apps\system\shell\shell.exe %ROS_INSTALL%\system32
copy apps\system\winlogon\winlogon.exe %ROS_INSTALL%\system32 copy apps\system\winlogon\winlogon.exe %ROS_INSTALL%\system32
copy apps\system\services\services.exe %ROS_INSTALL%\system32 copy apps\system\services\services.exe %ROS_INSTALL%\system32

View file

@ -1,4 +1,4 @@
/* $Id: import.c,v 1.5 2002/04/27 19:00:14 ekohl Exp $ /* $Id: import.c,v 1.6 2002/05/24 07:42:19 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -234,6 +234,14 @@ getKeyValueTypeFromChunk (PCHAR regChunk, PCHAR dataFormat, int *keyValueType)
if (*regChunk == ':') if (*regChunk == ':')
regChunk++; regChunk++;
} }
else if (strncmp (regChunk, "expand", 6) == 0)
{
strcpy (dataFormat, "expand");
*keyValueType = REG_EXPAND_SZ;
regChunk += 6;
if (*regChunk == ':')
regChunk++;
}
else else
{ {
UNIMPLEMENTED; UNIMPLEMENTED;
@ -315,6 +323,18 @@ computeKeyValueDataSize (PCHAR regChunk, PCHAR dataFormat)
dataSize++; dataSize++;
dataSize++; dataSize++;
} }
else if (strcmp (dataFormat, "expand") == 0)
{
regChunk++;
while (*regChunk != 0 && *regChunk != '\"')
{
dataSize++;
dataSize++;
regChunk++;
}
dataSize++;
dataSize++;
}
else else
{ {
UNIMPLEMENTED; UNIMPLEMENTED;
@ -417,6 +437,18 @@ getKeyValueDataFromChunk (PCHAR regChunk, PCHAR dataFormat, PCHAR data)
} }
*ptr = 0; *ptr = 0;
} }
else if (strcmp (dataFormat, "expand") == 0)
{
/* convert quoted string to zero-terminated Unicode string */
ptr = (PWCHAR)data;
regChunk++;
while (*regChunk != 0 && *regChunk != '\"')
{
*ptr++ = (WCHAR)*regChunk++;
}
*ptr = 0;
regChunk++;
}
else else
{ {
UNIMPLEMENTED; UNIMPLEMENTED;
@ -572,7 +604,7 @@ CmImportHive(PCHAR ChunkBase,
ExFreePool (data); ExFreePool (data);
} }
return; return;
} }

View file

@ -1,4 +1,4 @@
/* $Id: fs.c,v 1.26 2002/05/15 09:39:02 ekohl Exp $ /* $Id: fs.c,v 1.27 2002/05/24 07:44:56 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -449,6 +449,8 @@ IoVerifyVolume(IN PDEVICE_OBJECT DeviceObject,
FALSE, FALSE,
NULL); NULL);
DeviceObject->Flags &= ~DO_VERIFY_VOLUME;
if (DeviceObject->Vpb->Flags & VPB_MOUNTED) if (DeviceObject->Vpb->Flags & VPB_MOUNTED)
{ {
/* Issue verify request to the FSD */ /* Issue verify request to the FSD */
@ -469,7 +471,6 @@ IoVerifyVolume(IN PDEVICE_OBJECT DeviceObject,
} }
Irp->UserIosb = &IoStatusBlock; Irp->UserIosb = &IoStatusBlock;
DPRINT("Irp->UserIosb %x\n", Irp->UserIosb);
Irp->UserEvent = Event; Irp->UserEvent = Event;
Irp->Tail.Overlay.Thread = PsGetCurrentThread(); Irp->Tail.Overlay.Thread = PsGetCurrentThread();
@ -505,10 +506,11 @@ IoVerifyVolume(IN PDEVICE_OBJECT DeviceObject,
if (Status == STATUS_WRONG_VOLUME) if (Status == STATUS_WRONG_VOLUME)
{ {
/* FIXME: Replace existing VPB by a new one */ /* Clean existing VPB. This unmounts the filesystem (in an ugly way). */
DPRINT1("Wrong volume!\n"); DPRINT("Wrong volume!\n");
DeviceObject->Vpb->DeviceObject = NULL;
DeviceObject->Vpb->Flags &= ~VPB_MOUNTED;
} }
/* Start mount sequence */ /* Start mount sequence */

View file

@ -1,4 +1,4 @@
/* $Id: init.c,v 1.34 2002/05/22 15:55:51 ekohl Exp $ /* $Id: init.c,v 1.35 2002/05/24 07:49:41 ekohl Exp $
* *
* init.c - Session Manager initialization * init.c - Session Manager initialization
* *
@ -26,6 +26,9 @@
* 19990530 (Emanuele Aliberti) * 19990530 (Emanuele Aliberti)
* Compiled successfully with egcs 1.1.2 * Compiled successfully with egcs 1.1.2
*/ */
/* INCLUDES *****************************************************************/
#include <ntos.h> #include <ntos.h>
#include <ntdll/rtl.h> #include <ntdll/rtl.h>
#include <napi/lpc.h> #include <napi/lpc.h>
@ -34,12 +37,9 @@
#define NDEBUG #define NDEBUG
/* TYPES ********************************************************************/
/* GLOBALS ******************************************************************/
/* GLOBAL VARIABLES *********************************************************/
HANDLE SmApiPort = INVALID_HANDLE_VALUE;
HANDLE DbgSsApiPort = INVALID_HANDLE_VALUE; HANDLE DbgSsApiPort = INVALID_HANDLE_VALUE;
HANDLE DbgUiApiPort = INVALID_HANDLE_VALUE; HANDLE DbgUiApiPort = INVALID_HANDLE_VALUE;
@ -48,7 +48,6 @@ PWSTR SmSystemEnvironment = NULL;
/* FUNCTIONS ****************************************************************/ /* FUNCTIONS ****************************************************************/
static NTSTATUS STDCALL static NTSTATUS STDCALL
SmObjectDirectoryQueryRoutine(PWSTR ValueName, SmObjectDirectoryQueryRoutine(PWSTR ValueName,
ULONG ValueType, ULONG ValueType,
@ -60,12 +59,16 @@ SmObjectDirectoryQueryRoutine(PWSTR ValueName,
OBJECT_ATTRIBUTES ObjectAttributes; OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING UnicodeString; UNICODE_STRING UnicodeString;
HANDLE WindowsDirectory; HANDLE WindowsDirectory;
NTSTATUS Status; NTSTATUS Status = STATUS_SUCCESS;
#ifndef NDEBUG #ifndef NDEBUG
PrintString("ValueName '%S' Type %lu Length %lu\n", ValueName, ValueType, ValueLength); PrintString("ValueName '%S' Type %lu Length %lu\n", ValueName, ValueType, ValueLength);
PrintString("ValueData '%S'\n", (PWSTR)ValueData); PrintString("ValueData '%S'\n", (PWSTR)ValueData);
#endif #endif
if (ValueType != REG_SZ)
{
return(STATUS_SUCCESS);
}
RtlInitUnicodeString(&UnicodeString, RtlInitUnicodeString(&UnicodeString,
(PWSTR)ValueData); (PWSTR)ValueData);
@ -119,46 +122,49 @@ SmDosDevicesQueryRoutine(PWSTR ValueName,
UNICODE_STRING LinkName; UNICODE_STRING LinkName;
HANDLE LinkHandle; HANDLE LinkHandle;
WCHAR LinkBuffer[80]; WCHAR LinkBuffer[80];
NTSTATUS Status = STATUS_SUCCESS; NTSTATUS Status;
#ifndef NDEBUG #ifndef NDEBUG
PrintString("ValueName '%S' Type %lu Length %lu\n", ValueName, ValueType, ValueLength); PrintString("ValueName '%S' Type %lu Length %lu\n", ValueName, ValueType, ValueLength);
PrintString("ValueData '%S'\n", (PWSTR)ValueData); PrintString("ValueData '%S'\n", (PWSTR)ValueData);
#endif #endif
if (ValueType = REG_SZ) if (ValueType != REG_SZ)
{ {
swprintf(LinkBuffer, L"\\??\\%s", return(STATUS_SUCCESS);
ValueName); }
RtlInitUnicodeString(&LinkName,
LinkBuffer); swprintf(LinkBuffer,
RtlInitUnicodeString(&DeviceName, L"\\??\\%s",
(PWSTR)ValueData); ValueName);
RtlInitUnicodeString(&LinkName,
LinkBuffer);
RtlInitUnicodeString(&DeviceName,
(PWSTR)ValueData);
#ifndef NDEBUG #ifndef NDEBUG
PrintString("SM: Linking %wZ --> %wZ\n", PrintString("SM: Linking %wZ --> %wZ\n",
&LinkName, &LinkName,
&DeviceName); &DeviceName);
#endif #endif
/* create symbolic link */ /* create symbolic link */
InitializeObjectAttributes(&ObjectAttributes, InitializeObjectAttributes(&ObjectAttributes,
&LinkName, &LinkName,
OBJ_PERMANENT, OBJ_PERMANENT,
NULL, NULL,
NULL); NULL);
Status = NtCreateSymbolicLinkObject(&LinkHandle, Status = NtCreateSymbolicLinkObject(&LinkHandle,
SYMBOLIC_LINK_ALL_ACCESS, SYMBOLIC_LINK_ALL_ACCESS,
&ObjectAttributes, &ObjectAttributes,
&DeviceName); &DeviceName);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
PrintString("SmDosDevicesQueryRoutine: NtCreateSymbolicLink( %wZ --> %wZ ) failed!\n", PrintString("SmDosDevicesQueryRoutine: NtCreateSymbolicLink( %wZ --> %wZ ) failed!\n",
&LinkName, &LinkName,
&DeviceName); &DeviceName);
}
NtClose(LinkHandle);
} }
NtClose(LinkHandle);
return(Status); return(Status);
} }
@ -192,36 +198,43 @@ SmRunBootAppsQueryRoutine(PWSTR ValueName,
PVOID Context, PVOID Context,
PVOID EntryContext) PVOID EntryContext)
{ {
#if 0
PRTL_USER_PROCESS_PARAMETERS ProcessParameters; PRTL_USER_PROCESS_PARAMETERS ProcessParameters;
RTL_PROCESS_INFO ProcessInfo; RTL_PROCESS_INFO ProcessInfo;
UNICODE_STRING ImagePathString;
UNICODE_STRING CommandLineString;
WCHAR Description[256]; WCHAR Description[256];
WCHAR ImageName[256];
WCHAR ImagePath[256]; WCHAR ImagePath[256];
WCHAR CommandLine[256]; WCHAR CommandLine[256];
PWSTR p1, p2; PWSTR p1, p2;
ULONG len; ULONG len;
NTSTATUS Status = STATUS_SUCCESS; NTSTATUS Status;
#ifndef NDEBUG #ifndef NDEBUG
PrintString("ValueName '%S' Type %lu Length %lu\n", ValueName, ValueType, ValueLength); PrintString("ValueName '%S' Type %lu Length %lu\n", ValueName, ValueType, ValueLength);
PrintString("ValueData '%S'\n", (PWSTR)ValueData); PrintString("ValueData '%S'\n", (PWSTR)ValueData);
#endif #endif
if (ValueType != REG_SZ)
{
return(STATUS_SUCCESS);
}
/* Extract the description */ /* Extract the description */
p1 = wcschr((PWSTR)ValueData, L' '); p1 = wcschr((PWSTR)ValueData, L' ');
len = p1 - (PWSTR)ValueData; len = p1 - (PWSTR)ValueData;
memcpy(Description,ValueData, len * sizeof(WCHAR)); memcpy(Description,ValueData, len * sizeof(WCHAR));
Description[len] = 0; Description[len] = 0;
/* Extract the full image path */ /* Extract the image name */
p1++; p1++;
p2 = wcschr(p1, L' '); p2 = wcschr(p1, L' ');
if (p2 != NULL) if (p2 != NULL)
len = p2 - p1; len = p2 - p1;
else else
len = wcslen(p1); len = wcslen(p1);
memcpy(ImagePath, p1, len * sizeof(WCHAR)); memcpy(ImageName, p1, len * sizeof(WCHAR));
ImagePath[len] = 0; ImageName[len] = 0;
/* Extract the command line */ /* Extract the command line */
if (p2 == NULL) if (p2 == NULL)
@ -234,19 +247,19 @@ SmRunBootAppsQueryRoutine(PWSTR ValueName,
wcscpy(CommandLine, p2); wcscpy(CommandLine, p2);
} }
#ifndef NDEBUG
PrintString("Running %S...\n", Description); PrintString("Running %S...\n", Description);
PrintString("Executable: '%S'\n", ImagePath); #ifndef NDEBUG
PrintString("ImageName: '%S'\n", ImageName);
PrintString("CommandLine: '%S'\n", CommandLine); PrintString("CommandLine: '%S'\n", CommandLine);
#endif #endif
#if 0
/* initialize executable path */ /* initialize executable path */
wcscpy(UnicodeBuffer, L"\\??\\"); wcscpy(ImagePath, L"\\SystemRoot\\system32\\");
wcscat(UnicodeBuffer, SharedUserData->NtSystemRoot); wcscat(ImagePath, ImageName);
wcscat(UnicodeBuffer, L"\\system32\\csrss.exe"); wcscat(ImagePath, L".exe");
RtlInitUnicodeString(&ImagePathString, RtlInitUnicodeString(&ImagePathString,
UnicodeBuffer); ImagePath);
RtlInitUnicodeString(&CommandLineString, RtlInitUnicodeString(&CommandLineString,
CommandLine); CommandLine);
@ -262,7 +275,7 @@ SmRunBootAppsQueryRoutine(PWSTR ValueName,
NULL, NULL,
NULL); NULL);
Status = RtlCreateUserProcess(&UnicodeString, Status = RtlCreateUserProcess(&ImagePathString,
OBJ_CASE_INSENSITIVE, OBJ_CASE_INSENSITIVE,
ProcessParameters, ProcessParameters,
NULL, NULL,
@ -272,15 +285,22 @@ SmRunBootAppsQueryRoutine(PWSTR ValueName,
NULL, NULL,
NULL, NULL,
&ProcessInfo); &ProcessInfo);
if (!NT_SUCCESS(Status))
{
PrintString("Running %s failed (Status %lx)\n", Description, Status);
return(STATUS_SUCCESS);
}
RtlDestroyProcessParameters (ProcessParameters); RtlDestroyProcessParameters(ProcessParameters);
/* FIXME: wait for process termination */ /* Wait for process termination */
NtWaitForSingleObject(ProcessInfo.ProcessHandle,
FALSE,
NULL);
#endif NtClose(ProcessInfo.ThreadHandle);
NtClose(ProcessInfo.ProcessHandle);
return(Status);
#endif
return(STATUS_SUCCESS); return(STATUS_SUCCESS);
} }
@ -316,9 +336,6 @@ SmRunBootApps(VOID)
PrintString("SmRunBootApps: RtlQueryRegistryValues() failed! (Status %lx)\n", Status); PrintString("SmRunBootApps: RtlQueryRegistryValues() failed! (Status %lx)\n", Status);
} }
// PrintString("*** System stopped ***\n");
// for(;;);
return(Status); return(Status);
} }
@ -330,6 +347,8 @@ SmProcessFileRenameList(VOID)
PrintString("SmProcessFileRenameList() called\n"); PrintString("SmProcessFileRenameList() called\n");
#endif #endif
/* FIXME: implement it! */
#ifndef NDEBUG #ifndef NDEBUG
PrintString("SmProcessFileRenameList() done\n"); PrintString("SmProcessFileRenameList() done\n");
#endif #endif
@ -338,6 +357,23 @@ SmProcessFileRenameList(VOID)
} }
static NTSTATUS
SmPreloadDlls(VOID)
{
#ifndef NDEBUG
PrintString("SmPreloadDlls() called\n");
#endif
/* FIXME: implement it! */
#ifndef NDEBUG
PrintString("SmPreloadDlls() done\n");
#endif
return(STATUS_SUCCESS);
}
static NTSTATUS STDCALL static NTSTATUS STDCALL
SmPagingFilesQueryRoutine(PWSTR ValueName, SmPagingFilesQueryRoutine(PWSTR ValueName,
ULONG ValueType, ULONG ValueType,
@ -356,6 +392,11 @@ SmPagingFilesQueryRoutine(PWSTR ValueName,
PrintString("ValueData '%S'\n", (PWSTR)ValueData); PrintString("ValueData '%S'\n", (PWSTR)ValueData);
#endif #endif
if (ValueType != REG_SZ)
{
return(STATUS_SUCCESS);
}
RtlInitUnicodeString(&FileName, RtlInitUnicodeString(&FileName,
(PWSTR)ValueData); (PWSTR)ValueData);
@ -400,9 +441,52 @@ SmCreatePagingFiles(VOID)
} }
#if 0
static NTSTATUS STDCALL
SmEnvironmentQueryRoutine(PWSTR ValueName,
ULONG ValueType,
PVOID ValueData,
ULONG ValueLength,
PVOID Context,
PVOID EntryContext)
{
// NTSTATUS Status;
//#ifndef NDEBUG
PrintString("ValueName '%S' Type %lu Length %lu\n", ValueName, ValueType, ValueLength);
PrintString("ValueData '%S'\n", (PWSTR)ValueData);
//#endif
// return(Status);
return(STATUS_SUCCESS);
}
#endif
static NTSTATUS static NTSTATUS
SmSetEnvironmentVariables(VOID) SmSetEnvironmentVariables(VOID)
{ {
#if 0
RTL_QUERY_REGISTRY_TABLE QueryTable[2];
NTSTATUS Status;
RtlZeroMemory(&QueryTable,
sizeof(QueryTable));
QueryTable[0].QueryRoutine = SmEnvironmentQueryRoutine;
Status = RtlQueryRegistryValues(RTL_REGISTRY_CONTROL,
L"\\Session Manager\\Environment",
QueryTable,
NULL,
NULL);
PrintString("*** System stopped ***\n");
for(;;);
return(Status);
#endif
//#if 0
UNICODE_STRING EnvVariable; UNICODE_STRING EnvVariable;
UNICODE_STRING EnvValue; UNICODE_STRING EnvValue;
UNICODE_STRING EnvExpandedValue; UNICODE_STRING EnvExpandedValue;
@ -494,6 +578,7 @@ SmSetEnvironmentVariables(VOID)
&EnvExpandedValue); &EnvExpandedValue);
return(STATUS_SUCCESS); return(STATUS_SUCCESS);
//#endif
} }
@ -513,72 +598,32 @@ InitSessionManager(HANDLE Children[])
Status = SmCreateObjectDirectories(); Status = SmCreateObjectDirectories();
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
PrintString("SM: Failed to create object directories! (Status %lx)\n", Status); PrintString("SM: Failed to create object directories (Status %lx)\n", Status);
return(Status); return(Status);
} }
/* Create the "\SmApiPort" object (LPC) */ /* Create the SmApiPort object (LPC) */
RtlInitUnicodeString(&UnicodeString, Status = SmCreateApiPort();
L"\\SmApiPort");
InitializeObjectAttributes(&ObjectAttributes,
&UnicodeString,
PORT_ALL_ACCESS,
NULL,
NULL);
Status = NtCreatePort(&SmApiPort,
&ObjectAttributes,
0,
0,
0);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
PrintString("SM: Failed to create SmApiPort (Status %lx)\n", Status);
return(Status); return(Status);
} }
#ifndef NDEBUG
DisplayString (L"SM: \\SmApiPort created...\n");
#endif
/* Create two threads for "\SmApiPort" */
RtlCreateUserThread(NtCurrentProcess(),
NULL,
FALSE,
0,
NULL,
NULL,
(PTHREAD_START_ROUTINE)SmApiThread,
(PVOID)SmApiPort,
NULL,
NULL);
RtlCreateUserThread(NtCurrentProcess(),
NULL,
FALSE,
0,
NULL,
NULL,
(PTHREAD_START_ROUTINE)SmApiThread,
(PVOID)SmApiPort,
NULL,
NULL);
/* Create the system environment */ /* Create the system environment */
Status = RtlCreateEnvironment(FALSE, Status = RtlCreateEnvironment(FALSE,
&SmSystemEnvironment); &SmSystemEnvironment);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
PrintString("SM: Failed to create the system environment (Status %lx)\n", Status);
return(Status); return(Status);
} }
#ifndef NDEBUG
DisplayString(L"SM: System Environment created\n");
#endif
/* Define symbolic links to kernel devices (MS-DOS names) */ /* Define symbolic links to kernel devices (MS-DOS names) */
Status = SmInitDosDevices(); Status = SmInitDosDevices();
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
PrintString("SM: Failed to create dos device links! (Status %lx)\n", Status); PrintString("SM: Failed to create dos device links (Status %lx)\n", Status);
return(Status); return(Status);
} }
@ -586,7 +631,7 @@ InitSessionManager(HANDLE Children[])
Status = SmRunBootApps(); Status = SmRunBootApps();
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
PrintString("SM: Failed to run boot applications! (Status %lx)\n", Status); PrintString("SM: Failed to run boot applications (Status %lx)\n", Status);
return(Status); return(Status);
} }
@ -598,8 +643,13 @@ InitSessionManager(HANDLE Children[])
return(Status); return(Status);
} }
/* FIXME: Load the well known DLLs */ /* Load the well known DLLs */
// SmPreloadDlls(); Status = SmPreloadDlls();
if (!NT_SUCCESS(Status))
{
PrintString("SM: Failed to preload system DLLs (Status %lx)\n", Status);
return(Status);
}
/* Create paging files */ /* Create paging files */
Status = SmCreatePagingFiles(); Status = SmCreatePagingFiles();
@ -616,7 +666,7 @@ InitSessionManager(HANDLE Children[])
Status = SmSetEnvironmentVariables(); Status = SmSetEnvironmentVariables();
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
PrintString("SM: Failed to initialize the system environment (Status %lx)\n", Status); PrintString("SM: Failed to set system environment variables (Status %lx)\n", Status);
return(Status); return(Status);
} }

View file

@ -1,4 +1,4 @@
/* $Id: smapi.c,v 1.5 2002/02/08 02:57:10 chorns Exp $ /* $Id: smapi.c,v 1.6 2002/05/24 07:49:41 ekohl Exp $
* *
* Reactos Session Manager * Reactos Session Manager
* *
@ -6,62 +6,120 @@
*/ */
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <ntdll/rtl.h>
#include <napi/lpc.h> #include <napi/lpc.h>
#include "smss.h" #include "smss.h"
#define NDEBUG #define NDEBUG
/* GLOBAL VARIABLES *********************************************************/
static HANDLE SmApiPort = INVALID_HANDLE_VALUE;
/* FUNCTIONS ****************************************************************/
VOID STDCALL VOID STDCALL
SmApiThread (HANDLE Port) SmApiThread(HANDLE Port)
{ {
NTSTATUS Status; NTSTATUS Status;
ULONG Unknown; ULONG Unknown;
PLPC_MESSAGE Reply = NULL; PLPC_MESSAGE Reply = NULL;
LPC_MESSAGE Message; LPC_MESSAGE Message;
#ifndef NDEBUG #ifndef NDEBUG
DisplayString (L"SmApiThread: running\n"); DisplayString(L"SmApiThread: running\n");
#endif #endif
for (;;) while (TRUE)
{ {
#ifndef NDEBUG #ifndef NDEBUG
DisplayString (L"SmApiThread: waiting for message\n"); DisplayString(L"SmApiThread: waiting for message\n");
#endif #endif
Status = NtReplyWaitReceivePort (Port, Status = NtReplyWaitReceivePort(Port,
&Unknown, &Unknown,
Reply, Reply,
&Message); &Message);
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
{ {
#ifndef NDEBUG #ifndef NDEBUG
DisplayString (L"SmApiThread: message received\n"); DisplayString(L"SmApiThread: message received\n");
#endif #endif
if (Message.MessageType == LPC_CONNECTION_REQUEST) if (Message.MessageType == LPC_CONNECTION_REQUEST)
{ {
// SmHandleConnectionRequest (Port, &Message); // SmHandleConnectionRequest (Port, &Message);
Reply = NULL; Reply = NULL;
} }
else if (Message.MessageType == LPC_DEBUG_EVENT) else if (Message.MessageType == LPC_DEBUG_EVENT)
{ {
// DbgSsHandleKmApiMsg (&Message, 0); // DbgSsHandleKmApiMsg (&Message, 0);
Reply = NULL; Reply = NULL;
} }
else if (Message.MessageType == LPC_PORT_CLOSED) else if (Message.MessageType == LPC_PORT_CLOSED)
{ {
Reply = NULL; Reply = NULL;
} }
else else
{ {
// Reply = &Message;
// Reply = &Message; }
} }
}
} }
} }
NTSTATUS
SmCreateApiPort(VOID)
{
OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING UnicodeString;
NTSTATUS Status;
RtlInitUnicodeString(&UnicodeString,
L"\\SmApiPort");
InitializeObjectAttributes(&ObjectAttributes,
&UnicodeString,
PORT_ALL_ACCESS,
NULL,
NULL);
Status = NtCreatePort(&SmApiPort,
&ObjectAttributes,
0,
0,
0);
if (!NT_SUCCESS(Status))
{
return(Status);
}
/* Create two threads for "\SmApiPort" */
RtlCreateUserThread(NtCurrentProcess(),
NULL,
FALSE,
0,
NULL,
NULL,
(PTHREAD_START_ROUTINE)SmApiThread,
(PVOID)SmApiPort,
NULL,
NULL);
RtlCreateUserThread(NtCurrentProcess(),
NULL,
FALSE,
0,
NULL,
NULL,
(PTHREAD_START_ROUTINE)SmApiThread,
(PVOID)SmApiPort,
NULL,
NULL);
return(Status);
}
/* EOF */ /* EOF */

View file

@ -1,4 +1,4 @@
/* $Id: smss.c,v 1.10 2002/05/22 15:55:51 ekohl Exp $ /* $Id: smss.c,v 1.11 2002/05/24 07:49:41 ekohl Exp $
* *
* smss.c - Session Manager * smss.c - Session Manager
* *
@ -32,34 +32,33 @@
void void
DisplayString( LPCWSTR lpwString ) DisplayString(LPCWSTR lpwString)
{ {
UNICODE_STRING us; UNICODE_STRING us;
RtlInitUnicodeString (&us, lpwString); RtlInitUnicodeString(&us, lpwString);
NtDisplayString (&us); NtDisplayString(&us);
} }
void void
PrintString (char* fmt,...) PrintString(char* fmt,...)
{ {
char buffer[512]; char buffer[512];
va_list ap; va_list ap;
UNICODE_STRING UnicodeString; UNICODE_STRING UnicodeString;
ANSI_STRING AnsiString; ANSI_STRING AnsiString;
va_start(ap, fmt); va_start(ap, fmt);
vsprintf(buffer, fmt, ap); vsprintf(buffer, fmt, ap);
va_end(ap); va_end(ap);
RtlInitAnsiString (&AnsiString, buffer); RtlInitAnsiString(&AnsiString, buffer);
RtlAnsiStringToUnicodeString ( RtlAnsiStringToUnicodeString(&UnicodeString,
&UnicodeString, &AnsiString,
&AnsiString, TRUE);
TRUE); NtDisplayString(&UnicodeString);
NtDisplayString(&UnicodeString); RtlFreeUnicodeString(&UnicodeString);
RtlFreeUnicodeString (&UnicodeString);
} }
@ -78,20 +77,12 @@ NtProcessStartup(PPEB Peb)
goto ByeBye; goto ByeBye;
} }
#if 0
Status = NtWaitForMultipleObjects(((LONG) sizeof(Children) / sizeof(HANDLE)), Status = NtWaitForMultipleObjects(((LONG) sizeof(Children) / sizeof(HANDLE)),
Children, Children,
WaitAny, WaitAny,
TRUE, /* alertable */ TRUE, /* alertable */
NULL); /* NULL for infinite */ NULL); /* NULL for infinite */
#endif if (!NT_SUCCESS(Status))
Status = NtWaitForSingleObject(Children[CHILD_WINLOGON],
TRUE, /* alertable */
NULL);
// if (!NT_SUCCESS(Status))
if (Status > 1)
{ {
PrintString("SM: NtWaitForMultipleObjects failed!\n"); PrintString("SM: NtWaitForMultipleObjects failed!\n");
} }

View file

@ -9,7 +9,7 @@
/* GLOBAL VARIABLES ****/ /* GLOBAL VARIABLES ****/
extern HANDLE SmApiPort; //extern HANDLE SmApiPort;
/* FUNCTIONS ***********/ /* FUNCTIONS ***********/
@ -25,6 +25,10 @@ void PrintString (char* fmt,...);
/* smapi.c */ /* smapi.c */
NTSTATUS
SmCreateApiPort(VOID);
VOID STDCALL VOID STDCALL
SmApiThread(HANDLE Port); SmApiThread(HANDLE Port);

View file

@ -0,0 +1,89 @@
/*
* ReactOS kernel
* Copyright (C) 2002 ReactOS Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: autochk.c,v 1.1 2002/05/24 07:51:01 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: apps/system/autochk/autochk.c
* PURPOSE: Filesystem checker
* PROGRAMMER: Eric Kohl
*/
/* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
#include <napi/shared_data.h>
/* FUNCTIONS ****************************************************************/
void
DisplayString(LPCWSTR lpwString)
{
UNICODE_STRING us;
RtlInitUnicodeString(&us, lpwString);
NtDisplayString(&us);
}
void
PrintString(char* fmt,...)
{
char buffer[512];
va_list ap;
UNICODE_STRING UnicodeString;
ANSI_STRING AnsiString;
va_start(ap, fmt);
vsprintf(buffer, fmt, ap);
va_end(ap);
RtlInitAnsiString(&AnsiString, buffer);
RtlAnsiStringToUnicodeString(&UnicodeString,
&AnsiString,
TRUE);
NtDisplayString(&UnicodeString);
RtlFreeUnicodeString(&UnicodeString);
}
/* Native image's entry point */
VOID
NtProcessStartup(PPEB Peb)
{
ULONG i;
PrintString("Autochk 0.0.1\n");
for (i = 0; i < 26; i++)
{
if ((SharedUserData->DosDeviceMap & (1 << i)) &&
(SharedUserData->DosDeviceDriveType[i] == DOSDEVICE_DRIVE_FIXED))
{
PrintString(" Checking drive %c:", 'A'+i);
PrintString(" OK\n");
}
}
PrintString("\n");
NtTerminateProcess(NtCurrentProcess(), 0);
}
/* EOF */

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", "File system checker\0"
VALUE "FileVersion", RES_STR_FILE_VERSION
VALUE "InternalName", "autochk\0"
VALUE "LegalCopyright", RES_STR_LEGAL_COPYRIGHT
VALUE "OriginalFilename", "autochk.exe\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

@ -0,0 +1,21 @@
# $Id: makefile,v 1.1 2002/05/24 07:51:01 ekohl Exp $
PATH_TO_TOP = ../../..
TARGET_TYPE = program
TARGET_APPTYPE = native
TARGET_NAME = autochk
TARGET_INSTALLDIR = system32
TARGET_CFLAGS = -D__NTAPP__
TARGET_OBJECTS = $(TARGET_NAME).o
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
# EOF