Piotr Caban : msvcrt: Reimplement _set_new_mode function.

Alexandre Julliard julliard at winehq.org
Wed Jan 29 16:24:07 CST 2020


Module: wine
Branch: master
Commit: 6113a251ef3955f2ac3436d90a523faf4c03bc0a
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=6113a251ef3955f2ac3436d90a523faf4c03bc0a

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Wed Jan 29 14:27:35 2020 +0100

msvcrt: Reimplement _set_new_mode function.

Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msvcrt/heap.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/dlls/msvcrt/heap.c b/dlls/msvcrt/heap.c
index 52f800e824..31153fa5b1 100644
--- a/dlls/msvcrt/heap.c
+++ b/dlls/msvcrt/heap.c
@@ -226,12 +226,8 @@ MSVCRT_new_handler_func CDECL MSVCRT_set_new_handler(void *func)
  */
 int CDECL MSVCRT__set_new_mode(int mode)
 {
-  int old_mode;
-  LOCK_HEAP;
-  old_mode = MSVCRT_new_mode;
-  MSVCRT_new_mode = mode;
-  UNLOCK_HEAP;
-  return old_mode;
+  if(!MSVCRT_CHECK_PMT(mode == 0 || mode == 1)) return -1;
+  return InterlockedExchange(&MSVCRT_new_mode, mode);
 }
 
 /*********************************************************************




More information about the wine-cvs mailing list