msl.examples.loadlib.kernel32 module

A wrapper around the 32-bit Windows kernel32.dll library.

Example of a server that loads a 32-bit Windows library, kernel32.dll, in a 32-bit Python interpreter to host the library. The corresponding kernel64 module can be executed by a 64-bit Python interpreter and the Kernel64 class can send a request to the Kernel32 class which calls the 32-bit library to execute the request and then return the response from the library.

Kernel32 is the 32-bit server and Kernel64 is the 64-bit client for inter-process communication.

Note

The kernel32.dll library is a standard Windows library and therefore this example is only valid on a Windows computer.

class msl.examples.loadlib.kernel32.Kernel32(host, port, **kwargs)

Bases: Server32

Example of a class that is a wrapper around the Windows 32-bit kernel32.dll library.

Parameters:
  • host (str) – The IP address (or hostname) to use for the server.

  • port (int) – The port to open for the server.

  • kwargs (str) – Optional keyword arguments. The keys and values are of type str.

get_time()

Calls the kernel32.GetLocalTime function to get the current date and time.

See the corresponding 64-bit get_local_time() method.

Returns:

The current date and time.

Return type:

datetime

class msl.examples.loadlib.kernel32.SystemTime

Bases: Structure

Example of creating a ctypes.Structure.

See SYSTEMTIME for a description of the struct.

WORD

alias of c_ushort

wDay

Structure/Union member

wDayOfWeek

Structure/Union member

wHour

Structure/Union member

wMilliseconds

Structure/Union member

wMinute

Structure/Union member

wMonth

Structure/Union member

wSecond

Structure/Union member

wYear

Structure/Union member