Currently, when Winelib application startup finishes, GetLastError()
returns 6, or ERROR_INVALID_HANDLE.  Under Windows NT 4, when
applications start up, GetLastError() returns 0.

Because SetLastError() is used only sporadically throughout the Wine
code, it will be very difficult to track down why this error code
is being set.  Even if it is possible to figure out why, the
functions involved may be behaving as documented.

An easy way to fix this problem would be to call SetLastError(0)
immediately before calling WinMain() of the Winelib application.
Is this the correct solution?  Trivial patch to implement this
follows.

Index: spec32.c
===================================================================
RCS file: /home/wine/wine/tools/winebuild/spec32.c,v
retrieving revision 1.2
diff -u -r1.2 spec32.c
--- spec32.c    2000/06/24 13:37:06     1.2
+++ spec32.c    2000/08/23 02:49:09
@@ -402,6 +402,7 @@
                  "    if (*cmdline) cmdline++;\n"
                  "    GetStartupInfoA( &info );\n"
                  "    if (!(info.dwFlags & STARTF_USESHOWWINDOW)) info.wShowWindow = 
1;\n"
+                "    SetLastError(0);\n"
                  "    ExitProcess( %s( GetModuleHandleA(0), 0, cmdline, 
info.wShowWindow ) );\n"
                  "}\n\n", init_func, init_func );
         fprintf( outfile, 

--
James Juran
[EMAIL PROTECTED]

Reply via email to