*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
* NOTES
* Naming conventions
#define __WINE_MSVCRT_H
#include <stdarg.h>
-#include <ctype.h>
-#include <string.h>
#include "windef.h"
#include "winbase.h"
-#include "winerror.h"
-#include "winnls.h"
+
+#define MSVCRT_LONG_MAX 0x7fffffffL
+#define MSVCRT_ULONG_MAX 0xffffffffUL
+#define MSVCRT_I64_MAX (((__int64)0x7fffffff << 32) | 0xffffffff)
+#define MSVCRT_I64_MIN (-MSVCRT_I64_MAX-1)
+#define MSVCRT_UI64_MAX (((unsigned __int64)0xffffffff << 32) | 0xffffffff)
+
+#define MSVCRT__MAX_DRIVE 3
+#define MSVCRT__MAX_DIR 256
+#define MSVCRT__MAX_FNAME 256
+#define MSVCRT__MAX_EXT 256
typedef unsigned short MSVCRT_wchar_t;
typedef unsigned short MSVCRT_wint_t;
typedef unsigned short MSVCRT_wctype_t;
typedef unsigned short MSVCRT__ino_t;
-typedef unsigned long MSVCRT__fsize_t;
+typedef unsigned int MSVCRT__fsize_t;
+typedef int MSVCRT_long;
+typedef unsigned int MSVCRT_ulong;
#ifdef _WIN64
typedef unsigned __int64 MSVCRT_size_t;
typedef __int64 MSVCRT_intptr_t;
typedef unsigned __int64 MSVCRT_uintptr_t;
#else
-typedef unsigned int MSVCRT_size_t;
-typedef int MSVCRT_intptr_t;
-typedef unsigned int MSVCRT_uintptr_t;
+typedef unsigned long MSVCRT_size_t;
+typedef long MSVCRT_intptr_t;
+typedef unsigned long MSVCRT_uintptr_t;
#endif
typedef unsigned int MSVCRT__dev_t;
-typedef int MSVCRT__off_t;
-typedef long MSVCRT_clock_t;
-typedef long MSVCRT_time_t;
-typedef __int64 MSVCRT_fpos_t;
-
-typedef void (*MSVCRT_terminate_handler)(void);
-typedef void (*MSVCRT_terminate_function)(void);
-typedef void (*MSVCRT_unexpected_handler)(void);
-typedef void (*MSVCRT_unexpected_function)(void);
-typedef void (*MSVCRT__se_translator_function)(unsigned int code, struct _EXCEPTION_POINTERS *info);
-typedef void (*MSVCRT__beginthread_start_routine_t)(void *);
+typedef int MSVCRT__off_t;
+typedef int MSVCRT_clock_t;
+typedef int MSVCRT___time32_t;
+typedef __int64 DECLSPEC_ALIGN(8) MSVCRT___time64_t;
+typedef __int64 DECLSPEC_ALIGN(8) MSVCRT_fpos_t;
+
+typedef void (*__cdecl MSVCRT_terminate_handler)(void);
+typedef void (*__cdecl MSVCRT_terminate_function)(void);
+typedef void (*__cdecl MSVCRT_unexpected_handler)(void);
+typedef void (*__cdecl MSVCRT_unexpected_function)(void);
+typedef void (*__cdecl MSVCRT__se_translator_function)(unsigned int code, struct _EXCEPTION_POINTERS *info);
+typedef void (*__cdecl MSVCRT__beginthread_start_routine_t)(void *);
typedef unsigned int (__stdcall *MSVCRT__beginthreadex_start_routine_t)(void *);
-typedef int (*MSVCRT__onexit_t)(void);
+typedef int (*__cdecl MSVCRT__onexit_t)(void);
+typedef void (__cdecl *MSVCRT_invalid_parameter_handler)(const MSVCRT_wchar_t*, const MSVCRT_wchar_t*, const MSVCRT_wchar_t*, unsigned, MSVCRT_uintptr_t);
+typedef void (__cdecl *MSVCRT_purecall_handler)(void);
+
+typedef struct {long double x;} MSVCRT__LDOUBLE;
struct MSVCRT_tm {
int tm_sec;
struct __thread_data {
int thread_errno;
- unsigned long thread_doserrno;
+ MSVCRT_ulong thread_doserrno;
+ unsigned int random_seed; /* seed for rand() */
+ char *strtok_next; /* next ptr for strtok() */
unsigned char *mbstok_next; /* next ptr for mbstok() */
+ MSVCRT_wchar_t *wcstok_next; /* next ptr for wcstok() */
char *efcvt_buffer; /* buffer for ecvt/fcvt */
char *asctime_buffer; /* buffer for asctime */
MSVCRT_wchar_t *wasctime_buffer; /* buffer for wasctime */
struct MSVCRT_tm time_buffer; /* buffer for localtime/gmtime */
+ char *strerror_buffer; /* buffer for strerror */
+ MSVCRT_wchar_t *wcserror_buffer; /* buffer for wcserror */
int fpecode;
MSVCRT_terminate_function terminate_handler;
MSVCRT_unexpected_function unexpected_handler;
MSVCRT__se_translator_function se_translator;
EXCEPTION_RECORD *exc_record;
+ struct MSVCRT_localeinfo_struct *locale;
};
typedef struct __thread_data thread_data_t;
extern thread_data_t *msvcrt_get_thread_data(void);
-extern int msvcrt_current_lc_all_cp;
+extern int MSVCRT___lc_codepage;
+extern int MSVCRT___lc_collate_cp;
+extern int MSVCRT___mb_cur_max;
+extern WORD MSVCRT__ctype [257];
+extern WORD* MSVCRT__pctype;
void msvcrt_set_errno(int);
-char* msvcrt_strndup(const char*,unsigned int);
-MSVCRT_wchar_t *msvcrt_wstrndup(const MSVCRT_wchar_t*, unsigned int);
-void _purecall(void);
-void _amsg_exit(int errnum);
+void __cdecl _purecall(void);
+void __cdecl _amsg_exit(int errnum);
-extern char **_environ;
-extern MSVCRT_wchar_t **_wenviron;
+extern char **MSVCRT__environ;
+extern MSVCRT_wchar_t **MSVCRT__wenviron;
extern char ** msvcrt_SnapshotOfEnvironmentA(char **);
extern MSVCRT_wchar_t ** msvcrt_SnapshotOfEnvironmentW(MSVCRT_wchar_t **);
+MSVCRT_wchar_t *msvcrt_wstrdupa(const char *);
+
/* FIXME: This should be declared in new.h but it's not an extern "C" so
* it would not be much use anyway. Even for Winelib applications.
*/
-int MSVCRT__set_new_mode(int mode);
+int __cdecl MSVCRT__set_new_mode(int mode);
-void* MSVCRT_operator_new(unsigned long size);
-void MSVCRT_operator_delete(void*);
+void* __cdecl MSVCRT_operator_new(MSVCRT_size_t);
+void __cdecl MSVCRT_operator_delete(void*);
-typedef void* (*malloc_func_t)(MSVCRT_size_t);
-typedef void (*free_func_t)(void*);
+typedef void* (*__cdecl malloc_func_t)(MSVCRT_size_t);
+typedef void (*__cdecl free_func_t)(void*);
-extern char* __unDName(char *,const char*,int,malloc_func_t,free_func_t,unsigned short int);
-extern char* __unDNameEx(char *,const char*,int,malloc_func_t,free_func_t,void *,unsigned short int);
+extern char* __cdecl __unDName(char *,const char*,int,malloc_func_t,free_func_t,unsigned short int);
+extern char* __cdecl __unDNameEx(char *,const char*,int,malloc_func_t,free_func_t,void *,unsigned short int);
/* Setup and teardown multi threaded locks */
extern void msvcrt_init_mt_locks(void);
extern void msvcrt_init_signals(void);
extern void msvcrt_free_signals(void);
-extern unsigned msvcrt_create_io_inherit_block(STARTUPINFOA*);
+extern unsigned msvcrt_create_io_inherit_block(WORD*, BYTE**);
+
+extern unsigned int __cdecl _control87(unsigned int, unsigned int);
/* run-time error codes */
#define _RT_STACK 0
#define _RT_CRNL 252
#define _RT_BANNER 255
-struct MSVCRT__timeb {
- MSVCRT_time_t time;
+struct MSVCRT___timeb32 {
+ MSVCRT___time32_t time;
+ unsigned short millitm;
+ short timezone;
+ short dstflag;
+};
+
+struct MSVCRT___timeb64 {
+ MSVCRT___time64_t time;
unsigned short millitm;
short timezone;
short dstflag;
} MSVCRT_div_t;
typedef struct MSVCRT__ldiv_t {
- long quot; /* quotient */
- long rem; /* remainder */
+ MSVCRT_long quot; /* quotient */
+ MSVCRT_long rem; /* remainder */
} MSVCRT_ldiv_t;
struct MSVCRT__heapinfo {
unsigned int bytes_per_sector;
};
-struct MSVCRT__finddata_t {
- unsigned attrib;
- MSVCRT_time_t time_create;
- MSVCRT_time_t time_access;
- MSVCRT_time_t time_write;
- MSVCRT__fsize_t size;
- char name[260];
+struct MSVCRT__finddata32_t {
+ unsigned int attrib;
+ MSVCRT___time32_t time_create;
+ MSVCRT___time32_t time_access;
+ MSVCRT___time32_t time_write;
+ MSVCRT__fsize_t size;
+ char name[260];
+};
+
+struct MSVCRT__finddata32i64_t {
+ unsigned int attrib;
+ MSVCRT___time32_t time_create;
+ MSVCRT___time32_t time_access;
+ MSVCRT___time32_t time_write;
+ __int64 DECLSPEC_ALIGN(8) size;
+ char name[260];
+};
+
+struct MSVCRT__finddata64i32_t {
+ unsigned int attrib;
+ MSVCRT___time64_t time_create;
+ MSVCRT___time64_t time_access;
+ MSVCRT___time64_t time_write;
+ MSVCRT__fsize_t size;
+ char name[260];
+};
+
+struct MSVCRT__finddata64_t {
+ unsigned int attrib;
+ MSVCRT___time64_t time_create;
+ MSVCRT___time64_t time_access;
+ MSVCRT___time64_t time_write;
+ __int64 DECLSPEC_ALIGN(8) size;
+ char name[260];
+};
+
+struct MSVCRT__wfinddata32_t {
+ unsigned int attrib;
+ MSVCRT___time32_t time_create;
+ MSVCRT___time32_t time_access;
+ MSVCRT___time32_t time_write;
+ MSVCRT__fsize_t size;
+ MSVCRT_wchar_t name[260];
};
-struct MSVCRT__finddatai64_t {
- unsigned attrib;
- MSVCRT_time_t time_create;
- MSVCRT_time_t time_access;
- MSVCRT_time_t time_write;
- __int64 size;
- char name[260];
+struct MSVCRT__wfinddata32i64_t {
+ unsigned int attrib;
+ MSVCRT___time32_t time_create;
+ MSVCRT___time32_t time_access;
+ MSVCRT___time32_t time_write;
+ __int64 DECLSPEC_ALIGN(8) size;
+ MSVCRT_wchar_t name[260];
};
-struct MSVCRT__wfinddata_t {
- unsigned attrib;
- MSVCRT_time_t time_create;
- MSVCRT_time_t time_access;
- MSVCRT_time_t time_write;
- MSVCRT__fsize_t size;
- MSVCRT_wchar_t name[260];
+struct MSVCRT__wfinddata64i32_t {
+ unsigned int attrib;
+ MSVCRT___time64_t time_create;
+ MSVCRT___time64_t time_access;
+ MSVCRT___time64_t time_write;
+ MSVCRT__fsize_t size;
+ MSVCRT_wchar_t name[260];
};
-struct MSVCRT__wfinddatai64_t {
- unsigned attrib;
- MSVCRT_time_t time_create;
- MSVCRT_time_t time_access;
- MSVCRT_time_t time_write;
- __int64 size;
- MSVCRT_wchar_t name[260];
+struct MSVCRT__wfinddata64_t {
+ unsigned int attrib;
+ MSVCRT___time64_t time_create;
+ MSVCRT___time64_t time_access;
+ MSVCRT___time64_t time_write;
+ __int64 DECLSPEC_ALIGN(8) size;
+ MSVCRT_wchar_t name[260];
};
-struct MSVCRT__utimbuf
+struct MSVCRT___utimbuf32
{
- MSVCRT_time_t actime;
- MSVCRT_time_t modtime;
+ MSVCRT___time32_t actime;
+ MSVCRT___time32_t modtime;
+};
+
+struct MSVCRT___utimbuf64
+{
+ MSVCRT___time64_t actime;
+ MSVCRT___time64_t modtime;
};
/* for FreeBSD */
#undef st_ctime
#undef st_mtime
-struct MSVCRT__stat {
- MSVCRT__dev_t st_dev;
- MSVCRT__ino_t st_ino;
- unsigned short st_mode;
- short st_nlink;
- short st_uid;
- short st_gid;
- MSVCRT__dev_t st_rdev;
- MSVCRT__off_t st_size;
- MSVCRT_time_t st_atime;
- MSVCRT_time_t st_mtime;
- MSVCRT_time_t st_ctime;
+struct MSVCRT__stat32 {
+ MSVCRT__dev_t st_dev;
+ MSVCRT__ino_t st_ino;
+ unsigned short st_mode;
+ short st_nlink;
+ short st_uid;
+ short st_gid;
+ MSVCRT__dev_t st_rdev;
+ MSVCRT__off_t st_size;
+ MSVCRT___time32_t st_atime;
+ MSVCRT___time32_t st_mtime;
+ MSVCRT___time32_t st_ctime;
};
-struct MSVCRT_stat {
- MSVCRT__dev_t st_dev;
- MSVCRT__ino_t st_ino;
- unsigned short st_mode;
- short st_nlink;
- short st_uid;
- short st_gid;
- MSVCRT__dev_t st_rdev;
- MSVCRT__off_t st_size;
- MSVCRT_time_t st_atime;
- MSVCRT_time_t st_mtime;
- MSVCRT_time_t st_ctime;
+struct MSVCRT__stat32i64 {
+ MSVCRT__dev_t st_dev;
+ MSVCRT__ino_t st_ino;
+ unsigned short st_mode;
+ short st_nlink;
+ short st_uid;
+ short st_gid;
+ MSVCRT__dev_t st_rdev;
+ __int64 DECLSPEC_ALIGN(8) st_size;
+ MSVCRT___time32_t st_atime;
+ MSVCRT___time32_t st_mtime;
+ MSVCRT___time32_t st_ctime;
};
-struct MSVCRT__stati64 {
- MSVCRT__dev_t st_dev;
- MSVCRT__ino_t st_ino;
- unsigned short st_mode;
- short st_nlink;
- short st_uid;
- short st_gid;
- MSVCRT__dev_t st_rdev;
- __int64 st_size;
- MSVCRT_time_t st_atime;
- MSVCRT_time_t st_mtime;
- MSVCRT_time_t st_ctime;
+struct MSVCRT__stat64i32 {
+ MSVCRT__dev_t st_dev;
+ MSVCRT__ino_t st_ino;
+ unsigned short st_mode;
+ short st_nlink;
+ short st_uid;
+ short st_gid;
+ MSVCRT__dev_t st_rdev;
+ MSVCRT__off_t st_size;
+ MSVCRT___time64_t st_atime;
+ MSVCRT___time64_t st_mtime;
+ MSVCRT___time64_t st_ctime;
};
+struct MSVCRT__stat64 {
+ MSVCRT__dev_t st_dev;
+ MSVCRT__ino_t st_ino;
+ unsigned short st_mode;
+ short st_nlink;
+ short st_uid;
+ short st_gid;
+ MSVCRT__dev_t st_rdev;
+ __int64 DECLSPEC_ALIGN(8) st_size;
+ MSVCRT___time64_t st_atime;
+ MSVCRT___time64_t st_mtime;
+ MSVCRT___time64_t st_ctime;
+};
+
+#ifdef _WIN64
+#define MSVCRT__finddata_t MSVCRT__finddata64i32_t
+#define MSVCRT__finddatai64_t MSVCRT__finddata64_t
+#define MSVCRT__wfinddata_t MSVCRT__wfinddata64i32_t
+#define MSVCRT__wfinddatai64_t MSVCRT__wfinddata64_t
+#define MSVCRT__stat MSVCRT__stat64i32
+#define MSVCRT__stati64 MSVCRT__stat64
+#else
+#define MSVCRT__finddata_t MSVCRT__finddata32_t
+#define MSVCRT__finddatai64_t MSVCRT__finddata32i64_t
+#define MSVCRT__wfinddata_t MSVCRT__wfinddata32_t
+#define MSVCRT__wfinddatai64_t MSVCRT__wfinddata32i64_t
+#define MSVCRT__stat MSVCRT__stat32
+#define MSVCRT__stati64 MSVCRT__stat32i64
+#endif
+
#define MSVCRT_WEOF (MSVCRT_wint_t)(0xFFFF)
#define MSVCRT_EOF (-1)
#define MSVCRT_TMP_MAX 0x7fff
+#define MSVCRT_RAND_MAX 0x7fff
#define MSVCRT_BUFSIZ 512
#define MSVCRT_STDIN_FILENO 0
#define MSVCRT__IOLBF 0x0040
#define MSVCRT_FILENAME_MAX 260
+#define MSVCRT_DRIVE_MAX 3
+#define MSVCRT_FNAME_MAX 256
+#define MSVCRT_DIR_MAX 256
+#define MSVCRT_EXT_MAX 256
+#define MSVCRT_PATH_MAX 260
#define MSVCRT_stdin (MSVCRT__iob+MSVCRT_STDIN_FILENO)
#define MSVCRT_stdout (MSVCRT__iob+MSVCRT_STDOUT_FILENO)
#define MSVCRT_stderr (MSVCRT__iob+MSVCRT_STDERR_FILENO)
#define MSVCRT_ENOLCK 39
#define MSVCRT_ENOSYS 40
#define MSVCRT_ENOTEMPTY 41
+#define MSVCRT_EILSEQ 42
+#define MSVCRT_STRUNCATE 80
#define MSVCRT_LC_ALL 0
#define MSVCRT_LC_COLLATE 1
#define MSVCRT__FPCLASS_PN 0x0100 /* Positive Normal */
#define MSVCRT__FPCLASS_PINF 0x0200 /* Positive Infinity */
+#define MSVCRT__MCW_EM 0x0008001f
+#define MSVCRT__MCW_IC 0x00040000
+#define MSVCRT__MCW_RC 0x00000300
+#define MSVCRT__MCW_PC 0x00030000
+#define MSVCRT__MCW_DN 0x03000000
+
#define MSVCRT__EM_INVALID 0x00000010
#define MSVCRT__EM_DENORMAL 0x00080000
#define MSVCRT__EM_ZERODIVIDE 0x00000008
#define MSVCRT__PC_24 0x00020000
#define MSVCRT__PC_53 0x00010000
#define MSVCRT__PC_64 0x00000000
+#define MSVCRT__DN_SAVE 0x00000000
+#define MSVCRT__DN_FLUSH 0x01000000
+#define MSVCRT__DN_FLUSH_OPERANDS_SAVE_RESULTS 0x02000000
+#define MSVCRT__DN_SAVE_OPERANDS_FLUSH_RESULTS 0x03000000
+#define MSVCRT__EM_AMBIGUOUS 0x80000000
#define MSVCRT_CLOCKS_PER_SEC 1000
#define MSVCRT_SIGABRT 22
#define MSVCRT_NSIG (MSVCRT_SIGABRT + 1)
-typedef void (*MSVCRT___sighandler_t)(int);
+typedef void (__cdecl *MSVCRT___sighandler_t)(int);
#define MSVCRT_SIG_DFL ((MSVCRT___sighandler_t)0)
#define MSVCRT_SIG_IGN ((MSVCRT___sighandler_t)1)
#define MSVCRT_SIG_ERR ((MSVCRT___sighandler_t)-1)
-void MSVCRT_free(void*);
-void* MSVCRT_malloc(MSVCRT_size_t);
-void* MSVCRT_calloc(MSVCRT_size_t,MSVCRT_size_t);
-void* MSVCRT_realloc(void*,MSVCRT_size_t);
-
-int MSVCRT_iswalpha(MSVCRT_wint_t);
-int MSVCRT_iswspace(MSVCRT_wint_t);
-int MSVCRT_iswdigit(MSVCRT_wint_t);
-int MSVCRT_isleadbyte(int);
-
-int MSVCRT_fgetc(MSVCRT_FILE*);
-int MSVCRT_ungetc(int,MSVCRT_FILE*);
-MSVCRT_wint_t MSVCRT_fgetwc(MSVCRT_FILE*);
-MSVCRT_wint_t MSVCRT_ungetwc(MSVCRT_wint_t,MSVCRT_FILE*);
-void MSVCRT__exit(int);
-void MSVCRT_abort(void);
-unsigned long* MSVCRT___doserrno(void);
-int* MSVCRT__errno(void);
-char* MSVCRT_getenv(const char*);
-char* MSVCRT_setlocale(int,const char*);
-int MSVCRT_fclose(MSVCRT_FILE*);
-void MSVCRT_terminate(void);
-MSVCRT_FILE* MSVCRT__p__iob(void);
-MSVCRT_time_t MSVCRT_mktime(struct MSVCRT_tm *t);
-struct MSVCRT_tm* MSVCRT_localtime(const MSVCRT_time_t* secs);
-struct MSVCRT_tm* MSVCRT_gmtime(const MSVCRT_time_t* secs);
-MSVCRT_clock_t MSVCRT_clock(void);
-double MSVCRT_difftime(MSVCRT_time_t time1, MSVCRT_time_t time2);
-MSVCRT_time_t MSVCRT_time(MSVCRT_time_t*);
-MSVCRT_FILE* MSVCRT__fdopen(int, const char *);
-int MSVCRT_vsnprintf(char *str, unsigned int len, const char *format, va_list valist);
+#define MSVCRT__FPE_INVALID 0x81
+#define MSVCRT__FPE_DENORMAL 0x82
+#define MSVCRT__FPE_ZERODIVIDE 0x83
+#define MSVCRT__FPE_OVERFLOW 0x84
+#define MSVCRT__FPE_UNDERFLOW 0x85
+#define MSVCRT__FPE_INEXACT 0x86
+#define MSVCRT__FPE_UNEMULATED 0x87
+#define MSVCRT__FPE_SQRTNEG 0x88
+#define MSVCRT__FPE_STACKOVERFLOW 0x8a
+#define MSVCRT__FPE_STACKUNDERFLOW 0x8b
+#define MSVCRT__FPE_EXPLICITGEN 0x8c
+
+#define _MS 0x01
+#define _MP 0x02
+#define _M1 0x04
+#define _M2 0x08
+
+#define _SBUP 0x10
+#define _SBLOW 0x20
+
+#define _MBC_SINGLE 0
+#define _MBC_LEAD 1
+#define _MBC_TRAIL 2
+#define _MBC_ILLEGAL -1
+
+#define _MB_CP_SBCS 0
+#define _MB_CP_OEM -2
+#define _MB_CP_ANSI -3
+#define _MB_CP_LOCALE -4
+
+#define MSVCRT__TRUNCATE ((MSVCRT_size_t)-1)
+
+#define _MAX__TIME64_T (((MSVCRT___time64_t)0x00000007 << 32) | 0x93406FFF)
+
+void __cdecl MSVCRT_free(void*);
+void* __cdecl MSVCRT_malloc(MSVCRT_size_t);
+void* __cdecl MSVCRT_calloc(MSVCRT_size_t,MSVCRT_size_t);
+void* __cdecl MSVCRT_realloc(void*,MSVCRT_size_t);
+
+int __cdecl MSVCRT_iswalpha(MSVCRT_wint_t);
+int __cdecl MSVCRT_iswspace(MSVCRT_wint_t);
+int __cdecl MSVCRT_iswdigit(MSVCRT_wint_t);
+int __cdecl MSVCRT_isleadbyte(int);
+
+int __cdecl MSVCRT_fgetc(MSVCRT_FILE*);
+int __cdecl MSVCRT_ungetc(int,MSVCRT_FILE*);
+MSVCRT_wint_t __cdecl MSVCRT_fgetwc(MSVCRT_FILE*);
+MSVCRT_wint_t __cdecl MSVCRT_ungetwc(MSVCRT_wint_t,MSVCRT_FILE*);
+void __cdecl MSVCRT__exit(int);
+void __cdecl MSVCRT_abort(void);
+MSVCRT_ulong* __cdecl MSVCRT___doserrno(void);
+int* __cdecl MSVCRT__errno(void);
+char* __cdecl MSVCRT_getenv(const char*);
+char* __cdecl MSVCRT_setlocale(int,const char*);
+int __cdecl MSVCRT_fclose(MSVCRT_FILE*);
+void __cdecl MSVCRT_terminate(void);
+MSVCRT_FILE* __cdecl MSVCRT__iob_func(void);
+MSVCRT_clock_t __cdecl MSVCRT_clock(void);
+MSVCRT___time32_t __cdecl MSVCRT__time32(MSVCRT___time32_t*);
+MSVCRT___time64_t __cdecl MSVCRT__time64(MSVCRT___time64_t*);
+MSVCRT_FILE* __cdecl MSVCRT__fdopen(int, const char *);
+MSVCRT_FILE* __cdecl MSVCRT__wfdopen(int, const MSVCRT_wchar_t *);
+int __cdecl MSVCRT_vsnprintf(char *str, MSVCRT_size_t len, const char *format, __ms_va_list valist);
+int __cdecl MSVCRT_vsnwprintf(MSVCRT_wchar_t *str, MSVCRT_size_t len,
+ const MSVCRT_wchar_t *format, __ms_va_list valist );
+int __cdecl MSVCRT_sprintf(char*,const char*,...);
+int __cdecl MSVCRT__scprintf(const char*,...);
+int __cdecl MSVCRT_raise(int sig);
+
+typedef struct MSVCRT_tagLC_ID {
+ unsigned short wLanguage;
+ unsigned short wCountry;
+ unsigned short wCodePage;
+} MSVCRT_LC_ID, *MSVCRT_LPLC_ID;
+
+typedef struct MSVCRT_threadlocaleinfostruct {
+ int refcount;
+ unsigned int lc_codepage;
+ unsigned int lc_collate_cp;
+ unsigned long lc_handle[6];
+ MSVCRT_LC_ID lc_id[6];
+ struct {
+ char *locale;
+ wchar_t *wlocale;
+ int *refcount;
+ int *wrefcount;
+ } lc_category[6];
+ int lc_clike;
+ int mb_cur_max;
+ int *lconv_intl_refcount;
+ int *lconv_num_refcount;
+ int *lconv_mon_refcount;
+ struct MSVCRT_lconv *lconv;
+ int *ctype1_refcount;
+ unsigned short *ctype1;
+ unsigned short *pctype;
+ unsigned char *pclmap;
+ unsigned char *pcumap;
+ struct MSVCRT___lc_time_data *lc_time_curr;
+} MSVCRT_threadlocinfo;
+
+typedef struct MSVCRT_threadmbcinfostruct {
+ int refcount;
+ int mbcodepage;
+ int ismbcodepage;
+ int mblcid;
+ unsigned short mbulinfo[6];
+ char mbctype[257];
+ char mbcasemap[256];
+} MSVCRT_threadmbcinfo;
+
+typedef struct MSVCRT_threadlocaleinfostruct *MSVCRT_pthreadlocinfo;
+typedef struct MSVCRT_threadmbcinfostruct *MSVCRT_pthreadmbcinfo;
+
+typedef struct MSVCRT_localeinfo_struct
+{
+ MSVCRT_pthreadlocinfo locinfo;
+ MSVCRT_pthreadmbcinfo mbcinfo;
+} MSVCRT__locale_tstruct, *MSVCRT__locale_t;
+
+#define MSVCRT__ENABLE_PER_THREAD_LOCALE 1
+#define MSVCRT__DISABLE_PER_THREAD_LOCALE 2
+
+extern MSVCRT__locale_t MSVCRT_locale;
+MSVCRT__locale_t get_locale(void);
+void __cdecl MSVCRT__free_locale(MSVCRT__locale_t);
#ifndef __WINE_MSVCRT_TEST
-int _write(int,const void*,unsigned int);
-int _getch(void);
-int _vsnwprintf(MSVCRT_wchar_t*,MSVCRT_size_t,const MSVCRT_wchar_t*,va_list);
-int _ismbstrail(const unsigned char* start, const unsigned char* str);
-MSVCRT_intptr_t _spawnve(int,const char*,const char* const *,const char* const *);
-void _searchenv(const char*,const char*,char*);
-int _getdrive(void);
-char* _strdup(const char*);
-char* _strnset(char*,int,MSVCRT_size_t);
-char* _strset(char*,int);
-int _ungetch(int);
-int _cputs(const char*);
-int _cprintf(const char*,...);
-int _snprintf(char*,size_t,const char*,...);
-char*** __p__environ(void);
-int* __p___mb_cur_max(void);
-unsigned int* __p__fmode(void);
-MSVCRT_wchar_t* _wcsdup(const MSVCRT_wchar_t*);
-MSVCRT_wchar_t*** __p__wenviron(void);
-char* _strdate(char* date);
-char* _strtime(char* date);
-void _ftime(struct MSVCRT__timeb *buf);
-int _close(int);
-int _dup(int);
-int _dup2(int, int);
-int _pipe(int *, unsigned int, int);
+int __cdecl MSVCRT__write(int,const void*,unsigned int);
+int __cdecl _getch(void);
+int __cdecl _ismbblead(unsigned int);
+int __cdecl _ismbstrail(const unsigned char* start, const unsigned char* str);
+MSVCRT_intptr_t __cdecl MSVCRT__spawnve(int,const char*,const char* const *,const char* const *);
+MSVCRT_intptr_t __cdecl MSVRT__spawnvpe(int,const char*,const char* const *,const char* const *);
+MSVCRT_intptr_t __cdecl _wspawnve(int,const MSVCRT_wchar_t*,const MSVCRT_wchar_t* const *,const MSVCRT_wchar_t* const *);
+MSVCRT_intptr_t __cdecl _wspawnvpe(int,const MSVCRT_wchar_t*,const MSVCRT_wchar_t* const *,const MSVCRT_wchar_t* const *);
+void __cdecl _searchenv(const char*,const char*,char*);
+int __cdecl _getdrive(void);
+char* __cdecl _strdup(const char*);
+char* __cdecl MSVCRT__strnset(char*,int,MSVCRT_size_t);
+char* __cdecl _strset(char*,int);
+int __cdecl _ungetch(int);
+int __cdecl _cputs(const char*);
+int __cdecl _cprintf(const char*,...);
+char*** __cdecl __p__environ(void);
+int* __cdecl __p___mb_cur_max(void);
+unsigned int* __cdecl __p__fmode(void);
+MSVCRT_wchar_t* __cdecl _wcsdup(const MSVCRT_wchar_t*);
+MSVCRT_wchar_t*** __cdecl __p__wenviron(void);
+char* __cdecl _strdate(char* date);
+char* __cdecl _strtime(char* date);
+int __cdecl _setmbcp(int);
+int __cdecl MSVCRT__close(int);
+int __cdecl MSVCRT__dup(int);
+int __cdecl MSVCRT__dup2(int, int);
+int __cdecl MSVCRT__pipe(int *, unsigned int, int);
+MSVCRT_wchar_t* __cdecl _wgetenv(const MSVCRT_wchar_t*);
+void __cdecl _wsearchenv(const MSVCRT_wchar_t*, const MSVCRT_wchar_t*, MSVCRT_wchar_t*);
+MSVCRT_intptr_t __cdecl MSVCRT__spawnvpe(int, const char*, const char* const*, const char* const*);
+void __cdecl MSVCRT__invalid_parameter(const MSVCRT_wchar_t *expr, const MSVCRT_wchar_t *func,
+ const MSVCRT_wchar_t *file, unsigned int line, MSVCRT_uintptr_t arg);
+
+/* Maybe one day we'll enable the invalid parameter handlers with the full set of information (msvcrXXd)
+ * #define MSVCRT_INVALID_PMT(x) MSVCRT_call_invalid_parameter_handler(x, __FUNCTION__, __FILE__, __LINE__, 0)
+ * #define MSVCRT_CHECK_PMT(x) ((x) ? TRUE : MSVCRT_INVALID_PMT(#x),FALSE)
+ * Until this is done, just keep the same semantics for CHECK_PMT(), but without generating / sending
+ * any information
+ * NB : MSVCRT_call_invalid_parameter_handler is a wrapper around MSVCRT__invalid_parameter in order
+ * to do the Ansi to Unicode transformation
+ */
+#define MSVCRT_INVALID_PMT(x) MSVCRT__invalid_parameter(NULL, NULL, NULL, 0, 0)
+#define MSVCRT_CHECK_PMT(x) ((x) || (MSVCRT_INVALID_PMT(0),FALSE))
#endif
-/* FIXME: Functions that we forward to. They shouldn't be defined
- * here, but for now they're not declared in the standard headers.
- */
-void _splitpath(const char*,char*,char*,char*,char*);
-char* _strlwr(char*);
-char* _strupr(char*);
+typedef struct pf_output_t
+{
+ int used;
+ int len;
+ BOOL unicode;
+ union {
+ LPWSTR W;
+ LPSTR A;
+ } buf;
+ union {
+ LPWSTR W;
+ LPSTR A;
+ } grow;
+} pf_output;
+
+int pf_vsnprintf( pf_output *out, const WCHAR *format,
+ MSVCRT__locale_t locale, BOOL valid, __ms_va_list valist );
#endif /* __WINE_MSVCRT_H */