Commit 34c786b2 authored by Jon Griffiths's avatar Jon Griffiths Committed by Alexandre Julliard

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

- Forward to ntdll where possible. - Fix some .spec entries with incorrect parameters.
parent c968ed15
......@@ -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)
{
......
......@@ -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 */
......
......@@ -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)
......
......@@ -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);
}
......@@ -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)));
......
......@@ -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)
{
......
......@@ -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);
......
......@@ -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) : );
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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.@)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment