2 * Copyright 2010 Piotr Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
28 #include "wine/debug.h"
29 WINE_DEFAULT_DEBUG_CHANNEL(msvcp90
);
31 /* ??0_Mutex@std@@QAE@XZ */
32 /* ??0_Mutex@std@@QEAA@XZ */
33 DEFINE_THISCALL_WRAPPER(mutex_ctor
, 4)
34 mutex
* __thiscall
mutex_ctor(mutex
*this)
36 this->mutex
= CreateMutexW(NULL
, FALSE
, NULL
);
40 /* ??1_Mutex@std@@QAE@XZ */
41 /* ??1_Mutex@std@@QEAA@XZ */
42 DEFINE_THISCALL_WRAPPER(mutex_dtor
, 4)
43 void __thiscall
mutex_dtor(mutex
*this)
45 CloseHandle(this->mutex
);
48 /* ?_Lock@_Mutex@std@@QAEXXZ */
49 /* ?_Lock@_Mutex@std@@QEAAXXZ */
50 DEFINE_THISCALL_WRAPPER(mutex_lock
, 4)
51 void __thiscall
mutex_lock(mutex
*this)
53 WaitForSingleObject(this->mutex
, INFINITE
);
56 /* ?_Unlock@_Mutex@std@@QAEXXZ */
57 /* ?_Unlock@_Mutex@std@@QEAAXXZ */
58 DEFINE_THISCALL_WRAPPER(mutex_unlock
, 4)
59 void __thiscall
mutex_unlock(mutex
*this)
61 ReleaseMutex(this->mutex
);
64 /* ?_Mutex_Lock@_Mutex@std@@CAXPAV12@@Z */
65 /* ?_Mutex_Lock@_Mutex@std@@CAXPEAV12@@Z */
66 void CDECL
mutex_mutex_lock(mutex
*m
)
71 /* ?_Mutex_Unlock@_Mutex@std@@CAXPAV12@@Z */
72 /* ?_Mutex_Unlock@_Mutex@std@@CAXPEAV12@@Z */
73 void CDECL
mutex_mutex_unlock(mutex
*m
)
78 /* ?_Mutex_ctor@_Mutex@std@@CAXPAV12@@Z */
79 /* ?_Mutex_ctor@_Mutex@std@@CAXPEAV12@@Z */
80 void CDECL
mutex_mutex_ctor(mutex
*m
)
85 /* ?_Mutex_dtor@_Mutex@std@@CAXPAV12@@Z */
86 /* ?_Mutex_dtor@_Mutex@std@@CAXPEAV12@@Z */
87 void CDECL
mutex_mutex_dtor(mutex
*m
)
92 static CRITICAL_SECTION lockit_cs
;
94 void init_lockit(void) {
95 InitializeCriticalSection(&lockit_cs
);
96 lockit_cs
.DebugInfo
->Spare
[0] = (DWORD_PTR
)(__FILE__
": _Lockit critical section");
99 void free_lockit(void) {
100 lockit_cs
.DebugInfo
->Spare
[0] = 0;
101 DeleteCriticalSection(&lockit_cs
);
104 _Lockit
* __thiscall
_Lockit_ctor_locktype(_Lockit
*this, int locktype
)
106 EnterCriticalSection(&lockit_cs
);
110 /* ??0_Lockit@std@@QAE@XZ */
111 /* ??0_Lockit@std@@QEAA@XZ */
112 DEFINE_THISCALL_WRAPPER(_Lockit_ctor
, 4)
113 _Lockit
* __thiscall
_Lockit_ctor(_Lockit
*this)
115 return _Lockit_ctor_locktype(this, 0);
118 /* ??1_Lockit@std@@QAE@XZ */
119 /* ??1_Lockit@std@@QEAA@XZ */
120 DEFINE_THISCALL_WRAPPER(_Lockit_dtor
, 4)
121 void __thiscall
_Lockit_dtor(_Lockit
*this)
123 LeaveCriticalSection(&lockit_cs
);
127 unsigned short __cdecl
wctype(const char *property
)
129 static const struct {
133 { "alnum", _DIGIT
|_ALPHA
},
135 { "cntrl", _CONTROL
},
137 { "graph", _DIGIT
|_PUNCT
|_ALPHA
},
139 { "print", _DIGIT
|_PUNCT
|_BLANK
|_ALPHA
},
147 for(i
=0; i
<sizeof(properties
)/sizeof(properties
[0]); i
++)
148 if(!strcmp(property
, properties
[i
].name
))
149 return properties
[i
].mask
;
154 typedef void (__cdecl
*MSVCP_new_handler_func
)(void);
155 static MSVCP_new_handler_func MSVCP_new_handler
;
156 static int __cdecl
new_handler_wrapper(MSVCP_size_t unused
)
162 /* ?set_new_handler@std@@YAP6AXXZP6AXXZ@Z */
163 MSVCP_new_handler_func __cdecl
set_new_handler(MSVCP_new_handler_func new_handler
)
165 MSVCP_new_handler_func old_handler
= MSVCP_new_handler
;
167 TRACE("%p\n", new_handler
);
169 MSVCP_new_handler
= new_handler
;
170 MSVCRT_set_new_handler(new_handler
? new_handler_wrapper
: NULL
);
174 /* ?set_new_handler@std@@YAP6AXXZH@Z */
175 MSVCP_new_handler_func __cdecl
set_new_handler_reset(int unused
)
177 return set_new_handler(NULL
);