[Ttssh2-commit] [9309] layer_for_unicodeを使用するよう修正

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2021年 6月 13日 (日) 00:29:58 JST


Revision: 9309
          https://osdn.net/projects/ttssh2/scm/svn/commits/9309
Author:   zmatsuo
Date:     2021-06-13 00:29:57 +0900 (Sun, 13 Jun 2021)
Log Message:
-----------
layer_for_unicodeを使用するよう修正

Modified Paths:
--------------
    trunk/teraterm/common/dllutil.cpp
    trunk/teraterm/common/ttlib.c
    trunk/teraterm/common/ttlib_static_cpp.cpp
    trunk/teraterm/common/win32helper.cpp
    trunk/teraterm/teraterm/teraprn.cpp
    trunk/teraterm/teraterm/ttplug.c
    trunk/teraterm/teraterm/vtwin.cpp
    trunk/teraterm/ttpmacro/ttmlib.c
    trunk/teraterm/ttpset/ttset.c
    trunk/teraterm/ttpset/ttset_keyboard.c
    trunk/ttpmenu/CMakeLists.txt

-------------- next part --------------
Modified: trunk/teraterm/common/dllutil.cpp
===================================================================
--- trunk/teraterm/common/dllutil.cpp	2021-06-12 15:29:49 UTC (rev 9308)
+++ trunk/teraterm/common/dllutil.cpp	2021-06-12 15:29:57 UTC (rev 9309)
@@ -33,6 +33,8 @@
 #endif
 #include <crtdbg.h>
 
