mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 18:11:57 +00:00
- Moved the code for updating the drive-specific current-directory environment variable out of RTL and into the CRT. Testing on Windows shows that neither RtlSetCurrentDirectory_U or SetCurrentDirectory update these variables, but _tchdir does.
svn path=/trunk/; revision=40184
This commit is contained in:
parent
d99f998d2d
commit
73694e1e38
3 changed files with 15 additions and 20 deletions
|
@ -207,7 +207,6 @@ NTSTATUS NTAPI
|
|||
RtlSetCurrentDirectory_U(PUNICODE_STRING dir)
|
||||
{
|
||||
UNICODE_STRING full;
|
||||
UNICODE_STRING envvar;
|
||||
FILE_FS_DEVICE_INFORMATION device_info;
|
||||
OBJECT_ATTRIBUTES Attr;
|
||||
IO_STATUS_BLOCK iosb;
|
||||
|
@ -215,7 +214,6 @@ RtlSetCurrentDirectory_U(PUNICODE_STRING dir)
|
|||
NTSTATUS Status;
|
||||
ULONG size;
|
||||
HANDLE handle = NULL;
|
||||
WCHAR var[4];
|
||||
PWSTR ptr;
|
||||
|
||||
DPRINT("RtlSetCurrentDirectory %wZ\n", dir);
|
||||
|
@ -282,19 +280,6 @@ RtlSetCurrentDirectory_U(PUNICODE_STRING dir)
|
|||
cd->DosPath.Buffer[size] = 0;
|
||||
cd->DosPath.Length = size * sizeof(WCHAR);
|
||||
|
||||
|
||||
/* FIXME: whats this all about??? Wine doesnt have this. -Gunnar */
|
||||
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);
|
||||
}
|
||||
|
||||
RtlFreeUnicodeString( &full);
|
||||
RtlReleasePebLock();
|
||||
|
||||
|
|
|
@ -8,9 +8,20 @@
|
|||
*/
|
||||
int _tchdir(const _TCHAR* _path)
|
||||
{
|
||||
if (!SetCurrentDirectory(_path)) {
|
||||
_dosmaperr(_path?GetLastError():0);
|
||||
return -1;
|
||||
}
|
||||
WCHAR newdir[MAX_PATH];
|
||||
|
||||
if (!SetCurrentDirectory(_path))
|
||||
{
|
||||
_dosmaperr(_path ? GetLastError() : 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Update the drive-specific current directory variable */
|
||||
if (GetCurrentDirectoryW(MAX_PATH, newdir) && newdir[1] == L':')
|
||||
{
|
||||
WCHAR envvar[4] = { L'=', towupper(newdir[0]), L':', L'\0' };
|
||||
SetEnvironmentVariableW(envvar, newdir);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -2,4 +2,3 @@
|
|||
#define _UNICODE
|
||||
|
||||
#include "chdir.c"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue