Search code examples
c++winapieventlog-source

Windows event log service holding executable file handle


I have a service application that on startup and shutdown logs an event log record.

I rebuild the application frequently and also then the executable on the host machine. And here is the problem, after my service shutdown the Windows Eventlog service (not the event log viewer) is holding an open handle to the executable so I cant update it.

  • I have the event log messages embedded in the executable, i could move it out but then I just move the update problem to another file.

  • I've double checked and I have paired ::RegisterEventSource/::DeregisterEventSource correctly.

Anyone encountered this problem ?


Solution

  • I think it is probably the event log viewer. Close the viewer and you'll be fine.