mirror of
https://github.com/reactos/reactos.git
synced 2024-12-26 17:14:41 +00:00
Moving support for current dir on several drives from cmd.exe to NTDLL.
svn path=/trunk/; revision=1891
This commit is contained in:
parent
ba2a8ca045
commit
8efef1784a
1 changed files with 16 additions and 14 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $Id: path.c,v 1.9 2001/04/29 21:09:20 cnettel Exp $
|
||||
/* $Id: path.c,v 1.10 2001/05/06 16:09:03 cnettel Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -276,6 +276,7 @@ RtlGetCurrentDirectory_U (
|
|||
NTSTATUS STDCALL RtlSetCurrentDirectory_U (PUNICODE_STRING name)
|
||||
{
|
||||
UNICODE_STRING full;
|
||||
UNICODE_STRING envvar;
|
||||
OBJECT_ATTRIBUTES Attr;
|
||||
IO_STATUS_BLOCK iosb;
|
||||
PCURDIR cd;
|
||||
|
@ -287,6 +288,7 @@ NTSTATUS STDCALL RtlSetCurrentDirectory_U (PUNICODE_STRING name)
|
|||
PFILE_NAME_INFORMATION filenameinfo;
|
||||
ULONG backslashcount = 0;
|
||||
PWSTR cntr;
|
||||
WCHAR var[4];
|
||||
|
||||
DPRINT ("RtlSetCurrentDirectory %wZ\n", name);
|
||||
|
||||
|
@ -371,7 +373,6 @@ NTSTATUS STDCALL RtlSetCurrentDirectory_U (PUNICODE_STRING name)
|
|||
}
|
||||
|
||||
|
||||
|
||||
DPRINT("%d \n",backslashcount);
|
||||
for (;backslashcount;wcs--)
|
||||
{
|
||||
|
@ -409,6 +410,15 @@ NTSTATUS STDCALL RtlSetCurrentDirectory_U (PUNICODE_STRING name)
|
|||
NtClose (cd->Handle);
|
||||
cd->Handle = handle;
|
||||
|
||||
if (cd->DosPath.Buffer[1]==':')
|
||||
{
|
||||
envvar.Length = 2 * swprintf (var, L"=%c:", cd->DosPath.Buffer[0]);
|
||||
envvar.MaximumLength = 8;
|
||||
envvar.Buffer = var;
|
||||
|
||||
RtlSetEnvironmentVariable(NULL,&envvar,&cd->DosPath);
|
||||
}
|
||||
|
||||
RtlFreeHeap (RtlGetProcessHeap (),
|
||||
0,
|
||||
buf);
|
||||
|
@ -434,6 +444,7 @@ RtlGetFullPathName_U (
|
|||
{
|
||||
WCHAR *wcs, var[4], drive;
|
||||
int len;
|
||||
int reallen;
|
||||
DWORD offs, sz, type;
|
||||
UNICODE_STRING usvar, pfx;
|
||||
PCURDIR cd;
|
||||
|
@ -453,6 +464,7 @@ RtlGetFullPathName_U (
|
|||
if (!len)
|
||||
return 0;
|
||||
|
||||
reallen=len;
|
||||
/* strip trailing path separator (but don't change '\') */
|
||||
if ((len > 1) &&
|
||||
IS_PATH_SEPARATOR(DosName[len - 1]))
|
||||
|
@ -469,7 +481,7 @@ CHECKPOINT;
|
|||
offs = sz >> 17;
|
||||
sz &= 0x0000FFFF;
|
||||
if (sz + 8 >= size)
|
||||
return sz + 10;
|
||||
return sz + 10;
|
||||
wcscpy (buf, L"\\\\.\\");
|
||||
wcsncat (buf, DosName + offs, sz / sizeof(WCHAR));
|
||||
return sz + 8;
|
||||
|
@ -522,16 +534,6 @@ CHECKPOINT;
|
|||
return pfx.Length + len * 2 + 2;
|
||||
swprintf (buf, L"%c:\\", drive);
|
||||
}
|
||||
else
|
||||
{
|
||||
CHECKPOINT;
|
||||
if (pfx.Length > 6)
|
||||
{
|
||||
CHECKPOINT;
|
||||
buf[pfx.Length / 2] = L'\\';
|
||||
pfx.Length += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
Loading…
Reference in a new issue