Solved

Cannot register OCX using Regsvr32

Posted on 2012-03-14
8
4,317 Views
Last Modified: 2012-03-16
In a command prompt I am running this line:  

C:\Windows\System32> regsvr32 C:\Windows\System32\ImageViewer2.OCX

I get the following error:

RegSvr32
The Module "C:\Windows\System32\ImageViewer2.OCX" failed to load.
Make sure the binary is stored at the specified path or debug it to check for problems with the binary or dependent .DLL files.  
The Specified module could not be found.  

This is a new 64 bit, Win7 laptop.  The OCX file has been transferred from a 64 bit Win 7 system it succesfully installed on.  I am logged in as Administrator and running cmd as Administrator.  I have a VFP app that relies on this OCX to run.
0
Comment
Question by:woodwyn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 10

Accepted Solution

by:
CSI-Windows_com earned 250 total points
ID: 37722020
You are probably attempting to register it with the 64-bit version.

You need to execute: c:\windows\syswow64\regsvr32 C:\Windows\System32\ImageViewer2.OCX

Another way to do it, which may be relevant to scripting, is to elevate 32-bit CMD.exe which is in c:\windows\sysWOW64\cmd.exe and THEN use your previous command line.

Since the CMD.EXE is 32-bit, what appears to be "C:\windows\system32" is actually being redirected to "C:\windows\syswow64"
0
 
LVL 27

Expert Comment

by:CaptainCyril
ID: 37722072
The user trying to register does not have enough access privileges.

Let me tell you an example. I have a software that exports charts to PowerPoint. If the software is launched via QuickLaunch or StartMenu, the software won't be able to communicate with PowerPoint. It is only able to communicate with it when launched via CREATEOBJECT from the software itself. This is because of User Access Control by Vista and 7.

You should launch the Command Prompt as admin and try that.
0
 
LVL 42

Expert Comment

by:pcelba
ID: 37722378
And if it is no 32/64 problem then the most probable reason is some missing DLL which is necessary for the OCX control.

Try Dependency Walker software.
0
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
LVL 29

Assisted Solution

by:Olaf Doschke
Olaf Doschke earned 250 total points
ID: 37722699
As it's a 64bit system the first error is to put a 32 bit OCX into the system32 folder, this has to go into SysWoW64.

But if the OCX is 64bit, it goes ito system32, and then you have no chance to use it from FoxPro.

Bye, Olaf.


Edit:

It's easily mistaken: system32 is named that way for "downward compatibility" for new 64bit software, which indeed was a bad idea. New software doesn't need downward compatibility, old software does.

SysWoW64 is short for Subsystem Windows 32bit on Windows 64bit, naming it SysW32onW64 would have been better, perhaps.

http://en.wikipedia.org/wiki/WoW64

The downward compatibility for 32 bit software is, that 32bit processes accessing system32 are redirected to SysWow64, but if you manually put an OCX into system32 that is not redirected, of course.

Besides that UAC is another hurdle to register something manually. Even if you invoke the correct regsvr32 as admin, the regsvr process does not run with elevated rights and that makes it write registry entries into virtualised registry and report success, though it has not created the registry entries really needed. Running a cmd window as admin and executing regsvr32 from there, as CaptainCyril suggested, helps to overcome this.
0
 

Author Closing Comment

by:woodwyn
ID: 37727407
Does this make sense:  I could register the OCX in the SysWOW64 folder using the SysWOW64\regsvr32, but when done the VFP app would still not run correctly.   I was able to register the OCX in SysWOW64 using System32\regsver, but still no luck with the app.  Next I successfully registered the OCX in the System32 folder using SysWOW64\regsvr32, but still the app wouldn't run.  Lastly, I successfully registered the OCX in the System32 folder using System32\regsvr32 and the app worked!  

I can't guarentee I am reporting the steps taken with 100% accuracy, but I think I am.
0
 
LVL 10

Expert Comment

by:CSI-Windows_com
ID: 37727467
The answer depends on whether your command prompt was 32 or 64 bit.

FYI - System32 redirection is based on the bitness of the module (EXE /DLL), not the location of the module.
0
 
LVL 29

Expert Comment

by:Olaf Doschke
ID: 37730601
From your report you registered the OCX in any location with any regsvr32 version. I said, you will never get a fail reported, as writing to the registry also is done anyway, sometimes with redirection.

What CIS-Windows_com says also makes sense, as for the 32bit version of the command window the same redirection towords SysWow64 is done.

So you could eg remove or rename the OCX file from SysWow64 and see, if it's not used by foxpro, I would be surprised.

Bye, Olaf.
0
 
LVL 10

Expert Comment

by:CSI-Windows_com
ID: 37730798
I see that I didn't address this statement

"Next I successfully registered the OCX in the System32 folder using SysWOW64\regsvr32, but still the app wouldn't run."

That is because when you use sysWOW64\regsvr32.exe COM registration correctly goes to the 32-bit location in HKLM\Software\Wow6432Node\Classes\CLSID\<COMGUID>\InProcServer32\(default) which will be "C:\windows\system32\ImageViewer32.ocx"

The 32-bit EXE then also correctly reads "C:\windows\system32\ImageViewer32.ocx" from that same registry key.

But when the 32-bit EXE asks Windows to load the OCX from that location, system32 folder redirection picks up the reference and translates it to be "C:\windows\SysWOW64\ImageViewer32.ocx".

Since the file is not actually located there, the load fails.

If you put procmon on it you can verify the above.

Also, as an aside, if you use the "Start" "Run" box (it's no longer a separate "Run" box) to do the command "regsrv32.exe C:\windows\system32\ImageViewer32.ocx" you are automatically attempting to use the 64-bit version of regsrv32.exe because you are running from 64-bit Explorer.exe which picks up regsrv32.exe from the windows path in the actual C:\windows\system32 folder.
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

OfficeMate Freezes on login or does not load after login credentials are input.
The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
This Micro Tutorial will teach you how to the overview of Microsoft Security Essentials. This is a free anti-virus software that guards your PC against viruses, spyware, worms, and other malicious software. This will be demonstrated using Windows…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

626 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question