• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

FFFTPのソースコードです。


Commit MetaInfo

Revision732108b3e9b10886168500f6bd32e60da02e27db (tree)
Time2011-10-12 00:36:43
Authors_kawamoto <s_kawamoto@user...>
Commiters_kawamoto

Log Message

Change UI to enter a new master password.
Fix improper error handling of WinVerifyTrust.

Change Summary

Incremental Difference

--- a/FFFTP.vc90.vcproj
+++ b/FFFTP.vc90.vcproj
@@ -72,12 +72,12 @@
7272 <Tool
7373 Name="VCLinkerTool"
7474 AdditionalOptions="/MACHINE:I386"
75- AdditionalDependencies="comctl32.lib htmlhelp.lib imagehlp.lib rasapi32.lib sfc.lib winmm.lib wintrust.lib wsock32.lib"
75+ AdditionalDependencies="comctl32.lib crypt32.lib htmlhelp.lib imagehlp.lib rasapi32.lib sfc.lib winmm.lib wintrust.lib wsock32.lib"
7676 OutputFile=".\Debug\FFFTP.exe"
7777 LinkIncremental="2"
7878 SuppressStartupBanner="true"
7979 GenerateManifest="false"
80- DelayLoadDLLs="advapi32.dll;comctl32.dll;comdlg32.dll;gdi32.dll;imagehlp.dll;ole32.dll;sfc.dll;shell32.dll;user32.dll;winmm.dll;wintrust.dll;wsock32.dll"
80+ DelayLoadDLLs="advapi32.dll;comctl32.dll;crypt32.dll;comdlg32.dll;gdi32.dll;imagehlp.dll;ole32.dll;sfc.dll;shell32.dll;user32.dll;winmm.dll;wintrust.dll;wsock32.dll"
8181 GenerateDebugInformation="true"
8282 ProgramDatabaseFile=".\Debug\FFFTP.pdb"
8383 SubSystem="2"
@@ -165,12 +165,12 @@
165165 <Tool
166166 Name="VCLinkerTool"
167167 AdditionalOptions="/MACHINE:I386"
168- AdditionalDependencies="comctl32.lib htmlhelp.lib imagehlp.lib rasapi32.lib sfc.lib winmm.lib wintrust.lib wsock32.lib"
168+ AdditionalDependencies="comctl32.lib crypt32.lib htmlhelp.lib imagehlp.lib rasapi32.lib sfc.lib winmm.lib wintrust.lib wsock32.lib"
169169 OutputFile=".\Release\FFFTP.exe"
170170 LinkIncremental="1"
171171 SuppressStartupBanner="true"
172172 GenerateManifest="false"
173- DelayLoadDLLs="advapi32.dll;comctl32.dll;comdlg32.dll;gdi32.dll;sfc.dll;shell32.dll;ole32.dll;user32.dll;winmm.dll;wintrust.dll;wsock32.dll"
173+ DelayLoadDLLs="advapi32.dll;comctl32.dll;crypt32.dll;comdlg32.dll;gdi32.dll;sfc.dll;shell32.dll;ole32.dll;user32.dll;winmm.dll;wintrust.dll;wsock32.dll"
174174 ProgramDatabaseFile=".\Release\FFFTP.pdb"
175175 SubSystem="2"
176176 RandomizedBaseAddress="1"
--- a/FFFTP.vcproj
+++ b/FFFTP.vcproj
@@ -71,12 +71,12 @@
7171 <Tool
7272 Name="VCLinkerTool"
7373 AdditionalOptions="/MACHINE:I386"
74- AdditionalDependencies="comctl32.lib htmlhelp.lib imagehlp.lib rasapi32.lib sfc.lib winmm.lib wintrust.lib wsock32.lib"
74+ AdditionalDependencies="comctl32.lib crypt32.lib htmlhelp.lib imagehlp.lib rasapi32.lib sfc.lib winmm.lib wintrust.lib wsock32.lib"
7575 OutputFile=".\Debug\FFFTP.exe"
7676 LinkIncremental="2"
7777 SuppressStartupBanner="true"
7878 GenerateManifest="false"
79- DelayLoadDLLs="advapi32.dll;comctl32.dll;comdlg32.dll;gdi32.dll;sfc.dll;shell32.dll;ole32.dll;user32.dll;winmm.dll;wintrust.dll;wsock32.dll"
79+ DelayLoadDLLs="advapi32.dll;comctl32.dll;crypt32.dll;comdlg32.dll;gdi32.dll;sfc.dll;shell32.dll;ole32.dll;user32.dll;winmm.dll;wintrust.dll;wsock32.dll"
8080 GenerateDebugInformation="true"
8181 ProgramDatabaseFile=".\Debug\FFFTP.pdb"
8282 SubSystem="2"
@@ -165,12 +165,12 @@
165165 <Tool
166166 Name="VCLinkerTool"
167167 AdditionalOptions="/MACHINE:I386"
168- AdditionalDependencies="comctl32.lib htmlhelp.lib imagehlp.lib rasapi32.lib sfc.lib winmm.lib wintrust.lib wsock32.lib"
168+ AdditionalDependencies="comctl32.lib crypt32.lib htmlhelp.lib imagehlp.lib rasapi32.lib sfc.lib winmm.lib wintrust.lib wsock32.lib"
169169 OutputFile=".\Release\FFFTP.exe"
170170 LinkIncremental="1"
171171 SuppressStartupBanner="true"
172172 GenerateManifest="false"
173- DelayLoadDLLs="advapi32.dll;comctl32.dll;comdlg32.dll;gdi32.dll;sfc.dll;shell32.dll;ole32.dll;user32.dll;winmm.dll;wintrust.dll;wsock32.dll"
173+ DelayLoadDLLs="advapi32.dll;comctl32.dll;crypt32.dll;comdlg32.dll;gdi32.dll;sfc.dll;shell32.dll;ole32.dll;user32.dll;winmm.dll;wintrust.dll;wsock32.dll"
174174 ProgramDatabaseFile=".\Release\FFFTP.pdb"
175175 SubSystem="2"
176176 />
Binary files a/FFFTP_Eng_Release/FFFTP.exe and b/FFFTP_Eng_Release/FFFTP.exe differ
--- a/FFFTP_English.vc90.vcproj
+++ b/FFFTP_English.vc90.vcproj
@@ -73,12 +73,12 @@
7373 <Tool
7474 Name="VCLinkerTool"
7575 AdditionalOptions="/MACHINE:I386"
76- AdditionalDependencies="comctl32.lib htmlhelp.lib imagehlp.lib rasapi32.lib sfc.lib winmm.lib wintrust.lib wsock32.lib"
76+ AdditionalDependencies="comctl32.lib crypt32.lib htmlhelp.lib imagehlp.lib rasapi32.lib sfc.lib winmm.lib wintrust.lib wsock32.lib"
7777 OutputFile=".\FFFTP_Eng_Debug\FFFTP.exe"
7878 LinkIncremental="2"
7979 SuppressStartupBanner="true"
8080 GenerateManifest="false"
81- DelayLoadDLLs="advapi32.dll;comctl32.dll;comdlg32.dll;gdi32.dll;sfc.dll;shell32.dll;ole32.dll;user32.dll;winmm.dll;wintrust.dll;wsock32.dll"
81+ DelayLoadDLLs="advapi32.dll;comctl32.dll;crypt32.dll;comdlg32.dll;gdi32.dll;sfc.dll;shell32.dll;ole32.dll;user32.dll;winmm.dll;wintrust.dll;wsock32.dll"
8282 GenerateDebugInformation="true"
8383 ProgramDatabaseFile=".\FFFTP_Eng_Debug\FFFTP.pdb"
8484 SubSystem="2"
@@ -165,12 +165,12 @@
165165 <Tool
166166 Name="VCLinkerTool"
167167 AdditionalOptions="/MACHINE:I386"
168- AdditionalDependencies="comctl32.lib htmlhelp.lib imagehlp.lib rasapi32.lib sfc.lib winmm.lib wintrust.lib wsock32.lib"
168+ AdditionalDependencies="comctl32.lib crypt32.lib htmlhelp.lib imagehlp.lib rasapi32.lib sfc.lib winmm.lib wintrust.lib wsock32.lib"
169169 OutputFile=".\FFFTP_Eng_Release\FFFTP.exe"
170170 LinkIncremental="1"
171171 SuppressStartupBanner="true"
172172 GenerateManifest="false"
173- DelayLoadDLLs="advapi32.dll;comctl32.dll;comdlg32.dll;gdi32.dll;sfc.dll;shell32.dll;ole32.dll;user32.dll;winmm.dll;wintrust.dll;wsock32.dll"
173+ DelayLoadDLLs="advapi32.dll;comctl32.dll;crypt32.dll;comdlg32.dll;gdi32.dll;sfc.dll;shell32.dll;ole32.dll;user32.dll;winmm.dll;wintrust.dll;wsock32.dll"
174174 ProgramDatabaseFile=".\FFFTP_Eng_Release\FFFTP.pdb"
175175 SubSystem="2"
176176 RandomizedBaseAddress="1"
--- a/FFFTP_English.vcproj
+++ b/FFFTP_English.vcproj
@@ -72,12 +72,12 @@
7272 <Tool
7373 Name="VCLinkerTool"
7474 AdditionalOptions="/MACHINE:I386"
75- AdditionalDependencies="comctl32.lib htmlhelp.lib imagehlp.lib rasapi32.lib sfc.lib winmm.lib wintrust.lib wsock32.lib"
75+ AdditionalDependencies="comctl32.lib crypt32.lib htmlhelp.lib imagehlp.lib rasapi32.lib sfc.lib winmm.lib wintrust.lib wsock32.lib"
7676 OutputFile=".\FFFTP_Eng_Debug\FFFTP.exe"
7777 LinkIncremental="2"
7878 SuppressStartupBanner="true"
7979 GenerateManifest="false"
80- DelayLoadDLLs="advapi32.dll;comctl32.dll;comdlg32.dll;gdi32.dll;sfc.dll;shell32.dll;ole32.dll;user32.dll;winmm.dll;wintrust.dll;wsock32.dll"
80+ DelayLoadDLLs="advapi32.dll;comctl32.dll;crypt32.dll;comdlg32.dll;gdi32.dll;sfc.dll;shell32.dll;ole32.dll;user32.dll;winmm.dll;wintrust.dll;wsock32.dll"
8181 GenerateDebugInformation="true"
8282 ProgramDatabaseFile=".\FFFTP_Eng_Debug\FFFTP.pdb"
8383 SubSystem="2"
@@ -165,12 +165,12 @@
165165 <Tool
166166 Name="VCLinkerTool"
167167 AdditionalOptions="/MACHINE:I386"
168- AdditionalDependencies="comctl32.lib htmlhelp.lib imagehlp.lib rasapi32.lib sfc.lib winmm.lib wintrust.lib wsock32.lib"
168+ AdditionalDependencies="comctl32.lib crypt32.lib htmlhelp.lib imagehlp.lib rasapi32.lib sfc.lib winmm.lib wintrust.lib wsock32.lib"
169169 OutputFile=".\FFFTP_Eng_Release\FFFTP.exe"
170170 LinkIncremental="1"
171171 SuppressStartupBanner="true"
172172 GenerateManifest="false"
173- DelayLoadDLLs="advapi32.dll;comctl32.dll;comdlg32.dll;gdi32.dll;sfc.dll;shell32.dll;ole32.dll;user32.dll;winmm.dll;wintrust.dll;wsock32.dll"
173+ DelayLoadDLLs="advapi32.dll;comctl32.dll;crypt32.dll;comdlg32.dll;gdi32.dll;sfc.dll;shell32.dll;ole32.dll;user32.dll;winmm.dll;wintrust.dll;wsock32.dll"
174174 ProgramDatabaseFile=".\FFFTP_Eng_Release\FFFTP.pdb"
175175 SubSystem="2"
176176 />
Binary files a/Release/FFFTP.exe and b/Release/FFFTP.exe differ
--- a/Resource/FFFTP.rc
+++ b/Resource/FFFTP.rc
@@ -495,10 +495,10 @@ END
495495
496496 newmasterpasswd_dlg DIALOGEX 0, 0, 187, 43
497497 STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION
498-CAPTION "新しいマスターパスワードを入れてください"
498+CAPTION "新しいマスターパスワードを2回入れてください"
499499 FONT 9, "MS Pゴシック", 0, 0, 0x0
500500 BEGIN
501- EDITTEXT INP_INPSTR,7,7,173,12,ES_AUTOHSCROLL
501+ EDITTEXT INP_INPSTR,7,7,173,12,ES_PASSWORD | ES_AUTOHSCROLL
502502 DEFPUSHBUTTON "OK",IDOK,16,25,50,14
503503 PUSHBUTTON "キャンセル",IDCANCEL,68,25,50,14
504504 CONTROL "",INP_ANONYMOUS,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_DISABLED | WS_TABSTOP,172,31,8,8
--- a/Resource_eng/FFFTP-eng.rc
+++ b/Resource_eng/FFFTP-eng.rc
@@ -498,10 +498,10 @@ END
498498
499499 newmasterpasswd_dlg DIALOGEX 0, 0, 187, 43
500500 STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION
501-CAPTION "Enter new master password"
501+CAPTION "Enter new master password twice"
502502 FONT 9, "MS Sans Serif", 0, 0, 0x0
503503 BEGIN
504- EDITTEXT INP_INPSTR,7,7,173,12,ES_AUTOHSCROLL
504+ EDITTEXT INP_INPSTR,7,7,173,12,ES_PASSWORD | ES_AUTOHSCROLL
505505 DEFPUSHBUTTON "OK",IDOK,25,25,43,14
506506 PUSHBUTTON "Cancel",IDCANCEL,72,25,43,14
507507 CONTROL "",INP_ANONYMOUS,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_DISABLED | WS_TABSTOP,172,31,8,8
--- a/main.c
+++ b/main.c
@@ -499,7 +499,7 @@ static int InitApp(LPSTR lpszCmdLine, int cmdShow)
499499 DispWindowTitle();
500500 // SourceForge.JPによるフォーク
501501 // SetTaskMsg("FFFTP Ver." VER_STR " Copyright(C) 1997-2010 Sota & cooperators.");
502- SetTaskMsg("FFFTP Ver." VER_STR " Copyright(C) 1997-2010 Sota & cooperators.\r\nCopyright (C) 2011 Hiromichi Matsushima, Suguru Kawamoto.");
502+ SetTaskMsg("FFFTP Ver." VER_STR " Copyright(C) 1997-2010 Sota & cooperators.\r\nCopyright (C) 2011 FFFTP Project (Hiromichi Matsushima, Suguru Kawamoto).");
503503
504504 if(ForceIni)
505505 SetTaskMsg("%s%s", MSGJPN283, IniPath);
@@ -2767,12 +2767,29 @@ int AskAutoExit(void)
27672767 int EnterMasterPasswordAndSet( int Res, HWND hWnd )
27682768 {
27692769 char buf[MAX_PASSWORD_LEN + 1];
2770+ // パスワードの入力欄を非表示
2771+ // 非表示にしたため新しいパスワードを2回入力させる
2772+ char buf1[MAX_PASSWORD_LEN + 1];
27702773 char *p;
27712774 int Flag;
27722775
27732776 buf[0] = NUL;
27742777 if( InputDialogBox(Res, hWnd, NULL, buf, MAX_PASSWORD_LEN + 1,
27752778 &Flag, IDH_HELP_TOPIC_0000064) == YES){
2779+ // パスワードの入力欄を非表示
2780+ if(Res == newmasterpasswd_dlg)
2781+ {
2782+ buf1[0] = NUL;
2783+ if( InputDialogBox(Res, hWnd, NULL, buf1, MAX_PASSWORD_LEN + 1,
2784+ &Flag, IDH_HELP_TOPIC_0000064) != YES){
2785+ return 0;
2786+ }
2787+ if(strcmp(buf, buf1) != 0)
2788+ {
2789+ MessageBox(hWnd, MSGJPN325, "FFFTP", MB_OK | MB_ICONERROR);
2790+ return 0;
2791+ }
2792+ }
27762793 /* 末尾の空白を削除 */
27772794 RemoveTailingSpaces(buf);
27782795 /* 先頭の空白を削除 */
--- a/mesg-eng.h
+++ b/mesg-eng.h
@@ -322,3 +322,4 @@
322322 #define MSGJPN322 "Debugger was detected."
323323 #define MSGJPN323 "Failed to unload untrustworthy DLLs."
324324 #define MSGJPN324 "Failed to hook required functions to protect the process."
325+#define MSGJPN325 "New master passwords are not identical."
--- a/mesg-eng.old.h
+++ b/mesg-eng.old.h
@@ -322,3 +322,4 @@
322322 #define MSGJPN322 "Debugger was detected."
323323 #define MSGJPN323 "Failed to unload untrustworthy DLLs."
324324 #define MSGJPN324 "Failed to hook required functions to protect the process."
325+#define MSGJPN325 "New master passwords are not identical."
--- a/mesg-jpn.h
+++ b/mesg-jpn.h
@@ -322,3 +322,4 @@
322322 #define MSGJPN322 "\xE3\x83\x87\xE3\x83\x90\xE3\x83\x83\xE3\x82\xAC\xE3\x81\x8C\xE6\xA4\x9C\xE5\x87\xBA\xE3\x81\x95\xE3\x82\x8C\xE3\x81\xBE\xE3\x81\x97\xE3\x81\x9F."
323323 #define MSGJPN323 "\xE4\xBF\xA1\xE9\xA0\xBC\xE3\x81\xA7\xE3\x81\x8D\xE3\x81\xAA\xE3\x81\x84\x44LL\xE3\x82\x92\xE3\x82\xA2\xE3\x83\xB3\xE3\x83\xAD\xE3\x83\xBC\xE3\x83\x89\xE3\x81\xA7\xE3\x81\x8D\xE3\x81\xBE\xE3\x81\x9B\xE3\x82\x93\xE3\x81\xA7\xE3\x81\x97\xE3\x81\x9F."
324324 #define MSGJPN324 "\xE3\x83\x97\xE3\x83\xAD\xE3\x82\xBB\xE3\x82\xB9\xE3\x81\xAE\xE4\xBF\x9D\xE8\xAD\xB7\xE3\x81\xAB\xE5\xBF\x85\xE8\xA6\x81\xE3\x81\xAA\xE9\x96\xA2\xE6\x95\xB0\xE3\x82\x92\xE3\x83\x95\xE3\x83\x83\xE3\x82\xAF\xE3\x81\xA7\xE3\x81\x8D\xE3\x81\xBE\xE3\x81\x9B\xE3\x82\x93\xE3\x81\xA7\xE3\x81\x97\xE3\x81\x9F."
325+#define MSGJPN325 "\xE6\x96\xB0\xE3\x81\x97\xE3\x81\x84\xE3\x83\x9E\xE3\x82\xB9\xE3\x82\xBF\xE3\x83\xBC\xE3\x83\x91\xE3\x82\xB9\xE3\x83\xAF\xE3\x83\xBC\xE3\x83\x89\xE3\x81\x8C\xE4\xB8\x80\xE8\x87\xB4\xE3\x81\x97\xE3\x81\xBE\xE3\x81\x9B\xE3\x82\x93."
--- a/mesg-jpn.old.h
+++ b/mesg-jpn.old.h
@@ -322,3 +322,4 @@
322322 #define MSGJPN322 "デバッガが検出されました."
323323 #define MSGJPN323 "信頼できないDLLをアンロードできませんでした."
324324 #define MSGJPN324 "プロセスの保護に必要な関数をフックできませんでした."
325+#define MSGJPN325 "新しいマスターパスワードが一致しません."
--- a/protectprocess.c
+++ b/protectprocess.c
@@ -388,27 +388,69 @@ BOOL FindTrustedModuleSHA1Hash(void* pHash)
388388 // ファイルの署名を確認
389389 BOOL VerifyFileSignature(LPCWSTR Filename)
390390 {
391+// BOOL bResult;
392+// GUID g = WINTRUST_ACTION_GENERIC_VERIFY_V2;
393+// WINTRUST_FILE_INFO wfi;
394+// WINTRUST_DATA wd;
395+// LONG Error;
396+// bResult = FALSE;
397+// ZeroMemory(&wfi, sizeof(WINTRUST_FILE_INFO));
398+// wfi.cbStruct = sizeof(WINTRUST_FILE_INFO);
399+// wfi.pcwszFilePath = Filename;
400+// ZeroMemory(&wd, sizeof(WINTRUST_DATA));
401+// wd.cbStruct = sizeof(WINTRUST_DATA);
402+// wd.dwUIChoice = WTD_UI_NONE;
403+// wd.dwUnionChoice = WTD_CHOICE_FILE;
404+// wd.pFile = &wfi;
405+// Error = WinVerifyTrust((HWND)INVALID_HANDLE_VALUE, &g, &wd);
406+// if(Error == ERROR_SUCCESS)
407+// bResult = TRUE;
408+// else if((g_ProcessProtectionLevel & PROCESS_PROTECTION_EXPIRED) && Error == CERT_E_EXPIRED)
409+// bResult = TRUE;
410+// else if((g_ProcessProtectionLevel & PROCESS_PROTECTION_UNAUTHORIZED) && (Error == CERT_E_UNTRUSTEDROOT || Error == CERT_E_UNTRUSTEDCA))
411+// bResult = TRUE;
412+// return bResult;
391413 BOOL bResult;
392- GUID g = WINTRUST_ACTION_GENERIC_VERIFY_V2;
393- WINTRUST_FILE_INFO wfi;
394- WINTRUST_DATA wd;
395- LONG Error;
414+ HCERTSTORE hStore;
415+ PCCERT_CONTEXT pcc;
416+ CERT_CHAIN_PARA ccp;
417+ CERT_CHAIN_CONTEXT* pccc;
418+ CERT_CHAIN_POLICY_PARA ccpp;
419+ CERT_CHAIN_POLICY_STATUS ccps;
396420 bResult = FALSE;
397- ZeroMemory(&wfi, sizeof(WINTRUST_FILE_INFO));
398- wfi.cbStruct = sizeof(WINTRUST_FILE_INFO);
399- wfi.pcwszFilePath = Filename;
400- ZeroMemory(&wd, sizeof(WINTRUST_DATA));
401- wd.cbStruct = sizeof(WINTRUST_DATA);
402- wd.dwUIChoice = WTD_UI_NONE;
403- wd.dwUnionChoice = WTD_CHOICE_FILE;
404- wd.pFile = &wfi;
405- Error = WinVerifyTrust((HWND)INVALID_HANDLE_VALUE, &g, &wd);
406- if(Error == ERROR_SUCCESS)
407- bResult = TRUE;
408- else if((g_ProcessProtectionLevel & PROCESS_PROTECTION_EXPIRED) && Error == CERT_E_EXPIRED)
409- bResult = TRUE;
410- else if((g_ProcessProtectionLevel & PROCESS_PROTECTION_UNAUTHORIZED) && (Error == CERT_E_UNTRUSTEDROOT || Error == CERT_E_UNTRUSTEDCA))
411- bResult = TRUE;
421+ if(CryptQueryObject(CERT_QUERY_OBJECT_FILE, Filename, CERT_QUERY_CONTENT_FLAG_ALL, CERT_QUERY_FORMAT_FLAG_ALL, 0, NULL, NULL, NULL, &hStore, NULL, NULL))
422+ {
423+ pcc = NULL;
424+ while(!bResult && (pcc = CertEnumCertificatesInStore(hStore, pcc)))
425+ {
426+ ZeroMemory(&ccp, sizeof(CERT_CHAIN_PARA));
427+ ccp.cbSize = sizeof(CERT_CHAIN_PARA);
428+ if(CertGetCertificateChain(NULL, pcc, NULL, NULL, &ccp, 0, NULL, &pccc))
429+ {
430+ ZeroMemory(&ccpp, sizeof(CERT_CHAIN_POLICY_PARA));
431+ ccpp.cbSize = sizeof(CERT_CHAIN_POLICY_PARA);
432+ if(g_ProcessProtectionLevel & PROCESS_PROTECTION_EXPIRED)
433+ ccpp.dwFlags |= CERT_CHAIN_POLICY_IGNORE_NOT_TIME_VALID_FLAG;
434+ else if(g_ProcessProtectionLevel & PROCESS_PROTECTION_UNAUTHORIZED)
435+ ccpp.dwFlags |= CERT_CHAIN_POLICY_ALLOW_UNKNOWN_CA_FLAG;
436+ ZeroMemory(&ccps, sizeof(CERT_CHAIN_POLICY_STATUS));
437+ ccps.cbSize = sizeof(CERT_CHAIN_POLICY_STATUS);
438+ if(CertVerifyCertificateChainPolicy(CERT_CHAIN_POLICY_AUTHENTICODE, pccc, &ccpp, &ccps))
439+ {
440+ if(ccps.dwError == ERROR_SUCCESS)
441+ {
442+ bResult = TRUE;
443+ break;
444+ }
445+ }
446+ CertFreeCertificateChain(pccc);
447+ }
448+ }
449+ while(pcc = CertEnumCertificatesInStore(hStore, pcc))
450+ {
451+ }
452+ CertCloseStore(hStore, 0);
453+ }
412454 return bResult;
413455 }
414456
@@ -419,7 +461,6 @@ BOOL VerifyFileSignatureInCatalog(LPCWSTR Catalog, LPCWSTR Filename)
419461 GUID g = WINTRUST_ACTION_GENERIC_VERIFY_V2;
420462 WINTRUST_CATALOG_INFO wci;
421463 WINTRUST_DATA wd;
422- LONG Error;
423464 bResult = FALSE;
424465 if(VerifyFileSignature(Catalog))
425466 {
@@ -439,12 +480,7 @@ BOOL VerifyFileSignatureInCatalog(LPCWSTR Catalog, LPCWSTR Filename)
439480 wd.dwUIChoice = WTD_UI_NONE;
440481 wd.dwUnionChoice = WTD_CHOICE_CATALOG;
441482 wd.pCatalog = &wci;
442- Error = WinVerifyTrust((HWND)INVALID_HANDLE_VALUE, &g, &wd);
443- if(Error == ERROR_SUCCESS)
444- bResult = TRUE;
445- else if((g_ProcessProtectionLevel & PROCESS_PROTECTION_EXPIRED) && Error == CERT_E_EXPIRED)
446- bResult = TRUE;
447- else if((g_ProcessProtectionLevel & PROCESS_PROTECTION_UNAUTHORIZED) && (Error == CERT_E_UNTRUSTEDROOT || Error == CERT_E_UNTRUSTEDCA))
483+ if(WinVerifyTrust((HWND)INVALID_HANDLE_VALUE, &g, &wd) == ERROR_SUCCESS)
448484 bResult = TRUE;
449485 }
450486 free(wci.pbCalculatedFileHash);