Skip to content

Conversation

aisk
Copy link
Contributor

@aisk aisk commented Aug 16, 2025

Please note that the lpUserSid parameter in ReportEvent don't added because it needs passing a new struct from Python to it, and we don't need this parameter for the usage of implement NTEventLogHandler. If we want add it in the future, we can add it as kwargs.

Docuements for these functions:

For the NTEventLogHandler, there is a implementation detail:

The old implementation based on pywin32, if dllname is not specified, pywin32 will using a vendored dll in that package, as a log template for the NT event log system.

For the new implement in this PR, if the dllname is not specified, I decided not to register the dll. As a result, the log still can be send to the NT Event Log System, we can see it in the Event Viewer.

But the event will show some thing like this (I just use a picture from the Internet because I'm using a localized Windows which the text is Chinese but they are the same thing):

3dcfe02f31b83fb2ddbe167ee871f91278a8885c_2_571x500

And I think it's OK because we can check the Detail tab to see the original message, for develop purpose this is enough. For users with production usage, they can provide their own dlls as the message template.

{2AD0DB7D-2BDC-4C4F-ABFF-064BD3787642}

Copy link
Contributor

@sharktide sharktide left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the test fails :)

@aisk
Copy link
Contributor Author

aisk commented Aug 18, 2025

Sorry, I forgot to check the CI result after the push.

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your PR @aisk. It look interesting.

Could you please show how can this be used in NTEventLogHandler? Maybe not in this PR, but in a separate PR created on top of this?

@aisk aisk marked this pull request as draft September 8, 2025 15:52
@aisk aisk marked this pull request as ready for review September 9, 2025 17:27
@aisk
Copy link
Contributor Author

aisk commented Sep 9, 2025

Thank you for your PR @aisk. It look interesting.

Could you please show how can this be used in NTEventLogHandler? Maybe not in this PR, but in a separate PR created on top of this?

Thanks for the view! I'll create another PR based on this to try to implement the whole feature in the original issue.

@aisk aisk requested a review from vsajip as a code owner October 19, 2025 14:39
@aisk aisk changed the title gh-135852: Add NTEventLog related functions to _winapi gh-135852: Remove out of tree pywin32 dependency for NTEventLogHandler Oct 19, 2025
@aisk
Copy link
Contributor Author

aisk commented Oct 19, 2025

@serhiy-storchaka Hi, I found that using this in NTEventLogHandler to replace pywin32 is very simple, so I push it directly on this branch, and also added some information on the top of this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants