¿Cómo se 'extrae información de comunicaciones' de un OCX sin InstallShield?

In one of the projects our team is working on, we are trying to make an automated deployment system for an existing desktop application. In order to do that we need to understand how InstallShield installs the application to begin with.

We have access to the InstallShield manifest, but there is an OCX file that we cannot figure out how to install manually (without InstallShield). This particular OCX file is set to 'Extract COM Information'.

Aquí hay una captura de pantalla:

InstallShield Properties Dialog

The other OCXs in this application are self-registering, so they can be registered with Regsvr32.exe. But the OCX we are having problems with cannot be registered in that fashion.

How would one manually install an OCX file that is set to 'Extract COM Information' in an InstallShield manifest?

preguntado el 09 de marzo de 12 a las 17:03

2 Respuestas

RegSvr32.exe calls the LoadLibrary API to load your DLL and then invokes the DllRegisterServer entry point inside your DLL. The code inside that function does the actual COM registration. If RegSvr32 is failing, that typically means a dependency of your DLL is missing or invalid.

InstallShield does all of this along with some really low level bit hacking to virtualize all of this and then harvest it. An old article on the subject is:

Spying on Registry Entries

InstallShield doesn't actually use this technique per say ( they have several techniques, most of which is not documented and various filters and transform engines to clean up the data ). If you are just looking for a way to do it without InstallShield, then look at Windows Installer XML's "Heat" command line tool. This can "harvest" COM metadata into WxS XML elements.

Also WiX is open source so if you are really curious you could go looking at their code.

respondido 10 mar '12, 11:03

I'm sorry we can't modify the dll, so we have to find another way. - Mark Rogers

I don't believe I said anything about modifying any DLL's. - Christopher pintor

+1 Thanks for the response, let me clarify. I'm not sure what "RegSvr32.exe call LoadLibrary to load your DLL and then DllRegisterServer() inside your DLL." means. Are you saying run DllRegisterServer inside the deployment system? (we can do things programmatically). To restate, are saying that inside whatever deploys the app, DllReigsterServer() must be called? - Mark Rogers

I cleaned up my wording and added some links, maybe that will clarify it for you. - Christopher pintor

As Christopher mentioned, InstallShield extracts COM information from your .ocx by seeing what it registers when invoked similarly to regsvr32.exe will invoke it. Its various forms of redirection (for capturing purposes) have the added benefit of working around several potential permissions problems while the file is registering in your build environment. However if I'm not missing the point of your question, it's "why doesn't regsvr32.exe your.ocx work on the target machine?"

This is a bit of a stab in the dark, as you haven't included enough information. While missing dependencies can cause this, I'm going to guess you only see this failure on Windows Vista/Server 2008 or higher. If this is the case, there's a good chance your application is trying to write to registry keys that are protected by Protección de recursos de Windows (WRP), or is being tripped up by a per-user typelib registration problem.

When a poorly behaved self-registration routine encounters WRP, it attempts to write to a registry key it lacks permission to modify, then fails the entire registration. I'm uncertain what happens to the keys it wrote before that point, but all ones after it definitely never make it to the machine. You should be able to confirm whether this is the case with a tool like Monitor de proceso.

What do you do if this is the case? Well, you can stick with an extraction approach like that of InstallShield (which you say you want to leave). You can fix the file to not attempt to write to protected keys (which you say you cannot modify). Or you might be able to use the Kit de herramientas de compatibilidad de aplicaciones (ACT) to shim things, but I don't see how you can generally do that downstream. Generally speaking, I would recommend fixing the file, or continuing to use a working approach.

respondido 10 mar '12, 15:03

+1 thanks for the thoughtful comments, what additional information do you think I should include in the question? - Mark Rogers

Michael has the unfair advantage of actually working at InstallShield so he knows the code inside and out. :-) FWIW, what wasn' clear to me about your question was if you wanted to understand at a very low level how the extraction works so you could write your own program or if you were just trying to solve the COM extraction problem for this one time or if you simply didn't want to depend on InstallShield going forward to get the job done. - Christopher pintor

If you are just trying to get around a COM extraction problem for this one DLL and you don't mind emailing it to me, I could run it through a number of tricks that I have to try to take a crack at it for you. - Christopher pintor

We're just trying to solve the COM extraction so we can rewrite the ocx's install in our own clickonce deployment app, but there is a chance that we may have to do this for more applications. It's not that we don't want to use installshield, its just that we are trying to wrap a suite of applications that used installshield in Microsoft's ClickOnce deployment system so we have to understand how all the dlls and ocxs are registered and installed so we can duplicate it in .net. The target audience is considered of low expertise and does not want to relay on an unautomated install. - Mark Rogers

Oh, just the usual suspects - like which versions of IS, Windows, etc. you've tried, and what the behavior is with each. For example, if it worked with regsvr32 on Windows XP and failed on Vista, that would lend credence to what I talked about, whereas if it never worked, or worked on Vista but failed on Windows 7, it's probably something else. - miguel urman

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.