unit Unt_Machine_WebDll; {$WARN SYMBOL_PLATFORM OFF} interface uses ComObj, ActiveX, Machine_TLB, StdVcl, SysUtils, Windows, Device ; const g_SupportedOptions = INTERFACESAFE_FOR_UNTRUSTED_CALLER or INTERFACESAFE_FOR_UNTRUSTED_DATA ; type TMachine = class(TAutoObject, IMachine, IObjectSafety) private FObjectSafetyFlags: DWORD; protected { Protected declarations } ... public { IObjectSafety } function GetInterfaceSafetyOptions(const IID: TIID; pdwSupportedOptions, pdwEnabledOptions: PDWORD): HResult; virtual; stdcall; function SetInterfaceSafetyOptions(const IID: TIID; dwOptionSetMask, dwEnabledOptions: DWORD): HResult; virtual; stdcall; end; implementation uses ComServ; /参数传递/ var ... function TMachine.GetInterfaceSafetyOptions(const IID: TIID; pdwSupportedOptions, pdwEnabledOptions: PDWORD): HResult; var Unk: IUnknown; begin if (pdwSupportedOptions = nil) or (pdwEnabledOptions = nil) then begin Result := E_POINTER; Exit; end; Result := QueryInterface(IID, Unk); if Result = S_OK then begin pdwSupportedOptions^ := INTERFACESAFE_FOR_UNTRUSTED_CALLER or INTERFACESAFE_FOR_UNTRUSTED_DATA; pdwEnabledOptions^ := FObjectSafetyFlags and (INTERFACESAFE_FOR_UNTRUSTED_CALLER or INTERFACESAFE_FOR_UNTRUSTED_DATA); end else begin pdwSupportedOptions^ := 0; pdwEnabledOptions^ := 0; end; end; function TMachine.SetInterfaceSafetyOptions(const IID: TIID; dwOptionSetMask, dwEnabledOptions: DWORD): HResult; var Unk: IUnknown; begin Result := QueryInterface(IID, Unk); if Result <> S_OK then Exit; FObjectSafetyFlags := dwEnabledOptions and dwOptionSetMask; end; initialization TAutoObjectFactory.Create(ComServer, TMachine, Class_Machine, ciMultiInstance, tmApartment); end.
Delphi写网页安全控件(dll,ocx)
最新推荐文章于 2020-08-13 11:32:41 发布