- New msvcrt unicode functions, winapi_check/-Wall/-W clean.

- Forward to ntdll where possible.
- Fix some .spec entries with incorrect parameters.
This commit is contained in:
Jon Griffiths 2001-01-22 02:21:54 +00:00 committed by Alexandre Julliard
parent c968ed1542
commit 34c786b2db
14 changed files with 853 additions and 238 deletions

View File

@ -48,7 +48,7 @@ typedef struct __type_info
} type_info;
/******************************************************************
* ??0exception@@QAE@ABQBD@Z (MSVCRT.@)
* exception_ctor (MSVCRT.@)
*/
void __cdecl MSVCRT_exception_ctor(exception * _this, const char ** name)
{
@ -60,7 +60,7 @@ void __cdecl MSVCRT_exception_ctor(exception * _this, const char ** name)
}
/******************************************************************
* ??0exception@@QAE@ABV0@@Z (MSVCRT.@)
* exception_copy_ctor (MSVCRT.@)
*/
void __cdecl MSVCRT_exception_copy_ctor(exception * _this, const exception * rhs)
{
@ -71,7 +71,7 @@ void __cdecl MSVCRT_exception_copy_ctor(exception * _this, const exception * rhs
}
/******************************************************************
* ??0exception@@QAE@XZ (MSVCRT.@)
* exception_default_ctor (MSVCRT.@)
*/
void __cdecl MSVCRT_exception_default_ctor(exception * _this)
{
@ -82,7 +82,7 @@ void __cdecl MSVCRT_exception_default_ctor(exception * _this)
}
/******************************************************************
* ??1exception@@UAE@XZ (MSVCRT.@)
* exception_dtor (MSVCRT.@)
*/
void __cdecl MSVCRT_exception_dtor(exception * _this)
{
@ -90,7 +90,7 @@ void __cdecl MSVCRT_exception_dtor(exception * _this)
}
/******************************************************************
* ??4exception@@QAEAAV0@ABV0@@Z (MSVCRT.@)
* exception_opequals (MSVCRT.@)
*/
exception * __cdecl MSVCRT_exception_opequals(exception * _this, const exception * rhs)
{
@ -101,7 +101,7 @@ exception * __cdecl MSVCRT_exception_opequals(exception * _this, const exception
}
/******************************************************************
* ??_Eexception@@UAEPAXI@Z (MSVCRT.@)
* exception__unknown_E (MSVCRT.@)
*/
void * __cdecl MSVCRT_exception__unknown_E(exception * _this, unsigned int arg1)
{
@ -111,7 +111,7 @@ void * __cdecl MSVCRT_exception__unknown_E(exception * _this, unsigned int arg1)
}
/******************************************************************
* ??_Gexception@@UAEPAXI@Z (MSVCRT.@)
* exception__unknown_G (MSVCRT.@)
*/
void * __cdecl MSVCRT_exception__unknown_G(exception * _this, unsigned int arg1)
{
@ -121,7 +121,7 @@ void * __cdecl MSVCRT_exception__unknown_G(exception * _this, unsigned int arg1)
}
/******************************************************************
* ?what@exception@@UBEPBDXZ (MSVCRT.@)
* exception_what (MSVCRT.@)
*/
const char * __stdcall MSVCRT_exception_what(exception * _this)
{
@ -131,7 +131,7 @@ const char * __stdcall MSVCRT_exception_what(exception * _this)
/******************************************************************
* ??0bad_typeid@@QAE@ABV0@@Z (MSVCRT.@)
* bad_typeid_copy_ctor (MSVCRT.@)
*/
void __cdecl MSVCRT_bad_typeid_copy_ctor(bad_typeid * _this, const bad_typeid * rhs)
{
@ -140,7 +140,7 @@ void __cdecl MSVCRT_bad_typeid_copy_ctor(bad_typeid * _this, const bad_typeid *
}
/******************************************************************
* ??0bad_typeid@@QAE@PBD@Z (MSVCRT.@)
* bad_typeid_ctor (MSVCRT.@)
*/
void __cdecl MSVCRT_bad_typeid_ctor(bad_typeid * _this, const char * name)
{
@ -150,7 +150,7 @@ void __cdecl MSVCRT_bad_typeid_ctor(bad_typeid * _this, const char * name)
}
/******************************************************************
* ??1bad_typeid@@UAE@XZ (MSVCRT.@)
* bad_typeid_dtor (MSVCRT.@)
*/
void __cdecl MSVCRT_bad_typeid_dtor(bad_typeid * _this)
{
@ -159,7 +159,7 @@ void __cdecl MSVCRT_bad_typeid_dtor(bad_typeid * _this)
}
/******************************************************************
* ??4bad_typeid@@QAEAAV0@ABV0@@Z (MSVCRT.@)
* bad_typeid_opequals (MSVCRT.@)
*/
bad_typeid * __cdecl MSVCRT_bad_typeid_opequals(bad_typeid * _this, const bad_typeid * rhs)
{
@ -169,7 +169,7 @@ bad_typeid * __cdecl MSVCRT_bad_typeid_opequals(bad_typeid * _this, const bad_ty
}
/******************************************************************
* ??0__non_rtti_object@@QAE@ABV0@@Z (MSVCRT.@)
* __non_rtti_object_copy_ctor (MSVCRT.@)
*/
void __cdecl MSVCRT___non_rtti_object_copy_ctor(__non_rtti_object * _this,
const __non_rtti_object * rhs)
@ -179,7 +179,7 @@ void __cdecl MSVCRT___non_rtti_object_copy_ctor(__non_rtti_object * _this,
}
/******************************************************************
* ??0__non_rtti_object@@QAE@PBD@Z (MSVCRT.@)
* __non_rtti_object_ctor (MSVCRT.@)
*/
void __cdecl MSVCRT___non_rtti_object_ctor(__non_rtti_object * _this,
const char * name)
@ -190,7 +190,7 @@ void __cdecl MSVCRT___non_rtti_object_ctor(__non_rtti_object * _this,
}
/******************************************************************
* ??1__non_rtti_object@@UAE@XZ (MSVCRT.@)
* __non_rtti_object_dtor (MSVCRT.@)
*/
void __cdecl MSVCRT___non_rtti_object_dtor(__non_rtti_object * _this)
{
@ -199,7 +199,7 @@ void __cdecl MSVCRT___non_rtti_object_dtor(__non_rtti_object * _this)
}
/******************************************************************
* ??4__non_rtti_object@@QAEAAV0@ABV0@@Z (MSVCRT.@)
* __non_rtti_object_opequals (MSVCRT.@)
*/
__non_rtti_object * __cdecl MSVCRT___non_rtti_object_opequals(__non_rtti_object * _this,
const __non_rtti_object *rhs)
@ -211,7 +211,7 @@ __non_rtti_object * __cdecl MSVCRT___non_rtti_object_opequals(__non_rtti_object
}
/******************************************************************
* ??_E__non_rtti_object@@UAEPAXI@Z (MSVCRT.@)
* __non_rtti_object__unknown_E (MSVCRT.@)
*/
void * __cdecl MSVCRT___non_rtti_object__unknown_E(__non_rtti_object * _this, unsigned int arg1)
{
@ -221,7 +221,7 @@ void * __cdecl MSVCRT___non_rtti_object__unknown_E(__non_rtti_object * _this, un
}
/******************************************************************
* ??_G__non_rtti_object@@UAEPAXI@Z (MSVCRT.@)
* __non_rtti_object__unknown_G (MSVCRT.@)
*/
void * __cdecl MSVCRT___non_rtti_object__unknown_G(__non_rtti_object * _this, unsigned int arg1)
{
@ -231,7 +231,7 @@ void * __cdecl MSVCRT___non_rtti_object__unknown_G(__non_rtti_object * _this, un
}
/******************************************************************
* ??0bad_cast@@QAE@ABQBD@Z (MSVCRT.@)
* bad_cast_ctor (MSVCRT.@)
*/
void __cdecl MSVCRT_bad_cast_ctor(bad_cast * _this, const char ** name)
{
@ -241,7 +241,7 @@ void __cdecl MSVCRT_bad_cast_ctor(bad_cast * _this, const char ** name)
}
/******************************************************************
* ??0bad_cast@@QAE@ABV0@@Z (MSVCRT.@)
* bad_cast_copy_ctor (MSVCRT.@)
*/
void __cdecl MSVCRT_bad_cast_copy_ctor(bad_cast * _this, const bad_cast * rhs)
{
@ -250,7 +250,7 @@ void __cdecl MSVCRT_bad_cast_copy_ctor(bad_cast * _this, const bad_cast * rhs)
}
/******************************************************************
* ??1bad_cast@@UAE@XZ (MSVCRT.@)
* bad_cast_dtor (MSVCRT.@)
*/
void __cdecl MSVCRT_bad_cast_dtor(bad_cast * _this)
{
@ -259,7 +259,7 @@ void __cdecl MSVCRT_bad_cast_dtor(bad_cast * _this)
}
/******************************************************************
* ??4bad_cast@@QAEAAV0@ABV0@@Z (MSVCRT.@)
* bad_cast_opequals (MSVCRT.@)
*/
bad_cast * __cdecl MSVCRT_bad_cast_opequals(bad_cast * _this, const bad_cast * rhs)
{
@ -269,7 +269,7 @@ bad_cast * __cdecl MSVCRT_bad_cast_opequals(bad_cast * _this, const bad_cast * r
}
/******************************************************************
* ??8type_info@@QBEHABV0@@Z (MSVCRT.@)
* type_info_opequals_equals (MSVCRT.@)
*/
int __stdcall MSVCRT_type_info_opequals_equals(type_info * _this, const type_info * rhs)
{
@ -278,7 +278,7 @@ int __stdcall MSVCRT_type_info_opequals_equals(type_info * _this, const type_inf
}
/******************************************************************
* ??9type_info@@QBEHABV0@@Z (MSVCRT.@)
* type_info_opnot_equals (MSVCRT.@)
*/
int __stdcall MSVCRT_type_info_opnot_equals(type_info * _this, const type_info * rhs)
{
@ -287,7 +287,7 @@ int __stdcall MSVCRT_type_info_opnot_equals(type_info * _this, const type_info *
}
/******************************************************************
* ??1type_info@@UAE@XZ (MSVCRT.@)
* type_info_dtor (MSVCRT.@)
*/
void __cdecl MSVCRT_type_info_dtor(type_info * _this)
{
@ -297,7 +297,7 @@ void __cdecl MSVCRT_type_info_dtor(type_info * _this)
}
/******************************************************************
* ?name@type_info@@QBEPBDXZ (MSVCRT.@)
* type_info_name (MSVCRT.@)
*/
const char * __stdcall MSVCRT_type_info_name(type_info * _this)
{
@ -306,7 +306,7 @@ const char * __stdcall MSVCRT_type_info_name(type_info * _this)
}
/******************************************************************
* ?raw_name@type_info@@QBEPBDXZ (MSVCRT.@)
* type_info_raw_name (MSVCRT.@)
*/
const char * __stdcall MSVCRT_type_info_raw_name(type_info * _this)
{

View File

@ -50,14 +50,50 @@ GET_UINT_PTR(_osver)
GET_UINT_PTR(_winmajor)
GET_UINT_PTR(_winminor)
GET_UINT_PTR(_winver)
/*********************************************************************
* __p__acmdln (MSVCRT.@)
*/
char **__cdecl MSVCRT___p__acmdln(void) { return &MSVCRT__acmdln; }
/*********************************************************************
* __p__wcmdln (MSVCRT.@)
*/
WCHAR **__cdecl MSVCRT___p__wcmdln(void) { return &MSVCRT__wcmdln; }
/*********************************************************************
* __p___argv (MSVCRT.@)
*/
char ***__cdecl MSVCRT___p___argv(void) { return &MSVCRT___argv; }
/*********************************************************************
* __p___wargv (MSVCRT.@)
*/
WCHAR ***__cdecl MSVCRT___p___wargv(void) { return &MSVCRT___wargv; }
/*********************************************************************
* __p__environ (MSVCRT.@)
*/
char **__cdecl MSVCRT___p__environ(void) { return &MSVCRT__environ; }
/*********************************************************************
* __p__wenviron (MSVCRT.@)
*/
WCHAR **__cdecl MSVCRT___p__wenviron(void) { return &MSVCRT__wenviron; }
/*********************************************************************
* __p___initenv (MSVCRT.@)
*/
char ***__cdecl MSVCRT___p___initenv(void) { return &MSVCRT___initenv; }
/*********************************************************************
* __p___winitenv (MSVCRT.@)
*/
WCHAR ***__cdecl MSVCRT___p___winitenv(void) { return &MSVCRT___winitenv; }
/*********************************************************************
* __p__timezone (MSVCRT.@)
*/
int *__cdecl MSVCRT___p__timezone(void) { return &MSVCRT_timezone; }
/* INTERNAL: Create a wide string from an ascii string */

View File

@ -86,6 +86,12 @@ char * MSVCRT__strndup(const char *, unsigned int);
LPWSTR __cdecl MSVCRT__wcsdup( LPCWSTR );
LPWSTR __cdecl MSVCRT__wstrndup( LPCWSTR , unsigned int );
char *__cdecl MSVCRT_getenv(const char *);
WCHAR *__cdecl wcscpy(WCHAR *,const WCHAR *);
WCHAR *__cdecl wcsncpy(WCHAR *,const WCHAR *,unsigned int);
WCHAR *__cdecl wcscat(WCHAR *,const WCHAR *);
WCHAR *__cdecl wcschr(WCHAR *,WCHAR);
WCHAR *__cdecl wcsrchr(WCHAR *,WCHAR);
void __cdecl _splitpath(const char *,char *, char *,char *,char *);
/*********************************************************************
* _chdir (MSVCRT.@)
@ -430,46 +436,46 @@ int __cdecl MSVCRT__wrmdir(const WCHAR * dir)
}
/*********************************************************************
* _splitpath (MSVCRT.@)
* _wsplitpath (MSVCRT.@)
*/
void __cdecl MSVCRT__splitpath(const char* inpath, char * drv, char * dir,
char* fname, char * ext )
void __cdecl MSVCRT__wsplitpath(const WCHAR *inpath, WCHAR *drv, WCHAR *dir,
WCHAR *fname, WCHAR *ext )
{
/* Modified PD code from 'snippets' collection. */
char ch, *ptr, *p;
char pathbuff[MAX_PATH],*path=pathbuff;
WCHAR ch, *ptr, *p;
WCHAR pathbuff[MAX_PATH],*path=pathbuff;
TRACE(":splitting path '%s'\n",path);
strcpy(pathbuff, inpath);
TRACE(":splitting path '%s'\n",debugstr_w(path));
wcscpy(pathbuff, inpath);
/* convert slashes to backslashes for searching */
for (ptr = (char*)path; *ptr; ++ptr)
if ('/' == *ptr)
*ptr = '\\';
for (ptr = (WCHAR*)path; *ptr; ++ptr)
if (*ptr == (WCHAR)L'/')
*ptr = (WCHAR)L'\\';
/* look for drive spec */
if ('\0' != (ptr = strchr(path, ':')))
if ((ptr = wcschr(path, (WCHAR)L':')) != (WCHAR)L'\0')
{
++ptr;
if (drv)
{
strncpy(drv, path, ptr - path);
drv[ptr - path] = '\0';
wcsncpy(drv, path, ptr - path);
drv[ptr - path] = (WCHAR)L'\0';
}
path = ptr;
}
else if (drv)
*drv = '\0';
*drv = (WCHAR)L'\0';
/* find rightmost backslash or leftmost colon */
if (NULL == (ptr = strrchr(path, '\\')))
ptr = (strchr(path, ':'));
if ((ptr = wcsrchr(path, (WCHAR)L'\\')) == NULL)
ptr = (wcschr(path, (WCHAR)L':'));
if (!ptr)
{
ptr = (char *)path; /* no path */
ptr = (WCHAR *)path; /* no path */
if (dir)
*dir = '\0';
*dir = (WCHAR)L'\0';
}
else
{
@ -477,41 +483,41 @@ void __cdecl MSVCRT__splitpath(const char* inpath, char * drv, char * dir,
if (dir)
{
ch = *ptr;
*ptr = '\0';
strcpy(dir, path);
*ptr = (WCHAR)L'\0';
wcscpy(dir, path);
*ptr = ch;
}
}
if (NULL == (p = strrchr(ptr, '.')))
if ((p = wcsrchr(ptr, (WCHAR)L'.')) == NULL)
{
if (fname)
strcpy(fname, ptr);
wcscpy(fname, ptr);
if (ext)
*ext = '\0';
*ext = (WCHAR)L'\0';
}
else
{
*p = '\0';
*p = (WCHAR)L'\0';
if (fname)
strcpy(fname, ptr);
*p = '.';
wcscpy(fname, ptr);
*p = (WCHAR)L'.';
if (ext)
strcpy(ext, p);
wcscpy(ext, p);
}
/* Fix pathological case - Win returns ':' as part of the
* directory when no drive letter is given.
*/
if (drv && drv[0] == ':')
if (drv && drv[0] == (WCHAR)L':')
{
*drv = '\0';
*drv = (WCHAR)L'\0';
if (dir)
{
pathbuff[0] = ':';
pathbuff[1] = '\0';
strcat(pathbuff,dir);
strcpy(dir,pathbuff);
pathbuff[0] = (WCHAR)L':';
pathbuff[1] = (WCHAR)L'\0';
wcscat(pathbuff,dir);
wcscpy(dir, pathbuff);
}
}
}
@ -621,7 +627,7 @@ static void fln_fix(char *path)
/*********************************************************************
* _fullpath (MSVCRT.@)
*/
LPSTR __cdecl MSVCRT__fullpath(char * absPath, const char* relPath, unsigned int size)
char *__cdecl MSVCRT__fullpath(char * absPath, const char* relPath, unsigned int size)
{
char drive[5],dir[MAX_PATH],file[MAX_PATH],ext[MAX_PATH];
char res[MAX_PATH];
@ -640,7 +646,7 @@ LPSTR __cdecl MSVCRT__fullpath(char * absPath, const char* relPath, unsigned int
TRACE(":resolving relative path '%s'\n",relPath);
MSVCRT__splitpath(relPath, drive, dir, file, ext);
_splitpath(relPath, drive, dir, file, ext);
/* Get Directory and drive into 'res' */
if (!dir[0] || (dir[0] != '/' && dir[0] != '\\'))
@ -749,7 +755,7 @@ void __cdecl MSVCRT__searchenv(const char* file, const char* env, char *buf)
do
{
LPSTR end = penv;
char *end = penv;
while(*end && *end != ';') end++; /* Find end of next path */
if (penv == end || !*penv)

View File

@ -18,8 +18,8 @@ LPWSTR __cdecl wcsrchr( LPWSTR str, WCHAR ch );
*/
char *__cdecl MSVCRT_getenv(const char *name)
{
LPSTR environ = GetEnvironmentStringsA();
LPSTR pp,pos = NULL;
char *environ = GetEnvironmentStringsA();
char *pp,*pos = NULL;
unsigned int length;
for (pp = environ; (*pp); pp = pp + strlen(pp) +1)
@ -66,3 +66,53 @@ WCHAR *__cdecl MSVCRT__wgetenv(const WCHAR *name)
FreeEnvironmentStringsW( environ );
return pp;
}
/*********************************************************************
* _putenv (MSVCRT.@)
*/
int __cdecl MSVCRT__putenv(const char *str)
{
char name[256], value[512];
char *dst = name;
TRACE("%s\n", str);
if (!str)
return -1;
while (*str && *str != '=')
*dst++ = *str++;
if (!*str++)
return -1;
*dst = '\0';
dst = value;
while (*str)
*dst++ = *str++;
*dst = '\0';
return !SetEnvironmentVariableA(name, value[0] ? value : NULL);
}
/*********************************************************************
* _wputenv (MSVCRT.@)
*/
int __cdecl MSVCRT__wputenv(const WCHAR *str)
{
WCHAR name[256], value[512];
WCHAR *dst = name;
TRACE("%s\n", debugstr_w(str));
if (!str)
return -1;
while (*str && *str != (WCHAR)L'=')
*dst++ = *str++;
if (!*str++)
return -1;
*dst = (WCHAR)L'\0';
dst = value;
while (*str)
*dst++ = *str++;
*dst = (WCHAR)L'\0';
return !SetEnvironmentVariableW(name, value[0] ? value : NULL);
}

View File

@ -73,7 +73,7 @@ void MSVCRT__set_errno(int err)
/*********************************************************************
* _errno (MSVCRT.@)
*/
LPINT __cdecl MSVCRT__errno( VOID )
int *__cdecl MSVCRT__errno(void)
{
return GET_THREAD_VAR_PTR(errno);
}
@ -81,7 +81,7 @@ LPINT __cdecl MSVCRT__errno( VOID )
/*********************************************************************
* __doserrno (MSVCRT.@)
*/
LPINT __cdecl MSVCRT___doserrno( VOID )
int *__cdecl MSVCRT___doserrno(void)
{
return GET_THREAD_VAR_PTR(doserrno);
}
@ -101,7 +101,7 @@ char * __cdecl MSVCRT_strerror (int err)
*/
extern int sprintf(char *str, const char *format, ...);
LPSTR __cdecl MSVCRT__strerror (LPCSTR err)
const char *__cdecl MSVCRT__strerror (const char *err)
{
static char strerrbuff[256]; /* FIXME: Per thread, nprintf */
sprintf(strerrbuff,"%s: %s\n",err,MSVCRT_strerror(GET_THREAD_VAR(errno)));

View File

@ -14,14 +14,15 @@
DEFAULT_DEBUG_CHANNEL(msvcrt);
/* stat() mode bits */
#define _S_IFMT 0170000
#define _S_IFREG 0100000
#define _S_IFDIR 0040000
#define _S_IFCHR 0020000
#define _S_IFIFO 0010000
#define _S_IREAD 0000400
#define _S_IWRITE 0000200
#define _S_IEXEC 0000100
#define _S_IFMT 0xF000
#define _S_IFREG 0x8000
#define _S_IFDIR 0x4000
#define _S_IFCHR 0x2000
#define _S_IFIFO 0x1000
#define _S_IFBLK 0x3000
#define _S_IREAD 0x0100
#define _S_IWRITE 0x0080
#define _S_IEXEC 0x0040
/* for stat mode, permissions apply to all,owner and group */
#define MSVCRT_S_IREAD (_S_IREAD | (_S_IREAD >> 3) | (_S_IREAD >> 6))
@ -67,6 +68,12 @@ typedef struct _crtfile
#define SEEK_CUR 1
#define SEEK_END 2
#define _IOFBF 0
#define _IOLBF 1
#define _IONBF 2
#define BUFSIZ 512
#define MSVCRT_stdin (&MSVCRT__iob[0])
#define MSVCRT_stdout (&MSVCRT__iob[1])
#define MSVCRT_stderr (&MSVCRT__iob[2])
@ -117,12 +124,24 @@ static const unsigned int BAT = 'b' << 16 | 'a' << 8 | 't';
static const unsigned int CMD = 'c' << 16 | 'm' << 8 | 'd';
static const unsigned int COM = 'c' << 16 | 'o' << 8 | 'm';
#define TOUL(x) (ULONGLONG)((WCHAR)L##x)
static const ULONGLONG WCEXE = TOUL('e') << 32 | TOUL('x') << 16 | TOUL('e');
static const ULONGLONG WCBAT = TOUL('b') << 32 | TOUL('a') << 16 | TOUL('t');
static const ULONGLONG WCCMD = TOUL('c') << 32 | TOUL('m') << 16 | TOUL('d');
static const ULONGLONG WCCOM = TOUL('c') << 32 | TOUL('o') << 16 | TOUL('m');
extern CRITICAL_SECTION MSVCRT_file_cs;
#define LOCK_FILES EnterCriticalSection(&MSVCRT_file_cs)
#define UNLOCK_FILES LeaveCriticalSection(&MSVCRT_file_cs)
time_t __cdecl MSVCRT_time(time_t *);
int __cdecl MSVCRT__getdrive(void);
WCHAR *__cdecl MSVCRT__wcsdup(const WCHAR *);
unsigned int __cdecl wcslen(const WCHAR*);
int __cdecl iswalpha(WCHAR);
int __cdecl towupper(WCHAR);
int __cdecl towlower(WCHAR);
int __cdecl MSVCRT__vsnwprintf(WCHAR *,unsigned int,const WCHAR *,va_list);
/* INTERNAL: Get the HANDLE for a fd */
static HANDLE MSVCRT__fdtoh(int fd)
@ -246,14 +265,10 @@ int __cdecl MSVCRT__access(const char *filename, int mode)
{
DWORD attr = GetFileAttributesA(filename);
if (attr == 0xffffffff)
TRACE("(%s,%d) %ld\n",filename,mode,attr);
if (!filename || attr == 0xffffffff)
{
if (!filename)
{
/* FIXME: Should GetFileAttributesA() return this? */
MSVCRT__set_errno(ERROR_INVALID_DATA);
return -1;
}
MSVCRT__set_errno(GetLastError());
return -1;
}
@ -262,10 +277,30 @@ int __cdecl MSVCRT__access(const char *filename, int mode)
MSVCRT__set_errno(ERROR_ACCESS_DENIED);
return -1;
}
TRACE(":file %s, mode (%d) ok\n",filename,mode);
return 0;
}
/*********************************************************************
* _waccess (MSVCRT.@)
*/
int __cdecl MSVCRT__waccess(const WCHAR *filename, int mode)
{
DWORD attr = GetFileAttributesW(filename);
TRACE("(%s,%d) %ld\n",debugstr_w(filename),mode,attr);
if (!filename || attr == 0xffffffff)
{
MSVCRT__set_errno(GetLastError());
return -1;
}
if ((attr & FILE_ATTRIBUTE_READONLY) && (mode & W_OK))
{
MSVCRT__set_errno(ERROR_ACCESS_DENIED);
return -1;
}
return 0;
}
/*********************************************************************
* _chmod (MSVCRT.@)
@ -286,15 +321,47 @@ int __cdecl MSVCRT__chmod(const char *path, int flags)
return -1;
}
/*********************************************************************
* _wchmod (MSVCRT.@)
*/
int __cdecl MSVCRT__wchmod(const WCHAR *path, int flags)
{
DWORD oldFlags = GetFileAttributesW(path);
if (oldFlags != 0x0FFFFFFFF)
{
DWORD newFlags = (flags & _S_IWRITE)? oldFlags & ~FILE_ATTRIBUTE_READONLY:
oldFlags | FILE_ATTRIBUTE_READONLY;
if (newFlags == oldFlags || SetFileAttributesW(path, newFlags))
return 0;
}
MSVCRT__set_errno(GetLastError());
return -1;
}
/*********************************************************************
* _unlink (MSVCRT.@)
*/
int __cdecl MSVCRT__unlink(const char *path)
{
TRACE("path (%s)\n",path);
TRACE("(%s)\n",path);
if(DeleteFileA(path))
return 0;
TRACE("failed-last error (%ld)\n",GetLastError());
TRACE("failed (%ld)\n",GetLastError());
MSVCRT__set_errno(GetLastError());
return -1;
}
/*********************************************************************
* _wunlink (MSVCRT.@)
*/
int __cdecl MSVCRT__wunlink(const WCHAR *path)
{
TRACE("(%s)\n",debugstr_w(path));
if(DeleteFileW(path))
return 0;
TRACE("failed (%ld)\n",GetLastError());
MSVCRT__set_errno(GetLastError());
return -1;
}
@ -458,7 +525,7 @@ LONG __cdecl MSVCRT__lseek(int fd, LONG offset, int whence)
/*********************************************************************
* rewind (MSVCRT.@)
*/
VOID __cdecl MSVCRT_rewind(MSVCRT_FILE* file)
void __cdecl MSVCRT_rewind(MSVCRT_FILE* file)
{
TRACE(":file (%p) fd (%d)\n",file,file->_file);
MSVCRT__lseek(file->_file,0,SEEK_SET);
@ -479,6 +546,20 @@ MSVCRT_FILE* __cdecl MSVCRT__fdopen(int fd, const char *mode)
return file;
}
/*********************************************************************
* _wfdopen (MSVCRT.@)
*/
MSVCRT_FILE* __cdecl MSVCRT__wfdopen(int fd, const WCHAR *mode)
{
MSVCRT_FILE* file = MSVCRT__alloc_fp(fd);
TRACE(":fd (%d) mode (%s) FILE* (%p)\n",fd,debugstr_w(mode),file);
if (file)
MSVCRT_rewind(file);
return file;
}
/*********************************************************************
* _filelength (MSVCRT.@)
*/
@ -510,7 +591,7 @@ int __cdecl MSVCRT__fileno(MSVCRT_FILE* file)
/*********************************************************************
* _flushall (MSVCRT.@)
*/
int __cdecl MSVCRT__flushall(VOID)
int __cdecl MSVCRT__flushall(void)
{
int num_flushed = 0, i = 3;
@ -664,13 +745,47 @@ char *__cdecl MSVCRT__mktemp(char *pattern)
do
{
if (GetFileAttributesA(retVal) == 0xFFFFFFFF &&
GetLastError() == ERROR_FILE_NOT_FOUND)
GetLastError() == ERROR_FILE_NOT_FOUND)
return retVal;
*pattern = letter++;
} while(letter != '|');
return NULL;
}
/*********************************************************************
* _wmktemp (MSVCRT.@)
*/
WCHAR *__cdecl MSVCRT__wmktemp(WCHAR *pattern)
{
int numX = 0;
WCHAR *retVal = pattern;
int id;
WCHAR letter = (WCHAR)L'a';
while(*pattern)
numX = (*pattern++ == (WCHAR)L'X')? numX + 1 : 0;
if (numX < 5)
return NULL;
pattern--;
id = GetCurrentProcessId();
numX = 6;
while(numX--)
{
int tempNum = id / 10;
*pattern-- = id - (tempNum * 10) + (WCHAR)L'0';
id = tempNum;
}
pattern++;
do
{
if (GetFileAttributesW(retVal) == 0xFFFFFFFF &&
GetLastError() == ERROR_FILE_NOT_FOUND)
return retVal;
*pattern = letter++;
} while(letter != (WCHAR)L'|');
return NULL;
}
/*********************************************************************
* _open (MSVCRT.@)
*/
@ -757,6 +872,24 @@ int __cdecl MSVCRT__open(const char *path,int flags)
return fd;
}
/*********************************************************************
* _wopen (MSVCRT.@)
*/
int __cdecl MSVCRT__wopen(const WCHAR *path,int flags)
{
const unsigned int len = wcslen(path);
char *patha = MSVCRT_calloc(len + 1,1);
if (patha && WideCharToMultiByte(CP_ACP,0,path,len,patha,len,NULL,NULL))
{
int retval = MSVCRT__open(patha,flags);
MSVCRT_free(patha);
return retval;
}
MSVCRT__set_errno(GetLastError());
return -1;
}
/*********************************************************************
* _creat (MSVCRT.@)
*/
@ -766,6 +899,15 @@ int __cdecl MSVCRT__creat(const char *path, int flags)
return MSVCRT__open(path, usedFlags);
}
/*********************************************************************
* _wcreat (MSVCRT.@)
*/
int __cdecl MSVCRT__wcreat(const WCHAR *path, int flags)
{
int usedFlags = (flags & _O_TEXT)| _O_CREAT| _O_WRONLY| _O_TRUNC;
return MSVCRT__wopen(path, usedFlags);
}
/*********************************************************************
* _open_osfhandle (MSVCRT.@)
*/
@ -798,7 +940,7 @@ int __cdecl MSVCRT__rmtmp(void)
/*********************************************************************
* _read (MSVCRT.@)
*/
int __cdecl MSVCRT__read(int fd, LPVOID buf, unsigned int count)
int __cdecl MSVCRT__read(int fd, void *buf, unsigned int count)
{
DWORD num_read;
HANDLE hand = MSVCRT__fdtoh(fd);
@ -865,7 +1007,7 @@ int __cdecl MSVCRT__stat(const char* path, struct _stat * buf)
if (!GetFileAttributesExA(path, GetFileExInfoStandard, &hfi))
{
TRACE("failed-last error (%ld)\n",GetLastError());
TRACE("failed (%ld)\n",GetLastError());
MSVCRT__set_errno(ERROR_FILE_NOT_FOUND);
return -1;
}
@ -890,10 +1032,10 @@ int __cdecl MSVCRT__stat(const char* path, struct _stat * buf)
/* executable? */
if (plen > 6 && path[plen-4] == '.') /* shortest exe: "\x.exe" */
{
unsigned int ext = tolower(path[plen-1]) | (tolower(path[plen-2]) << 8)
| (tolower(path[plen-3]) << 16);
unsigned int ext = tolower(path[plen-1]) | (tolower(path[plen-2]) << 8) |
(tolower(path[plen-3]) << 16);
if (ext == EXE || ext == BAT || ext == CMD || ext == COM)
mode |= MSVCRT_S_IEXEC;
mode |= MSVCRT_S_IEXEC;
}
}
@ -908,7 +1050,68 @@ int __cdecl MSVCRT__stat(const char* path, struct _stat * buf)
RtlTimeToSecondsSince1970(&hfi.ftLastWriteTime, &dw);
buf->st_mtime = buf->st_ctime = dw;
TRACE("\n%d %d %d %d %d %d\n", buf->st_mode,buf->st_nlink,buf->st_size,
buf->st_atime,buf->st_mtime, buf->st_ctime);
buf->st_atime,buf->st_mtime, buf->st_ctime);
return 0;
}
/*********************************************************************
* _wstat (MSVCRT.@)
*/
int __cdecl MSVCRT__wstat(const WCHAR* path, struct _stat * buf)
{
DWORD dw;
WIN32_FILE_ATTRIBUTE_DATA hfi;
unsigned short mode = MSVCRT_S_IREAD;
int plen;
TRACE(":file (%s) buf(%p)\n",debugstr_w(path),buf);
if (!GetFileAttributesExW(path, GetFileExInfoStandard, &hfi))
{
TRACE("failed (%ld)\n",GetLastError());
MSVCRT__set_errno(ERROR_FILE_NOT_FOUND);
return -1;
}
memset(buf,0,sizeof(struct _stat));
/* FIXME: rdev isnt drive num,despite what the docs say-what is it? */
if (iswalpha(*path))
buf->st_dev = buf->st_rdev = towupper(*path - (WCHAR)L'A'); /* drive num */
else
buf->st_dev = buf->st_rdev = MSVCRT__getdrive() - 1;
plen = wcslen(path);
/* Dir, or regular file? */
if ((hfi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ||
(path[plen-1] == (WCHAR)L'\\'))
mode |= (_S_IFDIR | MSVCRT_S_IEXEC);
else
{
mode |= _S_IFREG;
/* executable? */
if (plen > 6 && path[plen-4] == (WCHAR)L'.') /* shortest exe: "\x.exe" */
{
ULONGLONG ext = towlower(path[plen-1]) | (towlower(path[plen-2]) << 16) |
((ULONGLONG)towlower(path[plen-3]) << 32);
if (ext == WCEXE || ext == WCBAT || ext == WCCMD || ext == WCCOM)
mode |= MSVCRT_S_IEXEC;
}
}
if (!(hfi.dwFileAttributes & FILE_ATTRIBUTE_READONLY))
mode |= MSVCRT_S_IWRITE;
buf->st_mode = mode;
buf->st_nlink = 1;
buf->st_size = hfi.nFileSizeLow;
RtlTimeToSecondsSince1970(&hfi.ftLastAccessTime, &dw);
buf->st_atime = dw;
RtlTimeToSecondsSince1970(&hfi.ftLastWriteTime, &dw);
buf->st_mtime = buf->st_ctime = dw;
TRACE("\n%d %d %d %d %d %d\n", buf->st_mode,buf->st_nlink,buf->st_size,
buf->st_atime,buf->st_mtime, buf->st_ctime);
return 0;
}
@ -933,7 +1136,24 @@ char *__cdecl MSVCRT__tempnam(const char *dir, const char *prefix)
TRACE("got name (%s)\n",tmpbuf);
return MSVCRT__strdup(tmpbuf);
}
TRACE("failed-last error (%ld)\n",GetLastError());
TRACE("failed (%ld)\n",GetLastError());
return NULL;
}
/*********************************************************************
* _wtempnam (MSVCRT.@)
*/
WCHAR *__cdecl MSVCRT__wtempnam(const WCHAR *dir, const WCHAR *prefix)
{
WCHAR tmpbuf[MAX_PATH];
TRACE("dir (%s) prefix (%s)\n",debugstr_w(dir),debugstr_w(prefix));
if (GetTempFileNameW(dir,prefix,0,tmpbuf))
{
TRACE("got name (%s)\n",debugstr_w(tmpbuf));
return MSVCRT__wcsdup(tmpbuf);
}
TRACE("failed (%ld)\n",GetLastError());
return NULL;
}
@ -943,7 +1163,7 @@ char *__cdecl MSVCRT__tempnam(const char *dir, const char *prefix)
int __cdecl MSVCRT__umask(int umask)
{
int old_umask = MSVCRT_umask;
TRACE("umask (%d)\n",umask);
TRACE("(%d)\n",umask);
MSVCRT_umask = umask;
return old_umask;
}
@ -964,10 +1184,26 @@ int __cdecl MSVCRT__utime(const char *path, struct _utimbuf *t)
return -1;
}
/*********************************************************************
* _wutime (MSVCRT.@)
*/
int __cdecl MSVCRT__wutime(const WCHAR *path, struct _utimbuf *t)
{
int fd = MSVCRT__wopen(path, _O_WRONLY | _O_BINARY);
if (fd > 0)
{
int retVal = MSVCRT__futime(fd, t);
MSVCRT__close(fd);
return retVal;
}
return -1;
}
/*********************************************************************
* _write (MSVCRT.@)
*/
unsigned int __cdecl MSVCRT__write(int fd, LPCVOID buf, unsigned int count)
unsigned int __cdecl MSVCRT__write(int fd, const void *buf, unsigned int count)
{
DWORD num_written;
HANDLE hand = MSVCRT__fdtoh(fd);
@ -1010,7 +1246,7 @@ int __cdecl MSVCRT__putw(int val, MSVCRT_FILE* file)
/*********************************************************************
* clearerr (MSVCRT.@)
*/
VOID __cdecl MSVCRT_clearerr(MSVCRT_FILE* file)
void __cdecl MSVCRT_clearerr(MSVCRT_FILE* file)
{
TRACE(":file (%p) fd (%d)\n",file,file->_file);
file->_flag &= ~(_IOERR | _IOEOF);
@ -1087,7 +1323,7 @@ int __cdecl MSVCRT_fgetpos(MSVCRT_FILE* file, MSVCRT_fpos_t *pos)
/*********************************************************************
* fgets (MSVCRT.@)
*/
CHAR* __cdecl MSVCRT_fgets(char *s, int size, MSVCRT_FILE* file)
char *__cdecl MSVCRT_fgets(char *s, int size, MSVCRT_FILE* file)
{
int cc;
char * buf_start = s;
@ -1181,7 +1417,7 @@ MSVCRT_FILE* __cdecl MSVCRT_fopen(const char *path, const char *mode)
int flags = 0, plus = 0, fd;
const char* search = mode;
TRACE(":path (%s) mode (%s)\n",path,mode);
TRACE("(%s,%s)\n",path,mode);
while (*search)
if (*search++ == '+')
@ -1226,13 +1462,38 @@ MSVCRT_FILE* __cdecl MSVCRT_fopen(const char *path, const char *mode)
return NULL;
file = MSVCRT__alloc_fp(fd);
TRACE(":get file (%p)\n",file);
TRACE(":got (%p)\n",file);
if (!file)
MSVCRT__close(fd);
return file;
}
/*********************************************************************
* _wfopen (MSVCRT.@)
*/
MSVCRT_FILE *__cdecl MSVCRT__wfopen(const WCHAR *path, const WCHAR *mode)
{
const unsigned int plen = wcslen(path), mlen = wcslen(mode);
char *patha = MSVCRT_calloc(plen + 1, 1);
char *modea = MSVCRT_calloc(mlen + 1, 1);
TRACE("(%s,%s)\n",debugstr_w(path),debugstr_w(mode));
if (patha && modea &&
WideCharToMultiByte(CP_ACP,0,path,plen,patha,plen,NULL,NULL) &&
WideCharToMultiByte(CP_ACP,0,mode,mlen,modea,mlen,NULL,NULL))
{
MSVCRT_FILE *retval = MSVCRT_fopen(patha,modea);
MSVCRT_free(patha);
MSVCRT_free(modea);
return retval;
}
MSVCRT__set_errno(GetLastError());
return NULL;
}
/*********************************************************************
* _fsopen (MSVCRT.@)
*/
@ -1242,6 +1503,16 @@ MSVCRT_FILE* __cdecl MSVCRT__fsopen(const char *path, const char *mode, int sha
return MSVCRT_fopen(path,mode);
}
/*********************************************************************
* _wfsopen (MSVCRT.@)
*/
MSVCRT_FILE* __cdecl MSVCRT__wfsopen(const WCHAR *path, const WCHAR *mode, int share)
{
FIXME(":(%s,%s,%d),ignoring share mode!\n",
debugstr_w(path),debugstr_w(mode),share);
return MSVCRT__wfopen(path,mode);
}
/*********************************************************************
* fputc (MSVCRT.@)
*/
@ -1269,7 +1540,7 @@ int __cdecl MSVCRT__fputchar(int c)
/*********************************************************************
* fread (MSVCRT.@)
*/
DWORD __cdecl MSVCRT_fread(LPVOID ptr, int size, int nmemb, MSVCRT_FILE* file)
DWORD __cdecl MSVCRT_fread(void *ptr, int size, int nmemb, MSVCRT_FILE* file)
{
DWORD read = MSVCRT__read(file->_file,ptr, size * nmemb);
if (read <= 0)
@ -1473,7 +1744,7 @@ LONG __cdecl MSVCRT_ftell(MSVCRT_FILE* file)
/*********************************************************************
* fwrite (MSVCRT.@)
*/
unsigned int __cdecl MSVCRT_fwrite(LPCVOID ptr, int size, int nmemb, MSVCRT_FILE* file)
unsigned int __cdecl MSVCRT_fwrite(const void *ptr, int size, int nmemb, MSVCRT_FILE* file)
{
unsigned int written = MSVCRT__write(file->_file, ptr, size * nmemb);
if (written <= 0)
@ -1489,6 +1760,14 @@ int __cdecl MSVCRT_fputs(const char *s, MSVCRT_FILE* file)
return MSVCRT_fwrite(s,strlen(s),1,file) == 1 ? 0 : MSVCRT_EOF;
}
/*********************************************************************
* fputws (MSVCRT.@)
*/
int __cdecl MSVCRT_fputws(const WCHAR *s, MSVCRT_FILE* file)
{
return MSVCRT_fwrite(s,wcslen(s),1,file) == 1 ? 0 : MSVCRT_EOF;
}
/*********************************************************************
* getchar (MSVCRT.@)
*/
@ -1554,15 +1833,39 @@ int __cdecl MSVCRT_puts(const char *s)
return retval;
}
/*********************************************************************
* _putws (MSVCRT.@)
*/
int __cdecl MSVCRT__putws(const WCHAR *s)
{
static const WCHAR nl = (WCHAR)L'\n';
if (MSVCRT_fwrite(s,wcslen(s),1,MSVCRT_stdout) == 1)
return MSVCRT_fwrite(&nl,sizeof(nl),1,MSVCRT_stdout) == 1 ? 0 : MSVCRT_EOF;
return MSVCRT_EOF;
}
/*********************************************************************
* remove (MSVCRT.@)
*/
int __cdecl MSVCRT_remove(const char *path)
{
TRACE(":path (%s)\n",path);
TRACE("(%s)\n",path);
if (DeleteFileA(path))
return 0;
TRACE(":failed-last error (%ld)\n",GetLastError());
TRACE(":failed (%ld)\n",GetLastError());
MSVCRT__set_errno(GetLastError());
return -1;
}
/*********************************************************************
* _wremove (MSVCRT.@)
*/
int __cdecl MSVCRT__wremove(const WCHAR *path)
{
TRACE("(%s)\n",debugstr_w(path));
if (DeleteFileW(path))
return 0;
TRACE(":failed (%ld)\n",GetLastError());
MSVCRT__set_errno(GetLastError());
return -1;
}
@ -1589,21 +1892,38 @@ int __cdecl MSVCRT_rename(const char *oldpath,const char *newpath)
TRACE(":from %s to %s\n",oldpath,newpath);
if (MoveFileExA(oldpath, newpath, MOVEFILE_REPLACE_EXISTING))
return 0;
TRACE(":failed-last error (%ld)\n",GetLastError());
TRACE(":failed (%ld)\n",GetLastError());
MSVCRT__set_errno(GetLastError());
return -1;
}
/*********************************************************************
* _wrename (MSVCRT.@)
*/
int __cdecl MSVCRT__wrename(const WCHAR *oldpath,const WCHAR *newpath)
{
TRACE(":from %s to %s\n",debugstr_w(oldpath),debugstr_w(newpath));
if (MoveFileExW(oldpath, newpath, MOVEFILE_REPLACE_EXISTING))
return 0;
TRACE(":failed (%ld)\n",GetLastError());
MSVCRT__set_errno(GetLastError());
return -1;
}
/*********************************************************************
* setvbuf (MSVCRT.@)
*/
void MSVCRT_setvbuf(MSVCRT_FILE* file, char *buf, int mode, unsigned int size)
{
FIXME("(%p,%p,%d,%d)stub\n",file, buf, mode, size);
}
/*********************************************************************
* setbuf (MSVCRT.@)
*/
int __cdecl MSVCRT_setbuf(MSVCRT_FILE* file, char *buf)
void __cdecl MSVCRT_setbuf(MSVCRT_FILE* file, char *buf)
{
TRACE(":file (%p) fd (%d) buf (%p)\n", file, file->_file,buf);
if (buf)
WARN(":user buffer will not be used!\n");
/* FIXME: no buffering for now */
return 0;
MSVCRT_setvbuf(file, buf, buf ? _IOFBF : _IONBF, BUFSIZ);
}
/*********************************************************************
@ -1644,7 +1964,7 @@ extern int vsnprintf(void *, unsigned int, const void*, va_list);
int __cdecl MSVCRT_vfprintf(MSVCRT_FILE* file, const char *format, va_list valist)
{
char buf[2048], *mem = buf;
int written, resize = sizeof(buf);
int written, resize = sizeof(buf), retval;
/* There are two conventions for vsnprintf failing:
* Return -1 if we truncated, or
* Return the number of bytes that would have been written
@ -1659,9 +1979,49 @@ int __cdecl MSVCRT_vfprintf(MSVCRT_FILE* file, const char *format, va_list valis
if (!(mem = (char *)MSVCRT_malloc(resize)))
return MSVCRT_EOF;
}
retval = MSVCRT_fwrite(mem, 1, written, file);
if (mem != buf)
MSVCRT_free (mem);
return MSVCRT_fwrite(mem, 1, written, file);
return retval;
}
/*********************************************************************
* vfwprintf (MSVCRT.@)
*/
int __cdecl MSVCRT_vfwprintf(MSVCRT_FILE* file, const WCHAR *format, va_list valist)
{
WCHAR buf[2048], *mem = buf;
int written, resize = sizeof(buf) / sizeof(WCHAR), retval;
/* See vfprintf comments */
while ((written = MSVCRT__vsnwprintf(mem, resize, format, valist)) == -1 ||
written > resize)
{
resize = (written == -1 ? resize * 2 : written + sizeof(WCHAR));
if (mem != buf)
MSVCRT_free (mem);
if (!(mem = (WCHAR *)MSVCRT_malloc(resize)))
return MSVCRT_EOF;
}
retval = MSVCRT_fwrite(mem, 1, written * sizeof (WCHAR), file);
if (mem != buf)
MSVCRT_free (mem);
return retval;
}
/*********************************************************************
* vprintf (MSVCRT.@)
*/
int __cdecl MSVCRT_vprintf(const char *format, va_list valist)
{
return MSVCRT_vfprintf(MSVCRT_stdout,format,valist);
}
/*********************************************************************
* vwprintf (MSVCRT.@)
*/
int __cdecl MSVCRT_vwprintf(const WCHAR *format, va_list valist)
{
return MSVCRT_vfwprintf(MSVCRT_stdout,format,valist);
}
/*********************************************************************
@ -1677,6 +2037,19 @@ int __cdecl MSVCRT_fprintf(MSVCRT_FILE* file, const char *format, ...)
return res;
}
/*********************************************************************
* fwprintf (MSVCRT.@)
*/
int __cdecl MSVCRT_fwprintf(MSVCRT_FILE* file, const WCHAR *format, ...)
{
va_list valist;
int res;
va_start(valist, format);
res = MSVCRT_vfwprintf(file, format, valist);
va_end(valist);
return res;
}
/*********************************************************************
* printf (MSVCRT.@)
*/
@ -1690,3 +2063,15 @@ int __cdecl MSVCRT_printf(const char *format, ...)
return res;
}
/*********************************************************************
* wprintf (MSVCRT.@)
*/
int __cdecl MSVCRT_wprintf(const WCHAR *format, ...)
{
va_list valist;
int res;
va_start(valist, format);
res = MSVCRT_vwprintf(format, valist);
va_end(valist);
return res;
}

View File

@ -39,7 +39,7 @@ static MSVCRT_new_handler_func MSVCRT_new_handler;
static int MSVCRT_new_mode;
/*********************************************************************
* ??2@YAPAXI@Z (MSVCRT.@)
* operator_new (MSVCRT.@)
*/
void *__cdecl MSVCRT_operator_new(unsigned long size)
{
@ -53,7 +53,7 @@ void *__cdecl MSVCRT_operator_new(unsigned long size)
}
/*********************************************************************
* ??3@YAXPAX@Z (MSVCRT.@)
* operator_delete (MSVCRT.@)
*/
void __cdecl MSVCRT_operator_delete(void *mem)
{

View File

@ -495,7 +495,7 @@ const char *__cdecl MSVCRT__Getnames(void)
* _Strftime (MSVCRT.@)
*/
const char *__cdecl MSVCRT__Strftime(char *out, unsigned int len, const char *fmt,
const /* struct tm */ void *tm, void *foo)
const void *tm, void *foo)
{
/* FIXME: */
TRACE("(%p %d %s %p %p) stub", out, len, fmt, tm, foo);

View File

@ -3,6 +3,7 @@
*
* Copyright 2000 Jon Griffiths
*/
#include "config.h"
#include "msvcrt.h"
#include "ms_errno.h"
@ -437,7 +438,7 @@ unsigned int __cdecl MSVCRT__statusfp(void)
*/
unsigned int __cdecl MSVCRT__clearfp(void)
{
UINT retVal = MSVCRT__statusfp();
unsigned int retVal = MSVCRT__statusfp();
#if defined(__GNUC__) && defined(__i386__)
__asm__ __volatile__( "fnclex" );
#else
@ -483,7 +484,7 @@ double __cdecl MSVCRT__chgsign(double num)
unsigned int __cdecl MSVCRT__control87(unsigned int newval, unsigned int mask)
{
#if defined(__GNUC__) && defined(__i386__)
UINT fpword, flags = 0;
unsigned int fpword, flags = 0;
/* Get fp control word */
__asm__ __volatile__( "fstsw %0" : "=m" (fpword) : );

View File

@ -8,7 +8,7 @@
DEFAULT_DEBUG_CHANNEL(msvcrt);
typedef INT (__cdecl *MSVCRT_comp_func)(LPCVOID, LPCVOID );
typedef int (__cdecl *MSVCRT_comp_func)(const void*, const void*);
/*********************************************************************
* _beep (MSVCRT.@)
@ -24,7 +24,7 @@ extern int rand(void);
/*********************************************************************
* rand (MSVCRT.@)
*/
INT __cdecl MSVCRT_rand()
int __cdecl MSVCRT_rand()
{
return (rand() & 0x7fff);
}
@ -32,7 +32,7 @@ INT __cdecl MSVCRT_rand()
/*********************************************************************
* _sleep (MSVCRT.@)
*/
VOID __cdecl MSVCRT__sleep(ULONG timeout)
void __cdecl MSVCRT__sleep(unsigned long timeout)
{
TRACE("MSVCRT__sleep for %ld milliseconds\n",timeout);
Sleep((timeout)?timeout:1);

View File

@ -51,7 +51,7 @@ debug_channels (msvcrt)
@ stub ?before@type_info@@QBEHABV1@@Z #(ptr ptr) stdcall
@ stdcall ?name@type_info@@QBEPBDXZ(ptr) MSVCRT_type_info_name
@ stdcall ?raw_name@type_info@@QBEPBDXZ(ptr) MSVCRT_type_info_raw_name
@ stub ?set_new_handler@@YAP6AXXZP6AXXZ@Z
@ stub ?set_new_handler@@YAP6AXXZP6AXXZ@Z
@ stub ?set_terminate@@YAP6AXXZP6AXXZ@Z
@ stub ?set_unexpected@@YAP6AXXZP6AXXZ@Z
@ stub ?terminate@@YAXXZ #()
@ -93,7 +93,7 @@ debug_channels (msvcrt)
@ stub __crtCompareStringA
@ stub __crtGetLocaleInfoW
@ stub __crtLCMapStringA
@ cdecl __dllonexit() MSVCRT___dllonexit
@ cdecl __dllonexit(ptr ptr ptr) MSVCRT___dllonexit
@ cdecl __doserrno() MSVCRT___doserrno
@ stub __fpecode #()
@ cdecl __getmainargs(ptr ptr ptr long) MSVCRT___getmainargs
@ -183,7 +183,7 @@ debug_channels (msvcrt)
@ cdecl _chdir(str) MSVCRT__chdir
@ cdecl _chdrive(long) MSVCRT__chdrive
@ cdecl _chgsign( double ) MSVCRT__chgsign
@ cdecl -i386 _chkesp() MSVCRT__chkesp
@ cdecl -noimport -i386 _chkesp() MSVCRT__chkesp
@ cdecl _chmod(str long) MSVCRT__chmod
@ stub _chsize #(long long)
@ cdecl _clearfp() MSVCRT__clearfp
@ -245,13 +245,13 @@ debug_channels (msvcrt)
@ cdecl _fpreset() MSVCRT__fpreset
@ cdecl _fputchar(long) MSVCRT__fputchar
@ cdecl _fputwchar(long) MSVCRT__fputwchar
@ cdecl _fsopen(str str) MSVCRT__fsopen
@ cdecl _fsopen(str str long) MSVCRT__fsopen
@ cdecl _fstat(long ptr) MSVCRT__fstat
@ stub _fstati64 #(long ptr)
@ cdecl _ftime(ptr) MSVCRT__ftime
@ forward _ftol ntdll._ftol
@ forward -noimport _ftol ntdll._ftol
@ cdecl _fullpath(str str long) MSVCRT__fullpath
@ cdecl _futime() MSVCRT__futime
@ cdecl _futime(long ptr) MSVCRT__futime
@ cdecl _gcvt( double long str) gcvt
@ cdecl _get_osfhandle(long) MSVCRT__get_osfhandle
@ stub _get_sbh_threshold #()
@ -280,9 +280,9 @@ debug_channels (msvcrt)
@ stub _i64toa #(long str long)
@ stub _i64tow #(long wstr long)
@ cdecl _initterm(ptr ptr) MSVCRT__initterm
@ stub -i386 _inp #(long)
@ stub -i386 _inpd #(long)
@ stub -i386 _inpw #(long)
@ stub _inp #(long) -i386
@ stub _inpd #(long) -i386
@ stub _inpw #(long) -i386
@ extern _iob MSVCRT__iob
@ cdecl _isatty(long) MSVCRT__isatty
@ cdecl _isctype(long long) MSVCRT__isctype
@ -316,7 +316,7 @@ debug_channels (msvcrt)
@ cdecl _ismbslead(ptr ptr) MSVCRT__ismbslead
@ cdecl _ismbstrail(ptr ptr) MSVCRT__ismbstrail
@ cdecl _isnan( double ) MSVCRT__isnan
@ forward _itoa ntdll._itoa
@ forward -noimport _itoa ntdll._itoa
@ cdecl _itow(long wstr long) MSVCRT__itow
@ cdecl _j0(double) j0
@ cdecl _j1(double) j1
@ -334,8 +334,8 @@ debug_channels (msvcrt)
@ cdecl _lsearch(ptr ptr long long ptr) MSVCRT__lsearch
@ cdecl _lseek(long long long) MSVCRT__lseek
@ stub _lseeki64 #(long long long)
@ forward _ltoa ntdll._ltoa
@ forward _ltow ntdll._ltow
@ forward -noimport _ltoa ntdll._ltoa
@ stub _ltow #(long)
@ cdecl _makepath(str str str str str) MSVCRT__makepath
@ cdecl _mbbtombc(long) MSVCRT__mbbtombc
@ stub _mbbtype #(long long)
@ -393,7 +393,7 @@ debug_channels (msvcrt)
@ cdecl _mbstrlen(str) MSVCRT__mbstrlen
@ stub _mbsupr #(str)
@ cdecl _memccpy(ptr ptr long long) memccpy
@ forward _memicmp ntdll._memicmp
@ forward -noimport _memicmp ntdll._memicmp
@ cdecl _mkdir(str) MSVCRT__mkdir
@ cdecl _mktemp(str) MSVCRT__mktemp
@ cdecl _msize(ptr) MSVCRT__msize
@ -412,9 +412,9 @@ debug_channels (msvcrt)
@ stub _popen #(str str)
@ cdecl _purecall() MSVCRT__purecall
@ cdecl _putch(long) MSVCRT__putch
@ stub _putenv #(str)
@ cdecl _putenv(str) MSVCRT__putenv
@ cdecl _putw(long ptr) MSVCRT__putw
@ stub _putws #(wstr)
@ cdecl _putws(wstr) MSVCRT__putws
@ stub _pwctype
@ cdecl _read(long ptr long) MSVCRT__read
@ cdecl _rmdir(str) MSVCRT__rmdir
@ -439,17 +439,17 @@ debug_channels (msvcrt)
@ stub _setsystime #(ptr long)
@ cdecl _sleep(long) MSVCRT__sleep
@ varargs _snprintf(str long str) snprintf
@ stub _snwprintf #(wstr long wstr) varargs
@ forward -noimport _snwprintf ntdll._snwprintf
@ stub _sopen
@ stub _spawnl #(str str) varargs
@ stub _spawnle #(str str) varargs
@ stub _spawnlp #(str str) varargs
@ stub _spawnlpe #(str str) varargs
@ cdecl _spawnv(str str) MSVCRT__spawnv
@ cdecl _spawnve(str str str) MSVCRT__spawnve
@ cdecl _spawnvp(str str) MSVCRT__spawnvp
@ cdecl _spawnvpe(str str str) MSVCRT__spawnvpe
@ cdecl _splitpath(str str str str str) MSVCRT__splitpath
@ cdecl _spawnv(long str ptr) MSVCRT__spawnv
@ cdecl _spawnve(long str ptr ptr) MSVCRT__spawnve
@ cdecl _spawnvp(long str ptr) MSVCRT__spawnvp
@ cdecl _spawnvpe(long str ptr ptr) MSVCRT__spawnvpe
@ forward -noimport _splitpath ntdll._splitpath
@ cdecl _stat(str ptr) MSVCRT__stat
@ stub _stati64 #(str ptr)
@ cdecl _statusfp() MSVCRT__statusfp
@ -459,7 +459,7 @@ debug_channels (msvcrt)
@ cdecl _strerror(long) MSVCRT__strerror
@ cdecl _stricmp(str str) strcasecmp
@ stub _stricoll #(str str)
@ forward _strlwr ntdll._strlwr
@ forward -noimport _strlwr ntdll._strlwr
@ stub _strncoll #(str str long)
@ cdecl _strnicmp(str str long) strncasecmp
@ stub _strnicoll #(str str long)
@ -467,7 +467,7 @@ debug_channels (msvcrt)
@ cdecl _strrev(str) MSVCRT__strrev
@ cdecl _strset(str long) MSVCRT__strset
@ cdecl _strtime(str) MSVCRT__strtime
@ forward _strupr ntdll._strupr
@ forward -noimport _strupr ntdll._strupr
@ cdecl _swab(str str long) MSVCRT__swab
@ stub _sys_errlist #()
@ stub _sys_nerr #()
@ -481,8 +481,8 @@ debug_channels (msvcrt)
@ stub _tzset #()
@ stub _ui64toa #(long str long)
@ stub _ui64tow #(long wstr long)
@ forward _ultoa ntdll._ultoa
@ forward _ultow ntdll._ultow
@ forward -noimport _ultoa ntdll._ultoa
@ forward -noimport _ultow ntdll._ultow
@ cdecl _umask(long) MSVCRT__umask
@ cdecl _ungetch(long) MSVCRT__ungetch
@ cdecl _unlink(str) MSVCRT__unlink
@ -490,24 +490,24 @@ debug_channels (msvcrt)
@ stub _unlock
@ cdecl _utime(str ptr) MSVCRT__utime
@ cdecl _vsnprintf(ptr long ptr ptr) vsnprintf
@ stub _vsnwprintf #(wstr long wstr long)
@ stub _waccess #(wstr long)
@ cdecl _vsnwprintf(wstr long wstr long) MSVCRT__vsnwprintf
@ cdecl _waccess(wstr long) MSVCRT__waccess
@ stub _wasctime #(ptr)
@ cdecl _wchdir(wstr) MSVCRT__wchdir
@ stub _wchmod #(wstr long)
@ cdecl _wchmod(wstr long) MSVCRT__wchmod
@ extern _wcmdln MSVCRT__wcmdln
@ stub _wcreat #(wstr long)
@ cdecl _wcreat(wstr long) MSVCRT__wcreat
@ cdecl _wcsdup(wstr) MSVCRT__wcsdup
@ forward _wcsicmp ntdll._wcsicmp
@ forward -noimport _wcsicmp ntdll._wcsicmp
@ cdecl _wcsicoll(wstr wstr) MSVCRT__wcsicoll
@ stub _wcslwr #(wstr)
@ forward -noimport _wcslwr ntdll._wcslwr
@ stub _wcsncoll #(wstr wstr long)
@ forward _wcsnicmp ntdll._wcsnicmp
@ forward -noimport _wcsnicmp ntdll._wcsnicmp
@ stub _wcsnicoll #(wstr wstr long)
@ cdecl _wcsnset(wstr long long) MSVCRT__wcsnset
@ cdecl _wcsrev(wstr) MSVCRT__wcsrev
@ cdecl _wcsset(wstr long) MSVCRT__wcsset
@ forward _wcsupr ntdll._wcsupr
@ forward -noimport _wcsupr ntdll._wcsupr
@ stub _wctime #(ptr)
@ extern _wenviron MSVCRT__wenviron
@ stub _wexecl #(wstr wstr) varargs
@ -518,14 +518,14 @@ debug_channels (msvcrt)
@ stub _wexecve #(wstr wstr wstr)
@ stub _wexecvp #(wstr wstr)
@ stub _wexecvpe #(wstr wstr wstr)
@ stub _wfdopen #(long wstr)
@ cdecl _wfdopen(long wstr) MSVCRT__wfdopen
@ cdecl _wfindfirst(wstr ptr) MSVCRT__wfindfirst
@ stub _wfindfirsti64 #(wstr ptr)
@ cdecl _wfindnext(long ptr) MSVCRT__wfindnext
@ stub _wfindnexti64 #(long ptr)
@ stub _wfopen #(wstr wstr)
@ cdecl _wfopen(wstr wstr) MSVCRT__wfopen
@ stub _wfreopen #(wstr wstr ptr)
@ stub _wfsopen #(wstr wstr)
@ cdecl _wfsopen(wstr wstr) MSVCRT__wfsopen
@ stub _wfullpath #(wstr wstr long)
@ cdecl _wgetcwd(wstr long) MSVCRT__wgetcwd
@ cdecl _wgetdcwd(long wstr long) MSVCRT__wgetdcwd
@ -535,14 +535,14 @@ debug_channels (msvcrt)
@ extern _winver MSVCRT__winver
@ stub _wmakepath #(wstr wstr wstr wstr wstr)
@ cdecl _wmkdir(wstr) MSVCRT__wmkdir
@ stub _wmktemp #(wstr)
@ stub _wopen #(wstr long) varargs
@ cdecl _wmktemp(wstr) MSVCRT__wmktemp
@ cdecl _wopen(wstr long) MSVCRT__wopen
@ stub _wperror #(wstr)
@ stub _wpgmptr
@ stub _wpopen #(wstr wstr)
@ stub _wputenv #(wstr)
@ stub _wremove #(wstr)
@ stub _wrename #(wstr wstr)
@ cdecl _wputenv(wstr) MSVCRT__wputenv
@ cdecl _wremove(wstr) MSVCRT__wremove
@ cdecl _wrename(wstr wstr) MSVCRT__wrename
@ cdecl _write(long ptr long) MSVCRT__write
@ cdecl _wrmdir(wstr) MSVCRT__wrmdir
@ stub _wsearchenv #(wstr wstr wstr)
@ -556,28 +556,28 @@ debug_channels (msvcrt)
@ stub _wspawnve #(long wstr wstr wstr)
@ stub _wspawnvp #(long wstr wstr)
@ stub _wspawnvpe #(long wstr wstr wstr)
@ stub _wsplitpath #(wstr wstr wstr wstr wstr)
@ stub _wstat #(wstr ptr)
@ cdecl _wsplitpath(wstr wstr wstr wstr wstr) MSVCRT__wsplitpath
@ cdecl _wstat(wstr ptr) MSVCRT__wstat
@ stub _wstati64 #(wstr ptr)
@ stub _wstrdate #(wstr)
@ stub _wstrtime #(wstr)
@ stub _wsystem #(wstr)
@ stub _wtempnam #(wstr wstr)
@ cdecl _wtempnam(wstr wstr) MSVCRT__wtempnam
@ stub _wtmpnam #(wstr)
@ forward _wtoi NTDLL._wtoi
@ forward -noimport _wtoi NTDLL._wtoi
@ stub _wtoi64 #(wstr)
@ forward _wtol NTDLL._wtol
@ stub _wunlink #(wstr)
@ stub _wutime
@ cdecl _wunlink(wstr) MSVCRT__wunlink
@ cdecl _wutime(wstr ptr) MSVCRT__wutime
@ cdecl _y0(double) MSVCRT__y0
@ cdecl _y1(double) MSVCRT__y1
@ cdecl _yn(long double ) MSVCRT__yn
@ cdecl abort() MSVCRT_abort
@ cdecl abs(long) abs
@ forward -noimport abs ntdll.abs
@ cdecl acos( double ) acos
@ cdecl asctime(ptr) asctime
@ cdecl asin(double) asin
@ cdecl atan(double) atan
@ forward -noimport atan ntdll.atan
@ cdecl atan2(double double) atan2
@ cdecl atexit(ptr) MSVCRT_atexit
@ cdecl atof(str) atof
@ -585,7 +585,7 @@ debug_channels (msvcrt)
@ cdecl atol(str) atol
@ cdecl bsearch(ptr ptr long long ptr) bsearch
@ cdecl calloc(long long) MSVCRT_calloc
@ cdecl ceil(double) ceil
@ forward -noimport ceil ntdll.ceil
@ cdecl clearerr(ptr) MSVCRT_clearerr
@ cdecl clock() MSVCRT_clock
@ cdecl cos(double) cos
@ -595,7 +595,7 @@ debug_channels (msvcrt)
@ cdecl -noimport div(long long) MSVCRT_div
@ cdecl exit(long) MSVCRT_exit
@ cdecl exp(double) exp
@ cdecl fabs(double) fabs
@ forward -noimport fabs ntdll.fabs
@ cdecl fclose(ptr) MSVCRT_fclose
@ cdecl feof(ptr) MSVCRT_feof
@ cdecl ferror(ptr) MSVCRT_ferror
@ -605,23 +605,23 @@ debug_channels (msvcrt)
@ cdecl fgets(str long ptr) MSVCRT_fgets
@ cdecl fgetwc(ptr) MSVCRT_fgetwc
@ stub fgetws #(wstr long ptr)
@ cdecl floor(double) floor
@ forward -noimport floor ntdll.floor
@ cdecl fmod(double double) fmod
@ cdecl fopen(str str) MSVCRT_fopen
@ varargs fprintf(ptr str) MSVCRT_fprintf
@ cdecl fputc(long ptr) MSVCRT_fputc
@ cdecl fputs(str ptr) MSVCRT_fputs
@ cdecl fputwc(long ptr) MSVCRT_fputwc
@ stub fputws #(wstr ptr)
@ cdecl fread() MSVCRT_fread
@ cdecl free() MSVCRT_free
@ cdecl fputws(wstr ptr) MSVCRT_fputws
@ cdecl fread(ptr long long ptr) MSVCRT_fread
@ cdecl free(ptr) MSVCRT_free
@ cdecl freopen(str str ptr) MSVCRT_freopen
@ cdecl frexp(double ptr) frexp
@ varargs fscanf(ptr str) MSVCRT_fscanf
@ cdecl fseek(ptr long long) MSVCRT_fseek
@ cdecl fsetpos(ptr ptr) MSVCRT_fsetpos
@ cdecl ftell(ptr) MSVCRT_ftell
@ stub fwprintf #(ptr wstr) varargs
@ varargs fwprintf(ptr wstr) MSVCRT_fwprintf
@ cdecl fwrite(ptr long long ptr) MSVCRT_fwrite
@ stub fwscanf #(ptr wstr) varargs
@ cdecl getc(ptr) MSVCRT_getc
@ -631,7 +631,7 @@ debug_channels (msvcrt)
@ cdecl getwc(ptr) MSVCRT_getwc
@ cdecl getwchar() MSVCRT_getwchar
@ cdecl gmtime(ptr) gmtime
@ forward is_wctype ntdll.iswctype
@ forward -noimport is_wctype ntdll.iswctype
@ cdecl isalnum(long) MSVCRT_isalnum
@ cdecl isalpha(long) MSVCRT_isalpha
@ cdecl iscntrl(long) MSVCRT_iscntrl
@ -644,10 +644,10 @@ debug_channels (msvcrt)
@ cdecl isspace(long) MSVCRT_isspace
@ cdecl isupper(long) MSVCRT_isupper
@ cdecl iswalnum(long) MSVCRT_iswalnum
@ forward iswalpha ntdll._iswalpha
@ forward -noimport iswalpha ntdll._iswalpha
@ cdecl iswascii(long) MSVCRT_iswascii
@ cdecl iswcntrl(long) MSVCRT_iswcntrl
@ forward iswctype ntdll._iswctype
@ forward -noimport iswctype ntdll._iswctype
@ cdecl iswdigit(long) MSVCRT_iswdigit
@ cdecl iswgraph(long) MSVCRT_iswgraph
@ cdecl iswlower(long) MSVCRT_iswlower
@ -657,17 +657,17 @@ debug_channels (msvcrt)
@ cdecl iswupper(long) MSVCRT_iswupper
@ cdecl iswxdigit(long) MSVCRT_iswxdigit
@ cdecl isxdigit(long) MSVCRT_isxdigit
@ cdecl labs(long) labs
@ forward -noimport labs ntdll.labs
@ cdecl ldexp( double long) MSVCRT_ldexp
@ cdecl -noimport ldiv(long long) MSVCRT_ldiv
@ stub localeconv #()
@ cdecl localtime(ptr) localtime
@ cdecl log(double) log
@ forward -noimport log ntdll.log
@ cdecl log10(double) log10
@ cdecl longjmp(long long) MSVCRT_longjmp
@ cdecl malloc(long) MSVCRT_malloc
@ stub mblen #(str long)
@ forward mbstowcs ntdll.mbstowcs
@ forward -noimport mbstowcs ntdll.mbstowcs
@ cdecl mbtowc(wstr str long) MSVCRT_mbtowc
@ cdecl memchr(ptr long long) memchr
@ cdecl memcmp(ptr ptr long) memcmp
@ -687,19 +687,19 @@ debug_channels (msvcrt)
@ cdecl qsort(ptr long long ptr) qsort
@ stub raise #(long)
@ cdecl rand() MSVCRT_rand
@ cdecl realloc() MSVCRT_realloc
@ cdecl realloc(ptr long) MSVCRT_realloc
@ cdecl remove(str) MSVCRT_remove
@ cdecl rename(str str) MSVCRT_rename
@ cdecl rewind(ptr) MSVCRT_rewind
@ varargs scanf(str) MSVCRT_scanf
@ cdecl setbuf(ptr ptr) MSVCRT_setbuf
@ cdecl setlocale(long str) MSVCRT_setlocale
@ stub setvbuf #(ptr str long long)
@ cdecl setvbuf(ptr str long long) MSVCRT_setvbuf
@ cdecl signal(long long) MSVCRT_signal
@ cdecl sin(double) sin
@ cdecl sinh(double) sinh
@ varargs sprintf(str str) sprintf
@ cdecl sqrt(double) sqrt
@ forward -noimport sqrt ntdll.sqrt
@ cdecl srand(long) srand
@ varargs sscanf(str str) sscanf
@ cdecl strcat(str str) strcat
@ -723,47 +723,47 @@ debug_channels (msvcrt)
@ cdecl strtol(str ptr long) strtol
@ cdecl strtoul(str ptr long) strtoul
@ cdecl strxfrm(ptr str long) strxfrm
@ stub swprintf #(wstr wstr) varargs
@ forward -noimport swprintf ntdll.swprintf
@ stub swscanf #(wstr wstr) varargs
@ cdecl system(str) MSVCRT_system
@ cdecl tan(double) tan
@ forward -noimport tan ntdll.tan
@ cdecl tanh(double) tanh
@ cdecl time(ptr) MSVCRT_time
@ cdecl tmpfile() MSVCRT_tmpfile
@ cdecl tmpnam(str) MSVCRT_tmpnam
@ cdecl tolower(long) tolower
@ cdecl toupper(long) toupper
@ forward towlower ntdll.towlower
@ forward towupper ntdll.towupper
@ forward -noimport towlower ntdll.towlower
@ forward -noimport towupper ntdll.towupper
@ stub ungetc #(long ptr)
@ stub ungetwc #(long ptr)
@ cdecl vfprintf(ptr str long) MSVCRT_vfprintf
@ stub vfwprintf #(ptr wstr long)
@ stub vprintf #(str long)
@ cdecl vfwprintf(ptr wstr long) MSVCRT_vfwprintf
@ cdecl vprintf(str long) MSVCRT_vprintf
@ cdecl vsprintf(ptr str ptr) vsprintf
@ stub vswprintf #(wstr wstr long)
@ stub vwprintf #(wstr long)
@ forward wcscat ntdll.wcscat
@ forward wcschr ntdll.wcschr
@ forward wcscmp ntdll.wcscmp
@ cdecl vswprintf(wstr wstr long) MSVCRT_vswprintf
@ varargs vwprintf(wstr long) MSVCRT_vwprintf
@ forward -noimport wcscat ntdll.wcscat
@ forward -noimport wcschr ntdll.wcschr
@ forward -noimport wcscmp ntdll.wcscmp
@ cdecl wcscoll(wstr wstr) MSVCRT_wcscoll
@ forward wcscpy ntdll.wcscpy
@ forward wcscspn ntdll.wcscspn
@ forward -noimport wcscpy ntdll.wcscpy
@ forward -noimport wcscspn ntdll.wcscspn
@ stub wcsftime #(wstr long wstr ptr)
@ forward wcslen ntdll.wcslen
@ forward wcsncat ntdll.wcsncat
@ forward wcsncmp ntdll.wcsncmp
@ forward wcsncpy ntdll.wcsncpy
@ forward -noimport wcslen ntdll.wcslen
@ forward -noimport wcsncat ntdll.wcsncat
@ forward -noimport wcsncmp ntdll.wcsncmp
@ forward -noimport wcsncpy ntdll.wcsncpy
@ cdecl wcspbrk(wstr wstr) MSVCRT_wcspbrk
@ forward wcsrchr ntdll.wcsrchr
@ forward wcsspn ntdll.wcsspn
@ forward wcsstr ntdll.wcsstr
@ forward -noimport wcsrchr ntdll.wcsrchr
@ forward -noimport wcsspn ntdll.wcsspn
@ forward -noimport wcsstr ntdll.wcsstr
@ stub wcstod #(wstr ptr)
@ forward wcstok ntdll.wcstok
@ forward wcstol ntdll.wcstol
@ forward wcstombs ntdll.wcstombs
@ stub wcstoul #(wstr ptr long)
@ forward -noimport wcstok ntdll.wcstok
@ forward -noimport wcstol ntdll.wcstol
@ forward -noimport wcstombs ntdll.wcstombs
@ forward -noimport wcstoul ntdll.wcstoul
@ stub wcsxfrm #(wstr wstr long)
@ cdecl wctomb(ptr long) MSVCRT_wctomb
@ stub wprintf #(wstr) varargs
@ varargs wprintf(wstr) MSVCRT_wprintf
@ stub wscanf #(wstr) varargs

View File

@ -157,7 +157,7 @@ int __cdecl MSVCRT__spawnve(int flags, const char *name, const char **argv,
{
char * args = __MSVCRT__argvtos(argv,' ');
char * envs = __MSVCRT__argvtos(envv,0);
LPCSTR fullname = name;
const char *fullname = name;
int ret = -1;
FIXME(":not translating name %s to locate program\n",fullname);

View File

@ -14,7 +14,7 @@ DEFAULT_DEBUG_CHANNEL(msvcrt);
unsigned long __cdecl MSVCRT__beginthreadex(void *sec,
unsigned int stack,
LPTHREAD_START_ROUTINE start,
void *arg, unsigned flag,
void *arg, unsigned int flag,
unsigned int*addr)
{
TRACE("(%p,%d,%p,%p,%d,%p)\n",sec, stack,start, arg,flag,addr);

View File

@ -4,12 +4,15 @@
* Copyright 1999 Alexandre Julliard
* Copyright 2000 Jon Griffiths
*/
#include <limits.h>
#include <stdio.h>
#include "msvcrt.h"
#include "winnls.h"
#include "wine/unicode.h"
DEFAULT_DEBUG_CHANNEL(msvcrt);
/* INTERNAL: MSVCRT_malloc() based wstrndup */
LPWSTR MSVCRT__wstrndup(LPCWSTR buf, unsigned int size)
{
@ -28,7 +31,7 @@ LPWSTR MSVCRT__wstrndup(LPCWSTR buf, unsigned int size)
}
/*********************************************************************
* MSVCRT__wcsdup (MSVCRT.@)
* _wcsdup (MSVCRT.@)
*/
LPWSTR __cdecl MSVCRT__wcsdup( LPCWSTR str )
{
@ -43,7 +46,7 @@ LPWSTR __cdecl MSVCRT__wcsdup( LPCWSTR str )
}
/*********************************************************************
* MSVCRT__wcsicoll (MSVCRT.@)
* _wcsicoll (MSVCRT.@)
*/
INT __cdecl MSVCRT__wcsicoll( LPCWSTR str1, LPCWSTR str2 )
{
@ -52,7 +55,7 @@ INT __cdecl MSVCRT__wcsicoll( LPCWSTR str1, LPCWSTR str2 )
}
/*********************************************************************
* MSVCRT__wcsnset (MSVCRT.@)
* _wcsnset (MSVCRT.@)
*/
LPWSTR __cdecl MSVCRT__wcsnset( LPWSTR str, WCHAR c, INT n )
{
@ -62,7 +65,7 @@ LPWSTR __cdecl MSVCRT__wcsnset( LPWSTR str, WCHAR c, INT n )
}
/*********************************************************************
* MSVCRT__wcsrev (MSVCRT.@)
* _wcsrev (MSVCRT.@)
*/
LPWSTR __cdecl MSVCRT__wcsrev( LPWSTR str )
{
@ -78,7 +81,7 @@ LPWSTR __cdecl MSVCRT__wcsrev( LPWSTR str )
}
/*********************************************************************
* MSVCRT__wcsset (MSVCRT.@)
* _wcsset (MSVCRT.@)
*/
LPWSTR __cdecl MSVCRT__wcsset( LPWSTR str, WCHAR c )
{
@ -88,7 +91,141 @@ LPWSTR __cdecl MSVCRT__wcsset( LPWSTR str, WCHAR c )
}
/*********************************************************************
* MSVCRT_wcscoll (MSVCRT.@)
* _vsnwprintf (MSVCRT.@)
*/
int __cdecl MSVCRT__vsnwprintf(WCHAR *str, unsigned int len,
const WCHAR *format, va_list valist)
{
/* If you fix a bug in this function, fix it in ntdll/wcstring.c also! */
unsigned int written = 0;
const WCHAR *iter = format;
char bufa[256], fmtbufa[64], *fmta;
TRACE("(%d,%s)\n",len,debugstr_w(format));
while (*iter)
{
while (*iter && *iter != (WCHAR)L'%')
{
if (written++ >= len)
return -1;
*str++ = *iter++;
}
if (*iter == (WCHAR)L'%')
{
fmta = fmtbufa;
*fmta++ = *iter++;
while (*iter == (WCHAR)L'0' ||
*iter == (WCHAR)L'+' ||
*iter == (WCHAR)L'-' ||
*iter == (WCHAR)L' ' ||
*iter == (WCHAR)L'0' ||
*iter == (WCHAR)L'*' ||
*iter == (WCHAR)L'#')
{
if (*iter == (WCHAR)L'*')
{
char *buffiter = bufa;
int fieldlen = va_arg(valist, int);
sprintf(buffiter, "%d", fieldlen);
while (*buffiter)
*fmta++ = *buffiter++;
}
else
*fmta++ = *iter;
iter++;
}
while (isdigit(*iter))
*fmta++ = *iter++;
if (*iter == (WCHAR)L'.')
{
*fmta++ = *iter++;
if (*iter == (WCHAR)L'*')
{
char *buffiter = bufa;
int fieldlen = va_arg(valist, int);
sprintf(buffiter, "%d", fieldlen);
while (*buffiter)
*fmta++ = *buffiter++;
}
else
while (isdigit(*iter))
*fmta++ = *iter++;
}
if (*iter == (WCHAR)L'h' ||
*iter == (WCHAR)L'l')
{
*fmta++ = *iter++;
*fmta++ = *iter++;
}
switch (*iter)
{
case (WCHAR)L's':
{
static const WCHAR none[] = { '(', 'n', 'u', 'l', 'l', ')', 0 };
const WCHAR *wstr = va_arg(valist, const WCHAR *);
const WCHAR *striter = wstr ? wstr : none;
while (*striter)
{
if (written++ >= len)
return -1;
*str++ = *striter++;
}
iter++;
break;
}
case (WCHAR)L'c':
if (written++ >= len)
return -1;
*str++ = va_arg(valist, WCHAR);
iter++;
break;
default:
{
/* For non wc types, use system sprintf and append to wide char output */
/* FIXME: for unrecognised types, should ignore % when printing */
char *bufaiter = bufa;
if (*iter == (WCHAR)L'p')
sprintf(bufaiter, "%08lX", va_arg(valist, long));
else
{
*fmta++ = *iter;
*fmta = '\0';
sprintf(bufaiter, fmtbufa, va_arg(valist, void *));
}
while (*bufaiter)
{
if (written++ >= len)
return -1;
*str++ = *bufaiter++;
}
iter++;
break;
}
}
}
}
if (written >= len)
return -1;
*str++ = (WCHAR)L'\0';
return (int)written;
}
/*********************************************************************
* vswprintf (MSVCRT.@)
*/
int __cdecl MSVCRT_vswprintf( LPWSTR str, LPCWSTR format, va_list args )
{
return MSVCRT__vsnwprintf( str, INT_MAX, format, args );
}
/*********************************************************************
* wcscoll (MSVCRT.@)
*/
DWORD __cdecl MSVCRT_wcscoll( LPCWSTR str1, LPCWSTR str2 )
{
@ -97,7 +234,7 @@ DWORD __cdecl MSVCRT_wcscoll( LPCWSTR str1, LPCWSTR str2 )
}
/*********************************************************************
* MSVCRT_wcspbrk (MSVCRT.@)
* wcspbrk (MSVCRT.@)
*/
LPWSTR __cdecl MSVCRT_wcspbrk( LPCWSTR str, LPCWSTR accept )
{
@ -111,15 +248,15 @@ LPWSTR __cdecl MSVCRT_wcspbrk( LPCWSTR str, LPCWSTR accept )
}
/*********************************************************************
* MSVCRT_wctomb (MSVCRT.@)
* wctomb (MSVCRT.@)
*/
INT __cdecl MSVCRT_wctomb( LPSTR dst, WCHAR ch )
INT __cdecl MSVCRT_wctomb( char *dst, WCHAR ch )
{
return WideCharToMultiByte( CP_ACP, 0, &ch, 1, dst, 6, NULL, NULL );
}
/*********************************************************************
* MSVCRT_iswalnum (MSVCRT.@)
* iswalnum (MSVCRT.@)
*/
INT __cdecl MSVCRT_iswalnum( WCHAR wc )
{
@ -127,7 +264,7 @@ INT __cdecl MSVCRT_iswalnum( WCHAR wc )
}
/*********************************************************************
* MSVCRT_iswalpha (MSVCRT.@)
* iswalpha (MSVCRT.@)
*/
INT __cdecl MSVCRT_iswalpha( WCHAR wc )
{
@ -135,7 +272,7 @@ INT __cdecl MSVCRT_iswalpha( WCHAR wc )
}
/*********************************************************************
* MSVCRT_iswcntrl (MSVCRT.@)
* iswcntrl (MSVCRT.@)
*/
INT __cdecl MSVCRT_iswcntrl( WCHAR wc )
{
@ -143,7 +280,7 @@ INT __cdecl MSVCRT_iswcntrl( WCHAR wc )
}
/*********************************************************************
* MSVCRT_iswdigit (MSVCRT.@)
* iswdigit (MSVCRT.@)
*/
INT __cdecl MSVCRT_iswdigit( WCHAR wc )
{
@ -151,7 +288,7 @@ INT __cdecl MSVCRT_iswdigit( WCHAR wc )
}
/*********************************************************************
* MSVCRT_iswgraph (MSVCRT.@)
* iswgraph (MSVCRT.@)
*/
INT __cdecl MSVCRT_iswgraph( WCHAR wc )
{
@ -159,7 +296,7 @@ INT __cdecl MSVCRT_iswgraph( WCHAR wc )
}
/*********************************************************************
* MSVCRT_iswlower (MSVCRT.@)
* iswlower (MSVCRT.@)
*/
INT __cdecl MSVCRT_iswlower( WCHAR wc )
{
@ -167,7 +304,7 @@ INT __cdecl MSVCRT_iswlower( WCHAR wc )
}
/*********************************************************************
* MSVCRT_iswprint (MSVCRT.@)
* iswprint (MSVCRT.@)
*/
INT __cdecl MSVCRT_iswprint( WCHAR wc )
{
@ -175,7 +312,7 @@ INT __cdecl MSVCRT_iswprint( WCHAR wc )
}
/*********************************************************************
* MSVCRT_iswpunct (MSVCRT.@)
* iswpunct (MSVCRT.@)
*/
INT __cdecl MSVCRT_iswpunct( WCHAR wc )
{
@ -183,7 +320,7 @@ INT __cdecl MSVCRT_iswpunct( WCHAR wc )
}
/*********************************************************************
* MSVCRT_iswspace (MSVCRT.@)
* iswspace (MSVCRT.@)
*/
INT __cdecl MSVCRT_iswspace( WCHAR wc )
{
@ -191,7 +328,7 @@ INT __cdecl MSVCRT_iswspace( WCHAR wc )
}
/*********************************************************************
* MSVCRT_iswupper (MSVCRT.@)
* iswupper (MSVCRT.@)
*/
INT __cdecl MSVCRT_iswupper( WCHAR wc )
{
@ -199,16 +336,16 @@ INT __cdecl MSVCRT_iswupper( WCHAR wc )
}
/*********************************************************************
* MSVCRT_iswxdigit (MSVCRT.@)
* iswxdigit (MSVCRT.@)
*/
INT __cdecl MSVCRT_iswxdigit( WCHAR wc )
{
return get_char_typeW(wc) & C1_XDIGIT;
}
extern LPSTR __cdecl _itoa( long , LPSTR , INT);
extern LPSTR __cdecl _ultoa( long , LPSTR , INT);
extern LPSTR __cdecl _ltoa( long , LPSTR , INT);
extern char *__cdecl _itoa( long , char *, int);
extern char *__cdecl _ultoa( long , char *, int);
extern char *__cdecl _ltoa( long , char *, int);
/*********************************************************************
* _itow (MSVCRT.@)