Leak Madness
Posted: Sat Feb 04, 2017 11:58 pm
Hi,
I've tried all I can think of to stop a Leak Report from popping up but no luck.
I narrowed it down to these two functions:
WinVerifyTrust
CryptQueryObject
I am going to use WinVerifyTrust because its simpler:
That gives me this Leak Report:
I've tried all I can think of to stop a Leak Report from popping up but no luck.
I narrowed it down to these two functions:
WinVerifyTrust
CryptQueryObject
I am going to use WinVerifyTrust because its simpler:
Code: Select all
class function TSigningCert.VerifyTrust(const Filename: string): Boolean;
var
file_info: TWinTrustFileInfo;
trust_data: TWinTrustData;
begin
FillChar(file_info, SizeOf(file_info), 0);
file_info.cbStruct := sizeof(file_info);
file_info.pcwszFilePath := PChar(Filename);
FillChar(trust_data, SizeOf(trust_data), 0);
trust_data.cbStruct := sizeof(trust_data);
trust_data.dwUIChoice := WTD_UI_NONE;
trust_data.fdwRevocationChecks := WTD_REVOKE_WHOLECHAIN;//instead of WTD_REVOKE_NONE
trust_data.dwProvFlags := WTD_REVOCATION_CHECK_CHAIN;
trust_data.dwUnionChoice := WTD_CHOICE_FILE;
trust_data.InfoUnion.pFile := @file_info;
If not WinVerifyTrust(INVALID_HANDLE_VALUE, WINTRUST_ACTION_GENERIC_VERIFY_V2, @trust_data) then Exit(False);
Result := True;
end;
I've even wrapped the whole thing in StopLeakChecking and it still comes up:allocation number: 5439
program up time: 4.04 s
type: Thread Handle
handle: $a9c
access rights: $1fffff
threadId: $1124
processId: $2748
process exe: D:\My Projects\DFX\Lib\Build_All\Win32\Build_All_Lib_Files.exe
main thread ($17fc):
671cd7f2 madExcept32.dll madExceptDbg 3805 CreateThreadCallback
004aca9b Build_All_Lib_Files.exe madExcept HookedCreateThread
75a2f0c8 wintrust.dll SoftpubLoadMessage
75a2de54 wintrust.dll WinVerifyTrust
00847c46 Build_All_Lib_Files.exe SigningCertifDfx 310 TSigningCert.VerifyTrust
00984cdd Build_All_Lib_Files.exe Build_All_Lib_Files 175 initialization
757062c2 KERNEL32.DLL BaseThreadInitThunk
Code: Select all
madExcept.StopLeakChecking(True);
{TSigningCert}
with TSigningCert.create(FileName, true) do
try
if VerifyTrust.Error then TDlg.Show('VerifyTrust Failed');
finally
Free;
end;
madExcept.StartLeakChecking(True);