[Ttssh2-commit] [8507] layer_for_unicode をリンクすると自動的に初期化

scmno****@osdn***** scmno****@osdn*****
2020年 1月 27日 (月) 00:13:58 JST


Revision: 8507
          https://osdn.net/projects/ttssh2/scm/svn/commits/8507
Author:   zmatsuo
Date:     2020-01-27 00:13:58 +0900 (Mon, 27 Jan 2020)
Log Message:
-----------
layer_for_unicode をリンクすると自動的に初期化

- APIアドレスの初期化を自動的に行うようにした

Modified Paths:
--------------
    trunk/teraterm/common/dllutil.cpp
    trunk/teraterm/common/layer_for_unicode.cpp

-------------- next part --------------
Modified: trunk/teraterm/common/dllutil.cpp
===================================================================
--- trunk/teraterm/common/dllutil.cpp	2020-01-26 15:13:52 UTC (rev 8506)
+++ trunk/teraterm/common/dllutil.cpp	2020-01-26 15:13:58 UTC (rev 8507)
@@ -260,6 +260,9 @@
 
 void DLLInit()
 {
+	if (HandleListCount != 0) {
+		return;		// \x8F\x89\x8A\xFA\x89\xBB\x8Dς\xDD
+	}
 	HandleList = NULL;
 	HandleListCount = 0;
 	SetupLoadLibraryPath();
@@ -268,6 +271,9 @@
 void DLLExit()
 {
 	int i;
+	if (HandleListCount == 0) {
+		return;		// \x96\xA2\x8Eg\x97p
+	}
 	for (i = 0; i < HandleListCount; i++) {
 		HandleList_t *p = &HandleList[i];
 		if (p->LoadFlag != DLL_GET_MODULE_HANDLE) {

Modified: trunk/teraterm/common/layer_for_unicode.cpp
===================================================================
--- trunk/teraterm/common/layer_for_unicode.cpp	2020-01-26 15:13:52 UTC (rev 8506)
+++ trunk/teraterm/common/layer_for_unicode.cpp	2020-01-26 15:13:58 UTC (rev 8507)
@@ -36,10 +36,24 @@
 
 #include "codeconv.h"
 #include "compat_win.h"
+#include "dllutil.h"
 #include "ttlib.h"		// for IsWindowsNTKernel()
 
 #include "layer_for_unicode.h"
 
+class Initializer {
+public:
+	Initializer() {
+		DLLInit();
+		WinCompatInit();
+	}
+	~Initializer() {
+		DLLExit();
+	}
+};
+
+static Initializer initializer;
+
 BOOL _SetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPCWSTR lpString)
 {
 	if (pSetDlgItemTextW != NULL) {


Ttssh2-commit メーリングリストの案内