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
30 /* ??0_Mutex@std@@QAE@XZ */
31 /* ??0_Mutex@std@@QEAA@XZ */
32 mutex* mutex_ctor(mutex *this)
34 this->mutex = CreateMutexW(NULL, FALSE, NULL);
38 /* ??1_Mutex@std@@QAE@XZ */
39 /* ??1_Mutex@std@@QEAA@XZ */
40 void mutex_dtor(mutex *this)
42 CloseHandle(this->mutex);
45 /* ?_Lock@_Mutex@std@@QAEXXZ */
46 /* ?_Lock@_Mutex@std@@QEAAXXZ */
47 void mutex_lock(mutex *this)
49 WaitForSingleObject(this->mutex, INFINITE);
52 /* ?_Unlock@_Mutex@std@@QAEXXZ */
53 /* ?_Unlock@_Mutex@std@@QEAAXXZ */
54 void mutex_unlock(mutex *this)
56 ReleaseMutex(this->mutex);
59 static CRITICAL_SECTION lockit_cs;
61 void init_lockit(void) {
62 InitializeCriticalSection(&lockit_cs);
63 lockit_cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": _Lockit critical section");
66 void free_lockit(void) {
67 lockit_cs.DebugInfo->Spare[0] = 0;
68 DeleteCriticalSection(&lockit_cs);
71 _Lockit* __thiscall _Lockit_ctor_locktype(_Lockit *this, int locktype)
73 EnterCriticalSection(&lockit_cs);
77 /* ??0_Lockit@std@@QAE@XZ */
78 /* ??0_Lockit@std@@QEAA@XZ */
79 DEFINE_THISCALL_WRAPPER(_Lockit_ctor, 4)
80 _Lockit* __thiscall _Lockit_ctor(_Lockit *this)
82 return _Lockit_ctor_locktype(this, 0);
85 /* ??1_Lockit@std@@QAE@XZ */
86 /* ??1_Lockit@std@@QEAA@XZ */
87 DEFINE_THISCALL_WRAPPER(_Lockit_dtor, 4)
88 void __thiscall _Lockit_dtor(_Lockit *this)
90 LeaveCriticalSection(&lockit_cs);
94 unsigned short __cdecl wctype(const char *property)
100 { "alnum", _DIGIT|_ALPHA },
102 { "cntrl", _CONTROL },
104 { "graph", _DIGIT|_PUNCT|_ALPHA },
106 { "print", _DIGIT|_PUNCT|_BLANK|_ALPHA },
114 for(i=0; i<sizeof(properties)/sizeof(properties[0]); i++)
115 if(!strcmp(property, properties[i].name))
116 return properties[i].mask;