0

I wonder if there is any WinAPI that can replace the following function EventLog::Exists() and EventLog::CreateEventSource() so my code won't rely on the .NET Framework.
I will be very grateful if you can give me some advice!

#define PRINT_SOURCE_NAME "Microsoft-Windows-PrintService"  
#define PRINT_LOG_NAME "Microsoft-Windows-PrintService/Operational" 
BOOL bRet = EventLog::Exists(PRINT_LOG_NAME );
if (!bRet)
{
    EventLog::CreateEventSource(PRINT_SOURCE_NAME , PRINT_LOG_NAME );
}
ggurbet
  • 82
  • 12
user2709407
  • 460
  • 1
  • 4
  • 11

1 Answers1

0

The EventLog::CreateEventSource method is just a thin wrapper over editing the registry entries that control the event log. You can just access these entries directly without .Net by manipulating the registry.

The main entry is SYSTEM\CurrentControlSet\Services\EventLog and the sub keys represent the available logs. This MSDN entry has a detailed description of the various values and what they represent

JaredPar
  • 733,204
  • 149
  • 1,241
  • 1,454