Release 970804
[wine/multimedia.git] / documentation / wine.texinfo
bloba530871e10522642c84333c8809e08812b9ef7bb
1 \input texinfo   @c -*-texinfo-*-
2 @c %**start of header
3 @setfilename wine.info
4 @settitle Wine Reference Manual
5 @iftex
6 @afourpaper
7 @end iftex
8 @c %**end of header
10 @ifinfo
11 @format
12 START-INFO-DIR-ENTRY
13 * wine: (wine.info).             The Windows Emulator.
14 END-INFO-DIR-ENTRY
15 @end format
16 @end ifinfo
18 @iftex
19 @c @finalout
20 @end iftex
22 @ifinfo
23 This file documents Wine, the Windows Emulator.
25 @c 
26 Copyright @copyright{} 1997 The Wine authors. @*
27 @xref{Authors, The Wine Authors, The Wine Authors},
28 for a list of the copyright holders.
30 Permission is granted to make and distribute verbatim
31 copies of this manual provided the copyright notice and
32 this permission notice are preserved on all copies.
34 @ignore
35 Permission is granted to process this file through TeX
36 and print the results, provided the printed document
37 carries a copying permission notice identical to this
38 one except for the removal of this paragraph (this
39 paragraph not being relevant to the printed manual).
41 @end ignore
42 Permission is granted to copy and distribute modified
43 versions of this manual under the conditions stated in
44 the section entitled ``License, Warranty, and Authors of Wine''.
46 @sp 4
47 FIXME: UNIX and POSIX trademarks. @*
48 DOS @*
49 X11 @*
50 MS-Windows, Windows-NT, Windows 95 are registered trademarks of
51 Microsoft Corp. Postscript is a registered trademark of Adobe Systems
52 Inc. All other product names mentioned herein are the trademarks of
53 their respective owners.
54 @end ifinfo
56 @c begin chapters on right pages
57 @setchapternewpage odd
59 @titlepage
60 @sp 10
62 @center @titlefont{The Wine Reference Manual}
63 @center Edition 0.0.2, 21 July 1997
66 @c The following two commands start the copyright page.
67 @page
68 @vskip 0pt plus 1filll
70 Copyright @copyright{} 1997 The Wine authors. @*
71 @xref{Authors, The Wine Authors, The Wine Authors},
72 for a list of the copyright holders.
74 Permission is granted to make and distribute verbatim
75 copies of this manual provided the copyright notice and
76 this permission notice are preserved on all copies.
78 Permission is granted to copy and distribute modified
79 versions of this manual under the conditions stated in
80 the section entitled ``License, Warranty, and Authors of Wine''.
82 @sp 4
83 FIXME: UNIX and POSIX trademarks. @*
84 MS-Windows, Windows-NT, Windows 95 are registered trademarks of
85 Microsoft Corp. Postscript is a registered trademark of Adobe Systems
86 Inc. All other product names mentioned herein are the trademarks of
87 their respective owners.
88 @end titlepage
93 @c SETTINGS, DEFINES, MACROS
96 @c Edit this macro manually in the above parts of the document
97 @macro winemanualversion
98 0.0.2
99 @end macro
101 @c Edit this macro manually in the above parts of the document
102 @macro winemanualdate
103 21 July 1997
104 @end macro
106 @c Edit this macro manually into the TeX titlepage
107 @macro winemanualtitle
108 The Wine Reference Manual
109 @end macro
112 @macro winelib
113 Winelib
114 @end macro
116 @c MICROSOFT
119 @c FIXME: automatical trademark reference
120 @macro mswindows
121 MS-Windows
122 @end macro
124 @c FIXME: automatical trademark reference
125 @c spell it always the same
126 @macro WIN32
127 WIN32
128 @end macro
129 @macro WIN16
130 WIN16
131 @end macro
133 @c FIXME: automatical trademark reference
134 @macro WINNT
135 Windows NT
136 @end macro
138 @c FIXME: automatical trademark reference
139 @macro WIN95
140 Windows 95
141 @end macro
145 @c THE OTHERS
147 @c FIXME: automatical trademark reference
148 @macro unix
149 UNIX
150 @end macro
152 @c FIXME: automatical trademark reference
153 @macro posix
154 POSIX
155 @end macro
157 @macro unicode
158 Unicode
159 @end macro
161 @macro ascii
162 ASCII
163 @end macro
166 @c THIS MANUAL
169 @c flag out differences to MS-Windows
170 @macro windiff
171 @emph{Differences to @mswindows{}:} @*
172 @end macro
174 @macro windiffnone
175 @windiff{}
176 No differences known.
177 @end macro
179 @c tell whether function is present in Windows 95 and/or NT
180 @macro winconf
181 @emph{Conformance to @mswindows{}:} @*
182 @end macro
184 @macro winconfall
185 @winconf{}
186 Present in @WIN95{} and @WINNT{}.
187 @end macro
189 @c give information about completion
190 @macro completion
191 @emph{Completion status:} @*
192 @end macro
194 @macro completionnone
195 @completion{}
196 Not yet implemented.
197 @end macro
200 @c MACROS FOR FUNCTIONS, TYPES, CONSTANTS, VARIABLES
203 @c Constants in the WIN32 API
204 @macro defvr_cw32 {restofline}
205 @defvr Constant \restofline\
206 @end macro
207 @macro defvrx_cw32 {restofline}
208 @defvrx Constant \restofline\
209 @end macro
211 @c Functions in the WIN32 API
212 @macro deftypefn_w32 {restofline}
213 @deftypefn {WIN32 function} \restofline\
214 @end macro
215 @macro deftypefnx_w32 {restofline}
216 @deftypefnx {WIN32 function} \restofline\
217 @end macro
219 @c Types in the WIN32 API
220 @macro deftp_w32 {restofline}
221 @deftp {Data type} \restofline\
222 @end macro
223 @macro deftpx_w32 {restofline}
224 @deftpx {Data type} \restofline\
225 @end macro
227 @c Macros internal to Wine
228 @macro deffn_winemacro {restofline}
229 @deffn {Wine internal macro} \restofline\
230 @end macro
231 @macro deffnx_winemacro {restofline}
232 @deffn {Wine internal macro} \restofline\
233 @end macro
235 @c Constants internal to Wine
236 @macro defvr_cwine {restofline}
237 @defvr {Wine internal constant} \restofline\
238 @end macro
239 @macro defvrx_cwine {restofline}
240 @defvrx {Wine internal constant} \restofline\
241 @end macro
245 @c TOP NODE
247 @ifinfo
248 @node Top, Copying, (dir), (dir)
249 @top Wine
251 This is edition @winemanualversion{}, last updated @winemanualdate{},
252 of @winemanualtitle{}.
254 Wine (Wine Is Not an Emulator, or the WINdows Emulator)
255 is both an emulator that runs @mswindows{} executables and a library
256 that can be used to compile @mswindows{} source code.
258 Wine is free software. Wine is still in development-only state.
259 @end ifinfo
261 @menu
262 * Copying::                     License, Warranty, and Authors of Wine.
263 * Introduction::                A short overview.
264 * Reference Manual::            The Wine reference manual.
265 * Installation::                Installing and configuring Wine.
266 * The Wine Project::            How to contribute to Wine.
267 * Concept Index::               Index of concepts and names.
268 * Type Index::                  Index of types and type qualifiers.
269 * Function Index::              Index of functions and function-like
270                                 macros.
271 * Variable Index::              Index of variables, constants, and
272                                 variable-like macros.
273 * File Index::                  Index of programs and files.
274 @end menu
276 @node Copying, Introduction, Top, Top
278 @unnumbered License, Warranty, and Authors of Wine
279 @cindex copying conditions for Wine
280 @cindex conditions for copying Wine
281 @cindex Wine copying conditions
283 The Wine license, warranty, and list of authors together form the
284 copyright for Wine. Read these sections carefully.
286 @menu
287 * License::                     The Wine license.
288 * Warranty::                    Wine comes with no warranty.
289 * Authors::                     The persons that contributed to Wine.
290 @end menu
292 @node License, Warranty, , Copying
293 @cindex Wine license
294 @cindex license of Wine
296 @unnumberedsec The Wine License
297 Wine is distributed under the following copyright.
299 @quotation
300 @include LICENSE
301 @end quotation
303 @node Warranty, Authors, License, Copying
304 @cindex Wine warranty
305 @cindex warranty of Wine
307 @unnumberedsec The Wine Warranty
309 @quotation
310 @include WARRANTY
311 @end quotation
313 @node Authors, , Warranty, Copying
314 @cindex Wine authors
315 @cindex authors of Wine
316 @cindex copyright holders of Wine
317 @cindex Wine copyright holders
319 @unnumberedsec The Wine Authors
321 @quotation
322 @include AUTHORS
323 @end quotation
325 These persons also hold the copyright on Wine.
327 The overall coordination is done by @*
328 Alexandre Julliard @*
329 @email{julliard@@lrc.epfl.ch}
333 @node Introduction, Reference Manual, Copying, Top
334 @chapter Introduction
336 @center Wine:
337 @center the WINdows Emulator,
338 @center or Wine Is Not an Emulator
340 FIXME: make an easy-readable fluent text out of this.
342 Welcome to @winemanualtitle{}. This is edition @winemanualversion{},
343 last updated @winemanualdate{}.
345 @strong{What is Wine?}
347 Wine is a program that allows running MS-Windows programs under X11.
350 Wine incorporates two features, the program loader and @winelib{}:
351 @enumerate
352 @item
353 You can run @mswindows{} binaries (programs) in Wine. Wine contains a
354 program loader which loads and executes an @mswindows{} binary. It uses
355 the @winelib{} features of Wine to translate @WIN32{} and @WIN16{} calls
356 to their @unix{}/X11 equivalent.
358 Both 16 bit and 32 bit binaries can be loaded.
359 @item
360 @winelib{}: Wine can also be used as a library which implements the 
361 @mswindows{} API on top of a @unix{} or @unix{}-like operating system
362 with X11. @winelib{} (i.e. the Wine library) translates @WIN16{} or
363 @WIN32{} API calls to their @unix{}/X11 equivalent.
365 You can write a user-level application program that calls the @WIN16{}
366 or @WIN32{} API functions and compile it on a @unix{} box.
367 @end enumerate
369 @strong{Status}
371 Wine is still at development stage. The file @file{ANNOUNCE} says,
372 ``This is still a developer's only release.  There are many bugs and
373 many unimplemented API features.  Most applications still do not work
374 correctly.''
375 @xref{Warranty}, for additional information.
377 @strong{Requirements}
379 Wine needs an 80x86 CPU to run on. Emulating the CPU is currently not
380 possible.
382 Currently, you must have one of:
383 @itemize @bullet
384 @item
385 Linux version 0.99.13 or above
386 @item
387 NetBSD-current
388 @item
389 FreeBSD-current or FreeBSD 1.1
390 @end itemize
391 You need X11, and you must have @file{libXpm} installed on your system.
393 @strong{Availability}
395 Wine is free software. The file @file{README} says, ``Basically, you can do
396 anything with it, except claim that you wrote it.''
397 @xref{Copying}, for more information.
399 @strong{Performance}
401 Wine is expected to run @mswindows{} binaries about the same speed as
402 @mswindows{} would. However, be aware that the 16 bit versions of
403 @mswindows{} programs are generally slower than their 32 bit
404 counterparts.
406 @strong{Further information}
408 You should consult the files @file{README}, @file{ANNOUNCE},
409 @file{RELEASE-NOTES}, @file{BUGS}, @file{LICENSE}, and @file{WARRANTY},
410 in the root directory of the Wine distribution.
412 The Wine FAQ, available from
413 @url{ftp://ftp.asgardpro.com/wine/dave/Wine.FAQ},
414 @url{ftp://tsx-11.mit.edu/pub/linux/ALPHA/Wine/Wine.FAQ},
415 @url{ftp://rtfm.mit.edu/pub/usenet-by-group/comp.emulators.ms-windows.wine/WINE_(WINdows_Emulator)_Frequently_Asked_Questions},
416 @url{ftp://sunsite.unc.edu/pub/Linux/ALPHA/wine/Wine.FAQ},
417 @url{http://www.asgardpro.com/wine/index.html},
418 gives answer to a lot of questions.
420 The Wine USENET newsgroup is interesting for developers. It discusses technical
421 matters about Wine. The address is: @url{news:comp.emulators.ms-windows.wine}.
425 @xref{The Wine Project}, if you consider contributing some work.
429 @node Reference Manual, Installation, Introduction, Top
431 @menu
432 * @WIN32{} Reference Manual::      The @WIN32{} function calls and data types.
433 * Resources and INI files::     How to determine the appearance and
434                                 behaviour of Wine programs.
435 * Metafiles--Icons--Bitmaps::     FIXME missing.
436 * Debugging::                   Debugging Wine.
437 * Programs::                    Programs written to run in/with Wine.
438 * Tools::                       Programs to support Wine.
439 @end menu
441 @node @WIN32{} Reference Manual, Resources and INI files, , Reference Manual
442 @chapter The @WIN32{} Reference Manual
444 @menu
445 * Kernel Objects::              How the Wine kernel keeps information.
446 * Processes and Threads::       Job control and management in Wine.
447 * Users and Groups::            Security in Wine.
448 * Date and Time::               Functions for getting the date and time
449                                 and for conversion between formats.
450 * System Information::          Getting information about the hardware
451                                 and software the system runs on.
452 * Memory Management::           How your programs get memory from
453                                 Wine.
454 * I/O Facilities::              Input/Output in Wine.
455 * Communication::               How processes can communicate.
456 * Windows and Graphics::        GUI functions of @WIN32{}.
457 * Errors and Exceptions::       How your program can report errors.
458                                 (messaging)
459 * Resources::                   Functions for dealing with resources.
460 * The Registry::                FIXME missing.
461 * Dynamic Link Libraries::      Functions for dealing with DLL's.
462 @end menu
464 @node Kernel Objects, Processes and Threads, , @WIN32{} Reference Manual
465 @section Kernel Objects
468 @node Processes and Threads, Users and Groups, Kernel Objects, @WIN32{} Reference Manual
469 @section Processes and Threads
471 @node Users and Groups, Date and Time, Processes and Threads, @WIN32{} Reference Manual
472 @section Users and Groups
474 @node Date and Time, System Information, Users and Groups, @WIN32{} Reference Manual
475 @section Date and Time
477 This section describes functions for manipulating dates and times. This
478 includes the current time, the creation or manipulation times of files
479 and other objects, and conversion between different time
480 representations.
482 @menu
483 * File Times::                  Creation and manipulation times of files.
484 @end menu
486 @node File Times, , , Date and Time
487 @subsection File Times
489 @menu
490 * Type FILETIME::               The data structure used for specifying
491                                 file times.
492 * Compare File Times::          Compare two file times.
493 @end menu
496 @c *** struct FILETIME ***
498 @node Type FILETIME, Compare File Times, , File Times
499 @subsubsection Type FILETIME
501 @noindent
502 File times in Wine are specified by the data type @code{FILETIME},
503 defined in @file{windows.h}.
504 @deftp_w32  FILETIME
505 @deftpx_w32 LPFILETIME
506 This is the data type for specifying file times. The file times are
507 stored with 64 bit precision. The actual data type is a structure with
508 two 32-bit values which are interpreted as the low and high parts of a
509 64-bit value. This value gives a time measured in a granularity of 100
510 nanoseconds, so 1.5 seconds are specified by a value of 15,000,000.  In
511 Wine, this 64-bit value is signed, with the sign taken from the high
512 part. The lower part is used as unsigned.
514 The definition of @code{FILETIME} reads:
515 @example
516 typedef struct
518     INT32 dwLowDateTime;
519     INT32 dwHighDateTime;
520 @} FILETIME, *LPFILETIME;
521 @end example
523 @cindex epoch in file time
524 The @code{FILETIME} structure may be used to hold absolute or relative
525 times. Absolute times are given as the number of 100 nanoseconds
526 intervals elapsed since 1 January 1601, 00:00:00 UTC (Coordinated
527 Universal Time, which is GMT, Greenwich Mean Time). This might be
528 called the @dfn{epoch} for file times. With a signed 64-bit value, this
529 representation covers absolute times of 29247 years around the epoch.
530 To convert this type to local time, use the function
531 @code{FileTimeToLocalFileTime}. 
533 @windiff{}
534 In @mswindows{}, the elements of the structure are apparently of type
535 @code{DWORD}. Whether the full 64 bit value is interpreted as signed or
536 unsigned I do not know.
537 @end deftp
540 @c *** CompareFileTime ***
542 @node Compare File Times, , Type FILETIME, File Times
544 @noindent
545 The Wine function @code{CompareFileTime} compares two file times, and
546 returns whether the first time is less than, equal to, or greater than
547 the second file time. It is defined in @file{windows.h}.
548 @deftypefn_w32 LONG CompareFileTime (@w{CONST FILETIME* @var{time_1},} @w{CONST FILETIME* @var{time_2})}
549 This function returns @code{1}, if @var{time_1} is greater than
550 @var{time_2}, @code{-1} if it is less, and @code{0} if both times are
551 equal. 
553 @winconfall{}
555 @windiffnone{}
557 @completionnone{}
558 @end deftypefn
560 @node System Information, Memory Management, Date and Time, @WIN32{} Reference Manual
561 @section System Information
563 @node Memory Management, I/O Facilities, System Information, @WIN32{} Reference Manual
564 @section Memory Management
566 @node I/O Facilities, Communication, Memory Management, @WIN32{} Reference Manual
567 @section I/O Facilities
569 This section describes all input/output of a process, except for two
570 topics: communication with other processes, and communication with the
571 windowing system.
573 @menu
574 * I/O on Files::                Accessing the contents of files.
575 * File System Interface::       Functions for manipulating files as a whole.
576 @end menu
578 @node I/O on Files, File System Interface, , I/O Facilities
579 @subsection I/O on Files
581 @node File System Interface, , I/O on Files, I/O Facilities
582 @subsection File System Interface
584 These functions are concerned with operating on files themselves, rather
585 than on their contents.
587 @menu
588 * Type BY_HANDLE_FILE_INFORMATION::     The data structure used to
589                                         specify file information.
590 * File attributes::                     The file attributes flags in
591                                         a file information structure.
592 * Getting file information::            These functions let you obtain
593                                         information about a file.
594 @end menu
596 @node Type BY_HANDLE_FILE_INFORMATION, File attributes, , File System Interface
597 @subsubsection The file information structure
599 The file information structure of Wine is used to obtain information
600 about files. It is declared in the header @file{winedows.h}.
601 @deftp_w32 BY_HANDLE_FILE_INFORMATION
602 This is the data type for specifying information about files as objects
603 of the file system. It contains the following members:
604 @table @code
605 @item int dwFileAttributes
606    @cindex file attributes in file information
607    @cindex attributes of file in file information
608    @xref{File attributes}, for details.
609 @item FILETIME ftCreationTime
610    @cindex creation time in file information
611    @cindex time of file creation in file information
612    The time when the file was created.
613    @xref{Type FILETIME}, for details.
614 @item FILETIME ftLastAccessTime
615    @cindex access time in file information
616    @cindex time of file access in file information
617    The time when the file was last accessed.
618    @xref{Type FILETIME}, for details.
619 @item FILETIME ftLastWriteTime
620    @cindex write time in file information
621    @cindex time of last file write in file information
622    The time when the file was last written to.
623    @xref{Type FILETIME}, for details.
624 @item int dwVolumeSerialNumber
625    @cindex serial number of volume in file information
626    @cindex volume number (serial) in file information
627    The serial number of the volume containing the file. In Wine,
628    currently 0.
629 @item int nFileSizeHigh
630    @cindex file size in file information
631    @cindex size of file in file information
632    A 32 bit value which contains the high part of the 64 bit file size.
633 @item int nFileSizeLow
634    A 32 bit value which contains the low part of the 64 bit file size.
635 @item int nNumberOfLinks
636    @cindex hard links number in file information
637    @cindex links (number of hard) in file information
638    This is the number of hard links to the file. In a file system which
639    does not support hard links, this is 1.
640 @item int nFileIndexHigh
641    @cindex inode number in file information
642    @cindex file index in file information
643    @cindex index of file in file information
644    A 32 bit value which contains the high part of the 64 bit file
645    index. The file index is a unique number for a file on a volume.
646    This identifier cannot change while the file is opened by a process.
647    Together with the volume number, the file index is a unique
648    identifier for the file. This can be used by an application to check
649    whether two handles refer to the same file. Wine currently uses the
650    inode number for the file index.
651 @item int nFileIndexLow
652    A 32 bit value which contains the low part of the 64 bit file index.
653 @end table
655 The definition of @code{BY_HANDLE_FILE_INFORMATION} reads:
656 @example
657 typedef struct
659   int dwFileAttributes;
660   FILETIME ftCreationTime;
661   FILETIME ftLastAccessTime;
662   FILETIME ftLastWriteTime;
663   int dwVolumeSerialNumber;
664   int nFileSizeHigh;
665   int nFileSizeLow;
666   int nNumberOfLinks;
667   int nFileIndexHigh;
668   int nFileIndexLow;
669 @} BY_HANDLE_FILE_INFORMATION ;
670 @end example
672 The @code{BY_HANDLE_FILE_INFORMATION} structure can be obtained by the
673 @code{GetFileInformationByHandle} function (@pxref{Getting file information}, for
674 details).
676 @windiff{}
677 In @mswindows{}, the @code{int} elements of the structure are apparently
678 of type @code{DWORD}.
679 @end deftp
681 @node File attributes, Getting file information, Type BY_HANDLE_FILE_INFORMATION, File System Interface
682 @subsubsection The file attributes in a file information structure
684 The file attributes in a file information structure and in other structures
685 are a logical @emph{or} of one or more of the following constants:
687 @defvr_cw32 FILE_ATTRIBUTE_READONLY
688 The file is a read-only file. (Wine value: 0x0001).
689 @end defvr
690 @defvr_cw32 FILE_ATTRIBUTE_HIDDEN
691 The file is a hidden file. Files in Wine do not have this attribute. (Wine value:
692 0x0002).
693 @end defvr
694 @defvr_cw32 FILE_ATTRIBUTE_SYSTEM
695 The file belongs to the operating system. Files in Wine do not have this
696 attribute. (Wine value: 0x0004).
697 @end defvr
698 @defvr_cw32 FILE_ATTRIBUTE_LABEL
699 This is not present in the @mswindows{} API. (Wine value: 0x0008).
700 @end defvr
701 @defvr_cw32 FILE_ATTRIBUTE_DIRECTORY
702 The file is a directory. (Wine value: 0x0010).
703 @end defvr
704 @defvr_cw32 FILE_ATTRIBUTE_ARCHIVE
705 The file is an archive file. All non-directory files are reported by Wine 
706 to have this attribute. (Wine value: 0x0020).
707 @end defvr
708 @defvr_cw32 FILE_ATTRIBUTE_NORMAL
709 The file does not have any other attributes set. This value must be used
710 alone. In Wine, normal files are reported as archive files. (Wine value:
711 0x0080).
712 @end defvr
713 @defvr_cw32 FILE_ATTRIBUTE_TEMPORARY
714 The file is used as a temporary storage. Files in Wine do not have this
715 attribute. (Wine value: 0x0100).
716 @end defvr
717 @defvr_cw32 FILE_ATTRIBUTE_ATOMIC_WRITE
718 This is reserved for future use. Files in Wine do not have this
719 attribute. (Wine value: 0x0200).
720 @end defvr
721 @defvr_cw32 FILE_ATTRIBUTE_XACTION_WRITE
722 This is reserved for future use. Files in Wine do not have this
723 attribute. (Wine value: 0x0400).
724 @end defvr
725 @defvr_cw32 FILE_ATTRIBUTE_COMPRESSED
726 The file is compressed. Files in Wine do not have this attribute. (Wine
727 value: 0x0800). 
728 @end defvr
730 @node Getting file information, , File attributes, File System Interface
731 @subsubsection Getting file information
733 The functions in this section describe how to get information about
734 files. 
737 @c *** GetFileInformationByHandle
739 @noindent
740 The Wine function @code{GetFileInformationByHandle} returns a file
741 information structure. It is defined in @file{windows.h}.
743 @deftypefn_w32 BOOL GetFileInformationByHandle (@w{HFILE32 @var{file},} @w{BY_HANDLE_FILE_INFORMATION *@var{info})}
744 This function obtains for the specified @var{file} the file information,
745 and stores it in @var{info}. The file information contains the file
746 attributes, the file times, the volume serial number, the file size, the
747 number of links, and a unique file identifier. The function returns
748 @code{TRUE} on success, @code{FALSE} on failure.
750 @winconfall{}
752 @windiff{}
753 The Wine function can of course only give back information that is
754 accessible in the @unix{} file system. File times are produced in a
755 granularity of full seconds. Most file attributes are not present in the
756 @unix{} file system. @xref{File attributes}, for details. The volume
757 serial number is set to 0.
758 @end deftypefn
762 @c *** GetFileTime ***
764 @noindent
765 The Wine function @code{GetFileTime} returns the creation time and
766 the times of last the read and modification access to a file. It is
767 defined in @file{windows.h}.
769 @deftypefn_w32 BOOL GetFileTime (@w{HANDLE @var{file},} @w{LPFILETIME @var{ctime},} @w{LPFILETIME @var{atime},} @w{LPFILETIME @var{mtime})}
770 This function obtains for the specified @var{file} the creation time
771 @var{ctime}, the time of the last access to the file @var{atime}, and
772 the time of the last modification (write) to the file, @var{mtime}.
773 The file time arguments of this function are pointers to @code{FILETIME}
774 variables, which are filled with a value that indicates an absolute time
775 in UTC. @xref{Type FILETIME}, for details. If you do not need some of
776 the times, you can pass a @code{NULL} pointer.
777 The function returns @code{TRUE} on
778 success, @code{FALSE} on failure.
780 @winconfall{}
782 @windiff{}
783 The file times are produced in a granularity of full seconds, due to the
784 underlying @unix{} file system. 
785 @end deftypefn
788 @c *** GetFileAttributes ***
790 @noindent
791 The Wine function @code{GetFileAttributes} returns the file attributes
792 for a file. It is defined in @file{windows.h}.
794 @deftypefn_w32 DWORD GetFileAttributes (@w{LPCTSTR @var{name})}
795 This function looks up the file with name @var{name}, and returns the
796 attributes of the file. @xref{File attributes}, for details on the file
797 attributes. If the function is not successful, it returns a word with
798 all bits set (@samp{0xffffffff}).
800 @winconfall{}
802 @windiff{}
803 Most file attributes are not present in the
804 @unix{} file system. @xref{File attributes}, for details.
805 @end deftypefn
810 @node Communication, Windows and Graphics, I/O Facilities, @WIN32{} Reference Manual
811 @section Communication
813 @node Windows and Graphics, Errors and Exceptions, Communication, @WIN32{} Reference Manual
814 @section Windows and Graphics
816 @node Errors and Exceptions, Resources, Windows and Graphics, @WIN32{} Reference Manual
817 @section Errors and Exceptions
819 @node Resources, The Registry, Errors and Exceptions, @WIN32{} Reference Manual
820 @section Resources
822 @node The Registry, Dynamic Link Libraries, Resources, @WIN32{} Reference Manual
823 @section The Registry
825 @node Dynamic Link Libraries, , The Registry, @WIN32{} Reference Manual
826 @section Dynamic Link Libraries (DLL's)
828 This section deals with API functions for handling DLL's (dynamic link
829 libraries). It does not describe DLL's themselves; nor does it give
830 information on how Wine handles DLL's. @xref{The build program}, for
831 information on how DLL's are integrated into Wine.
836 @node Resources and INI files, Metafiles--Icons--Bitmaps, @WIN32{} Reference Manual, Reference Manual
837 @chapter Resources and @file{INI} Files
839 @node Metafiles--Icons--Bitmaps, Debugging, Resources and INI files, Reference Manual
840 @chapter Metafiles --- Icons --- Bitmaps
842 @node Debugging, Programs, Metafiles--Icons--Bitmaps, Reference Manual
843 @chapter Debugging
845 @node Programs, Tools, Debugging, Reference Manual
846 @chapter Programs
848 @node Tools, , Programs, Reference Manual
849 @chapter Tools
851 This chapter describes some of the tools that are used by Wine. These
852 are not user-level programs which the user of Wine will
853 run. @xref{Programs} for such programs.
855 Tools are internal programs that are used to help compile or configure
856 Wine.
858 @menu
859 * The build program::           A program used to build the DLL entry
860                                 points from specifications in @file{if1632/}.
861 @end menu
864 @node The build program, , , Tools
865 @section The @file{build} program
867 @cindex modules of Wine
868 @cindex Wine modules
869 @cindex DLL's built-in in Wine
870 @cindex Wine DLL's built-in
871 @cindex built-in DLL's in Wine
872 Wine contains several modules that implement various DLL's which are
873 required to run @mswindows{} programs.
875 The @file{build} program, located in the @file{tools/} directory, is
876 used to create the bindings for the DLL entry points of the API functions.
877 This program reads a @file{.spec}-file in the @file{if1632} directory
878 and creates the assembly code that translates the function arguments
879 correctly. 
882 @menu
883 * The spec files::              The format of the @file{.spec}-files.
884 @end menu
886 FIXME: where in Wine are the DLL's affixed?
888 FIXME: write a description
890 @xref{Implementing an API function}, for notes on using this program.
892 @node The spec files, , , The build program
893 @subsection The @file{.spec}-files
894 @cindex DLL spec files
895 @cindex spec files of DLL's
896 @cindex entry points in DLL's
898 This subsection describes the format of the @file{.spec}-files.
900 A @file{.spec}-file contains the information about the functions,
901 variables, and constants that are contained in a DLL (dynamic link
902 library).
904 To be able to interpret the contents of a @file{.spec}-file, you must
905 know about the concept of ordinals.
906 @menu
907 * The general format::                  General format conventions.
908 * Ordinals::                            Ordinals are indexes of entry
909                                         points into DLL's.
910 * Spec file header::                    The header information.
911 * Variable entry points::               Entries for DLL variables.
912 * Function entry points::               Entries for DLL functions.
913 * Special entries::                     Entries for stubs, dummy
914                                         functions, Wine symbols, and
915                                         constant values.
916 @end menu
918 @node The general format, Ordinals, , The spec files
919 @subsubsection The general format
920 @cindex format of spec files
921 @cindex spec files format
923 The @file{.spec}-file contains a header and a sequence of declarations.
924 Each declaration describes an ordinal.
926 The header gives general information about the DLL and its properties.
928 Ordinal declarations are optional. That means that there is a default
929 behaviour assigned to ordinals which are not mentioned in the
930 @file{.spec}-file. The default handler function of an ordinal will print
931 an error message when called.
933 Comments are indicated by hash marks (@samp{#}); everything between a
934 hash mark and the end of the line is ignored.
936 Empty lines are allowed.
937 @* FIXME: is that so?
939 @node Ordinals, Spec file header, The general format, The spec files
940 @subsubsection Ordinals
941 @cindex ordinals in DLL's
942 @cindex DLL ordinals
944 All references to DLL objects like functions or variables are indexed by
945 unique nonnegative numbers. These numbers are called
946 @dfn{ordinals}. Apparently, a program can refer to a DLL function or
947 variable by specifying its name or its ordinal. Although reference by
948 name is the common usage, some program parts (notably DLL's themselves)
949 sometimes refer to DLL entries by ordinal. Therefore, the ordinals
950 cannot be chosen arbitrarily.
951 @* FIXME: is that correct?
953 @node Spec file header, Variable entry points, Ordinals, The spec files
954 @subsubsection The header of a @file{.spec}-file
956 The @file{.spec}-file starts with two mandatory definitions. The first
957 line gives the name of the DLL which the @file{.spec}-file describes,
958 @example
959 name @var{NAME}
960 @end example
961 where @var{NAME} is the name of the DLL. The next line defines the type
962 of the DLL, 
963 @example
964 type @var{TYPE}
965 @end example
966 with @var{TYPE} being either @samp{win16} or @samp{win32}.
968 An optional statement of the form
969 @example
970 base @var{ORDINAL}
971 @end example
972 can be used to define the offset of the first ordinal. @var{ORDINAL}
973 must be an integer number. If no base is specified, the offset is zero.
974 @* FIXME: is this the offset of the first or an offset that is added to all
975 ordinals?
976 what is the offset? Is it added to the ordinals, or is it an address, or
977 xxx?
979 An optional statement like
980 @example
981 heap @var{SIZE}
982 @end example
983 can be used to define the size of the module local heap. This is only
984 used for @WIN16{} DLL's. The local heap is the place where the segments
985 of 16 bit programs can locally allocate memory, without interfering with
986 one another. The default size of the local heap, if not specified, is 0.
988 @* FIXME: to my impression, a local heap in DLL's would only be required
989 if DLL functions used it. As all DLL functions in Wine are truly 32 bit
990 functions that are mapped from 16 bit on being called and back to 16 bit
991 on returning, a local heap should never be necessary.
992 If I receive a confirmation of that here, I will state so. Otherwise I
993 am missing some information on local heaps.
994 But why is a heap defined in user.spec and gdi.spec?
996 @node Variable entry points, Function entry points, Spec file header, The spec files
997 @subsubsection Variable entry points of @file{.spec}-files
999 You can declare an ordinal that holds data. Data items may be of 8, 16,
1000 or 32 bit in size.
1002 @example
1003 @var{ORDINAL} @var{VARTYPE} @var{EXPORTNAME} (@var{DATA} @var{[DATA @dots{}]})
1004 @end example
1006 @var{ORDINAL} is the ordinal number corresponding to the
1007 variable. @var{VARTYPE} must be @samp{byte}, @samp{word}, or
1008 @samp{long}, for 8, 16, or 32 bits respectively. @var{EXPORTNAME} will
1009 be the name available for dynamic linking. @var{DATA} can be a decimal
1010 number or a hex number preceded by @samp{0x}. Each @var{DATA} item defines
1011 a unit of storage.
1013 The following example defines the variable @samp{VariableA} at ordinal
1014 2, containing 4 bytes:
1015 @example
1016 2 byte VariableA(-1 0xff 0 0)
1017 @end example
1020 @node Function entry points, Special entries, Variable entry points, The spec files
1021 @subsubsection Function entry points of @file{.spec}-files
1023 @example
1024 @var{ORDINAL} @var{FUNCTYPE} @var{EXPORTNAME} (@var{[ARGTYPE} @dots{} @var{]}) @var{HANDLERNAME}
1025 @end example
1027 @var{ORDINAL} is the ordinal number corresponding to the
1028 function. @var{FUNCTYPE} must be chosen from this table:
1029 @table @samp
1030 @item pascal16
1031 A @WIN16{} function that returns a 16 bit value.
1032 @item pascal
1033 A @WIN16{} function that returns a 32 bit value.
1034 @item register
1035 A function using CPU registers to pass arguments.
1036 @item stdcall
1037 A normal @WIN32{} function.
1038 @item cdecl
1039 A @WIN32{} function using the C calling conventions. (This is presently
1040 only used for the built-in functions of the C runtime system).
1041 @end table
1043 @var{EXPORTNAME} specifies the name (prototype) available for dynamic
1044 linking.
1046 @var{ARGTYPE} must be chosen from this table:
1047 @table @samp
1048 @item byte
1049   An 8 bit argument. Can be used in @WIN16{} functions only.
1050 @item word
1051   A 16 bit argument. Can be used in @WIN16{} functions only.
1052 @item long
1053   A 32 bit argument. Can be used in @WIN16{} or @WIN32{} functions.
1054 @item ptr
1055   A linear pointer, unsegmented. Can be used in @WIN16{} or @WIN32{}
1056   functions.
1057 @item str
1058   A linear pointer, unsegmented, pointing to a null-terminated string.
1059   Can be used in @WIN16{} or @WIN32{} functions.
1060 @item s_byte
1061   A signed 8 bit argument. Can be used in @WIN16{} functions only.
1062 @item s_word
1063   A signed 16 bit argument. Can be used in @WIN16{} functions only.
1064 @item s_long
1065   A signed 32 bit argument. Can be used in @WIN16{} or @WIN32{}
1066   functions.
1067 @item segptr
1068   A segmented pointer. Can be used in @WIN16{} functions only.
1069 @item segstr
1070   A segmented pointer to a null-terminated string. Can be used in
1071   @WIN16{} functions only.
1072 @end table
1074 @var{HANDLERNAME} is the name of the actual Wine function that will
1075 process the request in 32-bit mode.
1078 @sp 2
1079 Here are some examples. The first example defines an entry point for the
1080 @code{CreateWindow()} call (the ordinal 100 is just an example):
1081 @example
1082 100 pascal CreateWindow(ptr ptr long s_word s_word s_word s_word
1083                         word word word ptr) WIN_CreateWindow
1084 @end example
1086 The second example defines an entry point for the @code{GetFocus()} call
1087 (again, the ordinal 100 is an example):
1088 @example
1089 100 pascal GetFocus() WIN_GetFocus()
1090 @end example
1092 To declare a function that uses a variable number of arguments, specify
1093 the function as taking no arguments. In this special case, in @WIN32{}
1094 the called function will be passed a pointer to the first arg; in
1095 @WIN16{}, the args are available as @code{CURRENT_STACK16->args}.
1096 @* FIXME: create a reference here
1097 See the @code{wsprintf}* functions in @file{user.spec} and 
1098 @file{user32.spec} for an example.
1101 @node Special entries, , Function entry points, The spec files
1102 @subsubsection Special entries of @file{.spec}-files
1104 The @file{.spec}-files offer the possibility to use some special
1105 entries. These entries are used for stubs (which allow linking for
1106 non-existing functions), dummy functions that do not perform any
1107 operations, Wine symbols that must be referenced directly, and constant
1108 values.
1111 @strong{Stub ordinals}
1113 This pseudo function type defines a stub function. It makes the name and
1114 ordinal available for dynamic linking, but will terminate execution with
1115 an error message if the function is ever called.
1117 @example
1118 @var{ORDINAL} stub @var{EXPORTNAME}
1119 @end example
1121 @var{ORDINAL} is the ordinal number corresponding to the
1122 function. @var{EXPORTNAME} specifies the name (prototype) available for dynamic
1123 linking.
1125 @strong{Return ordinals}
1127 This pseudo function type defines a function entry point whose handler
1128 should do nothing but return a value.
1129 @example
1130 @var{ORDINAL} return @var{EXPORTNAME} @var{ARGLENGTH} @var{RETVALUE}
1131 @end example
1133 @var{ORDINAL} is replaced by the ordinal number corresponding to the
1134 function. @var{ARGLENGTH} is the number of bytes that need to be removed
1135 from the stack before returning to the caller. @var{RETVALUE} is the
1136 return value which will be passed back to the caller.
1138 @strong{Extern ordinals}
1140 @example
1141 @var{ORDINAL} extern @var{EXPORTNAME} @var{SYMBOLNAME}
1142 @end example
1143 This type defines an entry that simply maps to a Wine symbol
1144 (variable or function); @var{EXPORTNAME} will point to the symbol
1145 @var{SYMBOLNAME} that must be defined in C code. This type only works with
1146 @WIN32{}.
1149 @strong{Equate ordinals}
1151 @example
1152 @var{ORDINAL} equate @var{EXPORTNAME} @var{DATA}
1153 @end example
1155 This type defines an ordinal as an absolute value.
1156 @var{ORDINAL} is replaced by the ordinal number corresponding to the
1157 entry. @var{EXPORTNAME} will be the name available for dynamic linking.  
1158 @var{DATA} can be a decimal number or a hex number preceeded by @samp{0x}.
1161 @node Installation, The Wine Project, Reference Manual, Top
1162 @chapter Wine installation and configuration
1163 FIXME: write installation guide
1165 @menu
1166 * Applying patches::            How to update Wine to a newer version.
1167 @end menu
1169 @node Applying patches, , , Installation
1170 @section Applying patches
1171 @xref{Creating patches}, for instructions on creating patches.
1173 FIXME: write patch instructions
1176 @node The Wine Project, , Installation, Top
1177 @chapter The Wine project
1178 @cindex Wine project contributions
1179 @cindex project contributions to Wine
1181 If you are new to Wine and want to support this project, here are
1182 some suggestions. 
1184 @menu
1185 * Implementing an API type::            How to implement a data type
1186                                         of the API (a checklist).
1187 * Implementing an API function::        How to implement one function
1188                                         of the API (a checklist).
1189 * API function and type naming::        How to name API functions in Wine.
1190 * Creating patches::                    How to create patches for Wine.
1191 * Adding Documentation::                Templates for the documentation.
1192 * File names::                          How Wine treats @mswindows{} and
1193                                         @unix{} file names.
1194 * Wide character strings::              How Wine treats wide character
1195                                         strings.
1196 @end menu
1198 @xref{Debugging}, for advice on how to debug Wine.
1199 @xref{Applying patches}, for instructions on applying patches.
1201 FIXME: what is most urgently needed
1203 @node Implementing an API type, Implementing an API function, , The Wine Project
1204 @section Implementing an API type
1206 Here is a checklist that should help you writing your first API type. It
1207 will of course not tell you which elements to put into the type
1208 (assuming it is a structure), but it should help you along the way of
1209 integrating this type into Wine.
1210 @xref{Implementing an API function}, for comparison.
1212 @enumerate
1213 @item
1214 Find out how the type should be named in Wine and in the DLL's.
1215 @xref{API function and type naming}, for details.
1217 @item
1218 Find out where the type should go. Please try to keep the header files
1219 structure as similar to @mswindows{} as possible. 
1221 @item
1222 Prepare for the later patch (by saving the original files before you
1223 work on them). @xref{Creating patches}, for details.
1225 @item
1226 Put the type declaration into the header file.
1228 @item
1229 Make sure the declaration is syntactically correct, i.e. it does not
1230 keep Wine from compiling.
1232 @item
1233 Make sure the declared type is layout-compatible with
1234 @mswindows{}-compiled types. Especially keep an eye on the packing of
1235 the structure.
1236 @* FIXME: a reference to packed structures here.
1238 @item
1239 Build Wine and test the type, if possible. If you cannot test the
1240 type by implementing a proper API function, write a small test program
1241 to test it on its own. Or rather stop here.
1243 @item
1244 Write the documentation of the type in the @file{wine.texinfo}
1245 file. @xref{Adding Documentation}, for details.
1246 With types, be especially careful and document all the details. Also
1247 document all constants or flags that are used in the type.
1249 @item
1250 Create an entry in the @file{ChangeLog} file.
1252 @item
1253 Collect some of these changes, and create a patch. @xref{Creating
1254 patches}, for details.
1256 @item
1257 Mail the patch to Alexandre Julliard, @email{julliard@@lrc.epfl.ch}.
1259 @item
1260 Wait for the patch to appear in the official distribution.
1261 @end enumerate
1264 @node Implementing an API function, API function and type naming, Implementing an API type, The Wine Project
1265 @section Implementing an API function
1267 Here is a checklist that should help you writing your first API
1268 function. It will of course not tell you what to do in the function,
1269 but it should help you along the way of integrating this function into
1270 Wine.
1272 @enumerate
1273 @item
1274 Make sure all data types that appear in function arguments are properly
1275 declared in Wine. Otherwise, start with the data types.
1277 @item
1278 Find out how the function should be named in Wine and in the DLL's.
1279 @xref{API function and type naming}, for details.
1281 @item
1282 Find out where the function should go:
1283 @enumerate
1284 @item
1285 Which header file for the prototype.
1286 @item
1287 Which C source file.
1288 @item
1289 Which DLL(s), and which ordinal the function will take there. Perhaps
1290 the function name is already present in one of the @file{.spec}-files in
1291 the @file{if1632} directory.
1292 @end enumerate
1294 @item
1295 Prepare for the later patch (by saving the original files before you
1296 work on them). @xref{Creating patches}, for details.
1298 @item
1299 Put the prototype into the header file, and the code into the C file.
1301 @item
1302 Make sure the code compiles.
1304 @item
1305 Create or change the information for the DLL entry points in the
1306 @file{.spec}-file in the @file{if1632} directory.
1307 @xref{The build program}, for details of the DLL spec files.
1309 @item
1310 Build Wine and test the function, if possible. If you cannot test the
1311 function in Wine, write a small test program to test it on its own.
1313 @item
1314 Write the documentation of the function in the @file{wine.texinfo}
1315 file. @xref{Adding Documentation}, for details.
1317 @item
1318 Create an entry in the @file{ChangeLog} file.
1320 @item
1321 Collect some of these changes, and create a patch. @xref{Creating
1322 patches}, for details.
1324 @item
1325 Mail the patch to Alexandre Julliard, @email{julliard@@lrc.epfl.ch}.
1327 @item
1328 Wait for the patch to appear in the official distribution.
1329 @end enumerate
1332 @node API function and type naming, Creating patches, Implementing an API function, The Wine Project
1333 @section API function and data type naming conventions
1334 @cindex API function names
1335 @cindex API type names
1336 @cindex names of API functions and types
1337 @cindex naming scheme for API functions and types
1338 @cindex suffixes for API functions and types
1339 @cindex endings of API function and type names
1341 This section describes Wine's naming scheme for API functions and data
1342 types.
1344 The purpose of these naming conventions is to ensure that
1345 @itemize @bullet
1346 @item
1347 both the @WIN16{} and @WIN32{} API are supported within the same source
1348 code,
1349 @item
1350 both wide character functions (with @unicode{} strings) and 8 bit
1351 character functions (with @ascii{} or extended @ascii{} encoding) are
1352 supported, and
1353 @item
1354 the source code can be shared between the emulator and the library
1355 version of Wine.
1356 @end itemize
1358 A function or data type whose name in the @mswindows{} API is @var{xxx}
1359 will in the Wine code have the following name(s):
1360 @table @code
1361 @item @var{xxx}16
1362 This is the version for the 16 bit API. You might call it the ``16 bit
1363 version'' except that the function itself of course runs in true 32 bit
1364 mode (being part of Wine). So, the correct meaning of the suffix is that
1365 this function is part of the 16 bit API.
1366 @item @var{xxx}32
1367 This is the version for the 32 bit API. Use this suffix only if the
1368 function does not use character strings in its parameters or return
1369 values. Otherwise use the next two.
1370 @item @var{xxx}32A
1371 This is the version for the 32 bit API which uses @ascii{} strings (or
1372 rather, strings with 8 bit character encodings, i.e. the standard C
1373 @code{char} type). This version always goes together with another
1374 version, using the next suffix.
1375 @item @var{xxx}32W
1376 This is the version for the 32 bit API which uses @unicode{} strings,
1377 i.e. strings with wide characters. It goes together with the @ascii{}
1378 version.
1379 @end table
1381 So, where the @mswindows{} API offers one name, Wine actually has two or
1382 three different functions implemented (which will hopefully share a
1383 large part of the code).
1385 Wine allows to use its API functions in two ways. The emulator part of
1386 Wine provides DLL's for the @mswindows{} programs it can run. The
1387 library part of Wine provides a @unix{} programmer with the facility to
1388 use the Wine API's in a standard @unix{} program.
1390 @menu
1391 * Access from the emulator::    How to access API functions and types
1392                                 from applications that are run in the
1393                                 Wine emulator.
1394 * Access in the library::       How to access API functions and types
1395                                 from applications that are linked with
1396                                 the Wine library.
1397 * Access from inside Wine::     How to access API functions and types
1398                                 from inside the Wine code.
1399 @end menu
1401 @node Access from the emulator, Access in the library, , API function and type naming
1402 @subsection Accessing API functions and types from the emulator
1403 @cindex access to DLL API functions and types
1404 @cindex Wine emulator access to API functions and types
1405 @cindex emulator access to Wine API functions and types
1407 The emulator part of Wine provides the hooks for dynamically linking the
1408 API functions to the @mswindows{} executables (@file{.EXE}-files). The
1409 Wine emulator contains all versions (16 or 32 bit, @ascii{} or
1410 @unicode{}) of the API functions in one executable. The emulator
1411 performs a mapping from the @mswindows{} name of the function,
1412 by which the executable calls it, to one of the Wine internal names that
1413 have been used in coding it.
1415 This mapping is done by the built-in DLL handling code of Wine. A
1416 programmer of Wine has to declare the function in one of the virtual
1417 DLL's that are provided by Wine. The declarations are done in the
1418 @file{.spec}-files in the @file{if1632/} directory. @xref{The build
1419 program}, for details.
1421 The @mswindows{} application simply calls the API function by its
1422 standard @mswindows{} name. Wine will apply the correct mapping
1423 according to Wine's selected appearance (as a 16 bit or 32 bit emulator,
1424 which is a parameter on invocation of Wine).
1427 @node Access in the library, Access from inside Wine, Access from the emulator, API function and type naming
1428 @subsection Accessing API functions and types in the library
1429 @cindex Wine library API function and type access
1430 @cindex access to Wine library API functions and types
1432 If Wine is built as a library, and linked to a user-level main program,
1433 the user will also use the standard @mswindows{} names for the API
1434 functions.
1436 Some macros are defined in @file{include/wintypes.h} which perform the
1437 necessary name mappings. 
1439 These macros are (see the examples below):
1440 @deffn_winemacro WINELIB_NAME (@var{xxx})
1441 This macro replaces @var{xxx} by one of @var{xxx}16 or
1442 @var{xxx}32, depending on the definition of the symbols
1443 @code{WINELIB16} and @code{WINELIB32}. @var{xxx} should
1444 be the name of an API function that uses no string arguments.
1445 Use this macro with a @code{#define} to establish the API name @var{xxx}.
1446 @end deffn
1447 @deffn_winemacro WINELIB_NAME_AW (@var{xxx})
1448 This macro replaces @var{xxx} by one of @var{xxx}16, @var{xxx}32A, or
1449 @var{xxx}32W, depending on the definition of the symbols
1450 @code{WINELIB16}, @code{WINELIB32}, and @code{UNICODE}. @var{xxx} should
1451 be the name of an API function that uses string arguments.
1452 Use this macro with a @code{#define} to establish the API name @var{xxx}.
1453 @end deffn
1454 @deffn_winemacro DECL_WINELIB_TYPE (@var{xxx})
1455 This macro declares @var{xxx} to be an equivalent to @var{xxx}16 or
1456 @var{xxx}32, depending on the definition of the symbols
1457 @code{WINELIB16} and @code{WINELIB32}. @var{xxx} should
1458 be the name of an API data type that contains no string arguments.
1459 @end deffn
1460 @deffn_winemacro DECL_WINELIB_TYPE_AW (@var{xxx})
1461 This macro declares the type @var{xxx} to be an equivalent to
1462 @var{xxx}16, @var{xxx}32A, or @var{xxx}32W, depending on the definition
1463 of the symbols @code{WINELIB16}, @code{WINELIB32}, and
1464 @code{UNICODE}. @var{xxx} should be the name of an API data type that
1465 contains string arguments. 
1466 @end deffn
1468 If Wine is compiled as an emulator, these macros have no effect, for the
1469 mapping is then done by the DLL code. This means that within Wine the
1470 name @var{xxx} itself will not be defined.
1472 Note: If the definition of @var{xxx} is exactly the same in @WIN16{} and
1473 @WIN32{}, you can simply use the same name as @mswindows{}.
1475 Here are some examples:
1476 @example
1477 /* A simple type without strings */
1478 typedef short INT16;
1479 typedef int INT32;
1480 DECL_WINELIB_TYPE(INT);
1482 /* A type with strings */
1483 typedef struct @{ /* Win32 ASCII data structure */ @} WNDCLASS32A;
1484 typedef struct @{ /* Win32 Unicode data structure */ @} WNDCLASS32W;
1485 typedef struct @{ /* Win16 data structure */ @} WNDCLASS16;
1486 DECL_WINELIB_TYPE_AW(WNDCLASS);
1488 /* A function with strings */
1489 ATOM RegisterClass16( WNDCLASS16 * );
1490 ATOM RegisterClass32A( WNDCLASS32A * );
1491 ATOM RegisterClass32W( WNDCLASS32W * );
1492 #define RegisterClass WINELIB_NAME_AW(RegisterClass)
1493 @end example
1495 The Winelib user can then say (in the application program):
1496 @example
1497     INT i;
1498     WNDCLASS wc = @{ @dots{} @};
1499     RegisterClass( &wc );
1500 @end example
1501 and this will use the correct declaration depending on the definitions
1502 @code{WINELIB16}, @code{WINELIB32}, and @code{UNICODE}.
1504 Here are the primary defines that are used when Wine is compiled as a
1505 library:
1506 @defvr_cwine WINELIB16
1507 If this @code{#define} is set, the Wine library is to be compiled in its
1508 16 bit form. That means, the 16 bit variants of all functions will be
1509 used and the appearance of the application linked with the Wine library
1510 will be that of a 16 bit application. Of course, both the application
1511 and the Wine library function really run in 32 bit mode. The switch only
1512 selects the function with the name ending in @code{@dots{}16}, which
1513 will perhaps have a behaviour different from its 32 bit counterpart.
1514 @end defvr
1515 @defvr_cwine WINELIB32
1516 If this @code{#define} is set, the Wine library is to be compiled in its
1517 32 bit form. That means, the 32 bit variants of all functions will be
1518 used and the appearance of the application linked with the Wine library
1519 will be that of a 32 bit application.
1520 @end defvr
1521 @defvr_cwine UNICODE
1522 This @code{define} is used to select one of two possible 32 bit
1523 variants. Functions and data types of the 32 bit API come in two
1524 flavours: one handling @ascii{} strings (or rather strings with
1525 characters encoded in 8 bit), the other @unicode{} strings. This define
1526 selects the correct variant. As a user of the Wine library, you are
1527 responsible to use the correct character type in your part of the
1528 application which accesses the Wine API functions and data types.
1529 @end defvr
1531 These switches are automatically set when Wine is compiled as a library.
1534 @node Access from inside Wine, , Access in the library, API function and type naming
1535 @subsection Accessing API functions from within Wine
1536 @cindex explicit names of API functions and types
1538 Within Wine and during the compilation of Wine, you cannot rely on the
1539 @mswindows{} names of the API functions and data types. If Wine is
1540 compiled as a library, they will be defined; if Wine is compiled as an
1541 emulator, they won't.
1543 You therefore have to access all functions and data types by their full
1544 names, with the proper suffix explicitely appended. In Wine, the 16 bit
1545 and 32 bit versions of the functions are distinct entities, which might
1546 (theoretically) show a completely different behaviour. They may even
1547 call each other (and they will quite frequently).
1549 Therefore Wine is a conglomerate that contains all two or
1550 three flavours of each function at once, and exports to the
1551 application whichever of these is appropriate. Remember that inside
1552 Wine, there is no memory segmentation, so all functions are 32 bit.
1553 The 16-to-32 bit mapping is done on exporting the DLL functions.
1556 @node Creating patches, Adding Documentation, API function and type naming, The Wine Project
1557 @section Creating patches
1558 @xref{Applying patches}, for instructions on applying patches.
1560 FIXME: how to create patches
1562 @node Adding Documentation, File names, Creating patches, The Wine Project
1563 @section Adding Documentation
1565 @ifinfo
1566 Here are some templates which should help you collaborate on this
1567 documentation. Read the text below before examining them.
1568 @end ifinfo
1570 @menu
1571 * Type Template::               How to document data types in Wine's
1572                                 include files.
1573 * Function Template::           How to document an (API) function of
1574                                 Wine. 
1575 @end menu
1578 These are my tips for adding documentation.
1580 Do not simply copy documentation from @mswindows{} related
1581 material. Except from risking copyright violations, which you would not
1582 want to do, there is another aspect to that:
1583 As Wine is a product to run on @unix{} and @unix{}-like workstations,
1584 it seems a good idea to me to organize this documentation primarily for
1585 the well-trained @unix{} reader. Please keep that in mind when you add
1586 some documentation.
1588 Finally, read the info pages for @code{texinfo}.
1590 The rest of this section provides some templates which can serve as a
1591 start in writing documentation.
1593 @subsection Template introduction
1594 @iftex
1595 On the following pages you will find some @code{texinfo} templates, which
1596 should help you collaborate on this documentation.
1597 @end iftex
1599 These templates give hints on how to document data types, functions,
1600 variables, constants etc. in Wine.
1601 As documentation evolves, you will find common features of data types
1602 that should be described in a unified fashion. In such a case, please
1603 add a corresponding style guide-line here, in this very place, to help
1604 keeping documentation of data types unified.
1607 Start out the type or function with a new node. Write a comment before
1608 the node, listing all data types (and functions) described in the node,
1609 like this:
1610 @example
1612 @@c *** struct FILETIME ***
1614 @@node Type FILETIME, NextNodeName, PreviousNodeName, ParentNodeName
1615 @end example
1617 The node command describes the node name and the names of the next node,
1618 the previous node, and the parent node. The parent node should contain
1619 a menu entry for this node. The previous node is the node that appears
1620 before this node in the parent node menu. The next node is the node
1621 succeeding this one in the parent node menu. If there is no previous or
1622 next node, omit the name (putting just a single space between the two
1623 commata).
1625 The node name must be a unique sequence of words. Case is important, so
1626 @emph{Type} and @emph{type} are distinct. The node name must not contain
1627 special characters like @samp{@@, @{, @}} or the comma. If you need to
1628 give a node the same name as a function, data type, etc., use the words
1629 @samp{Type}, @samp{Function}, etc. before the identifier.
1631 Always put the names of the node and its links on the same line, even if
1632 it gets rather long.
1634 If there are two or more data types or functions described in the node,
1635 adapt the comment like this:
1636 @example
1638 @@c *** int  X   ***
1639 @@c *** long Y() ***
1641 @@node Ints and Longs, NextNodeName, PreviousNodeName, ParentNodeName
1642 @end example
1644 After the node name, put a sectioning command, such as @samp{@@chapter},
1645 @samp{@@section}, @samp{@@subsection}, or @samp{@@subsubsection}.
1646 Without that command, cross references to the node will fail.
1647 @example
1648 @@subsubsection Type FILETIME
1649 @end example
1651 Start the description of the type(s) or function(s) with a single
1652 non-indented paragraph that gives a one-line description of the type(s)
1653 or function(s) and states the include files that are required.
1654 @example
1655 @@noindent
1656 File times in Wine are specified by the data type @@code@{FILETIME@},
1657 defined in @@file@{windows.h@}.
1658 @end example
1659 If several types or functions are closely connected, use one paragraph
1660 as a common description. If more paragraphs are required for a proper
1661 description, indent all but the first of them.
1663 Then start the definition of the data type or function. Use the proper
1664 macro, which you will find defined in the beginning of the texinfo file.
1665 If appropriate, add your own macros.
1666 Again, put everything that belongs to the header into a single line.
1667 Use continuation lines for additional headers.
1668 @example
1669 @@deftp_w32  FILETIME
1670 @@deftpx_w32 LPFILETIME
1671 @end example
1673 In the definition, give a verbal explanation of the data type or
1674 function. The explanation should be rather complete, exact, and
1675 comprehensible, than well-structured. This is the point where you can
1676 tell everything you want. Do not be afraid of wasting space.
1677 Do not describe the @mswindows{} situation but only say what Wine
1678 does. That is important. (Sometimes they might even do the same.)
1679 @example
1680 This is the data type for specifying file times. The file times are
1681 stored with 64 bit precision. The actual data type is a structure with
1682 two 32 bit values which are interpreted as the low and high parts of a
1683 64-bit value. This value gives a time measured in a granularity of 100
1684 nanoseconds, so 1.5 seconds are specified by a value of 15,000,000.  In
1685 Wine, this 64-bit value is signed, with the sign taken from the high
1686 part. The lower part is used as unsigned.
1687 @end example
1689 For data types, it is recommended to quote the definition from the
1690 header file. For a function, you might give a short example of its
1691 usage. You may also put one example in the end of a node that explains
1692 several of the functions in the node. Remember that cut-and-paste from a
1693 well prepared example will help the readers write their code.
1694 @example
1695 The definition of @@code@{FILETIME@} reads:
1696 @@example
1697 typedef struct
1698 @@@{
1699     INT32 dwLowDateTime;
1700     INT32 dwHighDateTime;
1701 @@@} FILETIME, *LPFILETIME;
1702 @@end example
1703 @end example
1705 You could also use the @code{cindex} command which creates an entry in
1706 the concept index. The @code{texinfo} manual recommends to keep concept
1707 entries distinct, so that a single concept index entry puts to one
1708 well-defined place in the document. Use lower case letters for index
1709 entries, unless they are proper names or quotes from actual code.
1710 @example
1711 @@cindex epoch in file time
1712 The @@code@{FILETIME@} structure may be used to hold absolute or relative
1713 times. Absolute times are given as the number of 100 nanoseconds
1714 intervals elapsed since 1 January 1601, 00:00:00 UTC (Coordinated
1715 Universal Time, which is GMT, Greenwich Mean Time). This might be
1716 called the @@dfn@{epoch@} for file times. With a signed 64-bit value, this
1717 representation covers absolute times of 29247 years around the epoch.
1718 @end example
1720 After the verbal documentation, you can add some special fields
1721 describing bugs, implementation dependencies etc. Two of these are
1722 recommended to attach to all descriptions. One describes the
1723 conformance of the data type or function to @mswindows{} products,
1724 i.e. whether the item is also present in @WINNT{} and @WIN95{}. The
1725 other one describes known differences of the Wine item to its
1726 @mswindows{} counterpart. Both will greatly help in porting software
1727 from @mswindows{} to Wine and vice versa.
1728 @example
1729 @@winconfall@{@}
1731 @@windiff@{@}
1732 In @@mswindows@{@}, the elements of the structure are apparently of type
1733 @@code@{DWORD@}. Whether the full 64 bit value is interpreted as signed or
1734 unsigned I do not know.
1735 @end example
1737 If you find that more of these property attributes are necessary, feel
1738 free to create your own ones. But keep in mind that they should be
1739 applicable more or less to all described items. Very special properties
1740 will better be put into the verbal text.
1742 Finally end the definition of the data type or function:
1743 @example
1744 @@end deftp
1745 @end example
1747 Do not forget to enter the node in the menu of its top node, and do
1748 properly link the node to its successor and predecessor.
1755 @node Type Template, Function Template, , Adding Documentation
1756 @subsection Data type template
1758 Category: Data type
1760 @node Function Template, , Type Template, Adding Documentation
1761 @subsection API function template
1763 Functions should be given category names, to indicate which API they
1764 belong to. Please add items to the list of categories possible.
1766 Category: WIN32 function
1768 @example
1770 @@c ***GetFileTime() ***
1772 @@node Get File Times, , Compare File Times, File Times
1773 @@noindent
1774 The Wine function @@code@{GetFileTime@} returns the creation time and
1775 the times of last the read and modification access to a file. It is
1776 defined in @@file@{windows.h@}.
1778 @@deftypefn_w32 BOOL GetFileTime (@@w@{HANDLE @@var@{file@},@} @@w@{LPFILETIME @@var@{ctime@},@} @@w@{LPFILETIME @@var@{atime@},@} @@w@{LPFILETIME @@var@{mtime@})@}
1779 This function obtains for the specified @@var@{file@} the creation time
1780 @@var@{ctime@}, the time of the last access to the file @@var@{atime@}, and
1781 the time of the last modification (write) to the file, @@var@{mtime@}.
1782 The @@var@{file@} handle must have been obtained by opening the file with
1783 @@code@{GENERIC_READ@} access. The file time arguments of this function are
1784 pointers to @@code@{FILETIME@} variables, which are filled with a value that
1785 indicates an absolute time in UTC. To convert these values to local
1786 times, use the function @@code@{FileTimeToLocalFileTime@}. If you do not
1787 need some of the times, you can pass a @@code@{NULL@} pointer.
1788 The function returns @@code@{TRUE@} on success, @@code@{FALSE@} on failure.
1790 @@winconfall@{@}
1792 @@windiffnone@{@}
1793 @@end deftypefn
1794 @end example
1797 @node File names, Wide character strings, Adding Documentation, The Wine Project
1798 @section @mswindows{} and @unix{} file names in Wine
1799 @cindex file names in Wine
1800 @cindex Windows file names
1801 @cindex DOS file names in Wine
1802 @cindex UNIX file names in Wine
1803 @cindex POSIX file names in Wine
1805 FIXME:
1807 @node Wide character strings, , File names, The Wine Project
1808 @section Wide character strings in API functions
1809 @cindex unicode strings in API functions
1810 @cindex wide character strings in API functions
1811 @cindex strings in API functions
1812 @cindex ascii strings in API functions
1813 @cindex 16 bit characters in API functions
1814 @cindex wchar_t in API functions
1816 Presently, all wide character strings in API functions of Wine are
1817 internally converted to 8 bit representation. Thus, the @WIN32{} API
1818 with @unicode{} strings is not fully functional for the application
1819 programmer at present.
1821 Even so, application programmers might consider developing their
1822 applications in wide character format with Wine, as future versions
1823 might bring a change. This might come when a @unix{} filesystem can
1824 handle @unicode{} file names.
1826 Furthermore, the @unicode{} API is required to let Wine run @mswindows{}
1827 applications which have been compiled for wide character strings.
1829 In Wine, wide characters are strictly 16 bit; the @code{wchar_t} type of
1830 standard C can therefore not be used.
1832 @node Concept Index, , , Top
1833 @comment  node-name,  next,  previous,  up
1834 @unnumbered Concept Index
1835 @printindex cp
1837 @node Type Index, , , Top
1838 @comment  node-name,  next,  previous,  up
1839 @unnumbered Type Index
1840 @printindex tp
1842 @node Function Index, , , Top
1843 @comment  node-name,  next,  previous,  up
1844 @unnumbered Function Index
1845 @printindex fn
1847 @node Variable Index, , , Top
1848 @comment  node-name,  next,  previous,  up
1849 @unnumbered Variable, Constants, and Variable-like Macros Index
1850 @printindex vr
1852 @node File Index, , , Top
1853 @comment  node-name,  next,  previous,  up
1854 @unnumbered File and Program Index
1855 @printindex pg
1858 @contents
1859 @bye