mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 22:13:06 +00:00
This change shouldn't mess things up, if used together with latest vfat version.
NtQueryInformationFile is required to return valid name information for this to work. svn path=/trunk/; revision=1840
This commit is contained in:
parent
59e33e46af
commit
7e0bfac662
1 changed files with 49 additions and 3 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: path.c,v 1.8 2001/03/08 22:48:42 dwelch Exp $
|
/* $Id: path.c,v 1.9 2001/04/29 21:09:20 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
|
||||||
|
@ -15,6 +15,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <ddk/obfuncs.h>
|
||||||
|
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <ntdll/ntdll.h>
|
#include <ntdll/ntdll.h>
|
||||||
|
@ -283,7 +284,10 @@ NTSTATUS STDCALL RtlSetCurrentDirectory_U (PUNICODE_STRING name)
|
||||||
HANDLE handle = NULL;
|
HANDLE handle = NULL;
|
||||||
PWSTR wcs;
|
PWSTR wcs;
|
||||||
PWSTR buf = 0;
|
PWSTR buf = 0;
|
||||||
|
PFILE_NAME_INFORMATION filenameinfo;
|
||||||
|
ULONG backslashcount = 0;
|
||||||
|
PWSTR cntr;
|
||||||
|
|
||||||
DPRINT ("RtlSetCurrentDirectory %wZ\n", name);
|
DPRINT ("RtlSetCurrentDirectory %wZ\n", name);
|
||||||
|
|
||||||
RtlAcquirePebLock ();
|
RtlAcquirePebLock ();
|
||||||
|
@ -344,7 +348,49 @@ NTSTATUS STDCALL RtlSetCurrentDirectory_U (PUNICODE_STRING name)
|
||||||
RtlReleasePebLock ();
|
RtlReleasePebLock ();
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
filenameinfo = RtlAllocateHeap (RtlGetProcessHeap(),
|
||||||
|
0,
|
||||||
|
MAX_PATH*sizeof(WCHAR)+sizeof(ULONG));
|
||||||
|
|
||||||
|
NtQueryInformationFile(handle,NULL, filenameinfo,MAX_PATH*sizeof(WCHAR)+sizeof(ULONG),FileNameInformation);
|
||||||
|
|
||||||
|
if (filenameinfo->FileName[1]) // If it's just "\", we need special handling
|
||||||
|
{
|
||||||
|
wcs = buf + size / sizeof(WCHAR) - 1;
|
||||||
|
if (*wcs == L'\\')
|
||||||
|
{
|
||||||
|
*(wcs) = 0;
|
||||||
|
wcs--;
|
||||||
|
size -= sizeof(WCHAR);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (cntr=filenameinfo->FileName;*cntr!=0;cntr++)
|
||||||
|
{
|
||||||
|
if (*cntr=='\\') backslashcount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
DPRINT("%d \n",backslashcount);
|
||||||
|
for (;backslashcount;wcs--)
|
||||||
|
{
|
||||||
|
if (*wcs=='\\') backslashcount--;
|
||||||
|
}
|
||||||
|
wcs++;
|
||||||
|
|
||||||
|
|
||||||
|
wcscpy(wcs,filenameinfo->FileName);
|
||||||
|
|
||||||
|
size=((wcs-buf)+wcslen(filenameinfo->FileName))*sizeof(WCHAR);
|
||||||
|
}
|
||||||
|
|
||||||
|
RtlFreeHeap (RtlGetProcessHeap (),
|
||||||
|
0,
|
||||||
|
filenameinfo);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* append backslash if missing */
|
/* append backslash if missing */
|
||||||
wcs = buf + size / sizeof(WCHAR) - 1;
|
wcs = buf + size / sizeof(WCHAR) - 1;
|
||||||
if (*wcs != L'\\')
|
if (*wcs != L'\\')
|
||||||
|
@ -353,7 +399,7 @@ NTSTATUS STDCALL RtlSetCurrentDirectory_U (PUNICODE_STRING name)
|
||||||
*(++wcs) = 0;
|
*(++wcs) = 0;
|
||||||
size += sizeof(WCHAR);
|
size += sizeof(WCHAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
memmove (cd->DosPath.Buffer,
|
memmove (cd->DosPath.Buffer,
|
||||||
buf,
|
buf,
|
||||||
size + sizeof(WCHAR));
|
size + sizeof(WCHAR));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue