[PATCH] fix for GetModuleFileName() hang when address is in ntdll.dll (NT4 SP5)

Joe Buehler jbuehler@hekimian.com
Wed Apr 2 15:17:00 GMT 2003


2003-04-02  Joe Buehler  <jhpb@hekimian.com>

	* exceptions.cc (interruptible): avoid calling GetModuleFileName() on system DLL

Index: exceptions.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/exceptions.cc,v
retrieving revision 1.144
diff -u -r1.144 exceptions.cc
--- exceptions.cc	31 Mar 2003 21:27:06 -0000	1.144
+++ exceptions.cc	2 Apr 2003 15:15:58 -0000
@@ -651,6 +652,11 @@
      res = 1;
    else if (h == cygwin_hmodule)
      res = 0;
+  else if (((int)h & 0xf0000000) == 0x70000000)
+    /* GetModuleFileName() has been observed to hang when handed an address
+       in ntdll.dll (NT4 SP5), so test before calling, to see whether the
+       address looks like it is in a Windows system DLL. */
+    res = 0;
    else if (!GetModuleFileName (h, checkdir, windows_system_directory_length + 2))
      res = 0;
    else
-- 
Joe Buehler



More information about the Cygwin-patches mailing list