The zugbruecke.CtypesSession class
- class zugbruecke.CtypesSession(**kwargs)
Represents one “ctypes session”, i.e. one Wine Python process, related infrastructure and its independent configuration. Mutliple sessions can run simultaneously. Mutable.
- Parameters
kwargs (
Any) – An arbitrary number of keyword arguments matching valid configuration parameters
- exception ArgumentError
- class Array
XXX to be provided
- class BigEndianStructure
Structure with big endian byte order
- CDLL(name, mode=0, handle=None, use_errno=False, use_last_error=False, winmode=None)
zugbrueckedrop-in replacement forctypes.CDLL- Parameters
name (
str) – Pathname of the shared library (DLL file)mode (
int) – Ignored on Windows, therefore ignored byzugbrueckehandle (
Optional[Any]) – Ignored byzugbruecke, see issue #54use_errno (
bool) – Enables actypesmechanism that allows accessing the system errno error number in a safe way.use_last_error (
bool) – Enables the same mechanism for the Windows error code which is managed by theGetLastError()andSetLastError()Windows API functions.winmode (
Optional[int]) – Ignored byzugbruecke. Used on Windows to specify how the library is loaded (since mode is ignored)
- CFUNCTYPE(restype, *argtypes, use_errno=False, use_last_error=False)
zugbrueckedrop-in replacement forctypes.CFUNCTYPE- Parameters
restype (
Any) – ctypes type of return valueargtypes (
Any) – ctypes types of argumentsuse_errno (
bool) – If true, the ctypes private copy of the system errno variable is exchanged with the real errno value before and after the call.use_last_error (
bool) – Does the same for the Windows error code.
- Return type
Type
- static DllCanUnloadNow()
Stub, not implemented. Required for COM.
- static DllGetClassObject(rclsid, riid, ppv)
Stub, not implemented. Required for COM.
- FormatError(*args, **kwargs)
zugbrueckewrapper forctypes.FormatError, untested.- Parameters
args (
Any) – positional argumentskwargs (
Any) – keyword arguments
- Return type
Any- Returns
A textual description of the error code code. If no error code is specified, the last error code is used by calling the Windows api function GetLastError.
- GetLastError(*args, **kwargs)
zugbrueckewrapper forctypes.GetLastError, untested.- Parameters
args (
Any) – positional argumentskwargs (
Any) – keyword arguments
- Return type
Any- Returns
The last error code set by Windows in the calling thread. This function calls the Windows
GetLastError()function directly, it does not return the ctypes-private copy of the error code.
- class HRESULT(*args, **kwargs)
Stub, not implemented. Required for COM. Special form of
ctypes.c_long(32 bit).- Parameters
args (
Any) – positional argumentskwargs (
Any) – keyword arguments
- OleDLL(name, mode=0, handle=None, use_errno=False, use_last_error=False, winmode=None)
zugbrueckedrop-in replacement forctypes.CDLL- Parameters
name (
str) – Pathname of the shared library (DLL file)mode (
int) – Ignored on Windows, therefore ignored byzugbrueckehandle (
Optional[Any]) – Ignored byzugbruecke, see issue #54use_errno (
bool) – Enables actypesmechanism that allows accessing the system errno error number in a safe way.use_last_error (
bool) – Enables the same mechanism for the Windows error code which is managed by theGetLastError()andSetLastError()Windows API functions.winmode (
Optional[int]) – Ignored byzugbruecke. Used on Windows to specify how the library is loaded (since mode is ignored)
- PyDLL(name, mode=0, handle=None, use_errno=False, use_last_error=False, winmode=None)
Stub, not implemented.
zugbrueckedrop-in replacement forctypes.PyDLL- Parameters
name (
str) – Pathname of the shared library (DLL file)mode (
int) – Ignored on Windows, therefore ignored byzugbrueckehandle (
Optional[Any]) – Ignored byzugbruecke, see issue #54use_errno (
bool) – Enables actypesmechanism that allows accessing the system errno error number in a safe way.use_last_error (
bool) – Enables the same mechanism for the Windows error code which is managed by theGetLastError()andSetLastError()Windows API functions.winmode (
Optional[int]) – Ignored byzugbruecke. Used on Windows to specify how the library is loaded (since mode is ignored)
- class Structure
Structure base class
- class Union
Union base class
- WINFUNCTYPE(restype, *argtypes, use_errno=False, use_last_error=False)
zugbrueckedrop-in replacement forctypes.WINFUNCTYPE- Parameters
restype (
Any) – ctypes type of return valueargtypes (
Any) – ctypes types of argumentsuse_errno (
bool) – If true, the ctypes private copy of the system errno variable is exchanged with the real errno value before and after the call.use_last_error (
bool) – Does the same for the Windows error code.
- Return type
Type
- WinDLL(name, mode=0, handle=None, use_errno=False, use_last_error=False, winmode=None)
zugbrueckedrop-in replacement forctypes.WinDLL- Parameters
name (
str) – Pathname of the shared library (DLL file)mode (
int) – Ignored on Windows, therefore ignored byzugbrueckehandle (
Optional[Any]) – Ignored byzugbruecke, see issue #54use_errno (
bool) – Enables actypesmechanism that allows accessing the system errno error number in a safe way.use_last_error (
bool) – Enables the same mechanism for the Windows error code which is managed by theGetLastError()andSetLastError()Windows API functions.winmode (
Optional[int]) – Ignored byzugbruecke. Used on Windows to specify how the library is loaded (since mode is ignored)
- WinError(*args, **kwargs)
zugbrueckewrapper forctypes.WinError, untested.This function is probably the worst-named thing in ctypes.
- Parameters
args (
Any) – positional argumentskwargs (
Any) – keyword arguments
- Return type
Any- Returns
An instance of
OSError.
- __enter__()
Context manager entry point for
zugbrueckesession.- Return type
CtypesSessionABC
- __exit__(exc_type, exc_value, traceback)
Context manager exit point for
zugbrueckesession.- Parameters
exc_type (
Optional[Type]) – Type of exceptionexc_value (
Optional[Exception]) – Actual exception objecttraceback (
Optional[traceback]) – Related traceback object
- __repr__()
zugbrueckesession string representation for interactive use- Return type
str
- static addressof(C instance) integer
Return the address of the C instance internal buffer
- static alignment(C type) integer
- static alignment(C instance) integer
Return the alignment requirements of a C instance
- static byref(C instance[, offset=0]) byref-object
Return a pointer lookalike to a C instance, only usable as function argument
- class c_bool
- class c_byte
- class c_char
- class c_double
- class c_float
- class c_int
- class c_long
- class c_longdouble
- class c_short
- class c_ubyte
- class c_uint
- class c_ulong
- class c_ushort
- class c_wchar
- property cdll: LibraryLoader
zugbrueckedrop-in replacement forLibraryLoader(CDLL)akactypes.cdll- Return type
LibraryLoader
- static create_string_buffer(aBytes) character array
- static create_string_buffer(anInteger) character array
- static create_string_buffer(aBytes, anInteger) character array
- static create_unicode_buffer(aString) character array
- static create_unicode_buffer(anInteger) character array
- static create_unicode_buffer(aString, anInteger) character array
- get_last_error(*args, **kwargs)
zugbrueckewrapper forctypes.get_last_error, untested.- Parameters
args (
Any) – positional argumentskwargs (
Any) – keyword arguments
- Return type
Any- Returns
The current value of the ctypes-private copy of the system
LastErrorvariable in the calling thread.
- property oledll: LibraryLoader
zugbrueckedrop-in replacement forLibraryLoader(OleDLL)akactypes.oledll- Return type
LibraryLoader
- class py_object
- property pydll: LibraryLoader
zugbrueckedrop-in replacement forLibraryLoader(PyDLL)akactypes.pydll- Return type
LibraryLoader
- static resize()
Resize the memory buffer of a ctypes instance
- set_last_error(*args, **kwargs)
zugbrueckewrapper forctypes.set_last_error, untested.Set the current value of the ctypes-private copy of the system
LastErrorvariable in the calling thread to valueself.- Parameters
args (
Any) – positional argumentskwargs (
Any) – keyword arguments
- Return type
Any- Returns
The previous value.
- static sizeof(C type) integer
- static sizeof(C instance) integer
Return the size in bytes of a C instance
- static string_at(addr[, size]) string
Return the string at addr.
- property util: _util
Regular
ctypeshas a submodule namedctypes.util. Inzugbruecke, this functionality is bound to a session. On a per-session level, it is exposed via this attribute.- Return type
_util- Returns
Drop-in replacement for
ctypes.util. Offerszugbrueckewrappers forfind_libraryandfind_msvcrt.
- property windll: LibraryLoader
zugbrueckedrop-in replacement forLibraryLoader(WinDLL)akactypes.windll- Return type
LibraryLoader
- static wstring_at(addr[, size]) string
Return the string at addr.
- property zb_client_up: bool
Client status
- Return type
bool
- zb_get_parameter(key)
Reads configuration parameter of this session
- Parameters
key (
str) – Name of configuration parameter- Return type
Any- Returns
Value for configuration parameter
- property zb_id: str
Session ID string
- Return type
str
- zb_path_unix_to_wine(path)
Path conversion, Unix to Windows/Wine. It uses Wine’s internal implementation for path conversions. It does not check, whether the path actually exists or not.
- Parameters
path (
str) – Unix path. Path can be absolute or relative.- Return type
str- Returns
Windows/Wine path
- zb_path_wine_to_unix(path)
Path conversion, Windows/Wine to Unix. It uses Wine’s internal implementation for path conversions. It does not check, whether the path actually exists or not.
- Parameters
path (
str) – Windows/Wine path. Path can be absolute or relative.- Return type
str- Returns
Unix path
- property zb_server_up: bool
Server status
- Return type
bool
- zb_set_parameter(key, value)
Changes configuration parameter of this session (both on Unix/client and Wine/server side)
- Parameters
key (
str) – Name of configuration parametervalue (
Any) – New value for configuration parameter
- zb_terminate()
This method can be used to manually terminate a session. It will quit the Windows Python interpreter running in the background. Once terminated, a session can not be re-started. Any handles on DLLs and their routines derived from this session will become useless.