mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
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:
parent
890bc030ff
commit
dffbf01285
11 changed files with 466 additions and 180 deletions
|
@ -64,7 +64,7 @@ STORAGE_DRIVERS = class2 scsiport atapi disk cdrom
|
|||
# system applications (required for startup)
|
||||
#
|
||||
#SYS_APPS = lsass
|
||||
SYS_APPS = services shell winlogon
|
||||
SYS_APPS = services shell winlogon autochk
|
||||
|
||||
#readfile
|
||||
APPS = args hello test cat bench apc shm lpc thread event file gditest \
|
||||
|
|
|
@ -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\disk\disk.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\winlogon\winlogon.exe %ROS_INSTALL%\system32
|
||||
copy apps\system\services\services.exe %ROS_INSTALL%\system32
|
||||
|
|
|
@ -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
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -234,6 +234,14 @@ getKeyValueTypeFromChunk (PCHAR regChunk, PCHAR dataFormat, int *keyValueType)
|
|||
if (*regChunk == ':')
|
||||
regChunk++;
|
||||
}
|
||||
else if (strncmp (regChunk, "expand", 6) == 0)
|
||||
{
|
||||
strcpy (dataFormat, "expand");
|
||||
*keyValueType = REG_EXPAND_SZ;
|
||||
regChunk += 6;
|
||||
if (*regChunk == ':')
|
||||
regChunk++;
|
||||
}
|
||||
else
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
|
@ -315,6 +323,18 @@ computeKeyValueDataSize (PCHAR regChunk, PCHAR dataFormat)
|
|||
dataSize++;
|
||||
dataSize++;
|
||||
}
|
||||
else if (strcmp (dataFormat, "expand") == 0)
|
||||
{
|
||||
regChunk++;
|
||||
while (*regChunk != 0 && *regChunk != '\"')
|
||||
{
|
||||
dataSize++;
|
||||
dataSize++;
|
||||
regChunk++;
|
||||
}
|
||||
dataSize++;
|
||||
dataSize++;
|
||||
}
|
||||
else
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
|
@ -417,6 +437,18 @@ getKeyValueDataFromChunk (PCHAR regChunk, PCHAR dataFormat, PCHAR data)
|
|||
}
|
||||
*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
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
|
|
|
@ -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
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -449,6 +449,8 @@ IoVerifyVolume(IN PDEVICE_OBJECT DeviceObject,
|
|||
FALSE,
|
||||
NULL);
|
||||
|
||||
DeviceObject->Flags &= ~DO_VERIFY_VOLUME;
|
||||
|
||||
if (DeviceObject->Vpb->Flags & VPB_MOUNTED)
|
||||
{
|
||||
/* Issue verify request to the FSD */
|
||||
|
@ -469,7 +471,6 @@ IoVerifyVolume(IN PDEVICE_OBJECT DeviceObject,
|
|||
}
|
||||
|
||||
Irp->UserIosb = &IoStatusBlock;
|
||||
DPRINT("Irp->UserIosb %x\n", Irp->UserIosb);
|
||||
Irp->UserEvent = Event;
|
||||
Irp->Tail.Overlay.Thread = PsGetCurrentThread();
|
||||
|
||||
|
@ -505,10 +506,11 @@ IoVerifyVolume(IN PDEVICE_OBJECT DeviceObject,
|
|||
|
||||
if (Status == STATUS_WRONG_VOLUME)
|
||||
{
|
||||
/* FIXME: Replace existing VPB by a new one */
|
||||
DPRINT1("Wrong volume!\n");
|
||||
|
||||
/* Clean existing VPB. This unmounts the filesystem (in an ugly way). */
|
||||
DPRINT("Wrong volume!\n");
|
||||
|
||||
DeviceObject->Vpb->DeviceObject = NULL;
|
||||
DeviceObject->Vpb->Flags &= ~VPB_MOUNTED;
|
||||
}
|
||||
|
||||
/* Start mount sequence */
|
||||
|
|
|
@ -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
|
||||
*
|
||||
|
@ -26,6 +26,9 @@
|
|||
* 19990530 (Emanuele Aliberti)
|
||||
* Compiled successfully with egcs 1.1.2
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#include <ntos.h>
|
||||
#include <ntdll/rtl.h>
|
||||
#include <napi/lpc.h>
|
||||
|
@ -34,12 +37,9 @@
|
|||
|
||||
#define NDEBUG
|
||||
|
||||
/* TYPES ********************************************************************/
|
||||
|
||||
/* GLOBALS ******************************************************************/
|
||||
|
||||
/* GLOBAL VARIABLES *********************************************************/
|
||||
|
||||
HANDLE SmApiPort = INVALID_HANDLE_VALUE;
|
||||
HANDLE DbgSsApiPort = INVALID_HANDLE_VALUE;
|
||||
HANDLE DbgUiApiPort = INVALID_HANDLE_VALUE;
|
||||
|
||||
|
@ -48,7 +48,6 @@ PWSTR SmSystemEnvironment = NULL;
|
|||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
|
||||
static NTSTATUS STDCALL
|
||||
SmObjectDirectoryQueryRoutine(PWSTR ValueName,
|
||||
ULONG ValueType,
|
||||
|
@ -60,12 +59,16 @@ SmObjectDirectoryQueryRoutine(PWSTR ValueName,
|
|||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
UNICODE_STRING UnicodeString;
|
||||
HANDLE WindowsDirectory;
|
||||
NTSTATUS Status;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
|
||||
#ifndef NDEBUG
|
||||
PrintString("ValueName '%S' Type %lu Length %lu\n", ValueName, ValueType, ValueLength);
|
||||
PrintString("ValueData '%S'\n", (PWSTR)ValueData);
|
||||
#endif
|
||||
if (ValueType != REG_SZ)
|
||||
{
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
RtlInitUnicodeString(&UnicodeString,
|
||||
(PWSTR)ValueData);
|
||||
|
@ -119,16 +122,20 @@ SmDosDevicesQueryRoutine(PWSTR ValueName,
|
|||
UNICODE_STRING LinkName;
|
||||
HANDLE LinkHandle;
|
||||
WCHAR LinkBuffer[80];
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
NTSTATUS Status;
|
||||
|
||||
#ifndef NDEBUG
|
||||
PrintString("ValueName '%S' Type %lu Length %lu\n", ValueName, ValueType, ValueLength);
|
||||
PrintString("ValueData '%S'\n", (PWSTR)ValueData);
|
||||
#endif
|
||||
|
||||
if (ValueType = REG_SZ)
|
||||
if (ValueType != REG_SZ)
|
||||
{
|
||||
swprintf(LinkBuffer, L"\\??\\%s",
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
swprintf(LinkBuffer,
|
||||
L"\\??\\%s",
|
||||
ValueName);
|
||||
RtlInitUnicodeString(&LinkName,
|
||||
LinkBuffer);
|
||||
|
@ -158,7 +165,6 @@ SmDosDevicesQueryRoutine(PWSTR ValueName,
|
|||
&DeviceName);
|
||||
}
|
||||
NtClose(LinkHandle);
|
||||
}
|
||||
|
||||
return(Status);
|
||||
}
|
||||
|
@ -192,36 +198,43 @@ SmRunBootAppsQueryRoutine(PWSTR ValueName,
|
|||
PVOID Context,
|
||||
PVOID EntryContext)
|
||||
{
|
||||
#if 0
|
||||
PRTL_USER_PROCESS_PARAMETERS ProcessParameters;
|
||||
RTL_PROCESS_INFO ProcessInfo;
|
||||
UNICODE_STRING ImagePathString;
|
||||
UNICODE_STRING CommandLineString;
|
||||
WCHAR Description[256];
|
||||
WCHAR ImageName[256];
|
||||
WCHAR ImagePath[256];
|
||||
WCHAR CommandLine[256];
|
||||
PWSTR p1, p2;
|
||||
ULONG len;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
NTSTATUS Status;
|
||||
|
||||
#ifndef NDEBUG
|
||||
PrintString("ValueName '%S' Type %lu Length %lu\n", ValueName, ValueType, ValueLength);
|
||||
PrintString("ValueData '%S'\n", (PWSTR)ValueData);
|
||||
#endif
|
||||
|
||||
if (ValueType != REG_SZ)
|
||||
{
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
/* Extract the description */
|
||||
p1 = wcschr((PWSTR)ValueData, L' ');
|
||||
len = p1 - (PWSTR)ValueData;
|
||||
memcpy(Description,ValueData, len * sizeof(WCHAR));
|
||||
Description[len] = 0;
|
||||
|
||||
/* Extract the full image path */
|
||||
/* Extract the image name */
|
||||
p1++;
|
||||
p2 = wcschr(p1, L' ');
|
||||
if (p2 != NULL)
|
||||
len = p2 - p1;
|
||||
else
|
||||
len = wcslen(p1);
|
||||
memcpy(ImagePath, p1, len * sizeof(WCHAR));
|
||||
ImagePath[len] = 0;
|
||||
memcpy(ImageName, p1, len * sizeof(WCHAR));
|
||||
ImageName[len] = 0;
|
||||
|
||||
/* Extract the command line */
|
||||
if (p2 == NULL)
|
||||
|
@ -234,19 +247,19 @@ SmRunBootAppsQueryRoutine(PWSTR ValueName,
|
|||
wcscpy(CommandLine, p2);
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
PrintString("Running %S...\n", Description);
|
||||
PrintString("Executable: '%S'\n", ImagePath);
|
||||
#ifndef NDEBUG
|
||||
PrintString("ImageName: '%S'\n", ImageName);
|
||||
PrintString("CommandLine: '%S'\n", CommandLine);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/* initialize executable path */
|
||||
wcscpy(UnicodeBuffer, L"\\??\\");
|
||||
wcscat(UnicodeBuffer, SharedUserData->NtSystemRoot);
|
||||
wcscat(UnicodeBuffer, L"\\system32\\csrss.exe");
|
||||
wcscpy(ImagePath, L"\\SystemRoot\\system32\\");
|
||||
wcscat(ImagePath, ImageName);
|
||||
wcscat(ImagePath, L".exe");
|
||||
|
||||
RtlInitUnicodeString(&ImagePathString,
|
||||
UnicodeBuffer);
|
||||
ImagePath);
|
||||
|
||||
RtlInitUnicodeString(&CommandLineString,
|
||||
CommandLine);
|
||||
|
@ -262,7 +275,7 @@ SmRunBootAppsQueryRoutine(PWSTR ValueName,
|
|||
NULL,
|
||||
NULL);
|
||||
|
||||
Status = RtlCreateUserProcess(&UnicodeString,
|
||||
Status = RtlCreateUserProcess(&ImagePathString,
|
||||
OBJ_CASE_INSENSITIVE,
|
||||
ProcessParameters,
|
||||
NULL,
|
||||
|
@ -272,15 +285,22 @@ SmRunBootAppsQueryRoutine(PWSTR ValueName,
|
|||
NULL,
|
||||
NULL,
|
||||
&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);
|
||||
}
|
||||
|
||||
|
@ -316,9 +336,6 @@ SmRunBootApps(VOID)
|
|||
PrintString("SmRunBootApps: RtlQueryRegistryValues() failed! (Status %lx)\n", Status);
|
||||
}
|
||||
|
||||
// PrintString("*** System stopped ***\n");
|
||||
// for(;;);
|
||||
|
||||
return(Status);
|
||||
}
|
||||
|
||||
|
@ -330,6 +347,8 @@ SmProcessFileRenameList(VOID)
|
|||
PrintString("SmProcessFileRenameList() called\n");
|
||||
#endif
|
||||
|
||||
/* FIXME: implement it! */
|
||||
|
||||
#ifndef NDEBUG
|
||||
PrintString("SmProcessFileRenameList() done\n");
|
||||
#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
|
||||
SmPagingFilesQueryRoutine(PWSTR ValueName,
|
||||
ULONG ValueType,
|
||||
|
@ -356,6 +392,11 @@ SmPagingFilesQueryRoutine(PWSTR ValueName,
|
|||
PrintString("ValueData '%S'\n", (PWSTR)ValueData);
|
||||
#endif
|
||||
|
||||
if (ValueType != REG_SZ)
|
||||
{
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
RtlInitUnicodeString(&FileName,
|
||||
(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
|
||||
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 EnvValue;
|
||||
UNICODE_STRING EnvExpandedValue;
|
||||
|
@ -494,6 +578,7 @@ SmSetEnvironmentVariables(VOID)
|
|||
&EnvExpandedValue);
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
//#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -513,72 +598,32 @@ InitSessionManager(HANDLE Children[])
|
|||
Status = SmCreateObjectDirectories();
|
||||
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);
|
||||
}
|
||||
|
||||
/* Create the "\SmApiPort" object (LPC) */
|
||||
RtlInitUnicodeString(&UnicodeString,
|
||||
L"\\SmApiPort");
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&UnicodeString,
|
||||
PORT_ALL_ACCESS,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
Status = NtCreatePort(&SmApiPort,
|
||||
&ObjectAttributes,
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
/* Create the SmApiPort object (LPC) */
|
||||
Status = SmCreateApiPort();
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
PrintString("SM: Failed to create SmApiPort (Status %lx)\n", 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 */
|
||||
Status = RtlCreateEnvironment(FALSE,
|
||||
&SmSystemEnvironment);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
PrintString("SM: Failed to create the system environment (Status %lx)\n", Status);
|
||||
return(Status);
|
||||
}
|
||||
#ifndef NDEBUG
|
||||
DisplayString(L"SM: System Environment created\n");
|
||||
#endif
|
||||
|
||||
/* Define symbolic links to kernel devices (MS-DOS names) */
|
||||
Status = SmInitDosDevices();
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -586,7 +631,7 @@ InitSessionManager(HANDLE Children[])
|
|||
Status = SmRunBootApps();
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -598,8 +643,13 @@ InitSessionManager(HANDLE Children[])
|
|||
return(Status);
|
||||
}
|
||||
|
||||
/* FIXME: Load the well known DLLs */
|
||||
// SmPreloadDlls();
|
||||
/* Load the well known DLLs */
|
||||
Status = SmPreloadDlls();
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
PrintString("SM: Failed to preload system DLLs (Status %lx)\n", Status);
|
||||
return(Status);
|
||||
}
|
||||
|
||||
/* Create paging files */
|
||||
Status = SmCreatePagingFiles();
|
||||
|
@ -616,7 +666,7 @@ InitSessionManager(HANDLE Children[])
|
|||
Status = SmSetEnvironmentVariables();
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
*
|
||||
|
@ -6,15 +6,22 @@
|
|||
*/
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <ntdll/rtl.h>
|
||||
#include <napi/lpc.h>
|
||||
|
||||
#include "smss.h"
|
||||
|
||||
#define NDEBUG
|
||||
|
||||
/* GLOBAL VARIABLES *********************************************************/
|
||||
|
||||
static HANDLE SmApiPort = INVALID_HANDLE_VALUE;
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
|
||||
VOID STDCALL
|
||||
SmApiThread (HANDLE Port)
|
||||
SmApiThread(HANDLE Port)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
ULONG Unknown;
|
||||
|
@ -22,23 +29,23 @@ SmApiThread (HANDLE Port)
|
|||
LPC_MESSAGE Message;
|
||||
|
||||
#ifndef NDEBUG
|
||||
DisplayString (L"SmApiThread: running\n");
|
||||
DisplayString(L"SmApiThread: running\n");
|
||||
#endif
|
||||
|
||||
for (;;)
|
||||
while (TRUE)
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
DisplayString (L"SmApiThread: waiting for message\n");
|
||||
DisplayString(L"SmApiThread: waiting for message\n");
|
||||
#endif
|
||||
|
||||
Status = NtReplyWaitReceivePort (Port,
|
||||
Status = NtReplyWaitReceivePort(Port,
|
||||
&Unknown,
|
||||
Reply,
|
||||
&Message);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
DisplayString (L"SmApiThread: message received\n");
|
||||
DisplayString(L"SmApiThread: message received\n");
|
||||
#endif
|
||||
|
||||
if (Message.MessageType == LPC_CONNECTION_REQUEST)
|
||||
|
@ -57,11 +64,62 @@ SmApiThread (HANDLE Port)
|
|||
}
|
||||
else
|
||||
{
|
||||
|
||||
// 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 */
|
||||
|
|
|
@ -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
|
||||
*
|
||||
|
@ -32,17 +32,17 @@
|
|||
|
||||
|
||||
void
|
||||
DisplayString( LPCWSTR lpwString )
|
||||
DisplayString(LPCWSTR lpwString)
|
||||
{
|
||||
UNICODE_STRING us;
|
||||
|
||||
RtlInitUnicodeString (&us, lpwString);
|
||||
NtDisplayString (&us);
|
||||
RtlInitUnicodeString(&us, lpwString);
|
||||
NtDisplayString(&us);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PrintString (char* fmt,...)
|
||||
PrintString(char* fmt,...)
|
||||
{
|
||||
char buffer[512];
|
||||
va_list ap;
|
||||
|
@ -53,13 +53,12 @@ PrintString (char* fmt,...)
|
|||
vsprintf(buffer, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
RtlInitAnsiString (&AnsiString, buffer);
|
||||
RtlAnsiStringToUnicodeString (
|
||||
&UnicodeString,
|
||||
RtlInitAnsiString(&AnsiString, buffer);
|
||||
RtlAnsiStringToUnicodeString(&UnicodeString,
|
||||
&AnsiString,
|
||||
TRUE);
|
||||
NtDisplayString(&UnicodeString);
|
||||
RtlFreeUnicodeString (&UnicodeString);
|
||||
RtlFreeUnicodeString(&UnicodeString);
|
||||
}
|
||||
|
||||
|
||||
|
@ -78,20 +77,12 @@ NtProcessStartup(PPEB Peb)
|
|||
goto ByeBye;
|
||||
}
|
||||
|
||||
#if 0
|
||||
Status = NtWaitForMultipleObjects(((LONG) sizeof(Children) / sizeof(HANDLE)),
|
||||
Children,
|
||||
WaitAny,
|
||||
TRUE, /* alertable */
|
||||
NULL); /* NULL for infinite */
|
||||
#endif
|
||||
|
||||
Status = NtWaitForSingleObject(Children[CHILD_WINLOGON],
|
||||
TRUE, /* alertable */
|
||||
NULL);
|
||||
|
||||
// if (!NT_SUCCESS(Status))
|
||||
if (Status > 1)
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
PrintString("SM: NtWaitForMultipleObjects failed!\n");
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
/* GLOBAL VARIABLES ****/
|
||||
|
||||
extern HANDLE SmApiPort;
|
||||
//extern HANDLE SmApiPort;
|
||||
|
||||
|
||||
/* FUNCTIONS ***********/
|
||||
|
@ -25,6 +25,10 @@ void PrintString (char* fmt,...);
|
|||
|
||||
|
||||
/* smapi.c */
|
||||
|
||||
NTSTATUS
|
||||
SmCreateApiPort(VOID);
|
||||
|
||||
VOID STDCALL
|
||||
SmApiThread(HANDLE Port);
|
||||
|
||||
|
|
89
reactos/subsys/system/autochk/autochk.c
Normal file
89
reactos/subsys/system/autochk/autochk.c
Normal 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 */
|
38
reactos/subsys/system/autochk/autochk.rc
Normal file
38
reactos/subsys/system/autochk/autochk.rc
Normal 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
|
||||
|
21
reactos/subsys/system/autochk/makefile
Normal file
21
reactos/subsys/system/autochk/makefile
Normal 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
|
Loading…
Reference in a new issue