Fix a typo & add some comments

This commit is contained in:
Don HO 2019-03-01 13:35:26 +01:00
parent c22f181d80
commit 94c4608cc1
5 changed files with 17 additions and 12 deletions

View File

@ -47,14 +47,14 @@ SecurityMode SecurityGard::_securityMode = sm_sha256;
SecurityGard::SecurityGard() SecurityGard::SecurityGard()
{ {
_scilexerSha256.push_back(TEXT("03c9177631d2b32de3d32c73a8841cf68fc2cb17f306825489dc3df98000db85")); // v3.5.6 32 bit _scilexerSha256.push_back(TEXT("03c9177631d2b32de3d32c73a8841cf68fc2cb17f306825489dc3df98000db85")); // v3.5.6 32 bit (signed)
_scilexerSha256.push_back(TEXT("9896c4089275e21412fd80421827912ebd80e357394b05145a613d190462e211")); // v3.5.6 64 bit _scilexerSha256.push_back(TEXT("9896c4089275e21412fd80421827912ebd80e357394b05145a613d190462e211")); // v3.5.6 64 bit (signed)
_gupSha256.push_back(TEXT("4c8191f511c2ad67148ef809b40c1108aaa074130547157c335a959404d8d6f6")); // v5.1 32 bit _gupSha256.push_back(TEXT("4c8191f511c2ad67148ef809b40c1108aaa074130547157c335a959404d8d6f6")); // v5.1 32 bit (signed)
_gupSha256.push_back(TEXT("268a65829e86d5c3d324eea79b51e59f0a7d07c69d3ba0f700c9cb3aa772566f")); // v5.1 64 bit _gupSha256.push_back(TEXT("268a65829e86d5c3d324eea79b51e59f0a7d07c69d3ba0f700c9cb3aa772566f")); // v5.1 64 bit (signed)
_pluginListSha256.push_back(TEXT("be9e251a30fd712fd2ff98febd360805df51110b6659de8c9a0000220d7ae535")); // v1.0.7 32 bit _pluginListSha256.push_back(TEXT("be9e251a30fd712fd2ff98febd360805df51110b6659de8c9a0000220d7ae535")); // v1.0.7 32 bit (unsigned)
_pluginListSha256.push_back(TEXT("3ecd7f9c56bcd659a4126c659eb69b354789c78574a82390749ac751ae539bc6")); // v1.0.7 64 bit _pluginListSha256.push_back(TEXT("3ecd7f9c56bcd659a4126c659eb69b354789c78574a82390749ac751ae539bc6")); // v1.0.7 64 bit (unsigned)
} }
bool SecurityGard::checkModule(std::wstring filePath, NppModule module2check) bool SecurityGard::checkModule(std::wstring filePath, NppModule module2check)
@ -70,7 +70,6 @@ bool SecurityGard::checkModule(std::wstring filePath, NppModule module2check)
bool SecurityGard::checkSha256(std::wstring filePath, NppModule module2check) bool SecurityGard::checkSha256(std::wstring filePath, NppModule module2check)
{ {
std::string content = getFileContent(filePath.c_str()); std::string content = getFileContent(filePath.c_str());
uint8_t sha2hash[32]; uint8_t sha2hash[32];
calc_sha_256(sha2hash, reinterpret_cast<const uint8_t*>(content.c_str()), content.length()); calc_sha_256(sha2hash, reinterpret_cast<const uint8_t*>(content.c_str()), content.length());
@ -89,9 +88,15 @@ bool SecurityGard::checkSha256(std::wstring filePath, NppModule module2check)
return false; return false;
for (auto i : *moduleSha256) for (auto i : *moduleSha256)
{
if (i == sha2hashStr) if (i == sha2hashStr)
{
//::MessageBox(NULL, filePath.c_str(), TEXT("OK"), MB_OK);
return true; return true;
}
}
//::MessageBox(NULL, filePath.c_str(), TEXT("KO"), MB_OK);
return false; return false;
} }

View File

