Better handling of custom templates and hooks.
[wine] / include / winbase.h
1 #ifndef __WINE_WINBASE_H
2 #define __WINE_WINBASE_H
3
4 #include "basetsd.h"
5 #include "winnt.h"
6 #include "pshpack1.h"
7
8 #ifndef RC_INVOKED
9 #include <stdarg.h>
10 #endif
11
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15
16   /* Windows Exit Procedure flag values */
17 #define WEP_FREE_DLL        0
18 #define WEP_SYSTEM_EXIT     1
19
20 typedef DWORD CALLBACK (*LPTHREAD_START_ROUTINE)(LPVOID);
21
22 typedef VOID (WINAPI *PFIBER_START_ROUTINE)( LPVOID lpFiberParameter );
23 typedef PFIBER_START_ROUTINE LPFIBER_START_ROUTINE;
24
25 typedef RTL_CRITICAL_SECTION CRITICAL_SECTION;
26 typedef PRTL_CRITICAL_SECTION PCRITICAL_SECTION;
27 typedef PRTL_CRITICAL_SECTION LPCRITICAL_SECTION;
28
29 typedef RTL_CRITICAL_SECTION_DEBUG CRITICAL_SECTION_DEBUG;
30 typedef PRTL_CRITICAL_SECTION_DEBUG PCRITICAL_SECTION_DEBUG;
31 typedef PRTL_CRITICAL_SECTION_DEBUG LPCRITICAL_SECTION_DEBUG;
32
33
34 #define EXCEPTION_DEBUG_EVENT       1
35 #define CREATE_THREAD_DEBUG_EVENT   2
36 #define CREATE_PROCESS_DEBUG_EVENT  3
37 #define EXIT_THREAD_DEBUG_EVENT     4
38 #define EXIT_PROCESS_DEBUG_EVENT    5
39 #define LOAD_DLL_DEBUG_EVENT        6
40 #define UNLOAD_DLL_DEBUG_EVENT      7
41 #define OUTPUT_DEBUG_STRING_EVENT   8
42 #define RIP_EVENT                   9
43
44 typedef struct _EXCEPTION_DEBUG_INFO {
45     EXCEPTION_RECORD ExceptionRecord;
46     DWORD dwFirstChance;
47 } EXCEPTION_DEBUG_INFO;
48
49 typedef struct _CREATE_THREAD_DEBUG_INFO {
50     HANDLE hThread;
51     LPVOID lpThreadLocalBase;
52     LPTHREAD_START_ROUTINE lpStartAddress;
53 } CREATE_THREAD_DEBUG_INFO;
54
55 typedef struct _CREATE_PROCESS_DEBUG_INFO {
56     HANDLE hFile;
57     HANDLE hProcess;
58     HANDLE hThread;
59     LPVOID lpBaseOfImage;
60     DWORD dwDebugInfoFileOffset;
61     DWORD nDebugInfoSize;
62     LPVOID lpThreadLocalBase;
63     LPTHREAD_START_ROUTINE lpStartAddress;
64     LPVOID lpImageName;
65     WORD fUnicode;
66 } CREATE_PROCESS_DEBUG_INFO;
67
68 typedef struct _EXIT_THREAD_DEBUG_INFO {
69     DWORD dwExitCode;
70 } EXIT_THREAD_DEBUG_INFO;
71
72 typedef struct _EXIT_PROCESS_DEBUG_INFO {
73     DWORD dwExitCode;
74 } EXIT_PROCESS_DEBUG_INFO;
75
76 typedef struct _LOAD_DLL_DEBUG_INFO {
77     HANDLE hFile;
78     LPVOID   lpBaseOfDll;
79     DWORD    dwDebugInfoFileOffset;
80     DWORD    nDebugInfoSize;
81     LPVOID   lpImageName;
82     WORD     fUnicode;
83 } LOAD_DLL_DEBUG_INFO;
84
85 typedef struct _UNLOAD_DLL_DEBUG_INFO {
86     LPVOID lpBaseOfDll;
87 } UNLOAD_DLL_DEBUG_INFO;
88
89 typedef struct _OUTPUT_DEBUG_STRING_INFO {
90     LPSTR lpDebugStringData;
91     WORD  fUnicode;
92     WORD  nDebugStringLength;
93 } OUTPUT_DEBUG_STRING_INFO;
94
95 typedef struct _RIP_INFO {
96     DWORD dwError;
97     DWORD dwType;
98 } RIP_INFO;
99
100 typedef struct _DEBUG_EVENT {
101     DWORD dwDebugEventCode;
102     DWORD dwProcessId;
103     DWORD dwThreadId;
104     union {
105         EXCEPTION_DEBUG_INFO      Exception;
106         CREATE_THREAD_DEBUG_INFO  CreateThread;
107         CREATE_PROCESS_DEBUG_INFO CreateProcessInfo;
108         EXIT_THREAD_DEBUG_INFO    ExitThread;
109         EXIT_PROCESS_DEBUG_INFO   ExitProcess;
110         LOAD_DLL_DEBUG_INFO       LoadDll;
111         UNLOAD_DLL_DEBUG_INFO     UnloadDll;
112         OUTPUT_DEBUG_STRING_INFO  DebugString;
113         RIP_INFO                  RipInfo;
114     } u;
115 } DEBUG_EVENT, *LPDEBUG_EVENT;
116
117 #define OFS_MAXPATHNAME 128
118 typedef struct
119 {
120     BYTE cBytes;
121     BYTE fFixedDisk;
122     WORD nErrCode;
123     BYTE reserved[4];
124     BYTE szPathName[OFS_MAXPATHNAME];
125 } OFSTRUCT, *LPOFSTRUCT;
126
127 #define OF_READ               0x0000
128 #define OF_WRITE              0x0001
129 #define OF_READWRITE          0x0002
130 #define OF_SHARE_COMPAT       0x0000
131 #define OF_SHARE_EXCLUSIVE    0x0010
132 #define OF_SHARE_DENY_WRITE   0x0020
133 #define OF_SHARE_DENY_READ    0x0030
134 #define OF_SHARE_DENY_NONE    0x0040
135 #define OF_PARSE              0x0100
136 #define OF_DELETE             0x0200
137 #define OF_VERIFY             0x0400   /* Used with OF_REOPEN */
138 #define OF_SEARCH             0x0400   /* Used without OF_REOPEN */
139 #define OF_CANCEL             0x0800
140 #define OF_CREATE             0x1000
141 #define OF_PROMPT             0x2000
142 #define OF_EXIST              0x4000
143 #define OF_REOPEN             0x8000
144
145 /* SetErrorMode values */
146 #define SEM_FAILCRITICALERRORS      0x0001
147 #define SEM_NOGPFAULTERRORBOX       0x0002
148 #define SEM_NOALIGNMENTFAULTEXCEPT  0x0004
149 #define SEM_NOOPENFILEERRORBOX      0x8000
150
151 /* CopyFileEx flags */
152 #define COPY_FILE_FAIL_IF_EXISTS        0x00000001
153 #define COPY_FILE_RESTARTABLE           0x00000002
154 #define COPY_FILE_OPEN_SOURCE_FOR_WRITE 0x00000004
155
156 /* GetTempFileName() Flags */
157 #define TF_FORCEDRIVE           0x80
158
159 #define DRIVE_CANNOTDETERMINE      0
160 #define DRIVE_DOESNOTEXIST         1
161 #define DRIVE_REMOVABLE            2
162 #define DRIVE_FIXED                3
163 #define DRIVE_REMOTE               4
164 /* Win32 additions */
165 #define DRIVE_CDROM                5
166 #define DRIVE_RAMDISK              6
167
168 /* The security attributes structure */
169 typedef struct _SECURITY_ATTRIBUTES
170 {
171     DWORD   nLength;
172     LPVOID  lpSecurityDescriptor;
173     BOOL  bInheritHandle;
174 } SECURITY_ATTRIBUTES, *PSECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES;
175
176 #ifndef _FILETIME_
177 #define _FILETIME_
178 /* 64 bit number of 100 nanoseconds intervals since January 1, 1601 */
179 typedef struct
180 {
181   DWORD  dwLowDateTime;
182   DWORD  dwHighDateTime;
183 } FILETIME, *LPFILETIME;
184 #endif /* _FILETIME_ */
185
186 /* Find* structures */
187 typedef struct
188 {
189     DWORD     dwFileAttributes;
190     FILETIME  ftCreationTime;
191     FILETIME  ftLastAccessTime;
192     FILETIME  ftLastWriteTime;
193     DWORD     nFileSizeHigh;
194     DWORD     nFileSizeLow;
195     DWORD     dwReserved0;
196     DWORD     dwReserved1;
197     CHAR      cFileName[260];
198     CHAR      cAlternateFileName[14];
199 } WIN32_FIND_DATAA, *LPWIN32_FIND_DATAA;
200
201 typedef struct
202 {
203     DWORD     dwFileAttributes;
204     FILETIME  ftCreationTime;
205     FILETIME  ftLastAccessTime;
206     FILETIME  ftLastWriteTime;
207     DWORD     nFileSizeHigh;
208     DWORD     nFileSizeLow;
209     DWORD     dwReserved0;
210     DWORD     dwReserved1;
211     WCHAR     cFileName[260];
212     WCHAR     cAlternateFileName[14];
213 } WIN32_FIND_DATAW, *LPWIN32_FIND_DATAW;
214
215 DECL_WINELIB_TYPE_AW(WIN32_FIND_DATA)
216 DECL_WINELIB_TYPE_AW(LPWIN32_FIND_DATA)
217
218 typedef enum _FINDEX_INFO_LEVELS
219 {
220         FindExInfoStandard,
221         FindExInfoMaxInfoLevel
222 } FINDEX_INFO_LEVELS;
223
224 typedef enum _FINDEX_SEARCH_OPS
225 {
226         FindExSearchNameMatch,
227         FindExSearchLimitToDirectories,
228         FindExSearchLimitToDevices,
229         FindExSearchMaxSearchOp
230 } FINDEX_SEARCH_OPS;
231
232 typedef struct
233 {
234     LPVOID lpData;
235     DWORD cbData;
236     BYTE cbOverhead;
237     BYTE iRegionIndex;
238     WORD wFlags;
239     union {
240         struct {
241             HANDLE hMem;
242             DWORD dwReserved[3];
243         } Block;
244         struct {
245             DWORD dwCommittedSize;
246             DWORD dwUnCommittedSize;
247             LPVOID lpFirstBlock;
248             LPVOID lpLastBlock;
249         } Region;
250     } Foo;
251 } PROCESS_HEAP_ENTRY, *LPPROCESS_HEAP_ENTRY;
252
253 #define PROCESS_HEAP_REGION                   0x0001
254 #define PROCESS_HEAP_UNCOMMITTED_RANGE        0x0002
255 #define PROCESS_HEAP_ENTRY_BUSY               0x0004
256 #define PROCESS_HEAP_ENTRY_MOVEABLE           0x0010
257 #define PROCESS_HEAP_ENTRY_DDESHARE           0x0020
258
259 #define INVALID_HANDLE_VALUE  ((HANDLE) -1)
260
261 #define TLS_OUT_OF_INDEXES ((DWORD)0xFFFFFFFF)
262
263 #define SHUTDOWN_NORETRY 1
264
265 /* comm */
266
267 #define CBR_110 0xFF10
268 #define CBR_300 0xFF11
269 #define CBR_600 0xFF12
270 #define CBR_1200        0xFF13
271 #define CBR_2400        0xFF14
272 #define CBR_4800        0xFF15
273 #define CBR_9600        0xFF16
274 #define CBR_14400       0xFF17
275 #define CBR_19200       0xFF18
276 #define CBR_38400       0xFF1B
277 #define CBR_56000       0xFF1F
278 #define CBR_57600       0xFF20
279 #define CBR_115200      0xFF21
280 #define CBR_128000      0xFF23
281 #define CBR_256000      0xFF27
282
283 #define NOPARITY        0
284 #define ODDPARITY       1
285 #define EVENPARITY      2
286 #define MARKPARITY      3
287 #define SPACEPARITY     4
288 #define ONESTOPBIT      0
289 #define ONE5STOPBITS    1
290 #define TWOSTOPBITS     2
291
292 #define IGNORE          0
293 #define INFINITE      0xFFFFFFFF
294
295 #define CE_RXOVER       0x0001
296 #define CE_OVERRUN      0x0002
297 #define CE_RXPARITY     0x0004
298 #define CE_FRAME        0x0008
299 #define CE_BREAK        0x0010
300 #define CE_CTSTO        0x0020
301 #define CE_DSRTO        0x0040
302 #define CE_RLSDTO       0x0080
303 #define CE_TXFULL       0x0100
304 #define CE_PTO          0x0200
305 #define CE_IOE          0x0400
306 #define CE_DNS          0x0800
307 #define CE_OOP          0x1000
308 #define CE_MODE 0x8000
309
310 #define IE_BADID        -1
311 #define IE_OPEN -2
312 #define IE_NOPEN        -3
313 #define IE_MEMORY       -4
314 #define IE_DEFAULT      -5
315 #define IE_HARDWARE     -10
316 #define IE_BYTESIZE     -11
317 #define IE_BAUDRATE     -12
318
319 #define EV_RXCHAR       0x0001
320 #define EV_RXFLAG       0x0002
321 #define EV_TXEMPTY      0x0004
322 #define EV_CTS          0x0008
323 #define EV_DSR          0x0010
324 #define EV_RLSD 0x0020
325 #define EV_BREAK        0x0040
326 #define EV_ERR          0x0080
327 #define EV_RING 0x0100
328 #define EV_PERR 0x0200
329 #define EV_CTSS 0x0400
330 #define EV_DSRS 0x0800
331 #define EV_RLSDS        0x1000
332 #define EV_RINGTE       0x2000
333 #define EV_RingTe       EV_RINGTE
334
335 #define SETXOFF 1
336 #define SETXON          2
337 #define SETRTS          3
338 #define CLRRTS          4
339 #define SETDTR          5
340 #define CLRDTR          6
341 #define RESETDEV        7
342 #define SETBREAK        8
343 #define CLRBREAK        9
344
345 #define GETBASEIRQ      10
346
347 /* Purge functions for Comm Port */
348 #define PURGE_TXABORT       0x0001  /* Kill the pending/current writes to the 
349                                        comm port */
350 #define PURGE_RXABORT       0x0002  /*Kill the pending/current reads to 
351                                      the comm port */
352 #define PURGE_TXCLEAR       0x0004  /* Kill the transmit queue if there*/
353 #define PURGE_RXCLEAR       0x0008  /* Kill the typeahead buffer if there*/
354
355
356 /* Modem Status Flags */
357 #define MS_CTS_ON           ((DWORD)0x0010)
358 #define MS_DSR_ON           ((DWORD)0x0020)
359 #define MS_RING_ON          ((DWORD)0x0040)
360 #define MS_RLSD_ON          ((DWORD)0x0080)
361
362 #define RTS_CONTROL_DISABLE     0
363 #define RTS_CONTROL_ENABLE      1
364 #define RTS_CONTROL_HANDSHAKE   2
365 #define RTS_CONTROL_TOGGLE      3
366
367 #define DTR_CONTROL_DISABLE     0
368 #define DTR_CONTROL_ENABLE      1
369 #define DTR_CONTROL_HANDSHAKE   2
370
371 #define CSTF_CTSHOLD    0x01
372 #define CSTF_DSRHOLD    0x02
373 #define CSTF_RLSDHOLD   0x04
374 #define CSTF_XOFFHOLD   0x08
375 #define CSTF_XOFFSENT   0x10
376 #define CSTF_EOF        0x20
377 #define CSTF_TXIM       0x40
378
379 #define MAKEINTRESOURCEA(i) (LPSTR)((DWORD)((WORD)(i)))
380 #define MAKEINTRESOURCEW(i) (LPWSTR)((DWORD)((WORD)(i)))
381 #define MAKEINTRESOURCE WINELIB_NAME_AW(MAKEINTRESOURCE)
382
383 /* Predefined resource types */
384 #define RT_CURSORA         MAKEINTRESOURCEA(1)
385 #define RT_CURSORW         MAKEINTRESOURCEW(1)
386 #define RT_CURSOR            WINELIB_NAME_AW(RT_CURSOR)
387 #define RT_BITMAPA         MAKEINTRESOURCEA(2)
388 #define RT_BITMAPW         MAKEINTRESOURCEW(2)
389 #define RT_BITMAP            WINELIB_NAME_AW(RT_BITMAP)
390 #define RT_ICONA           MAKEINTRESOURCEA(3)
391 #define RT_ICONW           MAKEINTRESOURCEW(3)
392 #define RT_ICON              WINELIB_NAME_AW(RT_ICON)
393 #define RT_MENUA           MAKEINTRESOURCEA(4)
394 #define RT_MENUW           MAKEINTRESOURCEW(4)
395 #define RT_MENU              WINELIB_NAME_AW(RT_MENU)
396 #define RT_DIALOGA         MAKEINTRESOURCEA(5)
397 #define RT_DIALOGW         MAKEINTRESOURCEW(5)
398 #define RT_DIALOG            WINELIB_NAME_AW(RT_DIALOG)
399 #define RT_STRINGA         MAKEINTRESOURCEA(6)
400 #define RT_STRINGW         MAKEINTRESOURCEW(6)
401 #define RT_STRING            WINELIB_NAME_AW(RT_STRING)
402 #define RT_FONTDIRA        MAKEINTRESOURCEA(7)
403 #define RT_FONTDIRW        MAKEINTRESOURCEW(7)
404 #define RT_FONTDIR           WINELIB_NAME_AW(RT_FONTDIR)
405 #define RT_FONTA           MAKEINTRESOURCEA(8)
406 #define RT_FONTW           MAKEINTRESOURCEW(8)
407 #define RT_FONT              WINELIB_NAME_AW(RT_FONT)
408 #define RT_ACCELERATORA    MAKEINTRESOURCEA(9)
409 #define RT_ACCELERATORW    MAKEINTRESOURCEW(9)
410 #define RT_ACCELERATOR       WINELIB_NAME_AW(RT_ACCELERATOR)
411 #define RT_RCDATAA         MAKEINTRESOURCEA(10)
412 #define RT_RCDATAW         MAKEINTRESOURCEW(10)
413 #define RT_RCDATA            WINELIB_NAME_AW(RT_RCDATA)
414 #define RT_MESSAGELISTA    MAKEINTRESOURCEA(11)
415 #define RT_MESSAGELISTW    MAKEINTRESOURCEW(11)
416 #define RT_MESSAGELIST       WINELIB_NAME_AW(RT_MESSAGELIST)
417 #define RT_GROUP_CURSORA   MAKEINTRESOURCEA(12)
418 #define RT_GROUP_CURSORW   MAKEINTRESOURCEW(12)
419 #define RT_GROUP_CURSOR      WINELIB_NAME_AW(RT_GROUP_CURSOR)
420 #define RT_GROUP_ICONA     MAKEINTRESOURCEA(14)
421 #define RT_GROUP_ICONW     MAKEINTRESOURCEW(14)
422 #define RT_GROUP_ICON        WINELIB_NAME_AW(RT_GROUP_ICON)
423
424
425 #define LMEM_FIXED          0   
426 #define LMEM_MOVEABLE       0x0002
427 #define LMEM_NOCOMPACT      0x0010
428 #define LMEM_NODISCARD      0x0020
429 #define LMEM_ZEROINIT       0x0040
430 #define LMEM_MODIFY         0x0080
431 #define LMEM_DISCARDABLE    0x0F00
432 #define LMEM_DISCARDED      0x4000
433 #define LMEM_LOCKCOUNT      0x00FF
434
435 #define LPTR (LMEM_FIXED | LMEM_ZEROINIT)
436 #define LHND (LMEM_MOVEABLE | LMEM_ZEROINIT)
437
438 #define NONZEROLHND         (LMEM_MOVEABLE)
439 #define NONZEROLPTR         (LMEM_FIXED)
440
441 #define GMEM_FIXED          0x0000
442 #define GMEM_MOVEABLE       0x0002
443 #define GMEM_NOCOMPACT      0x0010
444 #define GMEM_NODISCARD      0x0020
445 #define GMEM_ZEROINIT       0x0040
446 #define GMEM_MODIFY         0x0080
447 #define GMEM_DISCARDABLE    0x0100
448 #define GMEM_NOT_BANKED     0x1000
449 #define GMEM_SHARE          0x2000
450 #define GMEM_DDESHARE       0x2000
451 #define GMEM_NOTIFY         0x4000
452 #define GMEM_LOWER          GMEM_NOT_BANKED
453 #define GMEM_DISCARDED      0x4000
454 #define GMEM_LOCKCOUNT      0x00ff
455 #define GMEM_INVALID_HANDLE 0x8000
456
457 #define GHND                (GMEM_MOVEABLE | GMEM_ZEROINIT)
458 #define GPTR                (GMEM_FIXED | GMEM_ZEROINIT)
459
460
461 typedef struct tagMEMORYSTATUS
462 {
463     DWORD    dwLength;
464     DWORD    dwMemoryLoad;
465     DWORD    dwTotalPhys;
466     DWORD    dwAvailPhys;
467     DWORD    dwTotalPageFile;
468     DWORD    dwAvailPageFile;
469     DWORD    dwTotalVirtual;
470     DWORD    dwAvailVirtual;
471 } MEMORYSTATUS, *LPMEMORYSTATUS;
472
473
474 #ifndef NOLOGERROR
475
476 /* LogParamError and LogError values */
477
478 /* Error modifier bits */
479 #define ERR_WARNING             0x8000
480 #define ERR_PARAM               0x4000
481
482 #define ERR_SIZE_MASK           0x3000
483 #define ERR_BYTE                0x1000
484 #define ERR_WORD                0x2000
485 #define ERR_DWORD               0x3000
486
487 /* LogParamError() values */
488
489 /* Generic parameter values */
490 #define ERR_BAD_VALUE           0x6001
491 #define ERR_BAD_FLAGS           0x6002
492 #define ERR_BAD_INDEX           0x6003
493 #define ERR_BAD_DVALUE          0x7004
494 #define ERR_BAD_DFLAGS          0x7005
495 #define ERR_BAD_DINDEX          0x7006
496 #define ERR_BAD_PTR             0x7007
497 #define ERR_BAD_FUNC_PTR        0x7008
498 #define ERR_BAD_SELECTOR        0x6009
499 #define ERR_BAD_STRING_PTR      0x700a
500 #define ERR_BAD_HANDLE          0x600b
501
502 /* KERNEL parameter errors */
503 #define ERR_BAD_HINSTANCE       0x6020
504 #define ERR_BAD_HMODULE         0x6021
505 #define ERR_BAD_GLOBAL_HANDLE   0x6022
506 #define ERR_BAD_LOCAL_HANDLE    0x6023
507 #define ERR_BAD_ATOM            0x6024
508 #define ERR_BAD_HFILE           0x6025
509
510 /* USER parameter errors */
511 #define ERR_BAD_HWND            0x6040
512 #define ERR_BAD_HMENU           0x6041
513 #define ERR_BAD_HCURSOR         0x6042
514 #define ERR_BAD_HICON           0x6043
515 #define ERR_BAD_HDWP            0x6044
516 #define ERR_BAD_CID             0x6045
517 #define ERR_BAD_HDRVR           0x6046
518
519 /* GDI parameter errors */
520 #define ERR_BAD_COORDS          0x7060
521 #define ERR_BAD_GDI_OBJECT      0x6061
522 #define ERR_BAD_HDC             0x6062
523 #define ERR_BAD_HPEN            0x6063
524 #define ERR_BAD_HFONT           0x6064
525 #define ERR_BAD_HBRUSH          0x6065
526 #define ERR_BAD_HBITMAP         0x6066
527 #define ERR_BAD_HRGN            0x6067
528 #define ERR_BAD_HPALETTE        0x6068
529 #define ERR_BAD_HMETAFILE       0x6069
530
531
532 /* LogError() values */
533
534 /* KERNEL errors */
535 #define ERR_GALLOC              0x0001
536 #define ERR_GREALLOC            0x0002
537 #define ERR_GLOCK               0x0003
538 #define ERR_LALLOC              0x0004
539 #define ERR_LREALLOC            0x0005
540 #define ERR_LLOCK               0x0006
541 #define ERR_ALLOCRES            0x0007
542 #define ERR_LOCKRES             0x0008
543 #define ERR_LOADMODULE          0x0009
544
545 /* USER errors */
546 #define ERR_CREATEDLG           0x0040
547 #define ERR_CREATEDLG2          0x0041
548 #define ERR_REGISTERCLASS       0x0042
549 #define ERR_DCBUSY              0x0043
550 #define ERR_CREATEWND           0x0044
551 #define ERR_STRUCEXTRA          0x0045
552 #define ERR_LOADSTR             0x0046
553 #define ERR_LOADMENU            0x0047
554 #define ERR_NESTEDBEGINPAINT    0x0048
555 #define ERR_BADINDEX            0x0049
556 #define ERR_CREATEMENU          0x004a
557
558 /* GDI errors */
559 #define ERR_CREATEDC            0x0080
560 #define ERR_CREATEMETA          0x0081
561 #define ERR_DELOBJSELECTED      0x0082
562 #define ERR_SELBITMAP           0x0083
563
564
565
566 /* Debugging support (DEBUG SYSTEM ONLY) */
567 typedef struct
568 {
569     WORD    flags;
570     DWORD   dwOptions WINE_PACKED;
571     DWORD   dwFilter WINE_PACKED;
572     CHAR    achAllocModule[8] WINE_PACKED;
573     DWORD   dwAllocBreak WINE_PACKED;
574     DWORD   dwAllocCount WINE_PACKED;
575 } WINDEBUGINFO, *LPWINDEBUGINFO;
576
577 /* WINDEBUGINFO flags values */
578 #define WDI_OPTIONS         0x0001
579 #define WDI_FILTER          0x0002
580 #define WDI_ALLOCBREAK      0x0004
581
582 /* dwOptions values */
583 #define DBO_CHECKHEAP       0x0001
584 #define DBO_BUFFERFILL      0x0004
585 #define DBO_DISABLEGPTRAPPING 0x0010
586 #define DBO_CHECKFREE       0x0020
587
588 #define DBO_SILENT          0x8000
589
590 #define DBO_TRACEBREAK      0x2000
591 #define DBO_WARNINGBREAK    0x1000
592 #define DBO_NOERRORBREAK    0x0800
593 #define DBO_NOFATALBREAK    0x0400
594 #define DBO_INT3BREAK       0x0100
595
596 /* DebugOutput flags values */
597 #define DBF_TRACE           0x0000
598 #define DBF_WARNING         0x4000
599 #define DBF_ERROR           0x8000
600 #define DBF_FATAL           0xc000
601
602 /* dwFilter values */
603 #define DBF_KERNEL          0x1000
604 #define DBF_KRN_MEMMAN      0x0001
605 #define DBF_KRN_LOADMODULE  0x0002
606 #define DBF_KRN_SEGMENTLOAD 0x0004
607 #define DBF_USER            0x0800
608 #define DBF_GDI             0x0400
609 #define DBF_MMSYSTEM        0x0040
610 #define DBF_PENWIN          0x0020
611 #define DBF_APPLICATION     0x0008
612 #define DBF_DRIVER          0x0010
613
614 #endif /* NOLOGERROR */
615
616 typedef struct {
617         WORD wYear;
618         WORD wMonth;
619         WORD wDayOfWeek;
620         WORD wDay;
621         WORD wHour;
622         WORD wMinute;
623         WORD wSecond;
624         WORD wMilliseconds;
625 } SYSTEMTIME, *LPSYSTEMTIME;
626
627 /* The 'overlapped' data structure used by async I/O functions.
628  */
629 typedef struct {
630         DWORD Internal;
631         DWORD InternalHigh;
632         DWORD Offset;
633         DWORD OffsetHigh;
634         HANDLE hEvent;
635 } OVERLAPPED, *LPOVERLAPPED;
636
637 typedef VOID CALLBACK (*LPOVERLAPPED_COMPLETION_ROUTINE)(DWORD dwErrorCode, DWORD dwNumberOfBytesTransfered, LPOVERLAPPED lpOverlapped);
638
639 /* Process startup information.
640  */
641
642 /* STARTUPINFO.dwFlags */
643 #define STARTF_USESHOWWINDOW    0x00000001
644 #define STARTF_USESIZE          0x00000002
645 #define STARTF_USEPOSITION      0x00000004
646 #define STARTF_USECOUNTCHARS    0x00000008
647 #define STARTF_USEFILLATTRIBUTE 0x00000010
648 #define STARTF_RUNFULLSCREEN    0x00000020
649 #define STARTF_FORCEONFEEDBACK  0x00000040
650 #define STARTF_FORCEOFFFEEDBACK 0x00000080
651 #define STARTF_USESTDHANDLES    0x00000100
652 #define STARTF_USEHOTKEY        0x00000200
653
654 typedef struct {
655         DWORD cb;               /* 00: size of struct */
656         LPSTR lpReserved;       /* 04: */
657         LPSTR lpDesktop;        /* 08: */
658         LPSTR lpTitle;          /* 0c: */
659         DWORD dwX;              /* 10: */
660         DWORD dwY;              /* 14: */
661         DWORD dwXSize;          /* 18: */
662         DWORD dwYSize;          /* 1c: */
663         DWORD dwXCountChars;    /* 20: */
664         DWORD dwYCountChars;    /* 24: */
665         DWORD dwFillAttribute;  /* 28: */
666         DWORD dwFlags;          /* 2c: */
667         WORD wShowWindow;       /* 30: */
668         WORD cbReserved2;       /* 32: */
669         BYTE *lpReserved2;      /* 34: */
670         HANDLE hStdInput;       /* 38: */
671         HANDLE hStdOutput;      /* 3c: */
672         HANDLE hStdError;       /* 40: */
673 } STARTUPINFOA, *LPSTARTUPINFOA;
674
675 typedef struct {
676         DWORD cb;
677         LPWSTR lpReserved;
678         LPWSTR lpDesktop;
679         LPWSTR lpTitle;
680         DWORD dwX;
681         DWORD dwY;
682         DWORD dwXSize;
683         DWORD dwYSize;
684         DWORD dwXCountChars;
685         DWORD dwYCountChars;
686         DWORD dwFillAttribute;
687         DWORD dwFlags;
688         WORD wShowWindow;
689         WORD cbReserved2;
690         BYTE *lpReserved2;
691         HANDLE hStdInput;
692         HANDLE hStdOutput;
693         HANDLE hStdError;
694 } STARTUPINFOW, *LPSTARTUPINFOW;
695
696 DECL_WINELIB_TYPE_AW(STARTUPINFO)
697 DECL_WINELIB_TYPE_AW(LPSTARTUPINFO)
698
699 typedef struct {
700         HANDLE  hProcess;
701         HANDLE  hThread;
702         DWORD           dwProcessId;
703         DWORD           dwThreadId;
704 } PROCESS_INFORMATION,*LPPROCESS_INFORMATION;
705
706 typedef struct {
707         LONG Bias;
708         WCHAR StandardName[32];
709         SYSTEMTIME StandardDate;
710         LONG StandardBias;
711         WCHAR DaylightName[32];
712         SYSTEMTIME DaylightDate;
713         LONG DaylightBias;
714 } TIME_ZONE_INFORMATION, *LPTIME_ZONE_INFORMATION;
715
716 #define TIME_ZONE_ID_INVALID    ((DWORD)0xFFFFFFFF)
717 #define TIME_ZONE_ID_UNKNOWN    0
718 #define TIME_ZONE_ID_STANDARD   1
719 #define TIME_ZONE_ID_DAYLIGHT   2
720
721 /* CreateProcess: dwCreationFlag values
722  */
723 #define DEBUG_PROCESS               0x00000001
724 #define DEBUG_ONLY_THIS_PROCESS     0x00000002
725 #define CREATE_SUSPENDED            0x00000004
726 #define DETACHED_PROCESS            0x00000008
727 #define CREATE_NEW_CONSOLE          0x00000010
728 #define NORMAL_PRIORITY_CLASS       0x00000020
729 #define IDLE_PRIORITY_CLASS         0x00000040
730 #define HIGH_PRIORITY_CLASS         0x00000080
731 #define REALTIME_PRIORITY_CLASS     0x00000100
732 #define CREATE_NEW_PROCESS_GROUP    0x00000200
733 #define CREATE_UNICODE_ENVIRONMENT  0x00000400
734 #define CREATE_SEPARATE_WOW_VDM     0x00000800
735 #define CREATE_SHARED_WOW_VDM       0x00001000
736 #define CREATE_DEFAULT_ERROR_MODE   0x04000000
737 #define CREATE_NO_WINDOW            0x08000000
738 #define PROFILE_USER                0x10000000
739 #define PROFILE_KERNEL              0x20000000
740 #define PROFILE_SERVER              0x40000000
741
742
743 /* File object type definitions
744  */
745 #define FILE_TYPE_UNKNOWN       0
746 #define FILE_TYPE_DISK          1
747 #define FILE_TYPE_CHAR          2
748 #define FILE_TYPE_PIPE          3
749 #define FILE_TYPE_REMOTE        32768
750
751 /* File creation flags
752  */
753 #define FILE_FLAG_WRITE_THROUGH    0x80000000UL
754 #define FILE_FLAG_OVERLAPPED       0x40000000L
755 #define FILE_FLAG_NO_BUFFERING     0x20000000L
756 #define FILE_FLAG_RANDOM_ACCESS    0x10000000L
757 #define FILE_FLAG_SEQUENTIAL_SCAN  0x08000000L
758 #define FILE_FLAG_DELETE_ON_CLOSE  0x04000000L
759 #define FILE_FLAG_BACKUP_SEMANTICS 0x02000000L
760 #define FILE_FLAG_POSIX_SEMANTICS  0x01000000L
761 #define CREATE_NEW              1
762 #define CREATE_ALWAYS           2
763 #define OPEN_EXISTING           3
764 #define OPEN_ALWAYS             4
765 #define TRUNCATE_EXISTING       5
766
767 /* Standard handle identifiers
768  */
769 #define STD_INPUT_HANDLE        ((DWORD) -10)
770 #define STD_OUTPUT_HANDLE       ((DWORD) -11)
771 #define STD_ERROR_HANDLE        ((DWORD) -12)
772
773 typedef struct
774 {
775   int dwFileAttributes;
776   FILETIME ftCreationTime;
777   FILETIME ftLastAccessTime;
778   FILETIME ftLastWriteTime;
779   int dwVolumeSerialNumber;
780   int nFileSizeHigh;
781   int nFileSizeLow;
782   int nNumberOfLinks;
783   int nFileIndexHigh;
784   int nFileIndexLow;
785 } BY_HANDLE_FILE_INFORMATION, *LPBY_HANDLE_FILE_INFORMATION ;
786
787
788 typedef struct _SYSTEM_POWER_STATUS
789 {
790   BYTE    ACLineStatus;
791   BYTE    BatteryFlag;
792   BYTE    BatteryLifePercent;
793   BYTE    reserved;
794   DWORD   BatteryLifeTime;
795   DWORD   BatteryFullLifeTime;
796 } SYSTEM_POWER_STATUS, *LPSYSTEM_POWER_STATUS;
797
798
799 typedef BOOL CALLBACK (*CODEPAGE_ENUMPROCA)(LPSTR);
800 typedef BOOL CALLBACK (*CODEPAGE_ENUMPROCW)(LPWSTR);
801 DECL_WINELIB_TYPE_AW(CODEPAGE_ENUMPROC)
802 typedef BOOL CALLBACK (*LOCALE_ENUMPROCA)(LPSTR);
803 typedef BOOL CALLBACK (*LOCALE_ENUMPROCW)(LPWSTR);
804 DECL_WINELIB_TYPE_AW(LOCALE_ENUMPROC)
805
806 typedef struct tagSYSTEM_INFO
807 {
808     union {
809         DWORD   dwOemId; /* Obsolete field - do not use */
810         struct {
811                 WORD wProcessorArchitecture;
812                 WORD wReserved;
813         } DUMMYSTRUCTNAME;
814     } DUMMYUNIONNAME;
815     DWORD       dwPageSize;
816     LPVOID      lpMinimumApplicationAddress;
817     LPVOID      lpMaximumApplicationAddress;
818     DWORD       dwActiveProcessorMask;
819     DWORD       dwNumberOfProcessors;
820     DWORD       dwProcessorType;
821     DWORD       dwAllocationGranularity;
822     WORD        wProcessorLevel;
823     WORD        wProcessorRevision;
824 } SYSTEM_INFO, *LPSYSTEM_INFO;
825
826 typedef BOOL CALLBACK (*ENUMRESTYPEPROCA)(HMODULE,LPSTR,LONG);
827 typedef BOOL CALLBACK (*ENUMRESTYPEPROCW)(HMODULE,LPWSTR,LONG);
828 typedef BOOL CALLBACK (*ENUMRESNAMEPROCA)(HMODULE,LPCSTR,LPSTR,LONG);
829 typedef BOOL CALLBACK (*ENUMRESNAMEPROCW)(HMODULE,LPCWSTR,LPWSTR,LONG);
830 typedef BOOL CALLBACK (*ENUMRESLANGPROCA)(HMODULE,LPCSTR,LPCSTR,WORD,LONG);
831 typedef BOOL CALLBACK (*ENUMRESLANGPROCW)(HMODULE,LPCWSTR,LPCWSTR,WORD,LONG);
832
833 DECL_WINELIB_TYPE_AW(ENUMRESTYPEPROC)
834 DECL_WINELIB_TYPE_AW(ENUMRESNAMEPROC)
835 DECL_WINELIB_TYPE_AW(ENUMRESLANGPROC)
836
837 /* flags that can be passed to LoadLibraryEx */
838 #define DONT_RESOLVE_DLL_REFERENCES     0x00000001
839 #define LOAD_LIBRARY_AS_DATAFILE        0x00000002
840 #define LOAD_WITH_ALTERED_SEARCH_PATH   0x00000008
841
842 /* ifdef _x86_ ... */
843 typedef struct _LDT_ENTRY {
844     WORD        LimitLow;
845     WORD        BaseLow;
846     union {
847         struct {
848             BYTE        BaseMid;
849             BYTE        Flags1;/*Declare as bytes to avoid alignment problems */
850             BYTE        Flags2; 
851             BYTE        BaseHi;
852         } Bytes;
853         struct {            
854             unsigned    BaseMid         : 8;
855             unsigned    Type            : 5;
856             unsigned    Dpl             : 2;
857             unsigned    Pres            : 1;
858             unsigned    LimitHi         : 4;
859             unsigned    Sys             : 1;
860             unsigned    Reserved_0      : 1;
861             unsigned    Default_Big     : 1;
862             unsigned    Granularity     : 1;
863             unsigned    BaseHi          : 8;
864         } Bits;
865     } HighWord;
866 } LDT_ENTRY, *LPLDT_ENTRY;
867
868
869 typedef enum _GET_FILEEX_INFO_LEVELS {
870     GetFileExInfoStandard
871 } GET_FILEEX_INFO_LEVELS;
872
873 typedef struct _WIN32_FILE_ATTRIBUTES_DATA {
874     DWORD    dwFileAttributes;
875     FILETIME ftCreationTime;
876     FILETIME ftLastAccessTime;
877     FILETIME ftLastWriteTime;
878     DWORD    nFileSizeHigh;
879     DWORD    nFileSizeLow;
880 } WIN32_FILE_ATTRIBUTE_DATA, *LPWIN32_FILE_ATTRIBUTE_DATA;
881
882 /*
883  * This one seems to be a Win32 only definition. It also is defined with
884  * WINAPI instead of CALLBACK in the windows headers.
885  */
886 typedef DWORD CALLBACK (*LPPROGRESS_ROUTINE)(LARGE_INTEGER, LARGE_INTEGER, LARGE_INTEGER, 
887                                            LARGE_INTEGER, DWORD, DWORD, HANDLE,
888                                            HANDLE, LPVOID);
889
890
891 #define WAIT_FAILED             0xffffffff
892 #define WAIT_OBJECT_0           0
893 #define WAIT_ABANDONED          STATUS_ABANDONED_WAIT_0
894 #define WAIT_ABANDONED_0        STATUS_ABANDONED_WAIT_0
895 #define WAIT_IO_COMPLETION      STATUS_USER_APC
896 #define WAIT_TIMEOUT            STATUS_TIMEOUT
897 #define STILL_ACTIVE            STATUS_PENDING
898
899 #define FILE_BEGIN              0
900 #define FILE_CURRENT            1
901 #define FILE_END                2
902
903 #define FILE_MAP_COPY                   0x00000001
904 #define FILE_MAP_WRITE                  0x00000002
905 #define FILE_MAP_READ                   0x00000004
906 #define FILE_MAP_ALL_ACCESS             0x000f001f
907
908 #define MOVEFILE_REPLACE_EXISTING       0x00000001
909 #define MOVEFILE_COPY_ALLOWED           0x00000002
910 #define MOVEFILE_DELAY_UNTIL_REBOOT     0x00000004
911
912 #define FS_CASE_SENSITIVE               FILE_CASE_SENSITIVE_SEARCH
913 #define FS_CASE_IS_PRESERVED            FILE_CASE_PRESERVED_NAMES
914 #define FS_UNICODE_STORED_ON_DISK       FILE_UNICODE_ON_DISK
915
916 #define EXCEPTION_ACCESS_VIOLATION          STATUS_ACCESS_VIOLATION
917 #define EXCEPTION_DATATYPE_MISALIGNMENT     STATUS_DATATYPE_MISALIGNMENT
918 #define EXCEPTION_BREAKPOINT                STATUS_BREAKPOINT
919 #define EXCEPTION_SINGLE_STEP               STATUS_SINGLE_STEP
920 #define EXCEPTION_ARRAY_BOUNDS_EXCEEDED     STATUS_ARRAY_BOUNDS_EXCEEDED
921 #define EXCEPTION_FLT_DENORMAL_OPERAND      STATUS_FLOAT_DENORMAL_OPERAND
922 #define EXCEPTION_FLT_DIVIDE_BY_ZERO        STATUS_FLOAT_DIVIDE_BY_ZERO
923 #define EXCEPTION_FLT_INEXACT_RESULT        STATUS_FLOAT_INEXACT_RESULT
924 #define EXCEPTION_FLT_INVALID_OPERATION     STATUS_FLOAT_INVALID_OPERATION
925 #define EXCEPTION_FLT_OVERFLOW              STATUS_FLOAT_OVERFLOW
926 #define EXCEPTION_FLT_STACK_CHECK           STATUS_FLOAT_STACK_CHECK
927 #define EXCEPTION_FLT_UNDERFLOW             STATUS_FLOAT_UNDERFLOW
928 #define EXCEPTION_INT_DIVIDE_BY_ZERO        STATUS_INTEGER_DIVIDE_BY_ZERO
929 #define EXCEPTION_INT_OVERFLOW              STATUS_INTEGER_OVERFLOW
930 #define EXCEPTION_PRIV_INSTRUCTION          STATUS_PRIVILEGED_INSTRUCTION
931 #define EXCEPTION_IN_PAGE_ERROR             STATUS_IN_PAGE_ERROR
932 #define EXCEPTION_ILLEGAL_INSTRUCTION       STATUS_ILLEGAL_INSTRUCTION
933 #define EXCEPTION_NONCONTINUABLE_EXCEPTION  STATUS_NONCONTINUABLE_EXCEPTION
934 #define EXCEPTION_STACK_OVERFLOW            STATUS_STACK_OVERFLOW
935 #define EXCEPTION_INVALID_DISPOSITION       STATUS_INVALID_DISPOSITION
936 #define EXCEPTION_GUARD_PAGE                STATUS_GUARD_PAGE_VIOLATION
937 #define EXCEPTION_INVALID_HANDLE            STATUS_INVALID_HANDLE
938 #define CONTROL_C_EXIT                      STATUS_CONTROL_C_EXIT
939
940 /* Wine extension; Windows doesn't have a name for this code */
941 #define EXCEPTION_CRITICAL_SECTION_WAIT     0xc0000194
942
943 #define DUPLICATE_CLOSE_SOURCE          0x00000001
944 #define DUPLICATE_SAME_ACCESS           0x00000002
945
946 #define HANDLE_FLAG_INHERIT             0x00000001
947 #define HANDLE_FLAG_PROTECT_FROM_CLOSE  0x00000002
948
949 #define HINSTANCE_ERROR 32
950
951 #define THREAD_PRIORITY_LOWEST          THREAD_BASE_PRIORITY_MIN
952 #define THREAD_PRIORITY_BELOW_NORMAL    (THREAD_PRIORITY_LOWEST+1)
953 #define THREAD_PRIORITY_NORMAL          0
954 #define THREAD_PRIORITY_HIGHEST         THREAD_BASE_PRIORITY_MAX
955 #define THREAD_PRIORITY_ABOVE_NORMAL    (THREAD_PRIORITY_HIGHEST-1)
956 #define THREAD_PRIORITY_ERROR_RETURN    (0x7fffffff)
957 #define THREAD_PRIORITY_TIME_CRITICAL   THREAD_BASE_PRIORITY_LOWRT
958 #define THREAD_PRIORITY_IDLE            THREAD_BASE_PRIORITY_IDLE
959
960 /* flags to FormatMessage */
961 #define FORMAT_MESSAGE_ALLOCATE_BUFFER  0x00000100
962 #define FORMAT_MESSAGE_IGNORE_INSERTS   0x00000200
963 #define FORMAT_MESSAGE_FROM_STRING      0x00000400
964 #define FORMAT_MESSAGE_FROM_HMODULE     0x00000800
965 #define FORMAT_MESSAGE_FROM_SYSTEM      0x00001000
966 #define FORMAT_MESSAGE_ARGUMENT_ARRAY   0x00002000
967 #define FORMAT_MESSAGE_MAX_WIDTH_MASK   0x000000FF
968
969 #ifdef __WINE__
970 #define CRITICAL_SECTION_INIT { 0, -1, 0, 0, 0, 0 }
971 #endif
972
973 typedef struct {
974         DWORD dwOSVersionInfoSize;
975         DWORD dwMajorVersion;
976         DWORD dwMinorVersion;
977         DWORD dwBuildNumber;
978         DWORD dwPlatformId;
979         CHAR szCSDVersion[128];
980 } OSVERSIONINFOA;
981
982 typedef struct {
983         DWORD dwOSVersionInfoSize;
984         DWORD dwMajorVersion;
985         DWORD dwMinorVersion;
986         DWORD dwBuildNumber;
987         DWORD dwPlatformId;
988         WCHAR szCSDVersion[128];
989 } OSVERSIONINFOW;
990
991 DECL_WINELIB_TYPE_AW(OSVERSIONINFO)
992
993 #define VER_PLATFORM_WIN32s             0
994 #define VER_PLATFORM_WIN32_WINDOWS      1
995 #define VER_PLATFORM_WIN32_NT           2
996
997 typedef struct tagCOMSTAT
998 {
999     DWORD status;
1000     DWORD cbInQue;
1001     DWORD cbOutQue;
1002 } COMSTAT,*LPCOMSTAT;
1003
1004 typedef struct tagDCB
1005 {
1006     DWORD DCBlength;
1007     DWORD BaudRate;
1008     unsigned fBinary               :1;
1009     unsigned fParity               :1;
1010     unsigned fOutxCtsFlow          :1;
1011     unsigned fOutxDsrFlow          :1;
1012     unsigned fDtrControl           :2;
1013     unsigned fDsrSensitivity       :1;
1014     unsigned fTXContinueOnXoff     :1;
1015     unsigned fOutX                 :1;
1016     unsigned fInX                  :1;
1017     unsigned fErrorChar            :1;
1018     unsigned fNull                 :1;
1019     unsigned fRtsControl           :2;
1020     unsigned fAbortOnError         :1;
1021     unsigned fDummy2               :17;
1022     WORD wReserved;
1023     WORD XonLim;
1024     WORD XoffLim;
1025     BYTE ByteSize;
1026     BYTE Parity;
1027     BYTE StopBits;
1028     char XonChar;
1029     char XoffChar;
1030     char ErrorChar;
1031     char EofChar;
1032     char EvtChar;
1033 } DCB, *LPDCB;
1034
1035 typedef struct tagCOMMCONFIG {
1036         DWORD dwSize;
1037         WORD  wVersion;
1038         WORD  wReserved;
1039         DCB   dcb;
1040         DWORD dwProviderSubType;
1041         DWORD dwProviderOffset;
1042         DWORD dwProviderSize;
1043         DWORD wcProviderData[1];
1044 } COMMCONFIG, *LPCOMMCONFIG;
1045
1046 typedef struct tagCOMMPROP {
1047         WORD  wPacketLength;
1048         WORD  wPacketVersion;
1049         DWORD dwServiceMask;
1050         DWORD dwReserved1;
1051         DWORD dwMaxTxQueue;
1052         DWORD dwMaxRxQueue;
1053         DWORD dwMaxBaud;
1054         DWORD dwProvSubType;
1055         DWORD dwProvCapabilities;
1056         DWORD dwSettableParams;
1057         DWORD dwSettableBaud;
1058         WORD  wSettableData;
1059         WORD  wSettableStopParity;
1060         DWORD dwCurrentTxQueue;
1061         DWORD dwCurrentRxQueue;
1062         DWORD dwProvSpec1;
1063         DWORD dwProvSpec2;
1064         WCHAR wcProvChar[1];
1065 } COMMPROP, *LPCOMMPROP;
1066
1067 #define SP_SERIALCOMM ((DWORD)1)
1068
1069 #define BAUD_075     ((DWORD)0x01)
1070 #define BAUD_110     ((DWORD)0x02)
1071 #define BAUD_134_5   ((DWORD)0x04)
1072 #define BAUD_150     ((DWORD)0x08)
1073 #define BAUD_300     ((DWORD)0x10)
1074 #define BAUD_600     ((DWORD)0x20)
1075 #define BAUD_1200    ((DWORD)0x40)
1076 #define BAUD_1800    ((DWORD)0x80)
1077 #define BAUD_2400    ((DWORD)0x100)
1078 #define BAUD_4800    ((DWORD)0x200)
1079 #define BAUD_7200    ((DWORD)0x400)
1080 #define BAUD_9600    ((DWORD)0x800)
1081 #define BAUD_14400   ((DWORD)0x1000)
1082 #define BAUD_19200   ((DWORD)0x2000)
1083 #define BAUD_38400   ((DWORD)0x4000)
1084 #define BAUD_56K     ((DWORD)0x8000)
1085 #define BAUD_57600   ((DWORD)0x40000)
1086 #define BAUD_115200  ((DWORD)0x20000)
1087 #define BAUD_128K    ((DWORD)0x10000)
1088 #define BAUD_USER    ((DWORD)0x10000000)
1089
1090 #define PST_FAX            ((DWORD)0x21)
1091 #define PST_LAT            ((DWORD)0x101)
1092 #define PST_MODEM          ((DWORD)0x06)
1093 #define PST_NETWORK_BRIDGE ((DWORD)0x100)
1094 #define PST_PARALLEL_PORT  ((DWORD)0x02)
1095 #define PST_RS232          ((DWORD)0x01)
1096 #define PST_RS442          ((DWORD)0x03)
1097 #define PST_RS423          ((DWORD)0x04)
1098 #define PST_RS449          ((DWORD)0x06)
1099 #define PST_SCANNER        ((DWORD)0x22)
1100 #define PST_TCPIP_TELNET   ((DWORD)0x102)
1101 #define PST_UNSPECIFIED    ((DWORD)0x00)
1102 #define PST_X25            ((DWORD)0x103)
1103
1104 #define PCF_16BITMODE     ((DWORD)0x200)
1105 #define PCF_DTRDSR        ((DWORD)0x01)
1106 #define PCF_INTTIMEOUTS   ((DWORD)0x80)
1107 #define PCF_PARITY_CHECK  ((DWORD)0x08)
1108 #define PCF_RLSD          ((DWORD)0x04)
1109 #define PCF_RTSCTS        ((DWORD)0x02)
1110 #define PCF_SETXCHAR      ((DWORD)0x20)
1111 #define PCF_SPECIALCHARS  ((DWORD)0x100)
1112 #define PCF_TOTALTIMEOUTS ((DWORD)0x40)
1113 #define PCF_XONXOFF       ((DWORD)0x10)
1114
1115 #define SP_BAUD         ((DWORD)0x02)
1116 #define SP_DATABITS     ((DWORD)0x04)
1117 #define SP_HANDSHAKING  ((DWORD)0x10)
1118 #define SP_PARITY       ((DWORD)0x01)
1119 #define SP_PARITY_CHECK ((DWORD)0x20)
1120 #define SP_RLSD         ((DWORD)0x40)
1121 #define SP_STOPBITS     ((DWORD)0x08)
1122
1123 #define DATABITS_5   ((DWORD)0x01)
1124 #define DATABITS_6   ((DWORD)0x02)
1125 #define DATABITS_7   ((DWORD)0x04)
1126 #define DATABITS_8   ((DWORD)0x08)
1127 #define DATABITS_16  ((DWORD)0x10)
1128 #define DATABITS_16X ((DWORD)0x20)
1129
1130 #define STOPBITS_10 ((DWORD)1)
1131 #define STOPBITS_15 ((DWORD)2)
1132 #define STOPBITS_20 ((DWORD)4)
1133
1134 #define PARITY_NONE  ((DWORD)0x100)
1135 #define PARITY_ODD   ((DWORD)0x200)
1136 #define PARITY_EVEN  ((DWORD)0x400)
1137 #define PARITY_MARK  ((DWORD)0x800)
1138 #define PARITY_SPACE ((DWORD)0x1000)
1139
1140 typedef struct tagCOMMTIMEOUTS {
1141         DWORD   ReadIntervalTimeout;
1142         DWORD   ReadTotalTimeoutMultiplier;
1143         DWORD   ReadTotalTimeoutConstant;
1144         DWORD   WriteTotalTimeoutMultiplier;
1145         DWORD   WriteTotalTimeoutConstant;
1146 } COMMTIMEOUTS,*LPCOMMTIMEOUTS;
1147
1148
1149 #include "poppack.h"
1150
1151 typedef void CALLBACK (*PAPCFUNC)(ULONG_PTR);
1152 typedef void CALLBACK (*PTIMERAPCROUTINE)(LPVOID,DWORD,DWORD);
1153   
1154 /*DWORD WINAPI GetVersion( void );*/
1155 BOOL WINAPI GetVersionExA(OSVERSIONINFOA*);
1156 BOOL WINAPI GetVersionExW(OSVERSIONINFOW*);
1157 #define GetVersionEx WINELIB_NAME_AW(GetVersionEx)
1158
1159 /*int WinMain(HINSTANCE, HINSTANCE prev, char *cmd, int show);*/
1160
1161 LONG WINAPI RtlEnterCriticalSection( CRITICAL_SECTION *crit );
1162 LONG WINAPI RtlLeaveCriticalSection( CRITICAL_SECTION *crit );
1163 LONG WINAPI RtlDeleteCriticalSection( CRITICAL_SECTION *crit );
1164 BOOL WINAPI RtlTryEnterCriticalSection( CRITICAL_SECTION *crit );
1165 /* FIXME: need to use defines because we don't have proper imports yet */
1166 #define     EnterCriticalSection(crit) RtlEnterCriticalSection(crit)
1167 #define     LeaveCriticalSection(crit) RtlLeaveCriticalSection(crit)
1168 #define     DeleteCriticalSection(crit) RtlDeleteCriticalSection(crit)
1169 #define     TryEnterCriticalSection(crit) RtlTryEnterCriticalSection(crit)
1170 #if 0
1171 void      WINAPI DeleteCriticalSection(CRITICAL_SECTION *lpCrit);
1172 void      WINAPI EnterCriticalSection(CRITICAL_SECTION *lpCrit);
1173 BOOL      WINAPI TryEnterCriticalSection(CRITICAL_SECTION *lpCrit);
1174 void      WINAPI LeaveCriticalSection(CRITICAL_SECTION *lpCrit);
1175 #endif
1176
1177 void      WINAPI InitializeCriticalSection(CRITICAL_SECTION *lpCrit);
1178 void      WINAPI MakeCriticalSectionGlobal(CRITICAL_SECTION *lpCrit);
1179 BOOL      WINAPI GetProcessWorkingSetSize(HANDLE,LPDWORD,LPDWORD);
1180 DWORD     WINAPI QueueUserAPC(PAPCFUNC,HANDLE,ULONG_PTR);
1181 void      WINAPI RaiseException(DWORD,DWORD,DWORD,const LPDWORD);
1182 BOOL    WINAPI SetProcessWorkingSetSize(HANDLE,DWORD,DWORD);
1183 BOOL    WINAPI TerminateProcess(HANDLE,DWORD);
1184 BOOL    WINAPI TerminateThread(HANDLE,DWORD);
1185 BOOL    WINAPI GetExitCodeThread(HANDLE,LPDWORD); 
1186
1187 /* GetBinaryType return values.
1188  */
1189
1190 #define SCS_32BIT_BINARY    0
1191 #define SCS_DOS_BINARY      1
1192 #define SCS_WOW_BINARY      2
1193 #define SCS_PIF_BINARY      3
1194 #define SCS_POSIX_BINARY    4
1195 #define SCS_OS216_BINARY    5
1196
1197 BOOL WINAPI GetBinaryTypeA( LPCSTR lpApplicationName, LPDWORD lpBinaryType );
1198 BOOL WINAPI GetBinaryTypeW( LPCWSTR lpApplicationName, LPDWORD lpBinaryType );
1199 #define GetBinaryType WINELIB_NAME_AW(GetBinaryType)
1200
1201 /* Declarations for functions that exist only in Win32 */
1202
1203 BOOL        WINAPI AddAccessAllowedAce(PACL,DWORD,DWORD,PSID);
1204 BOOL        WINAPI AttachThreadInput(DWORD,DWORD,BOOL);
1205 BOOL        WINAPI AccessCheck(PSECURITY_DESCRIPTOR,HANDLE,DWORD,PGENERIC_MAPPING,PPRIVILEGE_SET,LPDWORD,LPDWORD,LPBOOL);
1206 BOOL        WINAPI AdjustTokenPrivileges(HANDLE,BOOL,LPVOID,DWORD,LPVOID,LPDWORD);
1207 BOOL        WINAPI AllocateAndInitializeSid(PSID_IDENTIFIER_AUTHORITY,BYTE,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,PSID *);
1208 BOOL        WINAPI AllocateLocallyUniqueId(PLUID);
1209 BOOL      WINAPI AllocConsole(void);
1210 BOOL      WINAPI AreFileApisANSI(void);
1211 BOOL        WINAPI BackupEventLogA(HANDLE,LPCSTR);
1212 BOOL        WINAPI BackupEventLogW(HANDLE,LPCWSTR);
1213 #define     BackupEventLog WINELIB_NAME_AW(BackupEventLog)
1214 BOOL        WINAPI BackupRead(HANDLE,LPBYTE,DWORD,LPDWORD,BOOL,BOOL,LPVOID*);
1215 BOOL        WINAPI BackupSeek(HANDLE,DWORD,DWORD,LPDWORD,LPDWORD,LPVOID*);
1216 BOOL        WINAPI BackupWrite(HANDLE,LPBYTE,DWORD,LPDWORD,BOOL,BOOL,LPVOID*);
1217 BOOL        WINAPI Beep(DWORD,DWORD);
1218 BOOL        WINAPI BuildCommDCBA(LPCSTR,LPDCB);
1219 BOOL        WINAPI BuildCommDCBW(LPCWSTR,LPDCB);
1220 #define     BuildCommDCB WINELIB_NAME_AW(BuildCommDCB)
1221 BOOL        WINAPI BuildCommDCBAndTimeoutsA(LPCSTR,LPDCB,LPCOMMTIMEOUTS);
1222 BOOL        WINAPI BuildCommDCBAndTimeoutsW(LPCWSTR,LPDCB,LPCOMMTIMEOUTS);
1223 #define     BuildCommDCBAndTimeouts WINELIB_NAME_AW(BuildCommDCBAndTimeouts)
1224 BOOL        WINAPI CancelWaitableTimer(HANDLE);
1225 BOOL        WINAPI ClearCommError(HANDLE,LPDWORD,LPCOMSTAT);
1226 BOOL        WINAPI ClearEventLogA(HANDLE,LPCSTR);
1227 BOOL        WINAPI ClearEventLogW(HANDLE,LPCWSTR);
1228 #define     ClearEventLog WINELIB_NAME_AW(ClearEventLog)
1229 BOOL        WINAPI CloseEventLog(HANDLE);
1230 BOOL        WINAPI CloseHandle(HANDLE);
1231 BOOL        WINAPI CommConfigDialogA(LPCSTR,HANDLE,LPCOMMCONFIG);
1232 BOOL        WINAPI CommConfigDialogW(LPCWSTR,HANDLE,LPCOMMCONFIG);
1233 #define     CommConfigDialog WINELIB_NAME_AW(CommConfigDialog)
1234 BOOL      WINAPI ContinueDebugEvent(DWORD,DWORD,DWORD);
1235 HANDLE    WINAPI ConvertToGlobalHandle(HANDLE hSrc);
1236 BOOL      WINAPI CopyFileA(LPCSTR,LPCSTR,BOOL);
1237 BOOL      WINAPI CopyFileW(LPCWSTR,LPCWSTR,BOOL);
1238 #define     CopyFile WINELIB_NAME_AW(CopyFile)
1239 BOOL      WINAPI CopyFileExA(LPCSTR, LPCSTR, LPPROGRESS_ROUTINE, LPVOID, LPBOOL, DWORD);
1240 BOOL      WINAPI CopyFileExW(LPCWSTR, LPCWSTR, LPPROGRESS_ROUTINE, LPVOID, LPBOOL, DWORD);
1241 #define     CopyFileEx WINELIB_NAME_AW(CopyFileEx)
1242 BOOL        WINAPI CopySid(DWORD,PSID,PSID);
1243 INT       WINAPI CompareFileTime(LPFILETIME,LPFILETIME);
1244 HANDLE    WINAPI CreateEventA(LPSECURITY_ATTRIBUTES,BOOL,BOOL,LPCSTR);
1245 HANDLE    WINAPI CreateEventW(LPSECURITY_ATTRIBUTES,BOOL,BOOL,LPCWSTR);
1246 #define     CreateEvent WINELIB_NAME_AW(CreateEvent)
1247 HANDLE     WINAPI CreateFileA(LPCSTR,DWORD,DWORD,LPSECURITY_ATTRIBUTES,
1248                                  DWORD,DWORD,HANDLE);
1249 HANDLE     WINAPI CreateFileW(LPCWSTR,DWORD,DWORD,LPSECURITY_ATTRIBUTES,
1250                                  DWORD,DWORD,HANDLE);
1251 #define     CreateFile WINELIB_NAME_AW(CreateFile)
1252 HANDLE    WINAPI CreateFileMappingA(HANDLE,LPSECURITY_ATTRIBUTES,DWORD,
1253                                         DWORD,DWORD,LPCSTR);
1254 HANDLE    WINAPI CreateFileMappingW(HANDLE,LPSECURITY_ATTRIBUTES,DWORD,
1255                                         DWORD,DWORD,LPCWSTR);
1256 #define     CreateFileMapping WINELIB_NAME_AW(CreateFileMapping)
1257 HANDLE    WINAPI CreateMutexA(LPSECURITY_ATTRIBUTES,BOOL,LPCSTR);
1258 HANDLE    WINAPI CreateMutexW(LPSECURITY_ATTRIBUTES,BOOL,LPCWSTR);
1259 #define     CreateMutex WINELIB_NAME_AW(CreateMutex)
1260 BOOL      WINAPI CreatePipe(PHANDLE,PHANDLE,LPSECURITY_ATTRIBUTES,DWORD);
1261 BOOL      WINAPI CreateProcessA(LPCSTR,LPSTR,LPSECURITY_ATTRIBUTES,
1262                                     LPSECURITY_ATTRIBUTES,BOOL,DWORD,LPVOID,LPCSTR,
1263                                     LPSTARTUPINFOA,LPPROCESS_INFORMATION);
1264 BOOL      WINAPI CreateProcessW(LPCWSTR,LPWSTR,LPSECURITY_ATTRIBUTES,
1265                                     LPSECURITY_ATTRIBUTES,BOOL,DWORD,LPVOID,LPCWSTR,
1266                                     LPSTARTUPINFOW,LPPROCESS_INFORMATION);
1267 #define     CreateProcess WINELIB_NAME_AW(CreateProcess)
1268 HANDLE    WINAPI CreateSemaphoreA(LPSECURITY_ATTRIBUTES,LONG,LONG,LPCSTR);
1269 HANDLE    WINAPI CreateSemaphoreW(LPSECURITY_ATTRIBUTES,LONG,LONG,LPCWSTR);
1270 #define     CreateSemaphore WINELIB_NAME_AW(CreateSemaphore)
1271 DWORD       WINAPI CreateTapePartition(HANDLE,DWORD,DWORD,DWORD);
1272 HANDLE      WINAPI CreateThread(LPSECURITY_ATTRIBUTES,DWORD,LPTHREAD_START_ROUTINE,LPVOID,DWORD,LPDWORD);
1273 HANDLE      WINAPI CreateWaitableTimerA(LPSECURITY_ATTRIBUTES,BOOL,LPCSTR);
1274 HANDLE      WINAPI CreateWaitableTimerW(LPSECURITY_ATTRIBUTES,BOOL,LPCWSTR);
1275 #define     CreateWaitableTimer WINELIB_NAME_AW(CreateWaitableTimer)
1276 BOOL        WINAPI DebugActiveProcess(DWORD);
1277 void        WINAPI DebugBreak(void);
1278 BOOL        WINAPI DeregisterEventSource(HANDLE);
1279 BOOL        WINAPI DisableThreadLibraryCalls(HMODULE);
1280 BOOL        WINAPI DosDateTimeToFileTime(WORD,WORD,LPFILETIME);
1281 BOOL        WINAPI DuplicateHandle(HANDLE,HANDLE,HANDLE,HANDLE*,DWORD,BOOL,DWORD);
1282 BOOL        WINAPI EnumDateFormatsA(DATEFMT_ENUMPROCA lpDateFmtEnumProc, LCID Locale, DWORD dwFlags);
1283 BOOL        WINAPI EnumDateFormatsW(DATEFMT_ENUMPROCW lpDateFmtEnumProc, LCID Locale, DWORD dwFlags);
1284 #define     EnumDateFormats WINELIB_NAME_AW(EnumDateFormats)
1285 BOOL      WINAPI EnumResourceLanguagesA(HMODULE,LPCSTR,LPCSTR,
1286                                             ENUMRESLANGPROCA,LONG);
1287 BOOL      WINAPI EnumResourceLanguagesW(HMODULE,LPCWSTR,LPCWSTR,
1288                                             ENUMRESLANGPROCW,LONG);
1289 #define     EnumResourceLanguages WINELIB_NAME_AW(EnumResourceLanguages)
1290 BOOL      WINAPI EnumResourceNamesA(HMODULE,LPCSTR,ENUMRESNAMEPROCA,
1291                                         LONG);
1292 BOOL      WINAPI EnumResourceNamesW(HMODULE,LPCWSTR,ENUMRESNAMEPROCW,
1293                                         LONG);
1294 #define     EnumResourceNames WINELIB_NAME_AW(EnumResourceNames)
1295 BOOL      WINAPI EnumResourceTypesA(HMODULE,ENUMRESTYPEPROCA,LONG);
1296 BOOL      WINAPI EnumResourceTypesW(HMODULE,ENUMRESTYPEPROCW,LONG);
1297 #define     EnumResourceTypes WINELIB_NAME_AW(EnumResourceTypes)
1298 BOOL      WINAPI EnumSystemCodePagesA(CODEPAGE_ENUMPROCA,DWORD);
1299 BOOL      WINAPI EnumSystemCodePagesW(CODEPAGE_ENUMPROCW,DWORD);
1300 #define     EnumSystemCodePages WINELIB_NAME_AW(EnumSystemCodePages)
1301 BOOL      WINAPI EnumSystemLocalesA(LOCALE_ENUMPROCA,DWORD);
1302 BOOL      WINAPI EnumSystemLocalesW(LOCALE_ENUMPROCW,DWORD);
1303 #define     EnumSystemLocales WINELIB_NAME_AW(EnumSystemLocales)
1304 BOOL      WINAPI EnumTimeFormatsA(TIMEFMT_ENUMPROCA lpTimeFmtEnumProc, LCID Locale, DWORD dwFlags);
1305 BOOL      WINAPI EnumTimeFormatsW(TIMEFMT_ENUMPROCW lpTimeFmtEnumProc, LCID Locale, DWORD dwFlags);
1306 #define     EnumTimeFormats WINELIB_NAME_AW(EnumTimeFormats)
1307 BOOL        WINAPI EqualSid(PSID, PSID);
1308 BOOL        WINAPI EqualPrefixSid(PSID,PSID);
1309 DWORD       WINAPI EraseTape(HANDLE,DWORD,BOOL);
1310 VOID        WINAPI ExitProcess(DWORD) WINE_NORETURN;
1311 VOID        WINAPI ExitThread(DWORD) WINE_NORETURN;
1312 DWORD       WINAPI ExpandEnvironmentStringsA(LPCSTR,LPSTR,DWORD);
1313 DWORD       WINAPI ExpandEnvironmentStringsW(LPCWSTR,LPWSTR,DWORD);
1314 #define     ExpandEnvironmentStrings WINELIB_NAME_AW(ExpandEnvironmentStrings)
1315 BOOL      WINAPI FileTimeToDosDateTime(const FILETIME*,LPWORD,LPWORD);
1316 BOOL      WINAPI FileTimeToLocalFileTime(const FILETIME*,LPFILETIME);
1317 BOOL      WINAPI FileTimeToSystemTime(const FILETIME*,LPSYSTEMTIME);
1318 HANDLE    WINAPI FindFirstChangeNotificationA(LPCSTR,BOOL,DWORD);
1319 HANDLE    WINAPI FindFirstChangeNotificationW(LPCWSTR,BOOL,DWORD);
1320 #define     FindFirstChangeNotification WINELIB_NAME_AW(FindFirstChangeNotification)
1321 BOOL      WINAPI FindNextChangeNotification(HANDLE);
1322 BOOL      WINAPI FindCloseChangeNotification(HANDLE);
1323 HRSRC     WINAPI FindResourceExA(HMODULE,LPCSTR,LPCSTR,WORD);
1324 HRSRC     WINAPI FindResourceExW(HMODULE,LPCWSTR,LPCWSTR,WORD);
1325 #define     FindResourceEx WINELIB_NAME_AW(FindResourceEx)
1326 BOOL      WINAPI FlushConsoleInputBuffer(HANDLE);
1327 BOOL      WINAPI FlushFileBuffers(HANDLE);
1328 BOOL      WINAPI FlushViewOfFile(LPCVOID, DWORD);
1329 DWORD       WINAPI FormatMessageA(DWORD,LPCVOID,DWORD,DWORD,LPSTR,DWORD,va_list*);
1330 DWORD       WINAPI FormatMessageW(DWORD,LPCVOID,DWORD,DWORD,LPWSTR,DWORD,va_list*);
1331 #define     FormatMessage WINELIB_NAME_AW(FormatMessage)
1332 BOOL      WINAPI FreeConsole(void);
1333 BOOL      WINAPI FreeEnvironmentStringsA(LPSTR);
1334 BOOL      WINAPI FreeEnvironmentStringsW(LPWSTR);
1335 #define     FreeEnvironmentStrings WINELIB_NAME_AW(FreeEnvironmentStrings)
1336 VOID        WINAPI FreeLibraryAndExitThread(HINSTANCE,DWORD);
1337 PVOID       WINAPI FreeSid(PSID);
1338 UINT        WINAPI GetACP(void);
1339 BOOL        WINAPI GetCommConfig(HANDLE,LPCOMMCONFIG);
1340 BOOL        WINAPI GetCommMask(HANDLE,LPDWORD);
1341 BOOL        WINAPI GetCommModemStatus(HANDLE,LPDWORD);
1342 BOOL        WINAPI GetCommProperties(HANDLE,LPCOMMPROP);
1343 BOOL        WINAPI GetCommState(HANDLE,LPDCB);
1344 BOOL        WINAPI GetCommTimeouts(HANDLE,LPCOMMTIMEOUTS);
1345 LPSTR       WINAPI GetCommandLineA(void);
1346 LPWSTR      WINAPI GetCommandLineW(void);
1347 #define     GetCommandLine WINELIB_NAME_AW(GetCommandLine)
1348 BOOL      WINAPI GetComputerNameA(LPSTR,LPDWORD);
1349 BOOL      WINAPI GetComputerNameW(LPWSTR,LPDWORD);
1350 #define     GetComputerName WINELIB_NAME_AW(GetComputerName)
1351 UINT      WINAPI GetConsoleCP(void);
1352 BOOL      WINAPI GetConsoleMode(HANDLE,LPDWORD);
1353 UINT      WINAPI GetConsoleOutputCP(void);
1354 DWORD       WINAPI GetConsoleTitleA(LPSTR,DWORD);
1355 DWORD       WINAPI GetConsoleTitleW(LPWSTR,DWORD);
1356 #define     GetConsoleTitle WINELIB_NAME_AW(GetConsoleTitle)
1357 HANDLE      WINAPI GetCurrentProcess(void);
1358 HANDLE      WINAPI GetCurrentThread(void);
1359 INT         WINAPI GetDateFormatA(LCID,DWORD,LPSYSTEMTIME,LPCSTR,LPSTR,INT);
1360 INT         WINAPI GetDateFormatW(LCID,DWORD,LPSYSTEMTIME,LPCWSTR,LPWSTR,INT);
1361 #define     GetDateFormat WINELIB_NAME_AW(GetDateFormat)
1362 BOOL        WINAPI GetDefaultCommConfigA(LPCSTR,LPCOMMCONFIG,LPDWORD);
1363 BOOL        WINAPI GetDefaultCommConfigW(LPCWSTR,LPCOMMCONFIG,LPDWORD);
1364 #define     GetDefaultCommConfig WINELIB_NAME_AW(GetDefaultCommConfig)
1365 LPSTR       WINAPI GetEnvironmentStringsA(void);
1366 LPWSTR      WINAPI GetEnvironmentStringsW(void);
1367 #define     GetEnvironmentStrings WINELIB_NAME_AW(GetEnvironmentStrings)
1368 DWORD       WINAPI GetEnvironmentVariableA(LPCSTR,LPSTR,DWORD);
1369 DWORD       WINAPI GetEnvironmentVariableW(LPCWSTR,LPWSTR,DWORD);
1370 #define     GetEnvironmentVariable WINELIB_NAME_AW(GetEnvironmentVariable)
1371 BOOL      WINAPI GetFileAttributesExA(LPCSTR,GET_FILEEX_INFO_LEVELS,LPVOID);
1372 BOOL      WINAPI GetFileAttributesExW(LPCWSTR,GET_FILEEX_INFO_LEVELS,LPVOID);
1373 #define     GetFileattributesEx WINELIB_NAME_AW(GetFileAttributesEx)
1374 DWORD       WINAPI GetFileInformationByHandle(HANDLE,BY_HANDLE_FILE_INFORMATION*);
1375 BOOL        WINAPI GetFileSecurityA(LPCSTR,SECURITY_INFORMATION,PSECURITY_DESCRIPTOR,DWORD,LPDWORD);
1376 BOOL        WINAPI GetFileSecurityW(LPCWSTR,SECURITY_INFORMATION,PSECURITY_DESCRIPTOR,DWORD,LPDWORD);
1377 #define     GetFileSecurity WINELIB_NAME_AW(GetFileSecurity)
1378 DWORD       WINAPI GetFileSize(HANDLE,LPDWORD);
1379 BOOL        WINAPI GetFileTime(HANDLE,LPFILETIME,LPFILETIME,LPFILETIME);
1380 DWORD       WINAPI GetFileType(HANDLE);
1381 DWORD       WINAPI GetFullPathNameA(LPCSTR,DWORD,LPSTR,LPSTR*);
1382 DWORD       WINAPI GetFullPathNameW(LPCWSTR,DWORD,LPWSTR,LPWSTR*);
1383 #define     GetFullPathName WINELIB_NAME_AW(GetFullPathName)
1384 BOOL      WINAPI GetHandleInformation(HANDLE,LPDWORD);
1385 DWORD       WINAPI GetLengthSid(PSID);
1386 VOID        WINAPI GetLocalTime(LPSYSTEMTIME);
1387 DWORD       WINAPI GetLogicalDrives(void);
1388 DWORD       WINAPI GetLongPathNameA(LPCSTR,LPSTR,DWORD);
1389 DWORD       WINAPI GetLongPathNameW(LPCWSTR,LPWSTR,DWORD);
1390 #define     GetLongPathName WINELIB_NAME_AW(GetLongPathName)
1391 BOOL      WINAPI GetNumberOfConsoleInputEvents(HANDLE,LPDWORD);
1392 BOOL      WINAPI GetNumberOfConsoleMouseButtons(LPDWORD);
1393 BOOL        WINAPI GetNumberOfEventLogRecords(HANDLE,PDWORD);
1394 UINT      WINAPI GetOEMCP(void);
1395 BOOL        WINAPI GetOldestEventLogRecord(HANDLE,PDWORD);
1396 DWORD       WINAPI GetPriorityClass(HANDLE);
1397 BOOL        WINAPI GetProcessTimes(HANDLE,LPFILETIME,LPFILETIME,LPFILETIME,LPFILETIME);
1398 DWORD       WINAPI GetProcessVersion(DWORD);
1399 BOOL        WINAPI GetSecurityDescriptorControl(PSECURITY_DESCRIPTOR,PSECURITY_DESCRIPTOR_CONTROL,LPDWORD);
1400 BOOL        WINAPI GetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR,LPBOOL,PACL *,LPBOOL);
1401 BOOL        WINAPI GetSecurityDescriptorGroup(PSECURITY_DESCRIPTOR,PSID *,LPBOOL);
1402 DWORD       WINAPI GetSecurityDescriptorLength(PSECURITY_DESCRIPTOR);
1403 BOOL        WINAPI GetSecurityDescriptorOwner(PSECURITY_DESCRIPTOR,PSID *,LPBOOL);
1404 BOOL        WINAPI GetSecurityDescriptorSacl(PSECURITY_DESCRIPTOR,LPBOOL,PACL *,LPBOOL);
1405 PSID_IDENTIFIER_AUTHORITY WINAPI GetSidIdentifierAuthority(PSID);
1406 DWORD       WINAPI GetSidLengthRequired(BYTE);
1407 PDWORD      WINAPI GetSidSubAuthority(PSID,DWORD);
1408 PUCHAR      WINAPI GetSidSubAuthorityCount(PSID);
1409 DWORD       WINAPI GetShortPathNameA(LPCSTR,LPSTR,DWORD);
1410 DWORD       WINAPI GetShortPathNameW(LPCWSTR,LPWSTR,DWORD);
1411 #define     GetShortPathName WINELIB_NAME_AW(GetShortPathName)
1412 HANDLE      WINAPI GetStdHandle(DWORD);
1413 BOOL      WINAPI GetStringTypeExA(LCID,DWORD,LPCSTR,INT,LPWORD);
1414 BOOL      WINAPI GetStringTypeExW(LCID,DWORD,LPCWSTR,INT,LPWORD);
1415 #define     GetStringTypeEx WINELIB_NAME_AW(GetStringTypeEx)
1416 VOID        WINAPI GetSystemInfo(LPSYSTEM_INFO);
1417 BOOL        WINAPI GetSystemPowerStatus(LPSYSTEM_POWER_STATUS);
1418 VOID        WINAPI GetSystemTime(LPSYSTEMTIME);
1419 VOID        WINAPI GetSystemTimeAsFileTime(LPFILETIME);
1420 DWORD       WINAPI GetTapeParameters(HANDLE,DWORD,LPDWORD,LPVOID);
1421 DWORD       WINAPI GetTapePosition(HANDLE,DWORD,LPDWORD,LPDWORD,LPDWORD);
1422 DWORD       WINAPI GetTapeStatus(HANDLE);
1423 INT         WINAPI GetTimeFormatA(LCID,DWORD,LPSYSTEMTIME,LPCSTR,LPSTR,INT);
1424 INT         WINAPI GetTimeFormatW(LCID,DWORD,LPSYSTEMTIME,LPCWSTR,LPWSTR,INT);
1425 #define     GetTimeFormat WINELIB_NAME_AW(GetTimeFormat)
1426 DWORD       WINAPI GetTimeZoneInformation(LPTIME_ZONE_INFORMATION);
1427 BOOL        WINAPI GetThreadContext(HANDLE,CONTEXT *);
1428 LCID        WINAPI GetThreadLocale(void);
1429 INT       WINAPI GetThreadPriority(HANDLE);
1430 BOOL        WINAPI GetThreadPriorityBoost(HANDLE,PBOOL);
1431 BOOL      WINAPI GetThreadSelectorEntry(HANDLE,DWORD,LPLDT_ENTRY);
1432 BOOL        WINAPI GetThreadTimes(HANDLE,LPFILETIME,LPFILETIME,LPFILETIME,LPFILETIME);
1433 BOOL        WINAPI GetTokenInformation(HANDLE,TOKEN_INFORMATION_CLASS,LPVOID,DWORD,LPDWORD);
1434 BOOL        WINAPI GetUserNameA(LPSTR,LPDWORD);
1435 BOOL        WINAPI GetUserNameW(LPWSTR,LPDWORD);
1436 #define     GetUserName WINELIB_NAME_AW(GetUserName)
1437 VOID        WINAPI GlobalMemoryStatus(LPMEMORYSTATUS);
1438 LPVOID      WINAPI HeapAlloc(HANDLE,DWORD,DWORD);
1439 DWORD       WINAPI HeapCompact(HANDLE,DWORD);
1440 HANDLE    WINAPI HeapCreate(DWORD,DWORD,DWORD);
1441 BOOL      WINAPI HeapDestroy(HANDLE);
1442 BOOL      WINAPI HeapFree(HANDLE,DWORD,LPVOID);
1443 BOOL      WINAPI HeapLock(HANDLE);
1444 LPVOID      WINAPI HeapReAlloc(HANDLE,DWORD,LPVOID,DWORD);
1445 DWORD       WINAPI HeapSize(HANDLE,DWORD,LPVOID);
1446 BOOL      WINAPI HeapUnlock(HANDLE);
1447 BOOL      WINAPI HeapValidate(HANDLE,DWORD,LPCVOID);
1448 BOOL        WINAPI HeapWalk(HANDLE,LPPROCESS_HEAP_ENTRY);
1449 DWORD       WINAPI InitializeAcl(PACL,DWORD,DWORD);
1450 BOOL        WINAPI InitializeSecurityDescriptor(PSECURITY_DESCRIPTOR,DWORD);
1451 BOOL        WINAPI InitializeSid(PSID,PSID_IDENTIFIER_AUTHORITY,BYTE);
1452 BOOL        WINAPI IsTextUnicode(CONST LPVOID lpBuffer, int cb, LPINT lpi);
1453 BOOL        WINAPI IsValidSecurityDescriptor(PSECURITY_DESCRIPTOR);
1454 BOOL        WINAPI IsValidSid(PSID);
1455 BOOL        WINAPI ImpersonateSelf(SECURITY_IMPERSONATION_LEVEL);
1456 BOOL        WINAPI IsDBCSLeadByteEx(UINT,BYTE);
1457 BOOL        WINAPI IsProcessorFeaturePresent(DWORD);
1458 BOOL        WINAPI IsValidLocale(DWORD,DWORD);
1459 BOOL        WINAPI LookupAccountSidA(LPCSTR,PSID,LPSTR,LPDWORD,LPSTR,LPDWORD,PSID_NAME_USE);
1460 BOOL        WINAPI LookupAccountSidW(LPCWSTR,PSID,LPWSTR,LPDWORD,LPWSTR,LPDWORD,PSID_NAME_USE);
1461 #define     LookupAccountSid WINELIB_NAME_AW(LookupAccountSid)
1462 BOOL        WINAPI LocalFileTimeToFileTime(const FILETIME*,LPFILETIME);
1463 BOOL        WINAPI LockFile(HANDLE,DWORD,DWORD,DWORD,DWORD);
1464 BOOL        WINAPI LockFileEx(HANDLE, DWORD, DWORD, DWORD, DWORD, LPOVERLAPPED);    
1465 BOOL        WINAPI LookupPrivilegeValueA(LPCSTR,LPCSTR,LPVOID);
1466 BOOL        WINAPI LookupPrivilegeValueW(LPCWSTR,LPCWSTR,LPVOID);
1467 #define     LookupPrivilegeValue WINELIB_NAME_AW(LookupPrivilegeValue)
1468 BOOL        WINAPI MakeSelfRelativeSD(PSECURITY_DESCRIPTOR,PSECURITY_DESCRIPTOR,LPDWORD);
1469 HMODULE     WINAPI MapHModuleSL(WORD);
1470 WORD        WINAPI MapHModuleLS(HMODULE);
1471 SEGPTR      WINAPI MapLS(LPVOID);
1472 LPVOID      WINAPI MapSL(SEGPTR);
1473 LPVOID      WINAPI MapViewOfFile(HANDLE,DWORD,DWORD,DWORD,DWORD);
1474 LPVOID      WINAPI MapViewOfFileEx(HANDLE,DWORD,DWORD,DWORD,DWORD,LPVOID);
1475 BOOL      WINAPI MoveFileA(LPCSTR,LPCSTR);
1476 BOOL      WINAPI MoveFileW(LPCWSTR,LPCWSTR);
1477 #define     MoveFile WINELIB_NAME_AW(MoveFile)
1478 BOOL      WINAPI MoveFileExA(LPCSTR,LPCSTR,DWORD);
1479 BOOL      WINAPI MoveFileExW(LPCWSTR,LPCWSTR,DWORD);
1480 #define     MoveFileEx WINELIB_NAME_AW(MoveFileEx)
1481 INT       WINAPI MultiByteToWideChar(UINT,DWORD,LPCSTR,INT,LPWSTR,INT);
1482 BOOL        WINAPI NotifyChangeEventLog(HANDLE,HANDLE);
1483 INT       WINAPI WideCharToMultiByte(UINT,DWORD,LPCWSTR,INT,LPSTR,INT,LPCSTR,BOOL*);
1484 HANDLE      WINAPI OpenBackupEventLogA(LPCSTR,LPCSTR);
1485 HANDLE      WINAPI OpenBackupEventLogW(LPCWSTR,LPCWSTR);
1486 #define     OpenBackupEventLog WINELIB_NAME_AW(OpenBackupEventLog)
1487 HANDLE    WINAPI OpenEventA(DWORD,BOOL,LPCSTR);
1488 HANDLE    WINAPI OpenEventW(DWORD,BOOL,LPCWSTR);
1489 #define     OpenEvent WINELIB_NAME_AW(OpenEvent)
1490 HANDLE      WINAPI OpenEventLogA(LPCSTR,LPCSTR);
1491 HANDLE      WINAPI OpenEventLogW(LPCWSTR,LPCWSTR);
1492 #define     OpenEventLog WINELIB_NAME_AW(OpenEventLog)
1493 HANDLE    WINAPI OpenFileMappingA(DWORD,BOOL,LPCSTR);
1494 HANDLE    WINAPI OpenFileMappingW(DWORD,BOOL,LPCWSTR);
1495 #define     OpenFileMapping WINELIB_NAME_AW(OpenFileMapping)
1496 HANDLE    WINAPI OpenMutexA(DWORD,BOOL,LPCSTR);
1497 HANDLE    WINAPI OpenMutexW(DWORD,BOOL,LPCWSTR);
1498 #define     OpenMutex WINELIB_NAME_AW(OpenMutex)
1499 HANDLE    WINAPI OpenProcess(DWORD,BOOL,DWORD);
1500 BOOL        WINAPI OpenProcessToken(HANDLE,DWORD,PHANDLE);
1501 HANDLE    WINAPI OpenSemaphoreA(DWORD,BOOL,LPCSTR);
1502 HANDLE    WINAPI OpenSemaphoreW(DWORD,BOOL,LPCWSTR);
1503 #define     OpenSemaphore WINELIB_NAME_AW(OpenSemaphore)
1504 BOOL        WINAPI OpenThreadToken(HANDLE,DWORD,BOOL,PHANDLE);
1505 HANDLE      WINAPI OpenWaitableTimerA(DWORD,BOOL,LPCSTR);
1506 HANDLE      WINAPI OpenWaitableTimerW(DWORD,BOOL,LPCWSTR);
1507 #define     OpenWaitableTimer WINELIB_NAME_AW(OpenWaitableTimer)
1508 DWORD       WINAPI PrepareTape(HANDLE,DWORD,BOOL);
1509 BOOL        WINAPI PulseEvent(HANDLE);
1510 BOOL        WINAPI PurgeComm(HANDLE,DWORD);
1511 DWORD       WINAPI QueryDosDeviceA(LPCSTR,LPSTR,DWORD);
1512 DWORD       WINAPI QueryDosDeviceW(LPCWSTR,LPWSTR,DWORD);
1513 #define     QueryDosDevice WINELIB_NAME_AW(QueryDosDevice)
1514 BOOL        WINAPI QueryPerformanceCounter(LARGE_INTEGER*);
1515 BOOL        WINAPI QueryPerformanceFrequency(LARGE_INTEGER*);
1516 BOOL      WINAPI ReadConsoleA(HANDLE,LPVOID,DWORD,LPDWORD,LPVOID);
1517 BOOL      WINAPI ReadConsoleW(HANDLE,LPVOID,DWORD,LPDWORD,LPVOID);
1518 #define     ReadConsole WINELIB_NAME_AW(ReadConsole)
1519 BOOL        WINAPI ReadEventLogA(HANDLE,DWORD,DWORD,LPVOID,DWORD,DWORD *,DWORD *);
1520 BOOL        WINAPI ReadEventLogW(HANDLE,DWORD,DWORD,LPVOID,DWORD,DWORD *,DWORD *);
1521 #define     ReadEventLog WINELIB_NAME_AW(ReadEventLog)
1522 BOOL      WINAPI ReadFile(HANDLE,LPVOID,DWORD,LPDWORD,LPOVERLAPPED);
1523 HANDLE      WINAPI RegisterEventSourceA(LPCSTR,LPCSTR);
1524 HANDLE      WINAPI RegisterEventSourceW(LPCWSTR,LPCWSTR);
1525 #define     RegisterEventSource WINELIB_NAME_AW(RegisterEventSource)
1526 BOOL      WINAPI ReleaseMutex(HANDLE);
1527 BOOL      WINAPI ReleaseSemaphore(HANDLE,LONG,LPLONG);
1528 BOOL        WINAPI ReportEventA(HANDLE,WORD,WORD,DWORD,PSID,WORD,DWORD,LPCSTR *,LPVOID);
1529 BOOL        WINAPI ReportEventW(HANDLE,WORD,WORD,DWORD,PSID,WORD,DWORD,LPCWSTR *,LPVOID);
1530 #define     ReportEvent WINELIB_NAME_AW(ReportEvent)
1531 BOOL      WINAPI ResetEvent(HANDLE);
1532 DWORD       WINAPI ResumeThread(HANDLE);
1533 BOOL        WINAPI RevertToSelf(void);
1534 DWORD       WINAPI SearchPathA(LPCSTR,LPCSTR,LPCSTR,DWORD,LPSTR,LPSTR*);
1535 DWORD       WINAPI SearchPathW(LPCWSTR,LPCWSTR,LPCWSTR,DWORD,LPWSTR,LPWSTR*);
1536 #define     SearchPath WINELIB_NAME_AW(SearchPath)
1537 BOOL        WINAPI SetCommConfig(HANDLE,LPCOMMCONFIG);
1538 BOOL        WINAPI SetCommMask(HANDLE,DWORD);
1539 BOOL        WINAPI SetCommState(HANDLE,LPDCB);
1540 BOOL        WINAPI SetCommTimeouts(HANDLE,LPCOMMTIMEOUTS);
1541 BOOL      WINAPI SetComputerNameA(LPCSTR);
1542 BOOL      WINAPI SetComputerNameW(LPCWSTR);
1543 #define     SetComputerName WINELIB_NAME_AW(SetComputerName)
1544 BOOL      WINAPI SetConsoleMode(HANDLE,DWORD);
1545 BOOL      WINAPI SetConsoleTitleA(LPCSTR);
1546 BOOL      WINAPI SetConsoleTitleW(LPCWSTR);
1547 #define     SetConsoleTitle WINELIB_NAME_AW(SetConsoleTitle)
1548 BOOL        WINAPI SetDefaultCommConfigA(LPCSTR,LPCOMMCONFIG,DWORD);
1549 BOOL        WINAPI SetDefaultCommConfigW(LPCWSTR,LPCOMMCONFIG,DWORD);
1550 #define     SetDefaultCommConfig WINELIB_NAME_AW(SetDefaultCommConfig)
1551 BOOL      WINAPI SetEndOfFile(HANDLE);
1552 BOOL      WINAPI SetEnvironmentVariableA(LPCSTR,LPCSTR);
1553 BOOL      WINAPI SetEnvironmentVariableW(LPCWSTR,LPCWSTR);
1554 #define     SetEnvironmentVariable WINELIB_NAME_AW(SetEnvironmentVariable)
1555 BOOL      WINAPI SetEvent(HANDLE);
1556 VOID        WINAPI SetFileApisToANSI(void);
1557 VOID        WINAPI SetFileApisToOEM(void);
1558 DWORD       WINAPI SetFilePointer(HANDLE,LONG,LPLONG,DWORD);
1559 BOOL        WINAPI SetFileSecurityA(LPCSTR,SECURITY_INFORMATION,PSECURITY_DESCRIPTOR);
1560 BOOL        WINAPI SetFileSecurityW(LPCWSTR,SECURITY_INFORMATION,PSECURITY_DESCRIPTOR);
1561 #define     SetFileSecurity WINELIB_NAME_AW(SetFileSecurity)
1562 BOOL        WINAPI SetFileTime(HANDLE,const FILETIME*,const FILETIME*,const FILETIME*);
1563 BOOL        WINAPI SetHandleInformation(HANDLE,DWORD,DWORD);
1564 BOOL        WINAPI SetKernelObjectSecurity(HANDLE,SECURITY_INFORMATION,PSECURITY_DESCRIPTOR);
1565 BOOL        WINAPI SetPriorityClass(HANDLE,DWORD);
1566 BOOL        WINAPI SetLocalTime(const SYSTEMTIME*);
1567 BOOL        WINAPI SetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR,BOOL,PACL,BOOL);
1568 BOOL        WINAPI SetSecurityDescriptorGroup(PSECURITY_DESCRIPTOR,PSID,BOOL);
1569 BOOL        WINAPI SetSecurityDescriptorOwner(PSECURITY_DESCRIPTOR,PSID,BOOL);
1570 BOOL        WINAPI SetSecurityDescriptorSacl(PSECURITY_DESCRIPTOR,BOOL,PACL,BOOL);
1571 BOOL      WINAPI SetStdHandle(DWORD,HANDLE);
1572 BOOL      WINAPI SetSystemPowerState(BOOL,BOOL);
1573 BOOL      WINAPI SetSystemTime(const SYSTEMTIME*);
1574 DWORD       WINAPI SetTapeParameters(HANDLE,DWORD,LPVOID);
1575 DWORD       WINAPI SetTapePosition(HANDLE,DWORD,DWORD,DWORD,DWORD,BOOL);
1576 DWORD       WINAPI SetThreadAffinityMask(HANDLE,DWORD);
1577 BOOL        WINAPI SetThreadContext(HANDLE,const CONTEXT *);
1578 BOOL        WINAPI SetThreadLocale(LCID);
1579 BOOL        WINAPI SetThreadPriority(HANDLE,INT);
1580 BOOL        WINAPI SetThreadPriorityBoost(HANDLE,BOOL);
1581 BOOL        WINAPI SetThreadToken(PHANDLE,HANDLE);
1582 BOOL        WINAPI SetTimeZoneInformation(const LPTIME_ZONE_INFORMATION);
1583 BOOL        WINAPI SetWaitableTimer(HANDLE,const LARGE_INTEGER*,LONG,PTIMERAPCROUTINE,LPVOID,BOOL);
1584 BOOL        WINAPI SetupComm(HANDLE,DWORD,DWORD);
1585 VOID        WINAPI Sleep(DWORD);
1586 DWORD       WINAPI SleepEx(DWORD,BOOL);
1587 DWORD       WINAPI SuspendThread(HANDLE);
1588 BOOL        WINAPI SystemTimeToFileTime(const SYSTEMTIME*,LPFILETIME);
1589 DWORD       WINAPI TlsAlloc(void);
1590 BOOL        WINAPI TlsFree(DWORD);
1591 LPVOID      WINAPI TlsGetValue(DWORD);
1592 BOOL        WINAPI TlsSetValue(DWORD,LPVOID);
1593 BOOL        WINAPI TransmitCommChar(HANDLE,CHAR);
1594 VOID        WINAPI UnMapLS(SEGPTR);
1595 BOOL        WINAPI UnlockFile(HANDLE,DWORD,DWORD,DWORD,DWORD);
1596 BOOL        WINAPI UnmapViewOfFile(LPVOID);
1597 LPVOID      WINAPI VirtualAlloc(LPVOID,DWORD,DWORD,DWORD);
1598 LPVOID      WINAPI VirtualAllocEx(HANDLE,LPVOID,DWORD,DWORD,DWORD);
1599 BOOL      WINAPI VirtualFree(LPVOID,DWORD,DWORD);
1600 BOOL      WINAPI VirtualLock(LPVOID,DWORD);
1601 BOOL      WINAPI VirtualProtect(LPVOID,DWORD,DWORD,LPDWORD);
1602 BOOL      WINAPI VirtualProtectEx(HANDLE,LPVOID,DWORD,DWORD,LPDWORD);
1603 DWORD       WINAPI VirtualQuery(LPCVOID,LPMEMORY_BASIC_INFORMATION,DWORD);
1604 DWORD       WINAPI VirtualQueryEx(HANDLE,LPCVOID,LPMEMORY_BASIC_INFORMATION,DWORD);
1605 BOOL      WINAPI VirtualUnlock(LPVOID,DWORD);
1606 BOOL      WINAPI WaitCommEvent(HANDLE,LPDWORD,LPOVERLAPPED);
1607 BOOL      WINAPI WaitForDebugEvent(LPDEBUG_EVENT,DWORD);
1608 DWORD       WINAPI WaitForMultipleObjects(DWORD,const HANDLE*,BOOL,DWORD);
1609 DWORD       WINAPI WaitForMultipleObjectsEx(DWORD,const HANDLE*,BOOL,DWORD,BOOL);
1610 DWORD       WINAPI WaitForSingleObject(HANDLE,DWORD);
1611 DWORD       WINAPI WaitForSingleObjectEx(HANDLE,DWORD,BOOL);
1612 BOOL      WINAPI WriteConsoleA(HANDLE,LPCVOID,DWORD,LPDWORD,LPVOID);
1613 BOOL      WINAPI WriteConsoleW(HANDLE,LPCVOID,DWORD,LPDWORD,LPVOID);
1614 #define     WriteConsole WINELIB_NAME_AW(WriteConsole)
1615 BOOL      WINAPI WriteFile(HANDLE,LPCVOID,DWORD,LPDWORD,LPOVERLAPPED);
1616 BOOL        WINAPI WriteFileEx(HANDLE,LPCVOID,DWORD,LPOVERLAPPED,LPOVERLAPPED_COMPLETION_ROUTINE);
1617 DWORD       WINAPI WriteTapemark(HANDLE,DWORD,DWORD,BOOL);
1618 LANGID      WINAPI GetSystemDefaultLangID(void);
1619 LCID        WINAPI GetSystemDefaultLCID(void);
1620 LANGID      WINAPI GetUserDefaultLangID(void);
1621 LCID        WINAPI GetUserDefaultLCID(void);
1622 ATOM        WINAPI AddAtomA(LPCSTR);
1623 ATOM        WINAPI AddAtomW(LPCWSTR);
1624 #define     AddAtom WINELIB_NAME_AW(AddAtom)
1625 UINT      WINAPI CompareStringA(DWORD,DWORD,LPCSTR,DWORD,LPCSTR,DWORD);
1626 UINT      WINAPI CompareStringW(DWORD,DWORD,LPCWSTR,DWORD,LPCWSTR,DWORD);
1627 #define     CompareString WINELIB_NAME_AW(CompareString)
1628 BOOL      WINAPI CreateDirectoryA(LPCSTR,LPSECURITY_ATTRIBUTES);
1629 BOOL      WINAPI CreateDirectoryW(LPCWSTR,LPSECURITY_ATTRIBUTES);
1630 #define     CreateDirectory WINELIB_NAME_AW(CreateDirectory)
1631 BOOL      WINAPI CreateDirectoryExA(LPCSTR,LPCSTR,LPSECURITY_ATTRIBUTES);
1632 BOOL      WINAPI CreateDirectoryExW(LPCWSTR,LPCWSTR,LPSECURITY_ATTRIBUTES);
1633 #define     CreateDirectoryEx WINELIB_NAME_AW(CreateDirectoryEx)
1634 BOOL        WINAPI DefineDosDeviceA(DWORD,LPCSTR,LPCSTR);
1635 #define     DefineHandleTable(w) ((w),TRUE)
1636 ATOM        WINAPI DeleteAtom(ATOM);
1637 BOOL      WINAPI DeleteFileA(LPCSTR);
1638 BOOL      WINAPI DeleteFileW(LPCWSTR);
1639 #define     DeleteFile WINELIB_NAME_AW(DeleteFile)
1640 void        WINAPI FatalAppExitA(UINT,LPCSTR);
1641 void        WINAPI FatalAppExitW(UINT,LPCWSTR);
1642 #define     FatalAppExit WINELIB_NAME_AW(FatalAppExit)
1643 ATOM        WINAPI FindAtomA(LPCSTR);
1644 ATOM        WINAPI FindAtomW(LPCWSTR);
1645 #define     FindAtom WINELIB_NAME_AW(FindAtom)
1646 BOOL        WINAPI FindClose(HANDLE);
1647 HANDLE      WINAPI FindFirstFileA(LPCSTR,LPWIN32_FIND_DATAA);
1648 HANDLE      WINAPI FindFirstFileW(LPCWSTR,LPWIN32_FIND_DATAW);
1649 #define     FindFirstFile WINELIB_NAME_AW(FindFirstFile)
1650 HANDLE      WINAPI FindFirstFileExA(LPCSTR,FINDEX_INFO_LEVELS,LPVOID,FINDEX_SEARCH_OPS,LPVOID,DWORD);
1651 HANDLE      WINAPI FindFirstFileExW(LPCWSTR,FINDEX_INFO_LEVELS,LPVOID,FINDEX_SEARCH_OPS,LPVOID,DWORD);
1652 #define     FindFirstFileEx WINELIB_NAME_AW(FindFirstFileEx)
1653 BOOL        WINAPI FindNextFileA(HANDLE,LPWIN32_FIND_DATAA);
1654 BOOL        WINAPI FindNextFileW(HANDLE,LPWIN32_FIND_DATAW);
1655 #define     FindNextFile WINELIB_NAME_AW(FindNextFile)
1656 HRSRC     WINAPI FindResourceA(HMODULE,LPCSTR,LPCSTR);
1657 HRSRC     WINAPI FindResourceW(HMODULE,LPCWSTR,LPCWSTR);
1658 #define     FindResource WINELIB_NAME_AW(FindResource)
1659 BOOL        WINAPI FreeLibrary(HMODULE);
1660 #define     FreeModule(handle) FreeLibrary(handle)
1661 #define     FreeProcInstance(proc) /*nothing*/
1662 BOOL      WINAPI FreeResource(HGLOBAL);
1663 UINT      WINAPI GetAtomNameA(ATOM,LPSTR,INT);
1664 UINT      WINAPI GetAtomNameW(ATOM,LPWSTR,INT);
1665 #define     GetAtomName WINELIB_NAME_AW(GetAtomName)
1666 UINT      WINAPI GetCurrentDirectoryA(UINT,LPSTR);
1667 UINT      WINAPI GetCurrentDirectoryW(UINT,LPWSTR);
1668 #define     GetCurrentDirectory WINELIB_NAME_AW(GetCurrentDirectory)
1669 #define     GetCurrentTime() GetTickCount()
1670 BOOL      WINAPI GetDiskFreeSpaceA(LPCSTR,LPDWORD,LPDWORD,LPDWORD,LPDWORD);
1671 BOOL      WINAPI GetDiskFreeSpaceW(LPCWSTR,LPDWORD,LPDWORD,LPDWORD,LPDWORD);
1672 #define     GetDiskFreeSpace WINELIB_NAME_AW(GetDiskFreeSpace)
1673 BOOL      WINAPI GetDiskFreeSpaceExA(LPCSTR,PULARGE_INTEGER,PULARGE_INTEGER,PULARGE_INTEGER);
1674 BOOL      WINAPI GetDiskFreeSpaceExW(LPCWSTR,PULARGE_INTEGER,PULARGE_INTEGER,PULARGE_INTEGER);
1675 #define     GetDiskFreeSpaceEx WINELIB_NAME_AW(GetDiskFreeSpaceEx)
1676 UINT      WINAPI GetDriveTypeA(LPCSTR);
1677 UINT      WINAPI GetDriveTypeW(LPCWSTR);
1678 #define     GetDriveType WINELIB_NAME_AW(GetDriveType)
1679 BOOL        WINAPI GetExitCodeProcess(HANDLE,LPDWORD);
1680 DWORD       WINAPI GetFileAttributesA(LPCSTR);
1681 DWORD       WINAPI GetFileAttributesW(LPCWSTR);
1682 #define     GetFileAttributes WINELIB_NAME_AW(GetFileAttributes)
1683 #define     GetFreeSpace(w) (0x100000L)
1684 UINT      WINAPI GetLogicalDriveStringsA(UINT,LPSTR);
1685 UINT      WINAPI GetLogicalDriveStringsW(UINT,LPWSTR);
1686 #define     GetLogicalDriveStrings WINELIB_NAME_AW(GetLogicalDriveStrings)
1687 DWORD       WINAPI GetModuleFileNameA(HMODULE,LPSTR,DWORD);
1688 DWORD       WINAPI GetModuleFileNameW(HMODULE,LPWSTR,DWORD);
1689 #define     GetModuleFileName WINELIB_NAME_AW(GetModuleFileName)
1690 HMODULE     WINAPI GetModuleHandleA(LPCSTR);
1691 HMODULE     WINAPI GetModuleHandleW(LPCWSTR);
1692 #define     GetModuleHandle WINELIB_NAME_AW(GetModuleHandle)
1693 BOOL        WINAPI GetOverlappedResult(HANDLE,LPOVERLAPPED,LPDWORD,BOOL);
1694 UINT        WINAPI GetPrivateProfileIntA(LPCSTR,LPCSTR,INT,LPCSTR);
1695 UINT        WINAPI GetPrivateProfileIntW(LPCWSTR,LPCWSTR,INT,LPCWSTR);
1696 #define     GetPrivateProfileInt WINELIB_NAME_AW(GetPrivateProfileInt)
1697 INT         WINAPI GetPrivateProfileSectionA(LPCSTR,LPSTR,DWORD,LPCSTR);
1698 INT         WINAPI GetPrivateProfileSectionW(LPCWSTR,LPWSTR,DWORD,LPCWSTR);
1699 #define     GetPrivateProfileSection WINELIB_NAME_AW(GetPrivateProfileSection)
1700 DWORD       WINAPI GetPrivateProfileSectionNamesA(LPSTR,DWORD,LPCSTR);
1701 DWORD       WINAPI GetPrivateProfileSectionNamesW(LPWSTR,DWORD,LPCWSTR);
1702 #define     GetPrivateProfileSectionNames WINELIB_NAME_AW(GetPrivateProfileSectionNames)
1703 INT       WINAPI GetPrivateProfileStringA(LPCSTR,LPCSTR,LPCSTR,LPSTR,UINT,LPCSTR);
1704 INT       WINAPI GetPrivateProfileStringW(LPCWSTR,LPCWSTR,LPCWSTR,LPWSTR,UINT,LPCWSTR);
1705 #define     GetPrivateProfileString WINELIB_NAME_AW(GetPrivateProfileString)
1706 BOOL      WINAPI GetPrivateProfileStructA(LPCSTR,LPCSTR,LPVOID,UINT,LPCSTR);
1707 BOOL      WINAPI GetPrivateProfileStructW(LPCWSTR,LPCWSTR,LPVOID,UINT,LPCWSTR);
1708 #define     GetPrivateProfileStruct WINELIB_NAME_AW(GetPrivateProfileStruct)
1709 FARPROC   WINAPI GetProcAddress(HMODULE,LPCSTR);
1710 UINT      WINAPI GetProfileIntA(LPCSTR,LPCSTR,INT);
1711 UINT      WINAPI GetProfileIntW(LPCWSTR,LPCWSTR,INT);
1712 #define     GetProfileInt WINELIB_NAME_AW(GetProfileInt)
1713 INT       WINAPI GetProfileSectionA(LPCSTR,LPSTR,DWORD);
1714 INT       WINAPI GetProfileSectionW(LPCWSTR,LPWSTR,DWORD);
1715 #define     GetProfileSection WINELIB_NAME_AW(GetProfileSection)
1716 INT       WINAPI GetProfileStringA(LPCSTR,LPCSTR,LPCSTR,LPSTR,UINT);
1717 INT       WINAPI GetProfileStringW(LPCWSTR,LPCWSTR,LPCWSTR,LPWSTR,UINT);
1718 #define     GetProfileString WINELIB_NAME_AW(GetProfileString)
1719 VOID        WINAPI GetStartupInfoA(LPSTARTUPINFOA);
1720 VOID        WINAPI GetStartupInfoW(LPSTARTUPINFOW);
1721 #define     GetStartupInfo WINELIB_NAME_AW(GetStartupInfo)
1722 BOOL        WINAPI GetStringTypeA(LCID,DWORD,LPCSTR,INT,LPWORD);
1723 BOOL        WINAPI GetStringTypeW(DWORD,LPCWSTR,INT,LPWORD);
1724 UINT        WINAPI GetSystemDirectoryA(LPSTR,UINT);
1725 UINT        WINAPI GetSystemDirectoryW(LPWSTR,UINT);
1726 #define     GetSystemDirectory WINELIB_NAME_AW(GetSystemDirectory)
1727 DWORD       WINAPI GetTickCount(void);
1728 UINT        WINAPI GetTempFileNameA(LPCSTR,LPCSTR,UINT,LPSTR);
1729 UINT        WINAPI GetTempFileNameW(LPCWSTR,LPCWSTR,UINT,LPWSTR);
1730 #define     GetTempFileName WINELIB_NAME_AW(GetTempFileName)
1731 UINT      WINAPI GetTempPathA(UINT,LPSTR);
1732 UINT      WINAPI GetTempPathW(UINT,LPWSTR);
1733 #define     GetTempPath WINELIB_NAME_AW(GetTempPath)
1734 LONG        WINAPI GetVersion(void);
1735 BOOL      WINAPI GetVolumeInformationA(LPCSTR,LPSTR,DWORD,LPDWORD,LPDWORD,LPDWORD,LPSTR,DWORD);
1736 BOOL      WINAPI GetVolumeInformationW(LPCWSTR,LPWSTR,DWORD,LPDWORD,LPDWORD,LPDWORD,LPWSTR,DWORD);
1737 #define     GetVolumeInformation WINELIB_NAME_AW(GetVolumeInformation)
1738 UINT      WINAPI GetWindowsDirectoryA(LPSTR,UINT);
1739 UINT      WINAPI GetWindowsDirectoryW(LPWSTR,UINT);
1740 #define     GetWindowsDirectory WINELIB_NAME_AW(GetWindowsDirectory)
1741 ATOM        WINAPI GlobalAddAtomA(LPCSTR);
1742 ATOM        WINAPI GlobalAddAtomW(LPCWSTR);
1743 #define     GlobalAddAtom WINELIB_NAME_AW(GlobalAddAtom)
1744 HGLOBAL     WINAPI GlobalAlloc(UINT,DWORD);
1745 DWORD       WINAPI GlobalCompact(DWORD);
1746 ATOM        WINAPI GlobalDeleteAtom(ATOM);
1747 ATOM        WINAPI GlobalFindAtomA(LPCSTR);
1748 ATOM        WINAPI GlobalFindAtomW(LPCWSTR);
1749 #define     GlobalFindAtom WINELIB_NAME_AW(GlobalFindAtom)
1750 UINT        WINAPI GlobalFlags(HGLOBAL);
1751 HGLOBAL     WINAPI GlobalFree(HGLOBAL);
1752 UINT        WINAPI GlobalGetAtomNameA(ATOM,LPSTR,INT);
1753 UINT        WINAPI GlobalGetAtomNameW(ATOM,LPWSTR,INT);
1754 #define     GlobalGetAtomName WINELIB_NAME_AW(GlobalGetAtomName)
1755 HGLOBAL     WINAPI GlobalHandle(LPCVOID);
1756 VOID        WINAPI GlobalFix(HGLOBAL);
1757 LPVOID      WINAPI GlobalLock(HGLOBAL);
1758 HGLOBAL     WINAPI GlobalReAlloc(HGLOBAL,DWORD,UINT);
1759 DWORD       WINAPI GlobalSize(HGLOBAL);
1760 VOID        WINAPI GlobalUnfix(HGLOBAL);
1761 BOOL        WINAPI GlobalUnlock(HGLOBAL);
1762 BOOL        WINAPI GlobalUnWire(HGLOBAL);
1763 LPVOID      WINAPI GlobalWire(HGLOBAL);
1764 BOOL      WINAPI InitAtomTable(DWORD);
1765 BOOL      WINAPI IsBadCodePtr(FARPROC);
1766 BOOL      WINAPI IsBadHugeReadPtr(LPCVOID,UINT);
1767 BOOL      WINAPI IsBadHugeWritePtr(LPVOID,UINT);
1768 BOOL      WINAPI IsBadReadPtr(LPCVOID,UINT);
1769 BOOL      WINAPI IsBadStringPtrA(LPCSTR,UINT);
1770 BOOL      WINAPI IsBadStringPtrW(LPCWSTR,UINT);
1771 #define     IsBadStringPtr WINELIB_NAME_AW(IsBadStringPtr)
1772 BOOL        WINAPI IsBadWritePtr(LPVOID,UINT);
1773 BOOL        WINAPI IsDBCSLeadByte(BYTE);
1774 BOOL        WINAPI IsDebuggerPresent(void);
1775 HMODULE     WINAPI LoadLibraryA(LPCSTR);
1776 HMODULE     WINAPI LoadLibraryW(LPCWSTR);
1777 #define     LoadLibrary WINELIB_NAME_AW(LoadLibrary)
1778 HMODULE     WINAPI LoadLibraryExA(LPCSTR,HANDLE,DWORD);
1779 HMODULE     WINAPI LoadLibraryExW(LPCWSTR,HANDLE,DWORD);
1780 #define     LoadLibraryEx WINELIB_NAME_AW(LoadLibraryEx)
1781 HINSTANCE WINAPI LoadModule(LPCSTR,LPVOID);
1782 HGLOBAL   WINAPI LoadResource(HMODULE,HRSRC);
1783 HLOCAL    WINAPI LocalAlloc(UINT,DWORD);
1784 UINT      WINAPI LocalCompact(UINT);
1785 UINT      WINAPI LocalFlags(HLOCAL);
1786 HLOCAL    WINAPI LocalFree(HLOCAL);
1787 HLOCAL    WINAPI LocalHandle(LPCVOID);
1788 LPVOID      WINAPI LocalLock(HLOCAL);
1789 HLOCAL    WINAPI LocalReAlloc(HLOCAL,DWORD,UINT);
1790 UINT      WINAPI LocalShrink(HGLOBAL,UINT);
1791 UINT      WINAPI LocalSize(HLOCAL);
1792 BOOL      WINAPI LocalUnlock(HLOCAL);
1793 LPVOID      WINAPI LockResource(HGLOBAL);
1794 #define     LockSegment(handle) GlobalFix((HANDLE)(handle))
1795 #define     MakeProcInstance(proc,inst) (proc)
1796 HFILE       WINAPI OpenFile(LPCSTR,OFSTRUCT*,UINT);
1797 VOID        WINAPI OutputDebugStringA(LPCSTR);
1798 VOID        WINAPI OutputDebugStringW(LPCWSTR);
1799 #define     OutputDebugString WINELIB_NAME_AW(OutputDebugString)
1800 BOOL        WINAPI ReadProcessMemory(HANDLE, LPCVOID, LPVOID, DWORD, LPDWORD);
1801 BOOL        WINAPI RemoveDirectoryA(LPCSTR);
1802 BOOL        WINAPI RemoveDirectoryW(LPCWSTR);
1803 #define     RemoveDirectory WINELIB_NAME_AW(RemoveDirectory)
1804 BOOL      WINAPI SetCurrentDirectoryA(LPCSTR);
1805 BOOL      WINAPI SetCurrentDirectoryW(LPCWSTR);
1806 #define     SetCurrentDirectory WINELIB_NAME_AW(SetCurrentDirectory)
1807 UINT      WINAPI SetErrorMode(UINT);
1808 BOOL      WINAPI SetFileAttributesA(LPCSTR,DWORD);
1809 BOOL      WINAPI SetFileAttributesW(LPCWSTR,DWORD);
1810 #define     SetFileAttributes WINELIB_NAME_AW(SetFileAttributes)
1811 UINT      WINAPI SetHandleCount(UINT);
1812 #define     SetSwapAreaSize(w) (w)
1813 BOOL        WINAPI SetVolumeLabelA(LPCSTR,LPCSTR);
1814 BOOL        WINAPI SetVolumeLabelW(LPCWSTR,LPCWSTR);
1815 #define     SetVolumeLabel WINELIB_NAME_AW(SetVolumeLabel)
1816 DWORD       WINAPI SizeofResource(HMODULE,HRSRC);
1817 BOOL        WINAPI UnlockFileEx(HFILE,DWORD,DWORD,DWORD,LPOVERLAPPED);
1818 #define     UnlockSegment(handle) GlobalUnfix((HANDLE)(handle))
1819 BOOL      WINAPI WritePrivateProfileSectionA(LPCSTR,LPCSTR,LPCSTR);
1820 BOOL      WINAPI WritePrivateProfileSectionW(LPCWSTR,LPCWSTR,LPCWSTR);
1821 #define     WritePrivateProfileSection WINELIB_NAME_AW(WritePrivateProfileSection)
1822 BOOL      WINAPI WritePrivateProfileStringA(LPCSTR,LPCSTR,LPCSTR,LPCSTR);
1823 BOOL      WINAPI WritePrivateProfileStringW(LPCWSTR,LPCWSTR,LPCWSTR,LPCWSTR);
1824 #define     WritePrivateProfileString WINELIB_NAME_AW(WritePrivateProfileString)
1825 BOOL         WINAPI WriteProfileSectionA(LPCSTR,LPCSTR);
1826 BOOL         WINAPI WriteProfileSectionW(LPCWSTR,LPCWSTR);
1827 #define     WritePrivateProfileSection WINELIB_NAME_AW(WritePrivateProfileSection)
1828 BOOL      WINAPI WritePrivateProfileStructA(LPCSTR,LPCSTR,LPVOID,UINT,LPCSTR);
1829 BOOL      WINAPI WritePrivateProfileStructW(LPCWSTR,LPCWSTR,LPVOID,UINT,LPCWSTR);
1830 #define     WritePrivateProfileStruct WINELIB_NAME_AW(WritePrivateProfileStruct)
1831 BOOL        WINAPI WriteProcessMemory(HANDLE, LPVOID, LPVOID, DWORD, LPDWORD);
1832 BOOL        WINAPI WriteProfileStringA(LPCSTR,LPCSTR,LPCSTR);
1833 BOOL        WINAPI WriteProfileStringW(LPCWSTR,LPCWSTR,LPCWSTR);
1834 #define     WriteProfileString WINELIB_NAME_AW(WriteProfileString)
1835 #define     Yield32()
1836 LPSTR       WINAPI lstrcatA(LPSTR,LPCSTR);
1837 LPWSTR      WINAPI lstrcatW(LPWSTR,LPCWSTR);
1838 #define     lstrcat WINELIB_NAME_AW(lstrcat)
1839 LPSTR       WINAPI lstrcpyA(LPSTR,LPCSTR);
1840 LPWSTR      WINAPI lstrcpyW(LPWSTR,LPCWSTR);
1841 #define     lstrcpy WINELIB_NAME_AW(lstrcpy)
1842 LPSTR       WINAPI lstrcpynA(LPSTR,LPCSTR,INT);
1843 LPWSTR      WINAPI lstrcpynW(LPWSTR,LPCWSTR,INT);
1844 #define     lstrcpyn WINELIB_NAME_AW(lstrcpyn)
1845 INT       WINAPI lstrlenA(LPCSTR);
1846 INT       WINAPI lstrlenW(LPCWSTR);
1847 #define     lstrlen WINELIB_NAME_AW(lstrlen)
1848 HINSTANCE WINAPI WinExec(LPCSTR,UINT);
1849 LONG        WINAPI _hread(HFILE,LPVOID,LONG);
1850 LONG        WINAPI _hwrite(HFILE,LPCSTR,LONG);
1851 HFILE     WINAPI _lcreat(LPCSTR,INT);
1852 HFILE     WINAPI _lclose(HFILE);
1853 LONG        WINAPI _llseek(HFILE,LONG,INT);
1854 HFILE     WINAPI _lopen(LPCSTR,INT);
1855 UINT      WINAPI _lread(HFILE,LPVOID,UINT);
1856 UINT      WINAPI _lwrite(HFILE,LPCSTR,UINT);
1857 INT       WINAPI lstrcmpA(LPCSTR,LPCSTR);
1858 INT       WINAPI lstrcmpW(LPCWSTR,LPCWSTR);
1859 #define     lstrcmp WINELIB_NAME_AW(lstrcmp)
1860 INT       WINAPI lstrcmpiA(LPCSTR,LPCSTR);
1861 INT       WINAPI lstrcmpiW(LPCWSTR,LPCWSTR);
1862 #define     lstrcmpi WINELIB_NAME_AW(lstrcmpi)
1863
1864 /* compatibility macros */
1865 #define     FillMemory RtlFillMemory
1866 #define     MoveMemory RtlMoveMemory
1867 #define     ZeroMemory RtlZeroMemory
1868 #define     CopyMemory RtlCopyMemory
1869
1870 /* a few optimizations for i386/gcc */
1871
1872 #if defined(__i386__) && defined(__GNUC__)
1873
1874 extern inline PVOID WINAPI InterlockedCompareExchange( PVOID *dest, PVOID xchg, PVOID compare );
1875 extern inline PVOID WINAPI InterlockedCompareExchange( PVOID *dest, PVOID xchg, PVOID compare )
1876 {
1877     PVOID ret;
1878     __asm__ __volatile__( "lock; cmpxchgl %2,(%1)"
1879                           : "=a" (ret) : "r" (dest), "r" (xchg), "0" (compare) : "memory" );
1880     return ret;
1881 }
1882
1883 extern inline LONG WINAPI InterlockedExchange( PLONG dest, LONG val );
1884 extern inline LONG WINAPI InterlockedExchange( PLONG dest, LONG val )
1885 {
1886     LONG ret;
1887     __asm__ __volatile__( "lock; xchgl %0,(%1)"
1888                           : "=r" (ret) :"r" (dest), "0" (val) : "memory" );
1889     return ret;
1890 }
1891
1892 extern inline LONG WINAPI InterlockedExchangeAdd( PLONG dest, LONG incr );
1893 extern inline LONG WINAPI InterlockedExchangeAdd( PLONG dest, LONG incr )
1894 {
1895     LONG ret;
1896     __asm__ __volatile__( "lock; xaddl %0,(%1)"
1897                           : "=r" (ret) : "r" (dest), "0" (incr) : "memory" );
1898     return ret;
1899 }
1900
1901 extern inline LONG WINAPI InterlockedIncrement( PLONG dest );
1902 extern inline LONG WINAPI InterlockedIncrement( PLONG dest )
1903 {
1904     return InterlockedExchangeAdd( dest, 1 ) + 1;
1905 }
1906
1907 extern inline LONG WINAPI InterlockedDecrement( PLONG dest );
1908 extern inline LONG WINAPI InterlockedDecrement( PLONG dest )
1909 {
1910     return InterlockedExchangeAdd( dest, -1 ) - 1;
1911 }
1912
1913 extern inline DWORD WINAPI GetLastError(void);
1914 extern inline DWORD WINAPI GetLastError(void)
1915 {
1916     DWORD ret;
1917     __asm__ __volatile__( ".byte 0x64\n\tmovl 0x60,%0" : "=r" (ret) );
1918     return ret;
1919 }
1920
1921 extern inline DWORD WINAPI GetCurrentProcessId(void);
1922 extern inline DWORD WINAPI GetCurrentProcessId(void)
1923 {
1924     DWORD ret;
1925     __asm__ __volatile__( ".byte 0x64\n\tmovl 0x20,%0" : "=r" (ret) );
1926     return ret;
1927 }
1928
1929 extern inline DWORD WINAPI GetCurrentThreadId(void);
1930 extern inline DWORD WINAPI GetCurrentThreadId(void)
1931 {
1932     DWORD ret;
1933     __asm__ __volatile__( ".byte 0x64\n\tmovl 0x24,%0" : "=r" (ret) );
1934     return ret;
1935 }
1936
1937 extern inline void WINAPI SetLastError( DWORD err );
1938 extern inline void WINAPI SetLastError( DWORD err )
1939 {
1940     __asm__ __volatile__( ".byte 0x64\n\tmovl %0,0x60" : : "r" (err) : "memory" );
1941 }
1942
1943 extern inline HANDLE WINAPI GetProcessHeap(void);
1944 extern inline HANDLE WINAPI GetProcessHeap(void)
1945 {
1946     HANDLE *pdb;
1947     __asm__ __volatile__( ".byte 0x64\n\tmovl 0x30,%0" : "=r" (pdb) );
1948     return pdb[0x18 / sizeof(HANDLE)];  /* get dword at offset 0x18 in pdb */
1949 }
1950
1951 #else  /* __i386__ && __GNUC__ */
1952 DWORD       WINAPI GetCurrentProcessId(void);
1953 DWORD       WINAPI GetCurrentThreadId(void);
1954 DWORD       WINAPI GetLastError(void);
1955 HANDLE      WINAPI GetProcessHeap(void);
1956 PVOID       WINAPI InterlockedCompareExchange(PVOID*,PVOID,PVOID);
1957 LONG        WINAPI InterlockedDecrement(PLONG);
1958 LONG        WINAPI InterlockedExchange(PLONG,LONG);
1959 LONG        WINAPI InterlockedExchangeAdd(PLONG,LONG);
1960 LONG        WINAPI InterlockedIncrement(PLONG);
1961 VOID        WINAPI SetLastError(DWORD);
1962 #endif  /* __i386__ && __GNUC__ */
1963
1964 #ifdef __WINE__
1965 #define GetCurrentProcess() ((HANDLE)0xffffffff)
1966 #define GetCurrentThread()  ((HANDLE)0xfffffffe)
1967 #endif
1968
1969 /* WinMain(entry point) must be declared in winbase.h. */
1970 /* If this is not declared, we cannot compile many sources written with C++. */
1971 int WINAPI WinMain(HINSTANCE,HINSTANCE,LPSTR,int);
1972
1973 #ifdef __cplusplus
1974 }
1975 #endif
1976
1977 #endif  /* __WINE_WINBASE_H */