目前我有一个资源文件,我用于自定义创建的事件日志。当我用信息/成功目的写一个事件到日志时,一切似乎都很完美。但当我写一个错误意图时,我得到......
无法找到来自源X的事件ID 301的描述......
我在想......是否与我的所有类别都是严重性=成功这一事实有关?我是否还需要具有Severity = Error?
的服务类别成功记录条目的示例:
事件ID:101,级别:信息,任务类别:(8)服务
非成功登录条目的示例:
事件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
.
答案 0 :(得分:1)
实际问题: 我创建错误的文件和我认为我创建的事件编号我们实际上是不同的数字。我在挖掘运行mc.exe和rc.exe命令时生成的myfile.c文件后发现了发生了什么。在查看该文件时,我意识到DWORD值(HEX)没有达到我预期的整数。
我的问题: 底线是我的问题只是因为我在#200上使用了“Severity = Warning”而不是“Severity = Success”。当我改变它时,我终于得到了我正在寻找被创建的事件编号。我对我的文件进行了一些其他增强(如下所示),但这是我遇到问题的主要原因。
更正的事件日志消息文件: 下面,您将找到我正确的事件日志消息文件。我还决定将其分成两个文件,使类别和事件分开。 (你不必)
categories.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
.
events.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
.