[RFC] __WINESRC__ & public headers

Dimitrie O. Paun dpaun at rogers.com
Sun Jan 5 02:21:03 CST 2003


Folks,

With the current efforts to cleanup our headers on __WINESRC__s,
I realized we are actually quite close to 'clean' header, something
that should allow us to compile Wine with other headers, such as
those from the w32api package that's part of mingw.

This is a worthy goal as the compiler will flag problems in our
headers (by complaining about different prototypes), as well as
in the w32api headers. A win-win situation for the free software
world.

What do we need to do before we can try this stunt? Well, we need
to cleanup our headers of __WINESRC__ tests that modifies them
in a incompatible way. Let me be more explicit:
  1. Tests that do not allow a file to be included in Wine are OK.
     If we use other headers, those file will simply be ignored,
     as they would not be used by Wine.
  2. Tests to keep certain things undefined/undeclared in Wine are OK.
     Such tests simply make the header files a subset of the standard
     one, and the stuff that's not defined is not used, so all is good.
  3. Tests that _add_ stuff to headers are BAD.
     It's clear that such things will not be present in other headers,
     and things will not work out as nicely.
  4. Tests that modify the behavior of the headers are BAD.
     Same explanation as above.

I will list below things that fall under 3, and 4. Ideas on how to deal
with them are highly appreciated.

-- It seems to me we want to move these to a wine/multimedia.h header.
include/mmddk.h:#ifdef __WINESRC__
include/mmddk.h-#define DRV_QUERYDSOUNDIFACE    (DRV_RESERVED + 10)
include/mmddk.h-#endif

include/mmsystem.h:#ifdef __WINESRC__
include/mmsystem.h-/* this call (GetDriverFlags) is not documented, nor the flags returned.
include/mmsystem.h- * here are Wine only definitions
include/mmsystem.h- */
include/mmsystem.h-#define WINE_GDF_EXIST       0x80000000
include/mmsystem.h-#define WINE_GDF_16BIT       0x10000000
include/mmsystem.h-#endif

include/mmsystem.h:#ifdef __WINESRC__
include/mmsystem.h-#define  WAVE_DIRECTSOUND               0x0080
include/mmsystem.h-#endif

-- Why do we need this undef?
include/objidl.h:#ifdef __WINESRC__
include/objidl.h-#undef GetObject
include/objidl.h-#endif

-- ?
include/rpcproxy.h:#if defined(__WINESRC__) && defined(__WINE_WINE_OBJ_OLEAUT_H)
include/rpcproxy.h-/* see http://msdn.microsoft.com/library/en-us/dnmsj99/html/com0199.asp?frame=true */
include/rpcproxy.h-
include/rpcproxy.h-RPCRTAPI HRESULT RPC_ENTRY
include/rpcproxy.h-  CreateProxyFromTypeInfo( LPTYPEINFO pTypeInfo, LPUNKNOWN pUnkOuter, REFIID riid,
include/rpcproxy.h-                           LPRPCPROXYBUFFER *ppProxy, LPVOID *ppv );
include/rpcproxy.h-RPCRTAPI HRESULT RPC_ENTRY
include/rpcproxy.h-  CreateStubFromTypeInfo( LPTYPEINFO pTypeInfo, REFIID riid, LPUNKNOWN pUnkServer,
include/rpcproxy.h-                          LPRPCSTUBBUFFER *ppStub );
include/rpcproxy.h-
include/rpcproxy.h-#endif

-- Seems like it wants moving to a wine/base.h
include/winbase.h:#ifdef __WINESRC__
include/winbase.h-#define CRITICAL_SECTION_INIT(name) { (void *)(__FILE__ ": " name), -1, 0, 0, 0, 0 }
include/winbase.h-#endif

-- Why are these Wine specific?
include/winbase.h:#ifdef __WINESRC__
include/winbase.h-#define GetCurrentProcess() ((HANDLE)0xffffffff)
include/winbase.h-#define GetCurrentThread()  ((HANDLE)0xfffffffe)
include/winbase.h-#endif

-- This one's a bugger. It make no sense to define these things conditionally on the
-- version of the compiler. One's code is written one way or another.
-- I suggest we remove these completely, and we defined the NONAMELESS* explicitly
-- in the files that need them.
include/winnt.h:#ifdef __WINESRC__
include/winnt.h-# define NONAMELESSSTRUCT
include/winnt.h-# define NONAMELESSUNION
include/winnt.h-#else
include/winnt.h-/* Anonymous struct support starts with gcc 2.96 or gcc/g++ 3.x */
include/winnt.h-# if !defined(NONAMELESSSTRUCT) && (defined(__GNUC__) && ((__GNUC__ < 2) || ((__GNUC__ == 2) && (defined(__cplusplu
s) || (__GNUC_MINOR__ < 96))))) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
include/winnt.h-#  define NONAMELESSSTRUCT
include/winnt.h-# endif
include/winnt.h-/* Anonymous unions support starts with gcc 2.96/g++ 2.95 */
include/winnt.h-# if !defined(NONAMELESSUNION) && (defined(__GNUC__) && ((__GNUC__ < 2) || ((__GNUC__ == 2) && ((__GNUC_MINOR__ < 9
5) || ((__GNUC_MINOR__ == 95) && !defined(__cplusplus)))))) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
include/winnt.h-#  define NONAMELESSUNION

-- These want moving to a wine-private header (wine/base.h?)
include/winnt.h:#ifdef __WINESRC__
include/winnt.h-#define MEM_SYSTEM              0x80000000
include/winnt.h-#endif

include/winnt.h:#ifdef __WINESRC__
include/winnt.h-
include/winnt.h-/* Macros to retrieve the current context */
include/winnt.h-
include/winnt.h-#ifdef __i386__
include/winnt.h-
include/winnt.h-#define _DEFINE_REGS_ENTRYPOINT( name, fn, args ) \
include/winnt.h-    __ASM_GLOBAL_FUNC( name, \
include/winnt.h-                       "call " __ASM_NAME("__wine_call_from_32_regs") "\n\t" \
include/winnt.h-                       ".long " __ASM_NAME(#fn) "\n\t" \
include/winnt.h-                       ".byte " #args ", " #args )

include/winsock.h:#ifdef __WINESRC__
include/winsock.h-#define FD_WINE_LISTENING          0x10000000
include/winsock.h-#define FD_WINE_NONBLOCKING        0x20000000
include/winsock.h-#define FD_WINE_CONNECTED          0x40000000
include/winsock.h-#define FD_WINE_RAW                0x80000000
include/winsock.h-#define FD_WINE_INTERNAL           0xFFFF0000
include/winsock.h-#endif

-- What about these?
include/wownt32.h:#ifdef __WINESRC__
include/wownt32.h-/* under Wine use the kernel functions directly so we don't have to import wow32 */
include/wownt32.h-HANDLE WINAPI K32WOWHandle32(WORD,WOW_HANDLE_TYPE);
include/wownt32.h-WORD   WINAPI K32WOWHandle16(HANDLE,WOW_HANDLE_TYPE);
include/wownt32.h-#define WOWHandle32 K32WOWHandle32
include/wownt32.h-#define WOWHandle16 K32WOWHandle16
include/wownt32.h-#endif

-- There are also some in include/winternl.h, but those can wait for now :)

-- 
Dimi.




More information about the wine-devel mailing list