1

I want to implement the event logging as specified in the link below

http://msdn.microsoft.com/en-us/library/windows/desktop/aa363680(v=vs.85).aspx

I can successfully create a provider.rc, provider.h and provider.res as it is.

But when I try create the link -dll -noentry provider.res it gives me the following error

Microsoft (R) Incremental Linker Version 10.00.30319.01 Copyright (C) Microsoft Corporation. All rights reserved.

LINK : warning LNK4068: /MACHINE not specified; defaulting to X86 LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt

I even tried the command below

link /MACHINE:X64 -dll -noentry provider.res

Still gave this error

LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt

If this is of any use I used Windows Server 2008 R2 64 bit OS.

Edit: I have also tried the following method provided in the link.

http://msdn.microsoft.com/en-us/library/24b2tcy0.aspx

It uses .rc file i have previously generated using mc command.

specified both NO INCREMENTAL and NO ENTRY option as specified.

Still not working. Gives the following error

Build started 3/5/2014 11:50:16 AM. InitializeBuildStatus: Touching "Debug\evtlog.unsuccessfulbuild". ClCompile: All outputs are up-to-date. All outputs are up-to-date. ResourceCompile: All outputs are up-to-date.

evtlog.obj : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt

Build FAILED.

Time Elapsed 00:00:00 ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

suryakrish
  • 132
  • 1
  • 11
  • I tried the example from the link you provided and while I saw the same warning about /MACHINE, the application compiled and linked and ran in debug mode. I checked the application event log and could see my events. I used Visual Studio 2005 on Windows XP. The application was a Windows console application. I did have to make changes to the Properties of the .mc file to add the commands for mc, rc, and link. I added windows.h and the generated .h file from the mc command to the main source file. see also http://msdn.microsoft.com/en-us/library/windows/hardware/hh825934(v=vs.85).aspx – Richard Chambers Mar 04 '14 at 13:57
  • Also see if this may be your problem http://stackoverflow.com/questions/10888391/error-link-fatal-error-lnk1123-failure-during-conversion-to-coff-file-inval – Richard Chambers Mar 04 '14 at 14:01
  • I used Visual Studio 2010 command prompt then I used using the Visual 2010 to create a new windows console application but I dont get to see the MESSAGE COMPILER in Configuration properties. I even tried this command **link /INCREMENTAL:NO /MACHINE:X64 -dll -noentry provider.res** it didnt work – suryakrish Mar 05 '14 at 05:21
  • I did the following. created new windows console project in 2005. copied and pasted the source code into same file as the main. added new a .mc file. copied and pasted the mc source into the .mc file. opened Properties on the .mc file, added custom build step for mc, rc, and link using $(InputName) macro. added to stdafx.h include files for Windows.h, stdio.h. put include for .h file generated by mc into the main below include of stdafx.h. The difference may be I am on Windows XP 32 bit with visual studio 2005. 32 bit versus 64 bit. It was simpler than I thought. – Richard Chambers Mar 05 '14 at 13:24
  • I am new to this I don't know how to add custom build step for VS2010. – suryakrish Mar 05 '14 at 14:03
  • Where do i add the macro you suggested. http://i.imgur.com/d8yAE2h.png – suryakrish Mar 05 '14 at 14:11
  • To add a custom build step for a particular file you can select the file then do a right mouse click and then select the Properties menu item from the displayed menu. for a .mc file about the only thing you can do is to add a custom build step. you can then modify the Command Line to enter a series of commands. when you bring up the Command Line dialog that lets you enter a series of command lines there should be a button that says Macros>> that will allow you to insert macros that act like variables which will be replaced by actual values when the command line is executed. – Richard Chambers Mar 05 '14 at 14:48

0 Answers0