I am trying to call StrongNameSignatureVerificationEx
on IClrStrongName
from Delphi (using Rad Studio Berlin)
My first attempt just used the definition
function StrongNameSignatureVerificationEx(
wszFilePath : LPCWSTR;
fForceVerification : boolean;
var pfWasVerifided : boolean
): BOOL; stdcall; external 'mscoree.dll';
but this calls the .Net 2.0 version (which is not required for the target machines - gives a nice 'Please install .net framework 2.0/3.5 message')
There is a mechanism to create a CLR host and invoke the version of the routine from a specific runtime using TJclClrHost
var
anHost : TJclClrHost;
aClsId : TGUID;
res : Boolean;
obj : OleVariant; // ? Not sure about this, copying from another example
begin
anHost := TJclClrHost.Create('v4.0.30319');
anHost. Start
aClsId := StringToGuid('{9280188d-0e8e-4867-b30c-7fa83884e8de}');
res := anHost.GetInterface(aClsId, obj);
//...
However, I have no Delphi definition for IClrStrongName
so once I get the object I don't see how to invoke any methods on it. Importing mscoree.tlb doesn't give one and a websearch revealed to me only a C++ definition from
- Is the code above correct (esp. the 'obj' parameter for GetInterface() )?
- Do I need an interface definition to invoke the method (is there a way to invoke by name)?
- Where can I obtain a Delphi definition for IClrStrongName?,
- How can I convert the C++ definition into Delphi?