0

Hello I want to write a program that a part of it would read event logs and notify user about it if something important happened.

As I understand, because so many logs are recorded, windows uses EventMessageFiles(and maybe CategoryMessageFile, and ParameterMessageFile) to reduce the size of logs. Possible event Ids, the descrioption associated with them, the parameters needed and how they are used in description and maybe other things are specified in these files. I want to read these files to be prepared, to know which eventIds are important and how I should notify user about them.

For example suppose I want to read google chromes event message file. I think the closest I got to it was when I tried this:

    import win32api,win32con

    eventmessagefile_addr = "C:\\Program 
    Files\\Google\\Chrome\\Application\\73.0.3683.103\\eventlog_provider.dll"

    eventmessagefile_handle = win32api.LoadLibraryEx(eventmessagefile_addr,None,win32con.LOAD_LIBRARY_AS_DATAFILE)

    resource_types = win32api.EnumResourceTypes(eventmessagefile_handle)  # 
    resource_types = [11,16]

    resorce11 = win32api.EnumResourceNames(lbl,"#11") # I don't know what this means but resource11 = [1]

    data= win32api.LoadResource(lbl,"#11",1) # now this gives me some bytes that I have no idea what they are and data.decode('utf-8') fails.

So how should i read these dll files.

PS: python is preferred but c++ and c# are okay too.

xyu
  • 1
  • 1

1 Answers1

0

Resource type 11 is message table.

A MESSAGE_RESOURCE_DATA structure can contain one or more MESSAGE_RESOURCE_BLOCK structures, which can each contain one or more MESSAGE_RESOURCE_ENTRY structures.

Anders
  • 97,548
  • 12
  • 110
  • 164