WebGadget with invalid Server Cert

Für allgemeine Fragen zur Programmierung mit PureBasic.
Wayne-C
Beiträge: 12
Registriert: 13.11.2015 14:59

WebGadget with invalid Server Cert

Beitrag von Wayne-C »

Hello

I try to implement OnSecurityProblem of IHttpSecurity to be able to browse to a Server URL with an invalid (self signed) certificate WITHOUT the security window alert popping up.

But I am stuck... Any help appreciated!

This function should be exposed to PureBasic:
https://msdn.microsoft.com/en-us/library/ms775050(v=vs.85).aspx

Code: Alles auswählen

If OpenWindow(0, 100, 100, 500, 400, "Webgadget", #PB_Window_SystemMenu)
	WebGadget(0, 0, 0, 500, 400, "https://www.test.ch/")
	WebBrowser.IWebBrowser2 = GetWindowLong_(GadgetID(0), #GWL_USERDATA)
	If WebBrowser\QueryInterface(?IID_IServiceProvider, @pServiceProvider.IServiceProvider) = #S_OK
		Debug "IServiceProvider OK"
		
		; Structure __COM_IHttpSecurity_Vtbl Extends __COM_IUnknown_Vtbl
		;   GetWindow.l
		;   OnSecurityProblem.l
		; EndStructure
		; 
		; Macro BuildCOMVTable_IHttpSecurity(__Object__)
		;   __COM_VTABLE_SetIUnknown(__Object__, IHttpSecurity)
		;   __COM_VTABLE_SetMethod(__Object__, IHttpSecurity, GetWindow, 2)
		;   __COM_VTABLE_SetMethod(__Object__, IHttpSecurity, OnSecurityProblem, 1)
		;   __COM_VTABLE_SetDebug(__Object__, IHttpSecurity)
		; EndMacro
		; 
		; DefineGUID(IID_IHttpSecurity, $79EAC9D7, $BAFA, $11CE, $8C, $82, $00, $AA, $00, $4B, $A9, $0B)
		
		; If pServiceProvider\QueryService(?SID_xxx, ?IID_IHttpSecurity, @pHttpSecurity.IHttpSecurity) = #S_OK
		; 	Debug "IHttpSecurity OK"
		; 	
		; 	; https://msdn.microsoft.com/en-us/library/ms775050(v=vs.85).aspx
		; 	
		; 	; pHttpSecurity\OnSecurityProblem(Problem.l)
		; 	
		; 	pHttpSecurity\Release()
		; EndIf
		
		pServiceProvider\Release()
	EndIf
	Repeat
		WEvent = WindowEvent()
		If WEvent
			If WEvent = #PB_Event_CloseWindow
				Break
			EndIf
		Else
			Delay(10)
		EndIf
	ForEver
EndIf
End

DataSection
	IID_IUnknown:
	Data.l $00000000
	Data.w $0000, $0000
	Data.b $C0, $00, $00, $00, $00, $00, $00, $46
	IID_IServiceProvider:
	Data.l $6D5140C1
	Data.w $7436,$11CE
	Data.b $80,$34,$00,$AA,$00,$60,$09,$FA
IID_IHttpSecurity:
	Data.l $79EAC9D7
	Data.w $BAFA, $11CE
	Data.b $8C, $82, $00, $AA, $00, $4B, $A9, $0B
IID_IWindowForBindingUI:
	Data.l $79EAC9D5
	Data.w $BAFA, $11CE
	Data.b $8C, $82, $00, $AA, $00, $4B, $A9, $0B
EndDataSection
Thank you in advance!

Kind regards
Wayne