-
-
Notifications
You must be signed in to change notification settings - Fork 33.1k
gh-135852: Add NTEventLog related functions to _winapi #137860
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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 :)
Sorry, I forgot to check the CI result after the push. |
There was a problem hiding this 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?
Modules/_winapi.c
Outdated
PyObject *item = PyList_GetItem(strings, i); | ||
if (!PyUnicode_Check(item)) { | ||
PyMem_Free(string_array); | ||
PyErr_SetString(PyExc_TypeError, "All strings must be unicode"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"unicode" is a weird term. There is no longer type unicode
. I would suggest something like: "expected a list of strings, not %T"
.
Modules/_winapi.c
Outdated
// Handle raw data | ||
if (raw_data->buf != NULL) { | ||
data = raw_data->buf; | ||
data_size = (DWORD) raw_data->len; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible integer overflow.
Co-authored-by: Serhiy Storchaka <[email protected]>
Thanks for the view! I'll create another PR based on this to try to implement the whole feature in the original issue. |
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 implementNTEventLogHandler
. If we want add it in the future, we can add it as kwargs.Docuements for these functions:
logging.handlers.NTEventLogHandler
#135852