Revision: 9715 https://osdn.net/projects/ttssh2/scm/svn/commits/9715 Author: nmaya Date: 2022-02-01 22:50:57 +0900 (Tue, 01 Feb 2022) Log Message: ----------- Tera Term, TTSSH のダンプファイルの出力先を LogDir にした Modified Paths: -------------- trunk/teraterm/teraterm/ttdebug.cpp trunk/ttssh2/ttxssh/ssh.c -------------- next part -------------- Modified: trunk/teraterm/teraterm/ttdebug.cpp =================================================================== --- trunk/teraterm/teraterm/ttdebug.cpp 2022-02-01 12:30:09 UTC (rev 9714) +++ trunk/teraterm/teraterm/ttdebug.cpp 2022-02-01 13:50:57 UTC (rev 9715) @@ -36,6 +36,7 @@ #include "svnversion.h" // for SVNVERSION #include "ttdebug.h" +#include "ttlib.h" /** * \x83R\x83\x93\x83\\x81[\x83\x8B\x83E\x83B\x83\x93\x83h\x83E\x82\xF0\x95\\x8E\xA6\x82\xB7\x82\xE9\x83f\x83o\x83O\x97p @@ -254,10 +255,6 @@ static wchar_t *CreateDumpFilename() { - // \x82Ƃ肠\x82\xA6\x82\xB8\x83f\x83X\x83N\x83g\x83b\x83v\x82ɍ쐬 - wchar_t *desktop; - _SHGetKnownFolderPath(FOLDERID_Desktop, KF_FLAG_CREATE, NULL, &desktop); - SYSTEMTIME local_time; GetLocalTime(&local_time); @@ -268,23 +265,28 @@ char *version = _strdup("unknown"); #endif wchar_t *dump_file; - aswprintf(&dump_file, L"%s\\teraterm_%hs_%04u%02u%02u-%02u%02u%02u.dmp", - desktop, version, + aswprintf(&dump_file, L"teraterm_%hs_%04u%02u%02u-%02u%02u%02u.dmp", + version, local_time.wYear, local_time.wMonth, local_time.wDay, local_time.wHour, local_time.wMinute, local_time.wSecond); free(version); - free(desktop); return dump_file; } static void DumpMiniDump(const wchar_t *filename, struct _EXCEPTION_POINTERS* pExceptionPointers) { + wchar_t *logdir = NULL; + wchar_t *dumpfile = NULL; + if (pMiniDumpWriteDump == NULL) { // MiniDumpWriteDump() \x82\xAA\x83T\x83|\x81[\x83g\x82\xB3\x82\xEA\x82Ă\xA2\x82Ȃ\xA2\x81BXP\x82\xE6\x82\xE8\x91O return; } - HANDLE file = CreateFileW(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + logdir = GetLogDirW(); + awcscats(&dumpfile, logdir, L"\\", filename, NULL); + HANDLE file = CreateFileW(dumpfile, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + free(dumpfile); if (file == INVALID_HANDLE_VALUE) { return; } Modified: trunk/ttssh2/ttxssh/ssh.c =================================================================== --- trunk/ttssh2/ttxssh/ssh.c 2022-02-01 12:30:09 UTC (rev 9714) +++ trunk/ttssh2/ttxssh/ssh.c 2022-02-01 13:50:57 UTC (rev 9715) @@ -568,8 +568,17 @@ int i; time_t t; struct tm *tm; + wchar_t *filenameW = NULL; + wchar_t *dumpfileW = NULL; + char *dumpfile = NULL; - fp = fopen(filename, "w"); + filenameW = ToWcharA(filename); + dumpfileW = get_log_dir_relative_nameW(filenameW); + dumpfile = ToCharW(dumpfileW); + fp = fopen(dumpfile, "w"); + free(filenameW); + free(dumpfileW); + free(dumpfile); if (fp == NULL) return;