1 #ifndef __WINE_CRTDLL_H
2 #define __WINE_CRTDLL_H
6 #include "wine/windef16.h"
7 #include "debugtools.h"
16 #define CRTDLL_LC_ALL 0
17 #define CRTDLL_LC_COLLATE 1
18 #define CRTDLL_LC_CTYPE 2
19 #define CRTDLL_LC_MONETARY 3
20 #define CRTDLL_LC_NUMERIC 4
21 #define CRTDLL_LC_TIME 5
22 #define CRTDLL_LC_MIN LC_ALL
23 #define CRTDLL_LC_MAX LC_TIME
26 #define CRTDLL_UPPER 0x1
27 #define CRTDLL_LOWER 0x2
28 #define CRTDLL_DIGIT 0x4
29 #define CRTDLL_SPACE 0x8
30 #define CRTDLL_PUNCT 0x10
31 #define CRTDLL_CONTROL 0x20
32 #define CRTDLL_BLANK 0x40
33 #define CRTDLL_HEX 0x80
34 #define CRTDLL_LEADBYTE 0x8000
35 #define CRTDLL_ALPHA (0x0100|CRTDLL_UPPER|CRTDLL_LOWER)
37 /* stat() mode bits */
38 #define _S_IFMT 0170000
39 #define _S_IFREG 0100000
40 #define _S_IFDIR 0040000
41 #define _S_IFCHR 0020000
42 #define _S_IFIFO 0010000
43 #define _S_IREAD 0000400
44 #define _S_IWRITE 0000200
45 #define _S_IEXEC 0000100
48 #define _O_RDONLY 0x0000
49 #define _O_WRONLY 0x0001
50 #define _O_RDWR 0x0002
51 #define _O_APPEND 0x0008
52 #define _O_CREAT 0x0100
53 #define _O_TRUNC 0x0200
54 #define _O_EXCL 0x0400
55 #define _O_TEXT 0x4000
56 #define _O_BINARY 0x8000
58 /* _access() bit flags FIXME: incomplete */
61 /* windows.h RAND_MAX is smaller than normal RAND_MAX */
62 #define CRTDLL_RAND_MAX 0x7fff
64 /* heap function constants */
67 #define _HEAPBADBEGIN -3
68 #define _HEAPBADNODE -4
70 #define _HEAPBADPTR -6
74 /* fpclass constants */
75 #define _FPCLASS_SNAN 1
76 #define _FPCLASS_QNAN 2
77 #define _FPCLASS_NINF 4
79 #define _FPCLASS_ND 16
80 #define _FPCLASS_NZ 32
81 #define _FPCLASS_PZ 64
82 #define _FPCLASS_PD 128
83 #define _FPCLASS_PN 256
84 #define _FPCLASS_PINF 512
86 /* _statusfp bit flags */
87 #define _SW_INEXACT 0x1
88 #define _SW_UNDERFLOW 0x2
89 #define _SW_OVERFLOW 0x4
90 #define _SW_ZERODIVIDE 0x8
91 #define _SW_INVALID 0x10
92 #define _SW_DENORMAL 0x80000
94 /* _controlfp masks and bitflags - x86 only so far*/
96 #define _MCW_EM 0x8001f
97 #define _EM_INEXACT 0x1
98 #define _EM_UNDERFLOW 0x2
99 #define _EM_OVERFLOW 0x4
100 #define _EM_ZERODIVIDE 0x8
101 #define _EM_INVALID 0x10
103 #define _MCW_RC 0x300
105 #define _RC_DOWN 0x100
107 #define _RC_CHOP 0x300
109 #define _MCW_PC 0x30000
111 #define _PC_53 0x10000
112 #define _PC_24 0x20000
114 #define _MCW_IC 0x40000
115 #define _IC_AFFINE 0x40000
116 #define _IC_PROJECTIVE 0x0
118 #define _EM_DENORMAL 0x80000
123 extern INT CRTDLL_doserrno;
124 extern INT CRTDLL_errno;
127 /* Binary compatable structures, types and defines used
128 * by CRTDLL. These should move to external header files,
129 * and in some cases need be renamed (CRTDLL_FILE!) to defs
130 * as used by lcc/bcc/watcom/vc++ etc, in order to get source
131 * compatability for winelib.
134 typedef struct _crtfile
146 /* file._flag flags */
147 #define _IOREAD 0x0001
148 #define _IOWRT 0x0002
149 #define _IOEOF 0x0010
150 #define _IOERR 0x0020
152 #define _IOAPPEND 0x0200
160 extern CRTDLL_FILE __CRTDLL_iob[3];
162 #define CRTDLL_stdin (&__CRTDLL_iob[0])
163 #define CRTDLL_stdout (&__CRTDLL_iob[1])
164 #define CRTDLL_stderr (&__CRTDLL_iob[2])
166 typedef struct _find_t
169 time_t time_create; /* -1 when N/A */
170 time_t time_access; /* -1 when N/A */
172 unsigned long size; /* FIXME: 64 bit ??*/
176 typedef struct _diskfree_t {
177 unsigned num_clusters;
179 unsigned cluster_sectors;
180 unsigned sector_bytes;
214 typedef struct _heapinfo
227 /* _matherr exception type */
237 typedef VOID (*sig_handler_type)(VOID);
239 typedef VOID (*new_handler_type)(VOID);
241 typedef VOID (*_INITTERMFUN)();
243 typedef VOID (*atexit_function)(VOID);
245 typedef INT (__cdecl *comp_func)(LPCVOID, LPCVOID );
247 /* CRTDLL functions */
250 INT __cdecl CRTDLL__chdir( LPCSTR newdir );
251 BOOL __cdecl CRTDLL__chdrive( INT newdrive );
252 INT __cdecl CRTDLL__findclose( DWORD hand );
253 DWORD __cdecl CRTDLL__findfirst( LPCSTR fspec, find_t* ft );
254 INT __cdecl CRTDLL__findnext( DWORD hand, find_t * ft );
255 CHAR* __cdecl CRTDLL__getcwd( LPSTR buf, INT size );
256 CHAR* __cdecl CRTDLL__getdcwd( INT drive,LPSTR buf, INT size );
257 UINT __cdecl CRTDLL__getdiskfree( UINT disk, diskfree_t* d );
258 INT __cdecl CRTDLL__getdrive( VOID );
259 INT __cdecl CRTDLL__mkdir( LPCSTR newdir );
260 INT __cdecl CRTDLL__rmdir( LPSTR dir );
263 INT __cdecl CRTDLL__abnormal_termination( VOID );
264 VOID __cdecl CRTDLL__amsg_exit( INT err );
265 VOID __cdecl CRTDLL__assert( LPVOID str, LPVOID file, UINT line );
266 VOID __cdecl CRTDLL__c_exit( VOID );
267 VOID __cdecl CRTDLL__cexit( VOID );
268 void __cdecl CRTDLL_exit( DWORD ret );
269 VOID __cdecl CRTDLL__exit( LONG ret );
270 VOID __cdecl CRTDLL_abort( VOID );
271 INT __cdecl CRTDLL_atexit( atexit_function x );
272 atexit_function __cdecl CRTDLL__onexit( atexit_function func);
275 CRTDLL_FILE* __cdecl CRTDLL__iob( VOID );
276 CRTDLL_FILE* __cdecl CRTDLL__fsopen( LPCSTR path, LPCSTR mode, INT share );
277 CRTDLL_FILE* __cdecl CRTDLL__fdopen( INT fd, LPCSTR mode );
278 LPSTR __cdecl CRTDLL__mktemp( LPSTR pattern );
279 CRTDLL_FILE* __cdecl CRTDLL_fopen( LPCSTR path, LPCSTR mode );
280 CRTDLL_FILE* __cdecl CRTDLL_freopen( LPCSTR path,LPCSTR mode,CRTDLL_FILE* f );
281 INT __cdecl CRTDLL__fgetchar( VOID );
282 DWORD __cdecl CRTDLL_fread( LPVOID ptr,INT size,INT nmemb,CRTDLL_FILE* file );
283 INT __cdecl CRTDLL_fscanf( CRTDLL_FILE* stream, LPSTR format, ... );
284 INT __cdecl CRTDLL__filbuf( CRTDLL_FILE* file );
285 LONG __cdecl CRTDLL__filelength( INT fd );
286 INT __cdecl CRTDLL__fileno( CRTDLL_FILE* file );
287 INT __cdecl CRTDLL__flsbuf( INT c, CRTDLL_FILE* file );
288 INT __cdecl CRTDLL__fputchar( INT c );
289 INT __cdecl CRTDLL__flushall( VOID );
290 INT __cdecl CRTDLL__fcloseall( VOID );
291 LONG __cdecl CRTDLL__lseek( INT fd, LONG offset, INT whence );
292 LONG __cdecl CRTDLL_fseek( CRTDLL_FILE* file, LONG offset, INT whence );
293 VOID __cdecl CRTDLL_rewind( CRTDLL_FILE* file );
294 INT __cdecl CRTDLL_fsetpos( CRTDLL_FILE* file, fpos_t *pos );
295 LONG __cdecl CRTDLL_ftell( CRTDLL_FILE* file );
296 UINT __cdecl CRTDLL_fwrite( LPCVOID ptr,INT size,INT nmemb,CRTDLL_FILE*file);
297 INT __cdecl CRTDLL_setbuf( CRTDLL_FILE* file, LPSTR buf );
298 INT __cdecl CRTDLL__open_osfhandle( HANDLE osfhandle, INT flags );
299 INT __cdecl CRTDLL_vfprintf( CRTDLL_FILE* file, LPCSTR format,va_list args);
300 INT __cdecl CRTDLL_fprintf( CRTDLL_FILE* file, LPCSTR format, ... );
301 INT __cdecl CRTDLL__putw( INT val, CRTDLL_FILE* file );
302 INT __cdecl CRTDLL__read( INT fd, LPVOID buf, UINT count );
303 UINT __cdecl CRTDLL__write( INT fd,LPCVOID buf,UINT count );
304 INT __cdecl CRTDLL__access( LPCSTR filename, INT mode );
305 INT __cdecl CRTDLL_fflush( CRTDLL_FILE* file );
306 INT __cdecl CRTDLL_fputc( INT c, CRTDLL_FILE* file );
307 VOID __cdecl CRTDLL_putchar( INT x );
308 INT __cdecl CRTDLL_fputs( LPCSTR s, CRTDLL_FILE* file );
309 INT __cdecl CRTDLL_puts( LPCSTR s );
310 INT __cdecl CRTDLL_putc( INT c, CRTDLL_FILE* file );
311 INT __cdecl CRTDLL_fgetc( CRTDLL_FILE* file );
312 INT __cdecl CRTDLL_getchar( VOID );
313 INT __cdecl CRTDLL_getc( CRTDLL_FILE* file );
314 CHAR* __cdecl CRTDLL_fgets( LPSTR s, INT size, CRTDLL_FILE* file );
315 LPSTR __cdecl CRTDLL_gets( LPSTR buf );
316 INT __cdecl CRTDLL_fclose( CRTDLL_FILE* file );
317 INT __cdecl CTRDLL__creat( LPCSTR path, INT flags );
318 INT __cdecl CRTDLL__eof( INT fd );
319 LONG __cdecl CRTDLL__tell(INT fd);
320 INT __cdecl CRTDLL__umask(INT umask);
321 INT __cdecl CRTDLL__utime( LPCSTR path, struct _utimbuf *t );
322 INT __cdecl CRTDLL__unlink( LPCSTR pathname );
323 INT __cdecl CRTDLL_rename( LPCSTR oldpath,LPCSTR newpath );
324 int __cdecl CRTDLL__stat( LPCSTR filename, struct _stat * buf );
325 INT __cdecl CRTDLL__open( LPCSTR path,INT flags );
326 INT __cdecl CRTDLL__chmod( LPCSTR path, INT flags );
327 INT __cdecl CRTDLL__close( INT fd );
328 INT __cdecl CRTDLL_feof( CRTDLL_FILE* file );
329 INT __cdecl CRTDLL__setmode( INT fh,INT mode );
330 INT __cdecl CRTDLL_remove( LPCSTR path );
331 INT __cdecl CRTDLL__commit( INT fd );
332 INT __cdecl CRTDLL__fstat( int file, struct _stat* buf );
333 INT __cdecl CRTDLL__futime( INT fd, struct _utimbuf *t );
334 HANDLE __cdecl CRTDLL__get_osfhandle( INT fd );
337 DWORD __cdecl CRTDLL__initterm( _INITTERMFUN *start,_INITTERMFUN *end );
338 VOID __cdecl CRTDLL__global_unwind2( PEXCEPTION_FRAME frame );
339 VOID __cdecl CRTDLL__local_unwind2( PEXCEPTION_FRAME endframe, DWORD nr );
340 INT __cdecl CRTDLL__setjmp( LPDWORD *jmpbuf );
341 VOID __cdecl CRTDLL_srand( DWORD seed );
342 INT __cdecl CRTDLL__getw( CRTDLL_FILE* file );
343 INT __cdecl CRTDLL__isatty(INT fd);
344 VOID __cdecl CRTDLL__beep( UINT freq, UINT duration );
345 INT __cdecl CRTDLL_rand( VOID );
346 UINT __cdecl CRTDLL__rotl( UINT x,INT shift );
347 DWORD __cdecl CRTDLL__lrotl( DWORD x,INT shift );
348 DWORD __cdecl CRTDLL__lrotr( DWORD x,INT shift );
349 DWORD __cdecl CRTDLL__rotr( UINT x,INT shift );
350 double __cdecl CRTDLL__scalb( double x, LONG y );
351 INT __cdecl CRTDLL__mbsicmp( unsigned char *x,unsigned char *y );
352 INT __cdecl CRTDLL_vswprintf( LPWSTR buffer, LPCWSTR spec, va_list args );
353 VOID __cdecl CRTDLL_longjmp( jmp_buf env, int val );
354 LPSTR __cdecl CRTDLL_setlocale( INT category,LPCSTR locale );
355 INT __cdecl CRTDLL__isctype( INT c, UINT type );
356 LPSTR __cdecl CRTDLL__fullpath( LPSTR buf, LPCSTR name, INT size );
357 VOID __cdecl CRTDLL__splitpath( LPCSTR path, LPSTR drive, LPSTR directory,
358 LPSTR filename, LPSTR extension );
359 INT __cdecl CRTDLL__matherr( struct _exception *e );
360 VOID __cdecl CRTDLL__makepath( LPSTR path, LPCSTR drive,
361 LPCSTR directory, LPCSTR filename,
363 LPINT __cdecl CRTDLL__errno( VOID );
364 LPINT __cdecl CRTDLL___doserrno( VOID );
365 LPCSTR**__cdecl CRTDLL__sys_errlist( VOID );
366 VOID __cdecl CRTDLL_perror( LPCSTR err );
367 UINT __cdecl CRTDLL__statusfp( VOID );
368 LPSTR __cdecl CRTDLL__strerror( LPCSTR err );
369 LPSTR __cdecl CRTDLL_strerror( INT err );
370 LPSTR __cdecl CRTDLL__tempnam( LPCSTR dir, LPCSTR prefix );
371 LPSTR __cdecl CRTDLL_tmpnam( LPSTR s );
372 LPVOID __cdecl CRTDLL_signal( INT sig, sig_handler_type ptr );
373 VOID __cdecl CRTDLL__sleep( ULONG timeout );
374 LPSTR __cdecl CRTDLL_getenv( LPCSTR name );
375 INT __cdecl CRTDLL_isalnum( INT c );
376 INT __cdecl CRTDLL_isalpha( INT c );
377 INT __cdecl CRTDLL_iscntrl( INT c );
378 INT __cdecl CRTDLL_isdigit( INT c );
379 INT __cdecl CRTDLL_isgraph( INT c );
380 INT __cdecl CRTDLL_islower( INT c);
381 INT __cdecl CRTDLL_isprint( INT c);
382 INT __cdecl CRTDLL_ispunct( INT c);
383 INT __cdecl CRTDLL_isspace( INT c);
384 INT __cdecl CRTDLL_isupper( INT c);
385 INT __cdecl CRTDLL_isxdigit( INT c );
386 double __cdecl CRTDLL_ldexp( double x, LONG y );
387 LPSTR __cdecl CRTDLL__mbsrchr( LPSTR s,CHAR x );
388 VOID __cdecl CRTDLL___dllonexit ( VOID );
389 VOID __cdecl CRTDLL__mbccpy( LPSTR dest, LPSTR src );
390 INT __cdecl CRTDLL___isascii( INT c );
391 INT __cdecl CRTDLL___toascii( INT c );
392 INT __cdecl CRTDLL_iswascii( LONG c );
393 INT __cdecl CRTDLL___iscsym( UCHAR c );
394 INT __cdecl CRTDLL___iscsymf( UCHAR c );
395 INT __cdecl CRTDLL__loaddll( LPSTR dllname );
396 INT __cdecl CRTDLL__unloaddll( HANDLE dll );
397 WCHAR* __cdecl CRTDLL__itow( INT value,WCHAR* out,INT base );
398 WCHAR* __cdecl CRTDLL__ltow( LONG value,WCHAR* out,INT base );
399 WCHAR* __cdecl CRTDLL__ultow( ULONG value,WCHAR* out,INT base );
400 CHAR __cdecl CRTDLL__toupper( CHAR c );
401 CHAR __cdecl CRTDLL__tolower( CHAR c );
402 double __cdecl CRTDLL__cabs( struct complex c );
403 double __cdecl CRTDLL__chgsign( double d );
404 UINT __cdecl CRTDLL__control87( UINT newVal, UINT mask);
405 UINT __cdecl CRTDLL__controlfp( UINT newVal, UINT mask);
406 double __cdecl CRTDLL__copysign( double x, double sign );
407 INT __cdecl CRTDLL__finite( double d );
408 UINT __cdecl CRTDLL__clearfp( VOID );
409 INT __cdecl CRTDLL__fpclass( double d );
410 VOID __cdecl CRTDLL__fpreset( void );
411 INT __cdecl CRTDLL__isnan( double d );
412 LPVOID __cdecl CRTDLL__lsearch( LPVOID match, LPVOID start, LPUINT array_size,
413 UINT elem_size, comp_func cf );
414 VOID __cdecl CRTDLL__purecall( VOID );
417 LPVOID __cdecl CRTDLL_new( DWORD size );
418 VOID __cdecl CRTDLL_delete( LPVOID ptr );
419 new_handler_type __cdecl CRTDLL_set_new_handler( new_handler_type func );
420 INT __cdecl CRTDLL__heapchk( VOID );
421 INT __cdecl CRTDLL__heapmin( VOID );
422 INT __cdecl CRTDLL__heapset( UINT value );
423 INT __cdecl CRTDLL__heapwalk( struct _heapinfo *next );
424 LPVOID __cdecl CRTDLL__expand( LPVOID ptr, INT size );
425 LONG __cdecl CRTDLL__msize( LPVOID mem );
426 LPVOID __cdecl CRTDLL_calloc( DWORD size, DWORD count );
427 VOID __cdecl CRTDLL_free( LPVOID ptr );
428 LPVOID __cdecl CRTDLL_malloc( DWORD size );
429 LPVOID __cdecl CRTDLL_realloc( VOID *ptr, DWORD size );
432 HANDLE __cdecl CRTDLL__spawnve( INT flags, LPSTR name, LPSTR *argv, LPSTR *envv);
433 INT __cdecl CRTDLL_system( LPSTR x );
436 LPSTR __cdecl CRTDLL__strdec( LPSTR str1, LPSTR str2 );
437 LPSTR __cdecl CRTDLL__strdup( LPCSTR ptr );
438 LPSTR __cdecl CRTDLL__strinc( LPSTR str );
439 UINT __cdecl CRTDLL__strnextc( LPCSTR str );
440 LPSTR __cdecl CRTDLL__strninc( LPSTR str, INT n );
441 LPSTR __cdecl CRTDLL__strnset( LPSTR str, INT c, INT len );
442 LPSTR __cdecl CRTDLL__strrev ( LPSTR str );
443 LPSTR __cdecl CRTDLL__strset ( LPSTR str, INT set );
444 LONG __cdecl CRTDLL__strncnt( LPSTR str, LONG max );
445 LPSTR __cdecl CRTDLL__strspnp( LPSTR str1, LPSTR str2 );
446 VOID __cdecl CRTDLL__swab( LPSTR src, LPSTR dst, INT len );
449 LPSTR __cdecl CRTDLL__strdate ( LPSTR date );
450 LPSTR __cdecl CRTDLL__strtime ( LPSTR date );
451 clock_t __cdecl CRTDLL_clock ( void );
452 double __cdecl CRTDLL_difftime ( time_t time1, time_t time2 );
453 time_t __cdecl CRTDLL_time ( time_t *timeptr );
456 LPSTR __cdecl CRTDLL__mbsinc( LPCSTR str );
457 INT __cdecl CRTDLL__mbslen( LPCSTR str );
458 INT __cdecl CRTDLL_mbtowc( WCHAR *dst, LPCSTR str, INT n );
459 LPWSTR __cdecl CRTDLL__wcsdup( LPCWSTR str );
460 INT __cdecl CRTDLL__wcsicoll( LPCWSTR str1, LPCWSTR str2 );
461 LPWSTR __cdecl CRTDLL__wcsnset( LPWSTR str, WCHAR c, INT n );
462 LPWSTR __cdecl CRTDLL__wcsrev( LPWSTR str );
463 LPWSTR __cdecl CRTDLL__wcsset( LPWSTR str, WCHAR c );
464 DWORD __cdecl CRTDLL_wcscoll( LPCWSTR str1, LPCWSTR str2 );
465 LPWSTR __cdecl CRTDLL_wcspbrk( LPCWSTR str, LPCWSTR accept );
466 INT __cdecl CRTDLL_wctomb( LPSTR dst, WCHAR ch );
469 INT __cdecl CRTDLL_iswalnum( WCHAR wc );
470 INT __cdecl CRTDLL_iswalpha( WCHAR wc );
471 INT __cdecl CRTDLL_iswcntrl( WCHAR wc );
472 INT __cdecl CRTDLL_iswdigit( WCHAR wc );
473 INT __cdecl CRTDLL_iswgraph( WCHAR wc );
474 INT __cdecl CRTDLL_iswlower( WCHAR wc );
475 INT __cdecl CRTDLL_iswprint( WCHAR wc );
476 INT __cdecl CRTDLL_iswpunct( WCHAR wc );
477 INT __cdecl CRTDLL_iswspace( WCHAR wc );
478 INT __cdecl CRTDLL_iswupper( WCHAR wc );
479 INT __cdecl CRTDLL_iswxdigit( WCHAR wc );
481 /* INTERNAL: Shared internal functions */
482 void __CRTDLL__set_errno(ULONG err);
483 LPSTR __CRTDLL__strndup(LPSTR buf, INT size);
484 VOID __CRTDLL__init_io(VOID);
486 #endif /* __WINE_CRTDLL_H */