Revision: 8993 https://osdn.net/projects/ttssh2/scm/svn/commits/8993 Author: zmatsuo Date: 2020-11-02 00:34:47 +0900 (Mon, 02 Nov 2020) Log Message: ----------- ファイル名領域確保に malloc を使用 - 従来は GlobalAlloc() を使用していた Modified Paths: -------------- branches/proto_unicode/teraterm/teraterm/filesys_proto.cpp branches/proto_unicode/teraterm/teraterm/filesys_proto.h branches/proto_unicode/teraterm/ttpfile/ftlib.c -------------- next part -------------- Modified: branches/proto_unicode/teraterm/teraterm/filesys_proto.cpp =================================================================== --- branches/proto_unicode/teraterm/teraterm/filesys_proto.cpp 2020-11-01 15:34:32 UTC (rev 8992) +++ branches/proto_unicode/teraterm/teraterm/filesys_proto.cpp 2020-11-01 15:34:47 UTC (rev 8993) @@ -155,11 +155,16 @@ fv->Close(fv); fv->FileOpen = FALSE; } + if (fv->FnStrMem != NULL) { + free(fv->FnStrMem); + } +#if 0 if (fv->FnStrMemHandle != 0) { GlobalUnlock(fv->FnStrMemHandle); GlobalFree(fv->FnStrMemHandle); } +#endif fv->FileSysDestroy(fv); free(fv); @@ -754,6 +759,7 @@ fv->NumFname = 0; /* moemory should be zero-initialized */ +#if 0 fv->FnStrMemHandle = GlobalAlloc(GHND, FnStrMemSize); if (fv->FnStrMemHandle == NULL) { MessageBeep(0); @@ -768,7 +774,14 @@ return FALSE; } } +#endif + fv->FnStrMem = (char *)malloc(FnStrMemSize); + if (fv->FnStrMem == NULL) { + MessageBeep(0); + return FALSE; + } + char *FNFilter = GetCommonDialogFilterA(FileSendFilter, UILanguageFile); char *default_filename = GetCommonDialogDefaultFilenameA(CurDir); @@ -834,11 +847,17 @@ fv->FNCount = 0; } +#if 0 GlobalUnlock(fv->FnStrMemHandle); if (! Ok) { GlobalFree(fv->FnStrMemHandle); fv->FnStrMemHandle = NULL; } +#endif + if (! Ok) { + free(fv->FnStrMem); + fv->FnStrMem = NULL; + } /* restore dir */ _SetCurrentDirectoryW(TempDir); Modified: branches/proto_unicode/teraterm/teraterm/filesys_proto.h =================================================================== --- branches/proto_unicode/teraterm/teraterm/filesys_proto.h 2020-11-01 15:34:32 UTC (rev 8992) +++ branches/proto_unicode/teraterm/teraterm/filesys_proto.h 2020-11-01 15:34:47 UTC (rev 8993) @@ -38,7 +38,7 @@ int DirLen; int NumFname, FNCount; - HANDLE FnStrMemHandle; +// HANDLE FnStrMemHandle; PCHAR FnStrMem; int FnPtr; Modified: branches/proto_unicode/teraterm/ttpfile/ftlib.c =================================================================== --- branches/proto_unicode/teraterm/ttpfile/ftlib.c 2020-11-01 15:34:32 UTC (rev 8992) +++ branches/proto_unicode/teraterm/ttpfile/ftlib.c 2020-11-01 15:34:47 UTC (rev 8993) @@ -62,13 +62,13 @@ fv->FNCount++; if (fv->NumFname==1) return TRUE; - GlobalLock(fv->FnStrMemHandle); +// GlobalLock(fv->FnStrMemHandle); strncpy_s(&fv->FullName[fv->DirLen],sizeof(fv->FullName) - fv->DirLen, &fv->FnStrMem[fv->FnPtr],_TRUNCATE); fv->FnPtr = fv->FnPtr + strlen(&fv->FnStrMem[fv->FnPtr]) + 1; - GlobalUnlock(fv->FnStrMemHandle); +// GlobalUnlock(fv->FnStrMemHandle); return TRUE; }