【学习笔记】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 ]
[] []

   -?               - 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    - Specify the extension for the header file (1-3 chars)
   -h         - gives the path of where to create the C include file
                      Default is .\
   -m       - generate a warning if the size of any message exceeds
                       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         - gives the path of where to create the RC include file
                      and the binary message resource files it includes.
                      Default is .\

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

   -t         - validate against baseline resource

   -u               - input file is Unicode.
   -U               - messages in .BIN file should be Unicode (default).
   -v               - gives verbose output.
   -W         - specifies path to winmeta.xml file.
   -w         - specifies path to eventman.xsd file.
   -x         - 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     - gives the base name of the generated files.
                      Default is basename of input file.
      - gives the name of manifest file to compile
       - 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   - generate C# (managed) logging class
                      based on FX3.5 Eventing class
   -css  - 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       - defines the macro name prefix applied to
                      each generated logging macro.
                      Default is "EventWrite"
   -P       - 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


相关