From: corinna Date: Thu, 16 Aug 2007 14:30:53 +0000 (+0000) Subject: * ntdll.h (RtlAcquirePebLock): Declare. X-Git-Tag: EOL_registry_mounts~2897 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=bba0482c068378a9c4125fbea1993195c7c5d20c;p=pf3gnuchains%2Fpf3gnuchains4x.git * ntdll.h (RtlAcquirePebLock): Declare. (RtlReleasePebLock): Declare. * path.cc (cwdstuff::set): Change PEB only while it's locked. --- diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index bc701fd5ae..9f36db5a93 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,5 +1,11 @@ 2007-08-16 Corinna Vinschen + * ntdll.h (RtlAcquirePebLock): Declare. + (RtlReleasePebLock): Declare. + * path.cc (cwdstuff::set): Change PEB only while it's locked. + +2007-08-16 Corinna Vinschen + * fhandler.h (fhandler_base::get_namehash): Use NT native path. * fhandler_disk_file.cc (readdir_get_ino): Ditto in call to hash_path_name. diff --git a/winsup/cygwin/ntdll.h b/winsup/cygwin/ntdll.h index 7b8c556b9a..ff9f955061 100644 --- a/winsup/cygwin/ntdll.h +++ b/winsup/cygwin/ntdll.h @@ -827,6 +827,7 @@ extern "C" NTSTATUS NTAPI RtlAppendUnicodeToString (PUNICODE_STRING, PCWSTR); NTSTATUS NTAPI RtlAppendUnicodeStringToString (PUNICODE_STRING, PUNICODE_STRING); + VOID NTAPI RtlAcquirePebLock (); NTSTATUS NTAPI RtlAnsiStringToUnicodeString (PUNICODE_STRING, PANSI_STRING, BOOLEAN); LONG NTAPI RtlCompareUnicodeString (PUNICODE_STRING, PUNICODE_STRING, @@ -848,6 +849,7 @@ extern "C" BOOLEAN); BOOLEAN NTAPI RtlPrefixUnicodeString (PUNICODE_STRING, PUNICODE_STRING, BOOLEAN); + VOID NTAPI RtlReleasePebLock (); VOID NTAPI RtlSecondsSince1970ToTime (ULONG, PLARGE_INTEGER); NTSTATUS NTAPI RtlUnicodeStringToAnsiString (PANSI_STRING, PUNICODE_STRING, BOOLEAN); diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 5a0bc903b7..a8b64da982 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -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 */