1

目前,我有一个用于自定义创建的事件日志的资源文件。当我出于信息/成功目的将事件写入日志时,一切似乎都运行良好。但是当我写一个错误意图时,我得到......

无法找到来自源 X 的事件 ID 301 的描述...

我想知道...这是否与我的所有类别都是严重性 = 成功的事实有关?我是否还需要具有 Severity=Error 的服务类别?


成功的日志条目示例:

事件 ID:101,级别:信息,任务类别:(8) 服务

NON 成功的日志条目示例:

事件 ID:301,级别:错误,任务类别:(8) 服务


以下是我当前的文本消息文件,我将其转换为类别和消息的资源文件...

; // EventLogMsgs.mc
; // ********************************************************
; // Use the following commands to build this file:
; //   mc -s EventLogMsgs.mc
; //   rc EventLogMsgs.rc
; //   link /DLL /SUBSYSTEM:WINDOWS /NOENTRY /MACHINE:x86 EventLogMsgs.Res 

; // ********************************************************
; // - Event categories -
; // Categories must be numbered consecutively starting at 1.
; // ********************************************************

MessageId=0x1
Severity=Success
SymbolicName=GENERAL_CATEGORY
Language=English
General
.

MessageId=0x2
Severity=Success
SymbolicName=DATABASE_CATEGORY
Language=English
Database Query
.

MessageId=0x3
Severity=Success
SymbolicName=LOGON_CATEGORY
Language=English
Logon
.

MessageId=0x4
Severity=Success
SymbolicName=LOGOFF_CATEGORY
Language=English
Logoff
.

MessageId=0x5
Severity=Success
SymbolicName=EMAIL_CATEGORY
Language=English
Email
.

MessageId=0x6
Severity=Success
SymbolicName=PRINTER_CATEGORY
Language=English
Printer
.

MessageId=0x7
Severity=Success
SymbolicName=IO_CATEGORY
Language=English
IO
.

MessageId=0x8
Severity=Success
SymbolicName=SERVICE_CATEGORY
Language=English
Service
.

MessageId=0x9
Severity=Success
SymbolicName=DEBUG_CATEGORY
Language=English
Debug
.

; // - Event messages -
; // *********************************

MessageId = 100
Severity = Success
Facility = Application
SymbolicName = SMESSAGE_ID100
Language=English
%1
.

MessageId = 101
Severity = Success
Facility = Application
SymbolicName = SMESSAGE_ID101
Language=English
%1
.

MessageId = 102
Severity = Success
Facility = Application
SymbolicName = SMESSAGE_ID102
Language=English
%1
.

MessageId = 103
Severity = Success
Facility = Application
SymbolicName = SMESSAGE_ID103
Language=English
%1
.

MessageId = 104
Severity = Success
Facility = Application
SymbolicName = SMESSAGE_ID104
Language=English
%1
.

MessageId = 105
Severity = Success
Facility = Application
SymbolicName = SMESSAGE_ID105
Language=English
%1
.

MessageId = 200
Severity = Warning
Facility = Application
SymbolicName = WMESSAGE_ID200
Language=English
%1
.

MessageId = 201
Severity = Warning
Facility = Application
SymbolicName = WMESSAGE_ID201
Language=English
%1
.

MessageId = 202
Severity = Warning
Facility = Application
SymbolicName = WMESSAGE_ID202
Language=English
%1
.

MessageId = 203
Severity = Warning
Facility = Application
SymbolicName = WMESSAGE_ID203
Language=English
%1
.

MessageId = 204
Severity = Warning
Facility = Application
SymbolicName = WMESSAGE_ID204
Language=English
%1
.

MessageId = 205
Severity = Warning
Facility = Application
SymbolicName = WMESSAGE_ID205
Language=English
%1
.

MessageId = 300
Severity = Error
Facility = Application
SymbolicName = EMESSAGE_ID300
Language=English
%1
.

MessageId = 301
Severity = Error
Facility = Application
SymbolicName = EMESSAGE_ID301
Language=English
%1
.

MessageId = 302
Severity = Error
Facility = Application
SymbolicName = EMESSAGE_ID302
Language=English
%1
.

MessageId = 303
Severity = Error
Facility = Application
SymbolicName = EMESSAGE_ID303
Language=English
%1
.

MessageId = 304
Severity = Error
Facility = Application
SymbolicName = EMESSAGE_ID304
Language=English
%1
.

MessageId = 305
Severity = Error
Facility = Application
SymbolicName = EMESSAGE_ID305
Language=English
%1
.
4

1 回答 1

