警告 - 运行 wevtutil 时无法访问提供程序资源

发布于 2025-01-04 06:47:02 字数 171 浏览 3 评论 0原文

我需要帮助解决尝试创建 Windows 事件提供程序时无法访问“提供程序”资源的问题。我使用 ManGen 实用程序创建清单文件,并将“.exe”文件命名为我的消息和资源文件。我编译了“生成了带有 exe 文件的 .rc' 文件和预期的 '.res' 文件。但是,当我运行 wevtutil 时,我不断收到“资源不可访问”警告。

I need help solving the "Provider '' resources not accessible when trying to create a windows event provider. I create my manifest file with the ManGen utility, and name my '.exe' file as my message and resource file. I compile the '.rc' file with my exe file and the expected'.res' file are generated. However, when I run wevtutil I keep getting the 'resources not accessible' warning.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

云裳 2025-01-11 06:47:02

当您安装清单(例如 wevtutil im manifest.man)时,如果资源不可用,您应该会看到某种警告:

**** Warning: Publisher EventsProvider resources are not accessible.

要获取一些其他信息,请尝试检索以下资源之一的信息:出版商。例如:

c:\...> wevtutil gp <EventProviderName>
Failed to open metadata for publisher <EventProviderName>. Access denied.

好的,上面表明存在权限问题,所以让我使路径可访问并重试:

c:\...> wevtutil gp <EventProviderName>
Failed to open metadata for publisher <EventProviderName>. The specified resource
type cannot be found in the image file.

对于上面的内容,看起来资源没有正确编译。

如果你使用VSFile->Open并在资源查看器中打开你的exe,你应该能够看到编译的资源。你至少应该有一个“WEVT_TEMPLATE”条目。

为了正确编译资源,需要向 csc 传递资源,如下所示:

csc /win32res:<Resource.res>

When you install your manifest (e.g. wevtutil im manifest.man), you should see some sort of a warning if the resources aren't available:

**** Warning: Publisher EventsProvider resources are not accessible.

To get some additional information, try to retrieve information on one of the publishers. For example:

c:\...> wevtutil gp <EventProviderName>
Failed to open metadata for publisher <EventProviderName>. Access denied.

Ok, the above suggests a permissions problem, so let me make the path accessible and try again:

c:\...> wevtutil gp <EventProviderName>
Failed to open metadata for publisher <EventProviderName>. The specified resource
type cannot be found in the image file.

For the above, it looks like the resource didn't get compiled in correctly.

If you go File->Open with VS and open your exe in the resource viewer you should be able to see the resources that were compiled in. You should at least have a "WEVT_TEMPLATE" entry.

For the resource to be compiled in correctly, csc needs to be passed the resource as follows:

csc /win32res:<Resource.res>
温柔嚣张 2025-01-11 06:47:02

您正在注册的 dll 需要具有一组特定的文件权限。我怀疑事件日志服务在“本地服务”帐户下运行。所以仅仅授予 SYSTEM 访问权限是不够的。我通过授予我的电脑上的“用户”组“读取和执行”权限来解决问题。

我遇到了一个棘手的问题,花了一天的时间才找到答案。我共享了我的项目工作文件夹,然后取消共享。由于某种原因,这删除了“用户”访问权限。我认为这就是 Windows SDK 中的事件跟踪示例将所有 dll 复制到 C 驱动器下的特殊文件夹并从那里安装提供程序的原因。当您在 C 盘下创建文件夹时,USERS 组将自动获得访问权限。

The dll you are registering needs to have a particular set of file permissions. I suspect that the event logging service runs under the "local service" account. So just giving SYSTEM access rights is not enough. I solved by problem by giving the "USERS" group on my PC "read & execute" priviledges.

I ran into a nasty problem that took a day to track down. I shared my project working folder and then unshared it. For some reason this removed the "USERS" access priviledges. I think this is the reason than the event tracing samples in the windows SDK copy all the dlls to a special folder under the C drive and install the provider from there. When you create folders under C drive the USERS group is given access automatically.

江南月 2025-01-11 06:47:02

我遇到了完全相同的错误,但解决方案与已发布的其他答案略有不同。我必须打开清单文件并更改 resourceFileNamemessageFileName 属性,以使用应用程序可执行文件的绝对路径

I had the exact same error but the solution was slightly different to the other answers that have already been posted. I had to open the manifest file and change the resourceFileName and messageFileName attributes to use absolute paths to the application executable.

尴尬癌患者 2025-01-11 06:47:02

我遇到了类似的问题。解决方案是

  • 尽可能使用绝对路径并远离相对路径
  • 确保每个人都具有对清单文件的读取权限

如果您的清单文件名为 manifest.manmanifest.dll,然后

  • 授予每个人读取权限

    icacls %~dp0\manifest.* /t /grantEveryone:R

  • 使用绝对路径安装(如果使用批处理文件,可以使用%~dp0变量)

    wevtutil im %~dp0\manifest.man /rf:"%~dp0\manifest.dll" /mf:"%~dp0\manifest.dll"

I experienced the similar problem. The solution is to

  • use absolute paths wherever possible and stay away from relative paths
  • make sure everyone has read access to manifest files

If your manifest files are called manifest.man and manifest.dll, then

  • grant read access to everyone

    icacls %~dp0\manifest.* /t /grant Everyone:R

  • use absolute paths to install (%~dp0 variable could be used if you are using a batch file)

    wevtutil im %~dp0\manifest.man /rf:"%~dp0\manifest.dll" /mf:"%~dp0\manifest.dll"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文