[Ttssh2-commit] [7360] OPENFILENAME.lStructSize を get_OPENFILENAME_SIZE() で初期化

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2018年 12月 24日 (月) 01:13:06 JST


Revision: 7360
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/7360
Author:   zmatsuo
Date:     2018-12-24 01:13:05 +0900 (Mon, 24 Dec 2018)
Log Message:
-----------
OPENFILENAME.lStructSize を get_OPENFILENAME_SIZE() で初期化

Modified Paths:
--------------
    trunk/TTXSamples/TTXttyrec/TTXttyplay.c
    trunk/TTXSamples/TTXttyrec/TTXttyrec.c
    trunk/teraterm/common/ttlib.c
    trunk/teraterm/common/ttlib.h
    trunk/teraterm/ttpfile/ttfile.c
    trunk/teraterm/ttpmacro/ttl.c
    trunk/ttssh2/ttxssh/auth.c
    trunk/ttssh2/ttxssh/ttxssh.c

-------------- next part --------------
Modified: trunk/TTXSamples/TTXttyrec/TTXttyplay.c
===================================================================
--- trunk/TTXSamples/TTXttyrec/TTXttyplay.c	2018-12-23 08:37:30 UTC (rev 7359)
+++ trunk/TTXSamples/TTXttyrec/TTXttyplay.c	2018-12-23 16:13:05 UTC (rev 7360)
@@ -384,7 +384,7 @@
 	case ID_MENU_REPLAY:
 		if (!pvar->enable) {
 			memset(&ofn, 0, sizeof(ofn));
-			ofn.lStructSize = sizeof(ofn);
+			ofn.lStructSize = get_OPENFILENAME_SIZE();
 			ofn.hwndOwner = hWin;
 			ofn.lpstrFilter = "ttyrec(*.tty)\0*.tty\0All files(*.*)\0*.*\0\0";
 			ofn.lpstrFile = pvar->openfn;

Modified: trunk/TTXSamples/TTXttyrec/TTXttyrec.c
===================================================================
--- trunk/TTXSamples/TTXttyrec/TTXttyrec.c	2018-12-23 08:37:30 UTC (rev 7359)
+++ trunk/TTXSamples/TTXttyrec/TTXttyrec.c	2018-12-23 16:13:05 UTC (rev 7360)
@@ -211,7 +211,7 @@
       }
 
       memset(&ofn, 0, sizeof(ofn));
-      ofn.lStructSize = sizeof(ofn);
+      ofn.lStructSize = get_OPENFILENAME_SIZE();
       ofn.hwndOwner = hWin;
       ofn.lpstrFilter = "ttyrec(*.tty)\0*.tty\0All files(*.*)\0*.*\0\0";
       ofn.lpstrFile = fname;

Modified: trunk/teraterm/common/ttlib.c
===================================================================
--- trunk/teraterm/common/ttlib.c	2018-12-23 08:37:30 UTC (rev 7359)
+++ trunk/teraterm/common/ttlib.c	2018-12-23 16:13:05 UTC (rev 7360)
@@ -1425,13 +1425,17 @@
 	return IsWindows2000OrLater() || IsWindowsMe();
 }
 
-int get_OPENFILENAME_SIZE()
+#if !defined(OPENFILENAME_SIZE_VERSION_400A)
+#define OPENFILENAME_SIZE_VERSION_400A 76
+#endif
+
+// OPENFILENAMEA.lStructSize \x82ɑ\xE3\x93\xFC\x82\xB7\x82\xE9\x92l
+DWORD get_OPENFILENAME_SIZE()
 {
 	if (IsWindows2000OrLater()) {
-		return sizeof(OPENFILENAME);
+		return sizeof(OPENFILENAMEA);
 	}
-	//return OPENFILENAME_SIZE_VERSION_400;
-	return 76;
+	return OPENFILENAME_SIZE_VERSION_400A;
 }
 
 // convert table for KanjiCodeID and ListID

Modified: trunk/teraterm/common/ttlib.h
===================================================================
--- trunk/teraterm/common/ttlib.h	2018-12-23 08:37:30 UTC (rev 7359)
+++ trunk/teraterm/common/ttlib.h	2018-12-23 16:13:05 UTC (rev 7360)
@@ -72,7 +72,7 @@
 BOOL doSelectFolder(HWND hWnd, char *path, int pathlen, char *def, char *msg);
 void OutputDebugPrintf(char *fmt, ...);
 BOOL is_NT4();
-int get_OPENFILENAME_SIZE();
+DllExport DWORD get_OPENFILENAME_SIZE();
 BOOL IsWindows95();
 BOOL IsWindowsMe();
 BOOL IsWindowsNT4();

Modified: trunk/teraterm/ttpfile/ttfile.c
===================================================================
--- trunk/teraterm/ttpfile/ttfile.c	2018-12-23 08:37:30 UTC (rev 7359)
+++ trunk/teraterm/ttpfile/ttfile.c	2018-12-23 16:13:05 UTC (rev 7360)
@@ -93,7 +93,7 @@
 	/* OPENFILENAME record */
 	memset(&ofn, 0, sizeof(OPENFILENAME));
 
-	ofn.lStructSize = sizeof(OPENFILENAME);
+	ofn.lStructSize = get_OPENFILENAME_SIZE();
 	ofn.hwndOwner   = HWin;
 	ofn.lpstrFile   = Name;
 	ofn.nMaxFile    = sizeof(Name);
@@ -485,7 +485,7 @@
 
 	ExtractFileName(fv->FullName, FileName ,sizeof(FileName));
 	strncpy_s(fv->FullName, sizeof(fv->FullName), FileName, _TRUNCATE);
