Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/delphi/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Delphi 10.3中更改前后的HttpRequestResp_Delphi_Wininet_Delphi 10.3 Rio_Internetsetoption - Fatal编程技术网

在Delphi 10.3中更改前后的HttpRequestResp

在Delphi 10.3中更改前后的HttpRequestResp,delphi,wininet,delphi-10.3-rio,internetsetoption,Delphi,Wininet,Delphi 10.3 Rio,Internetsetoption,我有一个事件代码,以前使用了数据参数,但在Delphi 10.3中,该参数被替换 在Delphi 10.3之前: 过程THTTPEvents.HTTPReqResp1BeforePost(常量HTTPReqResp:THTTPReqResp;数据:指针); 开始 //设置用于SSL连接的证书 如果不是InternetSetOption(数据、INTERNET选项、客户端证书上下文、PCertContext、Sizeof(证书上下文)*5) 然后引发异常。Create('Problema no c

我有一个事件代码,以前使用了
数据
参数,但在Delphi 10.3中,该参数被替换

在Delphi 10.3之前:

过程THTTPEvents.HTTPReqResp1BeforePost(常量HTTPReqResp:THTTPReqResp;数据:指针);
开始
//设置用于SSL连接的证书
如果不是InternetSetOption(数据、INTERNET选项、客户端证书上下文、PCertContext、Sizeof(证书上下文)*5)
然后引发异常。Create('Problema no certificado!');
结束;
在这段代码中,我使用了
InternetSetOption()
,我现在应该如何在Delphi10.3中继续?如何获取
数据
参数

procedure THTTPEvents.HTTPReqResp1BeforePost(const HTTPReqResp: THTTPReqResp; Data: Pointer);
var
  Store        : IStore;
  Cert         : ICertificate2;
  CertContext  : ICertContext;
  PCertContext : PCCERT_CONTEXT;
begin
  try
    if not FileExists(HTTPEvents.PFXFile) then
      Raise Exception.Create('Ficheiro de certificado não encontrado!');

    HttpReqResp.ConnectTimeout := 12000;
    HttpReqResp.ReceiveTimeout := 12000;
    HttpReqResp.SendTimeout := 12000;

    // create Certificate store object
    Store := CoStore.Create;
    Cert := CoCertificate.Create;
    Cert.Load(HTTPEvents.PFXFile, HTTPEvents.PFXPass, CAPICOM_KEY_STORAGE_DEFAULT, CAPICOM_CURRENT_USER_KEY);
    CertContext := Cert as ICertContext;
    CertContext.Get_CertContext(Integer(PCertContext));

    // set the certificate to use for the SSL connection
    if not InternetSetOption(Data, INTERNET_OPTION_CLIENT_CERT_CONTEXT, PCertContext, Sizeof(CERTCONTEXT)*5)
      then Raise Exception.Create('Problema no certificado!');
    CertContext.FreeContext(Integer(PCertContext));
  except
    ON E:Exception DO ShowMessage(E.Message);
  end;
end;

BeforePost事件中的所有代码。这段代码在Delphi10.3中不起作用,因为参数“Data”。如果有人帮助我,这个问题会让我发疯。

类似的问题:@LURD这个问题也没有答案@nolaspeaker,是的,但是一旦其中一个问题得到解决,将类似的问题链接在一起会更容易找到解决方案。看这里:文档链接:类似问题:@LURD该问题也没有答案@nolaspeaker,是的,但将类似的问题链接在一起,可以在解决其中一个问题后更容易地找到解决方案。请看这里:指向文档的链接: