Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ActiveX not working on client machine

Tags:

activex

inf

cab

I'm trying to run activex control for a simple hello world message box. First i created the class library and i have now the dll , then i created the HTML page and called the activeX control :

<!DOCTYPE>
<html>
<head>
      <title>DemoActiveX</title>
</head>
<body>
   <OBJECT id="DemoActiveX" classid="clsid:400DCE17-4B26-4E59-9A88-AF39E2BE4A55">
</OBJECT>
    <script type="text/javascript">
        try {
            var obj = document.DemoActiveX;
            if (obj) {
                alert(obj.SayHello());
            } else {
                alert("Object is not created!");
            }
        } catch (ex) {
            alert("Some error happens, error message is: " + ex.Description);
        }
    </script>
</body>
</html>

when i tried it in my machine i used to register the dll using regasm /codebase "dll path" and it worked fine.

The problem when i tried to run in another machine, i followed the coming steps : 1) I created setup project and added the dll file.

2) I created .inf file and tried two contents which are :

[version]
signature="$CHICAGO$"
AdvancedINF=2.0
[Add.Code]
ActiveX.dll=ActiveX.dll

[ActiveX.dll]
file-win32-x86=thiscab
clsid=400DCE17-4B26-4E59-9A88-AF39E2BE4A55
FileVersion=1,0,0,0

RegisterServer=yes

[version]
signature="$CHICAGO$"
AdvancedINF=2.0

[Setup Hooks]
install=install

[install]
run=msiexec.exe /package """%EXTRACT_DIR%\DemoActiveXSetup.msi""" /qn

3) I created .CAB file which contains the .inf and setup.exe files 4) Changed the object in HTML page to be :

<OBJECT id="DemoActiveX" classid="clsid:400DCE17-4B26-4E59-9A88-AF39E2BE4A55" 
codebase="ActiveXCAB.CAB" ></OBJECT>  

when i tried to open the page on the other machine a request windows opened which request to open CAB ,when i press yes nothing happened !!!!! why it doesn't open the setup.exe or msi file ?? BTW when i installed manually the setup file the activeX worked !

like image 482
Nader El Masry Avatar asked Oct 05 '22 12:10

Nader El Masry


1 Answers

I solved the problem :) The problem was :

1) I used to put msi file only or setup.exe in CAB file but i must put both msi and setup.exe and refer to setup.exe in inf file

2) inf file format was wrong , the correc one is :

 [version]
 signature="$CHICAGO$"
 AdvancedINF=2.0

 [Add.Code]
 setup.exe=setup.exe

 [setup.exe]
 file-win32-x86=thiscab
 clsid={415D09B9-3C9F-43F4-BB5C-C056263EF270}
 FileVersion=1,0,0,0

 [Setup Hooks]
 RunSetup=RunSetup

 [RunSetup]
 run="%EXTRACT_DIR%\setup.exe"

Good Luck :)

like image 176
Nader El Masry Avatar answered Oct 10 '22 02:10

Nader El Masry