mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
Added attributes to object parse method.
svn path=/trunk/; revision=1882
This commit is contained in:
parent
ab494baccd
commit
7c469f9c46
6 changed files with 287 additions and 279 deletions
|
@ -1,6 +1,6 @@
|
|||
#ifndef _INCLUDE_DDK_OBTYPES_H
|
||||
#define _INCLUDE_DDK_OBTYPES_H
|
||||
/* $Id: obtypes.h,v 1.11 2001/03/07 16:48:40 dwelch Exp $ */
|
||||
/* $Id: obtypes.h,v 1.12 2001/05/05 09:30:28 ekohl Exp $ */
|
||||
struct _DIRECTORY_OBJECT;
|
||||
struct _OBJECT_ATTRIBUTES;
|
||||
|
||||
|
@ -92,7 +92,8 @@ typedef struct _OBJECT_TYPE
|
|||
PVOID *NextObject,
|
||||
PUNICODE_STRING FullPath,
|
||||
PWSTR *Path,
|
||||
struct _OBJECT_TYPE* ObjectType);
|
||||
struct _OBJECT_TYPE* ObjectType,
|
||||
ULONG Attributes);
|
||||
|
||||
/*
|
||||
*/
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: registry.c,v 1.57 2001/05/01 23:08:18 chorns Exp $
|
||||
/* $Id: registry.c,v 1.58 2001/05/05 09:31:19 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -220,7 +220,8 @@ static NTSTATUS CmiObjectParse(PVOID ParsedObject,
|
|||
PVOID *NextObject,
|
||||
PUNICODE_STRING FullPath,
|
||||
PWSTR *Path,
|
||||
POBJECT_TYPE ObjectType);
|
||||
POBJECT_TYPE ObjectType,
|
||||
ULONG Attribute);
|
||||
static NTSTATUS CmiObjectCreate(PVOID ObjectBody,
|
||||
PVOID Parent,
|
||||
PWSTR RemainingPath,
|
||||
|
@ -229,7 +230,9 @@ static NTSTATUS CmiObjectCreate(PVOID ObjectBody,
|
|||
static VOID CmiObjectDelete(PVOID DeletedObject);
|
||||
static VOID CmiAddKeyToList(PKEY_OBJECT ParentKey,PKEY_OBJECT NewKey);
|
||||
static NTSTATUS CmiRemoveKeyFromList(PKEY_OBJECT NewKey);
|
||||
static PKEY_OBJECT CmiScanKeyList(PKEY_OBJECT Parent,PCHAR KeyNameBuf);
|
||||
static PKEY_OBJECT CmiScanKeyList(PKEY_OBJECT Parent,
|
||||
PCHAR KeyNameBuf,
|
||||
ULONG Attributes);
|
||||
static PREGISTRY_FILE CmiCreateRegistry(PWSTR Filename);
|
||||
static ULONG CmiGetMaxNameLength(PREGISTRY_FILE RegistryFile,
|
||||
PKEY_BLOCK KeyBlock);
|
||||
|
@ -242,11 +245,12 @@ static ULONG CmiGetMaxValueDataLength(PREGISTRY_FILE RegistryFile,
|
|||
static NTSTATUS CmiScanForSubKey(IN PREGISTRY_FILE RegistryFile,
|
||||
IN PKEY_BLOCK KeyBlock,
|
||||
OUT PKEY_BLOCK *SubKeyBlock,
|
||||
OUT BLOCK_OFFSET *BlockOffset,
|
||||
OUT BLOCK_OFFSET *BlockOffset,
|
||||
IN PCHAR KeyName,
|
||||
IN ACCESS_MASK DesiredAccess);
|
||||
IN ACCESS_MASK DesiredAccess,
|
||||
IN ULONG Attributes);
|
||||
static NTSTATUS CmiAddSubKey(IN PREGISTRY_FILE RegistryFile,
|
||||
IN PKEY_OBJECT Parent,
|
||||
IN PKEY_OBJECT Parent,
|
||||
OUT PKEY_OBJECT SubKey,
|
||||
IN PWSTR NewSubKeyName,
|
||||
IN USHORT NewSubKeyNameSize,
|
||||
|
@ -272,7 +276,7 @@ static NTSTATUS CmiDeleteValueFromKey(IN PREGISTRY_FILE RegistryFile,
|
|||
IN PCHAR ValueName);
|
||||
static NTSTATUS CmiAllocateHashTableBlock(IN PREGISTRY_FILE RegistryFile,
|
||||
OUT PHASH_TABLE_BLOCK *HashBlock,
|
||||
OUT BLOCK_OFFSET *HBOffset,
|
||||
OUT BLOCK_OFFSET *HBOffset,
|
||||
IN ULONG HashTableSize);
|
||||
static PKEY_BLOCK CmiGetKeyFromHashByIndex(PREGISTRY_FILE RegistryFile,
|
||||
PHASH_TABLE_BLOCK HashBlock,
|
||||
|
@ -283,7 +287,7 @@ static NTSTATUS CmiAddKeyToHashTable(PREGISTRY_FILE RegistryFile,
|
|||
BLOCK_OFFSET NKBOffset);
|
||||
static NTSTATUS CmiAllocateValueBlock(IN PREGISTRY_FILE RegistryFile,
|
||||
OUT PVALUE_BLOCK *ValueBlock,
|
||||
OUT BLOCK_OFFSET *VBOffset,
|
||||
OUT BLOCK_OFFSET *VBOffset,
|
||||
IN PCHAR ValueNameBuf);
|
||||
static NTSTATUS CmiDestroyValueBlock(PREGISTRY_FILE RegistryFile,
|
||||
PVALUE_BLOCK ValueBlock, BLOCK_OFFSET VBOffset);
|
||||
|
@ -2060,7 +2064,8 @@ static NTSTATUS CmiObjectParse(PVOID ParsedObject,
|
|||
PVOID *NextObject,
|
||||
PUNICODE_STRING FullPath,
|
||||
PWSTR *Path,
|
||||
POBJECT_TYPE ObjectType)
|
||||
POBJECT_TYPE ObjectType,
|
||||
ULONG Attributes)
|
||||
{
|
||||
CHAR cPath[MAX_PATH];
|
||||
PWSTR end;
|
||||
|
@ -2091,9 +2096,8 @@ static NTSTATUS CmiObjectParse(PVOID ParsedObject,
|
|||
wcstombs(cPath,(*Path),wcslen((*Path)));
|
||||
cPath[wcslen( (*Path))]=0;
|
||||
}
|
||||
/* FIXME : we must treat the OBJ_CASE_INSENTIVE Flag */
|
||||
/* ... but actually CmiObjectParse don't receive this information */
|
||||
FoundObject = CmiScanKeyList(ParsedKey,cPath);
|
||||
|
||||
FoundObject = CmiScanKeyList(ParsedKey,cPath,Attributes);
|
||||
if (FoundObject == NULL)
|
||||
{
|
||||
Status = CmiScanForSubKey(ParsedKey->RegistryFile,
|
||||
|
@ -2101,7 +2105,8 @@ static NTSTATUS CmiObjectParse(PVOID ParsedObject,
|
|||
&SubKeyBlock,
|
||||
&BlockOffset,
|
||||
cPath,
|
||||
0);
|
||||
0,
|
||||
Attributes);
|
||||
if(!NT_SUCCESS(Status) || SubKeyBlock == NULL)
|
||||
{
|
||||
if (end != NULL)
|
||||
|
@ -2258,7 +2263,9 @@ CmiRemoveKeyFromList(PKEY_OBJECT KeyToRemove)
|
|||
}
|
||||
|
||||
static PKEY_OBJECT
|
||||
CmiScanKeyList(PKEY_OBJECT Parent,PCHAR KeyName)
|
||||
CmiScanKeyList(PKEY_OBJECT Parent,
|
||||
PCHAR KeyName,
|
||||
ULONG Attributes)
|
||||
{
|
||||
KIRQL OldIrql;
|
||||
PKEY_OBJECT CurKey;
|
||||
|
@ -2270,13 +2277,23 @@ CmiScanKeyList(PKEY_OBJECT Parent,PCHAR KeyName)
|
|||
for (Index=0; Index < Parent->NumberOfSubKeys; Index++)
|
||||
{
|
||||
CurKey=Parent->SubKeys[Index];
|
||||
/* FIXME : perhaps we must not ignore case if NtCreateKey has not been */
|
||||
/* called with OBJ_CASE_INSENSITIVE flag ? */
|
||||
if( NameSize == CurKey->NameSize
|
||||
&& !_strnicmp(KeyName,CurKey->Name,NameSize))
|
||||
if (Attributes & OBJ_CASE_INSENSITIVE)
|
||||
{
|
||||
KeReleaseSpinLock(&CmiKeyListLock, OldIrql);
|
||||
return CurKey;
|
||||
if( NameSize == CurKey->NameSize
|
||||
&& !_strnicmp(KeyName,CurKey->Name,NameSize))
|
||||
{
|
||||
KeReleaseSpinLock(&CmiKeyListLock, OldIrql);
|
||||
return CurKey;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( NameSize == CurKey->NameSize
|
||||
&& !strncmp(KeyName,CurKey->Name,NameSize))
|
||||
{
|
||||
KeReleaseSpinLock(&CmiKeyListLock, OldIrql);
|
||||
return CurKey;
|
||||
}
|
||||
}
|
||||
}
|
||||
KeReleaseSpinLock(&CmiKeyListLock, OldIrql);
|
||||
|
@ -2585,7 +2602,8 @@ CmiScanForSubKey(IN PREGISTRY_FILE RegistryFile,
|
|||
OUT PKEY_BLOCK *SubKeyBlock,
|
||||
OUT BLOCK_OFFSET *BlockOffset,
|
||||
IN PCHAR KeyName,
|
||||
IN ACCESS_MASK DesiredAccess)
|
||||
IN ACCESS_MASK DesiredAccess,
|
||||
IN ULONG Attributes)
|
||||
{
|
||||
ULONG Idx;
|
||||
PHASH_TABLE_BLOCK HashBlock;
|
||||
|
@ -2602,24 +2620,46 @@ CmiScanForSubKey(IN PREGISTRY_FILE RegistryFile,
|
|||
for (Idx = 0; Idx < KeyBlock->NumberOfSubKeys
|
||||
&& Idx < HashBlock->HashTableSize; Idx++)
|
||||
{
|
||||
/* FIXME : perhaps we must not ignore case if NtCreateKey has not been */
|
||||
/* called with OBJ_CASE_INSENSITIVE flag ? */
|
||||
if (HashBlock->Table[Idx].KeyOffset != 0 &&
|
||||
HashBlock->Table[Idx].KeyOffset != -1 &&
|
||||
!_strnicmp(KeyName, (PCHAR) &HashBlock->Table[Idx].HashValue, 4))
|
||||
if (Attributes & OBJ_CASE_INSENSITIVE)
|
||||
{
|
||||
CurSubKeyBlock = CmiGetBlock(RegistryFile,
|
||||
HashBlock->Table[Idx].KeyOffset,NULL);
|
||||
if ( CurSubKeyBlock->NameSize == KeyLength
|
||||
&& !_strnicmp(KeyName, CurSubKeyBlock->Name, KeyLength))
|
||||
if (HashBlock->Table[Idx].KeyOffset != 0 &&
|
||||
HashBlock->Table[Idx].KeyOffset != -1 &&
|
||||
!_strnicmp(KeyName, (PCHAR) &HashBlock->Table[Idx].HashValue, 4))
|
||||
{
|
||||
*SubKeyBlock = CurSubKeyBlock;
|
||||
*BlockOffset = HashBlock->Table[Idx].KeyOffset;
|
||||
break;
|
||||
CurSubKeyBlock = CmiGetBlock(RegistryFile,
|
||||
HashBlock->Table[Idx].KeyOffset,NULL);
|
||||
if ( CurSubKeyBlock->NameSize == KeyLength
|
||||
&& !_strnicmp(KeyName, CurSubKeyBlock->Name, KeyLength))
|
||||
{
|
||||
*SubKeyBlock = CurSubKeyBlock;
|
||||
*BlockOffset = HashBlock->Table[Idx].KeyOffset;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
CmiReleaseBlock(RegistryFile, CurSubKeyBlock);
|
||||
}
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
if (HashBlock->Table[Idx].KeyOffset != 0 &&
|
||||
HashBlock->Table[Idx].KeyOffset != -1 &&
|
||||
!strncmp(KeyName, (PCHAR) &HashBlock->Table[Idx].HashValue, 4))
|
||||
{
|
||||
CmiReleaseBlock(RegistryFile, CurSubKeyBlock);
|
||||
CurSubKeyBlock = CmiGetBlock(RegistryFile,
|
||||
HashBlock->Table[Idx].KeyOffset,NULL);
|
||||
if ( CurSubKeyBlock->NameSize == KeyLength
|
||||
&& !_strnicmp(KeyName, CurSubKeyBlock->Name, KeyLength))
|
||||
{
|
||||
*SubKeyBlock = CurSubKeyBlock;
|
||||
*BlockOffset = HashBlock->Table[Idx].KeyOffset;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
CmiReleaseBlock(RegistryFile, CurSubKeyBlock);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: create.c,v 1.40 2001/05/01 23:08:19 chorns Exp $
|
||||
/* $Id: create.c,v 1.41 2001/05/05 09:32:36 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -78,16 +78,16 @@ IopCreateFile (PVOID ObjectBody,
|
|||
|
||||
if (NULL == DeviceObject)
|
||||
{
|
||||
/* This is probably an attempt to create a meta fileobject (eg. for FAT)
|
||||
for the cache manager, so return STATUS_SUCCESS */
|
||||
/* This is probably an attempt to create a meta fileobject (eg. for FAT)
|
||||
for the cache manager, so return STATUS_SUCCESS */
|
||||
DPRINT("DeviceObject was NULL\n");
|
||||
return (STATUS_SUCCESS);
|
||||
}
|
||||
if (IoDeviceObjectType != BODY_TO_HEADER(Parent)->ObjectType)
|
||||
{
|
||||
CPRINT("Parent is a %S which not a device type\n",
|
||||
BODY_TO_HEADER(Parent)->ObjectType->TypeName.Buffer);
|
||||
assert(FALSE);
|
||||
BODY_TO_HEADER(Parent)->ObjectType->TypeName.Buffer);
|
||||
assert(FALSE);
|
||||
return (STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
Status = ObReferenceObjectByPointer (DeviceObject,
|
||||
|
@ -126,7 +126,7 @@ IopCreateFile (PVOID ObjectBody,
|
|||
&& (DeviceObject->DeviceType != FILE_DEVICE_MAILSLOT))
|
||||
{
|
||||
CPRINT ("Device was wrong type\n");
|
||||
assert(FALSE);
|
||||
assert(FALSE);
|
||||
return (STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: symlink.c,v 1.19 2001/03/07 16:48:42 dwelch Exp $
|
||||
/* $Id: symlink.c,v 1.20 2001/05/05 09:32:36 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -57,24 +57,19 @@ static GENERIC_MAPPING IopSymbolicLinkMapping = {
|
|||
* REVISIONS
|
||||
*/
|
||||
NTSTATUS
|
||||
IopCreateSymbolicLink (
|
||||
PVOID Object,
|
||||
PVOID Parent,
|
||||
PWSTR RemainingPath,
|
||||
POBJECT_ATTRIBUTES ObjectAttributes
|
||||
)
|
||||
IopCreateSymbolicLink(PVOID Object,
|
||||
PVOID Parent,
|
||||
PWSTR RemainingPath,
|
||||
POBJECT_ATTRIBUTES ObjectAttributes)
|
||||
{
|
||||
if ( (Parent != NULL)
|
||||
&& (RemainingPath != NULL)
|
||||
)
|
||||
{
|
||||
ObAddEntryDirectory(
|
||||
Parent,
|
||||
Object,
|
||||
RemainingPath + 1
|
||||
);
|
||||
}
|
||||
return STATUS_SUCCESS;
|
||||
if ((Parent != NULL)
|
||||
&& (RemainingPath != NULL))
|
||||
{
|
||||
ObAddEntryDirectory(Parent,
|
||||
Object,
|
||||
RemainingPath + 1);
|
||||
}
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
|
@ -91,71 +86,72 @@ IopCreateSymbolicLink (
|
|||
* REVISIONS
|
||||
*/
|
||||
NTSTATUS
|
||||
IopParseSymbolicLink (
|
||||
PVOID Object,
|
||||
PVOID * NextObject,
|
||||
PUNICODE_STRING FullPath,
|
||||
PWSTR * RemainingPath,
|
||||
POBJECT_TYPE ObjectType
|
||||
)
|
||||
IopParseSymbolicLink(PVOID Object,
|
||||
PVOID * NextObject,
|
||||
PUNICODE_STRING FullPath,
|
||||
PWSTR * RemainingPath,
|
||||
POBJECT_TYPE ObjectType,
|
||||
ULONG Attributes)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
PSYMLNK_OBJECT SymlinkObject = (PSYMLNK_OBJECT) Object;
|
||||
PVOID ReturnedObject;
|
||||
UNICODE_STRING TargetPath;
|
||||
|
||||
DPRINT("IopParseSymbolicLink (RemainingPath %S)\n", *RemainingPath);
|
||||
/*
|
||||
* Stop parsing if the entire path has been parsed and
|
||||
* the desired object is a symbolic link object.
|
||||
*/
|
||||
if (((*RemainingPath == NULL) || (**RemainingPath == 0)) &&
|
||||
(ObjectType == IoSymbolicLinkType))
|
||||
{
|
||||
DPRINT("Parsing stopped!\n");
|
||||
*NextObject = NULL;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
Status = ObReferenceObjectByName(
|
||||
SymlinkObject->Target.ObjectName,
|
||||
0,
|
||||
NULL,
|
||||
STANDARD_RIGHTS_REQUIRED,
|
||||
NULL,
|
||||
UserMode,
|
||||
NULL,
|
||||
& ReturnedObject
|
||||
);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
*NextObject = ReturnedObject;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* 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 = ExAllocatePoolWithTag (NonPagedPool,
|
||||
TargetPath.MaximumLength,
|
||||
TAG_SYMLINK_TTARGET);
|
||||
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;
|
||||
NTSTATUS Status;
|
||||
PSYMLNK_OBJECT SymlinkObject = (PSYMLNK_OBJECT) Object;
|
||||
PVOID ReturnedObject;
|
||||
UNICODE_STRING TargetPath;
|
||||
|
||||
DPRINT("IopParseSymbolicLink (RemainingPath %S)\n", *RemainingPath);
|
||||
/*
|
||||
* Stop parsing if the entire path has been parsed and
|
||||
* the desired object is a symbolic link object.
|
||||
*/
|
||||
if (((*RemainingPath == NULL) || (**RemainingPath == 0)) &&
|
||||
(ObjectType == IoSymbolicLinkType))
|
||||
{
|
||||
DPRINT("Parsing stopped!\n");
|
||||
*NextObject = NULL;
|
||||
return STATUS_REPARSE;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
Status = ObReferenceObjectByName(SymlinkObject->Target.ObjectName,
|
||||
0,
|
||||
NULL,
|
||||
STANDARD_RIGHTS_REQUIRED,
|
||||
NULL,
|
||||
UserMode,
|
||||
NULL,
|
||||
&ReturnedObject);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
*NextObject = ReturnedObject;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* 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 = ExAllocatePoolWithTag(NonPagedPool,
|
||||
TargetPath.MaximumLength,
|
||||
TAG_SYMLINK_TTARGET);
|
||||
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;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
|
@ -212,13 +208,10 @@ VOID IoInitSymbolicLinkImplementation (VOID)
|
|||
* REVISIONS
|
||||
*
|
||||
*/
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NtOpenSymbolicLinkObject (
|
||||
OUT PHANDLE LinkHandle,
|
||||
IN ACCESS_MASK DesiredAccess,
|
||||
IN POBJECT_ATTRIBUTES ObjectAttributes
|
||||
)
|
||||
NTSTATUS STDCALL
|
||||
NtOpenSymbolicLinkObject(OUT PHANDLE LinkHandle,
|
||||
IN ACCESS_MASK DesiredAccess,
|
||||
IN POBJECT_ATTRIBUTES ObjectAttributes)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
PVOID Object;
|
||||
|
@ -270,41 +263,34 @@ NtOpenSymbolicLinkObject (
|
|||
* REVISIONS
|
||||
*
|
||||
*/
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NtQuerySymbolicLinkObject (
|
||||
IN HANDLE LinkHandle,
|
||||
IN OUT PUNICODE_STRING LinkTarget,
|
||||
OUT PULONG ReturnedLength OPTIONAL
|
||||
)
|
||||
NTSTATUS STDCALL
|
||||
NtQuerySymbolicLinkObject(IN HANDLE LinkHandle,
|
||||
IN OUT PUNICODE_STRING LinkTarget,
|
||||
OUT PULONG ReturnedLength OPTIONAL)
|
||||
{
|
||||
PSYMLNK_OBJECT SymlinkObject;
|
||||
NTSTATUS Status;
|
||||
PSYMLNK_OBJECT SymlinkObject;
|
||||
NTSTATUS Status;
|
||||
|
||||
Status = ObReferenceObjectByHandle(
|
||||
LinkHandle,
|
||||
SYMBOLIC_LINK_QUERY,
|
||||
IoSymbolicLinkType,
|
||||
UserMode,
|
||||
(PVOID *) & SymlinkObject,
|
||||
NULL
|
||||
);
|
||||
if (Status != STATUS_SUCCESS)
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
Status = ObReferenceObjectByHandle(LinkHandle,
|
||||
SYMBOLIC_LINK_QUERY,
|
||||
IoSymbolicLinkType,
|
||||
UserMode,
|
||||
(PVOID *)&SymlinkObject,
|
||||
NULL);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return(Status);
|
||||
}
|
||||
|
||||
RtlCopyUnicodeString(
|
||||
LinkTarget,
|
||||
SymlinkObject->Target.ObjectName
|
||||
);
|
||||
if (ReturnedLength != NULL)
|
||||
{
|
||||
*ReturnedLength = SymlinkObject->Target.Length;
|
||||
}
|
||||
ObDereferenceObject(SymlinkObject);
|
||||
RtlCopyUnicodeString(LinkTarget,
|
||||
SymlinkObject->Target.ObjectName);
|
||||
if (ReturnedLength != NULL)
|
||||
{
|
||||
*ReturnedLength = SymlinkObject->Target.Length;
|
||||
}
|
||||
ObDereferenceObject(SymlinkObject);
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
|
@ -321,17 +307,12 @@ NtQuerySymbolicLinkObject (
|
|||
* REVISIONS
|
||||
*
|
||||
*/
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
IoCreateUnprotectedSymbolicLink (
|
||||
PUNICODE_STRING SymbolicLinkName,
|
||||
PUNICODE_STRING DeviceName
|
||||
)
|
||||
NTSTATUS STDCALL
|
||||
IoCreateUnprotectedSymbolicLink(PUNICODE_STRING SymbolicLinkName,
|
||||
PUNICODE_STRING DeviceName)
|
||||
{
|
||||
return IoCreateSymbolicLink(
|
||||
SymbolicLinkName,
|
||||
DeviceName
|
||||
);
|
||||
return IoCreateSymbolicLink(SymbolicLinkName,
|
||||
DeviceName);
|
||||
}
|
||||
|
||||
|
||||
|
@ -348,12 +329,9 @@ IoCreateUnprotectedSymbolicLink (
|
|||
* REVISIONS
|
||||
*
|
||||
*/
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
IoCreateSymbolicLink (
|
||||
PUNICODE_STRING SymbolicLinkName,
|
||||
PUNICODE_STRING DeviceName
|
||||
)
|
||||
NTSTATUS STDCALL
|
||||
IoCreateSymbolicLink(PUNICODE_STRING SymbolicLinkName,
|
||||
PUNICODE_STRING DeviceName)
|
||||
{
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
PSYMLNK_OBJECT SymbolicLink;
|
||||
|
@ -424,11 +402,8 @@ IoCreateSymbolicLink (
|
|||
* REVISIONS
|
||||
*
|
||||
*/
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
IoDeleteSymbolicLink (
|
||||
PUNICODE_STRING SymbolicLinkName
|
||||
)
|
||||
NTSTATUS STDCALL
|
||||
IoDeleteSymbolicLink(PUNICODE_STRING SymbolicLinkName)
|
||||
{
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
HANDLE Handle;
|
||||
|
@ -471,63 +446,52 @@ IoDeleteSymbolicLink (
|
|||
* REVISIONS
|
||||
*
|
||||
*/
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NtCreateSymbolicLinkObject (
|
||||
OUT PHANDLE SymbolicLinkHandle,
|
||||
IN ACCESS_MASK DesiredAccess,
|
||||
IN POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
IN PUNICODE_STRING DeviceName
|
||||
)
|
||||
NTSTATUS STDCALL
|
||||
NtCreateSymbolicLinkObject(OUT PHANDLE SymbolicLinkHandle,
|
||||
IN ACCESS_MASK DesiredAccess,
|
||||
IN POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
IN PUNICODE_STRING DeviceName)
|
||||
{
|
||||
PSYMLNK_OBJECT SymbolicLink;
|
||||
PSYMLNK_OBJECT SymbolicLink;
|
||||
|
||||
assert_irql(PASSIVE_LEVEL);
|
||||
assert_irql(PASSIVE_LEVEL);
|
||||
|
||||
DPRINT(
|
||||
"NtCreateSymbolicLinkObject(SymbolicLinkHandle %p, DesiredAccess %ul, ObjectAttributes %p, DeviceName %S)\n",
|
||||
SymbolicLinkHandle,
|
||||
DesiredAccess,
|
||||
ObjectAttributes,
|
||||
DeviceName->Buffer
|
||||
);
|
||||
DPRINT("NtCreateSymbolicLinkObject(SymbolicLinkHandle %p, DesiredAccess %ul, ObjectAttributes %p, DeviceName %S)\n",
|
||||
SymbolicLinkHandle,
|
||||
DesiredAccess,
|
||||
ObjectAttributes,
|
||||
DeviceName->Buffer);
|
||||
|
||||
SymbolicLink = ObCreateObject(
|
||||
SymbolicLinkHandle,
|
||||
DesiredAccess,
|
||||
ObjectAttributes,
|
||||
IoSymbolicLinkType
|
||||
);
|
||||
if (SymbolicLink == NULL)
|
||||
{
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
SymbolicLink = ObCreateObject(SymbolicLinkHandle,
|
||||
DesiredAccess,
|
||||
ObjectAttributes,
|
||||
IoSymbolicLinkType);
|
||||
if (SymbolicLink == NULL)
|
||||
{
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
SymbolicLink->TargetName.Length = 0;
|
||||
SymbolicLink->TargetName.MaximumLength =
|
||||
((wcslen(DeviceName->Buffer) + 1) * sizeof(WCHAR));
|
||||
SymbolicLink->TargetName.Buffer =
|
||||
ExAllocatePoolWithTag(NonPagedPool,
|
||||
SymbolicLink->TargetName.MaximumLength,
|
||||
TAG_SYMLINK_TARGET);
|
||||
RtlCopyUnicodeString(
|
||||
& (SymbolicLink->TargetName),
|
||||
DeviceName
|
||||
);
|
||||
SymbolicLink->TargetName.Length = 0;
|
||||
SymbolicLink->TargetName.MaximumLength =
|
||||
((wcslen(DeviceName->Buffer) + 1) * sizeof(WCHAR));
|
||||
SymbolicLink->TargetName.Buffer =
|
||||
ExAllocatePoolWithTag(NonPagedPool,
|
||||
SymbolicLink->TargetName.MaximumLength,
|
||||
TAG_SYMLINK_TARGET);
|
||||
RtlCopyUnicodeString(&SymbolicLink->TargetName,
|
||||
DeviceName);
|
||||
|
||||
DPRINT("DeviceName %S\n", SymbolicLink->TargetName.Buffer);
|
||||
DPRINT("DeviceName %S\n", SymbolicLink->TargetName.Buffer);
|
||||
|
||||
InitializeObjectAttributes(
|
||||
& (SymbolicLink->Target),
|
||||
& (SymbolicLink->TargetName),
|
||||
0,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
InitializeObjectAttributes(&SymbolicLink->Target,
|
||||
&SymbolicLink->TargetName,
|
||||
0,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
DPRINT("%s() = STATUS_SUCCESS\n",__FUNCTION__);
|
||||
ObDereferenceObject( SymbolicLink );
|
||||
return STATUS_SUCCESS;
|
||||
DPRINT("%s() = STATUS_SUCCESS\n",__FUNCTION__);
|
||||
ObDereferenceObject(SymbolicLink);
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: namespc.c,v 1.22 2001/05/04 21:44:21 ea Exp $
|
||||
/* $Id: namespc.c,v 1.23 2001/05/05 09:33:16 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -149,9 +149,10 @@ ObOpenObjectByName(POBJECT_ATTRIBUTES ObjectAttributes,
|
|||
}
|
||||
|
||||
|
||||
VOID STDCALL ObAddEntryDirectory(PDIRECTORY_OBJECT Parent,
|
||||
POBJECT Object,
|
||||
PWSTR Name)
|
||||
VOID STDCALL
|
||||
ObAddEntryDirectory(PDIRECTORY_OBJECT Parent,
|
||||
POBJECT Object,
|
||||
PWSTR Name)
|
||||
/*
|
||||
* FUNCTION: Add an entry to a namespace directory
|
||||
* ARGUMENTS:
|
||||
|
@ -171,9 +172,10 @@ VOID STDCALL ObAddEntryDirectory(PDIRECTORY_OBJECT Parent,
|
|||
KeReleaseSpinLock(&Parent->Lock, oldlvl);
|
||||
}
|
||||
|
||||
PVOID ObpFindEntryDirectory(PDIRECTORY_OBJECT DirectoryObject,
|
||||
PWSTR Name,
|
||||
ULONG Attributes)
|
||||
PVOID
|
||||
ObpFindEntryDirectory(PDIRECTORY_OBJECT DirectoryObject,
|
||||
PWSTR Name,
|
||||
ULONG Attributes)
|
||||
{
|
||||
PLIST_ENTRY current = DirectoryObject->head.Flink;
|
||||
POBJECT_HEADER current_obj;
|
||||
|
@ -219,13 +221,12 @@ PVOID ObpFindEntryDirectory(PDIRECTORY_OBJECT DirectoryObject,
|
|||
}
|
||||
|
||||
NTSTATUS
|
||||
ObpParseDirectory (
|
||||
PVOID Object,
|
||||
PVOID * NextObject,
|
||||
PUNICODE_STRING FullPath,
|
||||
PWSTR * Path,
|
||||
POBJECT_TYPE ObjectType
|
||||
)
|
||||
ObpParseDirectory(PVOID Object,
|
||||
PVOID * NextObject,
|
||||
PUNICODE_STRING FullPath,
|
||||
PWSTR * Path,
|
||||
POBJECT_TYPE ObjectType,
|
||||
ULONG Attributes)
|
||||
{
|
||||
PWSTR end;
|
||||
PVOID FoundObject;
|
||||
|
@ -246,7 +247,7 @@ ObpParseDirectory (
|
|||
*end = 0;
|
||||
}
|
||||
|
||||
FoundObject = ObpFindEntryDirectory(Object, (*Path)+1, 0);
|
||||
FoundObject = ObpFindEntryDirectory(Object, (*Path)+1, Attributes);
|
||||
|
||||
if (FoundObject == NULL)
|
||||
{
|
||||
|
@ -277,10 +278,11 @@ ObpParseDirectory (
|
|||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS ObpCreateDirectory(PVOID ObjectBody,
|
||||
PVOID Parent,
|
||||
PWSTR RemainingPath,
|
||||
POBJECT_ATTRIBUTES ObjectAttributes)
|
||||
NTSTATUS
|
||||
ObpCreateDirectory(PVOID ObjectBody,
|
||||
PVOID Parent,
|
||||
PWSTR RemainingPath,
|
||||
POBJECT_ATTRIBUTES ObjectAttributes)
|
||||
{
|
||||
PDIRECTORY_OBJECT DirectoryObject = (PDIRECTORY_OBJECT)ObjectBody;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: object.c,v 1.36 2001/05/01 23:08:20 chorns Exp $
|
||||
/* $Id: object.c,v 1.37 2001/05/05 09:33:16 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -174,7 +174,7 @@ NTSTATUS ObFindObject(POBJECT_ATTRIBUTES ObjectAttributes,
|
|||
CurrentHeader = BODY_TO_HEADER(CurrentObject);
|
||||
|
||||
DPRINT("Current ObjectType %wZ\n",
|
||||
&CurrentHeader->ObjectType->TypeName);
|
||||
&CurrentHeader->ObjectType->TypeName);
|
||||
|
||||
if (CurrentHeader->ObjectType->Parse == NULL)
|
||||
{
|
||||
|
@ -185,7 +185,8 @@ NTSTATUS ObFindObject(POBJECT_ATTRIBUTES ObjectAttributes,
|
|||
&NextObject,
|
||||
&PathString,
|
||||
¤t,
|
||||
ObjectType);
|
||||
ObjectType,
|
||||
ObjectAttributes->Attributes);
|
||||
if (Status == STATUS_REPARSE)
|
||||
{
|
||||
/* reparse the object path */
|
||||
|
@ -285,10 +286,10 @@ ObCreateObject(PHANDLE Handle,
|
|||
ObjectAttributes);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
if (Parent)
|
||||
{
|
||||
ObDereferenceObject( Parent );
|
||||
}
|
||||
if (Parent)
|
||||
{
|
||||
ObDereferenceObject( Parent );
|
||||
}
|
||||
RtlFreeUnicodeString( &Header->Name );
|
||||
RtlFreeUnicodeString( &RemainingPath );
|
||||
ExFreePool( Header );
|
||||
|
|
Loading…
Reference in a new issue