我的本机 Win32 服务是否需要单独的消息文件库?
我们有一个使用 C++ 开发的旧版 win32 服务,我们最近注意到,当该服务启动和停止时,事件日志中会出现一条有关我们丢失的事件描述的信息性消息。更准确地说,该消息如下所示:
来自源 [应用程序] 的事件 ID 0 的描述不能是 成立。引发此事件的组件未安装在 您的本地计算机或安装已损坏。您可以安装 或修复本地计算机上的组件。
所以我们明白这意味着什么,基本上我们缺少一个编译了消息表的库。这样,当更改状态(启动/停止)的事件 ID 到达时,它可以查找该消息并将其打印在事件日志中。
问题是,对于几乎每个服务都会有的这些通用消息(更改状态等),当然有我们可以使用的默认消息表,而不必为此烦恼地创建另一个项目,添加注册表并更新我们的安装程序。
对于某些肯定应该在某个地方默认的东西来说,似乎有很多麻烦?喜欢标准的 win32 错误消息吗?
我过去创建了许多托管服务,我很确定我们以前不需要做这样的事情!
We've got an old legacy win32 service, developed with C++, and we've just recently noticed that when the service starts up and stops, there is an informational message in the event logs about our missing event descriptions. To be more precise, the message looks like this:
The description for Event ID 0 from source [application] cannot be
found. Either the component that raises this event is not installed on
your local computer or the installation is corrupted. You can install
or repair the component on the local computer.
So we understand what this means, basically we're missing a library which has a message table compiled into it. This way when the event ID for changing status (start/stop) arrives, it can look up the message and print it in the event logs.
The question is, for these universal messages (changing status etc) which pretty much every service is going to have, surely there are default message table that we can use, rather than having to go to the trouble of creating another project, just for this, adding registries and updating our installer.
Seems like a lot of hassle for something that should surely be a default somewhere? Like the standard win32 error messages?
I've created a number of managed services in the past, and I'm pretty sure we didn't need to do anything like this before!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
因此,总而言之,我想答案是,无论如何,总是需要一个新的消息表/文件(所以没有可以使用的默认消息),所以我只需将消息表放入我的服务资源文件并将注册表项添加到安装程序。
仍然觉得令人困惑的是,每个本机服务都有自己的“服务已停止/启动”消息......!
谢谢!
So to wrap this up, I guess the answer is that the a new message table/file is always required, regardless (so no there are no default messages you can use), so I'll just have to chuck in a message table into my services resource file and add a registry entry to the installer.
Still find it baffling thought that every native service has it's own 'service has stopped/started' message...!
Thanks!