Fix certificate checking error message issue

1. Fixed issue (caption and message are interchanged)
2. Disabled lexerdll signature checking in debug mode

Closes #3691, Fix #3688
This commit is contained in:
SinghRajenM 2017-09-02 18:32:54 +05:30 committed by Don HO
parent 97fce27cfe
commit 3cb8bc85a1
2 changed files with 7 additions and 2 deletions

View File

@ -228,7 +228,7 @@ bool VerifySignedLibrary(const wstring& filepath,
display_name = display_name_buffer.get();
} catch (wstring s) {
::MessageBox(NULL, TEXT("DLL signature verification failed"), s.c_str(), MB_ICONERROR);
::MessageBox(NULL, s.c_str(), TEXT("DLL signature verification failed"), MB_ICONERROR);
OutputDebugString(TEXT("VerifyLibrary: error while getting certificate informations\n"));
status = false;
} catch (...) {
@ -236,7 +236,7 @@ bool VerifySignedLibrary(const wstring& filepath,
OutputDebugString(TEXT("VerifyLibrary: error while getting certificate informations\n"));
wstring errMsg(TEXT("Unknown exception occured. "));
errMsg += GetLastErrorAsString(GetLastError());
::MessageBox(NULL, TEXT("DLL signature verification failed"), errMsg.c_str(), MB_ICONERROR);
::MessageBox(NULL, errMsg.c_str(), TEXT("DLL signature verification failed"), MB_ICONERROR);
status = false;
}

View File

@ -206,6 +206,10 @@ HMODULE loadSciLexerDll()
{
generic_string sciLexerPath = getSciLexerFullPathName(moduleFileName, 1024);
// Do not check dll signature if npp is running in debug mode
// This is helpful for developers to skip signature checking
// while analyzing issue or modifying the lexer dll
#ifndef _DEBUG
bool isOK = VerifySignedLibrary(sciLexerPath, SCINTILLA_SIGNER_KEY_ID, SCINTILLA_SIGNER_SUBJECT, SCINTILLA_SIGNER_DISPLAY_NAME, false, false);
if (!isOK)
@ -216,6 +220,7 @@ HMODULE loadSciLexerDll()
MB_OK | MB_ICONERROR);
return nullptr;
}
#endif // !_DEBUG
return ::LoadLibrary(sciLexerPath.c_str());
}