@ -913,7 +913,7 @@ BEGIN
POPUP "Se&ttings" POPUP "Se&ttings"
BEGIN BEGIN
MENUITEM "Preferences...", IDM_SETTING_PREFERECE MENUITEM "Preferences...", IDM_SETTING_PREFERENCE
MENUITEM "Style Configurator...", IDM_LANGSTYLE_CONFIG_DLG MENUITEM "Style Configurator...", IDM_LANGSTYLE_CONFIG_DLG
MENUITEM "Shortcut Mapper...", IDM_SETTING_SHORTCUT_MAPPER MENUITEM "Shortcut Mapper...", IDM_SETTING_SHORTCUT_MAPPER
MENUITEM SEPARATOR MENUITEM SEPARATOR

View File

@ -497,7 +497,7 @@ void Notepad_plus::command(int id)
case IDM_EDIT_CHANGESEARCHENGINE: case IDM_EDIT_CHANGESEARCHENGINE:
{ {
command(IDM_SETTING_PREFERECE); command(IDM_SETTING_PREFERENCE);
_preference.showDialogByName(TEXT("SearchEngine")); _preference.showDialogByName(TEXT("SearchEngine"));
} }
break; break;
@ -2520,7 +2520,7 @@ void Notepad_plus::command(int id)
shortcutMapper.destroy(); shortcutMapper.destroy();
break; break;
} }
case IDM_SETTING_PREFERECE : case IDM_SETTING_PREFERENCE:
{ {
bool isFirstTime = !_preference.isCreated(); bool isFirstTime = !_preference.isCreated();
_preference.doDialog(_nativeLangSpeaker.isRTL()); _preference.doDialog(_nativeLangSpeaker.isRTL());

View File

@ -361,7 +361,7 @@ static const WinMenuKeyDefinition winKeyDefs[] =
{ VK_NULL, IDM_LANG_USER_DLG, false, false, false, nullptr }, { VK_NULL, IDM_LANG_USER_DLG, false, false, false, nullptr },
{ VK_NULL, IDM_LANG_USER, false, false, false, nullptr }, { VK_NULL, IDM_LANG_USER, false, false, false, nullptr },
{ VK_NULL, IDM_SETTING_PREFERECE, false, false, false, nullptr }, { VK_NULL, IDM_SETTING_PREFERENCE, false, false, false, nullptr },
{ VK_NULL, IDM_LANGSTYLE_CONFIG_DLG, false, false, false, nullptr }, { VK_NULL, IDM_LANGSTYLE_CONFIG_DLG, false, false, false, nullptr },
{ VK_NULL, IDM_SETTING_SHORTCUT_MAPPER, false, false, false, nullptr }, { VK_NULL, IDM_SETTING_SHORTCUT_MAPPER, false, false, false, nullptr },
{ VK_NULL, IDM_SETTING_IMPORTPLUGIN, false, false, false, nullptr }, { VK_NULL, IDM_SETTING_IMPORTPLUGIN, false, false, false, nullptr },

View File

@ -547,7 +547,7 @@
#define IDM_SETTING_TRAYICON (IDM_SETTING + 8) #define IDM_SETTING_TRAYICON (IDM_SETTING + 8)
#define IDM_SETTING_SHORTCUT_MAPPER (IDM_SETTING + 9) #define IDM_SETTING_SHORTCUT_MAPPER (IDM_SETTING + 9)
#define IDM_SETTING_REMEMBER_LAST_SESSION (IDM_SETTING + 10) #define IDM_SETTING_REMEMBER_LAST_SESSION (IDM_SETTING + 10)
#define IDM_SETTING_PREFERECE (IDM_SETTING + 11) #define IDM_SETTING_PREFERENCE (IDM_SETTING + 11)
#define IDM_SETTING_PLUGINADM (IDM_SETTING + 14) #define IDM_SETTING_PLUGINADM (IDM_SETTING + 14)
#define IDM_SETTING_OPENPLUGINSDIR (IDM_SETTING + 15) #define IDM_SETTING_OPENPLUGINSDIR (IDM_SETTING + 15)
#define IDM_SETTING_SHORTCUT_MAPPER_MACRO (IDM_SETTING + 16) #define IDM_SETTING_SHORTCUT_MAPPER_MACRO (IDM_SETTING + 16)