[Ttssh2-commit] [7959] Windows Meでは InitializeCriticalSectionAndSpinCount APIがサポートされているが、

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2019年 8月 15日 (木) 21:15:13 JST


Revision: 7959
          https://osdn.net/projects/ttssh2/scm/svn/commits/7959
Author:   yutakapon
Date:     2019-08-15 21:15:12 +0900 (Thu, 15 Aug 2019)
Log Message:
-----------
Windows Meでは InitializeCriticalSectionAndSpinCount APIがサポートされているが、
関数がエラー(0)を返し、かつGetLastError()が0になるという現象が発生する。そのため、
当該APIを使わないようにする。
チケット #36876 

Ticket Links:
------------
    https://osdn.net/projects/ttssh2/tracker/detail/36876

Modified Paths:
--------------
    branches/openssl_1_1_1_v2/libs/openssl_patch/check_patch.bat

Added Paths:
-----------
    branches/openssl_1_1_1_v2/libs/openssl_patch/atomic_api.txt

-------------- next part --------------
Added: branches/openssl_1_1_1_v2/libs/openssl_patch/atomic_api.txt
===================================================================
--- branches/openssl_1_1_1_v2/libs/openssl_patch/atomic_api.txt	                        (rev 0)
+++ branches/openssl_1_1_1_v2/libs/openssl_patch/atomic_api.txt	2019-08-15 12:15:12 UTC (rev 7959)
@@ -0,0 +1,46 @@
+*** openssl-1.1.1c.org/crypto/threads_win.c	2019-05-28 22:12:20.000000000 +0900
+--- openssl/crypto/threads_win.c	2019-08-15 20:07:00.636008200 +0900
+***************
+*** 13,18 ****
+--- 13,53 ----
+  
+  #include <openssl/crypto.h>
+  
++ #define InitializeCriticalSectionAndSpinCount(a, b) myInitializeCriticalSectionAndSpinCount(a)
++ int myInitializeCriticalSectionAndSpinCount(void *arg)
++ {
++ 	InitializeCriticalSection(arg);
++  	return 1;
++ }
++ 
++ #if 0
++ #define InterlockedCompareExchange(a, b, c) myInterlockedCompareExchange(a, b, c)
++ LONG myInterlockedCompareExchange( 
++      LPLONG volatile Destination,
++      LONG Exchange,
++      LONG Comperand
++ )
++ {
++  	LONG ret = *Destination;
++ 	OutputDebugPrintf("%s: %x\n", __FUNCTION__, ret);
++  	
++  	if (*Destination == Comperand)
++  		ret = InterlockedExchange(Destination, Exchange);
++  	return (ret);
++ }
++  
++ #define InterlockedExchangeAdd(a, b) myInterlockedExchangeAdd(a, b)
++ LONG myInterlockedExchangeAdd(
++    LONG volatile *Addend,
++    LONG          Value
++  )
++ {
++ 	OutputDebugPrintf("%s: %x\n", __FUNCTION__, Value);
++  	while (Value-- > 0) 
++  		InterlockedIncrement(Addend);
++ }
++ #endif
++ 
+  #if defined(OPENSSL_THREADS) && !defined(CRYPTO_TDEBUG) && defined(OPENSSL_SYS_WINDOWS)
+  
+  CRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void)

Modified: branches/openssl_1_1_1_v2/libs/openssl_patch/check_patch.bat
===================================================================
--- branches/openssl_1_1_1_v2/libs/openssl_patch/check_patch.bat	2019-08-15 09:02:29 UTC (rev 7958)
+++ branches/openssl_1_1_1_v2/libs/openssl_patch/check_patch.bat	2019-08-15 12:15:12 UTC (rev 7959)
@@ -54,11 +54,21 @@
 popd
 
 
-
+rem WindowsMe\x82\xC5InitializeCriticalSectionAndSpinCount\x82\xAA\x83G\x83\x89\x81[\x82ƂȂ錻\x8Fۉ\xF1\x94\xF0\x82̂\xBD\x82߁B
 :patch6
+findstr /c:"myInitializeCriticalSectionAndSpinCount" ..\openssl\crypto\threads_win.c
+if ERRORLEVEL 1 goto fail6
+goto patch7
+:fail6
+pushd ..
+%folder%\patch %cmdopt1% < %folder%\atomic_api.txt
+%folder%\patch %cmdopt2% < %folder%\atomic_api.txt
+popd
 
 
+:patch7
 
+
 :patch_end
 echo "\x83p\x83b\x83`\x82͓K\x97p\x82\xB3\x82\xEA\x82Ă\xA2\x82܂\xB7"
 timeout 5


Ttssh2-commit メーリングリストの案内
Back to archive index