gdi32: Add a helper function to initialize Bresenham parameters for line drawing.
[wine/multimedia.git] / dlls / msvcp60 / misc.c
blob4d511993cfa5c5de0845dc4276dd83450e0c4564
1 /*
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
19 #include "config.h"
21 #include <stdarg.h>
22 #include <limits.h>
24 #include "msvcp.h"
26 #include "windef.h"
27 #include "winbase.h"
30 /* ??0_Mutex@std@@QAE@XZ */
31 /* ??0_Mutex@std@@QEAA@XZ */
32 DEFINE_THISCALL_WRAPPER(mutex_ctor, 4)
33 mutex* __thiscall mutex_ctor(mutex *this)
35 this->mutex = CreateMutexW(NULL, FALSE, NULL);
36 return this;
39 /* ??1_Mutex@std@@QAE@XZ */
40 /* ??1_Mutex@std@@QEAA@XZ */
41 DEFINE_THISCALL_WRAPPER(mutex_dtor, 4)
42 void __thiscall mutex_dtor(mutex *this)
44 CloseHandle(this->mutex);
47 /* ?_Lock@_Mutex@std@@QAEXXZ */
48 /* ?_Lock@_Mutex@std@@QEAAXXZ */
49 DEFINE_THISCALL_WRAPPER(mutex_lock, 4)
50 void __thiscall mutex_lock(mutex *this)
52 WaitForSingleObject(this->mutex, INFINITE);
55 /* ?_Unlock@_Mutex@std@@QAEXXZ */
56 /* ?_Unlock@_Mutex@std@@QEAAXXZ */
57 DEFINE_THISCALL_WRAPPER(mutex_unlock, 4)
58 void __thiscall mutex_unlock(mutex *this)
60 ReleaseMutex(this->mutex);
63 static CRITICAL_SECTION lockit_cs;
65 void init_lockit(void) {
66 InitializeCriticalSection(&lockit_cs);
67 lockit_cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": _Lockit critical section");
70 void free_lockit(void) {
71 lockit_cs.DebugInfo->Spare[0] = 0;
72 DeleteCriticalSection(&lockit_cs);
75 static _Lockit* __thiscall _Lockit_ctor_locktype(_Lockit *this, int locktype)
77 EnterCriticalSection(&lockit_cs);
78 return this;
81 /* ??0_Lockit@std@@QAE@XZ */
82 /* ??0_Lockit@std@@QEAA@XZ */
83 DEFINE_THISCALL_WRAPPER(_Lockit_ctor, 4)
84 _Lockit* __thiscall _Lockit_ctor(_Lockit *this)
86 return _Lockit_ctor_locktype(this, 0);
89 /* ??1_Lockit@std@@QAE@XZ */
90 /* ??1_Lockit@std@@QEAA@XZ */
91 DEFINE_THISCALL_WRAPPER(_Lockit_dtor, 4)
92 void __thiscall _Lockit_dtor(_Lockit *this)
94 LeaveCriticalSection(&lockit_cs);