2004-09-27(月) 雨 安静時心拍数 43 [長年日記]
_ イベントログとメッセージ DLL ファイルとレジストリ
テストをしていたらレジストリ情報が無いとかメッセージ DLL ファイルとかで怒られてしまったので調査しました。検索したら NTイベントログに、任意のソースで任意のイベントIDのメッセージを出力するで一発解決です。
ただし Visual Studio でメッセージファイルをビルドしようとしても変更を関知してくれません。たまたま持っていた
プログラミング Microsoft Windows2000―サービスによるサーバーアプリケーション開発 (マイクロソフト公式解説書)(ジェフリ リヒター/ジェイソン・D. クラーク/Jeffrey Richter/Jason D. Clark/豊田 孝)の p.236 にカスタムビルドの方法が載っていたのでやってみました。コマンドには
mc -s -U -h $(ProjDir) -r $(ProjDir) $(InputName)
出力には
$(InputName).h
を追加します。mc のオプションは
>mc -?
Microsoft (R) Message Compiler Version 1.00.5239
Copyright (c) Microsoft Corp 1992-1995. All rights reserved.
usage: MC [-?vcdwso] [-m maxmsglen] [-h dirspec] [-e extension] [-r dirspec] [-x
dbgFileSpec] [-u] [-U] filename.mc
-? - displays this message
-v - gives verbose output.
-c - sets the Customer bit in all the message Ids.
-d - FACILTY and SEVERITY values in header file in decimal.
Sets message values in header to decimal initially.
-w - warns if message text contains non-OS/2 compatible inserts.
-s - insert symbolic name as first line of each message.
-o - generate OLE2 header file (use HRESULT definition instead of
status code definition)
-m maxmsglen - generate a warning if the size of any message exceeds
maxmsglen characters.
-h pathspec - gives the path of where to create the C include file
Default is .\
-e extension - Specify the extension for the header file.
From 1 - 3 chars.
-r pathspec - gives the path of where to create the RC include file
and the binary message resource files it includes.
Default is .\
-x pathspec - gives the path of where to create the .dbg C include
file that maps message Ids to their symbolic name.
-u - input file is Unicode.
-U - messages in .BIN file should be Unicode.
filename.mc - gives the names of a message text file
to compile.
Generated files have the Archive bit cleared.
でちゃんと意味を確認しておくこと。
それにしてもたかがログを吐くだけでイベントログだのメッセージ DLL ファイルだのレジストリだのをいじらなければならないのでしょうかね。手間が掛かり過ぎますよ。Windows の方がバッドノウハウが多いような気がします。
[ツッコミを入れる]