I have written a class library using Visual Studio 2010 C# to read hardware information of a Computer (e.g. HDD/SSD). I will use this dll to create an installer using InnoSetup to read the hardware info of the target computer. Now my problems is .NET dll cannot be used directly unless it is registered already. I am trying to find a way to register the dll during InitializeSetup in InnoSetup so I can use the functions in the dll. Here is the script I wrote for installer.
function InitializeSetup(): Boolean;
var
obj: Variant;
diskPartitions: Integer;
va: String;
ErrorCode: Integer;
b: Boolean;
begin
ExtractTemporaryFile('SSHardwareChecker.dll');
RegisterServer(False, ExpandConstant('{tmp}\SSHardwareChecker.dll'), False);
obj := CreateOleObject('SSHardwareChecker.SSClass');
va := obj.GetDiskDriveInformation;
MsgBox(va, mbInformation, mb_Ok);
b:=UnregisterServer(False, ExpandConstant('{tmp}\SSHardwareChecker.dll'), False);
end;
The function RegisterServer
doesn't seem to work.It throws an error which says RegSvr32 failed with exit code 0x4
. I read a lot of articles in the net that says .net dll shoud be registered using regasm. I dont really know how to do this, especially in Inno Setup.
Please help guys.