From 3340277cdddcb4b3a8f5b9d39d81834b29f5e604 Mon Sep 17 00:00:00 2001 From: "METANEOCORTEX\\Kotti" Date: Thu, 2 Apr 2026 05:56:17 +0200 Subject: [PATCH] upd: migration to original grepWin tooling (remove home brew project) --- Notepad3.sln | 24 ------ minipath/src/Config.cpp | 4 +- src/Config/Config.cpp | 6 +- src/Dialogs.c | 168 ++++++++++++++++++++++++---------------- src/DynStrg.c | 1 - src/MuiLanguage.c | 85 +++++++++++++------- src/Notepad3.c | 6 +- 7 files changed, 172 insertions(+), 122 deletions(-) diff --git a/Notepad3.sln b/Notepad3.sln index d2f761699f..13ac42f230 100644 --- a/Notepad3.sln +++ b/Notepad3.sln @@ -9,8 +9,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{D32CB1 .nuget\NuGet.targets = .nuget\NuGet.targets EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grepWinNP3", "grepWinNP3\grepWinNP3.vcxproj", "{0049F8CF-1BEC-4E6E-B457-0187A33AD522}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Notepad3", "src\Notepad3.vcxproj", "{BAAD32AB-CD47-12FD-873C-0BBC204B7641}" ProjectSection(ProjectDependencies) = postProject {07C218D7-D510-4D63-95E8-F661F62ED418} = {07C218D7-D510-4D63-95E8-F661F62ED418} @@ -289,8 +287,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "np3_ja_jp", "language\np3_j {9DC82B0D-2484-4925-92AD-1237C64CCB78} = {9DC82B0D-2484-4925-92AD-1237C64CCB78} EndProjectSection EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "grepWinNP3", "grepWinNP3", "{0E679756-ECA4-4CAC-8799-1D2B9A294B3A}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "np3_pt_pt", "language\np3_pt_pt\np3_pt_pt.vcxproj", "{B7C9135A-C4AA-4A85-B361-B610B442B57C}" ProjectSection(ProjectDependencies) = postProject {9DC82B0D-2484-4925-92AD-1237C64CCB78} = {9DC82B0D-2484-4925-92AD-1237C64CCB78} @@ -385,25 +381,6 @@ Global Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {0049F8CF-1BEC-4E6E-B457-0187A33AD522}.Debug|ARM.ActiveCfg = Debug|Win32 - {0049F8CF-1BEC-4E6E-B457-0187A33AD522}.Debug|ARM64.ActiveCfg = Debug|Win32 - {0049F8CF-1BEC-4E6E-B457-0187A33AD522}.Debug|Win32.ActiveCfg = Debug|Win32 - {0049F8CF-1BEC-4E6E-B457-0187A33AD522}.Debug|Win32.Build.0 = Debug|Win32 - {0049F8CF-1BEC-4E6E-B457-0187A33AD522}.Debug|x64.ActiveCfg = Debug|x64 - {0049F8CF-1BEC-4E6E-B457-0187A33AD522}.Debug|x64.Build.0 = Debug|x64 - {0049F8CF-1BEC-4E6E-B457-0187A33AD522}.Release_AVX2|ARM.ActiveCfg = Release_AVX2|x64 - {0049F8CF-1BEC-4E6E-B457-0187A33AD522}.Release_AVX2|ARM.Build.0 = Release_AVX2|x64 - {0049F8CF-1BEC-4E6E-B457-0187A33AD522}.Release_AVX2|ARM64.ActiveCfg = Release_AVX2|Win32 - {0049F8CF-1BEC-4E6E-B457-0187A33AD522}.Release_AVX2|Win32.ActiveCfg = Release_AVX2|Win32 - {0049F8CF-1BEC-4E6E-B457-0187A33AD522}.Release_AVX2|Win32.Build.0 = Release_AVX2|Win32 - {0049F8CF-1BEC-4E6E-B457-0187A33AD522}.Release_AVX2|x64.ActiveCfg = Release_AVX2|x64 - {0049F8CF-1BEC-4E6E-B457-0187A33AD522}.Release_AVX2|x64.Build.0 = Release_AVX2|x64 - {0049F8CF-1BEC-4E6E-B457-0187A33AD522}.Release|ARM.ActiveCfg = Release|Win32 - {0049F8CF-1BEC-4E6E-B457-0187A33AD522}.Release|ARM64.ActiveCfg = Release|Win32 - {0049F8CF-1BEC-4E6E-B457-0187A33AD522}.Release|Win32.ActiveCfg = Release|Win32 - {0049F8CF-1BEC-4E6E-B457-0187A33AD522}.Release|Win32.Build.0 = Release|Win32 - {0049F8CF-1BEC-4E6E-B457-0187A33AD522}.Release|x64.ActiveCfg = Release|x64 - {0049F8CF-1BEC-4E6E-B457-0187A33AD522}.Release|x64.Build.0 = Release|x64 {BAAD32AB-CD47-12FD-873C-0BBC204B7641}.Debug|ARM.ActiveCfg = Debug|Win32 {BAAD32AB-CD47-12FD-873C-0BBC204B7641}.Debug|ARM64.ActiveCfg = Debug|Win32 {BAAD32AB-CD47-12FD-873C-0BBC204B7641}.Debug|Win32.ActiveCfg = Debug|Win32 @@ -1658,7 +1635,6 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {0049F8CF-1BEC-4E6E-B457-0187A33AD522} = {0E679756-ECA4-4CAC-8799-1D2B9A294B3A} {BAAD32AB-CD47-12FD-873C-0BBC204B7641} = {C3735E17-6EAE-4CC5-980E-30BCEF094862} {781B17E7-427F-488F-A8E9-360BA38A10F3} = {D21C1F85-6FA3-4695-82CD-DDC5690E2D66} {146D0122-33C6-4C1B-9E7A-178DEC80842E} = {8C28F8E6-5B4E-4233-B5C7-5A903596AEB2} diff --git a/minipath/src/Config.cpp b/minipath/src/Config.cpp index 88b5fa9b1a..19405e62ba 100644 --- a/minipath/src/Config.cpp +++ b/minipath/src/Config.cpp @@ -747,7 +747,9 @@ int CheckIniFile(LPWSTR lpszFile, LPCWSTR lpszModule) if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_RoamingAppData, 0, nullptr, &pszPath))) { StringCchCopy(tchBuild, COUNTOF(tchBuild), pszPath); CoTaskMemFree(pszPath); - if (SUCCEEDED(PathCchAppend(tchBuild, COUNTOF(tchBuild), tchFileExpanded))) { + if (SUCCEEDED(PathCchAppend(tchBuild, COUNTOF(tchBuild), L"Rizonesoft")) && + SUCCEEDED(PathCchAppend(tchBuild, COUNTOF(tchBuild), L"Notepad3")) && + SUCCEEDED(PathCchAppend(tchBuild, COUNTOF(tchBuild), tchFileExpanded))) { if (PathIsExistingFile(tchBuild)) { StringCchCopy(lpszFile, MAX_PATH, tchBuild); return 1; diff --git a/src/Config/Config.cpp b/src/Config/Config.cpp index 45dc52f9ef..31b5909bb9 100644 --- a/src/Config/Config.cpp +++ b/src/Config/Config.cpp @@ -940,6 +940,8 @@ static bool _CheckAndSetIniFile(HPATHL hpth_in_out) // Application Data (%APPDATA%) HPATHL happdata = Path_Allocate(NULL); if (Path_GetKnownFolder(FOLDERID_RoamingAppData, happdata)) { + Path_Append(happdata, L"Rizonesoft"); + Path_Append(happdata, L"Notepad3"); Path_Append(happdata, wchMore); result = Path_IsExistingFile(happdata); if (result) { @@ -1614,7 +1616,7 @@ void LoadSettings() Defaults.EFR_Data.bHideNonMatchedLines = false; Settings.EFR_Data.bHideNonMatchedLines = IniSectionGetBool(IniSecSettings, L"HideNonMatchedLines", Defaults.EFR_Data.bHideNonMatchedLines); Defaults.EFR_Data.fuFlags = 0; - Settings.EFR_Data.fuFlags = (UINT)IniSectionGetInt(IniSecSettings, L"efrData_fuFlags", (int)Defaults.EFR_Data.fuFlags); + Settings.EFR_Data.fuFlags = (UINT)IniSectionGetLong(IniSecSettings, L"efrData_fuFlags", (long)Defaults.EFR_Data.fuFlags); if (Path_GetKnownFolder(FOLDERID_Desktop, Defaults.OpenWithDir)) { LPWSTR const wchOpenWithDir = Path_WriteAccessBuf(Settings.OpenWithDir, PATHLONG_MAX_CCH); @@ -2096,7 +2098,7 @@ static bool _SaveSettings(bool bForceSaveSettings) IniSectionDelete(IniSecSettings, L"HideNonMatchedLines", false); } if (Settings.EFR_Data.fuFlags != Defaults.EFR_Data.fuFlags) { - IniSectionSetInt(IniSecSettings, L"efrData_fuFlags", Settings.EFR_Data.fuFlags); + IniSectionSetLong(IniSecSettings, L"efrData_fuFlags", Settings.EFR_Data.fuFlags); } else { IniSectionDelete(IniSecSettings, L"efrData_fuFlags", false); } diff --git a/src/Dialogs.c b/src/Dialogs.c index 83f6b2040c..f0d7adc933 100644 --- a/src/Dialogs.c +++ b/src/Dialogs.c @@ -4971,7 +4971,6 @@ static grepWin_t grepWinIniSettings[] = { { L"onlyone", L"1" }, { L"AllSize", L"0" }, { L"Size", L"2000" }, - { L"CaseSensitive", L"0" }, { L"CreateBackup", L"1" }, { L"DateLimit", L"0" }, { L"IncludeBinary", L"0" }, @@ -4979,7 +4978,6 @@ static grepWin_t grepWinIniSettings[] = { { L"IncludeSubfolders", L"1" }, { L"IncludeSystem", L"1" }, { L"UseFileMatchRegex", L"0" }, - { L"UseRegex", L"0" }, { L"UTF8", L"1" } }; @@ -4990,16 +4988,10 @@ static grepWin_t grepWinIniSettings[] = { // void DialogGrepWin(HWND hwnd, LPCWSTR searchPattern) { - HPATHL hGrepWinIniPath = Path_Copy(Paths.IniFile); // side-by-side - Path_CanonicalizeEx(hGrepWinIniPath, Paths.ModuleDirectory); - HPATHL hExeFilePath = Path_Allocate(Path_Get(Settings2.GrepWinPath)); - Path_CanonicalizeEx(hExeFilePath, Paths.ModuleDirectory); wchar_t* const exe_pth_buf = Path_WriteAccessBuf(hExeFilePath, PATHLONG_MAX_CCH); - - HSTRINGW hstrOptions = StrgCreate(NULL); + HSTRINGW hstrOptions = StrgCreate(L""); wchar_t* const options_buf = StrgWriteAccessBuf(hstrOptions, PATHLONG_MAX_CCH); - // find grepWin executable if (Path_IsNotEmpty(hExeFilePath)) { ExtractFirstArgument(Path_Get(Settings2.GrepWinPath), exe_pth_buf, options_buf, PATHLONG_MAX_CCH); @@ -5007,28 +4999,40 @@ void DialogGrepWin(HWND hwnd, LPCWSTR searchPattern) Path_Sanitize(hExeFilePath); } if (Path_IsEmpty(hExeFilePath)) { - Path_Reset(hExeFilePath, Constants.FileSearchGrepWin); - Path_CanonicalizeEx(hExeFilePath, Paths.ModuleDirectory); - } - if (Path_IsRelative(hExeFilePath)) { - Path_AbsoluteFromApp(hExeFilePath, false); + // 1st: side-by-side in module directory + Path_Reset(hExeFilePath, Path_Get(Paths.ModuleDirectory)); + Path_Append(hExeFilePath, L"grepWin"); // subdir + Path_Append(hExeFilePath, Constants.FileSearchGrepWin); + } + if (!Path_IsExistingFile(hExeFilePath)) { + // 2nd: %APPDATA%\Rizonesoft\Notepad3\grepWin\ + HPATHL happdata = Path_Allocate(NULL); + if (Path_GetKnownFolder(&FOLDERID_RoamingAppData, happdata)) { + Path_Append(happdata, L"Rizonesoft"); + Path_Append(happdata, L"Notepad3"); + Path_Append(happdata, L"grepWin"); + Path_Append(happdata, Constants.FileSearchGrepWin); + if (Path_IsExistingFile(happdata)) { + Path_Swap(hExeFilePath, happdata); + } + } + Path_Release(happdata); } - // working (grepWinNP3.ini) directory - HPATHL hTemp = Path_Allocate(NULL); + // working (grepwin.ini) directory HPATHL hGrepWinDir = Path_Allocate(Path_Get(hExeFilePath)); Path_RemoveFileSpec(hGrepWinDir); + HPATHL hGrepWinIniPath = Path_Copy(hExeFilePath); // side-by-side + + const WCHAR* const commandsSection = L"commands"; + if (Path_IsExistingFile(hExeFilePath)) { // path to grepWin INI-File - if (Path_IsEmpty(hGrepWinIniPath)) { - Path_Reset(hGrepWinIniPath, Path_Get(Paths.IniFileDefault)); - Path_CanonicalizeEx(hGrepWinIniPath, Paths.ModuleDirectory); - } Path_RemoveFileSpec(hGrepWinIniPath); - LPCWSTR const wchIniFileName = L"grepWinNP3.ini"; + LPCWSTR const wchIniFileName = L"grepwin.ini"; Path_Append(hGrepWinIniPath, wchIniFileName); if (Path_IsRelative(hGrepWinIniPath)) { Path_Reset(hGrepWinIniPath, Path_Get(hGrepWinDir)); @@ -5039,10 +5043,12 @@ void DialogGrepWin(HWND hwnd, LPCWSTR searchPattern) ResetIniFileCache(); if (CreateIniFile(hGrepWinIniPath, NULL) && LoadIniFileCache(hGrepWinIniPath)) { + // ================================================================= // preserve [global] user settings from last call + // ================================================================= const WCHAR* const globalSection = L"global"; - WCHAR value[HUGE_BUFFER]; + WCHAR value[LARGE_BUFFER]; for (int i = 0; i < COUNTOF(grepWinIniSettings); ++i) { IniSectionGetString(globalSection, grepWinIniSettings[i].key, grepWinIniSettings[i].val, value, COUNTOF(value)); IniSectionSetString(globalSection, grepWinIniSettings[i].key, value); @@ -5059,53 +5065,75 @@ void DialogGrepWin(HWND hwnd, LPCWSTR searchPattern) HPATHL hLngFilePath = Path_Allocate(NULL); LPWSTR wchLngPathBuf = Path_WriteAccessBuf(hLngFilePath, PATHLONG_MAX_CCH); + const WCHAR* const langFile = L"languagefile"; if (lngIdx >= 0) { - IniSectionGetString(globalSection, L"languagefile", grepWinLangResName[lngIdx].filename, wchLngPathBuf, Path_GetBufCount(hLngFilePath)); - IniSectionSetString(globalSection, L"languagefile", wchLngPathBuf); + IniSectionGetString(globalSection, langFile, grepWinLangResName[lngIdx].filename, wchLngPathBuf, Path_GetBufCount(hLngFilePath)); Path_Sanitize(hLngFilePath); + if (Path_IsEmpty(hLngFilePath)) { + IniSectionDelete(globalSection, langFile, false); + } + else { + Path_CanonicalizeEx(hLngFilePath, hGrepWinDir); + wchLngPathBuf = Path_WriteAccessBuf(hLngFilePath, PATHLONG_MAX_CCH); + IniSectionSetString(globalSection, langFile, wchLngPathBuf); + } } else { - IniSectionGetString(globalSection, L"languagefile", L"", wchLngPathBuf, Path_GetBufCount(hLngFilePath)); + IniSectionGetString(globalSection, langFile, L"", wchLngPathBuf, Path_GetBufCount(hLngFilePath)); Path_Sanitize(hLngFilePath); if (Path_IsEmpty(hLngFilePath)) { - IniSectionDelete(globalSection, L"languagefile", false); + IniSectionDelete(globalSection, langFile, false); } } - bool const bDarkMode = UseDarkMode(); // <- override usr ~ IniSectionGetBool(globalSection, L"darkmode", UseDarkMode()); - IniSectionSetBool(globalSection, L"darkmode", bDarkMode); + IniSectionSetInt(globalSection, L"darkmode", UseDarkMode() ? 1 : 0); + + int const iCaseSens = IniSectionGetInt(globalSection, L"CaseSensitive", ((Settings.EFR_Data.fuFlags & SCFIND_MATCHCASE) != 0) ? 1 : 0); + IniSectionSetInt(globalSection, L"CaseSensitive", iCaseSens); + int const iWholeWord = IniSectionGetInt(globalSection, L"WholeWords", ((Settings.EFR_Data.fuFlags & SCFIND_WHOLEWORD) != 0) ? 1 : 0); + IniSectionSetInt(globalSection, L"WholeWords", iWholeWord); + int const iUseRegex = IniSectionGetInt(globalSection, L"UseRegex", Settings.EFR_Data.bRegExprSearch ? 1 : 0); + IniSectionSetInt(globalSection, L"UseRegex", iUseRegex); + int const idotMLn = IniSectionGetInt(globalSection, L"DotMatchesNewline", ((Settings.EFR_Data.fuFlags & SCFIND_DOT_MATCH_ALL) != 0) ? (Settings.EFR_Data.bRegExprSearch) : 0); + IniSectionSetInt(globalSection, L"DotMatchesNewline", idotMLn); // Notepad3 path (for grepWin's EditorCmd) HPATHL hpath_np3 = Path_Allocate(NULL); Path_GetModuleFilePath(hpath_np3); - StringCchPrintf(wchLngPathBuf, Path_GetBufCount(hLngFilePath), L"%s /%%mode%% \"%%pattern%%\" /g %%line%% - %%path%%", Path_Get(hpath_np3)); - IniSectionSetString(globalSection, L"editorcmd", wchLngPathBuf); + StringCchPrintf(value, COUNTOF(value), L"%s /g %%line%% - %%path%%", Path_Get(hpath_np3)); + IniSectionSetString(globalSection, L"editorcmd", value); Path_Release(hpath_np3); Path_Release(hLngFilePath); - long const iOpacity = IniSectionGetLong(globalSection, L"OpacityNoFocus", Settings2.FindReplaceOpacityLevel); - IniSectionSetLong(globalSection, L"OpacityNoFocus", iOpacity); - + // ================================================================= // [settings] - const WCHAR *const settingsSection = L"settings"; + // ================================================================= + const WCHAR* const settingsSection = L"settings"; - bool const bEscClose = IniSectionGetBool(settingsSection, L"escclose", (Settings.EscFunction == 2)); - IniSectionSetBool(settingsSection, L"escclose", bEscClose); - bool const bBackupInFolder = IniSectionGetBool(settingsSection, L"backupinfolder", true); - IniSectionSetBool(settingsSection, L"backupinfolder", bBackupInFolder); + int const iEscClose = IniSectionGetInt(settingsSection, L"escclose", (Settings.EscFunction == 2) ? 1 : 0); + IniSectionSetInt(settingsSection, L"escclose", iEscClose); + int const iBackupInFolder = IniSectionGetInt(settingsSection, L"backupinfolder", 1); + IniSectionSetInt(settingsSection, L"backupinfolder", iBackupInFolder); + // ================================================================= // [export] - const WCHAR *const exportSection = L"export"; - bool const bExpPaths = IniSectionGetBool(exportSection, L"paths", true); - IniSectionSetBool(exportSection, L"paths", bExpPaths); - bool const bExpLnNums = IniSectionGetBool(exportSection, L"linenumbers", true); - IniSectionSetBool(exportSection, L"linenumbers", bExpLnNums); - bool const bExpContent = IniSectionGetBool(exportSection, L"linecontent", true); - IniSectionSetBool(exportSection, L"linecontent", bExpContent); + // ================================================================= + const WCHAR* const exportSection = L"export"; + int const iExpPaths = IniSectionGetInt(exportSection, L"paths", 1); + IniSectionSetInt(exportSection, L"paths", iExpPaths); + int const iExpLnNums = IniSectionGetInt(exportSection, L"linenumbers", 1); + IniSectionSetInt(exportSection, L"linenumbers", iExpLnNums); + int const iExpContent = IniSectionGetInt(exportSection, L"linecontent", 1); + IniSectionSetInt(exportSection, L"linecontent", iExpContent); + + // ================================================================= + // [commands] + // ================================================================= + // see above: const WCHAR* const commandsSection = L"commands"; // search directory HPATHL pthSearchDir = NULL; @@ -5116,11 +5144,19 @@ void DialogGrepWin(HWND hwnd, LPCWSTR searchPattern) else { pthSearchDir = Path_Copy(Paths.WorkingDirectory); } - IniSectionSetString(globalSection, L"searchpath", Path_Get(pthSearchDir)); + IniSectionSetString(commandsSection, L"searchpath", Path_Get(pthSearchDir)); Path_Release(pthSearchDir); // search pattern - IniSectionSetString(globalSection, L"searchfor", searchPattern); + if (StrIsNotEmpty(searchPattern)) + IniSectionSetString(commandsSection, L"searchfor", searchPattern); + else { + IniSectionSetString(commandsSection, L"searchfor", StrgGet(Settings.EFR_Data.chFindPattern)); + IniSectionSetString(commandsSection, L"replacewith", StrgGet(Settings.EFR_Data.chReplaceTemplate)); + } + + int const iRegex = IniSectionGetInt(commandsSection, L"regex", Settings.EFR_Data.bRegExprSearch ? 1 : 0); + IniSectionSetInt(commandsSection, L"regex", iRegex); SaveIniFileCache(hGrepWinIniPath); ResetIniFileCache(); @@ -5128,36 +5164,36 @@ void DialogGrepWin(HWND hwnd, LPCWSTR searchPattern) } // grepWin arguments - HSTRINGW hstrParams = StrgCreate(NULL); + HSTRINGW hstrParams = StrgCreate(L""); if (Path_IsExistingFile(hGrepWinIniPath)) { - StrgFormat(hstrParams, L"/portable /content %s /inipath:\"%s\"", StrgGet(hstrOptions), Path_Get(hGrepWinIniPath)); + StrgFormat(hstrParams, L"/portable /content %s /searchini:\"%s\" /name:\"%s\"", + StrgGet(hstrOptions), Path_Get(hGrepWinIniPath), commandsSection); } else { StrgFormat(hstrParams, L"/portable /content %s", StrgGet(hstrOptions)); } - //if (StrIsNotEmpty(searchPattern)) { - // SetClipboardText(Globals.hwndMain, searchPattern, StringCchLen(searchPattern, 0)); - //} - StrgDestroy(hstrOptions); - - SHELLEXECUTEINFO sei = { sizeof(SHELLEXECUTEINFO) }; - sei.fMask = SEE_MASK_FLAG_NO_UI | SEE_MASK_NOZONECHECKS; - sei.hwnd = hwnd; - sei.lpVerb = NULL; - sei.lpFile = Path_Get(hExeFilePath); - sei.lpParameters = StrgGet(hstrParams); - sei.lpDirectory = Path_Get(hGrepWinDir); - sei.nShow = SW_SHOWNORMAL; - ShellExecuteExW(&sei); - if ((INT_PTR)sei.hInstApp < 32) { + if (!Path_IsExistingFile(hExeFilePath)) { InfoBoxLng(MB_ICONWARNING, NULL, IDS_MUI_ERR_GREPWIN); } + else { + SHELLEXECUTEINFO sei = { sizeof(SHELLEXECUTEINFO) }; + sei.fMask = SEE_MASK_FLAG_NO_UI | SEE_MASK_NOZONECHECKS; + sei.hwnd = hwnd; + sei.lpVerb = NULL; + sei.lpFile = Path_Get(hExeFilePath); + sei.lpParameters = StrgGet(hstrParams); + sei.lpDirectory = Path_Get(hGrepWinDir); + sei.nShow = SW_SHOWNORMAL; + if (!ShellExecuteExW(&sei) || (INT_PTR)sei.hInstApp < 32) { + InfoBoxLng(MB_ICONWARNING, NULL, IDS_MUI_ERR_GREPWIN); + } + } + StrgDestroy(hstrOptions); StrgDestroy(hstrParams); Path_Release(hGrepWinIniPath); Path_Release(hGrepWinDir); - Path_Release(hTemp); Path_Release(hExeFilePath); } @@ -5484,7 +5520,7 @@ int ComboBox_GetTextHW(HWND hDlg, int nIDDlgItem, HSTRINGW hstr) int ComboBox_GetTextW2MB(HWND hDlg, int nIDDlgItem, LPSTR lpString, size_t cch) { - HSTRINGW hstr = StrgCreate(NULL); + HSTRINGW hstr = StrgCreate(L""); ComboBox_GetTextHW(hDlg, nIDDlgItem, hstr); int const len = StrgGetAsUTF8(hstr, lpString, (int)cch); StrgDestroy(hstr); diff --git a/src/DynStrg.c b/src/DynStrg.c index 003deb8428..9efe5defd4 100644 --- a/src/DynStrg.c +++ b/src/DynStrg.c @@ -450,7 +450,6 @@ void STRAPI StrgDestroy(HSTRINGW hstr) if (!pstr) return; FreeBufferW(pstr); - FreeBuffer((LPWSTR)pstr); } // ---------------------------------------------------------------------------- diff --git a/src/MuiLanguage.c b/src/MuiLanguage.c index f8a78a7e02..7b30839609 100644 --- a/src/MuiLanguage.c +++ b/src/MuiLanguage.c @@ -54,40 +54,71 @@ LANGID GetLangIdByLocaleName(LPCWSTR pLocaleName) { //============================================================================= //============================================================================= - grepWinLng_t grepWinLangResName[] = { - { L"en-US", L".\\lng\\gwLng\\English (United States) [en-US].lang" }, - { L"af-ZA", L".\\lng\\gwLng\\Afrikaans (Suid-Afrika) [af-ZA].lang" }, - { L"be-BY", L".\\lng\\gwLng\\Беларуская (Беларусь) [be-BY].lang" }, - { L"de-DE", L".\\lng\\gwLng\\Deutsch (Deutschland) [de-DE].lang" }, - { L"el-GR", L".\\lng\\gwLng\\Ελληνικά (Ελλάδα) [el-GR].lang" }, - { L"en-GB", L".\\lng\\gwLng\\English (United Kingdom) [en-GB].lang" }, - { L"es-ES", L".\\lng\\gwLng\\Español (España) [es-ES].lang" }, - { L"fi-FI", L".\\lng\\gwLng\\suomi (Suomi) [fi-FI].lang" }, - { L"fr-FR", L".\\lng\\gwLng\\Français (France) [fr-FR].lang" }, - { L"hi-IN", L".\\lng\\gwLng\\हिन्दी (भारत) [hi-IN].lang" }, - { L"hu-HU", L".\\lng\\gwLng\\Magyar (Magyarország) [hu-HU].lang" }, - { L"id-ID", L".\\lng\\gwLng\\Bahasa Indonesia (Indonesia) [id-ID].lang" }, - { L"it-IT", L".\\lng\\gwLng\\Italiano (Italia) [it-IT].lang" }, - { L"ja-JP", L".\\lng\\gwLng\\日本語 (日本) [ja-JP].lang" }, - { L"ko-KR", L".\\lng\\gwLng\\한국어 (대한민국) [ko-KR].lang" }, - { L"nl-NL", L".\\lng\\gwLng\\Nederlands (Nederland) [nl-NL].lang" }, - { L"pl-PL", L".\\lng\\gwLng\\Polski (Polska) [pl-PL].lang" }, - { L"pt-BR", L".\\lng\\gwLng\\Português Brasileiro (Brasil) [pt-BR].lang" }, - { L"pt-PT", L".\\lng\\gwLng\\Português (Portugal) [pt-PT].lang" }, - { L"ru-RU", L".\\lng\\gwLng\\Русский (Pоссия) [ru-RU].lang" }, - { L"sk-SK", L".\\lng\\gwLng\\Slovenčina (Slovensko) [sk-SK].lang" }, - { L"sv-SE", L".\\lng\\gwLng\\Svenska (Sverige) [sv-SE].lang" }, - { L"tr-TR", L".\\lng\\gwLng\\Türkçe (Türkiye) [tr-TR].lang" }, - { L"vi-VN", L".\\lng\\gwLng\\Tiếng Việt (Việt Nam) [vi-VN].lang" }, - { L"zh-CN", L".\\lng\\gwLng\\简体中文 (中国大陆) [zh-CN].lang" }, - { L"zh-TW", L".\\lng\\gwLng\\正體中文 (中國台灣) [zh-TW].lang" } + { L"en-US", L"" }, + { L"en-GB", L"" }, + { L"af-ZA", L"Afrikaans.lang" }, + { L"be-BY", L"Belarusian.lang" }, + { L"de-DE", L"German.lang" }, + { L"el-GR", L"Greek.lang" }, + { L"es-ES", L"Spanish.lang" }, + { L"es-MX", L"Spanish Mexican.lang" }, + { L"fi-FI", L"" }, + { L"fr-FR", L"French.lang" }, + { L"hi-IN", L"Hindi.lang" }, + { L"hu-HU", L"Hungarian.lang" }, + { L"id-ID", L"" }, + { L"it-IT", L"Italian.lang" }, + { L"ja-JP", L"Japanese.lang" }, + { L"ko-KR", L"Korean.lang" }, + { L"nl-NL", L"Dutch.lang" }, + { L"pl-PL", L"Polish.lang" }, + { L"pt-BR", L"Portuguese Brazilian.lang" }, + { L"pt-PT", L"Portuguese.lang" }, + { L"ru-RU", L"Russian.lang" }, + { L"sk-SK", L"Slovak.lang" }, + { L"sv-SE", L"Swedish.lang" }, + { L"ta-IN", L"Tamil.lang" }, + { L"tr-TR", L"Turkish.lang" }, + { L"vi-VN", L"" }, + { L"zh-CN", L"Chinese Simplified.lang" }, + { L"zh-TW", L"Chinese Traditional.lang" } }; unsigned grepWinLang_CountOf() { return COUNTOF(grepWinLangResName); }; +#if 0 +grepWinLng_t grepWinLangResName[] = { + { L"en-US", L"English (United States) [en-US].lang" }, + { L"af-ZA", L"Afrikaans (Suid-Afrika) [af-ZA].lang" }, + { L"be-BY", L"Беларуская (Беларусь) [be-BY].lang" }, + { L"de-DE", L"Deutsch (Deutschland) [de-DE].lang" }, + { L"el-GR", L"Ελληνικά (Ελλάδα) [el-GR].lang" }, + { L"en-GB", L"English (United Kingdom) [en-GB].lang" }, + { L"es-ES", L"Español (España) [es-ES].lang" }, + { L"fi-FI", L"suomi (Suomi) [fi-FI].lang" }, + { L"fr-FR", L"Français (France) [fr-FR].lang" }, + { L"hi-IN", L"हिन्दी (भारत) [hi-IN].lang" }, + { L"hu-HU", L"Magyar (Magyarország) [hu-HU].lang" }, + { L"id-ID", L"Bahasa Indonesia (Indonesia) [id-ID].lang" }, + { L"it-IT", L"Italiano (Italia) [it-IT].lang" }, + { L"ja-JP", L"日本語 (日本) [ja-JP].lang" }, + { L"ko-KR", L"한국어 (대한민국) [ko-KR].lang" }, + { L"nl-NL", L"Nederlands (Nederland) [nl-NL].lang" }, + { L"pl-PL", L"Polski (Polska) [pl-PL].lang" }, + { L"pt-BR", L"Português Brasileiro (Brasil) [pt-BR].lang" }, + { L"pt-PT", L"Português (Portugal) [pt-PT].lang" }, + { L"ru-RU", L"Русский (Pоссия) [ru-RU].lang" }, + { L"sk-SK", L"Slovenčina (Slovensko) [sk-SK].lang" }, + { L"sv-SE", L"Svenska (Sverige) [sv-SE].lang" }, + { L"tr-TR", L"Türkçe (Türkiye) [tr-TR].lang" }, + { L"vi-VN", L"Tiếng Việt (Việt Nam) [vi-VN].lang" }, + { L"zh-CN", L"简体中文 (中国大陆) [zh-CN].lang" }, + { L"zh-TW", L"正體中文 (中國台灣) [zh-TW].lang" } +}; +#endif //============================================================================= // diff --git a/src/Notepad3.c b/src/Notepad3.c index 63c0d229c8..47492f8b7a 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -81,7 +81,11 @@ LPCWSTR WordBookMarks[MARKER_NP3_BOOKMARK] = { CONSTANTS_T const Constants = { 2 // StdDefaultLexerID , L"minipath.exe" // FileBrowserMiniPath - , L"grepWinNP3.exe" // FileSearchGrepWin +#ifdef _WIN64 + , L"grepWin-64.exe" // FileSearchGrepWin +#else + , L"grepWin-32.exe" // FileSearchGrepWin +#endif , L"Settings" // Inifile Section "Settings" , L"Settings2" // Inifile Section "Settings2" , L"Window" // Inifile Section "Window"