pywincffi.wintypes package

Submodules

pywincffi.wintypes.functions module

Functions

This module provides various functions for converting and using Windows types.

pywincffi.wintypes.functions.handle_from_file(file_)[source]

Converts a standard Python file object into a HANDLE object.

Warning

This function is mainly intended for internal use. Passing in a file object with an invalid file descriptor may crash your interpreter.

Parameters:file (file) – The Python file object to convert to a HANDLE object.
Raises:InputError – Raised if file_ does not appear to be a file object or is currently closed.
Return type:HANDLE
pywincffi.wintypes.functions.wintype_to_cdata(wintype)[source]

Returns the underlying CFFI cdata object or ffi.NULL if wintype is None. Used internally in API wrappers to “convert” pywincffi’s Python types to the required CFFI cdata objects when calling CFFI functions. Example:

>>> from pywincffi.core import dist
>>> from pywincffi.kernel32 import CreateEvent
>>> from pywincffi.wintypes import wintype_to_cdata
>>> ffi, lib = dist.load()
>>> # Get an event HANDLE, using the wrapper: it's a Python HANDLE object.
>>> hEvent = CreateEvent(False, False)
>>> # Call ResetEvent directly without going through the wrapper:
>>> hEvent_cdata = wintype_to_cdata(hEvent)
>>> result = lib.ResetEvent(hEvent_cdata)
Parameters:wintype – A type derived from pywincffi.core.typesbase.CFFICDataWrapper
Returns:The underlying CFFI <cdata> object, or ffi.NULL if wintype is None.

pywincffi.wintypes.objects module

Objects

Provides wrappers around core Windows objects such as file handles, sockets, etc.

class pywincffi.wintypes.objects.HANDLE(data=None)[source]

Bases: pywincffi.core.typesbase.CFFICDataWrapper, pywincffi.wintypes.objects.ObjectMixin

class pywincffi.wintypes.objects.ObjectMixin[source]

Bases: object

A mixin which is used by object classes to share common code.

pywincffi.wintypes.structures module

Structures

This module provides wrappers for structures produced or required by the Windows APIs.

class pywincffi.wintypes.structures.FILETIME[source]

Bases: pywincffi.core.typesbase.CFFICDataWrapper

class pywincffi.wintypes.structures.OVERLAPPED[source]

Bases: pywincffi.core.typesbase.CFFICDataWrapper

hEvent
class pywincffi.wintypes.structures.SECURITY_ATTRIBUTES[source]

Bases: pywincffi.core.typesbase.CFFICDataWrapper

nLength

Module contents

Windows Types Package

Provides user accessible types corresponding to the respective Windows types used across the exposed APIs.