diff --git a/dlls/msvcp140/msvcp140.spec b/dlls/msvcp140/msvcp140.spec index 05d62becb12..fedb05fb88a 100644 --- a/dlls/msvcp140/msvcp140.spec +++ b/dlls/msvcp140/msvcp140.spec @@ -3675,10 +3675,10 @@ @ stub _Mtx_clear_owner @ cdecl _Mtx_current_owns(ptr) msvcp110._Mtx_current_owns @ cdecl _Mtx_destroy(ptr) _Mtx_destroy -@ stub _Mtx_destroy_in_situ +@ cdecl _Mtx_destroy_in_situ(ptr) _Mtx_destroy_in_situ @ cdecl _Mtx_getconcrtcs(ptr) _Mtx_getconcrtcs @ cdecl _Mtx_init(ptr long) _Mtx_init -@ stub _Mtx_init_in_situ +@ cdecl _Mtx_init_in_situ(ptr long) _Mtx_init_in_situ @ cdecl _Mtx_lock(ptr) _Mtx_lock @ stub _Mtx_reset_owner @ stub _Mtx_timedlock diff --git a/dlls/msvcp90/misc.c b/dlls/msvcp90/misc.c index 18b6a198ad6..322e937719c 100644 --- a/dlls/msvcp90/misc.c +++ b/dlls/msvcp90/misc.c @@ -478,19 +478,29 @@ typedef _Mtx_t *_Mtx_arg_t; #define MTX_T_TO_ARG(m) (&(m)) #endif -int __cdecl _Mtx_init(_Mtx_t *mtx, int flags) +void __cdecl _Mtx_init_in_situ(_Mtx_t mtx, int flags) { if(flags & ~MTX_MULTI_LOCK) FIXME("unknown flags ignored: %x\n", flags); + mtx->flags = flags; + call_func1(critical_section_ctor, &mtx->cs); + mtx->thread_id = -1; + mtx->count = 0; +} + +int __cdecl _Mtx_init(_Mtx_t *mtx, int flags) +{ *mtx = MSVCRT_operator_new(sizeof(**mtx)); - (*mtx)->flags = flags; - call_func1(critical_section_ctor, &(*mtx)->cs); - (*mtx)->thread_id = -1; - (*mtx)->count = 0; + _Mtx_init_in_situ(*mtx, flags); return 0; } +void __cdecl _Mtx_destroy_in_situ(_Mtx_t mtx) +{ + call_func1(critical_section_dtor, &mtx->cs); +} + void __cdecl _Mtx_destroy(_Mtx_arg_t mtx) { call_func1(critical_section_dtor, &MTX_T_FROM_ARG(mtx)->cs);