The Wine source tree is loosely based on the original Windows modules.
Most of the source is concerned with implementing the Wine API, although
there are also various tools, documentation, sample Winelib code, and
-code specific to the binary loader.
-
-Wine API directories:
----------------------
-
-KERNEL:
-
- files/ - file I/O
- loader/ - Win16-, Win32-binary loader
- memory/ - memory management
- msdos/ - DOS features and BIOS calls (interrupts)
- scheduler/ - process and thread management
-
-GDI:
-
- graphics/ - graphics drivers
- x11drv/ - X11 display driver
- win16drv/ -> see below
- ttydrv/ - tty display driver
- psdrv/ - PostScript graphics driver
- metafiledrv/ - metafile driver
- enhmetafiledrv/ - enhanced metafile driver
- objects/ - logical objects
-
-USER:
-
- controls/ - built-in widgets
- resources/ - built-in menu and message box resources
- windows/ - window management
-
-Other DLLs:
-
- dlls/ - Other system DLLs implemented by Wine
- advapi32/ - crypto, systeminfo, security, eventlogging
- avifil32/ - COM object to play AVI files
- comctl32/ - common controls
- commdlg/ - common dialog boxes (both 16 & 32 bit)
- crtdll/ - Old C runtime library
- dplayx/ - DirectX dplayx
- dsound/ - DirectX dsound
- imagehlp/ - PE (Portable Executable) Image Helper lib
- imm32/
- lzexpand/ - Liv-Zempel compression/decompression
- mpr/ - Multi-Protocol Router (interface to various
- network transport protocols)
- msacm/ - audio compression manager (multimedia) (16 bit)
- msacm32/ - audio compression manager (multimedia) (32 bit)
- msnet/
- msvcrt/ - C runtime library
- msvideo/ - 16 bit video manager
- 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
- olesvr/ - 16 bit OLE server
- ntdll/ - NT implementation of kernel calls
- psapi/ - process status API
- rasapi32/ - remote access server API
- shell32/ - COM object implementing shell views
- sound/ - Sound on loudspeaker (not sound card)
- tapi32/ - telephone API
- ver/ - File Installation Library (16 bit)
- version/ - File Installation Library (32 bit)
- win32s
- win87em - 80387 math-emulation
- winaspi/ - 16 bit Advanced SCSI Peripheral Interface
- windebug/ - Windows debugger
- wing/ - WinG (for games) internface
- winmm/ - multimedia (16 & 32 bit)
- mciXXX/ - various MCI drivers
- wineoss/- MM driver for OSS systems
- wavemap/- audio mapper
- midimap/- midi mapper
- winspool/ - Printing & Print Spooler
- wnaspi32/ - 32 bit ASPI
-
-Miscellaneous:
-
- misc/ - shell, registry, winsock, etc.
- ipc/ - SysV IPC based interprocess communication
- win32/ - misc Win32 functions
- ole/ - OLE code
- nls/ - National Language Support
- configuration files
-
-Tools:
-------
+code specific to the binary loader. Note that several of the libraries
+listed here are "stubbed out", meaning they still need to be implemented.
+
+DLLs (under dlls/):
+-------------------
+
+ advapi32/ - Crypto, systeminfo, security, eventlogging
+ advpack/ - Reads and verifies .INF files
+ amstream/ - MultiMedia Streams
+ atl/ - Active Template Library
+ avicap32/ - AVI capture window class
+ avifil32/ - COM object to play AVI files
+ cabinet/ - Cabinet file interface
+ capi2032/ - Wrapper library for CAPI4Linux access
+ cards/ - Card graphics
+ cfgmgr32/ - Config manager
+ comcat/ - Component category manager
+ comctl32/ - Common controls
+ commdlg/ - Common dialog boxes (both 16 & 32 bit)
+ crtdll/ - Old C runtime library
+ crypt32/ - Cryptography
+ ctl3d/ - 3D Effects for Common GUI Components
+ d3d8/ - Direct3D (3D graphics)
+ d3d9/ - Direct3D (3D graphics)
+ d3dim/ - Direct3D Immediate Mode
+ d3drm/ - Direct3D Retained Mode
+ d3dx8/ - Direct3D (3D graphics)
+ d3dxof/ - DirectX Files Functions
+ dbghelp/ - Engine for symbol and module enumeration
+ dciman32/ - DCI Manager (graphics)
+ ddraw/ - DirectDraw (graphics)
+ devenum/ - Device enumeration (part of DirectShow)
+ dinput/ - DirectInput (device input)
+ dinput8/ - DirectInput (device input)
+ dmband/ - DirectMusic Band
+ dmcompos/ - DirectMusic Composer
+ dmime/ - DirectMusic Interactive Engine
+ dmloader/ - DirectMusic Loader
+ dmscript/ - DirectMusic Scripting
+ dmstyle/ - DirectMusic Style Engine
+ dmsynth/ - DirectMusic Software Synthesizer
+ dmusic/ - DirectMusic Core Services
+ dmusic32/ - DirectMusic Legacy Port
+ dplay/ - DirectPlay (networking)
+ dplayx/ - DirectPlay (networking)
+ dpnet/ - DirectPlay (networking)
+ dpnhpast/ - DirectPlay NAT Helper PAST
+ dsound/ - DirectSound (audio)
+ dswave/ - DirectMusic Wave
+ dxdiagn/ - DirectX Diagnostic Tool
+ gdi/ - GDI (graphics)
+ glu32/ - OpenGL Utility library (graphics)
+ glut32/ - OpenGL Utility Toolkit
+ hhctrl.ocx/ - HHCTRL OCX implementation
+ iccvid/ - Radius Cinepak Video Decoder
+ icmp/ - ICMP protocol (networking)
+ ifsmgr.vxd/ - IFSMGR VxD implementation
+ imagehlp/ - PE (Portable Executable) Image Helper lib
+ imm32/ - Input Method Manager
+ iphlpapi/ - IP Helper API
+ itss/ - Infotech Structured Storage (HTML Help)
+ kernel/ - The Windows kernel
+ lzexpand/ - Lempel-Ziv compression/decompression
+ mapi32/ - Mail interface
+ mlang/ - Multi Language Support
+ mmdevldr.vxd/ - MMDEVLDR VxD implementation
+ monodebg.vxd/ - MONODEBG VxD implementation
+ mpr/ - Multi-Protocol Router (networking)
+ msacm/ - Audio Compression Manager (multimedia)
+ msacm/imaadp32/ - IMA ADPCM Audio Codec
+ msacm/msadp32/ - MS ADPCM Audio Codec
+ msacm/msg711/ - MS G711 Audio Codec (includes A-Law & MU-Law)
+ msacm/winemp3/ - Mpeg Layer 3 Audio Codec
+ mscms/ - Color Management System
+ msdmo/ - DirectX Media Objects
+ mshtml/ - MS HTML component
+ msi/ - Microsoft Installer
+ msimg32/ - Gradient and transparency (graphics)
+ msisys/ - System information
+ msnet32/ - Network interface
+ msrle32/ - Video codecs
+ msvcrt/ - C runtime library
+ msvcrt20/ - C runtime library version 2.0
+ msvcrt40/ - C runtime library version 4.0
+ msvcrtd/ - C runtime library debugging
+ msvidc32/ - Microsoft Video-1 Decoder
+ msvideo/ - 16 bit video manager
+ mswsock/ - Misc networking
+ netapi32/ - Network interface
+ newdev/ - New Hardware Device Library
+ ntdll/ - NT implementation of kernel calls
+ odbc32/ - Open DataBase Connectivity driver manager
+ ole32/ - 32 bit OLE 2.0 libraries
+ oleacc/ - OLE accessibility support
+ oleaut32/ - 32 bit OLE 2.0 automation
+ olecli/ - 16 bit OLE client
+ oledlg/ - OLE 2.0 user interface support
+ olepro32/ - 32 bit OLE 2.0 automation
+ olesvr/ - 16 bit OLE server
+ opengl32/ - OpenGL implementation (graphics)
+ psapi/ - Process Status interface
+ qcap/ - DirectShow runtime
+ quartz/ - DirectShow runtime
+ rasapi32/ - Remote Access Server interface
+ richedit/ - Rich text editing control
+ rpcrt4/ - Remote Procedure Call runtime
+ rsabase/ - RSA encryption
+ rsaenh/ - Crypto API that provides algorithms for DES, 3DES, and RSA among others
+ secur32/ - Contains Windows Security functions
+ serialui/ - Serial port property pages
+ setupapi/ - Setup interface
+ shdocvw/ - Shell document object and control
+ shell32/ - COM object implementing shell views
+ shfolder/ - Shell folder service
+ shlwapi/ - Shell Light-Weight interface
+ snmpapi/ - SNMP protocol interface (networking)
+ sti/ - Still Image service
+ tapi32/ - Telephone interface
+ ttydrv/ - TTY display driver (Wine specific)
+ twain/ - TWAIN Imaging device communications
+ unicows/ - Unicows replacement (Unicode layer for Win9x)
+ url/ - Internet shortcut shell extension
+ urlmon/ - URL Moniker allows binding to a URL (like KIO/gnome-vfs)
+ user/ - Window management, standard controls, etc.
+ uxtheme/ - Theme library
+ vdhcp.vxd/ - VDHCP VxD implementation
+ vdmdbg/ - Virtual DOS machine debug library
+ version/ - File installation library
+ vmm.vxd/ - VMM VxD implementation
+ vnbt.vxd/ - VNBT VxD implementation
+ vnetbios.vxd/ - VNETBIOS VxD implementation
+ vtdapi.vxd/ - VTDAPI VxD implementation
+ vwin32.vxd/ - VWIN32 VxD implementation
+ win32s/ - 32-bit function access for 16-bit systems
+ winaspi/ - 16 bit Advanced SCSI Peripheral Interface
+ wined3d/ - Wine internal Direct3D helper
+ winedos/ - DOS features and BIOS calls (interrupts) (wine specific)
+ wineps/ - Postscript driver (Wine specific)
+ wininet/ - Internet extensions
+ winmm/ - Multimedia (16 & 32 bit)
+ winmm/joystick/ - Joystick driver
+ winmm/mcianim/ - MCI animation driver
+ winmm/mciavi/ - MCI video driver
+ winmm/mcicda/ - MCI audio CD driver
+ winmm/mciseq/ - MCI MIDI driver
+ winmm/mciwave/ - MCI wave driver
+ winmm/midimap/ - MIDI mapper
+ winmm/wavemap/ - Audio mapper
+ winmm/winealsa/ - ALSA audio driver
+ winmm/winearts/ - aRts audio driver
+ winmm/wineaudioio/ - audioio audio driver
+ winmm/winejack/ - JACK audio server driver
+ winmm/winenas/ - NAS audio driver
+ winmm/wineoss/ - OSS audio driver
+ winnls/ - National Language Support
+ winsock/ - Sockets 2.0 (networking)
+ winspool/ - Printing & Print Spooler
+ wintab32/ - Tablet device interface
+ wintrust/ - Trust verification interface
+ wow32/ - WOW subsystem
+ wsock32/ - Sockets 1.1 (networking)
+ x11drv/ - X11 display driver (Wine specific)
+
+Winelib programs (under programs/):
+-----------------------------------
- rc/ - old resource compiler
- tools/ - relay code builder, new rc, bugreport
- generator, wineconfigurator, etc.
+ avitools/ - AVI information viewer and player
+ clock/ - Graphical clock
+ cmdlgtst/ - Common dialog tests
+ control/ - Control panel
+ expand/ - Decompress Lempel-Ziv compressed archive
+ msiexec/ - Microsoft Installer frontend
+ notepad/ - Notepad replacement
+ progman/ - Program manager
+ regedit/ - Registry editor
+ regsvr32/ - Register COM server
+ rpcss/ - RPC services
+ rundll32/ - Execute DLL functions directly
+ start/ - Replacement for start.exe
+ taskmgr/ - Manage running Windows/Winelib applications
+ uninstaller/ - Remove installed programs
+ view/ - Metafile viewer
+ wcmd/ - Command line interface
+ wineboot/ - Wine bootstrap process
+ winecfg/ - Wine configuration utility
+ wineconsole/ - Console
+ winedbg/ - Debugger
+ winefile/ - File manager
+ winemenubuilder/ - Helper program for building Unix menu entries
+ winemine/ - Mine game
+ winepath/ - Translate between Wine and Unix paths
+ winetest/ - Wine testing shell
+ winevdm/ - Wine virtual DOS machine
+ winhelp/ - Help viewer
+ winver/ - Windows Version Program
+
+
+Support programs, libraries, etc:
+---------------------------------
+
+ dlls/dxerr8/ - DirectX 8 error import lib
+ dlls/dxerr9/ - DirectX 9 error import lib
+ dlls/dxguid/ - DirectX UUID import lib
+ dlls/strmiids/ - Exports class (CLSIDs) and interface (IIDs) identifiers
+ dlls/uuid/ - Windows-compatible UUID import lib
documentation/ - some documentation
+ documentation/samples/ - sample configuration files
+ include/ - Windows standard includes
+ include/msvcrt/ - MSVC compatible libc headers
+ include/wine/ - Wine specific headers
+ libs/ - the Wine libraries
+ libs/port/ - portability library
+ libs/unicode/ - Unicode support shared
+ libs/wine/ - Wine bootstrap library
+ libs/wpp/ - C preprocessor
+ loader/ - the main Wine loader
+ server/ - the Wine server
+ tools/ - various tools used to build/check Wine
+ tools/widl/ - the IDL compiler
+ tools/winapi{,_check}/ - A Win32 API checker
+ tools/winebuild/ - Wine build tool
+ tools/winedump/ - a .DLL dump utility
+ tools/winegcc/ - a MinGW command line compatible gcc wrapper
+ tools/wmc/ - the message compiler
+ tools/wpp/ - the C pre-processor library
+ tools/wrc/ - the resource compiler
-Binary loader specific directories:
------------------------------------
+Miscellaneous:
+--------------
- debugger/ - built-in debugger
- if1632/ - relay code
- miscemu/ - hardware instruction emulation
- graphics/win16drv/ - Win16 printer driver
- server/ - the main, controlling thread of wine
- tsx11/ - thread-safe X11 wrappers (auto generated)
+Note: these directories will ultimately get moved into their
+respective dlls.
-Winelib specific directories:
------------------------------
+ misc/ - KERNEL registry
+ windows/ - USER window management
- library/ - Required code for programs using Winelib
- libtest/ - Small samples and tests
- programs/ - Extended samples / system utilities
IMPLEMENTING NEW API CALLS
==========================
-This is the simple version, and covers only Win32. Win16 is slightly uglier,
-because of the Pascal heritage and the segmented memory model.
+This is the simple version, and covers only Win32. Win16 is slightly
+uglier, because of the Pascal heritage and the segmented memory model.
-All of the Win32 APIs known to Wine are listed in [relay32/*.spec]. An
-unimplemented call will look like (from gdi32.spec)
+All of the Win32 APIs known to Wine are listed in the .spec file of
+their corresponding dll. An unimplemented call will look like (from
+gdi32.spec)
269 stub PolyBezierTo
To implement this call, you need to do the following four things.
/************************************************************
* PolyBezierTo (GDI32.269)
*
- * Draw many Bezier curves
+ * Draw many Bezier curves.
+ *
+ * PARAMS
+ * hdc [I] Device context to draw to
+ * p [I] Array of POINT structs
+ * count [I] Number of points in p
*
* RETURNS
- * nonzero on success or zero on faillure
+ * Success: Non-zero.
+ * Failure: FALSE. Use GetLastError() to find the error cause.
*
* BUGS
* Unimplemented
*/
- BOOL WINAPI PolyBezierTo(HDC hdc, /* handle to device context */
- LPCVOID p, /* ptr to array of Point structs */
- DWORD count /* nr of points in array */
- )
+ BOOL WINAPI PolyBezierTo(HDC hdc, LPCVOID p, DWORD count)
{
- /* tell the user they've got a substandard implementation */
- FIXME(gdi, ":(%x,%p,%d): stub\n", hdc, p, count);
-
- /* some programs may be able to compensate,
- * if they know what happened
- */
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return FALSE; /* error value */
+ /* tell the user they've got a substandard implementation */
+ FIXME("(%x,%p,%d): stub\n", hdc, p, count);
+
+ /* some programs may be able to compensate,
+ * if they know what happened
+ */
+ SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+ return FALSE; /* error value */
}
4. Implement and test the rest of the function.
following:
1. Create a directory <MyDll> where to store the implementation of
- the DLL.
-
- If the DLL exists under Windows as both 16 and 32 bit DLL, you can
- either create one directory for each, or have a single directory
- with both implementations.
-
- This (those) directory(ies) have to be put under the dlls/
- directory in Wine tree structure.
+ the DLL. This directory has to be put under the dlls/ directory.
+ If the DLL exists under Windows as both 16 and 32 bit DLL, you
+ should have a single directory with both implementations.
2. Create the Makefile.in in the ./dlls/<MyDll>/ directory. You can
copy an existing Makefile.in from another ./dlls/ subdirectory.
+ You need at least to change the MODULE and C_SRCS macros.
- You need at least to change the MODULE, SPEC_SRCS, and C_SRCS
- macros.
+3. Add the directory in ./configure.ac (in AC_OUTPUT macro at the end
+ of the file to trigger the Makefile generation)
-3. Add the directory (and the generated .o file for the module) in:
- + ./configure.in (in AC_OUTPUT macro at the end of the file to
- trigger the Makefile generation),
- + ./Makefile.in (in LIBSUBDIRS and LIBOBJS macros)
- + ./dlls/Makefile.in (in SUBDIRS macro)
+4. Run ./make_dlls in the dlls directory to update Makefile.in in
+ that directory.
-4. You can now regenerate ./configure file (with 'make configure')
+5. You can now regenerate ./configure file (with 'make configure')
and the various Makefiles (with 'configure; make depend') (run
from the top of Wine's tree).
+ You should now have a Makefile file in ./dlls/<MyDll>/
- You shall now have a Makefile file in ./dlls/<MyDll>/
-
-5. You now need to declare the DLL in the module lists. This is done
- by adding the corresponding descriptor in ./if1632/builtin.c if
- your DLL is 16 bit (resp. ./relay32/builtin.c for a 32 bit DLL)
- (or both if your directory contains the dual 16/32
- implementations).
-
- Note: the name of the descriptor is based on the module name, not
- on the file name (they are the same in most of the case, but for
- some DLLs it's not the case).
-
-6. You also need to define the loadorder for the created DLL
- (./wine.ini and ./loader/loadorder.c). Usually, "native,builtin"
- is ok. If you have written a paired 16/32 bit implementation, don't
- forget to define it also in those files.
-
-7. Create the .spec file for the DLL export points in your
+6. Create the .spec file for the DLL exported functions in your
directory. Refer to 'Implementation of new API calls' earlier in
this document for more information on this part.
-8. Don't forget the .cvsignore file. The .cvsignore contain (on a per
- directory basis) all the files generated by the compilation
- process, why cvs shall ignore when processing the dir.
- *.o is in there by default, but in Wine case you will find:
- - Makefile (generated from Makefile.in)
- - *.spec.c: those c files are generated by tools/build from the
- .spec file
- - when thunking down to 16 bit DLLs, you'll get some others (.glue.c)
- - result of .y => .c translation (by yacc or bison)
- - result of .rc compilation
- - ...
- For a simple DLL, listing in .cvsignore Makefile and
- <MyDll>.spec.c will do.
-
-9. You can now start adding .c files.
-
-10. For the .h files, if they are standard Windows one, put them in
- include/. If they are linked to *your* implementation of the DLL,
- put them in your newly created directory.
+7. You can now start adding .c files. For the .h files, if they are
+ standard Windows one, put them in include/. If they are linked to
+ *your* implementation of the dll, put them in your newly created
+ directory.
Debug channels
--------------
If you need to create a new debug channel, just add the
-DECLARE_DEBUG_CHANNEL to your .c file(s) and rerun
-tools/make_debug. When sending out your patch, you don't need to
-provide neither ./configure nor the ./include/debugdefs.h diffs. Just
-indicate that those files need to be regenerated.
+WINE_DEFAULT_DEBUG_CHANNEL to your .c file(s), and use them.
+All the housekeeping will happen automatically.
Resources
---------
-If you also need to add resources to your DLL, the create the .rc
-file. Since, the .rc file will be translated into a .s file, and then
-compiled as a .o file, its basename must be different from the
-basename of any .c file.
-Add to your ./dlls/<MyDll>/Makefile.in, in the RC_SRCS macro, the list
-of .rc files to add to the DLL. You may also have to add the following
-directives
-1/ to tell gnumake to translate .rc into .s files,
- $(RC_SRCS:.rc=.s): $(WRC)
-2/ to give some parameters to wrc for helping the translation.
- WRCEXTRA = -s -p$(MODULE)
-
-See dlls/comctl32/ for an example of this.
+If you also need to add resources to your DLL, then create the .rc
+file. Add to your ./dlls/<MyDll>/Makefile.in, in the RC_SRCS macro,
+the list of .rc files to add to the DLL. See dlls/comctl32/ for an
+example of this.
Thunking
--------
maps to WORD,WORD,LONG,LONG,LONG.
You can put several functions between the Start/Stop build pair.
-You can also read tools/build.txt for more details on this.
+You can also read the winebuild manpage for more details on this.
-Then, add to ./dlls/<MyDll>/Makefile.in to the macro GLUE the list of
-.c files containing the /* ### Start build ### */ directives.
+Then, add to ./dlls/<MyDll>/Makefile.in a line like:
+
+EXTRA_OBJS = $(MODULE).glue.o
See dlls/winmm/ for an example of this.
are regular 32-bit linear addresses.
There are four ways to obtain a segmented pointer:
- - Use the SEGPTR_* macros in include/heap.h (recommended).
+ - Using the MapLS function (recommended).
- Allocate a block of memory from the global heap and use
WIN16_GlobalLock to get its segmented address.
- - Allocate a block of memory from a local heap, and build the
- segmented address from the local heap selector (see the
- USER_HEAP_* macros for an example of this).
- Declare the argument as 'segptr' instead of 'ptr' in the spec file
for a given API function.
Once you have a segmented pointer, it must be converted to a linear
pointer before you can use it from 32-bit code. This can be done with
-the PTR_SEG_TO_LIN() and PTR_SEG_OFF_TO_LIN() macros. The linear
-pointer can then be used freely with standard Unix functions like
-memcpy() etc. without worrying about 64k boundaries. Note: there's no
-easy way to convert back from a linear to a segmented address.
+the MapSL function. The linear pointer can then be used freely with
+standard Unix functions like memcpy() etc. without worrying about 64k
+boundaries. Note: there's no easy way to convert back from a linear
+to a segmented address.
In most cases, you don't need to worry about segmented address, as the
conversion is made automatically by the callback code and the API
For alignment on a 2-byte boundary, there is a "pshpack2.h", etc.
-The use of the WINE_PACKED attribute is obsolete. Please remove these
-in favour of the above solution.
-Using WINE_PACKED, you would declare the above structure like this:
-
-struct { BYTE x; WORD y WINE_PACKED; };
-
-You had to do this every time a structure member is not aligned
-correctly under Windows (i.e. a WORD not on an even address, or a
-DWORD on a address that was not a multiple of 4).
-
NAMING CONVENTIONS FOR API FUNCTIONS AND TYPES
==============================================
code must use:
- 'xxx16' for the Win16 version,
- - 'xxx' for the Win32 version when no ASCII/Unicode strings are
- involved,
+ - 'xxx' for the Win32 version when no strings are involved,
- 'xxxA' for the Win32 version with ASCII strings,
- 'xxxW' for the Win32 version with Unicode strings.
of the UNICODE symbol.
-NAMING CONVENTIONS FOR NON-API FUNCTIONS AND TYPES
-==================================================
+DEBUG MESSAGES
+==============
-Functions and data which are internal to your code (or at least shouldn't be
-visible to any Winelib or Windows program) should be preceded by
-an identifier to the module:
+To display a message only during debugging, you normally write something
+like this:
-Examples:
+ TRACE("abc..."); or
+ FIXME("abc..."); or
+ WARN("abc..."); or
+ ERR("abc...");
-ENUMPRINTERS_GetDWORDFromRegistryA() (in dlls/winspool/info.c)
-IAVIFile_fnRelease() (in dlls/avifil32/avifile.c)
-X11DRV_CreateDC() (in graphics/x11drv/init.c)
-TIMER_Init() (implemented in windows/timer.c,
- used in loader/main.c )
-
-if you need prototypes for these, there are a few possibilities:
-- within same source file only:
- put the prototypes at the top of your file and mark them as prototypes.
-- within the same module:
- create a header file within the subdirectory where that module resides,
- e.g. graphics/ddraw_private.h
-- from a totally different module, or for use in winelib:
- put your header file entry in /include/wine/
- but be careful not to clutter this directory!
-under no circumstances, you should add non-api calls to the standard
-windoze include files. Unfortunately, this is often the case, e.g.
-the above example of TIMER_Init is defined in include/message.h
-
-
-API ENTRY POINTS
-================
-
-Because Win16 programs use a 16-bit stack and because they can only
-call 16:16 addressed functions, all API entry points must be at low
-address offsets and must have the arguments translated and moved to
-Wines 32-bit stack. This task is handled by the code in the "if1632"
-directory. To define a new API entry point handler you must place a
-new entry in the appropriate API specification file. These files are
-named *.spec. For example, the API specification file for the USER
-DLL is contained in the file user.spec. These entries are processed
-by the "build" program to create an assembly file containing the entry
-point code for each API call. The format of the *.spec files is
-documented in the file "tools/build-spec.txt".
+depending on the seriousness of the problem. (documentation/debugging.sgml
+explains when it is appropriate to use each of them). You need to declare
+the debug channel name at the top of the file (after the includes) using
+the WINE_DEFAULT_DEBUG_CHANNEL macro, like so:
+ WINE_DEFAULT_DEBUG_CHANNEL(win);
-DEBUG MESSAGES
-==============
+If your debugging code is more complex than just printf, you can use
+the macros:
-To display a message only during debugging, you normally write something
-like this:
+ TRACE_ON(xxx), WARN_ON(xxx), ERR_ON(xxx) and FIXME_ON(xxx)
+
+to test if the given channel is enabled. Thus, you can write:
- TRACE(win,"abc..."); or
- FIXME(win,"abc..."); or
- WARN(win,"abc..."); or
- ERR(win,"abc...");
-
-depending on the seriousness of the problem. (documentation/degug-msgs
-explains when it is appropriate to use each of them)
-
-These macros are defined in include/debug.h. The macro-definitions are
-generated by the shell-script tools/make_debug. It scans the source
-code for symbols of this forms and puts the necessary macro
-definitions in include/debug.h and include/debugdefs.h. These macros
-test whether the debugging "channel" associated with the first
-argument of these macros (win in the above example) is enabled and
-thus decide whether to actually display the text. In addition you can
-change the types of displayed messages by supplying the "-debugmsg"
-option to Wine. If your debugging code is more complex than just
-printf, you can use the symbols TRACE_ON(xxx), WARN_ON(xxx),
-ERR_ON(xxx) and FIXME_ON(xxx) as well. These are true when channel xxx
-is enabled, either permanent or in the command line. Thus, you can
-write:
-
- if(TRACE_ON(win))DumpSomeStructure(&str);
+ if (TRACE_ON(win)) DumpSomeStructure(&str);
Don't worry about the inefficiency of the test. If it is permanently
disabled (that is TRACE_ON(win) is 0 at compile time), the compiler will
eliminate the dead code.
-You have to start tools/make_debug only if you introduced a new macro,
-e.g. TRACE(win32).
-
For more info about debugging messages, read:
-documentation/debug-msgs
+http://www.winehq.org/site/docs/wine-devel/debugging
MORE INFO
=========
1. There is a FREE online version of the MSDN library (including
- documentation for the Win32 API) on http://www.microsoft.com/msdn/
+ documentation for the Win32 API) on http://msdn.microsoft.com/
+ or http://www.msdn.com/
-2. http://www.sonic.net/~undoc/bookstore.html
+2. Windows apilist: http://www.mentalis.org/apilist/apilist.php
-3. In 1993 Dr. Dobbs Journal published a column called "Undocumented Corner".
+3. http://www.sonic.net/~undoc/bookstore.html
-4. You might want to check out BYTE from December 1983 as well :-)
+4. In 1993 Dr. Dobbs Journal published a column called "Undocumented Corner".
+5. www.geocities.com/SiliconValley/4942/