Revert 59183 on hbelusca's request.

svn path=/trunk/; revision=59184
This commit is contained in:
Sylvain Petreolle 2013-06-07 09:36:37 +00:00
parent 917be25184
commit d93b910537
4 changed files with 41 additions and 46 deletions

View file

@ -762,7 +762,7 @@ static BOOL PROFILE_Open( LPCWSTR filename, BOOL write_access )
if (!filename) if (!filename)
filename = wininiW; filename = wininiW;
if ((RtlDetermineDosPathNameType_U(filename) == RtlPathTypeRelative) && if ((RtlDetermineDosPathNameType_U(filename) == RELATIVE_PATH) &&
!strchrW(filename, '\\') && !strchrW(filename, '/')) !strchrW(filename, '\\') && !strchrW(filename, '/'))
{ {
static const WCHAR wszSeparator[] = {'\\', 0}; static const WCHAR wszSeparator[] = {'\\', 0};

View file

@ -2617,7 +2617,7 @@ RtlDoesFileExists_U(
); );
NTSYSAPI NTSYSAPI
RTL_PATH_TYPE ULONG
NTAPI NTAPI
RtlDetermineDosPathNameType_U( RtlDetermineDosPathNameType_U(
_In_ PCWSTR Path _In_ PCWSTR Path

View file

@ -861,18 +861,18 @@ typedef struct _TIMER_BASIC_INFORMATION
} TIMER_BASIC_INFORMATION, *PTIMER_BASIC_INFORMATION; } TIMER_BASIC_INFORMATION, *PTIMER_BASIC_INFORMATION;
/* Return type of RtlDetermineDosPathNameType_U */ /* return type of RtlDetermineDosPathNameType_U (FIXME: not the correct names) */
typedef enum _RTL_PATH_TYPE typedef enum
{ {
RtlPathTypeUnknown, INVALID_PATH = 0,
RtlPathTypeUncAbsolute, UNC_PATH, /* "//foo" */
RtlPathTypeDriveAbsolute, ABSOLUTE_DRIVE_PATH, /* "c:/foo" */
RtlPathTypeDriveRelative, RELATIVE_DRIVE_PATH, /* "c:foo" */
RtlPathTypeRooted, ABSOLUTE_PATH, /* "/foo" */
RtlPathTypeRelative, RELATIVE_PATH, /* "foo" */
RtlPathTypeLocalDevice, DEVICE_PATH, /* "//./foo" */
RtlPathTypeRootLocalDevice, UNC_DOT_PATH /* "//." */
} RTL_PATH_TYPE; } DOS_PATHNAME_TYPE;
/*********************************************************************** /***********************************************************************
* IA64 specific types and data structures * IA64 specific types and data structures
@ -2130,7 +2130,7 @@ NTSTATUS WINAPI RtlDestroyHandleTable(RTL_HANDLE_TABLE *);
HANDLE WINAPI RtlDestroyHeap(HANDLE); HANDLE WINAPI RtlDestroyHeap(HANDLE);
void WINAPI RtlDestroyProcessParameters(RTL_USER_PROCESS_PARAMETERS*); void WINAPI RtlDestroyProcessParameters(RTL_USER_PROCESS_PARAMETERS*);
NTSTATUS WINAPI RtlDestroyQueryDebugBuffer(PDEBUG_BUFFER); NTSTATUS WINAPI RtlDestroyQueryDebugBuffer(PDEBUG_BUFFER);
RTL_PATH_TYPE WINAPI RtlDetermineDosPathNameType_U(PCWSTR); DOS_PATHNAME_TYPE WINAPI RtlDetermineDosPathNameType_U(PCWSTR);
BOOLEAN WINAPI RtlDoesFileExists_U(LPCWSTR); BOOLEAN WINAPI RtlDoesFileExists_U(LPCWSTR);
BOOLEAN WINAPI RtlDosPathNameToNtPathName_U(PCWSTR,PUNICODE_STRING,PCWSTR*,CURDIR*); BOOLEAN WINAPI RtlDosPathNameToNtPathName_U(PCWSTR,PUNICODE_STRING,PCWSTR*,CURDIR*);
ULONG WINAPI RtlDosSearchPath_U(LPCWSTR, LPCWSTR, LPCWSTR, ULONG, LPWSTR, LPWSTR*); ULONG WINAPI RtlDosSearchPath_U(LPCWSTR, LPCWSTR, LPCWSTR, ULONG, LPWSTR, LPWSTR*);

View file

@ -160,7 +160,7 @@ RtlIsDosDeviceName_Ustr(IN PCUNICODE_STRING PathString)
{ {
/* Check if the character is a path or drive separator */ /* Check if the character is a path or drive separator */
c = *End; c = *End;
if (IS_PATH_SEPARATOR(c) || ((c == ':') && (End == PathCopy.Buffer + 1))) if ((c == '\\') || (c == '/') || ((c == ':') && (End == PathCopy.Buffer + 1)))
{ {
/* Get the next lower case character */ /* Get the next lower case character */
End++; End++;
@ -422,33 +422,30 @@ RtlpWin32NTNameToNtPathName_U(IN PUNICODE_STRING DosPath,
if (PartName) if (PartName)
{ {
/* Loop from the back until we find a path separator */ /* Loop from the back until we find a path separator */
p = &NewBuffer[DosLength / sizeof (WCHAR)]; p = &NewBuffer[(DosLength - 1) / sizeof (WCHAR)];
while (--p > NewBuffer) while (p > NewBuffer) if (*p-- == '\\') break;
{
/* We found a path separator, move past it */
if (*p == OBJ_NAME_PATH_SEPARATOR)
{
++p;
break;
}
}
/* Check whether a separator was found and if something remains */ /* Was one found? */
if ((p > NewBuffer) && *p) if (p > NewBuffer)
{ {
/* What follows the path separator is the partial name */ /* Move past it -- anything left? */
*PartName = p; p++;
} if (!*p)
else {
{ /* The path ends with a path separator, no part name */
/* The path ends with a path separator, no partial name */ *PartName = NULL;
*PartName = NULL; }
else
{
/* What follows the path separator is the part name */
*PartName = p;
}
} }
} }
/* Build the final NT path string */ /* Build the final NT path string */
NtPath->Buffer = NewBuffer;
NtPath->Length = (USHORT)DosLength; NtPath->Length = (USHORT)DosLength;
NtPath->Buffer = NewBuffer;
NtPath->MaximumLength = (USHORT)DosLength + sizeof(UNICODE_NULL); NtPath->MaximumLength = (USHORT)DosLength + sizeof(UNICODE_NULL);
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
@ -577,6 +574,7 @@ RtlpDosPathNameToRelativeNtPathName_Ustr(IN BOOLEAN HaveRelative,
/* Nothing else is expected */ /* Nothing else is expected */
default: default:
ASSERT(FALSE); ASSERT(FALSE);
} }
/* Now copy the prefix and the buffer */ /* Now copy the prefix and the buffer */
@ -594,7 +592,7 @@ RtlpDosPathNameToRelativeNtPathName_Ustr(IN BOOLEAN HaveRelative,
NtName->Length = (USHORT)Length; NtName->Length = (USHORT)Length;
NtName->MaximumLength = (USHORT)MaxLength; NtName->MaximumLength = (USHORT)MaxLength;
NewBuffer[LengthChars] = UNICODE_NULL; NewBuffer[LengthChars] = UNICODE_NULL;
DPRINT("New buffer: %S\n", NewBuffer); DPRINT("new buffer: %S\n", NewBuffer);
DPRINT("NT Name: %wZ\n", NtName); DPRINT("NT Name: %wZ\n", NtName);
/* Check if a partial name was requested */ /* Check if a partial name was requested */
@ -653,7 +651,7 @@ RtlpDosPathNameToRelativeNtPathName_Ustr(IN BOOLEAN HaveRelative,
RelativeName->RelativeName.Buffer = (PWSTR)((ULONG_PTR)NewBuffer + PrefixLength + FullPath.Length - PrefixCut * sizeof(WCHAR)); RelativeName->RelativeName.Buffer = (PWSTR)((ULONG_PTR)NewBuffer + PrefixLength + FullPath.Length - PrefixCut * sizeof(WCHAR));
RelativeName->RelativeName.Length = (USHORT)(PathLength - FullPath.Length); RelativeName->RelativeName.Length = (USHORT)(PathLength - FullPath.Length);
/* If relative name starts with \, skip it */ /* If relative name starts with \, skip it */
if (RelativeName->RelativeName.Buffer[0] == OBJ_NAME_PATH_SEPARATOR) if (RelativeName->RelativeName.Buffer[0] == L'\\')
{ {
RelativeName->RelativeName.Buffer++; RelativeName->RelativeName.Buffer++;
RelativeName->RelativeName.Length -= sizeof(WCHAR); RelativeName->RelativeName.Length -= sizeof(WCHAR);
@ -869,7 +867,7 @@ RtlGetLongestNtPathLength(VOID)
/* /*
* @implemented * @implemented
*/ */
RTL_PATH_TYPE ULONG
NTAPI NTAPI
RtlDetermineDosPathNameType_U(IN PCWSTR Path) RtlDetermineDosPathNameType_U(IN PCWSTR Path)
{ {
@ -1123,7 +1121,7 @@ RtlSetCurrentDirectory_U(IN PUNICODE_STRING Path)
FullPath.Length = (USHORT)FullPathLength; FullPath.Length = (USHORT)FullPathLength;
/* If full path isn't \ terminated, do it */ /* If full path isn't \ terminated, do it */
if (FullPath.Buffer[CharLength - 1] != OBJ_NAME_PATH_SEPARATOR) if (FullPath.Buffer[CharLength - 1] != L'\\')
{ {
if ((CharLength + 1) * sizeof(WCHAR) > SavedLength) if ((CharLength + 1) * sizeof(WCHAR) > SavedLength)
{ {
@ -1131,7 +1129,7 @@ RtlSetCurrentDirectory_U(IN PUNICODE_STRING Path)
goto Leave; goto Leave;
} }
FullPath.Buffer[CharLength] = OBJ_NAME_PATH_SEPARATOR; FullPath.Buffer[CharLength] = L'\\';
FullPath.Buffer[CharLength + 1] = UNICODE_NULL; FullPath.Buffer[CharLength + 1] = UNICODE_NULL;
FullPath.Length += sizeof(WCHAR); FullPath.Length += sizeof(WCHAR);
} }
@ -1502,8 +1500,6 @@ ULONG NTAPI RtlGetFullPathName_U(
if (!name || !*name) return 0; if (!name || !*name) return 0;
RtlZeroMemory(buffer, size);
if (file_part) *file_part = NULL; if (file_part) *file_part = NULL;
/* check for DOS device name */ /* check for DOS device name */
@ -1737,9 +1733,9 @@ RtlDosSearchPath_U(IN PCWSTR Path,
} }
/* Add a terminating slash if needed */ /* Add a terminating slash if needed */
if ((BufferStart != NewBuffer) && (BufferStart[-1] != OBJ_NAME_PATH_SEPARATOR)) if ((BufferStart != NewBuffer) && (BufferStart[-1] != '\\'))
{ {
*BufferStart++ = OBJ_NAME_PATH_SEPARATOR; *BufferStart++ = '\\';
} }
/* Bail out if we reached the end */ /* Bail out if we reached the end */
@ -2055,7 +2051,6 @@ RtlDosSearchPath_Ustr(IN ULONG Flags,
/* Initialize optional arguments */ /* Initialize optional arguments */
if (FullNameOut) *FullNameOut = NULL; if (FullNameOut) *FullNameOut = NULL;
if (FilePartSize) *FilePartSize = 0; if (FilePartSize) *FilePartSize = 0;
if (LengthNeeded) *LengthNeeded = 0;
if (DynamicString) if (DynamicString)
{ {
DynamicString->Length = DynamicString->MaximumLength = 0; DynamicString->Length = DynamicString->MaximumLength = 0;
@ -2327,7 +2322,7 @@ RtlDosSearchPath_Ustr(IN ULONG Flags,
&StaticCandidateString, &StaticCandidateString,
Status); Status);
} }
DPRINT("Status: %lx BUFFER: %S\n", Status, CallerBuffer->Buffer); DPRINT("STatus: %lx BUFFER: %S\n", Status, CallerBuffer->Buffer);
goto Quickie; goto Quickie;
} }
else else