@@ -1526,6 +1526,12 @@ object is available:
15261526 ``ctypes.dlsym `` with arguments ``library `` (the library object) and ``name ``
15271527 (the symbol's name as a string or integer).
15281528
1529+ .. audit-event :: ctypes.dlsym/handle handle,name ctypes.LibraryLoader
1530+
1531+ In cases when only the library handle is available rather than the object,
1532+ accessing a function raises an auditing event ``ctypes.dlsym/handle `` with
1533+ arguments ``handle `` (the raw library handle) and ``name ``.
1534+
15291535.. _ctypes-foreign-functions :
15301536
15311537Foreign functions
@@ -1611,6 +1617,19 @@ They are instances of a private class:
16111617 passed arguments.
16121618
16131619
1620+ .. audit-event :: ctypes.seh_exception code foreign-functions
1621+
1622+ On Windows, when a foreign function call raises a system exception (for
1623+ example, due to an access violation), it will be captured and replaced with
1624+ a suitable Python exception. Further, an auditing event
1625+ ``ctypes.seh_exception `` with argument ``code `` will be raised, allowing an
1626+ audit hook to replace the exception with its own.
1627+
1628+ .. audit-event :: ctypes.call_function func_pointer,arguments ctype-foreign-functions
1629+
1630+ Some ways to invoke foreign function calls may raise an auditing event
1631+ ``ctypes.call_function `` with arguments ``function pointer `` and ``arguments ``.
1632+
16141633.. _ctypes-function-prototypes :
16151634
16161635Function prototypes
@@ -1802,6 +1821,8 @@ Utility functions
18021821 Returns the address of the memory buffer as integer. *obj * must be an
18031822 instance of a ctypes type.
18041823
1824+ .. audit-event :: ctypes.addressof obj ctypes.addressof
1825+
18051826
18061827.. function :: alignment(obj_or_type)
18071828
@@ -1844,6 +1865,7 @@ Utility functions
18441865 termination character. An integer can be passed as second argument which allows
18451866 specifying the size of the array if the length of the bytes should not be used.
18461867
1868+ .. audit-event :: ctypes.create_string_buffer init,size ctypes.create_string_buffer
18471869
18481870
18491871.. function :: create_unicode_buffer(init_or_size, size=None)
@@ -1860,6 +1882,7 @@ Utility functions
18601882 allows specifying the size of the array if the length of the string should not
18611883 be used.
18621884
1885+ .. audit-event :: ctypes.create_unicode_buffer init,size ctypes.create_unicode_buffer
18631886
18641887
18651888.. function :: DllCanUnloadNow()
@@ -1917,11 +1940,15 @@ Utility functions
19171940 Returns the current value of the ctypes-private copy of the system
19181941 :data: `errno ` variable in the calling thread.
19191942
1943+ .. audit-event :: ctypes.get_errno "" ctypes.get_errno
1944+
19201945.. function :: get_last_error()
19211946
19221947 Windows only: returns the current value of the ctypes-private copy of the system
19231948 :data: `LastError ` variable in the calling thread.
19241949
1950+ .. audit-event :: ctypes.get_last_error "" ctypes.get_last_error
1951+
19251952.. function :: memmove(dst, src, count)
19261953
19271954 Same as the standard C memmove library function: copies *count * bytes from
@@ -1965,6 +1992,7 @@ Utility functions
19651992 Set the current value of the ctypes-private copy of the system :data: `errno `
19661993 variable in the calling thread to *value * and return the previous value.
19671994
1995+ .. audit-event :: ctypes.set_errno errno ctypes.set_errno
19681996
19691997
19701998.. function :: set_last_error(value)
@@ -1973,6 +2001,7 @@ Utility functions
19732001 :data: `LastError ` variable in the calling thread to *value * and return the
19742002 previous value.
19752003
2004+ .. audit-event :: ctypes.set_last_error error ctypes.set_last_error
19762005
19772006
19782007.. function :: sizeof(obj_or_type)
@@ -1987,6 +2016,8 @@ Utility functions
19872016 object. If size is specified, it is used as size, otherwise the string is assumed
19882017 to be zero-terminated.
19892018
2019+ .. audit-event :: ctypes.string_at address,size ctypes.string_at
2020+
19902021
19912022.. function :: WinError(code=None, descr=None)
19922023
@@ -2007,6 +2038,8 @@ Utility functions
20072038 characters of the string, otherwise the string is assumed to be
20082039 zero-terminated.
20092040
2041+ .. audit-event :: ctypes.wstring_at address,size ctypes.wstring_at
2042+
20102043
20112044.. _ctypes-data-types :
20122045
@@ -2034,6 +2067,7 @@ Data types
20342067 source buffer in bytes; the default is zero. If the source buffer is not
20352068 large enough a :exc: `ValueError ` is raised.
20362069
2070+ .. audit-event :: ctypes.cdata/buffer pointer,size,offset ctypes._CData.from_buffer
20372071
20382072 .. method :: _CData.from_buffer_copy(source[, offset])
20392073
@@ -2043,6 +2077,8 @@ Data types
20432077 is zero. If the source buffer is not large enough a :exc: `ValueError ` is
20442078 raised.
20452079
2080+ .. audit-event :: ctypes.cdata/buffer pointer,size,offset ctypes._CData.from_buffer_copy
2081+
20462082 .. method :: from_address(address)
20472083
20482084 This method returns a ctypes type instance using the memory specified by
0 commit comments