* 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

@ -1,3 +1,9 @@
2007-08-16 Corinna Vinschen <corinna@vinschen.de>
* ntdll.h (RtlAcquirePebLock): Declare.
(RtlReleasePebLock): Declare.
* path.cc (cwdstuff::set): Change PEB only while it's locked.
2007-08-16 Corinna Vinschen <corinna@vinschen.de> 2007-08-16 Corinna Vinschen <corinna@vinschen.de>
* fhandler.h (fhandler_base::get_namehash): Use NT native path. * fhandler.h (fhandler_base::get_namehash): Use NT native path.

View File

@ -827,6 +827,7 @@ extern "C"
NTSTATUS NTAPI RtlAppendUnicodeToString (PUNICODE_STRING, PCWSTR); NTSTATUS NTAPI RtlAppendUnicodeToString (PUNICODE_STRING, PCWSTR);
NTSTATUS NTAPI RtlAppendUnicodeStringToString (PUNICODE_STRING, NTSTATUS NTAPI RtlAppendUnicodeStringToString (PUNICODE_STRING,
PUNICODE_STRING); PUNICODE_STRING);
VOID NTAPI RtlAcquirePebLock ();
NTSTATUS NTAPI RtlAnsiStringToUnicodeString (PUNICODE_STRING, PANSI_STRING, NTSTATUS NTAPI RtlAnsiStringToUnicodeString (PUNICODE_STRING, PANSI_STRING,
BOOLEAN); BOOLEAN);
LONG NTAPI RtlCompareUnicodeString (PUNICODE_STRING, PUNICODE_STRING, LONG NTAPI RtlCompareUnicodeString (PUNICODE_STRING, PUNICODE_STRING,
@ -848,6 +849,7 @@ extern "C"
BOOLEAN); BOOLEAN);
BOOLEAN NTAPI RtlPrefixUnicodeString (PUNICODE_STRING, PUNICODE_STRING, BOOLEAN NTAPI RtlPrefixUnicodeString (PUNICODE_STRING, PUNICODE_STRING,
BOOLEAN); BOOLEAN);
VOID NTAPI RtlReleasePebLock ();
VOID NTAPI RtlSecondsSince1970ToTime (ULONG, PLARGE_INTEGER); VOID NTAPI RtlSecondsSince1970ToTime (ULONG, PLARGE_INTEGER);
NTSTATUS NTAPI RtlUnicodeStringToAnsiString (PANSI_STRING, PUNICODE_STRING, NTSTATUS NTAPI RtlUnicodeStringToAnsiString (PANSI_STRING, PUNICODE_STRING,
BOOLEAN); BOOLEAN);

View File

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