fixup bogus SetLastError()

Andreas Mohr a.mohr at mailto.de
Mon Jun 4 13:01:23 CDT 2001


Hi all,

objects/gdiobj.c really has no business dealing with SetLastError().
SetLastError() is a mechanism to communicate errors to external programs,
so it should definitely not be used for highly internal functions.

(updated docu, too)

Andreas Mohr
-------------- next part --------------
Determining best CVS host...
Using CVSROOT :pserver:cvs at rhlx01.fht-esslingen.de:/home/wine
Index: DEVELOPERS-HINTS
===================================================================
RCS file: /home/wine/wine/DEVELOPERS-HINTS,v
retrieving revision 1.9
diff -u -r1.9 DEVELOPERS-HINTS
--- DEVELOPERS-HINTS	2001/01/10 23:59:25	1.9
+++ DEVELOPERS-HINTS	2001/06/04 15:59:12
@@ -23,6 +23,7 @@
 
 GDI:
 
+	console/		- handling of text consoles
 	graphics/		- graphics drivers
 		x11drv/		- X11 display driver
 		win16drv/	-> see below 
@@ -58,7 +59,7 @@
 		msnet/
 		msvcrt/		- C runtime library
 		msvideo/	- 16 bit video manager
-		ole32/		- 32 bit OLE 2.0 librairies
+		ole32/		- 32 bit OLE 2.0 libraries
 		oleaut32/	- 32 bit OLE 2.0 automation
 		olecli/		- 16 bit OLE client
 		oledlg/		- OLE 2.0 user interface support
@@ -86,12 +87,13 @@
 
 Miscellaneous:
 
-	misc/			- shell, registry, winsock, etc.
+	misc/			- misc. wine management, registry, etc.
 	ipc/			- SysV IPC based interprocess communication
-	win32/			- misc Win32 functions
         ole/			- OLE code 
-		nls/		- National Language Support 
+	nls/			- National Language Support 
 				  configuration files
+	unicode/		- Unicode (character) support
+	win32/			- misc Win32 functions
 
 Tools:
 ------
@@ -521,6 +523,21 @@
 
 documentation/debug-msgs
 
+MISCELLANEOUS STUFF
+===================
+
+1. Avoid SetLastError() in internal functions. LastError is a mechanism
+   for *external* programs, not for Wine parameter verification.
+   Thus an invalid SetLastError() setting can get outside of Wine easily
+   if you use it within internal use only functions.
+   Or, to be more precise, try to use it only for WINAPI functions.
+
+2. Parameter verification:
+   Avoid parameter verification in internal functions.
+   Rather verify parameters only in WINAPI functions.
+   Wine should really know what it's doing with its functions,
+   so we really don't need internal parameter verification.
+   If there's a problem, then it's a bug that should be fixed.
 
 MORE INFO
 =========
Index: scheduler/thread.c
===================================================================
RCS file: /home/wine/wine/scheduler/thread.c,v
retrieving revision 1.101
diff -u -r1.101 thread.c
--- scheduler/thread.c	2001/05/18 23:21:22	1.101
+++ scheduler/thread.c	2001/06/04 15:59:12
@@ -792,6 +792,12 @@
  */
 void WINAPI SetLastError( DWORD error ) /* [in] Per-thread error code */
 {
+#ifdef SLE_TRACING
+    /* if you want to trace SLE, rename __i386__ above e.g. to x__i386__
+     * and also make sure that you don't forget to disable the asm defines
+     * in winbase.h */
+    TRACE("error: %ld\n", error);
+#endif
     NtCurrentTeb()->last_error = error;
 }
 


More information about the wine-patches mailing list