The dwinshs.iss
uses the WinInet API. With this API, to ignore the unknown CA error, you have to call the InternetSetOption
function.
That's somewhat complicated as it takes a pointer to integer with the security flags as its argument. Inno Setup does not support pointers to integers. But it supports pointers to structures (as you have commented). So you can wrap the integer to a structure.
You need to declare an alternative name for the InternetSetOption
that takes the structure instead of the string (again as the Inno Setup does not support generic pointers, otherwise single declaration would suffice).
const
INTERNET_OPTION_SECURITY_FLAGS = 31;
SECURITY_FLAG_IGNORE_UNKNOWN_CA = $00000100;
type
TInteger = record
Value: Integer;
end;
function InternetSetOptionInt(
hInet: HINTERNET; dwOption: DWORD; var lpBuffer: TInteger; dwBufferLength: DWORD): BOOL;
external 'InternetSetOptionA@wininet.dll stdcall delayload setuponly';
And use it like:
SecurityFlags.Value := SECURITY_FLAG_IGNORE_UNKNOWN_CA;
InternetSetOptionInt(
hRequest, INTERNET_OPTION_SECURITY_FLAGS, SecurityFlags, SizeOf(SecurityFlags))
(after the hRequest
is assigned in dwinshs.iss
).
Or use a plain HTTP instead. HTTPS set to ignore certificate errors is not secure anyway.
Or use a different library to download the files.
The Inno Download Plugin can ignore all certificate errors with:
idpSetOption('InvalidCert', 'ignore');