启动时 ucrtbase.dll 上的 Windows C++ 服务错误

标签 windows dll service fault

所以我开发这个程序已经有一段时间了……它的目的是充当我们 IT 团队的 Assets 管理者( future 可能更多)。我有 2 个服务,我们现在将它们称为“Manager”和“IAM”。 “管理器”负责所有服务的所有管理工作(目前只有称为“IAM”的库存 Assets 管理器),例如自动更新等,而 Assets 管理器则负责其工作。

无论如何,它已经运行了一段时间了。最近我实现了一个自动更新功能(实际上仍然需要测试和可能的调试)。在执行此操作时,我需要使我的命名保持一致(例如,将我的服务从“Updater”和“CppWindowsService”重命名为软件的实际名称)。

在此之前,它一直运行良好!启动、停止、安装和卸载没有任何问题。我更改了所有内容的名称,并确保它们都可以编译。看起来不错。现在“Manager”和“IAM”的安装都很好,但是当我尝试启动它时,我得到:

StartService failed (1053)

此外,当我尝试从 services.msc 启动它时,我收到以下错误消息:

Windows could not start the service on Local Computer.

Error 1053: The service did not respond to the start or control request in a timely fashion

但奇怪的是它不会等待任何类型的超时。它只是立即吐出消息。该消息来自从我的 wmain()(Windows 入口点。main() 否则。)函数调用的代码。

if (!StartService(
        schService,  // handle to service 
        0,           // number of arguments 
        NULL))      // no arguments 
    {
        printf("StartService failed (%d)\n", GetLastError());
        CloseServiceHandle(schService);
        CloseServiceHandle(schSCManager);
        return;
    }
    else printf("Service start pending...\n");

在 Windows 事件日志中,我收到包含以下详细信息的应用程序错误。

Faulting application name: InITManager.exe, version: 0.0.0.0, time stamp: 0x59e11e44

Faulting module name: ucrtbase.dll, version: 10.0.15063.674, time stamp: 0x8ac9f9d4

Exception code: 0xc0000409

Fault offset: 0x000000000007350e

Faulting process id: 0x3008

Faulting application start time: 0x01d346915918e17d

Faulting application path: C:\Users\collin.walker\Desktop\InITService\C++\x64\Release\Manager.exe

Faulting module path: C:\WINDOWS\System32\ucrtbase.dll

Report Id: 7fcbdcc4-be8e-476a-960f-4fa1fb21f892

Faulting package full name:

Faulting package-relative application ID:

其他信息:ucrtbase.dll 由 Visual Studio 使用并与发布版本相关联,而 ucrtbased.dll 与调试器版本相关联。我在 Release模式下构建。

现在,我已经被告知问题不是我的代码,但如果有人觉得他们需要查看它,那么我会把它包括在内。不过它是非常简单的 c++ winapi 东西。

如果有人对如何解决此问题有任何进一步的建议,请告诉我,并提前感谢所有帮助!

最佳答案

在我进行故障排除时有点忘记了这篇文章...无论如何,我想通了。上面的评论很到位!

对我来说,缓冲区溢出是因为我更改了服务名称,这也更改了程序目录名称。当我在我的服务的构造函数中初始化我的日志记录对象时发生了错误。我在构造函数中只有两行代码,所以我完全忘了看那里。更改了创建日志的硬编码目录位置,一切开始运行良好!感谢大家提供有用的信息!

关于启动时 ucrtbase.dll 上的 Windows C++ 服务错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46779455/

相关文章:

java - 您可以通过编程方式在 Java 中注册 ActiveX dll 吗?

php - beanstalkd - 保留但未完成的作业会怎样?

linux - 制作 Linux Web 服务的最佳方式?

java - 使用库(并行)在 R for Windows 上对 RWeka 进行并行化

linux - Powershell查询WINDOWS->LINUX

python - WMIC + Python 子进程/(Windows 10)

debugging - 如何调试在 Init() 方法中失败的 Windows 服务

用于显示文件名和上次访问时间的 Windows Shell 命令

c# - 快速的 C++ 程序,C# GUI,可能吗?

c++ - LNK2019 : unresolved external symbol -- Implicit DLL