mirror of
https://github.com/reactos/reactos.git
synced 2025-04-18 03:34:11 +00:00
Current directory now always with correct casing.
svn path=/trunk/; revision=1675
This commit is contained in:
parent
c5cdaa420a
commit
03e327f37f
1 changed files with 36 additions and 11 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $Id: path.c,v 1.6 2000/09/01 17:05:46 ekohl Exp $
|
||||
/* $Id: path.c,v 1.7 2001/03/07 22:29:09 cnettel Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -119,7 +119,7 @@ RtlDetermineDosPathNameType_U (
|
|||
PWSTR Path
|
||||
)
|
||||
{
|
||||
DPRINT ("RtlDetermineDosPathNameType_U %S\n", Path);
|
||||
// DPRINT ("RtlDetermineDosPathNameType_U %S\n", Path);
|
||||
|
||||
if (Path == NULL)
|
||||
return 0;
|
||||
|
@ -240,7 +240,7 @@ RtlGetCurrentDirectory_U (
|
|||
ULONG Length;
|
||||
PCURDIR cd;
|
||||
|
||||
DPRINT ("RtlGetCurrentDirectory %lu %p\n", MaximumLength, Buffer);
|
||||
// DPRINT ("RtlGetCurrentDirectory %lu %p\n", MaximumLength, Buffer);
|
||||
|
||||
cd = &(NtCurrentPeb ()->ProcessParameters->CurrentDirectory);
|
||||
|
||||
|
@ -250,8 +250,8 @@ RtlGetCurrentDirectory_U (
|
|||
cd->DosPath.Buffer[Length - 2] != L':')
|
||||
Length--;
|
||||
|
||||
DPRINT ("cd->DosPath.Buffer %S Length %d\n",
|
||||
cd->DosPath.Buffer, Length);
|
||||
// DPRINT ("cd->DosPath.Buffer %S Length %d\n",
|
||||
// cd->DosPath.Buffer, Length);
|
||||
|
||||
if (MaximumLength / sizeof(WCHAR) > Length)
|
||||
{
|
||||
|
@ -283,7 +283,10 @@ NTSTATUS STDCALL RtlSetCurrentDirectory_U (PUNICODE_STRING name)
|
|||
ULONG size;
|
||||
HANDLE handle = NULL;
|
||||
PWSTR wcs;
|
||||
PWSTR devpathstart, loopvar;
|
||||
PWSTR buf = 0;
|
||||
PFILE_NAME_INFORMATION objnameinfo;
|
||||
ULONG reslength;
|
||||
|
||||
DPRINT ("RtlSetCurrentDirectory %wZ\n", name);
|
||||
|
||||
|
@ -334,6 +337,28 @@ NTSTATUS STDCALL RtlSetCurrentDirectory_U (PUNICODE_STRING name)
|
|||
&iosb,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT);
|
||||
|
||||
objnameinfo = RtlAllocateHeap (RtlGetProcessHeap(),
|
||||
0,
|
||||
cd->DosPath.MaximumLength*sizeof(WCHAR)+4); // A little margin, for Length pre-fix
|
||||
|
||||
NtQueryInformationFile(handle,NULL,objnameinfo,sizeof(OBJECT_NAME_INFORMATION),FileNameInformation);
|
||||
|
||||
devpathstart=buf+wcslen(buf);
|
||||
|
||||
for (loopvar=objnameinfo->FileName;(*loopvar);loopvar++)
|
||||
if ((*loopvar)=='\\')
|
||||
{
|
||||
devpathstart--;
|
||||
for (;devpathstart>buf && (*devpathstart)!='\\';devpathstart--) {}
|
||||
}
|
||||
|
||||
wcscpy(devpathstart, objnameinfo->FileName);
|
||||
|
||||
|
||||
RtlFreeHeap (RtlGetProcessHeap (),
|
||||
0,
|
||||
objnameinfo);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
RtlFreeHeap (RtlGetProcessHeap (),
|
||||
|
@ -394,8 +419,8 @@ RtlGetFullPathName_U (
|
|||
PCURDIR cd;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("RtlGetFullPathName_U %S %ld %p %p\n",
|
||||
DosName, size, buf, FilePart);
|
||||
// DPRINT("RtlGetFullPathName_U %S %ld %p %p\n",
|
||||
// DosName, size, buf, FilePart);
|
||||
|
||||
if (!DosName || !*DosName)
|
||||
return 0;
|
||||
|
@ -436,7 +461,7 @@ CHECKPOINT;
|
|||
RtlAcquirePebLock();
|
||||
|
||||
cd = &(NtCurrentPeb ()->ProcessParameters->CurrentDirectory);
|
||||
DPRINT("type %ld\n", type);
|
||||
//DPRINT("type %ld\n", type);
|
||||
switch (type)
|
||||
{
|
||||
case 1: /* \\xxx or \\.xxx */
|
||||
|
@ -507,7 +532,7 @@ CHECKPOINT;
|
|||
return 0;
|
||||
}
|
||||
|
||||
DPRINT("buf \'%S\' DosName \'%S\' len %ld\n", buf, DosName, len);
|
||||
// DPRINT("buf \'%S\' DosName \'%S\' len %ld\n", buf, DosName, len);
|
||||
/* add dosname to prefix */
|
||||
wcsncat (buf, DosName, len);
|
||||
|
||||
|
@ -521,9 +546,9 @@ CHECKPOINT;
|
|||
if (len < 3 && buf[len-1] == L':')
|
||||
wcscat (buf, L"\\");
|
||||
|
||||
DPRINT("buf \'%S\'\n", buf);
|
||||
// DPRINT("buf \'%S\'\n", buf);
|
||||
RtlpEatPath (buf);
|
||||
DPRINT("buf \'%S\'\n", buf);
|
||||
// DPRINT("buf \'%S\'\n", buf);
|
||||
|
||||
len = wcslen (buf);
|
||||
|
||||
|
|
Loading…
Reference in a new issue