* ntdll.h (RtlAcquirePebLock): Declare.

(RtlReleasePebLock): Declare.
	* path.cc (cwdstuff::set): Change PEB only while it's locked.
This commit is contained in:
Corinna Vinschen
2007-08-16 14:30:53 +00:00
parent bd61a7f7b9
commit dec9daad4a
3 changed files with 12 additions and 5 deletions

View File

@ -4329,6 +4329,7 @@ cwdstuff::set (const char *win32_cwd, const char *posix_cwd, bool doit)
strcpy (as.Buffer + len, "\\");
++as.Length;
}
RtlAcquirePebLock ();
if (current_codepage == ansi_cp)
RtlAnsiStringToUnicodeString (
&get_user_proc_parms ()->CurrentDirectoryName,
@ -4339,11 +4340,9 @@ cwdstuff::set (const char *win32_cwd, const char *posix_cwd, bool doit)
&as, FALSE);
PHANDLE phdl = &get_user_proc_parms ()->CurrentDirectoryHandle;
if (*phdl)
{
HANDLE old_h = *phdl;
*phdl = h;
CloseHandle (old_h);
}
CloseHandle (*phdl);
*phdl = h;
RtlReleasePebLock ();
}
}
/* If there is no win32 path or it has the form c:xxx, get the value */