mirror of
https://github.com/reactos/reactos.git
synced 2024-07-04 11:44:33 +00:00
Current directory now always with correct casing.
svn path=/trunk/; revision=1675
This commit is contained in:
parent
c5cdaa420a
commit
03e327f37f
|
@ -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
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
|
@ -119,7 +119,7 @@ RtlDetermineDosPathNameType_U (
|
||||||
PWSTR Path
|
PWSTR Path
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
DPRINT ("RtlDetermineDosPathNameType_U %S\n", Path);
|
// DPRINT ("RtlDetermineDosPathNameType_U %S\n", Path);
|
||||||
|
|
||||||
if (Path == NULL)
|
if (Path == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -240,7 +240,7 @@ RtlGetCurrentDirectory_U (
|
||||||
ULONG Length;
|
ULONG Length;
|
||||||
PCURDIR cd;
|
PCURDIR cd;
|
||||||
|
|
||||||
DPRINT ("RtlGetCurrentDirectory %lu %p\n", MaximumLength, Buffer);
|
// DPRINT ("RtlGetCurrentDirectory %lu %p\n", MaximumLength, Buffer);
|
||||||
|
|
||||||
cd = &(NtCurrentPeb ()->ProcessParameters->CurrentDirectory);
|
cd = &(NtCurrentPeb ()->ProcessParameters->CurrentDirectory);
|
||||||
|
|
||||||
|
@ -250,8 +250,8 @@ RtlGetCurrentDirectory_U (
|
||||||
cd->DosPath.Buffer[Length - 2] != L':')
|
cd->DosPath.Buffer[Length - 2] != L':')
|
||||||
Length--;
|
Length--;
|
||||||
|
|
||||||
DPRINT ("cd->DosPath.Buffer %S Length %d\n",
|
// DPRINT ("cd->DosPath.Buffer %S Length %d\n",
|
||||||
cd->DosPath.Buffer, Length);
|
// cd->DosPath.Buffer, Length);
|
||||||
|
|
||||||
if (MaximumLength / sizeof(WCHAR) > Length)
|
if (MaximumLength / sizeof(WCHAR) > Length)
|
||||||
{
|
{
|
||||||
|
@ -283,7 +283,10 @@ NTSTATUS STDCALL RtlSetCurrentDirectory_U (PUNICODE_STRING name)
|
||||||
ULONG size;
|
ULONG size;
|
||||||
HANDLE handle = NULL;
|
HANDLE handle = NULL;
|
||||||
PWSTR wcs;
|
PWSTR wcs;
|
||||||
|
PWSTR devpathstart, loopvar;
|
||||||
PWSTR buf = 0;
|
PWSTR buf = 0;
|
||||||
|
PFILE_NAME_INFORMATION objnameinfo;
|
||||||
|
ULONG reslength;
|
||||||
|
|
||||||
DPRINT ("RtlSetCurrentDirectory %wZ\n", name);
|
DPRINT ("RtlSetCurrentDirectory %wZ\n", name);
|
||||||
|
|
||||||
|
@ -334,6 +337,28 @@ NTSTATUS STDCALL RtlSetCurrentDirectory_U (PUNICODE_STRING name)
|
||||||
&iosb,
|
&iosb,
|
||||||
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||||
FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT);
|
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))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
RtlFreeHeap (RtlGetProcessHeap (),
|
RtlFreeHeap (RtlGetProcessHeap (),
|
||||||
|
@ -394,8 +419,8 @@ RtlGetFullPathName_U (
|
||||||
PCURDIR cd;
|
PCURDIR cd;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
DPRINT("RtlGetFullPathName_U %S %ld %p %p\n",
|
// DPRINT("RtlGetFullPathName_U %S %ld %p %p\n",
|
||||||
DosName, size, buf, FilePart);
|
// DosName, size, buf, FilePart);
|
||||||
|
|
||||||
if (!DosName || !*DosName)
|
if (!DosName || !*DosName)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -436,7 +461,7 @@ CHECKPOINT;
|
||||||
RtlAcquirePebLock();
|
RtlAcquirePebLock();
|
||||||
|
|
||||||
cd = &(NtCurrentPeb ()->ProcessParameters->CurrentDirectory);
|
cd = &(NtCurrentPeb ()->ProcessParameters->CurrentDirectory);
|
||||||
DPRINT("type %ld\n", type);
|
//DPRINT("type %ld\n", type);
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case 1: /* \\xxx or \\.xxx */
|
case 1: /* \\xxx or \\.xxx */
|
||||||
|
@ -507,7 +532,7 @@ CHECKPOINT;
|
||||||
return 0;
|
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 */
|
/* add dosname to prefix */
|
||||||
wcsncat (buf, DosName, len);
|
wcsncat (buf, DosName, len);
|
||||||
|
|
||||||
|
@ -521,9 +546,9 @@ CHECKPOINT;
|
||||||
if (len < 3 && buf[len-1] == L':')
|
if (len < 3 && buf[len-1] == L':')
|
||||||
wcscat (buf, L"\\");
|
wcscat (buf, L"\\");
|
||||||
|
|
||||||
DPRINT("buf \'%S\'\n", buf);
|
// DPRINT("buf \'%S\'\n", buf);
|
||||||
RtlpEatPath (buf);
|
RtlpEatPath (buf);
|
||||||
DPRINT("buf \'%S\'\n", buf);
|
// DPRINT("buf \'%S\'\n", buf);
|
||||||
|
|
||||||
len = wcslen (buf);
|
len = wcslen (buf);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue