Skip to content

Commit

Permalink
CFUNCTYPE --> WINFUNCTYPE to use stdcall for x86
Browse files Browse the repository at this point in the history
Use WINFUNCTYPE to ensure stdcall convention on x86 (32-bit) systems. Only spot testet on Windows 7 x86 and Windows 10 x64.

This fixes #377
  • Loading branch information
Oliver Wienand authored and boppreh committed Aug 1, 2020
1 parent 86d9a85 commit e277e3f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions keyboard/_winkeyboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# this would be simply #include "windows.h".

import ctypes
from ctypes import c_short, c_char, c_uint8, c_int32, c_int, c_uint, c_uint32, c_long, Structure, CFUNCTYPE, POINTER
from ctypes import c_short, c_char, c_uint8, c_int32, c_int, c_uint, c_uint32, c_long, Structure, WINFUNCTYPE, POINTER
from ctypes.wintypes import WORD, DWORD, BOOL, HHOOK, MSG, LPWSTR, WCHAR, WPARAM, LPARAM, LONG, HMODULE, LPCWSTR, HINSTANCE, HWND
LPMSG = POINTER(MSG)
ULONG_PTR = POINTER(DWORD)
Expand Down Expand Up @@ -89,7 +89,7 @@ class INPUT(ctypes.Structure):
_fields_ = (('type', DWORD),
('union', _INPUTunion))

LowLevelKeyboardProc = CFUNCTYPE(c_int, WPARAM, LPARAM, POINTER(KBDLLHOOKSTRUCT))
LowLevelKeyboardProc = WINFUNCTYPE(c_int, WPARAM, LPARAM, POINTER(KBDLLHOOKSTRUCT))

SetWindowsHookEx = user32.SetWindowsHookExW
SetWindowsHookEx.argtypes = [c_int, LowLevelKeyboardProc, HINSTANCE , DWORD]
Expand Down

0 comments on commit e277e3f

Please sign in to comment.