【学习笔记】MC.exe 生成H和RC文件

在编译DEVCON.exe时提示找不到msg.h,发现存在msg.mc文件,可以使用MC.exe 进行编译出h头文件和rc资源文件,在此记录下,自己学习也是方便其他人。

1. MC.exe

usage:
MC [-?aAbcdnouUv] [-m ] [-h ] [-e ] [-r ] [-x ]
[-w ] [-W ] [-z ]
[-km | -um | -cs ] [-mof] [-p ] [-P ]
[<filename.man>] [<filename.mc>]

   -?               - displays this message
   -a               - input file is ANSI (default).
   -A               - messages in .BIN file should be ANSI.
   -b               - .BIN filename should have .mc filename included for uniqueness.
   -c               - sets the Customer bit in all of the message Ids.
   -d               - FACILTY and SEVERITY values in header file in decimal.
                      Sets message values in header to decimal initially.
   -e <extension>   - Specify the extension for the header file (1-3 chars)
   -h <path>        - gives the path of where to create the C include file
                      Default is .\
   -m <length>      - generate a warning if the size of any message exceeds
                      <length> characters.
   -n               - terminates all strings with null's in the message tables.
   -o               - generate OLE2 header file (use HRESULT definition instead of
                      status code definition)
   -r <path>        - gives the path of where to create the RC include file
                      and the binary message resource files it includes.
                      Default is .\

   -s <path>        - generate binary resource per provider
                      generate summary global resource MCGenResource.BIN

   -t <path>        - validate against baseline resource

   -u               - input file is Unicode.
   -U               - messages in .BIN file should be Unicode (default).
   -v               - gives verbose output.
   -W <file>        - specifies path to winmeta.xml file.
   -w <file>        - specifies path to eventman.xsd file.
   -x <path>        - gives the path of where to create the .dbg C include
                      file that maps message Ids to their symbolic name.
                      This option can only be used with message text file.
   -z <basename>    - gives the base name of the generated files.
                      Default is basename of input file.
   <filename.man>   - gives the name of manifest file to compile
   <filename.mc>    - gives the name of a message file to compile

   Code Generation Options
   -----------------------
   -km              - generate Kernel Mode logging macros
   -um              - generate User Mode logging macros
   -cs <namespace>  - generate C# (managed) logging class
                      based on FX3.5 Eventing class
   -css <namespace> - generate static C# (managed) logging class
                      based on FX3.5 Eventing class

   -co              - add callout macro to invoke user code at loggin.
                      not availalbe for c#, and ignored.
   -mof             - generate downlevel support for all function/macros generated.
                      MOF file will be generated from the manifest.
                      MOF file will be placed in the location specified by
                      the "-h" switch.
   -p <prefix>      - defines the macro name prefix applied to
                      each generated logging macro.
                      Default is "EventWrite"
   -P <prefix>      - defines the text at the start of each event
                      symbol name to remove before forming the macro names.
                      Default is NULL.

   Note: Switches 'w' and 'W' are not required and will be removed in future.
   Note: At most one .mc and/or one .man file can be processed in one invocation.
   Note: Generated files have the Archive bit cleared.

2.使用

上面的命令提示已经很明确了,生成命令就是下面的代码了

C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin>MC.Exe -r C:\Users\john\Downloads\Device_Console__DevCon__Tool\ -h C:\Users\john\Downloads\Device_Console__DevCon__Tool C:\Users\john\Downloads\Device_Console__DevCon__Tool\msg.mc
MC: Compiling C:\Users\john\Downloads\Device_Console__DevCon__Tool\msg.mc

image
image

posted @ 2021-04-02 23:18  dozeoo  阅读(297)  评论(0编辑  收藏  举报