1

实际问题: 我创建的文件错误,我认为我创建的事件编号实际上是不同的编号。在挖掘运行 mc.exe 和 rc.exe 命令时生成的 myfile.c 文件后,我发现了发生了什么。在查看该文件时,我意识到 DWORD 值 (HEX) 加起来并没有达到我预期的整数。

我的问题: 底线是我的问题仅仅是因为我在 #200 上使用了“严重性 = 警告”而不是“严重性 = 成功”。当我改变它时,我终于得到了我正在寻找的事件编号。我对文件进行了一些其他增强(如下所示),但这是我遇到问题的主要原因。

更正的事件日志消息文件: 下面,您将找到我正确的事件日志消息文件。我还决定将它分成两个文件,将类别和事件分开。(你不必)

类别.mc

; // EventLogMsgs.mc
; // ********************************************************
; // Use the following commands to build this file:
; //   mc -s EventLogMsgs.mc
; //   rc EventLogMsgs.rc
; //   link /DLL /SUBSYSTEM:WINDOWS /NOENTRY /MACHINE:x86 EventLogMsgs.Res 

; // ********************************************************
; // - Event categories -
; // Categories must be numbered consecutively starting at 1.
; // ********************************************************

MessageIdTypedef = WORD

LanguageNames = (English=0x409:MSG00409)

MessageId = 0x1
SymbolicName=GENERAL_CATEGORY
Language=English
General
.

MessageId = 0x2
SymbolicName=DATABASE_CATEGORY
Language=English
Database
.

MessageId = 0x3
SymbolicName=LOGON_CATEGORY
Language=English
Logon
.

MessageId = 0x4
SymbolicName=LOGOFF_CATEGORY
Language=English
Logoff
.

MessageId = 0x5
SymbolicName=EMAIL_CATEGORY
Language=English
Email
.

MessageId = 0x6
SymbolicName=PRINTER_CATEGORY
Language=English
Printer
.

MessageId = 0x7
SymbolicName=IO_CATEGORY
Language=English
IO
.

MessageId = 0x8
SymbolicName=SERVICE_CATEGORY
Language=English
Service
.

MessageId = 0x9
SymbolicName=DEBUG_CATEGORY
Language=English
Debug
.

事件.mc

; // EventLogMsgs.mc
; // ********************************************************
; // Use the following commands to build this file:
; //   mc -s EventLogMsgs.mc
; //   rc EventLogMsgs.rc
; //   link /DLL /SUBSYSTEM:WINDOWS /NOENTRY /MACHINE:x86 EventLogMsgs.Res 

; // ********************************************************
; // - Event categories -
; // Categories must be numbered consecutively starting at 1.
; // ********************************************************

; // - Event messages -
; // *********************************

MessageIdTypedef = DWORD

LanguageNames = (English=0x409:MSG00409)

MessageId = 100
SymbolicName = SMESSAGE_ID100
Language=English
%1
.

MessageId = 101
SymbolicName = SMESSAGE_ID101
Language=English
%1
.

MessageId = 102
SymbolicName = SMESSAGE_ID102
Language=English
%1
.

MessageId = 103
SymbolicName = SMESSAGE_ID103
Language=English
%1
.

MessageId = 104
SymbolicName = SMESSAGE_ID104
Language=English
%1
.

MessageId = 105
SymbolicName = SMESSAGE_ID105
Language=English
%1
.

MessageId = 200
SymbolicName = WMESSAGE_ID200
Language=English
%1
.

MessageId = 201
SymbolicName = WMESSAGE_ID201
Language=English
%1
.

MessageId = 202
SymbolicName = WMESSAGE_ID202
Language=English
%1
.

MessageId = 203
SymbolicName = WMESSAGE_ID203
Language=English
%1
.

MessageId = 204
SymbolicName = WMESSAGE_ID204
Language=English
%1
.

MessageId = 205
SymbolicName = WMESSAGE_ID205
Language=English
%1
.

MessageId = 300
SymbolicName = EMESSAGE_ID300
Language=English
%1
.

MessageId = 301
SymbolicName = EMESSAGE_ID301
Language=English
%1
.

MessageId = 302
SymbolicName = EMESSAGE_ID302
Language=English
%1
.

MessageId = 303
SymbolicName = EMESSAGE_ID303
Language=English
%1
.

MessageId = 304
SymbolicName = EMESSAGE_ID304
Language=English
%1
.

MessageId = 305
SymbolicName = EMESSAGE_ID305
Language=English
%1
.
于 2014-08-01T05:54:14.507 回答