2

I need to set this property for a WinHttp request...

BOOL fRet = WinHttpSetOption(hRequest,
                             WINHTTP_OPTION_CLIENT_CERT_CONTEXT,
                             WINHTTP_NO_CLIENT_CERT_CONTEXT,
                             0);

But from within an old VB application. I can access the method but can't use the constants.

I can use this to access the method from VB...

Declare Function WinHttpSetOption Lib "winhttp.dll" _ 
(ByVal hInternet As Variant, ByVal dwOption As Integer, ByVal lpBuffer As Byte, ByVal dwBufferLength As Integer) _ 
As Boolean

And then call it like so...

Call WinHttpSetOption(hRequest, WINHTTP_OPTION_CLIENT_CERT_CONTEXT, WINHTTP_NO_CLIENT_CERT_CONTEXT, 0);

But have to replace the constants WINHTTP_OPTION_CLIENT_CERT_CONTEXT and WINHTTP_NO_CLIENT_CERT_CONTEXT with the correct numbers, or figure out how to import them.

After I long google search, I think WINHTTP_OPTION_CLIENT_CERT_CONTEXT is 47 but can't find WINHTTP_NO_CLIENT_CERT_CONTEXT anywhere.

Many thanks

StayOnTarget
  • 11,743
  • 10
  • 52
  • 81
Martin Holland
  • 291
  • 1
  • 14
  • In PowerBASIC it's defined as ```%WINHTTP_NO_CLIENT_CERT_CONTEXT = %NULL```, where ```%NULL = 0```. tl;dr it's zero. – Hel O'Ween Nov 24 '22 at 16:18
  • Many thanks! Can you confirm if WINHTTP_OPTION_CLIENT_CERT_CONTEXT is defined as 47? – Martin Holland Nov 24 '22 at 18:11
  • 2
    Yes, it is. BTW, the PowerBASIC definitions are a direct translation of the VC++ header file _WinHttp.h_. If you can get hold of a copy it - everything is in there. – Hel O'Ween Nov 25 '22 at 09:35

0 Answers0