Implemented SystemRoot and DosDevices links.
svn path=/trunk/; revision=1182
#ifndef _INCLUDE_DDK_OBTYPES_H
#define _INCLUDE_DDK_OBTYPES_H
-/* $Id: obtypes.h,v 1.7 2000/05/01 14:15:01 ea Exp $ */
+/* $Id: obtypes.h,v 1.8 2000/06/15 18:37:33 ekohl Exp $ */
struct _DIRECTORY_OBJECT;
struct _OBJECT_ATTRIBUTES;
* should be return when a leaf is reached and Path should be
* left unchanged as a reault.
*/
- PVOID (*Parse)(PVOID ParsedObject, PWSTR* Path);
+// PVOID (*Parse)(PVOID ParsedObject, PWSTR* Path);
+
+ /*
+ * RETURNS
+ * STATUS_SUCCESS NextObject was found
+ * STATUS_UNSUCCESSFUL NextObject not found
+ * STATUS_REPARSE Path changed, restart parsing the path
+ */
+ NTSTATUS (*Parse)(PVOID ParsedObject,
+ PVOID *NextObject,
+ PUNICODE_STRING FullPath,
+ PWSTR *Path);
/*
*/
- NTSTATUS (*Security)(PVOID Object,
+ NTSTATUS (*Security)(PVOID Object,
ULONG InfoClass,
PVOID Info,
PULONG InfoLength);
PEPROCESS Process);
NTSTATUS ObFindObject(POBJECT_ATTRIBUTES ObjectAttributes,
PVOID* ReturnedObject,
- PWSTR* RemainingPath);
+ PUNICODE_STRING RemainingPath);
+// PWSTR* RemainingPath);
ULONG ObGetReferenceCount(PVOID Object);
ULONG ObGetHandleCount(PVOID Object);
-/* $Id: iomgr.c,v 1.10 2000/05/09 16:13:49 ekohl Exp $
+/* $Id: iomgr.c,v 1.11 2000/06/15 18:38:19 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
HANDLE handle;
UNICODE_STRING UnicodeString;
ANSI_STRING AnsiString;
+ UNICODE_STRING DeviceName;
/*
* Register iomgr types: DeviceObjectType
*/
IoDeviceObjectType = ExAllocatePool (
- NonPagedPool,
+ NonPagedPool,
sizeof (OBJECT_TYPE)
);
-
+
IoDeviceObjectType->TotalObjects = 0;
IoDeviceObjectType->TotalHandles = 0;
IoDeviceObjectType->MaxObjects = ULONG_MAX;
IoDeviceObjectType->NonpagedPoolCharge = sizeof (DEVICE_OBJECT);
IoDeviceObjectType->Dump = NULL;
IoDeviceObjectType->Open = NULL;
- IoDeviceObjectType->Close = NULL;
+ IoDeviceObjectType->Close = NULL;
IoDeviceObjectType->Delete = NULL;
IoDeviceObjectType->Parse = NULL;
IoDeviceObjectType->Security = NULL;
IoDeviceObjectType->QueryName = NULL;
IoDeviceObjectType->OkayToClose = NULL;
IoDeviceObjectType->Create = IopCreateDevice;
-
+
RtlInitAnsiString (
& AnsiString,
"Device"
NonPagedPool,
sizeof (OBJECT_TYPE)
);
-
+
IoFileObjectType->TotalObjects = 0;
IoFileObjectType->TotalHandles = 0;
IoFileObjectType->MaxObjects = ULONG_MAX;
IoFileObjectType->QueryName = NULL;
IoFileObjectType->OkayToClose = NULL;
IoFileObjectType->Create = IopCreateFile;
-
+
RtlInitAnsiString (
& AnsiString,
"File"
0,
& attr
);
+
/*
* Create the \?? directory
*/
0,
& attr
);
- /*
+ /*
* Initialize remaining subsubsystem
*/
IoInitCancelHandling ();
IoInitSymbolicLinkImplementation ();
IoInitFileSystemImplementation ();
-}
+ /*
+ * Create link from \DosDevices to \?? directory
+ */
+ RtlInitUnicodeString (&UnicodeString,
+ L"\\DosDevices");
+ RtlInitUnicodeString (&DeviceName,
+ L"\\??");
+ IoCreateSymbolicLink (&UnicodeString,
+ &DeviceName);
+}
/* EOF */
-/* $Id: symlink.c,v 1.13 2000/06/13 15:51:13 ekohl Exp $
+/* $Id: symlink.c,v 1.14 2000/06/15 18:38:19 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
*
* ARGUMENTS
*
- * RETURNN VALUE
+ * RETURN VALUE
*
* REVISIONS
*/
-PVOID
+NTSTATUS
IopParseSymbolicLink (
- PVOID Object,
- PWSTR * RemainingPath
+ PVOID Object,
+ PVOID * NextObject,
+ PUNICODE_STRING FullPath,
+ PWSTR * RemainingPath
)
{
NTSTATUS Status;
PSYMLNK_OBJECT SymlinkObject = (PSYMLNK_OBJECT) Object;
PVOID ReturnedObject;
+ UNICODE_STRING TargetPath;
Status = ObReferenceObjectByName(
SymlinkObject->Target.ObjectName,
);
if (NT_SUCCESS(Status))
{
- return ReturnedObject;
+ *NextObject = ReturnedObject;
+ return STATUS_SUCCESS;
}
- return NULL;
-}
+ /* build the expanded path */
+ TargetPath.MaximumLength = SymlinkObject->TargetName.Length + sizeof(WCHAR);
+ if (RemainingPath && *RemainingPath)
+ TargetPath.MaximumLength += (wcslen (*RemainingPath) * sizeof(WCHAR));
+ TargetPath.Length = TargetPath.MaximumLength - sizeof(WCHAR);
+ TargetPath.Buffer = ExAllocatePool (NonPagedPool,
+ TargetPath.MaximumLength);
+ wcscpy (TargetPath.Buffer, SymlinkObject->TargetName.Buffer);
+ if (RemainingPath && *RemainingPath)
+ wcscat (TargetPath.Buffer, *RemainingPath);
+
+ /* transfer target path buffer into FullPath */
+ RtlFreeUnicodeString (FullPath);
+ FullPath->Length = TargetPath.Length;
+ FullPath->MaximumLength = TargetPath.MaximumLength;
+ FullPath->Buffer = TargetPath.Buffer;
+
+ /* reinitialize RemainingPath for reparsing */
+ *RemainingPath = FullPath->Buffer;
+
+ *NextObject = NULL;
+ return STATUS_REPARSE;
+}
/**********************************************************************
* NAME INTERNAL
-/* $Id: main.c,v 1.46 2000/06/04 19:50:12 ekohl Exp $
+/* $Id: main.c,v 1.47 2000/06/15 18:39:04 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
HalDisplayString (buffer);
}
+static void
+CreateSystemRootLink (LPWSTR Device)
+{
+ UNICODE_STRING LinkName;
+ UNICODE_STRING DeviceName;
+
+ RtlInitUnicodeString (&LinkName,
+ L"\\SystemRoot");
+
+ RtlInitUnicodeString (&DeviceName,
+ Device);
+
+ IoCreateSymbolicLink (&LinkName,
+ &DeviceName);
+}
void set_breakpoint(unsigned int i, unsigned int addr, unsigned int type,
unsigned int len)
start = start + bp.module_length[i];
}
+ /* Create the SystemRoot symbolic link */
+ /* Hardcoded to 'C:\reactos' but this will change. */
+ CreateSystemRootLink (L"\\Device\\Harddisk0\\Partition1\\reactos");
+
/*
* Load Auto configured drivers
*/
-/* $Id: loader.c,v 1.54 2000/05/09 16:14:07 ekohl Exp $
+/* $Id: loader.c,v 1.55 2000/06/15 18:38:37 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
DbgPrint("Loading %S\n",RelativeDriverName);
- LdrGetSystemDirectory(TmpFileName, (MAX_PATH * sizeof(WCHAR)));
- wcscat(TmpFileName, L"\\drivers\\");
+ wcscpy(TmpFileName, L"\\SystemRoot\\system32\\drivers\\");
wcscat(TmpFileName, RelativeDriverName);
RtlInitUnicodeString (&DriverName, TmpFileName);
UNICODE_STRING ModuleName;
OBJECT_ATTRIBUTES ObjectAttributes;
PMODULE_OBJECT ModuleObject;
- PWSTR RemainingPath;
+ UNICODE_STRING RemainingPath;
+// PWSTR RemainingPath;
wcscpy(NameBuffer, MODULE_ROOT_NAME);
if (wcsrchr(Filename->Buffer, '\\') != 0)
0,
NULL,
NULL);
+
Status = ObFindObject(&ObjectAttributes,
(PVOID *) &ModuleObject,
&RemainingPath);
CHECKPOINT;
- if (NT_SUCCESS(Status) && (RemainingPath == NULL || *RemainingPath == 0))
+ if (NT_SUCCESS(Status) && (RemainingPath.Buffer == NULL || *(RemainingPath.Buffer) == 0))
{
DPRINT("Module %wZ at %p\n", Filename, ModuleObject);
+ RtlFreeUnicodeString (&RemainingPath);
return ModuleObject;
}
+ RtlFreeUnicodeString (&RemainingPath);
+
return NULL;
}
PVOID* ObjectPtr)
{
PVOID Object;
- PWSTR RemainingPath;
+ UNICODE_STRING RemainingPath;
+// PWSTR RemainingPath;
OBJECT_ATTRIBUTES ObjectAttributes;
InitializeObjectAttributes(&ObjectAttributes,
&Object,
&RemainingPath);
- if (RemainingPath != NULL ||
+ if (RemainingPath.Buffer != NULL ||
Object == NULL)
{
*ObjectPtr = NULL;
+ RtlFreeUnicodeString (&RemainingPath);
return(STATUS_UNSUCCESSFUL);
}
*ObjectPtr = Object;
+ RtlFreeUnicodeString (&RemainingPath);
return(STATUS_SUCCESS);
}
}
-PVOID ObpParseDirectory(PVOID Object, PWSTR* Path)
+NTSTATUS
+ObpParseDirectory (
+ PVOID Object,
+ PVOID * NextObject,
+ PUNICODE_STRING FullPath,
+ PWSTR * Path
+ )
{
PWSTR end;
PVOID FoundObject;
DPRINT("ObpParseDirectory(Object %x, Path %x, *Path %S)\n",
Object,Path,*Path);
-
+
+ *NextObject = NULL;
+
if ((*Path) == NULL)
{
- return(NULL);
+ return STATUS_UNSUCCESSFUL;
}
end = wcschr((*Path)+1, '\\');
{
*end = '\\';
}
- return(NULL);
+ return STATUS_UNSUCCESSFUL;
}
ObReferenceObjectByPointer(FoundObject,
{
*Path = NULL;
}
-
- return(FoundObject);
+
+ *NextObject = FoundObject;
+
+ return STATUS_SUCCESS;
}
NTSTATUS ObpCreateDirectory(PVOID ObjectBody,
-/* $Id: object.c,v 1.23 2000/05/09 21:30:06 ekohl Exp $
+/* $Id: object.c,v 1.24 2000/06/15 18:39:25 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* DESCRIPTION
*
* ARGUMENTS
+ * ObjectAttributes
+ *
+ * ReturnedObject
+ *
+ * RemainigPath
+ * Pointer to a unicode string that will contain the
+ * remaining path if the function returns successfully.
+ * The caller must free the buffer after use by calling
+ * RtlFreeUnicodeString ().
*
* RETURN VALUE
*/
NTSTATUS ObFindObject(POBJECT_ATTRIBUTES ObjectAttributes,
PVOID* ReturnedObject,
- PWSTR* RemainingPath)
+ PUNICODE_STRING RemainingPath)
{
PVOID NextObject;
PVOID CurrentObject;
+ PVOID RootObject;
POBJECT_HEADER CurrentHeader;
NTSTATUS Status;
PWSTR Path;
PWSTR current;
+ UNICODE_STRING PathString;
DPRINT("ObFindObject(ObjectAttributes %x, ReturnedObject %x, "
"RemainingPath %x)\n",ObjectAttributes,ReturnedObject,RemainingPath);
DPRINT("ObjectAttributes->ObjectName->Buffer %x\n",
ObjectAttributes->ObjectName->Buffer);
-
+
+ RtlInitUnicodeString (RemainingPath, NULL);
+
if (ObjectAttributes->RootDirectory == NULL)
{
ObReferenceObjectByPointer(NameSpaceRoot,
return(STATUS_UNSUCCESSFUL);
}
- current = Path;
+ if (Path)
+ {
+ RtlCreateUnicodeString (&PathString, Path);
+ current = PathString.Buffer;
+ }
+ else
+ {
+ RtlInitUnicodeString (&PathString, NULL);
+ current = NULL;
+ }
+
+ RootObject = CurrentObject;
while (TRUE)
{
DPRINT("Current object can't parse\n");
break;
}
- NextObject = CurrentHeader->ObjectType->Parse(CurrentObject,
- ¤t);
+ Status = CurrentHeader->ObjectType->Parse(CurrentObject,
+ &NextObject,
+ &PathString,
+ ¤t);
+ if (Status == STATUS_REPARSE)
+ {
+ /* reparse the object path */
+ NextObject = RootObject;
+ current = PathString.Buffer;
+ }
+
if (NextObject == NULL)
{
break;
CurrentObject = NextObject;
}
- *RemainingPath = current;
+ if (current)
+ RtlCreateUnicodeString (RemainingPath, current);
+ RtlFreeUnicodeString (&PathString);
*ReturnedObject = CurrentObject;
return(STATUS_SUCCESS);
POBJECT_TYPE Type)
{
PVOID Parent = NULL;
- PWSTR RemainingPath = NULL;
+ UNICODE_STRING RemainingPath;
POBJECT_HEADER Header;
NTSTATUS Status;
&Parent,
&RemainingPath);
}
-
+ else
+ {
+ RtlInitUnicodeString (&RemainingPath, NULL);
+ }
Header = (POBJECT_HEADER)ExAllocatePool(NonPagedPool,
OBJECT_ALLOC_SIZE(Type));
- ObInitializeObject(Header,
- Handle,
- DesiredAccess,
- Type,
+ ObInitializeObject(Header,
+ Handle,
+ DesiredAccess,
+ Type,
ObjectAttributes);
if (Header->ObjectType != NULL &&
Header->ObjectType->Create != NULL)
DPRINT("Calling %x\n", Header->ObjectType->Create);
Status = Header->ObjectType->Create(HEADER_TO_BODY(Header),
Parent,
- RemainingPath,
+ RemainingPath.Buffer,
ObjectAttributes);
if (!NT_SUCCESS(Status))
{
ObDereferenceObject( Parent );
RtlFreeUnicodeString( &Header->Name );
+ RtlFreeUnicodeString( &RemainingPath );
ExFreePool( Header );
return(NULL);
}
}
+ RtlFreeUnicodeString( &RemainingPath );
return(HEADER_TO_BODY(Header));
}