Solved

Cannot register OCX using Regsvr32

Posted on 2012-03-14
8
3,167 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
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 41

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
 
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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

I hope this helps those who have been battling the SanDisk / U3 problem for a while. For anyone that is running Windows 7 64bit and is receiving and searching the internet for the “Windows Error: Windows has allocated a drive letter to the U3 dri…
Hi Friends, These registry tweaks will help you optimizing your Windows 7 system for any VDI. This will improve the machine performanance and can be used on normal systems also. These are few registry tweaks which will add value by enhancing the …
This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now