How to use REGSVR32 correctly in C++ code with WINDOWS7?

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hello World,<br/>
<br/>
I want to call regsvr32 automatically within an existing C++ project.<br/>
So far everything is working fine on XP machines, but we have problems on Windows 7.
<br/>
There is a (for my eyes) hidden problem I can not solve.


Hopefully someone here can help me!!!<br/>
<br/>
<br/>
<span style="text-decoration:underline The details:<br/>
There is an application (call it App.exe) that needs some COM registrations and related .dll and .ocx files. These will be registered through a small C++ tool which is written with MS VS6. Lets call this tool Tool.exe.
For your interest the detailed registration:
<div style="margin:5px 20px 20px
<div style="margin-bottom:2px Code:
<pre dir="ltr" style="margin:0px; padding:6px; border:1px inset; width:650px; height:98px; text-align:left <span style="color:black <br/>HINSTANCE hinst;<br/>hinst=ShellExecute(NULL,<span style="color:#a31515 "open",<span style="color:#a31515 "regsvr32",m_Path+<span style="color:#a31515 "\Important.dll"",NULL,SW_HIDE);<br/><span style="color:green // ** if registration failed: show a message box<br/> <span style="color:blue if ((<span style="color:blue int)hinst<=32) AfxMessageBox(<span style="color:#a31515 "Register Important.dll failed");[/code]

On XP after each regsvr32 call there will be shown an information in the way of "registration completed successfully".<br/>
If I would call regsvr32 from Windows7 command line I will get the same information.<br/>
<br/>
Unfortunately while running my tool on Windows 7 there will be shown NO information.<br/>
Because App.exe necessarily need the registered components I can check easiliy if the registration has been completed.<br/>
<span style="color:red BUT the problem is that in taskmanager you can see that there are still some regsvr32.exe processes running and these processes are sticking on the .dll files.<br/>
While the processes can be seen it is impossible to rename the files nor the folder where they are inside.<br/>
This means that the regsvr32 call has not been completed. It seems that the information (via message box or dialog??) is the only thing that is missing.<br/>
<br/>
Can you please tell me how it is possible to register .dll and .ocx files
correctly (similar to regsvr32 via CMD) in Windows 7 programmatically? <br/>
<br/>
Some facts:<br/>
* UAC is disabled<br/>
* User is Administrator<br/>
* User name is John<br/>
* Tool.exe is located within a folder on C: drive<br/>
* Tool.exe was started by user manually<br/>
* For testing I also started Interactive Service Detection but still no information shown<br/>
<br/>
<br/>
I did try so far to do the change the way of registration to<br/>
(1) LoadLibrary( dllFile )<br/>
(2) GetProcAdress ( DllRegisterServer)<br/>
(3) Call DllRegisterServer<br/>
But this failed for two files. One file that was not working is MSXml4.dll (Microsoft XML 4.0 SP2) where msxml4r.dll (Microsoft XML 4.0 SP1 Resources) is in the same directory. (When I remember correctly the 4r.dll file is necessary for the 4.dll file).
<br/>
I dont want to get to much in detail with this error so far, because I hope that some experienced Windows 7 C++ developer will find a solution quickly!
<img title="Wink" src="http://cssimg.sevenforumscdn.com/images/smilies/wink.gif" border="0" alt="

Because registration with regsvr32 will be succeeded I would like to know how I can do this correctly with my tool!?

<br/>
<br/>
<br/>
If you need any further inputs, please let me know!<br/>
<br/>
<br/>
Hopefully someone has some good news for me!<br/>
<br/>
<br/>
Kind regards,
#50



View the full article
 
Back
Top