+#include "layer_for_unicode.h"
+
 #include "dllutil.h"
 
 typedef struct {
@@ -54,7 +56,7 @@
 	int r;
 
 	if (LoadFlag == DLL_GET_MODULE_HANDLE) {
-		module = GetModuleHandleW(dllName);
+		module = _GetModuleHandleW(dllName);
 		assert(module != NULL);
 		return module;
 	}
@@ -73,12 +75,12 @@
 	dllPath[0] = 0;
 	switch (LoadFlag) {
 	case DLL_LOAD_LIBRARY_SYSTEM:
-		r = GetSystemDirectoryW(dllPath, _countof(dllPath));
+		r = _GetSystemDirectoryW(dllPath, _countof(dllPath));
 		assert(r != 0);
 		if (r == 0) return NULL;
 		break;
 	case DLL_LOAD_LIBRARY_CURRENT:
-		r = GetModuleFileNameW(NULL, dllPath, _countof(dllPath));
+		r = _GetModuleFileNameW(NULL, dllPath, _countof(dllPath));
 		assert(r != 0);
 		if (r == 0) return NULL;
 		*wcsrchr(dllPath, L'\\') = 0;
@@ -88,7 +90,7 @@
 	}
 	wcscat_s(dllPath, _countof(dllPath), L"\\");
 	wcscat_s(dllPath, _countof(dllPath), dllName);
-	module = LoadLibraryW(dllPath);
+	module = _LoadLibraryW(dllPath);
 	if (module == NULL) {
 		// \x91\xB6\x8D݂\xB5\x82Ȃ\xA2,dll\x82\xB6\x82\xE1\x82Ȃ\xA2?
 		return NULL;

Modified: trunk/teraterm/common/ttlib.c
===================================================================
--- trunk/teraterm/common/ttlib.c	2021-06-12 15:29:49 UTC (rev 9308)
+++ trunk/teraterm/common/ttlib.c	2021-06-12 15:29:57 UTC (rev 9309)
@@ -43,6 +43,7 @@
 #include "tttypes.h"
 #include "compat_win.h"
 #include "codeconv.h"
+#include "layer_for_unicode.h"
 
 #include "../teraterm/unicode_test.h"
 
@@ -1018,8 +1019,8 @@
 	SetupFName = GetDefaultSetupFNameW(HomeDirW);
 
 	/* Get LanguageFile name */
-	GetPrivateProfileStringW(L"Tera Term", entryW, L"off",
-	                        Temp, _countof(Temp), SetupFName);
+	_GetPrivateProfileStringW(L"Tera Term", entryW, L"off",
+							  Temp, _countof(Temp), SetupFName);
 
 	TempA = ToCharW(Temp);
 	strncpy_s(buf, buflen, TempA, _TRUNCATE);

Modified: trunk/teraterm/common/ttlib_static_cpp.cpp
===================================================================
--- trunk/teraterm/common/ttlib_static_cpp.cpp	2021-06-12 15:29:49 UTC (rev 9308)
+++ trunk/teraterm/common/ttlib_static_cpp.cpp	2021-06-12 15:29:57 UTC (rev 9309)
@@ -872,7 +872,7 @@
 	IMalloc *pmalloc;
 	SHGetMalloc(&pmalloc);
 	if (SHGetSpecialFolderLocation(NULL, CSIDL_PERSONAL, &pidl) == S_OK) {
-		SHGetPathFromIDListW(pidl, MyDoc);
+		_SHGetPathFromIDListW(pidl, MyDoc);
 		pmalloc->Free(pidl);
 		pmalloc->Release();
 	}
@@ -888,7 +888,7 @@
 		wcscpy(dest, MyDoc);
 		AppendSlashW(dest,destlen);
 		wcsncat_s(dest, destlen, file, _TRUNCATE);
-		if (GetFileAttributesW(dest) != INVALID_FILE_ATTRIBUTES) {
+		if (_GetFileAttributesW(dest) != INVALID_FILE_ATTRIBUTES) {
 			// My Documents \x82̐ݒ\xE8\x83t\x83@\x83C\x83\x8B
 			return dest;
 		}

Modified: trunk/teraterm/common/win32helper.cpp
===================================================================
--- trunk/teraterm/common/win32helper.cpp	2021-06-12 15:29:49 UTC (rev 9308)
+++ trunk/teraterm/common/win32helper.cpp	2021-06-12 15:29:57 UTC (rev 9309)
@@ -31,6 +31,8 @@
 #include <stdlib.h>
 #include <crtdbg.h>
 
+#include "layer_for_unicode.h"
+
 #include "win32helper.h"
 
 /**
@@ -51,7 +53,7 @@
 	}
 
 	for(;;) {
-		DWORD r = GetModuleFileNameW(hModule, b, (DWORD)size);
+		DWORD r = _GetModuleFileNameW(hModule, b, (DWORD)size);
 		if (r == 0) {
 			// \x8A֐\x94\x82\xAA\x8E\xB8\x94s
 			error = GetLastError();
@@ -99,7 +101,7 @@
 	}
 	b[0] = 0;
 	for(;;) {
-		DWORD r = GetPrivateProfileStringW(section, key, def, b, (DWORD)size, ini);
+		DWORD r = _GetPrivateProfileStringW(section, key, def, b, (DWORD)size, ini);
 		if (r == 0 || b[0] == L'\0') {
 			// \x8E\x9F\x82̏ꍇ\x82\xB1\x82\xB1\x82ɓ\xFC\x82\xE9
 			//   ini\x82\xC9'key='\x82ƋL\x8Fq ("="\x82̌\xE3\x82ɉ\xBD\x82\xE0\x8F\x91\x82\xA2\x82Ă\xA2\x82Ȃ\xA2)
@@ -141,7 +143,7 @@
  */
 DWORD hGetFullPathNameW(const wchar_t *lpFileName, wchar_t **fullpath, wchar_t **filepart)
 {
-	size_t len = GetFullPathNameW(lpFileName, 0, NULL, NULL);		// include L'\0'
+	size_t len = _GetFullPathNameW(lpFileName, 0, NULL, NULL);		// include L'\0'
 	if (len == 0) {
 		*fullpath = NULL;
 		*filepart = NULL;
@@ -149,7 +151,7 @@
 	}
 	wchar_t *path = (wchar_t *)malloc(sizeof(wchar_t) * len);
 	wchar_t *file;
-	len = GetFullPathNameW(lpFileName, (DWORD)len, path, &file);
+	len = _GetFullPathNameW(lpFileName, (DWORD)len, path, &file);
 	if (len == 0) {
 		free(path);
 		return GetLastError();

Modified: trunk/teraterm/teraterm/teraprn.cpp
===================================================================
--- trunk/teraterm/teraterm/teraprn.cpp	2021-06-12 15:29:49 UTC (rev 9308)
+++ trunk/teraterm/teraterm/teraprn.cpp	2021-06-12 15:29:57 UTC (rev 9309)
@@ -42,6 +42,7 @@
 #include "ttlib.h"
 #include "codeconv.h"
 #include "vtdisp.h"
+#include "layer_for_unicode.h"
 
 #include "tt_res.h"
 #include "tmfc.h"
@@ -450,15 +451,15 @@
 	KillTimer(HVTWin, IdPrnStartTimer);
 
 	wchar_t TempPath[MAX_PATH];
-	GetTempPathW(_countof(TempPath), TempPath);
+	_GetTempPathW(_countof(TempPath), TempPath);
 	wchar_t Temp[MAX_PATH];
-	if (GetTempFileNameW(TempPath, L"tmp", 0, Temp) == 0) {
+	if (_GetTempFileNameW(TempPath, L"tmp", 0, Temp) == 0) {
 		free(p);
 		return NULL;
 	}
 	p->PrnFName = _wcsdup(Temp);
 
-	HANDLE h = CreateFileW(p->PrnFName, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+	HANDLE h = _CreateFileW(p->PrnFName, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
 	if (h == INVALID_HANDLE_VALUE) {
 		free(p);
 		return NULL;
@@ -474,7 +475,7 @@
 	if (handle->PrnFName == NULL) {
 		return;
 	}
-	DeleteFileW(handle->PrnFName);
+	_DeleteFileW(handle->PrnFName);
 	free(handle->PrnFName);
 	handle->PrnFName = NULL;
 }
@@ -491,9 +492,9 @@
 static void PrintFile_(PrintFile *handle)
 {
 	if (VTPrintInit(IdPrnFile)==IdPrnFile) {
-		HANDLE HPrnFile = CreateFileW(handle->PrnFName,
-									  GENERIC_READ, FILE_SHARE_READ, NULL,
-									  OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+		HANDLE HPrnFile = _CreateFileW(handle->PrnFName,
+									   GENERIC_READ, FILE_SHARE_READ, NULL,
+									   OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
 
 		if (HPrnFile != INVALID_HANDLE_VALUE) {
 			char BuffA[TermWidthMax];
@@ -589,9 +590,9 @@
 	PrnAbortDlg->Create(hInst,hParent,&PrintAbortFlag,&ts);
 	HPrnAbortDlg = PrnAbortDlg->GetSafeHwnd();
 
-	handle->HPrnFile = CreateFileW(handle->PrnFName,
-								   GENERIC_READ, FILE_SHARE_READ, NULL,
-								   OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+	handle->HPrnFile = _CreateFileW(handle->PrnFName,
+									GENERIC_READ, FILE_SHARE_READ, NULL,
+									OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
 	PrintAbortFlag = (handle->HPrnFile == INVALID_HANDLE_VALUE) || ! PrnOpen(ts.PrnDev);
 	handle->PrnBuffCount = 0;
 	SetTimer(HVTWin,IdPrnProcTimer,0,NULL);

Modified: trunk/teraterm/teraterm/ttplug.c
===================================================================
--- trunk/teraterm/teraterm/ttplug.c	2021-06-12 15:29:49 UTC (rev 9308)
+++ trunk/teraterm/teraterm/ttplug.c	2021-06-12 15:29:57 UTC (rev 9309)
@@ -41,6 +41,7 @@
 #include "ttplugin.h"
 #include "codeconv.h"
 #include "asprintf.h"
+#include "layer_for_unicode.h"
 
 #include "ttplug.h"
 
@@ -66,7 +67,7 @@
 	const wchar_t *sub_message;
 	HMODULE hPlugin;
 
-	hPlugin = LoadLibraryW(fileName);
+	hPlugin = _LoadLibraryW(fileName);
 	if (hPlugin != NULL) {
 		TTXBindProc bind = NULL;
 		FARPROC *pbind = (FARPROC *)&bind;
@@ -147,7 +148,7 @@
 
 	aswprintf(&load_mask, L"%s\\TTX*.DLL", HomeDirW);
 
-	hFind = FindFirstFileW(load_mask, &fd);
+	hFind = _FindFirstFileW(load_mask, &fd);
 	if (hFind != INVALID_HANDLE_VALUE) {
 		do {
 			wchar_t *filename;
@@ -154,7 +155,7 @@
 			aswprintf(&filename, L"%s\\%s", HomeDirW, fd.cFileName);
 			loadExtension(filename);
 			free(filename);
-		} while (FindNextFileW(hFind, &fd));
+		} while (_FindNextFileW(hFind, &fd));
 		FindClose(hFind);
 	}
 	free(load_mask);

Modified: trunk/teraterm/teraterm/vtwin.cpp
===================================================================
--- trunk/teraterm/teraterm/vtwin.cpp	2021-06-12 15:29:49 UTC (rev 9308)
+++ trunk/teraterm/teraterm/vtwin.cpp	2021-06-12 15:29:57 UTC (rev 9309)
@@ -4659,7 +4659,7 @@
 		free(HomeDirW);
 	}
 
-	SetCurrentDirectoryW(DirW);
+	_SetCurrentDirectoryW(DirW);
 
 	/* OPENFILENAME record */
 	OPENFILENAMEW ofn = {};

Modified: trunk/teraterm/ttpmacro/ttmlib.c
===================================================================
--- trunk/teraterm/ttpmacro/ttmlib.c	2021-06-12 15:29:49 UTC (rev 9308)
+++ trunk/teraterm/ttpmacro/ttmlib.c	2021-06-12 15:29:57 UTC (rev 9309)
@@ -38,6 +38,7 @@
 #include "compat_win.h"
 #include "ttmlib.h"
 #include "codeconv.h"
+#include "layer_for_unicode.h"
 
 static char CurrentDir[MAXPATHLEN];
 
@@ -186,13 +187,13 @@
 	wchar_t *pCurrentDirW = ToWcharU8(CurrentDir);
 	wchar_t *DirW = ToWcharU8(Dir);
 	char *pCurrentDirU8;
-	GetCurrentDirectoryW(_countof(Temp), Temp);
-	SetCurrentDirectoryW(pCurrentDirW);
-	SetCurrentDirectoryW(DirW);
-	GetCurrentDirectoryW(_countof(CurrentDirW), CurrentDirW);
+	_GetCurrentDirectoryW(_countof(Temp), Temp);
+	_SetCurrentDirectoryW(pCurrentDirW);
+	_SetCurrentDirectoryW(DirW);
+	_GetCurrentDirectoryW(_countof(CurrentDirW), CurrentDirW);
 	pCurrentDirU8 = ToU8W(CurrentDirW);
 	strncpy_s(CurrentDir, _countof(CurrentDir), pCurrentDirU8, _TRUNCATE);
-	SetCurrentDirectoryW(Temp);
+	_SetCurrentDirectoryW(Temp);
 	free(pCurrentDirW);
 	free(DirW);
 	free(pCurrentDirU8);

Modified: trunk/teraterm/ttpset/ttset.c
===================================================================
--- trunk/teraterm/ttpset/ttset.c	2021-06-12 15:29:49 UTC (rev 9308)
+++ trunk/teraterm/ttpset/ttset.c	2021-06-12 15:29:57 UTC (rev 9309)
@@ -46,6 +46,7 @@
 #include "tt_res.h"
 #include "servicenames.h"
 #include "codeconv.h"
+#include "layer_for_unicode.h"
 #include "win32helper.h"
 
 #define DllExport __declspec(dllexport)
@@ -171,7 +172,7 @@
 	wchar_t *defW = ToWcharA(defA);
 	DWORD lenW_max = size;
 	wchar_t *strW = malloc(sizeof(wchar_t) * lenW_max);
-	DWORD lenW = GetPrivateProfileStringW(appW, keyW, defW, strW, lenW_max, filenameW);
+	DWORD lenW = _GetPrivateProfileStringW(appW, keyW, defW, strW, lenW_max, filenameW);
 	free(appW);
 	free(keyW);
 	free(defW);
@@ -201,7 +202,7 @@
 	wchar_t *appW = ToWcharA(appA);
 	wchar_t *keyW = ToWcharA(keyA);
 	wchar_t *strW = ToWcharA(strA);
-	BOOL r = WritePrivateProfileStringW(appW, keyW, strW, filenameW);
+	BOOL r = _WritePrivateProfileStringW(appW, keyW, strW, filenameW);
 	free(appW);
 	free(keyW);
 	free(strW);
@@ -215,7 +216,7 @@
 {
 	wchar_t *appW = ToWcharA(appA);
 	wchar_t *keyW = ToWcharA(keyA);
-	UINT r = GetPrivateProfileIntW(appW, keyW, def, filenameW);
+	UINT r = _GetPrivateProfileIntW(appW, keyW, def, filenameW);
 	free(appW);
 	free(keyW);
 	return r;

Modified: trunk/teraterm/ttpset/ttset_keyboard.c
===================================================================
--- trunk/teraterm/ttpset/ttset_keyboard.c	2021-06-12 15:29:49 UTC (rev 9308)
+++ trunk/teraterm/ttpset/ttset_keyboard.c	2021-06-12 15:29:57 UTC (rev 9309)
@@ -36,6 +36,7 @@
 #include <crtdbg.h>
 #include "ttlib.h"
 #include "codeconv.h"
+#include "layer_for_unicode.h"
 #include "../teraterm/keyboard_i.h"
 
 typedef struct {
@@ -50,7 +51,7 @@
 	for (i = 0; i < count; i++) {
 		wchar_t Temp[11];
 		WORD Num;
-		GetPrivateProfileStringW(section, p->key_str, L"", Temp, _countof(Temp), FName);
+		_GetPrivateProfileStringW(section, p->key_str, L"", Temp, _countof(Temp), FName);
 		if (Temp[0] == 0)
 			Num = 0xFFFF;
 		else if (_wcsicmp(Temp, L"off") == 0)
@@ -190,8 +191,8 @@
 		wchar_t EntName[7];
 		wchar_t TempStr[256];
 		_snwprintf_s(EntName, _countof(EntName), _TRUNCATE, L"User%d", i + 1);
-		GetPrivateProfileStringW(L"User keys", EntName, L"",
-								 TempStr, _countof(TempStr), FName);
+		_GetPrivateProfileStringW(L"User keys", EntName, L"",
+								  TempStr, _countof(TempStr), FName);
 		if (TempStr[0] == 0) {
 			continue;
 		}

Modified: trunk/ttpmenu/CMakeLists.txt
===================================================================
--- trunk/ttpmenu/CMakeLists.txt	2021-06-12 15:29:49 UTC (rev 9308)
+++ trunk/ttpmenu/CMakeLists.txt	2021-06-12 15:29:57 UTC (rev 9309)
@@ -30,9 +30,8 @@
 
 source_group(
   "common"
-  FILES
-  ${COMMON_SRC}
-  )
+  REGULAR_EXPRESSION
+  "teraterm\/common\/")
 
 if(SUPPORT_OLD_WINDOWS)
   if(MSVC)


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