MC.exe (Message compiler), rc.exe, link.exe to generate .dll for EventMessageFile

Good afternoon, dear readers of Habr. This post is a guide for creating a dynamic .dll library, which contains the messages necessary for displaying in a custom logger, which is located in the Windows Event Viewer Application and Services Logs, yy (as an example). 3r3147.  3r3154. 3r3147.  3r3154. MC.exe (Message compiler), rc.exe, link.exe to generate .dll for EventMessageFile 3r3147.  3r3154. 3r311.
3r3147.  3r3154. In the custom log you can often see messages, the description of which contains:
 3r3154. 3r3147.  3r3154. 3r3147.  3r3154. 3r3147.  3r3154. This means that the source of the events yyyy does not contain the necessary set of ID and Description. 3r3147.  3r3154. 3r3147.  3r3154. In order to correct this situation, you need:
 3r3154. 3r3147.  3r3154. 3r3133. 1. [/b] Open regedit in the following path: HKLMSYSTEMCurrentControlSetServicesEventLog and verify the existence of your section. 3r3147.  3r3154. 3r3147.  3r3154. 3r3133. 2. [/b] Create eventMessage.txt into which you need to place your parameters, example with msdn , save in the required encoding of Windows-1251 or Unicode and the eventMessage.mc format. 3r3147.  3r3154. 3r3147.  3r3154. 3r3133. Note: 3r3135. when filling eventMessage with your ID and description ALWAYS after the description it is necessary to put a dot on the new line, and after it to transfer the caret to a new line. 3r3147.  3r3154. 3r3147.  3r3154. Example: 3r3147.  3r3154. 3r3147.  3r3154.
3r3128. MessageId = 0x1
SymbolicName = CAT_1
Language = English
OutDescription for your application
. 3r3154. 3r3154. MessageId = 0x2
3r3147.  3r3154. If you do not take into account this feature, then there may be unexpected errors at compile time. 3r3147.  3r3154. 3r3147.  3r3154. 3r3133. 3. [/b] Run cmd as administrator. 3r3147.  3r3154. 3r3147.  3r3154. 3r3133. 4. [/b] Run the following command: mc.exe –u C: SomeFoldereventMessage.mc -r C: SomeFolderresult
 3r3154. 3r3147.  3r3154. 3r3133. Note [/b] : mc.exe, in particular, is in C: Program Files (x86) Windows Kits10bin???.0x86 instead of the format 3r3128. -u (Unicode) can use 3r3128. -A (W-1251 or ANSI, the default format) , and parameter 3r3128. -r 3r3129. is the output location where the files will be saved after compilation. 3r3147.  3r3154. 3r3147.  3r3154. After the command is executed, the binary file and the eventMessage.rc file in C: SomeFolderresult
will be created.  3r3154. 3r3147.  3r3154. 3r3133. 5. [/b] Run the following command: rc.exe C: SomeFolderresulteventMessage.rc
 3r3154. 3r3147.  3r3154. 3r3133. Note [/b] : rc.exe is in the same directory as mc.exe. 3r3147.  3r3154. 3r3147.  3r3154. After compilation, the eventMessage.res file will be created, which is required to create a dynamic library. 3r3147.  3r3154. 3r3147.  3r3154. 3r3133. 6. 3r3135. Run the command: link.exe -dll -noentry /out:C:SomeFolderresultOurMessageSet.dll C: SomeFolderresulteventMessage.res. 3r3147.  3r3154. 3r3147.  3r3154. 3r3133. Note: 3r3135. link.exe is, in a particular case, in C: Program Files (x86) Microsoft Visual Studio2017CommunitySDKScopeCppSDKVCbin 3r3147.  3r3154. 3r3147.  3r3154. 3r3133. 7. 3r3135. Congratulations, we have created a long-awaited library with you, but that's not all. Go to regedit to our directory from step 1. In the directory field, create a string parameter (string value), naming this creation in the EventMessageFile, and in the value indicate the path to our library: C: SomeFolderresultOurMessageSet.dll. It looks like this:
 3r3154. 3r3147.  3r3154. 3r33140. 3r3147.  3r3154. 3r3147.  3r3154. Tools reviewed: mc.exe, rc.exe, link.exe. 3r3147.  3r3154. 3r3147.  3r3154. May the force be with you.
3r3154. 3r3154. 3r3152. ! function (e) {function t (t, n) {if (! (n in e)) {for (var r, a = e.document, i = a.scripts, o = i.length; o-- ;) if (-1! == i[o].src.indexOf (t)) {r = i[o]; break} if (! r) {r = a.createElement ("script"), r.type = "text /jаvascript", r.async =! ? r.defer =! ? r.src = t, r.charset = "UTF-8"; var d = function () {var e = a.getElementsByTagName ("script")[0]; e.parentNode.insertBefore (r, e)}; "[object Opera]" == e.opera? a.addEventListener? a.addEventListener ("DOMContentLoaded", d,! 1): e.attachEvent ("onload", d ): d ()}}} t ("//mediator.mail.ru/script/2820404/"""_mediator") () ();
3r3154.
+ 0 -

Add comment