Windows 7 上的 NTSVC.OCX 问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2241331/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 13:54:39  来源:igfitidea点击:

NTSVC.OCX issues on Windows 7

windowswindows-7

提问by Bill

I have a VB6 Service that uses the standard NTSVC.ocx file to help manage all the NT service functions. The application has been running on Windows 2003 Server RC1 with no troubles. Our sales team asked if we could put this same application on a notebook that could be used as a live site demo. The only issue I am having is that the notebook is brand new, running Windows 7 and the manufacturer only has Windows 7 drivers for the devices.

我有一个 VB6 服务,它使用标准的 NTSVC.ocx 文件来帮助管理所有 NT 服务功能。该应用程序已在 Windows 2003 Server RC1 上运行,没有出现任何问题。我们的销售团队询问我们是否可以将这个相同的应用程序放在可以用作现场演示的笔记本电脑上。我遇到的唯一问题是笔记本电脑是全新的,运行的是 Windows 7,制造商只有这些设备的 Windows 7 驱动程序。

There is no installer for this service. I manually load the ocx and supporting other dll's into the various Windows and System32 folder and then run regsvr32 from the command prompt to load the OCX. The service has a command line set of parameters to install and uninstall the service itself.

此服务没有安装程序。我手动将 ocx 和支持其他 dll 加载到各种 Windows 和 System32 文件夹中,然后从命令提示符运行 regsvr32 以加载 OCX。该服务有一组命令行参数来安装和卸载服务本身。

When I try to REGSVR32 the OCX I get the following error:

当我尝试 REGSVR32 OCX 时,出现以下错误:

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

模块“C:\Windows\System32\ntsvc.ocx”加载失败。确保二进制文件存储在指定路径或调试以检查二进制文件或相关 .DLL 文件是否存在问题。指定的模块无法找到。

回答by mox

One potential reason that might lead to your problem, is that the NTSVC.OCX is built with a fixed Base Address (in other words, the Image has been bound by the Linker with the /FIXED switch). Starting with Vista, the Windows Loader uses Address Space Layour Randomization (ASLR) mechanism.

可能导致您出现问题的一个潜在原因是 NTSVC.OCX 是使用固定基址构建的(换句话说,图像已由链接器与/FIXED 开关绑定)。从 Vista 开始,Windows 加载程序使用地址空间布局随机化 (ASLR) 机制

Based on this ASLR feature the Windows Loader attempts to load the OCX component at another Base Address than the predefined one (the one hardcoded in the OCX image file). Since your OCX Address Base is hardcoded, the Loader will fail to load your OCX (which is technically just a DLL!).

基于此 ASLR 功能,Windows 加载程序尝试在另一个基地址而不是预定义的基地址(OCX 图像文件中硬编码的基地址)加载 OCX 组件。由于您的 OCX 地址库是硬编码的,加载程序将无法加载您的 OCX(技术上只是一个 DLL!)。

See Snapshot below showing these fields of the NTSVC.OCX image using PeStudio:

请参阅下面使用PeStudio显示 NTSVC.OCX 图像的这些字段的快照:

enter image description here

在此处输入图片说明

回答by Zoba

As ich said: in an administrative shell: regsvr32 C:\Windows\SYSWOW64\NTSVC.ocx did work for me. Note that \System32 did not work, as it gave me an error. It might work in a x86 environment, though.

正如 ich 所说:在管理外壳中: regsvr32 C:\Windows\SYSWOW64\NTSVC.ocx 对我有用。请注意 \System32 不起作用,因为它给了我一个错误。不过,它可能适用于 x86 环境。

I now have no errors in my project but did not try if it works properly.

我现在在我的项目中没有错误但没有尝试它是否正常工作。

回答by rerun

I would first try Dependency walker. If that doesn't give you a clue as to what you need you may be SOL. Also you will have to run regsvr32 as an administrator so you should get the little UAC popup.

我会首先尝试Dependency walker。如果这不能为您提供有关您需要什么的线索,那么您可能是 SOL。此外,您还必须以管理员身份运行 regsvr32,这样您应该会看到 UAC 小弹出窗口。

回答by Ich

this ocx (an also other ocx such as vbwheelscollfix.dll) to register ist very easy. First Step: copy this OCX into the Folder C:\Windows\SYSWOW64 (on 32 bit, i suspect its SYSWOW32).

这个 ocx(还有其他 ocx,如 vbwheelscollfix.dll)注册非常容易。第一步:将此 OCX 复制到文件夹 C:\Windows\SYSWOW64(在 32 位上,我怀疑它是 SYSWOW32)。

Second Step: Open a CMD with administrative rights.

第二步:打开一个有管理权限的CMD。

Last Step: Now you can register / unregister the file from the SYSWOW path.

最后一步:现在您可以从 SYSWOW 路径注册/取消注册文件。