Commit 6d30d6be authored by Alexandre Julliard's avatar Alexandre Julliard

msvcp100: Share the source code with msvcp90.

parent 40a64912
......@@ -2,6 +2,8 @@ MODULE = msvcp100.dll
IMPORTS = msvcrt
MODCFLAGS = @BUILTINFLAG@
EXTRAINCL = -I$(top_srcdir)/include/msvcrt
EXTRADEFS = -D_MSVCP_VER=100
PARENTSRC = ../msvcp90
C_SRCS = \
exception.c \
......@@ -10,7 +12,7 @@ C_SRCS = \
math.c \
memory.c \
misc.c \
msvcp100.c \
msvcp_main.c \
string.c
@MAKE_DLL_RULES@
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
/*
* Copyright 2010 Piotr Caban for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include <stdarg.h>
#include <limits.h>
#include "msvcp.h"
#include "windef.h"
#include "winbase.h"
/* ?deallocate@?$allocator@D@std@@QAEXPADI@Z */
/* ?deallocate@?$allocator@D@std@@QEAAXPEAD_K@Z */
void MSVCP_allocator_char_deallocate(void *this, char *ptr, MSVCP_size_t size)
{
MSVCRT_operator_delete(ptr);
}
/* ?allocate@?$allocator@D@std@@QAEPADI@Z */
/* ?allocate@?$allocator@D@std@@QEAAPEAD_K@Z */
char* MSVCP_allocator_char_allocate(void *this, MSVCP_size_t count)
{
return MSVCRT_operator_new(count);
}
/* allocator<wchar_t> */
/* ?deallocate@?$allocator@_W@std@@QAEXPA_WI@Z */
/* ?deallocate@?$allocator@_W@std@@QEAAXPEA_W_K@Z */
void MSVCP_allocator_wchar_deallocate(void *this,
wchar_t *ptr, MSVCP_size_t size)
{
MSVCRT_operator_delete(ptr);
}
/* ?allocate@?$allocator@_W@std@@QAEPA_WI@Z */
/* ?allocate@?$allocator@_W@std@@QEAAPEA_W_K@Z */
wchar_t* MSVCP_allocator_wchar_allocate(void *this, MSVCP_size_t count)
{
if(UINT_MAX/count < sizeof(wchar_t)) {
throw_exception(EXCEPTION_BAD_ALLOC, NULL);
return NULL;
}
return MSVCRT_operator_new(count * sizeof(wchar_t));
}
/*
* Copyright 2010 Piotr Caban for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include <stdarg.h>
#include <limits.h>
#include "msvcp.h"
#include "windef.h"
#include "winbase.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(msvcp);
struct __Container_proxy;
typedef struct {
struct __Container_proxy *proxy;
} _Container_base12;
typedef struct __Iterator_base12 {
struct __Container_proxy *proxy;
struct __Iterator_base12 *next;
} _Iterator_base12;
typedef struct __Container_proxy {
const _Container_base12 *cont;
_Iterator_base12 *head;
} _Container_proxy;
/* ??0_Mutex@std@@QAE@XZ */
/* ??0_Mutex@std@@QEAA@XZ */
DEFINE_THISCALL_WRAPPER(mutex_ctor, 4)
mutex* __thiscall mutex_ctor(mutex *this)
{
CRITICAL_SECTION *cs = MSVCRT_operator_new(sizeof(*cs));
if(!cs) {
ERR("Out of memory\n");
throw_exception(EXCEPTION_BAD_ALLOC, NULL);
}
InitializeCriticalSection(cs);
cs->DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": _Mutex critical section");
this->mutex = cs;
return this;
}
/* ??1_Mutex@std@@QAE@XZ */
/* ??1_Mutex@std@@QEAA@XZ */
DEFINE_THISCALL_WRAPPER(mutex_dtor, 4)
void __thiscall mutex_dtor(mutex *this)
{
((CRITICAL_SECTION*)this->mutex)->DebugInfo->Spare[0] = 0;
DeleteCriticalSection(this->mutex);
MSVCRT_operator_delete(this->mutex);
}
/* ?_Lock@_Mutex@std@@QAEXXZ */
/* ?_Lock@_Mutex@std@@QEAAXXZ */
DEFINE_THISCALL_WRAPPER(mutex_lock, 4)
void __thiscall mutex_lock(mutex *this)
{
EnterCriticalSection(this->mutex);
}
/* ?_Unlock@_Mutex@std@@QAEXXZ */
/* ?_Unlock@_Mutex@std@@QEAAXXZ */
DEFINE_THISCALL_WRAPPER(mutex_unlock, 4)
void __thiscall mutex_unlock(mutex *this)
{
LeaveCriticalSection(this->mutex);
}
/* ?_Mutex_Lock@_Mutex@std@@CAXPAV12@@Z */
/* ?_Mutex_Lock@_Mutex@std@@CAXPEAV12@@Z */
void CDECL mutex_mutex_lock(mutex *m)
{
mutex_lock(m);
}
/* ?_Mutex_Unlock@_Mutex@std@@CAXPAV12@@Z */
/* ?_Mutex_Unlock@_Mutex@std@@CAXPEAV12@@Z */
void CDECL mutex_mutex_unlock(mutex *m)
{
mutex_unlock(m);
}
/* ?_Mutex_ctor@_Mutex@std@@CAXPAV12@@Z */
/* ?_Mutex_ctor@_Mutex@std@@CAXPEAV12@@Z */
void CDECL mutex_mutex_ctor(mutex *m)
{
mutex_ctor(m);
}
/* ?_Mutex_dtor@_Mutex@std@@CAXPAV12@@Z */
/* ?_Mutex_dtor@_Mutex@std@@CAXPEAV12@@Z */
void CDECL mutex_mutex_dtor(mutex *m)
{
mutex_dtor(m);
}
static CRITICAL_SECTION lockit_cs[_MAX_LOCK];
/* ?_Lockit_ctor@_Lockit@std@@SAXH@Z */
void __cdecl _Lockit_init(int locktype) {
InitializeCriticalSection(&lockit_cs[locktype]);
lockit_cs[locktype].DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": _Lockit critical section");
}
/* ?_Lockit_dtor@_Lockit@std@@SAXH@Z */
void __cdecl _Lockit_free(int locktype)
{
lockit_cs[locktype].DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&lockit_cs[locktype]);
}
void init_lockit(void) {
int i;
for(i=0; i<_MAX_LOCK; i++)
_Lockit_init(i);
}
void free_lockit(void) {
int i;
for(i=0; i<_MAX_LOCK; i++)
_Lockit_free(i);
}
/* ?_Lockit_ctor@_Lockit@std@@CAXPAV12@H@Z */
/* ?_Lockit_ctor@_Lockit@std@@CAXPEAV12@H@Z */
void __cdecl _Lockit__Lockit_ctor_locktype(_Lockit *lockit, int locktype)
{
lockit->locktype = locktype;
EnterCriticalSection(&lockit_cs[locktype]);
}
/* ?_Lockit_ctor@_Lockit@std@@CAXPAV12@@Z */
/* ?_Lockit_ctor@_Lockit@std@@CAXPEAV12@@Z */
void __cdecl _Lockit__Lockit_ctor(_Lockit *lockit)
{
_Lockit__Lockit_ctor_locktype(lockit, 0);
}
/* ??0_Lockit@std@@QAE@H@Z */
/* ??0_Lockit@std@@QEAA@H@Z */
DEFINE_THISCALL_WRAPPER(_Lockit_ctor_locktype, 8)
_Lockit* __thiscall _Lockit_ctor_locktype(_Lockit *this, int locktype)
{
_Lockit__Lockit_ctor_locktype(this, locktype);
return this;
}
/* ??0_Lockit@std@@QAE@XZ */
/* ??0_Lockit@std@@QEAA@XZ */
DEFINE_THISCALL_WRAPPER(_Lockit_ctor, 4)
_Lockit* __thiscall _Lockit_ctor(_Lockit *this)
{
_Lockit__Lockit_ctor_locktype(this, 0);
return this;
}
/* ?_Lockit_dtor@_Lockit@std@@CAXPAV12@@Z */
/* ?_Lockit_dtor@_Lockit@std@@CAXPEAV12@@Z */
void __cdecl _Lockit__Lockit_dtor(_Lockit *lockit)
{
LeaveCriticalSection(&lockit_cs[lockit->locktype]);
}
/* ??1_Lockit@std@@QAE@XZ */
/* ??1_Lockit@std@@QEAA@XZ */
DEFINE_THISCALL_WRAPPER(_Lockit_dtor, 4)
void __thiscall _Lockit_dtor(_Lockit *this)
{
_Lockit__Lockit_dtor(this);
}
/* wctype */
unsigned short __cdecl wctype(const char *property)
{
static const struct {
const char *name;
unsigned short mask;
} properties[] = {
{ "alnum", _DIGIT|_ALPHA },
{ "alpha", _ALPHA },
{ "cntrl", _CONTROL },
{ "digit", _DIGIT },
{ "graph", _DIGIT|_PUNCT|_ALPHA },
{ "lower", _LOWER },
{ "print", _DIGIT|_PUNCT|_BLANK|_ALPHA },
{ "punct", _PUNCT },
{ "space", _SPACE },
{ "upper", _UPPER },
{ "xdigit", _HEX }
};
int i;
for(i=0; i<sizeof(properties)/sizeof(properties[0]); i++)
if(!strcmp(property, properties[i].name))
return properties[i].mask;
return 0;
}
typedef void (__cdecl *MSVCP_new_handler_func)(void);
static MSVCP_new_handler_func MSVCP_new_handler;
static int __cdecl new_handler_wrapper(MSVCP_size_t unused)
{
MSVCP_new_handler();
return 1;
}
/* ?set_new_handler@std@@YAP6AXXZP6AXXZ@Z */
MSVCP_new_handler_func __cdecl set_new_handler(MSVCP_new_handler_func new_handler)
{
MSVCP_new_handler_func old_handler = MSVCP_new_handler;
TRACE("%p\n", new_handler);
MSVCP_new_handler = new_handler;
MSVCRT_set_new_handler(new_handler ? new_handler_wrapper : NULL);
return old_handler;
}
/* ?set_new_handler@std@@YAP6AXXZH@Z */
MSVCP_new_handler_func __cdecl set_new_handler_reset(int unused)
{
return set_new_handler(NULL);
}
/* _Container_base0 is used by apps compiled without iterator checking
* (i.e. with _ITERATOR_DEBUG_LEVEL=0 ).
* It provides empty versions of methods used by visual c++'s stl's
* iterator checking.
* msvcr100 has to provide them in case apps are compiled with /Od
* or the optimizer fails to inline those (empty) calls.
*/
/* ?_Orphan_all@_Container_base0@std@@QAEXXZ */
/* ?_Orphan_all@_Container_base0@std@@QEAAXXZ */
DEFINE_THISCALL_WRAPPER(Container_base0_Orphan_all, 4)
void __thiscall Container_base0_Orphan_all(void *this)
{
}
/* ?_Swap_all@_Container_base0@std@@QAEXAAU12@@Z */
/* ?_Swap_all@_Container_base0@std@@QEAAXAEAU12@@Z */
DEFINE_THISCALL_WRAPPER(Container_base0_Swap_all, 8)
void __thiscall Container_base0_Swap_all(void *this, void *that)
{
}
/* ??4_Container_base0@std@@QAEAAU01@ABU01@@Z */
/* ??4_Container_base0@std@@QEAAAEAU01@AEBU01@@Z */
DEFINE_THISCALL_WRAPPER(Container_base0_op_assign, 8)
void* __thiscall Container_base0_op_assign(void *this, const void *that)
{
return this;
}
/* ??0_Container_base12@std@@QAE@ABU01@@Z */
/* ??0_Container_base12@std@@QEAA@AEBU01@@Z */
DEFINE_THISCALL_WRAPPER(_Container_base12_copy_ctor, 8)
_Container_base12* __thiscall _Container_base12_copy_ctor(
_Container_base12 *this, _Container_base12 *that)
{
this->proxy = NULL;
return this;
}
/* ??0_Container_base12@std@@QAE@XZ */
/* ??0_Container_base12@std@@QEAA@XZ */
DEFINE_THISCALL_WRAPPER(_Container_base12_ctor, 4)
_Container_base12* __thiscall _Container_base12_ctor(_Container_base12 *this)
{
this->proxy = NULL;
return this;
}
/* ??1_Container_base12@std@@QAE@XZ */
/* ??1_Container_base12@std@@QEAA@XZ */
DEFINE_THISCALL_WRAPPER(_Container_base12_dtor, 4)
void __thiscall _Container_base12_dtor(_Container_base12 *this)
{
}
/* ??4_Container_base12@std@@QAEAAU01@ABU01@@Z */
/* ??4_Container_base12@std@@QEAAAEAU01@AEBU01@@ */
DEFINE_THISCALL_WRAPPER(_Container_base12_op_assign, 8)
_Container_base12* __thiscall _Container_base12_op_assign(
_Container_base12 *this, const _Container_base12 *that)
{
return this;
}
/* ?_Getpfirst@_Container_base12@std@@QBEPAPAU_Iterator_base12@2@XZ */
/* ?_Getpfirst@_Container_base12@std@@QEBAPEAPEAU_Iterator_base12@2@XZ */
DEFINE_THISCALL_WRAPPER(_Container_base12__Getpfirst, 4)
_Iterator_base12** __thiscall _Container_base12__Getpfirst(_Container_base12 *this)
{
return this->proxy ? &this->proxy->head : NULL;
}
/* ?_Orphan_all@_Container_base12@std@@QAEXXZ */
/* ?_Orphan_all@_Container_base12@std@@QEAAXXZ */
DEFINE_THISCALL_WRAPPER(_Container_base12__Orphan_all, 4)
void __thiscall _Container_base12__Orphan_all(_Container_base12 *this)
{
}
/* ?_Swap_all@_Container_base12@std@@QAEXAAU12@@Z */
/* ?_Swap_all@_Container_base12@std@@QEAAXAEAU12@@Z */
DEFINE_THISCALL_WRAPPER(_Container_base12__Swap_all, 8)
void __thiscall _Container_base12__Swap_all(
_Container_base12 *this, _Container_base12 *that)
{
_Container_proxy *tmp;
tmp = this->proxy;
this->proxy = that->proxy;
that->proxy = tmp;
if(this->proxy)
this->proxy->cont = this;
if(that->proxy)
that->proxy->cont = that;
}
/*
* msvcp100 specific functions
*
* Copyright 2011 Austin English
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include <stdarg.h>
#include "msvcp.h"
#include "windef.h"
#include "winbase.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(msvcp);
#ifdef __i386__
#define DEFINE_VTBL_WRAPPER(off) \
__ASM_GLOBAL_FUNC(vtbl_wrapper_ ## off, \
"popl %eax\n\t" \
"popl %ecx\n\t" \
"pushl %eax\n\t" \
"movl 0(%ecx), %eax\n\t" \
"jmp *" #off "(%eax)\n\t")
DEFINE_VTBL_WRAPPER(0);
DEFINE_VTBL_WRAPPER(4);
DEFINE_VTBL_WRAPPER(8);
DEFINE_VTBL_WRAPPER(12);
DEFINE_VTBL_WRAPPER(16);
DEFINE_VTBL_WRAPPER(20);
DEFINE_VTBL_WRAPPER(24);
DEFINE_VTBL_WRAPPER(28);
DEFINE_VTBL_WRAPPER(32);
DEFINE_VTBL_WRAPPER(36);
DEFINE_VTBL_WRAPPER(40);
DEFINE_VTBL_WRAPPER(44);
DEFINE_VTBL_WRAPPER(48);
DEFINE_VTBL_WRAPPER(52);
DEFINE_VTBL_WRAPPER(56);
#endif
void* (__cdecl *MSVCRT_operator_new)(MSVCP_size_t);
void (__cdecl *MSVCRT_operator_delete)(void*);
void* (__cdecl *MSVCRT_set_new_handler)(void*);
static void init_cxx_funcs(void)
{
HMODULE hmod = GetModuleHandleA("msvcrt.dll");
if (sizeof(void *) > sizeof(int)) /* 64-bit has different names */
{
MSVCRT_operator_new = (void*)GetProcAddress(hmod, "??2@YAPEAX_K@Z");
MSVCRT_operator_delete = (void*)GetProcAddress(hmod, "??3@YAXPEAX@Z");
MSVCRT_set_new_handler = (void*)GetProcAddress(hmod, "?_set_new_handler@@YAP6AH_K@ZP6AH0@Z@Z");
}
else
{
MSVCRT_operator_new = (void*)GetProcAddress(hmod, "??2@YAPAXI@Z");
MSVCRT_operator_delete = (void*)GetProcAddress(hmod, "??3@YAXPAX@Z");
MSVCRT_set_new_handler = (void*)GetProcAddress(hmod, "?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z");
}
}
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved);
switch (fdwReason)
{
case DLL_WINE_PREATTACH:
return FALSE; /* prefer native version */
case DLL_PROCESS_ATTACH:
init_cxx_funcs();
init_lockit();
init_exception(hinstDLL);
init_locale(hinstDLL);
init_io(hinstDLL);
break;
case DLL_PROCESS_DETACH:
if (lpvReserved) break;
free_io();
free_locale();
free_lockit();
break;
}
return TRUE;
}
/* ?_BADOFF@std@@3JB -> long const std::_BADOFF */
/* ?_BADOFF@std@@3_JB -> __int64 const std::_BADOFF */
const streamoff std_BADOFF = -1;
......@@ -454,6 +454,45 @@ void __cdecl _Nomemory(void)
throw_exception(EXCEPTION_BAD_ALLOC, NULL);
}
/* ?_Xmem@tr1@std@@YAXXZ */
void __cdecl _Xmem(void)
{
TRACE("()\n");
throw_exception(EXCEPTION_BAD_ALLOC, NULL);
}
/* ?_Xinvalid_argument@std@@YAXPBD@Z */
/* ?_Xinvalid_argument@std@@YAXPEBD@Z */
void __cdecl _Xinvalid_argument(const char *str)
{
TRACE("(%s)\n", debugstr_a(str));
throw_exception(EXCEPTION_INVALID_ARGUMENT, str);
}
/* ?_Xlength_error@std@@YAXPBD@Z */
/* ?_Xlength_error@std@@YAXPEBD@Z */
void __cdecl _Xlength_error(const char *str)
{
TRACE("(%s)\n", debugstr_a(str));
throw_exception(EXCEPTION_LENGTH_ERROR, str);
}
/* ?_Xout_of_range@std@@YAXPBD@Z */
/* ?_Xout_of_range@std@@YAXPEBD@Z */
void __cdecl _Xout_of_range(const char *str)
{
TRACE("(%s)\n", debugstr_a(str));
throw_exception(EXCEPTION_OUT_OF_RANGE, str);
}
/* ?_Xruntime_error@std@@YAXPBD@Z */
/* ?_Xruntime_error@std@@YAXPEBD@Z */
void __cdecl _Xruntime_error(const char *str)
{
TRACE("(%s)\n", debugstr_a(str));
throw_exception(EXCEPTION_RUNTIME_ERROR, str);
}
#ifndef __GNUC__
void __asm_dummy_vtables(void) {
#endif
......
......@@ -48,12 +48,21 @@ MSVCP_size_t __cdecl _Strftime(char*, MSVCP_size_t, const char*,
const struct tm*, struct __lc_time_data*);
const locale* __cdecl locale_classic(void);
#if _MSVCP_VER < 100
#define locale_string basic_string_char
#define locale_string_char_ctor_cstr(this,str) MSVCP_basic_string_char_ctor_cstr(this,str)
#define locale_string_char_copy_ctor(this,copy) MSVCP_basic_string_char_copy_ctor(this,copy)
#define locale_string_char_dtor(this) MSVCP_basic_string_char_dtor(this)
#define locale_string_char_c_str(this) MSVCP_basic_string_char_c_str(this)
#define locale_string_char_assign(this,assign) MSVCP_basic_string_char_assign(this,assign)
#else
#define locale_string _Yarn_char
#define locale_string_char_ctor_cstr(this,str) _Yarn_char_ctor_cstr(this,str)
#define locale_string_char_copy_ctor(this,copy) _Yarn_char_copy_ctor(this,copy)
#define locale_string_char_dtor(this) _Yarn_char_dtor(this)
#define locale_string_char_c_str(this) _Yarn_char_c_str(this)
#define locale_string_char_assign(this,assign) _Yarn_char_op_assign(this,assign)
#endif
typedef int category;
......@@ -722,17 +731,6 @@ const struct lconv* __thiscall _Locinfo__Getlconv(const _Locinfo *this)
return localeconv();
}
/* ?_Getname@_Locinfo@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
/* ?_Getname@_Locinfo@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
DEFINE_THISCALL_WRAPPER(_Locinfo__Getname, 8)
basic_string_char* __thiscall _Locinfo__Getname(const _Locinfo *this, basic_string_char *ret)
{
TRACE("(%p)\n", this);
MSVCP_basic_string_char_copy_ctor(ret, &this->newlocname);
return ret;
}
/* ?_Gettnames@_Locinfo@std@@QBE?AV_Timevec@2@XZ */
/* ?_Gettnames@_Locinfo@std@@QEBA?AV_Timevec@2@XZ */
DEFINE_THISCALL_WRAPPER(_Locinfo__Gettnames, 8)
......@@ -1493,11 +1491,11 @@ ctype_char* __thiscall ctype_char_vector_dtor(ctype_char *this, unsigned int fla
/* ?do_narrow@?$ctype@D@std@@MBEDDD@Z */
/* ?do_narrow@?$ctype@D@std@@MEBADDD@Z */
DEFINE_THISCALL_WRAPPER(ctype_char_do_narrow_ch, 12)
#if _MSVCP_VER < 80
#define call_ctype_char_do_narrow_ch(this, ch, unused) CALL_VTBL_FUNC(this, 32, \
#if _MSVCP_VER >= 80 && _MSVCP_VER <= 90
#define call_ctype_char_do_narrow_ch(this, ch, unused) CALL_VTBL_FUNC(this, 36, \
char, (const ctype_char*, char, char), (this, ch, unused))
#else
#define call_ctype_char_do_narrow_ch(this, ch, unused) CALL_VTBL_FUNC(this, 36, \
#define call_ctype_char_do_narrow_ch(this, ch, unused) CALL_VTBL_FUNC(this, 32, \
char, (const ctype_char*, char, char), (this, ch, unused))
#endif
char __thiscall ctype_char_do_narrow_ch(const ctype_char *this, char ch, char unused)
......@@ -1509,12 +1507,12 @@ char __thiscall ctype_char_do_narrow_ch(const ctype_char *this, char ch, char un
/* ?do_narrow@?$ctype@D@std@@MBEPBDPBD0DPAD@Z */
/* ?do_narrow@?$ctype@D@std@@MEBAPEBDPEBD0DPEAD@Z */
DEFINE_THISCALL_WRAPPER(ctype_char_do_narrow, 20)
#if _MSVCP_VER < 80
#define call_ctype_char_do_narrow(this, first, last, unused, dest) CALL_VTBL_FUNC(this, 28, \
#if _MSVCP_VER >= 80 && _MSVCP_VER <= 90
#define call_ctype_char_do_narrow(this, first, last, unused, dest) CALL_VTBL_FUNC(this, 32, \
const char*, (const ctype_char*, const char*, const char*, char, char*), \
(this, first, last, unused, dest))
#else
#define call_ctype_char_do_narrow(this, first, last, unused, dest) CALL_VTBL_FUNC(this, 32, \
#define call_ctype_char_do_narrow(this, first, last, unused, dest) CALL_VTBL_FUNC(this, 28, \
const char*, (const ctype_char*, const char*, const char*, char, char*), \
(this, first, last, unused, dest))
#endif
......@@ -2133,11 +2131,11 @@ char __thiscall ctype_wchar__Donarrow(const ctype_wchar *this, wchar_t ch, char
/* ?do_narrow@?$ctype@G@std@@MBEDGD@Z */
/* ?do_narrow@?$ctype@G@std@@MEBADGD@Z */
DEFINE_THISCALL_WRAPPER(ctype_wchar_do_narrow_ch, 12)
#if _MSVCP_VER < 80
#define call_ctype_wchar_do_narrow_ch(this, ch, dflt) CALL_VTBL_FUNC(this, 48, \
#if _MSVCP_VER >= 80 && _MSVCP_VER <= 90
#define call_ctype_wchar_do_narrow_ch(this, ch, dflt) CALL_VTBL_FUNC(this, 52, \
char, (const ctype_wchar*, wchar_t, char), (this, ch, dflt))
#else
#define call_ctype_wchar_do_narrow_ch(this, ch, dflt) CALL_VTBL_FUNC(this, 52, \
#define call_ctype_wchar_do_narrow_ch(this, ch, dflt) CALL_VTBL_FUNC(this, 48, \
char, (const ctype_wchar*, wchar_t, char), (this, ch, dflt))
#endif
char __thiscall ctype_wchar_do_narrow_ch(const ctype_wchar *this, wchar_t ch, char dflt)
......@@ -2150,12 +2148,12 @@ char __thiscall ctype_wchar_do_narrow_ch(const ctype_wchar *this, wchar_t ch, ch
/* ?do_narrow@?$ctype@G@std@@MBEPBGPBG0DPAD@Z */
/* ?do_narrow@?$ctype@G@std@@MEBAPEBGPEBG0DPEAD@Z */
DEFINE_THISCALL_WRAPPER(ctype_wchar_do_narrow, 20)
#if _MSVCP_VER < 80
#define call_ctype_wchar_do_narrow(this, first, last, dflt, dest) CALL_VTBL_FUNC(this, 44, \
#if _MSVCP_VER >= 80 && _MSVCP_VER <= 90
#define call_ctype_wchar_do_narrow(this, first, last, dflt, dest) CALL_VTBL_FUNC(this, 48, \
const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, char, char*), \
(this, first, last, dflt, dest))
#else
#define call_ctype_wchar_do_narrow(this, first, last, dflt, dest) CALL_VTBL_FUNC(this, 48, \
#define call_ctype_wchar_do_narrow(this, first, last, dflt, dest) CALL_VTBL_FUNC(this, 44, \
const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, char, char*), \
(this, first, last, dflt, dest))
#endif
......@@ -9406,16 +9404,6 @@ locale* __cdecl locale_empty(locale *ret)
return ret;
}
/* ?name@locale@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
/* ?name@locale@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
DEFINE_THISCALL_WRAPPER(locale_name, 8)
basic_string_char* __thiscall locale_name(const locale *this, basic_string_char *ret)
{
TRACE( "(%p)\n", this);
MSVCP_basic_string_char_copy_ctor(ret, &this->ptr->name);
return ret;
}
/* ?global@locale@std@@SA?AV12@ABV12@@Z */
/* ?global@locale@std@@SA?AV12@AEBV12@@Z */
locale* __cdecl locale_global(locale *ret, const locale *loc)
......@@ -9443,6 +9431,31 @@ locale* __cdecl locale_global(locale *ret, const locale *loc)
return ret;
}
#if _MSVCP_VER < 100
/* ?_Getname@_Locinfo@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
/* ?_Getname@_Locinfo@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
DEFINE_THISCALL_WRAPPER(_Locinfo__Getname, 8)
basic_string_char* __thiscall _Locinfo__Getname(const _Locinfo *this, basic_string_char *ret)
{
TRACE("(%p)\n", this);
MSVCP_basic_string_char_copy_ctor(ret, &this->newlocname);
return ret;
}
/* ?name@locale@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
/* ?name@locale@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
DEFINE_THISCALL_WRAPPER(locale_name, 8)
basic_string_char* __thiscall locale_name(const locale *this, basic_string_char *ret)
{
TRACE( "(%p)\n", this);
MSVCP_basic_string_char_copy_ctor(ret, &this->ptr->name);
return ret;
}
#endif /* _MSVCP_VER < 100 */
/* wctrans */
wctrans_t __cdecl wctrans(const char *property)
{
......@@ -9519,16 +9532,15 @@ void __asm_dummy_vtables(void) {
VTABLE_ADD_FUNC(ctype_char_do_toupper_ch)
VTABLE_ADD_FUNC(ctype_char_do_widen)
VTABLE_ADD_FUNC(ctype_char_do_widen_ch)
#if _MSVCP_VER < 80
VTABLE_ADD_FUNC(ctype_char_do_narrow)
VTABLE_ADD_FUNC(ctype_char_do_narrow_ch));
#else
#if _MSVCP_VER >= 80 && _MSVCP_VER <= 90
VTABLE_ADD_FUNC(ctype_char__Do_widen_s)
VTABLE_ADD_FUNC(ctype_char_do_narrow)
VTABLE_ADD_FUNC(ctype_char_do_narrow_ch)
VTABLE_ADD_FUNC(ctype_char__Do_narrow_s));
#else
VTABLE_ADD_FUNC(ctype_char_do_narrow)
VTABLE_ADD_FUNC(ctype_char_do_narrow_ch));
#endif
__ASM_VTABLE(ctype_wchar,
VTABLE_ADD_FUNC(ctype_wchar_vector_dtor)
VTABLE_ADD_FUNC(ctype_wchar_do_is)
......@@ -9541,14 +9553,14 @@ void __asm_dummy_vtables(void) {
VTABLE_ADD_FUNC(ctype_wchar_do_toupper_ch)
VTABLE_ADD_FUNC(ctype_wchar_do_widen)
VTABLE_ADD_FUNC(ctype_wchar_do_widen_ch)
#if _MSVCP_VER < 80
VTABLE_ADD_FUNC(ctype_wchar_do_narrow)
VTABLE_ADD_FUNC(ctype_wchar_do_narrow_ch));
#else
#if _MSVCP_VER >= 80 && _MSVCP_VER <= 90
VTABLE_ADD_FUNC(ctype_wchar__Do_widen_s)
VTABLE_ADD_FUNC(ctype_wchar_do_narrow)
VTABLE_ADD_FUNC(ctype_wchar_do_narrow_ch)
VTABLE_ADD_FUNC(ctype_wchar__Do_narrow_s));
#else
VTABLE_ADD_FUNC(ctype_wchar_do_narrow)
VTABLE_ADD_FUNC(ctype_wchar_do_narrow_ch));
#endif
__ASM_VTABLE(ctype_short,
VTABLE_ADD_FUNC(ctype_wchar_vector_dtor)
......@@ -9562,14 +9574,14 @@ void __asm_dummy_vtables(void) {
VTABLE_ADD_FUNC(ctype_wchar_do_toupper_ch)
VTABLE_ADD_FUNC(ctype_wchar_do_widen)
VTABLE_ADD_FUNC(ctype_wchar_do_widen_ch)
#if _MSVCP_VER < 80
VTABLE_ADD_FUNC(ctype_wchar_do_narrow)
VTABLE_ADD_FUNC(ctype_wchar_do_narrow_ch));
#else
#if _MSVCP_VER >= 80 && _MSVCP_VER <= 90
VTABLE_ADD_FUNC(ctype_wchar__Do_widen_s)
VTABLE_ADD_FUNC(ctype_wchar_do_narrow)
VTABLE_ADD_FUNC(ctype_wchar_do_narrow_ch)
VTABLE_ADD_FUNC(ctype_wchar__Do_narrow_s));
#else
VTABLE_ADD_FUNC(ctype_wchar_do_narrow)
VTABLE_ADD_FUNC(ctype_wchar_do_narrow_ch));
#endif
__ASM_VTABLE(codecvt_base,
VTABLE_ADD_FUNC(codecvt_base_vector_dtor)
......
......@@ -28,6 +28,22 @@
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(msvcp);
struct __Container_proxy;
typedef struct {
struct __Container_proxy *proxy;
} _Container_base12;
typedef struct __Iterator_base12 {
struct __Container_proxy *proxy;
struct __Iterator_base12 *next;
} _Iterator_base12;
typedef struct __Container_proxy {
const _Container_base12 *cont;
_Iterator_base12 *head;
} _Container_proxy;
/* ??0_Mutex@std@@QAE@XZ */
/* ??0_Mutex@std@@QEAA@XZ */
DEFINE_THISCALL_WRAPPER(mutex_ctor, 4)
......@@ -229,3 +245,101 @@ MSVCP_new_handler_func __cdecl set_new_handler_reset(int unused)
{
return set_new_handler(NULL);
}
/* _Container_base0 is used by apps compiled without iterator checking
* (i.e. with _ITERATOR_DEBUG_LEVEL=0 ).
* It provides empty versions of methods used by visual c++'s stl's
* iterator checking.
* msvcr100 has to provide them in case apps are compiled with /Od
* or the optimizer fails to inline those (empty) calls.
*/
/* ?_Orphan_all@_Container_base0@std@@QAEXXZ */
/* ?_Orphan_all@_Container_base0@std@@QEAAXXZ */
DEFINE_THISCALL_WRAPPER(Container_base0_Orphan_all, 4)
void __thiscall Container_base0_Orphan_all(void *this)
{
}
/* ?_Swap_all@_Container_base0@std@@QAEXAAU12@@Z */
/* ?_Swap_all@_Container_base0@std@@QEAAXAEAU12@@Z */
DEFINE_THISCALL_WRAPPER(Container_base0_Swap_all, 8)
void __thiscall Container_base0_Swap_all(void *this, void *that)
{
}
/* ??4_Container_base0@std@@QAEAAU01@ABU01@@Z */
/* ??4_Container_base0@std@@QEAAAEAU01@AEBU01@@Z */
DEFINE_THISCALL_WRAPPER(Container_base0_op_assign, 8)
void* __thiscall Container_base0_op_assign(void *this, const void *that)
{
return this;
}
/* ??0_Container_base12@std@@QAE@ABU01@@Z */
/* ??0_Container_base12@std@@QEAA@AEBU01@@Z */
DEFINE_THISCALL_WRAPPER(_Container_base12_copy_ctor, 8)
_Container_base12* __thiscall _Container_base12_copy_ctor(
_Container_base12 *this, _Container_base12 *that)
{
this->proxy = NULL;
return this;
}
/* ??0_Container_base12@std@@QAE@XZ */
/* ??0_Container_base12@std@@QEAA@XZ */
DEFINE_THISCALL_WRAPPER(_Container_base12_ctor, 4)
_Container_base12* __thiscall _Container_base12_ctor(_Container_base12 *this)
{
this->proxy = NULL;
return this;
}
/* ??1_Container_base12@std@@QAE@XZ */
/* ??1_Container_base12@std@@QEAA@XZ */
DEFINE_THISCALL_WRAPPER(_Container_base12_dtor, 4)
void __thiscall _Container_base12_dtor(_Container_base12 *this)
{
}
/* ??4_Container_base12@std@@QAEAAU01@ABU01@@Z */
/* ??4_Container_base12@std@@QEAAAEAU01@AEBU01@@ */
DEFINE_THISCALL_WRAPPER(_Container_base12_op_assign, 8)
_Container_base12* __thiscall _Container_base12_op_assign(
_Container_base12 *this, const _Container_base12 *that)
{
return this;
}
/* ?_Getpfirst@_Container_base12@std@@QBEPAPAU_Iterator_base12@2@XZ */
/* ?_Getpfirst@_Container_base12@std@@QEBAPEAPEAU_Iterator_base12@2@XZ */
DEFINE_THISCALL_WRAPPER(_Container_base12__Getpfirst, 4)
_Iterator_base12** __thiscall _Container_base12__Getpfirst(_Container_base12 *this)
{
return this->proxy ? &this->proxy->head : NULL;
}
/* ?_Orphan_all@_Container_base12@std@@QAEXXZ */
/* ?_Orphan_all@_Container_base12@std@@QEAAXXZ */
DEFINE_THISCALL_WRAPPER(_Container_base12__Orphan_all, 4)
void __thiscall _Container_base12__Orphan_all(_Container_base12 *this)
{
}
/* ?_Swap_all@_Container_base12@std@@QAEXAAU12@@Z */
/* ?_Swap_all@_Container_base12@std@@QEAAXAEAU12@@Z */
DEFINE_THISCALL_WRAPPER(_Container_base12__Swap_all, 8)
void __thiscall _Container_base12__Swap_all(
_Container_base12 *this, _Container_base12 *that)
{
_Container_proxy *tmp;
tmp = this->proxy;
this->proxy = that->proxy;
that->proxy = tmp;
if(this->proxy)
this->proxy->cont = this;
if(that->proxy)
that->proxy->cont = that;
}
......@@ -20,12 +20,22 @@
#include "windef.h"
#include "cxx.h"
#define ALIGNED_SIZE(size, alignment) (((size)+((alignment)-1))/(alignment)*(alignment))
typedef unsigned char MSVCP_bool;
typedef SIZE_T MSVCP_size_t;
#if _MSVCP_VER >= 100
typedef __int64 DECLSPEC_ALIGN(8) streamoff;
typedef __int64 DECLSPEC_ALIGN(8) streamsize;
#define STREAMOFF_BITS 64
#define STREAMSIZE_BITS 64
#else
typedef SSIZE_T streamoff;
typedef SSIZE_T streamsize;
#define STREAMOFF_BITS 32
#define STREAMSIZE_BITS 32
#endif
void __cdecl _invalid_parameter(const wchar_t*, const wchar_t*,
const wchar_t*, unsigned int, uintptr_t);
......@@ -87,6 +97,18 @@ wchar_t* __thiscall MSVCP_allocator_wchar_allocate(void*, MSVCP_size_t);
void __thiscall MSVCP_allocator_wchar_deallocate(void*, wchar_t*, MSVCP_size_t);
MSVCP_size_t __thiscall MSVCP_allocator_wchar_max_size(void*);
typedef struct
{
char *str;
char null_str;
} _Yarn_char;
_Yarn_char* __thiscall _Yarn_char_ctor_cstr(_Yarn_char*, const char*);
_Yarn_char* __thiscall _Yarn_char_copy_ctor(_Yarn_char*, const _Yarn_char*);
const char* __thiscall _Yarn_char_c_str(const _Yarn_char*);
void __thiscall _Yarn_char_dtor(_Yarn_char*);
_Yarn_char* __thiscall _Yarn_char_op_assign(_Yarn_char*, const _Yarn_char*);
/* class locale::facet */
typedef struct {
const vtable_ptr *vtable;
......@@ -288,7 +310,11 @@ typedef struct _fnarray {
/* class ios_base */
typedef struct _ios_base {
const vtable_ptr *vtable;
#if _MSVCP_VER >= 100
MSVCP_size_t DECLSPEC_ALIGN(8) stdstr;
#else
MSVCP_size_t stdstr;
#endif
IOSB_iostate state;
IOSB_iostate except;
IOSB_fmtflags fmtfl;
......
......@@ -1721,6 +1721,115 @@ MSVCP_size_t __thiscall MSVCP_basic_string_char_find_first_of(
basic_string_char_const_ptr(find), off, find->size);
}
/* ??0?$_Yarn@D@std@@QAE@XZ */
/* ??0?$_Yarn@D@std@@QEAA@XZ */
DEFINE_THISCALL_WRAPPER(_Yarn_char_ctor, 4)
_Yarn_char* __thiscall _Yarn_char_ctor(_Yarn_char *this)
{
TRACE("(%p)\n", this);
this->str = NULL;
this->null_str = '\0';
return this;
}
/* ?_Tidy@?$_Yarn@D@std@@AAEXXZ */
/* ?_Tidy@?$_Yarn@D@std@@AEAAXXZ */
DEFINE_THISCALL_WRAPPER(_Yarn_char__Tidy, 4)
void __thiscall _Yarn_char__Tidy(_Yarn_char *this)
{
TRACE("(%p)\n", this);
if(this->str)
MSVCRT_operator_delete(this->str);
this->str = NULL;
}
/* ??4?$_Yarn@D@std@@QAEAAV01@PBD@Z */
/* ??4?$_Yarn@D@std@@QEAAAEAV01@PEBD@Z */
DEFINE_THISCALL_WRAPPER(_Yarn_char_op_assign_cstr, 8)
_Yarn_char* __thiscall _Yarn_char_op_assign_cstr(_Yarn_char *this, const char *str)
{
TRACE("(%p %p)\n", this, str);
_Yarn_char__Tidy(this);
if(str) {
MSVCP_size_t len = strlen(str);
this->str = MSVCRT_operator_new((len+1)*sizeof(char));
if(!this->str) {
ERR("out of memory\n");
return NULL;
}
memcpy(this->str, str, (len+1)*sizeof(char));
}
return this;
}
/* ??0?$_Yarn@D@std@@QAE@PBD@Z */
/* ??0?$_Yarn@D@std@@QEAA@PEBD@Z */
DEFINE_THISCALL_WRAPPER(_Yarn_char_ctor_cstr, 8)
_Yarn_char* __thiscall _Yarn_char_ctor_cstr(_Yarn_char *this, const char *str)
{
TRACE("(%p %p)\n", this, str);
_Yarn_char_ctor(this);
return _Yarn_char_op_assign_cstr(this, str);
}
/* ??4?$_Yarn@D@std@@QAEAAV01@ABV01@@Z */
/* ??4?$_Yarn@D@std@@QEAAAEAV01@AEBV01@@Z */
DEFINE_THISCALL_WRAPPER(_Yarn_char_op_assign, 8)
_Yarn_char* __thiscall _Yarn_char_op_assign(_Yarn_char *this, const _Yarn_char *rhs)
{
TRACE("(%p %p)\n", this, rhs);
return _Yarn_char_op_assign_cstr(this, rhs->str);
}
/* ??0?$_Yarn@D@std@@QAE@ABV01@@Z */
/* ??0?$_Yarn@D@std@@QEAA@AEBV01@@Z */
DEFINE_THISCALL_WRAPPER(_Yarn_char_copy_ctor, 8)
_Yarn_char* __thiscall _Yarn_char_copy_ctor(_Yarn_char *this, const _Yarn_char *copy)
{
TRACE("(%p %p)\n", this, copy);
_Yarn_char_ctor(this);
return _Yarn_char_op_assign(this, copy);
}
/* ??1?$_Yarn@D@std@@QAE@XZ */
/* ??1?$_Yarn@D@std@@QEAA@XZ */
DEFINE_THISCALL_WRAPPER(_Yarn_char_dtor, 4)
void __thiscall _Yarn_char_dtor(_Yarn_char *this)
{
TRACE("(%p)\n", this);
_Yarn_char__Tidy(this);
}
/* ?_C_str@?$_Yarn@D@std@@QBEPBDXZ */
/* ?_C_str@?$_Yarn@D@std@@QEBAPEBDXZ */
/* ?c_str@?$_Yarn@D@std@@QBEPBDXZ */
/* ?c_str@?$_Yarn@D@std@@QEBAPEBDXZ */
DEFINE_THISCALL_WRAPPER(_Yarn_char_c_str, 4)
const char* __thiscall _Yarn_char_c_str(const _Yarn_char *this)
{
TRACE("(%p)\n", this);
return this->str ? this->str : &this->null_str;
}
/* ?_Empty@?$_Yarn@D@std@@QBE_NXZ */
/* ?_Empty@?$_Yarn@D@std@@QEBA_NXZ */
/* ?empty@?$_Yarn@D@std@@QBE_NXZ */
/* ?empty@?$_Yarn@D@std@@QEBA_NXZ */
DEFINE_THISCALL_WRAPPER(_Yarn_char_empty, 4)
MSVCP_bool __thiscall _Yarn_char_empty(const _Yarn_char *this)
{
TRACE("(%p)\n", this);
return !this->str;
}
/* ?find_first_of@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIPBDI@Z */
/* ?find_first_of@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA_KPEBD_K@Z */
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_find_first_of_cstr, 12)
......
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