-	ofn.lStructSize = sizeof(OPENFILENAME);
+	ofn.lStructSize = get_OPENFILENAME_SIZE();
 	ofn.hwndOwner   = fv->HMainWin;
 	ofn.lpstrFilter = FNFilter;
 	ofn.nFilterIndex = 1;
@@ -714,7 +714,7 @@
 	memcpy(pf, uimsg, sizeof(FNFilter) - (pf - FNFilter + 2));
 
 	memset(&ofn, 0, sizeof(OPENFILENAME));
-	ofn.lStructSize = sizeof(OPENFILENAME);
+	ofn.lStructSize = get_OPENFILENAME_SIZE();
 	ofn.hwndOwner   = fv->HMainWin;
 	ofn.lpstrFilter = FNFilter;
 	ofn.nFilterIndex = 1;
@@ -1144,7 +1144,7 @@
 	// \0\0 \x82ŏI\x82\xED\x82\xE9\x95K\x97v\x82\xAA\x82\xA0\x82\xE9\x82̂\xC5 2 \x83o\x83C\x83g
 	memcpy(pf, uimsg, sizeof(FNFilter) - (pf - FNFilter + 2));
 
-	ofn.lStructSize = sizeof(OPENFILENAME);
+	ofn.lStructSize = get_OPENFILENAME_SIZE();
 	ofn.hwndOwner   = HWin;
 	ofn.lpstrFilter = FNFilter;
 	ofn.nFilterIndex = 1;

Modified: trunk/teraterm/ttpmacro/ttl.c
===================================================================
--- trunk/teraterm/ttpmacro/ttl.c	2018-12-23 08:37:30 UTC (rev 7359)
+++ trunk/teraterm/ttpmacro/ttl.c	2018-12-23 16:13:05 UTC (rev 7360)
@@ -1547,7 +1547,7 @@
 	if (CheckVar("inputstr", &ValType, &VarId) &&
 	    (ValType==TypString)) {
 		memset(&ofn, 0, sizeof(OPENFILENAME));
-		ofn.lStructSize     = sizeof(OPENFILENAME);
+		ofn.lStructSize     = get_OPENFILENAME_SIZE();
 		ofn.hwndOwner       = HMainWin;
 		ofn.lpstrTitle      = Str1;
 		ofn.lpstrFile       = StrVarPtr(VarId);

Modified: trunk/ttssh2/ttxssh/auth.c
===================================================================
--- trunk/ttssh2/ttxssh/auth.c	2018-12-23 08:37:30 UTC (rev 7359)
+++ trunk/ttssh2/ttxssh/auth.c	2018-12-23 16:13:05 UTC (rev 7360)
@@ -31,6 +31,7 @@
 #include "util.h"
 #include "ssh.h"
 #include "key.h"
+#include "ttlib.h"
 
 #include <io.h>
 #include <fcntl.h>
@@ -373,7 +374,7 @@
 	char filter[MAX_UIMSG];
 
 	ZeroMemory(&params, sizeof(params));
-	params.lStructSize = sizeof(OPENFILENAME);
+	params.lStructSize = get_OPENFILENAME_SIZE();
 	params.hwndOwner = parent;
 	// \x83t\x83B\x83\x8B\x83^\x82̒lj\xC1 (2004.12.19 yutaka)
 	// 3\x83t\x83@\x83C\x83\x8B\x83t\x83B\x83\x8B\x83^\x82̒lj\xC1 (2005.4.26 yutaka)

Modified: trunk/ttssh2/ttxssh/ttxssh.c
===================================================================
--- trunk/ttssh2/ttxssh/ttxssh.c	2018-12-23 08:37:30 UTC (rev 7359)
+++ trunk/ttssh2/ttxssh/ttxssh.c	2018-12-23 16:13:05 UTC (rev 7360)
@@ -3222,7 +3222,7 @@
 	OPENFILENAME params;
 	char fullname_buf[2048] = "ssh_known_hosts";
 
-	params.lStructSize = sizeof(OPENFILENAME);
+	params.lStructSize = get_OPENFILENAME_SIZE();
 	params.hwndOwner = parent;
 	params.lpstrFilter = NULL;
 	params.lpstrCustomFilter = NULL;
@@ -3940,7 +3940,7 @@
 			OPENFILENAME ofn;
 
 			ZeroMemory(&ofn, sizeof(ofn));
-			ofn.lStructSize = sizeof(OPENFILENAME);
+			ofn.lStructSize = get_OPENFILENAME_SIZE();
 			ofn.hwndOwner = dlg;
 #if 0
 			get_lang_msg("FILEDLG_SELECT_LOGVIEW_APP_FILTER", ts.UIMsg, sizeof(ts.UIMsg),
@@ -4652,7 +4652,7 @@
 
 			// saving file dialog
 			ZeroMemory(&ofn, sizeof(ofn));
-			ofn.lStructSize = sizeof(ofn);
+			ofn.lStructSize = get_OPENFILENAME_SIZE();
 			ofn.hwndOwner = dlg;
 			switch (public_key.type) {
 			case KEY_RSA1:
@@ -4868,7 +4868,7 @@
 
 			// saving file dialog
 			ZeroMemory(&ofn, sizeof(ofn));
-			ofn.lStructSize = sizeof(ofn);
+			ofn.lStructSize = get_OPENFILENAME_SIZE();
 			ofn.hwndOwner = dlg;
 			switch (private_key.type) {
 			case KEY_RSA1:


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