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)[source]

Bases: Server32

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

Parameters:
  • host (str) – The IP address of the server.

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

Note

Any class that is a subclass of Server32 MUST provide two arguments in its constructor: host and port (in that order) and **kwargs. Otherwise the server32 executable, see start_server32, cannot create an instance of the Server32 subclass.

get_time()[source]

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

See the corresponding 64-bit get_local_time() method.

Returns:

datetime – The current date and time.

class msl.examples.loadlib.kernel32.SystemTime[source]

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