This is the mail archive of the
cygwin-patches
mailing list for the Cygwin project.
AttachConsole broken autoload
- From: Dave Korn <dave dot korn dot cygwin at googlemail dot com>
- To: cygwin-patches at cygwin dot com
- Date: Sat, 04 Jul 2009 13:47:23 +0100
- Subject: AttachConsole broken autoload
Got this error when I tried to run with a DLL built from today's CVS HEAD:
> ---------------------------
> bash.exe - Entry Point Not Found
> ---------------------------
> The procedure entry point AttachConsole could not be located in the dynamic link library KERNEL32.dll.
> ---------------------------
> OK
> ---------------------------
Checked that it doesn't exist on W2K:
http://msdn.microsoft.com/en-us/library/ms681952(VS.85).aspx
> Minimum supported client Windows XP
> Minimum supported server Windows Server 2003
Something's gone wrong with the autoload definition, because here's the
reference:
> $ nm fhandler_console.o | grep AttachConsole
> U _AttachConsole@4
... but here's the definition:
> $ nm autoload.o | grep AttachConsole
> 00000000 T _AttachConsole@0
> 00000000 T _win32_AttachConsole@0
... leading to the DLL still having an explicit import for it:
> $ dumpbin /imports new-cygwin1.dll | grep AttachConsole
> D AttachConsole
Attached patch looks like the obvious fix to me and builds a DLL without an
import for AttachConsole; resulting DLL loads and runs on W2k. Ok?
* autoload.cc (AttachConsole): Correct size of args.
cheers,
DaveK
Index: winsup/cygwin/autoload.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/autoload.cc,v
retrieving revision 1.161
diff -p -u -r1.161 autoload.cc
--- winsup/cygwin/autoload.cc 3 Jul 2009 10:50:51 -0000 1.161
+++ winsup/cygwin/autoload.cc 4 Jul 2009 12:27:59 -0000
@@ -409,7 +409,7 @@ LoadDLLfuncEx2 (SendARP, 16, iphlpapi, 1
LoadDLLfunc (CoTaskMemFree, 4, ole32)
-LoadDLLfuncEx (AttachConsole, 0, kernel32, 1)
+LoadDLLfuncEx (AttachConsole, 4, kernel32, 1)
LoadDLLfuncEx (FindFirstVolumeA, 8, kernel32, 1)
LoadDLLfuncEx (FindNextVolumeA, 12, kernel32, 1)
LoadDLLfuncEx (FindVolumeClose, 4, kernel32, 1)