├── km ├── __init__.py ├── abi │ └── __init__.py ├── crt │ ├── __init__.py │ ├── sys │ │ └── __init__.py │ ├── string_h.py │ ├── stdarg_h.py │ ├── time_h.py │ ├── cstddef │ ├── limits_h.py │ ├── _70_xstddef │ ├── xstddef │ ├── stdlib_h.py │ ├── exception │ ├── new │ └── excpt_h.py ├── spb │ ├── __init__.py │ └── 1_0 │ │ └── __init__.py ├── ucm │ ├── __init__.py │ └── 1_0 │ │ └── __init__.py ├── ucx │ ├── __init__.py │ ├── 1_1 │ │ └── __init__.py │ ├── 1_2 │ │ └── __init__.py │ ├── 1_3 │ │ └── __init__.py │ └── 1_4 │ │ └── __init__.py ├── ude │ ├── __init__.py │ └── 1_0 │ │ └── __init__.py ├── ufx │ ├── __init__.py │ └── 1_1 │ │ └── __init__.py ├── urs │ ├── __init__.py │ └── 1_0 │ │ └── __init__.py ├── UcmTcpci │ ├── __init__.py │ └── 1_0 │ │ └── __init__.py ├── sercx │ ├── __init__.py │ ├── 1_0 │ │ └── __init__.py │ └── 2_0 │ │ └── __init__.py ├── wlan │ ├── 1_0 │ │ └── __init__.py │ └── __init__.py ├── netadaptercx │ ├── __init__.py │ ├── 1_0 │ │ └── __init__.py │ ├── 1_1 │ │ └── __init__.py │ └── 1_2 │ │ └── __init__.py ├── d4iface_h.py ├── rxtypes_h.py ├── amtvuids_h.py ├── struchdr_h.py ├── rxtimer_h.py ├── sdpnode_h.py ├── bthxddi_h.py ├── rxdata_h.py └── ksdebug_h.py ├── shared ├── __init__.py ├── ipv6prefast_h.py ├── initguid_h.py ├── usb200_h.py ├── afunix_h.py ├── pshpack1_h.py ├── pshpack2_h.py ├── pshpck16_h.py ├── apdevpkey_h.py ├── pshpack4_h.py ├── pshpack8_h.py ├── poppack_h.py ├── unexposeenums2managed_h.py ├── in6addr_h.py ├── usbprint_h.py ├── atsmedia_h.py ├── inaddr_h.py ├── usbdi_h.py ├── cderr_h.py ├── gpio_h.py ├── apisetcconv_h.py ├── exposeenums2managed_h.py ├── minwindef_h.py ├── winusbio_h.py ├── nettypes_h.py ├── tvout_h.py ├── clfslsn_h.py └── winpackagefamily_h.py ├── ucrt ├── __init__.py └── sys │ └── __init__.py ├── um ├── __init__.py ├── abi │ └── __init__.py ├── gl │ └── __init__.py ├── nfc │ ├── __init__.py │ └── 1_0 │ │ └── __init__.py ├── pos │ ├── __init__.py │ └── 1_1 │ │ └── __init__.py ├── qcc │ ├── __init__.py │ └── windows │ │ └── __init__.py ├── ucm │ ├── __init__.py │ └── 1_0 │ │ └── __init__.py ├── wrl │ └── __init__.py ├── iddcx │ ├── __init__.py │ ├── 1_0 │ │ └── __init__.py │ ├── 1_2 │ │ └── __init__.py │ └── 1_3 │ │ └── __init__.py ├── mincore │ └── __init__.py ├── minwin │ └── __init__.py ├── sensors │ ├── __init__.py │ └── 1_1 │ │ └── __init__.py ├── alljoyn_c │ └── __init__.py ├── winsqlite │ └── __init__.py ├── adojet_h.py ├── adoid_h.py ├── adsdb_h.py ├── activeds_h.py ├── adoguids_h.py ├── portabledeviceconnectimports_h.py ├── activecf_h.py ├── propkeydef_h.py ├── objerror_h.py ├── audioapotypes_h.py ├── uiautomation_h.py ├── audioendpoints_h.py ├── socketapi_h.py ├── servprov_h.py ├── lmuseflg_h.py ├── adodef_h.py ├── lmon_h.py ├── propapi_h.py ├── accountssettingspaneinterop_h.py ├── playto_h.py ├── vptype_h.py ├── unknwn_h.py ├── errors_h.py ├── audiomediatype_h.py ├── cguid_h.py ├── lm_h.py ├── spapidef_h.py ├── adc_h.py ├── adsnms_h.py ├── lmconfig_h.py ├── lmapibuf_h.py ├── timeapi_h.py ├── lmmsg_h.py ├── lmsname_h.py ├── mfgphone_h.py └── mfgrl_h.py ├── winrt ├── __init__.py ├── wrl │ ├── __init__.py │ └── wrappers │ │ └── __init__.py ├── asyncinfo_h.py ├── hstring_h.py └── inspectable_h.py ├── cppwinrt ├── __init__.py └── winrt │ ├── __init__.py │ └── impl │ └── __init__.py ├── .gitignore ├── stat_gen.py ├── code_converter ├── utils.py ├── includes.py ├── sort_code.py └── importer.py ├── README.md └── overloaded_methods.py /km/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /km/abi/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /km/crt/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /km/spb/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /km/ucm/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /km/ucx/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /km/ude/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /km/ufx/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /km/urs/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /shared/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ucrt/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /um/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /um/abi/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /um/gl/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /um/nfc/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /um/pos/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /um/qcc/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /um/ucm/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /um/wrl/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /winrt/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /cppwinrt/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /km/UcmTcpci/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /km/crt/sys/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /km/sercx/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /km/spb/1_0/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /km/ucm/1_0/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /km/ucx/1_1/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /km/ucx/1_2/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /km/ucx/1_3/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /km/ucx/1_4/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /km/ude/1_0/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /km/ufx/1_1/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /km/urs/1_0/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /km/wlan/1_0/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /km/wlan/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ucrt/sys/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /um/iddcx/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /um/mincore/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /um/minwin/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /um/nfc/1_0/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /um/pos/1_1/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /um/sensors/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /um/ucm/1_0/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /winrt/wrl/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /cppwinrt/winrt/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /km/UcmTcpci/1_0/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /km/netadaptercx/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /km/sercx/1_0/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /km/sercx/2_0/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /um/alljoyn_c/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /um/iddcx/1_0/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /um/iddcx/1_2/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /um/iddcx/1_3/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /um/qcc/windows/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /um/sensors/1_1/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /um/winsqlite/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /cppwinrt/winrt/impl/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /km/netadaptercx/1_0/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /km/netadaptercx/1_1/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /km/netadaptercx/1_2/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /winrt/wrl/wrappers/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /um/adojet_h.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | -------------------------------------------------------------------------------- /um/adoid_h.py: -------------------------------------------------------------------------------- 1 | 2 | from winapifamily_h import * # NOQA 3 | from adodef_h import * # NOQA 4 | from adoguids_h import * # NOQA 5 | 6 | -------------------------------------------------------------------------------- /um/adsdb_h.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | import ntdef_h 4 | 5 | 6 | from winapifamily_h import * # NOQA 7 | DBPROPFLAGS_ADSISEARCH = 0x0000C000 8 | 9 | __all__ = ( 10 | 'DBPROPFLAGS_ADSISEARCH', 11 | ) 12 | -------------------------------------------------------------------------------- /km/crt/string_h.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | from wtypes_h import ( 4 | NULL, 5 | ) 6 | import ntdef_h 7 | 8 | 9 | from crtdefs_h import * # NOQA 10 | _NLSCMPERROR = 0x7FFFFFFF 11 | wcswcs = wcsstr 12 | 13 | __all__ = ( 14 | 'wcswcs', '_NLSCMPERROR', 15 | ) 16 | -------------------------------------------------------------------------------- /km/crt/stdarg_h.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | import ntdef_h 4 | 5 | 6 | from crtdefs_h import * # NOQA 7 | from vadefs_h import * # NOQA 8 | va_start = _crt_va_start 9 | va_arg = _crt_va_arg 10 | va_end = _crt_va_end 11 | 12 | __all__ = ( 13 | 'va_arg', 'va_end', 'va_start', 14 | ) 15 | -------------------------------------------------------------------------------- /um/activeds_h.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | import ntdef_h 4 | 5 | 6 | from winapifamily_h import * # NOQA 7 | from iads_h import * # NOQA 8 | from adshlp_h import * # NOQA 9 | from adserr_h import * # NOQA 10 | from adsiid_h import * # NOQA 11 | from adssts_h import * # NOQA 12 | from adsnms_h import * # NOQA 13 | from adsdb_h import * # NOQA 14 | 15 | __all__ = ( 16 | 17 | ) 18 | -------------------------------------------------------------------------------- /shared/ipv6prefast_h.py: -------------------------------------------------------------------------------- 1 | from pyWinAPI import * 2 | 3 | # /* + + Copyright (c) 2005 Microsoft Corporation Module Name: ipv6prefast.h 4 | # Abstract: Provides control over IPv6 - related PREfast warnings. Revision 5 | # History: - - 6 | _PREFAST_ = 1 7 | IPV6_PREFAST_SAFE = 1 8 | if defined(_PREFAST_) and defined(IPV6_PREFAST_SAFE): 9 | pass 10 | # END IF _PREFAST_ ... 11 | -------------------------------------------------------------------------------- /um/adoguids_h.py: -------------------------------------------------------------------------------- 1 | 2 | from guiddef_h import DEFINE_GUID 3 | 4 | 5 | def STRING_GUID(l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8): 6 | pass 7 | # return l##-##w1##-##w2##-##b1##b2##-##b3##b4##b5##b6##b7##b8 8 | 9 | 10 | def GUID_BUILDER(l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8): 11 | return DEFINE_GUID(l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) 12 | 13 | 14 | from adogpool_h import * # NOQA 15 | 16 | __all__ = ( 17 | 'STRING_GUID', 'GUID_BUILDER', 18 | ) 19 | -------------------------------------------------------------------------------- /um/portabledeviceconnectimports_h.py: -------------------------------------------------------------------------------- 1 | 2 | from pyWinAPI import * 3 | 4 | # ************************************************************************** 5 | # Copyright (c) Microsoft Corporation. All rights reserved. 6 | # ************************************************************************* 7 | if defined(MIDL_PASS): 8 | from from pyWinAPI.shared.devpropdef_h import * # NOQA 9 | 10 | # WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) 11 | # END IF MIDL_PASS 12 | -------------------------------------------------------------------------------- /shared/initguid_h.py: -------------------------------------------------------------------------------- 1 | from pyWinAPI import * 2 | 3 | # ***************************************************************************\ 4 | # * * * initguid.h - Definitions for controlling GUID initialization * * * 5 | # * OLE Version 2.0 * * * * Copyright (c) Microsoft Corporation. All rights 6 | # reserved. * * * 7 | # \*************************************************************************** 8 | if _MSC_VER > 1000: 9 | pass 10 | # END IF 11 | 12 | INITGUID = 1 13 | 14 | from guiddef_h import * # NOQA 15 | 16 | -------------------------------------------------------------------------------- /shared/usb200_h.py: -------------------------------------------------------------------------------- 1 | from pyWinAPI import * 2 | 3 | # Copyright (C) Microsoft. All rights reserved. 4 | __USB200_H__ = None 5 | if not defined(__USB200_H__): 6 | __USB200_H__ = 1 7 | 8 | from pyWinAPI.shared.winapifamily_h import * # NOQA 9 | 10 | if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM): 11 | from pyWinAPI.shared.usbspec_h import * # NOQA 12 | # END IF WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM) 13 | # END IF __USB200_H__ 14 | -------------------------------------------------------------------------------- /um/activecf_h.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | from wtypes_h import ( 4 | UINT, 5 | CLSID, 6 | ) 7 | import ctypes 8 | import ntdef_h 9 | 10 | 11 | from winapifamily_h import * # NOQA 12 | CFSTR_VFW_FILTERLIST = "Video for Windows 4 Filters" 13 | 14 | class tagVFW_FILTERLIST(ctypes.Structure): 15 | _fields_ = [ 16 | ('cFilters', UINT), 17 | ('aClsId', CLSID * 1), 18 | ] 19 | 20 | 21 | VFW_FILTERLIST = tagVFW_FILTERLIST 22 | 23 | 24 | 25 | __all__ = ( 26 | 'CFSTR_VFW_FILTERLIST', 'VFW_FILTERLIST', 'tagVFW_FILTERLIST', 27 | ) 28 | -------------------------------------------------------------------------------- /um/propkeydef_h.py: -------------------------------------------------------------------------------- 1 | 2 | from shared.wtypes_h import PROPERTYKEY 3 | from shared.guiddef_h import GUID, IsEqualIID 4 | 5 | PID_FIRST_USABLE = 0x2 6 | 7 | REFPROPERTYKEY = PROPERTYKEY 8 | 9 | 10 | def DEFINE_PROPERTYKEY(l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8, pid): 11 | return PROPERTYKEY( 12 | GUID(l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8), 13 | pid 14 | ) 15 | 16 | 17 | def IsEqualPropertyKey(a, b): 18 | return (a.pid == b.pid) and IsEqualIID(a.fmtid, b.fmtid) 19 | 20 | 21 | __all__ = ( 22 | 'REFPROPERTYKEY', 'DEFINE_PROPERTYKEY', 'IsEqualPropertyKey', 23 | 'PID_FIRST_USABLE', 24 | ) 25 | -------------------------------------------------------------------------------- /um/objerror_h.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | from pyWinAPI import * 3 | from pyWinAPI.shared.wtypes_h import * 4 | from pyWinAPI.shared.sdkddkver_h import * 5 | from pyWinAPI.shared.guiddef_h import * 6 | 7 | 8 | # + --------------------------------------------------------------------------- 9 | # Microsoft Windows 10 | # Copyright (c) Microsoft Corporation. All rights reserved. 11 | # File: objerror.h 12 | # ---------------------------------------------------------------------------- 13 | if _MSC_VER > 1000: 14 | pass 15 | # END IF 16 | 17 | 18 | from pyWinAPI.shared.winapifamily_h import * # NOQA 19 | if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP): 20 | from pyWinAPI.shared.winerror_h import * # NOQA 21 | # END IF WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) 22 | 23 | 24 | -------------------------------------------------------------------------------- /km/crt/time_h.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | from wtypes_h import ( 4 | NULL, 5 | INT, 6 | UINT, 7 | LONG, 8 | INT64, 9 | SIZE_T 10 | ) 11 | import ctypes 12 | 13 | 14 | from crtdefs_h import * # NOQA 15 | from crtdefs_h import * # NOQA 16 | _time32_t = LONG 17 | _time64_t = INT64 18 | time_t = INT64 19 | clock_t = LONG 20 | size_t = SIZE_T 21 | 22 | class tm(ctypes.Structure): 23 | _fields_ = [ 24 | ('tm_sec', INT), 25 | ('tm_min', INT), 26 | ('tm_hour', INT), 27 | ('tm_mday', INT), 28 | ('tm_mon', INT), 29 | ('tm_year', INT), 30 | ('tm_wday', INT), 31 | ('tm_yday', INT), 32 | ('tm_isdst', INT), 33 | ] 34 | 35 | CLOCKS_PER_SEC = 0x000003E8 36 | 37 | CLK_TCK = CLOCKS_PER_SEC 38 | 39 | __all__ = ( 40 | 'CLK_TCK', 'CLOCKS_PER_SEC', 'tm', 'size_t', '_time32_t', 'clock_t', 41 | 'time_t', '_time64_t', 42 | ) 43 | -------------------------------------------------------------------------------- /km/crt/cstddef: -------------------------------------------------------------------------------- 1 | // cstddef standard header 2 | #ifndef _CSTDDEF_ 3 | #define _CSTDDEF_ 4 | #ifdef _STD_USING 5 | #undef _STD_USING 6 | #include 7 | #define _STD_USING 8 | #else 9 | #include 10 | #endif /* _STD_USING */ 11 | #endif /* _CSTDDEF_ */ 12 | 13 | #if _GLOBAL_USING && !defined(RC_INVOKED) 14 | _STD_BEGIN 15 | using _CSTD ptrdiff_t; using _CSTD size_t; 16 | 17 | #if _HAS_CPP0X 18 | typedef double max_align_t; // most aligned type 19 | #endif /* _HAS_CPP0X */ 20 | _STD_END 21 | #endif /* _GLOBAL_USING */ 22 | 23 | /* 24 | * Copyright (c) 1994 by P.J. Plauger. ALL RIGHTS RESERVED. 25 | * Consult your license regarding permissions and restrictions. 26 | */ 27 | // The file \sdpublic\sdk\inc\crt\cstddef was reviewed by LCA in June 2011 and per license is 28 | // acceptable for Microsoft use under Dealpoint ID 46582, 201971 29 | /* 88bf0570-3001-4e78-a5f2-be5765546192 */ 30 | -------------------------------------------------------------------------------- /um/audioapotypes_h.py: -------------------------------------------------------------------------------- 1 | 2 | from .winapifamily_h import * # NOQA 3 | 4 | import ctypes 5 | from .wtypes_h import ( 6 | ENUM, 7 | UINT_PTR, 8 | UINT32, 9 | POINTER, 10 | ) 11 | 12 | 13 | class APO_BUFFER_FLAGS(ENUM): 14 | BUFFER_INVALID = 0 15 | BUFFER_VALID = 1 16 | BUFFER_SILENT = 2 17 | 18 | 19 | class APO_CONNECTION_PROPERTY(ctypes.Structure): 20 | _fields_ = [ 21 | ('pBuffer', UINT_PTR), 22 | ('u32ValidFrameCount', UINT32), 23 | ('u32BufferFlags', APO_BUFFER_FLAGS), 24 | ('u32Signature', UINT32), 25 | ] 26 | 27 | 28 | PAPO_CONNECTION_PROPERTY = POINTER(APO_CONNECTION_PROPERTY) 29 | 30 | 31 | class AUDIO_CURVE_TYPE(ENUM): 32 | AUDIO_CURVE_TYPE_NONE = 0 33 | AUDIO_CURVE_TYPE_WINDOWS_FADE = 1 34 | 35 | 36 | __all__ = ( 37 | 'AUDIO_CURVE_TYPE', 'PAPO_CONNECTION_PROPERTY', 'APO_CONNECTION_PROPERTY', 38 | 'APO_BUFFER_FLAGS' 39 | ) 40 | -------------------------------------------------------------------------------- /um/uiautomation_h.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | from pyWinAPI import * 3 | from pyWinAPI.shared.wtypes_h import * 4 | from pyWinAPI.shared.winapifamily_h import * 5 | from pyWinAPI.shared.sdkddkver_h import * 6 | from pyWinAPI.shared.guiddef_h import * 7 | 8 | 9 | 10 | 11 | # ------------------------------------------------------------- 12 | # UIAutomation.h 13 | # UIAutomation API Header, brings in all the other UIAutomation headers 14 | # Copyright (c) Microsoft Corporation. All rights reserved. 15 | # ------------------------------------------------------------- 16 | from pyWinAPI.shared.winapifamily_h import * # NOQA 17 | if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP): 18 | from pyWinAPI.um.uiautomationcore_h import * # NOQA 19 | from pyWinAPI.um.uiautomationclient_h import * # NOQA 20 | from pyWinAPI.um.uiautomationcoreapi_h import * # NOQA 21 | # END IF WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) 22 | 23 | 24 | -------------------------------------------------------------------------------- /shared/afunix_h.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | from pyWinAPI import * 3 | from pyWinAPI.shared.wtypes_h import * 4 | from pyWinAPI.shared.winapifamily_h import * 5 | from pyWinAPI.shared.sdkddkver_h import * 6 | from pyWinAPI.shared.guiddef_h import * 7 | 8 | 9 | class sockaddr_un(ctypes.Structure): 10 | pass 11 | 12 | 13 | SOCKADDR_UN = sockaddr_un 14 | PSOCKADDR_UN = POINTER(sockaddr_un) 15 | 16 | 17 | # /* + + Copyright (c) Microsoft Corporation Module Name: afunix.h Abstract: 18 | # This file contains the definitions for the AF_UNIX socket address family 19 | # that can be used by both user - mode and kernel mode modules. BETA: The 20 | # definitions in this header are subject to change. - - 21 | 22 | _AFUNIX_ = 1 23 | if not defined(_AFUNIX_): 24 | 25 | from pyWinAPI.shared.ws2def_h import * # NOQA 26 | _AFUNIX_ = 1 27 | UNIX_PATH_MAX = 108 28 | 29 | sockaddr_un._fields_ = [ 30 | # AF_UNIX 31 | ('sun_family', ADDRESS_FAMILY), 32 | # pathname 33 | ('sun_path', CHAR * UNIX_PATH_MAX), 34 | ] 35 | # END IF _AFUNIX_ 36 | -------------------------------------------------------------------------------- /shared/pshpack1_h.py: -------------------------------------------------------------------------------- 1 | from pyWinAPI import * 2 | 3 | # /* + + Copyright (c) Microsoft Corporation. All rights reserved. Module 4 | # Name: pshpack1.h Abstract: This file turns 1 byte packing of structures on. 5 | # (That is, it disables automatic alignment of structure fields.) An include 6 | # file is needed because various compilers do this in different ways. For 7 | # Microsoft compatible compilers, this files uses the push option to the pack 8 | # pragma so that the poppack.h include file can restore the previous packing 9 | # reliably. The file poppack.h is the complement to this file. - - 10 | lint = None 11 | _PUSHPOP_SUPPORTED = None 12 | if not (defined(lint) or defined(RC_INVOKED)): 13 | if ( 14 | (_MSC_VER >= 800 and not defined(_M_I86)) or 15 | defined(_PUSHPOP_SUPPORTED) 16 | ): 17 | if not defined(MIDL_PASS) or defined(__midl): 18 | pass 19 | else: 20 | pass 21 | # END IF 22 | else: 23 | pass 24 | # END IF 25 | pass 26 | # END IF not (defined(lint) or defined(RC_INVOKED)) 27 | -------------------------------------------------------------------------------- /shared/pshpack2_h.py: -------------------------------------------------------------------------------- 1 | from pyWinAPI import * 2 | 3 | # /* + + Copyright (c) Microsoft Corporation. All rights reserved. Module 4 | # Name: pshpack2.h Abstract: This file turns 2 byte packing of structures on. 5 | # (That is, it disables automatic alignment of structure fields.) An include 6 | # file is needed because various compilers do this in different ways. For 7 | # Microsoft compatible compilers, this files uses the push option to the pack 8 | # pragma so that the poppack.h include file can restore the previous packing 9 | # reliably. The file poppack.h is the complement to this file. - - 10 | lint = None 11 | _PUSHPOP_SUPPORTED = None 12 | if not (defined(lint) or defined(RC_INVOKED)): 13 | if ( 14 | (_MSC_VER >= 800 and not defined(_M_I86)) or 15 | defined(_PUSHPOP_SUPPORTED) 16 | ): 17 | if not defined(MIDL_PASS) or defined(__midl): 18 | pass 19 | else: 20 | pass 21 | # END IF 22 | else: 23 | pass 24 | # END IF 25 | pass 26 | # END IF not (defined(lint) or defined(RC_INVOKED)) 27 | -------------------------------------------------------------------------------- /shared/pshpck16_h.py: -------------------------------------------------------------------------------- 1 | from pyWinAPI import * 2 | 3 | # /* + + Copyright (c) Microsoft Corporation. All rights reserved. Module 4 | # Name: pshpack8.h Abstract: This file turns 8 byte packing of structures on. 5 | # (That is, it disables automatic alignment of structure fields.) An include 6 | # file is needed because various compilers do this in different ways. For 7 | # Microsoft compatible compilers, this files uses the push option to the pack 8 | # pragma so that the poppack.h include file can restore the previous packing 9 | # reliably. The file poppack.h is the complement to this file. - - 10 | lint = None 11 | _PUSHPOP_SUPPORTED = None 12 | if not (defined(lint) or defined(RC_INVOKED)): 13 | if ( 14 | (_MSC_VER >= 800 and not defined(_M_I86)) or 15 | defined(_PUSHPOP_SUPPORTED) 16 | ): 17 | if not defined(MIDL_PASS) or defined(__midl): 18 | pass 19 | else: 20 | pass 21 | # END IF 22 | else: 23 | pass 24 | # END IF 25 | pass 26 | # END IF not (defined(lint) or defined(RC_INVOKED)) 27 | -------------------------------------------------------------------------------- /shared/apdevpkey_h.py: -------------------------------------------------------------------------------- 1 | from pyWinAPI import * 2 | from pyWinAPI.shared.sdkddkver_h import * 3 | 4 | 5 | # /* + + Copyright (c) Microsoft Corporation. All rights reserved. Module 6 | # Name: apdevpkey.h Abstract: Defines Plug and Play Device property keys used 7 | # for AutoPlay behavior. Environment: User and Kernel modes. - - 8 | from winapifamily_h import * # NOQA 9 | if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP): 10 | if NTDDI_VERSION >= NTDDI_WIN8: 11 | from pyWinAPI.shared.devpropdef_h import * # NOQA 12 | 13 | # Indicate that AutoPlay should not be displayed for this device 14 | # interface. 15 | DEVPKEY_DeviceInterface_Autoplay_Silent = DEFINE_DEVPROPKEY( 16 | 0x434DD28F, 17 | 0x9E75, 18 | 0x450A, 19 | 0x9A, 20 | 0xB9, 21 | 0xFF, 22 | 0x61, 23 | 0xE6, 24 | 0x18, 25 | 0xBA, 26 | 0xD0, 27 | 2 28 | ) 29 | # END IF 30 | # END IF WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) 31 | -------------------------------------------------------------------------------- /shared/pshpack4_h.py: -------------------------------------------------------------------------------- 1 | from pyWinAPI import * 2 | 3 | 4 | # /* + + Copyright (c) Microsoft Corporation. All rights reserved. Module 5 | # Name: pshpack4.h Abstract: This file turns 4 byte packing of structures on. 6 | # (That is, it disables automatic alignment of structure fields.) An include 7 | # file is needed because various compilers do this in different ways. For 8 | # Microsoft compatible compilers, this files uses the push option to the pack 9 | # pragma so that the poppack.h include file can restore the previous packing 10 | # reliably. The file poppack.h is the complement to this file. - - 11 | lint = None 12 | _PUSHPOP_SUPPORTED = None 13 | if not (defined(lint) or defined(RC_INVOKED)): 14 | if ( 15 | (_MSC_VER >= 800 and not defined(_M_I86)) or 16 | defined(_PUSHPOP_SUPPORTED) 17 | ): 18 | if not defined(MIDL_PASS) or defined(__midl): 19 | pass 20 | else: 21 | pass 22 | # END IF 23 | else: 24 | pass 25 | # END IF 26 | pass 27 | # END IF not (defined(lint) or defined(RC_INVOKED)) 28 | -------------------------------------------------------------------------------- /shared/pshpack8_h.py: -------------------------------------------------------------------------------- 1 | from pyWinAPI import * 2 | 3 | 4 | # /* + + Copyright (c) Microsoft Corporation. All rights reserved. Module 5 | # Name: pshpack8.h Abstract: This file turns 8 byte packing of structures on. 6 | # (That is, it disables automatic alignment of structure fields.) An include 7 | # file is needed because various compilers do this in different ways. For 8 | # Microsoft compatible compilers, this files uses the push option to the pack 9 | # pragma so that the poppack.h include file can restore the previous packing 10 | # reliably. The file poppack.h is the complement to this file. - - 11 | lint = None 12 | _PUSHPOP_SUPPORTED = None 13 | if not (defined(lint) or defined(RC_INVOKED)): 14 | if ( 15 | (_MSC_VER >= 800 and not defined(_M_I86)) or 16 | defined(_PUSHPOP_SUPPORTED) 17 | ): 18 | if not defined(MIDL_PASS) or defined(__midl): 19 | pass 20 | else: 21 | pass 22 | # END IF 23 | else: 24 | pass 25 | # END IF 26 | pass 27 | # END IF not (defined(lint) or defined(RC_INVOKED)) 28 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | .idea 3 | __pycache__/ 4 | *.py[cod] 5 | *$py.class 6 | 7 | *.* 8 | !code_converter/win_functions_not_found.txt 9 | !*.py 10 | !LICENSE.md 11 | !README.md 12 | !.gitignore 13 | 14 | # C extensions 15 | *.so 16 | 17 | # Distribution / packaging 18 | .Python 19 | env/ 20 | build/ 21 | develop-eggs/ 22 | dist/ 23 | downloads/ 24 | eggs/ 25 | .eggs/ 26 | lib/ 27 | lib64/ 28 | parts/ 29 | sdist/ 30 | var/ 31 | *.egg-info/ 32 | .installed.cfg 33 | *.egg 34 | 35 | # PyInstaller 36 | # Usually these files are written by a python script from a template 37 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 38 | *.manifest 39 | *.spec 40 | 41 | # Installer logs 42 | pip-log.txt 43 | pip-delete-this-directory.txt 44 | 45 | # Unit test / coverage reports 46 | htmlcov/ 47 | .tox/ 48 | .coverage 49 | .coverage.* 50 | .cache 51 | nosetests.xml 52 | coverage.xml 53 | *,cover 54 | 55 | # Translations 56 | *.mo 57 | *.pot 58 | 59 | # Django stuff: 60 | *.log 61 | 62 | # Sphinx documentation 63 | docs/_build/ 64 | 65 | # PyBuilder 66 | target/ 67 | -------------------------------------------------------------------------------- /um/audioendpoints_h.py: -------------------------------------------------------------------------------- 1 | __REQUIRED_RPCNDR_H_VERSION__ = 0x000001F4 2 | __REQUIRED_RPCSAL_H_VERSION__ = 0x00000064 3 | # from rpc_h import * # NOQA 4 | # from rpcndr_h import * # NOQA 5 | # from windows_h import * # NOQA 6 | # from ole2_h import * # NOQA 7 | # from unknwn_h import * # NOQA 8 | from .winapifamily_h import * # NOQA 9 | 10 | from .wtypes_h import DWORD, HRESULT 11 | from .guiddef_h import IID 12 | import comtypes 13 | 14 | 15 | ENDPOINT_FORMAT_RESET_MIX_ONLY = 0x00000001 16 | 17 | COMMETHOD = comtypes.COMMETHOD 18 | 19 | 20 | IID_IAudioEndpointFormatControl = IID( 21 | '{784CFD40-9F89-456E-A1A6-873B006A664E}' 22 | ) 23 | 24 | 25 | class IAudioEndpointFormatControl(comtypes.IUnknown): 26 | _case_insensitive_ = True 27 | _iid_ = IID_IAudioEndpointFormatControl 28 | _idlflags_ = [] 29 | _methods_ = [ 30 | COMMETHOD( 31 | [], 32 | HRESULT, 33 | 'ResetToDefault', 34 | (['in'], DWORD, 'ResetFlags') 35 | ), 36 | ] 37 | 38 | __all__ = ( 39 | 'ENDPOINT_FORMAT_RESET_MIX_ONLY', 'IID_IAudioEndpointFormatControl', 40 | 'IAudioEndpointFormatControl' 41 | ) 42 | -------------------------------------------------------------------------------- /shared/poppack_h.py: -------------------------------------------------------------------------------- 1 | from pyWinAPI import * 2 | 3 | # /* + + Copyright (c) Microsoft Corporation. All rights reserved. Module 4 | # Name: poppack.h Abstract: This file turns packing of structures off. 5 | # (That is, it enables automatic alignment of structure fields.) An include 6 | # file is needed because various compilers do this in different ways. 7 | # poppack.h is the complement to pshpack?.h. An inclusion of poppack.h MUST 8 | # ALWAYS be preceded by an inclusion of one of pshpack?.h, in one - to - one 9 | # correspondence. For Microsoft compatible compilers, this file uses the pop 10 | # option to the pack pragma so that it can restore the previous saved by the 11 | # pshpack?.h include file. - - 12 | 13 | lint = None 14 | _PUSHPOP_SUPPORTED = None 15 | if not (defined(lint) or defined(RC_INVOKED)): 16 | if ( 17 | (_MSC_VER >= 800 and not defined(_M_I86)) or 18 | defined(_PUSHPOP_SUPPORTED) 19 | ): 20 | if not defined(MIDL_PASS) or defined(__midl): 21 | pass 22 | else: 23 | pass 24 | # END IF 25 | else: 26 | pass 27 | # END IF 28 | pass 29 | # END IF not (defined(lint) or defined(RC_INVOKED)) 30 | -------------------------------------------------------------------------------- /um/socketapi_h.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | from pyWinAPI import * 3 | from pyWinAPI.shared.wtypes_h import * 4 | 5 | 6 | _SOCKETAPI_H = None 7 | 8 | # /* Copyright (c) Microsoft Corporation. All rights reserved. Module Name: 9 | # socketapi.h Abstract: Prototypes and Definitions for Socket API 10 | if not defined(_SOCKETAPI_H): 11 | _SOCKETAPI_H = VOID 12 | if defined(_MSC_VER): 13 | pass 14 | # END IF _MSC_VER 15 | 16 | if defined(__cplusplus): 17 | networking = ctypes.WinDLL('Windows.Networking') 18 | 19 | # extern "C" 20 | # { 21 | # #endif 22 | # 23 | # #include 24 | # 25 | # #pragma region Application Family 26 | # #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) 27 | # 28 | # #if NTDDI_VERSION >= NTDDI_WIN8 29 | # 30 | # HRESULT WINAPI SetSocketMediaStreamingMode(_In_ BOOL value); 31 | SetSocketMediaStreamingMode = ( 32 | networking.SetSocketMediaStreamingMode 33 | ) 34 | SetSocketMediaStreamingMode.restype = HRESULT 35 | # END IF NTDDI_VERSION >= NTDDI_WIN8 36 | # END IF WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) 37 | if defined(__cplusplus): 38 | pass 39 | # END IF 40 | 41 | # END IF _SOCKETAPI_H 42 | 43 | 44 | -------------------------------------------------------------------------------- /um/servprov_h.py: -------------------------------------------------------------------------------- 1 | __REQUIRED_RPCNDR_H_VERSION__ = 0x1F4 2 | __REQUIRED_RPCSAL_H_VERSION__ = 0x64 3 | # from .rpc_h import * # NOQA 4 | # from .rpcndr_h import * # NOQA 5 | # from .windows_h import * # NOQA 6 | # from .ole2_h import * # NOQA 7 | 8 | from .wtypes_h import ( 9 | POINTER, 10 | HRESULT, 11 | VOID, 12 | ) 13 | from .guiddef_h import ( 14 | REFGUID, 15 | REFIID, 16 | IID 17 | ) 18 | 19 | import comtypes 20 | 21 | 22 | IID_IServiceProvider = IID( 23 | '{6d5140c1-7436-11ce-8034-00aa006009fa}' 24 | ) 25 | 26 | 27 | class IServiceProvider(comtypes.IUnknown): 28 | _case_insensitive_ = True 29 | _iid_ = IID_IServiceProvider 30 | _idlflags_ = [] 31 | 32 | 33 | from .objidl_h import * # NOQA 34 | from .winapifamily_h import * # NOQA 35 | 36 | LPSERVICEPROVIDER = POINTER(IServiceProvider) 37 | COMMETHOD = comtypes.COMMETHOD 38 | 39 | 40 | IServiceProvider._methods_ = [ 41 | COMMETHOD( 42 | [], 43 | HRESULT, 44 | 'QueryService', 45 | (['in'], REFGUID, 'guidService'), 46 | (['in'], REFIID, 'riid'), 47 | (['out'], POINTER(POINTER(VOID)), 'ppvObject'), 48 | ), 49 | ] 50 | 51 | 52 | __all__ = ( 53 | 'IServiceProvider', '__REQUIRED_RPCSAL_H_VERSION__', 'LPSERVICEPROVIDER', 54 | '__REQUIRED_RPCNDR_H_VERSION__', 55 | ) 56 | -------------------------------------------------------------------------------- /shared/unexposeenums2managed_h.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | from pyWinAPI import * 3 | from pyWinAPI.shared.wtypes_h import * 4 | from pyWinAPI.shared.winapifamily_h import * 5 | from pyWinAPI.shared.sdkddkver_h import * 6 | from pyWinAPI.shared.guiddef_h import * 7 | 8 | 9 | # ---------------------------------------------------------------------------- 10 | # File: expose.h 11 | # Desc: macros to allow the same enum to be exposed to native and managed. 12 | # USAGE: 13 | # see comments at top of exposeenums2managed.h 14 | # Copyright (c) 2003-2004, Microsoft Corporation. All rights reserved. 15 | # ---------------------------------------------------------------------------- 16 | # not not not do not pragma once or macro guard this file. 17 | # it gets used multiple times by the same compilation units 18 | from pyWinAPI.shared.winapifamily_h import * # NOQA 19 | if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP): 20 | # undef V1_ENUM 21 | # undef V1_ENUMG 22 | # undef ENUM 23 | # undef ENUMG 24 | # undef ENUM16 25 | # undef FLAGS 26 | # undef FLAGS16 27 | # undef TAG 28 | # undef EHRECVR_MGD_NAMESPACE 29 | # undef ANALOG_VIDEO_STANDARD_NAMESPACE 30 | # undef RATLEVEL 31 | # undef RATATTR 32 | pass 33 | # end of file - expose.h 34 | # END IF WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) 35 | -------------------------------------------------------------------------------- /shared/in6addr_h.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | from pyWinAPI import * 3 | from pyWinAPI.shared.wtypes_h import * 4 | from pyWinAPI.shared.winapifamily_h import * 5 | from pyWinAPI.shared.sdkddkver_h import * 6 | from pyWinAPI.shared.guiddef_h import * 7 | 8 | 9 | s6_addr = None 10 | 11 | class in6_addr(ctypes.Structure): 12 | pass 13 | 14 | 15 | IN6_ADDR = in6_addr 16 | PIN6_ADDR = POINTER(in6_addr) 17 | LPIN6_ADDR = POINTER(in6_addr) 18 | 19 | # /* + + Copyright (c) Microsoft Corporation Module Name: in6addr.h 20 | # Environment: user mode or kernel mode -- 21 | if not defined(s6_addr): 22 | if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM): 23 | # IPv6 Internet address (RFC 2553) 24 | # This is an 'on-wire' format structure. 25 | class u(ctypes.Union): 26 | pass 27 | 28 | 29 | u._fields_ = [ 30 | ('Byte', UCHAR * 16), 31 | ('Word', USHORT * 8), 32 | ] 33 | in6_addr.u = u 34 | 35 | in6_addr._fields_ = [ 36 | ('u', in6_addr.u), 37 | ] 38 | in_addr6 = in6_addr 39 | 40 | # Defines to match RFC 2553. 41 | _S6_un = u 42 | _S6_u8 = Byte 43 | s6_addr = _S6_un._S6_u8 44 | 45 | # Defines for our implementation. 46 | s6_bytes = u.Byte 47 | s6_words = u.Word 48 | # END IF WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM) 49 | # END IF 50 | 51 | 52 | -------------------------------------------------------------------------------- /winrt/asyncinfo_h.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | from wtypes_h import ( 4 | ENUM, 5 | POINTER, 6 | HRESULT, 7 | INT32 8 | ) 9 | from guiddef_h import ( 10 | IID, 11 | ) 12 | import comtypes 13 | 14 | 15 | __REQUIRED_RPCNDR_H_VERSION__ = 0x000001F4 16 | __REQUIRED_RPCSAL_H_VERSION__ = 0x00000064 17 | 18 | IID_IAsyncInfo = IID( 19 | '{00000036-0000-0000-C000-000000000046}' 20 | ) 21 | 22 | from inspectable_h import * # NOQA 23 | 24 | 25 | class IAsyncInfo(IInspectable): 26 | _case_insensitive_ = True 27 | _iid_ = IID_IAsyncInfo 28 | _idlflags_ = [] 29 | 30 | 31 | class AsyncStatus(ENUM): 32 | Started = 0 33 | Completed = 1 34 | Canceled = 2 35 | Error = 3 36 | 37 | 38 | COMMETHOD = comtypes.COMMETHOD 39 | 40 | 41 | IAsyncInfo._methods_ = [ 42 | COMMETHOD( 43 | [], 44 | HRESULT, 45 | 'get_Id', 46 | (['out', 'retval'], POINTER(INT32), 'id'), 47 | ), 48 | COMMETHOD( 49 | [], 50 | HRESULT, 51 | 'get_Status', 52 | (['out', 'retval'], POINTER(AsyncStatus), 'status'), 53 | ), 54 | COMMETHOD( 55 | [], 56 | HRESULT, 57 | 'get_ErrorCode', 58 | (['out', 'retval'], POINTER(HRESULT), 'errorCode'), 59 | ), 60 | COMMETHOD( 61 | [], 62 | HRESULT, 63 | 'Close' 64 | ), 65 | ] 66 | 67 | __all__ = ( 68 | 'IAsyncInfo', '__REQUIRED_RPCSAL_H_VERSION__', '', 'AsyncStatus', 69 | '__REQUIRED_RPCNDR_H_VERSION__', 70 | ) 71 | -------------------------------------------------------------------------------- /um/lmuseflg_h.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | from pyWinAPI import * 3 | from pyWinAPI.shared.wtypes_h import * 4 | from pyWinAPI.shared.winapifamily_h import * 5 | from pyWinAPI.shared.sdkddkver_h import * 6 | from pyWinAPI.shared.guiddef_h import * 7 | 8 | 9 | _LMUSEFLG_ = None 10 | 11 | # /* + + BUILD Version: 0001 // Increment this if a change has global effects 12 | # Copyright (c) 1991-1999 Microsoft Corporation Module Name: lmuseflg.h 13 | # Abstract: This file contains deletion force levels for deleting a 14 | # connection. Environment: User Mode - Win32 Notes: This file has no 15 | # dependencies. It is included by lmwksta.h and lmuse.h. Revision History: -- 16 | if not defined(_LMUSEFLG_): 17 | _LMUSEFLG_ = VOID 18 | 19 | if _MSC_VER > 1000: 20 | pass 21 | # END IF 22 | 23 | from pyWinAPI.shared.winapifamily_h import * # NOQA 24 | 25 | if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM): 26 | # Definition for NetWkstaTransportDel and NetUseDel deletion force 27 | # levels and flags. The lower 16 bits 28 | # define the force levels and the upper 16 bits are the use flags 29 | # defined in lmuse.h 30 | USE_NOFORCE = 0 31 | USE_FORCE = 1 32 | USE_LOTS_OF_FORCE = 2 33 | 34 | 35 | def FORCE_LEVEL(LEVELFLAGS): 36 | return LEVELFLAGS & 0xFFFF 37 | 38 | # END IF WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM) 39 | # END IF _LMUSEFLG_ 40 | 41 | 42 | -------------------------------------------------------------------------------- /um/adodef_h.py: -------------------------------------------------------------------------------- 1 | 2 | from guiddef_h import uuid 3 | 4 | 5 | ADO_MAJOR = 0x00000006 6 | ADOR_MAJOR = 0x00000006 7 | ADOX_MAJOR = 0x00000006 8 | ADOMD_MAJOR = 0x00000006 9 | JRO_MAJOR = 0x00000002 10 | ADO_MINOR = 0x00000001 11 | ADOR_MINOR = 0x00000000 12 | ADOX_MINOR = 0x00000000 13 | ADOMD_MINOR = 0x00000000 14 | JRO_MINOR = 0x00000006 15 | ADO_VERSION = ADO_MAJOR##.##ADO_MINOR 16 | ADOR_VERSION = ADOR_MAJOR##.##ADOR_MINOR 17 | ADOX_VERSION = ADOX_MAJOR##.##ADOX_MINOR 18 | ADOMD_VERSION = ADOMD_MAJOR##.##ADOMD_MINOR 19 | JRO_VERSION = JRO_MAJOR##.##JRO_MINOR 20 | ADO_LIBRARYNAME = "Microsoft ActiveX Data Objects 6.1 Library" 21 | ADOR_LIBRARYNAME = "Microsoft ActiveX Data Objects Recordset 6.0 Library" 22 | ADOX_LIBRARYNAME = "Microsoft ADO Ext. 6.0 for DDL and Security" 23 | ADOMD_LIBRARYNAME = ( 24 | "Microsoft ActiveX Data Objects (Multi-dimensional) 6.0 Library" 25 | ) 26 | JRO_LIBRARYNAME = "Microsoft Jet and Replication Objects 2.6 Library" 27 | ADOMD_TYPELIB_UUID = uuid('{22813728-8BD3-11D0-B4EF-00A0C9138CA4}') 28 | JRO_TYPELIB_UUID = uuid('{AC3B8B4C-B6CA-11d1-9F31-00C04FC29D52}') 29 | 30 | __all__ = ( 31 | 'ADOR_MINOR', 'ADO_MINOR', 'ADOR_LIBRARYNAME', 'ADOR_VERSION', 32 | 'JRO_TYPELIB_UUID', 'ADOMD_VERSION', 'ADOMD_TYPELIB_UUID', 'ADOMD_MINOR', 33 | 'ADOX_LIBRARYNAME', 'ADOX_MAJOR', 'ADOX_VERSION', 'ADOX_MINOR', 34 | 'ADO_VERSION', 'JRO_MINOR', 'ADOMD_LIBRARYNAME', 'JRO_MAJOR', 'ADO_MAJOR', 35 | 'ADOR_MAJOR', 'JRO_LIBRARYNAME', 'ADO_LIBRARYNAME', 'ADOMD_MAJOR', 36 | 'JRO_VERSION', 37 | ) 38 | -------------------------------------------------------------------------------- /um/lmon_h.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | from pyWinAPI import * 3 | from pyWinAPI.shared.wtypes_h import * 4 | from pyWinAPI.shared.winapifamily_h import * 5 | from pyWinAPI.shared.sdkddkver_h import * 6 | from pyWinAPI.shared.guiddef_h import * 7 | 8 | 9 | class _PORT_INFO_FFA(ctypes.Structure): 10 | pass 11 | 12 | 13 | PORT_INFO_FFA = _PORT_INFO_FFA 14 | PPORT_INFO_FFA = POINTER(_PORT_INFO_FFA) 15 | LPPORT_INFO_FFA = POINTER(_PORT_INFO_FFA) 16 | 17 | 18 | class _PORT_INFO_FFW(ctypes.Structure): 19 | pass 20 | 21 | 22 | PORT_INFO_FFW = _PORT_INFO_FFW 23 | PPORT_INFO_FFW = POINTER(_PORT_INFO_FFW) 24 | LPPORT_INFO_FFW = POINTER(_PORT_INFO_FFW) 25 | 26 | 27 | # /* + + Copyright (c) 1991-1999 Microsoft Corporation All rights reserved 28 | # Module Name: lmon.h -- 29 | from pyWinAPI.shared.winapifamily_h import * # NOQA 30 | 31 | if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP): 32 | _PORT_INFO_FFA._fields_ = [ 33 | ('pName', LPSTR), 34 | ('cbMonitorData', DWORD), 35 | ('pMonitorData', LPBYTE), 36 | ] 37 | 38 | _PORT_INFO_FFW._fields_ = [ 39 | ('pName', LPWSTR), 40 | ('cbMonitorData', DWORD), 41 | ('pMonitorData', LPBYTE), 42 | ] 43 | if defined(UNICODE): 44 | PORT_INFO_FF = PORT_INFO_FFW 45 | PPORT_INFO_FF = PPORT_INFO_FFW 46 | LPPORT_INFO_FF = LPPORT_INFO_FFW 47 | else: 48 | PORT_INFO_FF = PORT_INFO_FFA 49 | PPORT_INFO_FF = PPORT_INFO_FFA 50 | LPPORT_INFO_FF = LPPORT_INFO_FFA 51 | # END IF UNICODE 52 | # END IF WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) 53 | 54 | 55 | -------------------------------------------------------------------------------- /um/propapi_h.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | from pyWinAPI import * 3 | from pyWinAPI.shared.wtypes_h import * 4 | from pyWinAPI.shared.winapifamily_h import * 5 | from pyWinAPI.shared.sdkddkver_h import * 6 | from pyWinAPI.shared.guiddef_h import * 7 | 8 | 9 | _PROPAPI_H_ = None 10 | 11 | # + ------------------------------------------------------------------------- 12 | # Microsoft Windows 13 | # Copyright (C) Microsoft Corporation, 1992-2006. 14 | # File: propapi.h 15 | # Contents: Structured storage properties APIs 16 | # -------------------------------------------------------------------------- 17 | if not defined(_PROPAPI_H_): 18 | _PROPAPI_H_ = VOID 19 | 20 | if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP): 21 | if defined(__cplusplus): 22 | pass 23 | # END IF 24 | 25 | NTPROP = POINTER(VOID) 26 | from pyWinAPI.um.propidl_h import * # NOQA 27 | ole32 = ctypes.windll.OLE32 28 | 29 | # EXTERN_C 30 | # _Success_(TRUE) // Raises status on failure 31 | # ULONG __stdcall 32 | # StgPropertyLengthAsVariant( 33 | # _In_reads_bytes_(cbProp) SERIALIZEDPROPERTYVALUE* pProp, 34 | # _In_ ULONG cbProp, 35 | # _In_ USHORT CodePage, 36 | # _Reserved_ BYTE bReserved); 37 | StgPropertyLengthAsVariant = ole32.StgPropertyLengthAsVariant 38 | StgPropertyLengthAsVariant.restype = ULONG 39 | 40 | if defined(__cplusplus): 41 | pass 42 | # END IF 43 | 44 | # END IF WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) 45 | # END IF ifndef _PROPAPI_H_ 46 | 47 | 48 | -------------------------------------------------------------------------------- /km/crt/limits_h.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | CHAR_BIT = 0x00000008 4 | SCHAR_MIN = -128 5 | SCHAR_MAX = 0x0000007F 6 | UCHAR_MAX = 0x000000FF 7 | CHAR_MIN = SCHAR_MIN 8 | CHAR_MAX = SCHAR_MAX 9 | MB_LEN_MAX = 0x00000005 10 | SHRT_MIN = -32768 11 | SHRT_MAX = 0x00007FFF 12 | USHRT_MAX = 0x0000FFFF 13 | INT_MIN = -2147483647 - 1 14 | INT_MAX = 0x7FFFFFFF 15 | UINT_MAX = 0xFFFFFFFF 16 | LONG_MIN = -2147483647 - 1 17 | LONG_MAX = 0x7FFFFFFF 18 | ULONG_MAX = 0xFFFFFFFF 19 | LLONG_MAX = 9223372036854775807 20 | LLONG_MIN = -9223372036854775807 - 1 21 | ULLONG_MAX = 0xFFFFFFFFFFFFFFFF 22 | _I8_MIN = -127 - 1 23 | _I8_MAX = 127 24 | _UI8_MAX = 0x000FF 25 | _I16_MIN = -32767 - 1 26 | _I16_MAX = 32767 27 | _UI16_MAX = 0xFFFF 28 | _I32_MIN = -2147483647 - 1 29 | _I32_MAX = 2147483647 30 | _UI32_MAX = 0xFFFFFFFF 31 | _I64_MIN = -9223372036854775807 - 1 32 | _I64_MAX = 9223372036854775807 33 | _UI64_MAX = 0xFFFFFFFFFFFFFFFF 34 | _I128_MIN = -170141183460469231731687303715884105727 - 1 35 | _I128_MAX = 170141183460469231731687303715884105727 36 | _UI128_MAX = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF 37 | SIZE_MAX = _UI64_MAX 38 | RSIZE_MAX = SIZE_MAX 39 | 40 | __all__ = ( 41 | 'SCHAR_MIN', '_I128_MIN', 'LONG_MIN', 'CHAR_MAX', 'UCHAR_MAX', '_I16_MAX', 42 | 'USHRT_MAX', '_I32_MAX', '_I64_MAX', 'LONG_MAX', '_UI16_MAX', '_I8_MIN', 43 | '_I128_MAX', 'CHAR_BIT', 'SHRT_MIN', '_I8_MAX', 'RSIZE_MAX', 'SIZE_MAX', 44 | 'UINT_MAX', '_UI32_MAX', '_I64_MIN', '_UI8_MAX', '_UI64_MAX', 'LLONG_MIN', 45 | '_UI128_MAX', 'ULLONG_MAX', 'CHAR_MIN', 'LLONG_MAX', 'INT_MIN', 'INT_MAX', 46 | '_I16_MIN', 'ULONG_MAX', 'SHRT_MAX', 'MB_LEN_MAX', 'SCHAR_MAX', 47 | '_I32_MIN', 48 | ) 49 | -------------------------------------------------------------------------------- /shared/usbprint_h.py: -------------------------------------------------------------------------------- 1 | 2 | # + + Copyright (c) 1998 - 2000 Microsoft Corporation Module Name: ioctl.h 3 | # Abstract: Environment: Kernel & user mode Revision History: - - 4 | 5 | from pyWinAPI.shared.winapifamily_h import * # NOQA 6 | from pyWinAPI.shared.devioctl_h import * # NOQA 7 | if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP): 8 | # {28D78FAD - 5A12 - 11d1 - AE5B - 0000F803A8C2} 9 | GUID_DEVINTERFACE_USBPRINT = DEFINE_GUID( 10 | 0x28D78FAD, 11 | 0x5A12, 12 | 0x11D1, 13 | 0xAE, 14 | 0x5B, 15 | 0x0, 16 | 0x0, 17 | 0xF8, 18 | 0x3, 19 | 0xA8, 20 | 0xC2 21 | ) 22 | USBPRINT_IOCTL_INDEX = 0x0000 23 | IOCTL_USBPRINT_GET_LPT_STATUS = CTL_CODE( 24 | FILE_DEVICE_UNKNOWN, 25 | USBPRINT_IOCTL_INDEX + 12, 26 | METHOD_BUFFERED, 27 | FILE_ANY_ACCESS, 28 | ) 29 | IOCTL_USBPRINT_GET_1284_ID = CTL_CODE( 30 | FILE_DEVICE_UNKNOWN, 31 | USBPRINT_IOCTL_INDEX + 13, 32 | METHOD_BUFFERED, 33 | FILE_ANY_ACCESS, 34 | ) 35 | IOCTL_USBPRINT_VENDOR_SET_COMMAND = CTL_CODE( 36 | FILE_DEVICE_UNKNOWN, 37 | USBPRINT_IOCTL_INDEX + 14, 38 | METHOD_BUFFERED, 39 | FILE_ANY_ACCESS, 40 | ) 41 | IOCTL_USBPRINT_VENDOR_GET_COMMAND = CTL_CODE( 42 | FILE_DEVICE_UNKNOWN, 43 | USBPRINT_IOCTL_INDEX + 15, 44 | METHOD_BUFFERED, 45 | FILE_ANY_ACCESS, 46 | ) 47 | IOCTL_USBPRINT_SOFT_RESET = CTL_CODE( 48 | FILE_DEVICE_UNKNOWN, 49 | USBPRINT_IOCTL_INDEX + 16, 50 | METHOD_BUFFERED, 51 | FILE_ANY_ACCESS, 52 | ) 53 | # END IF WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) 54 | -------------------------------------------------------------------------------- /shared/atsmedia_h.py: -------------------------------------------------------------------------------- 1 | from pyWinAPI import * 2 | from pyWinAPI.shared.guiddef_h import * 3 | 4 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 | # - - 6 | # File: ATSMedia.h 7 | # Desc: Broadcast Driver Architecture Media Definitions for ATSC 8 | # Copyright (c) 1996 - 2001, Microsoft Corporation. All rights reserved. 9 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 10 | # - - 11 | from pyWinAPI.shared.winapifamily_h import * # NOQA 12 | if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP): 13 | 14 | _KSMEDIA_ = 1 15 | if not defined(_KSMEDIA_): 16 | pass 17 | # END IF not defined(_KSMEDIA_) 18 | _BDAMEDIA_ = 1 19 | if not defined(_BDAMEDIA_): 20 | pass 21 | # END IF not defined(_KSMEDIA_) 22 | _ATSCMEDIA_ = None 23 | if not defined(_ATSCMEDIA_): 24 | _ATSCMEDIA_ = 1 25 | # == == == == == == == == == == == == == == == == == == == == == == == 26 | # == == == == == == == == == == == == == == = 27 | # ATSC Network Type 28 | # == == == == == == == == == == == == == == == == == == == == == == == 29 | # == == == == == == == == == == == == == == = 30 | STATIC_BDANETWORKTYPE_ATSC = ( 31 | 0x71985F51, 32 | 0x1CA1, 33 | 0x11D3, 34 | 0x9C, 35 | 0xC8, 36 | 0x0, 37 | 0xC0, 38 | 0x4F, 39 | 0x79, 40 | 0x71, 41 | 0xE0 42 | ) 43 | BDANETWORKTYPE_ATSC = DEFINE_GUIDSTRUCT( 44 | "71985F51-1CA1-11d3-9CC8-00C04F7971E0" 45 | ) 46 | BDANETWORKTYPE_ATSC = DEFINE_GUIDNAMED(BDANETWORKTYPE_ATSC) 47 | # END IF _ATSCMEDIA_ 48 | # END IF WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) 49 | -------------------------------------------------------------------------------- /km/d4iface_h.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | from .wtypes_h import ( 4 | ULONG, 5 | POINTER, 6 | UINT, 7 | ) 8 | import ctypes 9 | 10 | 11 | DOT4_MAX_CHANNELS = 0x80 12 | NO_TIMEOUT = 0x0 13 | STREAM_TYPE_CHANNEL = 0x1 14 | PACKET_TYPE_CHANNEL = 0x2 15 | DOT4_STREAM_RECEIVED = 0x100 16 | DOT4_STREAM_CREDITS = 0x101 17 | DOT4_MESSAGE_RECEIVED = 0x102 18 | DOT4_DISCONNECT = 0x103 19 | DOT4_CHANNEL_CLOSED = 0x105 20 | DOT4_CHANNEL = 0x0 21 | HP_MESSAGE_PROCESSOR = 0x1 22 | PRINTER_CHANNEL = 0x2 23 | SCANNER_CHANNEL = 0x4 24 | MIO_COMMAND_PROCESSOR = 0x5 25 | ECHO_CHANNEL = 0x6 26 | FAX_SEND_CHANNEL = 0x7 27 | FAX_RECV_CHANNEL = 0x8 28 | DIAGNOSTIC_CHANNEL = 0x9 29 | HP_RESERVED = 0xA 30 | IMAGE_DOWNLOAD = 0xB 31 | HOST_DATASTORE_UPLOAD = 0xC 32 | HOST_DATASTORE_DOWNLOAD = 0xD 33 | CONFIG_UPLOAD = 0xE 34 | CONFIG_DOWNLOAD = 0xF 35 | CHANNEL_HANDLE = UINT 36 | PCHANNEL_HANDLE = POINTER(CHANNEL_HANDLE) 37 | 38 | 39 | class _DOT4_ACTIVITY(ctypes.Structure): 40 | _fields_ = [ 41 | ('ulMessage', ULONG), 42 | ('ulByteCount', ULONG), 43 | ('hChannel', CHANNEL_HANDLE), 44 | ] 45 | 46 | 47 | DOT4_ACTIVITY = _DOT4_ACTIVITY 48 | PDOT4_ACTIVITY = POINTER(_DOT4_ACTIVITY) 49 | 50 | 51 | __all__ = ( 52 | 'CONFIG_DOWNLOAD', 'IMAGE_DOWNLOAD', 'DOT4_STREAM_CREDITS', 'NO_TIMEOUT', 53 | 'PRINTER_CHANNEL', 'FAX_RECV_CHANNEL', 'DIAGNOSTIC_CHANNEL', 54 | 'CONFIG_UPLOAD', 'DOT4_STREAM_RECEIVED', 'HOST_DATASTORE_DOWNLOAD', 55 | 'FAX_SEND_CHANNEL', 'DOT4_CHANNEL', 'DOT4_CHANNEL_CLOSED', 'ECHO_CHANNEL', 56 | 'SCANNER_CHANNEL', 'STREAM_TYPE_CHANNEL', 'DOT4_DISCONNECT', 57 | 'HP_MESSAGE_PROCESSOR', 'DOT4_MESSAGE_RECEIVED', 'DOT4_MAX_CHANNELS', 58 | 'HOST_DATASTORE_UPLOAD', 'HP_RESERVED', 'MIO_COMMAND_PROCESSOR', 59 | 'PACKET_TYPE_CHANNEL', 'DOT4_ACTIVITY', 'PDOT4_ACTIVITY', 60 | '_DOT4_ACTIVITY', 'CHANNEL_HANDLE', 'PCHANNEL_HANDLE', 61 | ) 62 | -------------------------------------------------------------------------------- /km/rxtypes_h.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | from pyWinAPI import * 3 | from pyWinAPI.shared.wtypes_h import * 4 | 5 | 6 | class _BINDING_HANDLE(ctypes.Structure): 7 | pass 8 | 9 | 10 | RX_BINDING_HANDLE = _BINDING_HANDLE 11 | PRX_BINDING_HANDLE = POINTER(_BINDING_HANDLE) 12 | 13 | 14 | class _RX_BINDING_CONTEXT(ctypes.Structure): 15 | pass 16 | 17 | 18 | RX_BINDING_CONTEXT = _RX_BINDING_CONTEXT 19 | PRX_BINDING_CONTEXT = POINTER(_RX_BINDING_CONTEXT) 20 | 21 | _RXTYPES_INCL = None 22 | 23 | if not defined(_RXTYPES_INCL): 24 | _RXTYPES_INCL = 1 25 | from pyWinAPI.km.nodetype_h import * # NOQA 26 | 27 | # MUST match MaximumWorkQueue in wdm.h for Win7 or earlier. 28 | RxMaximumWorkQueue = 3 29 | RX_HANDLE = PVOID 30 | PRX_HANDLE = POINTER(PVOID) 31 | RX_SPIN_LOCK = KSPIN_LOCK 32 | PRX_SPIN_LOCK = PKSPIN_LOCK 33 | 34 | # String definitions 35 | # The RX_STRING type corresponds to a UNICODE_STRING and all the Rtl 36 | # functions that are 37 | # available to manipulate Unicode strings can be used to manipulate the 38 | # strings 39 | _BINDING_HANDLE._fields_ = [ 40 | # Win9X net structure 41 | ('pTdiEmulationContext', RX_HANDLE), 42 | # tdi transport information. 43 | ('pTransportInformation', RX_HANDLE), 44 | ] 45 | PUNICODE_STRING = POINTER(UNICODE_STRING) 46 | 47 | # This structure is transient. Most fields in this structure allow us to 48 | # move through the bind/addname part of activating a net. Runtime info 49 | # for the rxce and LONG term context is kept elsewhere. 50 | _RX_BINDING_CONTEXT._fields_ = [ 51 | # Transport Name (unicode string). 52 | ('pTransportName', PUNICODE_STRING), 53 | # Requested QOS. 54 | ('QualityOfService', ULONG), 55 | # Handle to transport bind info. 56 | ('pBindHandle', PRX_BINDING_HANDLE), 57 | ] 58 | # END IF _RXTYPES_INCL 59 | -------------------------------------------------------------------------------- /um/accountssettingspaneinterop_h.py: -------------------------------------------------------------------------------- 1 | 2 | __REQUIRED_RPCNDR_H_VERSION__ = 0x000001F4 3 | __REQUIRED_RPCSAL_H_VERSION__ = 0x00000064 4 | # from rpc_h import * # NOQA 5 | # from rpcndr_h import * # NOQA 6 | # from windows_h import * # NOQA 7 | # from ole2_h import * # NOQA 8 | 9 | from shared.guiddef_h import ( 10 | IID, 11 | REFIID 12 | ) 13 | import comtypes 14 | from shared.wtypes_h import ( 15 | VOID, 16 | HWND, 17 | HRESULT, 18 | POINTER 19 | 20 | ) 21 | 22 | from winrt.inspectable_h import * # NOQA 23 | from winrt.asyncinfo_h import * # NOQA 24 | from shared.winapifamily_h import * # NOQA 25 | 26 | 27 | IID_IAccountsSettingsPaneInterop = IID( 28 | '{D3EE12AD-3865-4362-9746-B75A682DF0E6}' 29 | ) 30 | 31 | 32 | class IAccountsSettingsPaneInterop(IInspectable): 33 | _case_insensitive_ = True 34 | _iid_ = IID_IAccountsSettingsPaneInterop 35 | _idlflags_ = [] 36 | 37 | 38 | COMMETHOD = comtypes.COMMETHOD 39 | 40 | 41 | IAccountsSettingsPaneInterop._methods_ = [ 42 | COMMETHOD( 43 | [], 44 | HRESULT, 45 | 'GetForWindow', 46 | (['in'], HWND, 'appWindow'), 47 | (['in'], REFIID, 'riid'), 48 | (['retval', 'out'], POINTER(POINTER(VOID)), 'accountsSettingsPane'), 49 | ), 50 | COMMETHOD( 51 | [], 52 | HRESULT, 53 | 'ShowManageAccountsForWindowAsync', 54 | (['in'], HWND, 'appWindow'), 55 | (['in'], REFIID, 'riid'), 56 | (['retval', 'out'], POINTER(POINTER(VOID)), 'asyncAction'), 57 | ), 58 | COMMETHOD( 59 | [], 60 | HRESULT, 61 | 'ShowAddAccountForWindowAsync', 62 | (['in'], HWND, 'appWindow'), 63 | (['in'], REFIID, 'riid'), 64 | (['retval', 'out'], POINTER(POINTER(VOID)), 'asyncAction'), 65 | ), 66 | ] 67 | 68 | 69 | __all__ = ( 70 | 'IAccountsSettingsPaneInterop', '__REQUIRED_RPCSAL_H_VERSION__', 71 | '__REQUIRED_RPCNDR_H_VERSION__', 72 | ) 73 | -------------------------------------------------------------------------------- /stat_gen.py: -------------------------------------------------------------------------------- 1 | 2 | import os 3 | base_path = os.getcwd() 4 | 5 | 6 | py_count = 0 7 | idl_count = 0 8 | h_count = 0 9 | 10 | py_line_count = 0 11 | idl_line_count = 0 12 | h_line_count = 0 13 | 14 | 15 | def iter_folder(path): 16 | global py_count 17 | global idl_count 18 | global h_count 19 | global py_line_count 20 | global idl_line_count 21 | global h_line_count 22 | 23 | files = list( 24 | os.path.join(path, f) for f in os.listdir(path) 25 | if '__init__' not in f 26 | ) 27 | 28 | for f in files: 29 | if f.endswith('.h'): 30 | h_count += 1 31 | with open(f, 'r') as fle: 32 | h_line_count += len(fle.readlines()) 33 | 34 | elif f.endswith('.idl'): 35 | idl_count += 1 36 | with open(f, 'r') as fle: 37 | idl_line_count += len(fle.readlines()) 38 | 39 | elif f.endswith('.py'): 40 | py_count += 1 41 | with open(f, 'r') as fle: 42 | py_line_count += len(fle.readlines()) 43 | 44 | elif os.path.isdir(f): 45 | iter_folder(f) 46 | 47 | 48 | shared = os.path.join(base_path, 'shared') 49 | km = os.path.join(base_path, 'km') 50 | um = os.path.join(base_path, 'um') 51 | ucrt = os.path.join(base_path, 'ucrt') 52 | 53 | iter_folder(shared) 54 | iter_folder(km) 55 | iter_folder(um) 56 | iter_folder(ucrt) 57 | 58 | 59 | template = '''\ 60 | current statistics 61 | 62 | total number of C code files {0} 63 | number of files converted {1} 64 | 65 | total number of C code lines {2} 66 | number of line converted {3} 67 | 68 | percentage of files completed: {4:.2f} % 69 | percentage of line of code converted {5:.2f} % 70 | 71 | ''' 72 | 73 | print template.format( 74 | h_count, 75 | py_count, 76 | h_line_count, 77 | py_line_count, 78 | (float(py_count) / float(h_count)) * 100.0, 79 | (float(py_line_count) / float(h_line_count)) * 100.0 80 | ) 81 | -------------------------------------------------------------------------------- /shared/inaddr_h.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | from pyWinAPI import * 3 | from pyWinAPI.shared.wtypes_h import * 4 | from pyWinAPI.shared.winapifamily_h import * 5 | 6 | 7 | class in_addr(ctypes.Structure): 8 | pass 9 | 10 | 11 | IN_ADDR = in_addr 12 | PIN_ADDR = POINTER(in_addr) 13 | LPIN_ADDR = POINTER(in_addr) 14 | 15 | 16 | # /* + + Copyright (c) Microsoft Corporation Module Name: inaddr.h 17 | # Environment: user mode or kernel mode - - 18 | s_addr = None 19 | if not defined(s_addr): 20 | if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM): 21 | # IPv4 Internet address 22 | # This is an 'on - wire' format structure. 23 | 24 | class S_un(ctypes.Union): 25 | pass 26 | 27 | class S_un_b(ctypes.Structure): 28 | pass 29 | 30 | S_un_b._fields_ = [ 31 | ('s_b1', UCHAR), 32 | ('s_b2', UCHAR), 33 | ('s_b3', UCHAR), 34 | ('s_b4', UCHAR) 35 | ] 36 | 37 | S_un.S_un_b = S_un_b 38 | 39 | class S_un_w(ctypes.Structure): 40 | pass 41 | 42 | S_un_w._fields_ = [ 43 | ('s_w1', USHORT), 44 | ('s_w2', USHORT), 45 | ] 46 | 47 | S_un.S_un_w = S_un_w 48 | 49 | S_un._field_ = [ 50 | ('S_un_b', S_un.S_un_b), 51 | ('S_un_w', S_un.S_un_w), 52 | ('S_addr', ULONG), 53 | ] 54 | 55 | in_addr.S_un = S_un 56 | 57 | in_addr._fields_ = [ 58 | ('S_un', in_addr.S_un), 59 | ] 60 | 61 | s_addr = S_un.S_addr # can be used for most tcp & ip code 62 | s_host = S_un.S_un_b.s_b2 # host on imp 63 | s_net = S_un.S_un_b.s_b1 # network 64 | s_imp = S_un.S_un_w.s_w2 # imp 65 | s_impno = S_un.S_un_b.s_b4 # imp # 66 | s_lh = S_un.S_un_b.s_b3 # logical host 67 | 68 | # END IF WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM) 69 | # END IF 70 | -------------------------------------------------------------------------------- /um/playto_h.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | from pyWinAPI import * 3 | from pyWinAPI.shared.wtypes_h import * 4 | from pyWinAPI.shared.winapifamily_h import * 5 | from pyWinAPI.shared.sdkddkver_h import * 6 | from pyWinAPI.shared.guiddef_h import * 7 | 8 | 9 | __REQUIRED_RPCNDR_H_VERSION__ = None 10 | __REQUIRED_RPCSAL_H_VERSION__ = None 11 | __RPCNDR_H_VERSION__ = None 12 | __playto_h__ = None 13 | 14 | 15 | # this ALWAYS GENERATED file contains the definitions for the interfaces 16 | # File created by MIDL compiler version 8.01.0622 17 | # @@MIDL_FILE_HEADING( ) 18 | # verify that the version is high enough to compile this file 19 | if not defined(__REQUIRED_RPCNDR_H_VERSION__): 20 | __REQUIRED_RPCNDR_H_VERSION__ = 500 21 | # END IF 22 | 23 | # verify that the version is high enough to compile this file 24 | if not defined(__REQUIRED_RPCSAL_H_VERSION__): 25 | __REQUIRED_RPCSAL_H_VERSION__ = 100 26 | # END IF 27 | 28 | 29 | from pyWinAPI.shared.rpc_h import * # NOQA 30 | from pyWinAPI.shared.rpcndr_h import * # NOQA 31 | 32 | if not defined(__RPCNDR_H_VERSION__): 33 | pass 34 | # END IF __RPCNDR_H_VERSION__ 35 | 36 | if not defined(__playto_h__): 37 | __playto_h__ = VOID 38 | if defined(_MSC_VER) and (_MSC_VER >= 1020): 39 | pass 40 | # END IF 41 | 42 | # Forward Declarations 43 | # header files for imported files 44 | from pyWinAPI.um.mfsharingengine_h import * # NOQA 45 | if defined(__cplusplus): 46 | pass 47 | # END IF 48 | 49 | # interface __MIDL_itf_playto_0000_0000 50 | # [local] 51 | from pyWinAPI.shared.winapifamily_h import * # NOQA 52 | 53 | if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP): 54 | if NTDDI_VERSION >= NTDDI_WIN8: 55 | pass 56 | # END IF (NTDDI_VERSION >= NTDDI_WIN8) 57 | # END IF WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) 58 | 59 | # Additional Prototypes for ALL interfaces 60 | # end of Additional Prototypes 61 | if defined(__cplusplus): 62 | pass 63 | # END IF 64 | 65 | # END IF 66 | 67 | 68 | -------------------------------------------------------------------------------- /shared/usbdi_h.py: -------------------------------------------------------------------------------- 1 | from pyWinAPI import * 2 | 3 | # + + Copyright 2004(c) Microsoft Corporation. All rights reserved. Module 4 | # Name: USBDI.H Abstract: Obsolete header. Use usb.h. Environment: Kernel & 5 | # user mode Revision History: 09 - 29 - 95 : created 02 - 01 - 04 : updated to 6 | # use usb.h - - 7 | 8 | __USBDI_H__ = None 9 | 10 | if not defined(__USBDI_H__): 11 | __USBDI_H__ = 1 12 | from pyWinAPI.shared.winapifamily_h import * # NOQA 13 | 14 | if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP): 15 | from pyWinAPI.shared.usb_h import * # NOQA 16 | from pyWinAPI.shared.usbioctl_h import * # NOQA 17 | 18 | # The following are deprecated definitions. These should not be used 19 | USBD_STATUS_CANCELLING = 0x00020000 20 | USBD_STATUS_CANCELING = 0x00020000 21 | USBD_STATUS_NO_MEMORY = 0x80000100 22 | USBD_STATUS_ERROR = 0x80000000 23 | USBD_STATUS_REQUEST_FAILED = 0x80000500 24 | USBD_STATUS_HALTED = 0xC0000000 25 | 26 | 27 | def USBD_HALTED(Status): 28 | return Status >> 30 == 3 29 | 30 | 31 | def USBD_STATUS(Status): 32 | return Status & 0x0FFFFFFF 33 | 34 | 35 | URB_FUNCTION_RESERVED0 = 0x0016 36 | URB_FUNCTION_RESERVED = 0x001D 37 | URB_FUNCTION_LAST = 0x0029 38 | USBD_PF_DOUBLE_BUFFER = 0x00000002 39 | 40 | if defined(USBD_PF_VALID_MASK): 41 | pass 42 | 43 | # END IF 44 | USBD_PF_VALID_MASK = ( 45 | USBD_PF_CHANGE_MAX_PACKET | 46 | USBD_PF_DOUBLE_BUFFER | 47 | USBD_PF_ENABLE_RT_THREAD_ACCESS | 48 | USBD_PF_MAP_ADD_TRANSFERS 49 | ) 50 | USBD_TRANSFER_DIRECTION_BIT = 0 51 | USBD_SHORT_TRANSFER_OK_BIT = 1 52 | USBD_START_ISO_TRANSFER_ASAP_BIT = 2 53 | 54 | if defined(USBD_TRANSFER_DIRECTION): 55 | pass 56 | # END IF 57 | 58 | def USBD_TRANSFER_DIRECTION(x): 59 | return x & USBD_TRANSFER_DIRECTION_IN 60 | 61 | # END IF WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) 62 | # END IF __USBDI_H__ 63 | -------------------------------------------------------------------------------- /shared/cderr_h.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | from pyWinAPI import * 3 | from pyWinAPI.shared.wtypes_h import * 4 | from pyWinAPI.shared.winapifamily_h import * 5 | from pyWinAPI.shared.sdkddkver_h import * 6 | from pyWinAPI.shared.guiddef_h import * 7 | 8 | 9 | _INC_CDERR = None 10 | 11 | 12 | # ***************************************************************************\ 13 | # * cderr.h - Common dialog error return codes * * Version 1.0 * * 14 | # Copyright (c) 1992-1999, Microsoft Corp. All rights reserved. * * 15 | # \*************************************************************************** 16 | if not defined(_INC_CDERR): 17 | _INC_CDERR = VOID 18 | if _MSC_VER > 1000: 19 | pass 20 | # END IF 21 | 22 | CDERR_DIALOGFAILURE = 0xFFFF 23 | CDERR_GENERALCODES = 0x0000 24 | CDERR_STRUCTSIZE = 0x0001 25 | CDERR_INITIALIZATION = 0x0002 26 | CDERR_NOTEMPLATE = 0x0003 27 | CDERR_NOHINSTANCE = 0x0004 28 | CDERR_LOADSTRFAILURE = 0x0005 29 | CDERR_FINDRESFAILURE = 0x0006 30 | CDERR_LOADRESFAILURE = 0x0007 31 | CDERR_LOCKRESFAILURE = 0x0008 32 | CDERR_MEMALLOCFAILURE = 0x0009 33 | CDERR_MEMLOCKFAILURE = 0x000A 34 | CDERR_NOHOOK = 0x000B 35 | CDERR_REGISTERMSGFAIL = 0x000C 36 | PDERR_PRINTERCODES = 0x1000 37 | PDERR_SETUPFAILURE = 0x1001 38 | PDERR_PARSEFAILURE = 0x1002 39 | PDERR_RETDEFFAILURE = 0x1003 40 | PDERR_LOADDRVFAILURE = 0x1004 41 | PDERR_GETDEVMODEFAIL = 0x1005 42 | PDERR_INITFAILURE = 0x1006 43 | PDERR_NODEVICES = 0x1007 44 | PDERR_NODEFAULTPRN = 0x1008 45 | PDERR_DNDMMISMATCH = 0x1009 46 | PDERR_CREATEICFAILURE = 0x100A 47 | PDERR_PRINTERNOTFOUND = 0x100B 48 | PDERR_DEFAULTDIFFERENT = 0x100C 49 | CFERR_CHOOSEFONTCODES = 0x2000 50 | CFERR_NOFONTS = 0x2001 51 | CFERR_MAXLESSTHANMIN = 0x2002 52 | FNERR_FILENAMECODES = 0x3000 53 | FNERR_SUBCLASSFAILURE = 0x3001 54 | FNERR_INVALIDFILENAME = 0x3002 55 | FNERR_BUFFERTOOSMALL = 0x3003 56 | FRERR_FINDREPLACECODES = 0x4000 57 | FRERR_BUFFERLENGTHZERO = 0x4001 58 | CCERR_CHOOSECOLORCODES = 0x5000 59 | # END IF not _INC_CDERR 60 | 61 | 62 | -------------------------------------------------------------------------------- /km/crt/_70_xstddef: -------------------------------------------------------------------------------- 1 | // xstddef standard header 2 | #pragma once 3 | #ifndef _XSTDDEF_ 4 | #define _XSTDDEF_ 5 | #ifndef RC_INVOKED 6 | #ifndef _YVALS 7 | #include 8 | #endif /* _YVALS */ 9 | 10 | #include 11 | 12 | #ifdef _MSC_VER 13 | #pragma pack(push,_CRT_PACKING) 14 | #pragma warning(push,3) 15 | #endif /* _MSC_VER */ 16 | 17 | #if defined (_HAS_EXCEPTIONS) 18 | #if !_HAS_EXCEPTIONS 19 | #error "_HAS_EXCEPTIONS == 0 is not supported." 20 | #endif 21 | #endif 22 | 23 | _STD_BEGIN 24 | 25 | // EXCEPTION MACROS 26 | 27 | #define _TRY_BEGIN try { 28 | #define _CATCH(x) } catch (x) { 29 | #define _CATCH_ALL } catch (...) { 30 | #define _CATCH_END } 31 | 32 | #define _RAISE(x) throw (x) 33 | #define _RERAISE throw 34 | 35 | #define _THROW0() throw () 36 | #define _THROW1(x) throw (...) 37 | 38 | #define _THROW(x, y) throw x(y) 39 | #define _THROW_NCEE(x, y) _THROW(x, y) 40 | 41 | 42 | // BITMASK MACROS 43 | #define _BITMASK(Enum, Ty) typedef int Ty 44 | 45 | #define _BITMASK_OPS(Ty) 46 | 47 | // MISCELLANEOUS MACROS 48 | #define _DESTRUCTOR(ty, ptr) (ptr)->~ty() 49 | #define _MESG(str) str 50 | #define _PROTECTED protected 51 | 52 | #define _TDEF(x) = x 53 | #define _TDEF2(x, y) = x, y 54 | 55 | #define _STCONS(ty, name, val) static const ty name = (ty)(val) 56 | 57 | #ifndef _XSTD 58 | #define _X_STD_BEGIN _STD_BEGIN 59 | #define _X_STD_END _STD_END 60 | #define _XSTD std::/* LEAVE SPACE */ 61 | #endif /* _XSTD */ 62 | 63 | // TYPE DEFINITIONS 64 | enum _Uninitialized 65 | { // tag for suppressing initialization 66 | _Noinit}; 67 | _STD_END 68 | 69 | #ifdef _MSC_VER 70 | #pragma warning(pop) 71 | #pragma pack(pop) 72 | #endif /* _MSC_VER */ 73 | 74 | #endif /* RC_INVOKED */ 75 | #endif /* _XSTDDEF_ */ 76 | 77 | /* 78 | * Copyright (c) 1992-2004 by P.J. Plauger. ALL RIGHTS RESERVED. 79 | * Consult your license regarding permissions and restrictions. 80 | V4.03:0009 */ 81 | // The file \sdpublic\sdk\inc\crt\_70_xstddef was reviewed by LCA in June 2011 and per license is 82 | // acceptable for Microsoft use under Dealpoint ID 46582, 201971 83 | /* 88bf0570-3001-4e78-a5f2-be5765546192 */ 84 | -------------------------------------------------------------------------------- /km/amtvuids_h.py: -------------------------------------------------------------------------------- 1 | from pyWinAPI import * 2 | from pyWinAPI.shared.guiddef_h import * 3 | 4 | OUR_GUID_ENTRY = None 5 | 6 | if not defined(OUR_GUID_ENTRY): 7 | def OUR_GUID_ENTRY(l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8): 8 | return DEFINE_GUID(l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) 9 | 10 | # END IF 11 | CLSID_CTVTunerFilter = OUR_GUID_ENTRY( 12 | 0x266EEE40, 13 | 0x6C63, 14 | 0x11CF, 15 | 0x8A, 16 | 0x3, 17 | 0x0, 18 | 0xAA, 19 | 0x0, 20 | 0x6E, 21 | 0xCB, 22 | 0x65 23 | ) 24 | CLSID_CTVTunerFilterPropertyPage = OUR_GUID_ENTRY( 25 | 0x266EEE41, 26 | 0x6C63, 27 | 0x11CF, 28 | 0x8A, 29 | 0x3, 30 | 0x0, 31 | 0xAA, 32 | 0x0, 33 | 0x6E, 34 | 0xCB, 35 | 0x65 36 | ) 37 | IID_AnalogVideoStandard = OUR_GUID_ENTRY( 38 | 0x266EEE44, 39 | 0x6C63, 40 | 0x11CF, 41 | 0x8A, 42 | 0x3, 43 | 0x0, 44 | 0xAA, 45 | 0x0, 46 | 0x6E, 47 | 0xCB, 48 | 0x65 49 | ) 50 | IID_TunerInputType = OUR_GUID_ENTRY( 51 | 0x266EEE46, 52 | 0x6C63, 53 | 0x11CF, 54 | 0x8A, 55 | 0x3, 56 | 0x0, 57 | 0xAA, 58 | 0x0, 59 | 0x6E, 60 | 0xCB, 61 | 0x65 62 | ) 63 | CLSID_CrossbarFilter = OUR_GUID_ENTRY( 64 | 0x71F96460, 65 | 0x78F3, 66 | 0x11D0, 67 | 0xA1, 68 | 0x8C, 69 | 0x0, 70 | 0xA0, 71 | 0xC9, 72 | 0x11, 73 | 0x89, 74 | 0x56 75 | ) 76 | CLSID_CrossbarFilterPropertyPage = OUR_GUID_ENTRY( 77 | 0x71F96461, 78 | 0x78F3, 79 | 0x11D0, 80 | 0xA1, 81 | 0x8C, 82 | 0x0, 83 | 0xA0, 84 | 0xC9, 85 | 0x11, 86 | 0x89, 87 | 0x56 88 | ) 89 | CLSID_TVAudioFilter = OUR_GUID_ENTRY( 90 | 0x71F96462, 91 | 0x78F3, 92 | 0x11D0, 93 | 0xA1, 94 | 0x8C, 95 | 0x0, 96 | 0xA0, 97 | 0xC9, 98 | 0x11, 99 | 0x89, 100 | 0x56 101 | ) 102 | CLSID_TVAudioFilterPropertyPage = OUR_GUID_ENTRY( 103 | 0x71F96463, 104 | 0x78F3, 105 | 0x11D0, 106 | 0xA1, 107 | 0x8C, 108 | 0x0, 109 | 0xA0, 110 | 0xC9, 111 | 0x11, 112 | 0x89, 113 | 0x56 114 | ) 115 | -------------------------------------------------------------------------------- /um/vptype_h.py: -------------------------------------------------------------------------------- 1 | from .winapifamily_h import * # NOQA 2 | from .wtypes_h import( 3 | ENUM, 4 | POINTER, 5 | DWORD, 6 | RECT, 7 | BOOL, 8 | LONG 9 | ) 10 | import ctypes 11 | 12 | 13 | class _AMVP_SELECT_FORMAT_BY(ENUM): 14 | AMVP_DO_NOT_CARE = 0 15 | AMVP_BEST_BANDWIDTH = 1 16 | AMVP_INPUT_SAME_AS_OUTPUT = 2 17 | 18 | 19 | AMVP_SELECT_FORMAT_BY = _AMVP_SELECT_FORMAT_BY 20 | 21 | 22 | class _AMVP_MODE(ENUM): 23 | AMVP_MODE_WEAVE = 0 24 | AMVP_MODE_BOBINTERLEAVED = 1 25 | AMVP_MODE_BOBNONINTERLEAVED = 2 26 | AMVP_MODE_SKIPEVEN = 3 27 | AMVP_MODE_SKIPODD = 4 28 | 29 | 30 | AMVP_MODE = _AMVP_MODE 31 | 32 | 33 | class _AMVPSIZE(ctypes.Structure): 34 | _fields_ = [ 35 | ('dwWidth', DWORD), 36 | ('dwHeight', DWORD) 37 | ] 38 | 39 | 40 | AMVPSIZE = _AMVPSIZE 41 | LPAMVPSIZE = POINTER(_AMVPSIZE) 42 | 43 | 44 | class _AMVPDIMINFO(ctypes.Structure): 45 | _fields_ = [ 46 | ('dwFieldWidth', DWORD), 47 | ('dwFieldHeight', DWORD), 48 | ('dwVBIWidth', DWORD), 49 | ('dwVBIHeight', DWORD), 50 | ('rcValidRegion', RECT), 51 | ] 52 | 53 | 54 | AMVPDIMINFO = _AMVPDIMINFO 55 | LPAMVPDIMINFO = POINTER(_AMVPDIMINFO) 56 | 57 | 58 | class _AMVPDATAINFO(ctypes.Structure): 59 | _fields_ = [ 60 | ('dwSize', DWORD), 61 | ('dwMicrosecondsPerField', DWORD), 62 | ('amvpDimInfo', AMVPDIMINFO), 63 | ('dwPictAspectRatioX', DWORD), 64 | ('dwPictAspectRatioY', DWORD), 65 | ('bEnableDoubleClock', BOOL), 66 | ('bEnableVACT', BOOL), 67 | ('bDataIsInterlaced', BOOL), 68 | ('lHalfLinesOdd', LONG), 69 | ('bFieldPolarityInverted', BOOL), 70 | ('dwNumLinesInVREF', DWORD), 71 | ('lHalfLinesEven', LONG), 72 | ('dwReserved1', DWORD), 73 | ] 74 | 75 | 76 | AMVPDATAINFO = _AMVPDATAINFO 77 | LPAMVPDATAINFO = POINTER(_AMVPDATAINFO) 78 | 79 | 80 | __all__ = ( 81 | '_AMVP_SELECT_FORMAT_BY', 'AMVP_SELECT_FORMAT_BY', '_AMVP_MODE', 82 | 'AMVP_MODE', '_AMVPSIZE', 'AMVPSIZE', 'LPAMVPSIZE', '_AMVPDIMINFO', 83 | 'AMVPDIMINFO', 'LPAMVPDIMINFO', '_AMVPDATAINFO', 'AMVPDATAINFO', 84 | 'LPAMVPDATAINFO' 85 | ) 86 | -------------------------------------------------------------------------------- /um/unknwn_h.py: -------------------------------------------------------------------------------- 1 | __REQUIRED_RPCNDR_H_VERSION__ = 0x1F4 2 | __REQUIRED_RPCSAL_H_VERSION__ = 0x64 3 | # from .rpc_h import * # NOQA 4 | # from .rpcndr_h import * # NOQA 5 | # from .windows_h import * # NOQA 6 | # from .ole2_h import * # NOQA 7 | from .winapifamily_h import * # NOQA 8 | 9 | 10 | from .wtypes_h import ( 11 | REFIID, 12 | VOID, 13 | POINTER, 14 | HRESULT, 15 | ULONG, 16 | BOOL, 17 | ) 18 | from .guiddef_h import ( 19 | IID, 20 | ) 21 | import comtypes 22 | 23 | 24 | IID_AsyncIUnknown = IID( 25 | '{000e0000-0000-0000-C000-000000000046}' 26 | ) 27 | 28 | 29 | class AsyncIUnknown(comtypes.IUnknown): 30 | _case_insensitive_ = True 31 | _iid_ = IID_AsyncIUnknown 32 | _idlflags_ = [] 33 | 34 | 35 | IID_IClassFactory = IID( 36 | '{00000001-0000-0000-C000-000000000046}' 37 | ) 38 | 39 | 40 | class IClassFactory(comtypes.IUnknown): 41 | _case_insensitive_ = True 42 | _iid_ = IID_IClassFactory 43 | _idlflags_ = [] 44 | 45 | 46 | IUnknown = comtypes.IUnknown 47 | LPUNKNOWN = POINTER(IUnknown) 48 | 49 | 50 | COMMETHOD = comtypes.COMMETHOD 51 | 52 | AsyncIUnknown._methods_ = [ 53 | COMMETHOD( 54 | [], 55 | HRESULT, 56 | 'Begin_QueryInterface', 57 | (['in'], REFIID, 'riid'), 58 | ), 59 | COMMETHOD( 60 | [], 61 | HRESULT, 62 | 'Finish_QueryInterface', 63 | (['out'], POINTER(POINTER(VOID)), 'ppvObject'), 64 | ), 65 | COMMETHOD( 66 | [], 67 | ULONG, 68 | 'Finish_Release' 69 | ), 70 | ] 71 | 72 | 73 | LPCLASSFACTORY = POINTER(IClassFactory) 74 | 75 | 76 | IClassFactory._methods_ = [ 77 | COMMETHOD( 78 | [], 79 | HRESULT, 80 | 'CreateInstance', 81 | (['in'], POINTER(comtypes.IUnknown), 'pUnkOuter'), 82 | (['in'], REFIID, 'riid'), 83 | (['out'], POINTER(POINTER(VOID)), 'ppvObject'), 84 | ), 85 | COMMETHOD( 86 | [], 87 | HRESULT, 88 | 'LockServer', 89 | (['in'], BOOL, 'fLock'), 90 | ), 91 | ] 92 | 93 | 94 | __all__ = ( 95 | 'AsyncIUnknown', 'IClassFactory', 'LPCLASSFACTORY', 'IUnknown', 96 | '__REQUIRED_RPCSAL_H_VERSION__', '__REQUIRED_RPCNDR_H_VERSION__', 97 | 'LPUNKNOWN', 98 | ) 99 | -------------------------------------------------------------------------------- /um/errors_h.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | from pyWinAPI import * 3 | from pyWinAPI.shared.wtypes_h import * 4 | 5 | 6 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 7 | # - - 8 | # File: Errors.h 9 | # Desc: ActiveMovie error defines. 10 | # Copyright (c) 1992 - 2001, Microsoft Corporation. All rights reserved. 11 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 12 | # - - 13 | 14 | __ERRORS__ = None 15 | if not defined(__ERRORS__): 16 | __ERRORS__ = 1 17 | from pyWinAPI.shared.winapifamily_h import * # NOQA 18 | 19 | if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP): 20 | _AMOVIE_ = 0 21 | 22 | if defined(__cplusplus): 23 | pass 24 | # END IF __cplusplus 25 | 26 | if not defined(_AMOVIE_): 27 | AMOVIEAPI = DECLSPEC_IMPORT 28 | else: 29 | AMOVIEAPI = 1 30 | # END IF 31 | # codes 0 - 01ff are reserved for OLE 32 | VFW_FIRST_CODE = 0x200 33 | MAX_ERROR_TEXT_LEN = 160 34 | 35 | # includes all message definitions 36 | from pyWinAPI.um.vfwmsgs_h import * # NOQA 37 | 38 | AMGETERRORTEXTPROCA = CALLBACK(BOOL, HRESULT, CHAR, DWORD) 39 | AMGETERRORTEXTPROCW = CALLBACK(BOOL, HRESULT, WCHAR, DWORD) 40 | 41 | quartz = ctypes.windll.quartz 42 | 43 | # AMOVIEAPI DWORD WINAPI AMGetErrorTextA( HRESULT hr , _Out_writes_(MaxLen) LPSTR pbuffer , DWORD MaxLen); 44 | AMGetErrorTextA = quartz.AMGetErrorTextA 45 | AMGetErrorTextA.restype = DWORD 46 | 47 | # AMOVIEAPI DWORD WINAPI AMGetErrorTextW( HRESULT hr , _Out_writes_(MaxLen) LPWSTR pbuffer , DWORD MaxLen); 48 | AMGetErrorTextW = quartz.AMGetErrorTextW 49 | AMGetErrorTextW.restype = DWORD 50 | 51 | 52 | if defined(UNICODE): 53 | AMGetErrorText = AMGetErrorTextW 54 | AMGETERRORTEXTPROC = AMGETERRORTEXTPROCW 55 | else: 56 | AMGetErrorText = AMGetErrorTextA 57 | AMGETERRORTEXTPROC = AMGETERRORTEXTPROCA 58 | # END IF 59 | if defined(__cplusplus): 60 | pass 61 | # END IF __cplusplus 62 | # END IF WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) 63 | # END IF __ERRORS__ 64 | -------------------------------------------------------------------------------- /um/audiomediatype_h.py: -------------------------------------------------------------------------------- 1 | __REQUIRED_RPCNDR_H_VERSION__ = 0x000001F4 2 | __REQUIRED_RPCSAL_H_VERSION__ = 0x00000064 3 | # from rpc_h import * # NOQA 4 | # from rpcndr_h import * # NOQA 5 | # from windows_h import * # NOQA 6 | # from ole2_h import * # NOQA 7 | from .oaidl_h import * # NOQA 8 | from .ocidl_h import * # NOQA 9 | from .mmreg_h import * # NOQA 10 | from .winapifamily_h import * # NOQA 11 | 12 | import ctypes 13 | import comtypes 14 | from .wtypes_h import ( 15 | BOOL, 16 | POINTER, 17 | HRESULT, 18 | DWORD, 19 | GUID, 20 | FLOAT, 21 | ) 22 | from .guiddef_h import IID 23 | 24 | 25 | class _UNCOMPRESSEDAUDIOFORMAT(ctypes.Structure): 26 | _fields_ = [ 27 | ('guidFormatType', GUID), 28 | ('dwSamplesPerFrame', DWORD), 29 | ('dwBytesPerSampleContainer', DWORD), 30 | ('dwValidBitsPerSample', DWORD), 31 | ('fFramesPerSecond', FLOAT), 32 | ('dwChannelMask', DWORD), 33 | ] 34 | 35 | UNCOMPRESSEDAUDIOFORMAT = _UNCOMPRESSEDAUDIOFORMAT 36 | 37 | COMMETHOD = comtypes.COMMETHOD 38 | 39 | IID_IAudioMediaType = IID( 40 | '{4E997F73-B71F-4798-873B-ED7DFCF15B4D}' 41 | ) 42 | 43 | 44 | class IAudioMediaType(comtypes.IUnknown): 45 | _case_insensitive_ = True 46 | _iid_ = IID_IAudioMediaType 47 | _idlflags_ = [] 48 | 49 | 50 | IAudioMediaType._methods_ = [ 51 | COMMETHOD( 52 | [], 53 | HRESULT, 54 | 'IsCompressedFormat', 55 | (['out'], POINTER(BOOL), 'pfCompressed'), 56 | ), 57 | COMMETHOD( 58 | [], 59 | HRESULT, 60 | 'IsEqual', 61 | (['in'], POINTER(IAudioMediaType), 'pIAudioType'), 62 | (['out'], POINTER(DWORD), 'pdwFlags'), 63 | ), 64 | COMMETHOD( 65 | [], 66 | HRESULT, 67 | 'GetUncompressedAudioFormat', 68 | (['out'], POINTER(UNCOMPRESSEDAUDIOFORMAT), 'pUncompressedAudioFormat'), 69 | ), 70 | ] 71 | 72 | 73 | AUDIOMEDIATYPE_EQUAL_FORMAT_TYPES = 0x00000002 74 | AUDIOMEDIATYPE_EQUAL_FORMAT_DATA = 0x00000004 75 | AUDIOMEDIATYPE_EQUAL_FORMAT_USER_DATA = 0x00000008 76 | 77 | 78 | __all__ = ( 79 | '_UNCOMPRESSEDAUDIOFORMAT', 'UNCOMPRESSEDAUDIOFORMAT', 'IAudioMediaType', 80 | 'IID_IAudioMediaType', 'AUDIOMEDIATYPE_EQUAL_FORMAT_TYPES', 81 | 'AUDIOMEDIATYPE_EQUAL_FORMAT_DATA', 'AUDIOMEDIATYPE_EQUAL_FORMAT_USER_DATA' 82 | ) 83 | -------------------------------------------------------------------------------- /winrt/hstring_h.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | from wtypes_h import ( 4 | INT, 5 | PVOID, 6 | CHAR, 7 | POINTER, 8 | ) 9 | import ctypes 10 | 11 | 12 | # this ALWAYS GENERATED file contains the definitions for the INTerfaces 13 | # File created by MIDL compiler version 8.01.0622 14 | # @@MIDL_FILE_HEADING( ) 15 | # verify that the version is high enough to compile this file 16 | __REQUIRED_RPCNDR_H_VERSION__ = 0x000001F4 17 | # verify that the version is high enough to compile this file 18 | __REQUIRED_RPCSAL_H_VERSION__ = 0x00000064 19 | # from rpc_h import * # NOQA 20 | # from rpcndr_h import * # NOQA 21 | # __RPCNDR_H_VERSION__ 22 | # Forward Declarations 23 | # header files for imported files 24 | # INTerface __MIDL_itf_hstring_0000_0000 25 | # [local] 26 | # +------------------------------------------------------------------------- 27 | 28 | # Microsoft Windows 29 | # Copyright (c) Microsoft Corporation. All rights reserved. 30 | 31 | # -------------------------------------------------------------------------- 32 | # Declare the HSTRING handle as wire_marshal for midl only 33 | 34 | class HSTRING__(ctypes.Structure): 35 | _fields_ = [ 36 | ('unused', INT), 37 | ] 38 | 39 | 40 | # [unique][wire_marshal] 41 | HSTRING = POINTER(HSTRING__) 42 | # Declaring a handle dummy struct for HSTRING the same way DECLARE_HANDLE does. 43 | 44 | 45 | class HSTRING_HEADER(ctypes.Structure): 46 | 47 | class Reserved(ctypes.Union): 48 | _fields_ = [ 49 | ('Reserved1', PVOID), 50 | ('Reserved2', CHAR * 24), 51 | ('Reserved2', CHAR * 20), 52 | ] 53 | 54 | _fields_ = [ 55 | ('Reserved', Reserved), 56 | ] 57 | 58 | 59 | 60 | # Declare the HSTRING_BUFFER for the HSTRING's two-phase construction 61 | # functions. 62 | 63 | # This route eliminates the PCWSTR string copy that happens when passing it to 64 | # the traditional WindowsCreateString(). The caller preallocates a string 65 | # buffer, 66 | # sets the wide CHARacter string values in that buffer, and finally promotes 67 | # the 68 | # buffer to an HSTRING. If a buffer is never promoted, it can still be 69 | # deleted. 70 | # Additional Prototypes for ALL INTerfaces 71 | # end of Additional Prototypes 72 | 73 | __all__ = ( 74 | '__REQUIRED_RPCSAL_H_VERSION__', '__REQUIRED_RPCNDR_H_VERSION__', 75 | 'HSTRING__', 'HSTRING_HEADER', 'HSTRING', 76 | ) 77 | -------------------------------------------------------------------------------- /km/crt/xstddef: -------------------------------------------------------------------------------- 1 | #if defined _STL70_ 2 | #include "_70_xstddef" 3 | #define _CNTSIZ(iter) ptrdiff_t 4 | #elif defined _STL100_ 5 | #include "_100_xstddef" 6 | #elif defined _STL110_ 7 | #include "_110_xstddef" 8 | #else 9 | 10 | // xstddef standard header 11 | #ifndef _XSTDDEF_ 12 | #define _XSTDDEF_ 13 | #ifndef _YVALS 14 | #include 15 | #endif 16 | #include 17 | #include 18 | 19 | #ifdef _MSC_VER 20 | #pragma pack(push,8) 21 | #endif /* _MSC_VER */ 22 | _STD_BEGIN 23 | // EXCEPTION MACROS 24 | #if defined (_HAS_EXCEPTIONS) 25 | #if !_HAS_EXCEPTIONS 26 | #error "_HAS_EXCEPTIONS == 0 is not supported." 27 | #endif 28 | #endif 29 | #define _HAS_EXCEPTIONS 1 30 | #if _HAS_EXCEPTIONS 31 | #define _TRY_BEGIN try { 32 | #define _CATCH(x) } catch (x) { 33 | #define _CATCH_ALL } catch (...) { 34 | #define _CATCH_END } 35 | #define _RAISE(x) throw (x) 36 | #define _RERAISE throw 37 | #define _THROW0() throw () 38 | #define _THROW1(x) throw (x) 39 | #define _THROW(x, y) throw x(y) 40 | #else /* no exceptions */ 41 | #define _TRY_BEGIN {{ 42 | #define _CATCH(x) } if (0) { 43 | #define _CATCH_ALL } if (0) { 44 | #define _CATCH_END }} 45 | 46 | #define _RAISE(x) (x) 47 | #define _RERAISE 48 | 49 | #define _THROW0() 50 | #define _THROW1(x) 51 | #define _THROW(x, y) x(y) 52 | #endif /* _HAS_EXCEPTIONS */ 53 | // explicit KEYWORD 54 | // BITMASK MACROS 55 | #define _BITMASK(E, T) typedef int T 56 | #define _BITMASK_OPS(T) 57 | // MISCELLANEOUS MACROS 58 | #define _DESTRUCTOR(ty, ptr) (ptr)->~ty() 59 | #define _MESG(str) str 60 | #define _PROTECTED public 61 | #define _TDEF(x) = x 62 | #define _TDEF2(x, y) = x, y 63 | #define _CNTSIZ(iter) ptrdiff_t 64 | #define _TDEFP(x) 65 | #define _STCONS(ty, name, val) enum {name = val} 66 | // TYPE DEFINITIONS 67 | enum _Uninitialized {_Noinit}; 68 | // FUNCTIONS 69 | _CRTIMP2 void __cdecl _Nomemory(); 70 | _STD_END 71 | #ifdef _MSC_VER 72 | #pragma pack(pop) 73 | #endif /* _MSC_VER */ 74 | 75 | #endif /* _XSTDDEF_ */ 76 | 77 | /* 78 | * Copyright (c) 1995 by P.J. Plauger. ALL RIGHTS RESERVED. 79 | * Consult your license regarding permissions and restrictions. 80 | */ 81 | // The file \sdpublic\sdk\inc\crt\xstddef was reviewed by LCA in June 2011 and per license is 82 | // acceptable for Microsoft use under Dealpoint ID 46582, 201971 83 | 84 | #endif // _STL70_ or _100_ or _110_ 85 | /* 88bf0570-3001-4e78-a5f2-be5765546192 */ 86 | -------------------------------------------------------------------------------- /shared/gpio_h.py: -------------------------------------------------------------------------------- 1 | from pyWinAPI import * 2 | from pyWinAPI.shared.winapifamily_h import * 3 | from pyWinAPI.shared.sdkddkver_h import * 4 | from pyWinAPI.shared.devioctl_h import * 5 | 6 | 7 | # + + Copyright (c) Microsoft Corporation. All rights reserved. THIS CODE AND 8 | # INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 9 | # EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF 10 | # MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. Module Name: gpio.h 11 | # Abstract: Header file that defines structures, prototypes and definitions 12 | # required by consumers of GPIO services. Environment: Kernel mode - - 13 | __GPIO_W__ = None 14 | 15 | if not defined(__GPIO_W__): 16 | __GPIO_W__ = 1 17 | from winapifamily_h import * # NOQA 18 | 19 | if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP): 20 | if NTDDI_VERSION >= NTDDI_WIN8: 21 | if defined(__cplusplus): 22 | pass 23 | # END IF 24 | 25 | # Define IOCTL to read from a set of GPIO pins (input). 26 | IOCTL_GPIO_READ_PINS = CTL_CODE( 27 | FILE_DEVICE_GPIO, 28 | 0x0, 29 | METHOD_BUFFERED, 30 | FILE_ANY_ACCESS, 31 | ) 32 | 33 | # Define IOCTL to write to a set of GPIO pins (output). 34 | IOCTL_GPIO_WRITE_PINS = CTL_CODE( 35 | FILE_DEVICE_GPIO, 36 | 0x1, 37 | METHOD_BUFFERED, 38 | FILE_ANY_ACCESS, 39 | ) 40 | 41 | # Define IOCTL for handling GPIO controller - specific 42 | # functionality. 43 | IOCTL_GPIO_CONTROLLER_SPECIFIC_FUNCTION = CTL_CODE( 44 | FILE_DEVICE_GPIO, 45 | 0x2, 46 | METHOD_BUFFERED, 47 | FILE_ANY_ACCESS, 48 | ) 49 | 50 | if NTDDI_VERSION >= NTDDI_WIN10_RS1: 51 | # Define IOCTL to commit function config pin settings to HW. 52 | IOCTL_GPIO_COMMIT_FUNCTION_CONFIG_PINS = CTL_CODE( 53 | FILE_DEVICE_GPIO, 54 | 0x4, 55 | METHOD_BUFFERED, 56 | FILE_ANY_ACCESS, 57 | ) 58 | # END IF 59 | if defined(__cplusplus): 60 | pass 61 | # END IF # END IF (NTDDI_VERSION >= NTDDI_WIN8) # END IF WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)# END IF __GPIO_W__ 62 | -------------------------------------------------------------------------------- /um/cguid_h.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | from pyWinAPI import * 3 | from pyWinAPI.shared.wtypes_h import * 4 | 5 | from pyWinAPI.shared.sdkddkver_h import * 6 | from pyWinAPI.shared.guiddef_h import * 7 | 8 | 9 | __CGUID_H__ = None 10 | 11 | 12 | from pyWinAPI.shared.winapifamily_h import * # NOQA 13 | 14 | # /* + 15 | # ------------------------------------------------------------------------- 16 | # Microsoft Windows Copyright (c) Microsoft Corporation. All rights reserved. 17 | # File: cguid.h - 18 | if not defined(__CGUID_H__): 19 | __CGUID_H__ = VOID 20 | if _MSC_VER > 1000: 21 | pass 22 | # END IF 23 | 24 | if _MSC_VER >= 800: 25 | if _MSC_VER >= 1200: 26 | pass 27 | # END IF 28 | # END IF 29 | 30 | 31 | if defined(__cplusplus): 32 | pass 33 | # END IF 34 | 35 | 36 | if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP): 37 | pass 38 | # END IF WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) 39 | 40 | if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP): 41 | if NTDDI_VERSION >= NTDDI_WINXP: 42 | pass 43 | # END IF 44 | 45 | # END IF WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) 46 | 47 | if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM): 48 | pass 49 | # END IF WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM) 50 | 51 | 52 | if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP): 53 | if NTDDI_VERSION >= NTDDI_WINXP: 54 | pass 55 | # END IF 56 | 57 | if NTDDI_VERSION >= NTDDI_VISTA: 58 | pass 59 | # END IF 60 | 61 | # -------------------------------------------- 62 | # CD Forms CLSIDs 63 | # -------------------------------------------- 64 | # Form Kernel objects 65 | # Control objects 66 | # Property Pages # END IF WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) 67 | if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP): 68 | pass 69 | # END IF WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) 70 | 71 | if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP): 72 | # Enumerations 73 | pass 74 | # END IF WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) 75 | if defined(__cplusplus): 76 | pass 77 | # END IF 78 | 79 | if _MSC_VER >= 800: 80 | if _MSC_VER >= 1200: 81 | pass 82 | else: 83 | pass 84 | # END IF 85 | 86 | # END IF 87 | 88 | # END IF __CGUID_H__ 89 | 90 | 91 | -------------------------------------------------------------------------------- /km/struchdr_h.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | from pyWinAPI import * 3 | from pyWinAPI.shared.wtypes_h import * 4 | from pyWinAPI.shared.winapifamily_h import * 5 | from pyWinAPI.shared.sdkddkver_h import * 6 | from pyWinAPI.shared.guiddef_h import * 7 | 8 | 9 | # /* + + Copyright (c) 1989 Microsoft Corporation Module Name: StrucHdr.h 10 | # Abstract: This module predefines the structures for important data 11 | # structures so that we can always talk about them.... even though they're not 12 | # defined yet. Author: Revision History: - - 13 | 14 | _RDBSSSTRUCHDR_ = None 15 | 16 | if not defined(_RDBSSSTRUCHDR_): 17 | from pyWinAPI.km.nodetype_h import * # NOQA 18 | from pyWinAPI.km.prefix_h import * # NOQA 19 | from pyWinAPI.km.rxstruc_h import * # NOQA 20 | 21 | _RDBSSSTRUCHDR_ = 1 22 | 23 | def IMPORTANT_STRUCTURE(x): 24 | return x 25 | 26 | PNODE_TYPE_CODE_AND_SIZE = POINTER(NODE_TYPE_CODE_AND_SIZE) 27 | 28 | PRX_PREFIX_ENTRY = POINTER(RX_PREFIX_ENTRY) 29 | 30 | PRX_PREFIX_TABLE = POINTER(RX_PREFIX_TABLE) 31 | 32 | PRX_FSD_DISPATCH_VECTOR = POINTER(RX_FSD_DISPATCH_VECTOR) 33 | 34 | PRDBSS_DATA = POINTER(RDBSS_DATA) 35 | 36 | PRDBSS_EXPORTS = POINTER(RDBSS_EXPORTS) 37 | 38 | PVCB = POINTER(VCB) 39 | 40 | PRDBSS_DEVICE_OBJECT = POINTER(RDBSS_DEVICE_OBJECT) 41 | 42 | PFILE_NAME_NODE = POINTER(FILE_NAME_NODE) 43 | 44 | PREPINNED_BCBS = POINTER(REPINNED_BCBS) 45 | 46 | PRDBSS_IO_CONTEXT = POINTER(RDBSS_IO_CONTEXT) 47 | 48 | PIO_RUNS = POINTER(IO_RUNS) 49 | 50 | PDELETE_CONTEXT = POINTER(DELETE_CONTEXT) 51 | 52 | PCLOSE_CONTEXT = POINTER(CLOSE_CONTEXT) 53 | 54 | PCLEAN_AND_DIRTY_VOLUME_PACKET = POINTER(CLEAN_AND_DIRTY_VOLUME_PACKET) 55 | 56 | PSRV_CALL = POINTER(SRV_CALL) 57 | 58 | PNET_ROOT = POINTER(_NET_ROOT) 59 | 60 | PV_NET_ROOT = POINTER(_V_NET_ROOT) 61 | 62 | PNON_PAGED_FCB = POINTER(_NON_PAGED_FCB) 63 | 64 | PFCB = POINTER(_FCB) 65 | 66 | PSRV_OPEN = POINTER(_SRV_OPEN) 67 | 68 | PFOBX = POINTER(_FOBX) 69 | 70 | PRX_CONTEXT = POINTER(_RX_CONTEXT) 71 | 72 | PLOWIO_CONTEXT = POINTER(_LOWIO_CONTEXT) 73 | 74 | PEA_RANGE = POINTER(_EA_RANGE) 75 | 76 | PMINIRDR_DISPATCH = POINTER(_MINIRDR_DISPATCH) 77 | 78 | PRDBSS_EXPORTS = POINTER(_RDBSS_EXPORTS) 79 | 80 | PMRX_SRVCALL_CALLBACK_CONTEXT = POINTER(_MRX_SRVCALL_CALLBACK_CONTEXT) 81 | 82 | PMRX_SRVCALLDOWN_STRUCTURE = POINTER(_MRX_SRVCALLDOWN_STRUCTURE) 83 | 84 | PMRX_CREATENETROOT_CONTEXT = POINTER(_MRX_CREATENETROOT_CONTEXT) 85 | 86 | # END IF _RDBSSSTRUCHDR_ 87 | -------------------------------------------------------------------------------- /um/lm_h.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | from pyWinAPI import * 3 | from pyWinAPI.shared.wtypes_h import * 4 | from pyWinAPI.shared.winapifamily_h import * 5 | from pyWinAPI.shared.sdkddkver_h import * 6 | from pyWinAPI.shared.guiddef_h import * 7 | 8 | 9 | _LM_ = None 10 | 11 | # /* + + BUILD Version: 0001 // Increment this if a change has global effects 12 | # Copyright (c) 1991-1999 Microsoft Corporation Module Name: lm.h Abstract: 13 | # This is the top level include file that includes all the files necessary for 14 | # writing Lan Manager Application. [Environment:] User Mode - Win32 -- 15 | if not defined(_LM_): 16 | _LM_ = VOID 17 | if _MSC_VER > 1000: 18 | pass 19 | # END IF 20 | 21 | from pyWinAPI.shared.winapifamily_h import * # NOQA 22 | if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP): 23 | # LAN Manager common definitions 24 | from pyWinAPI.shared.lmcons_h import * # NOQA 25 | 26 | # LAN Manager network error definitions 27 | from pyWinAPI.shared.lmerr_h import * # NOQA 28 | 29 | # Access, Domain, Group and User classes 30 | from pyWinAPI.um.lmaccess_h import * # NOQA 31 | 32 | # Alerter 33 | from pyWinAPI.um.lmalert_h import * # NOQA 34 | 35 | # Connection, File, Session and Share classes 36 | from pyWinAPI.um.lmshare_h import * # NOQA 37 | 38 | # Message class 39 | from pyWinAPI.um.lmmsg_h import * # NOQA 40 | 41 | # Remote Utility class 42 | from pyWinAPI.um.lmremutl_h import * # NOQA 43 | 44 | # Replicator class 45 | from pyWinAPI.um.lmrepl_h import * # NOQA 46 | 47 | # Server class 48 | from pyWinAPI.um.lmserver_h import * # NOQA 49 | 50 | # Service class 51 | from pyWinAPI.um.lmsvc_h import * # NOQA 52 | 53 | # Use class 54 | from pyWinAPI.um.lmuse_h import * # NOQA 55 | 56 | # Workstation class 57 | from pyWinAPI.um.lmwksta_h import * # NOQA 58 | 59 | # NetApiBuffer class 60 | from pyWinAPI.um.lmapibuf_h import * # NOQA 61 | 62 | # NetErrorLog class 63 | from pyWinAPI.um.lmerrlog_h import * # NOQA 64 | 65 | # NetConfig class 66 | from pyWinAPI.um.lmconfig_h import * # NOQA 67 | 68 | # NetStats class 69 | from pyWinAPI.um.lmstats_h import * # NOQA 70 | 71 | # NetAudit class 72 | from pyWinAPI.um.lmaudit_h import * # NOQA 73 | 74 | # NetJoinDomain class 75 | from pyWinAPI.um.lmjoin_h import * # NOQA 76 | # END IF WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) 77 | # END IF _LM_ 78 | 79 | 80 | -------------------------------------------------------------------------------- /km/crt/stdlib_h.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | from wtypes_h import ( 4 | LONG, 5 | DOUBLE, 6 | FLOAT, 7 | UINT, 8 | INT, 9 | ) 10 | import ctypes 11 | 12 | from crtdefs_h import * # NOQA 13 | from limits_h import * # NOQA 14 | 15 | MB_LEN_MAX = 0x00000005 16 | EXIT_SUCCESS = 0x00000000 17 | EXIT_FAILURE = 0x00000001 18 | _onexit_t = INT 19 | _onexit_m_t = _onexit_t 20 | onexit_t = _onexit_t 21 | 22 | 23 | class _div_t(ctypes.Structure): 24 | _fields_ = [ 25 | ('quot', INT), 26 | ('rem', INT), 27 | ] 28 | 29 | 30 | div_t = _div_t 31 | 32 | 33 | class _ldiv_t(ctypes.Structure): 34 | _fields_ = [ 35 | ('quot', LONG), 36 | ('rem', LONG), 37 | ] 38 | 39 | 40 | ldiv_t = _ldiv_t 41 | 42 | 43 | class _LDOUBLE(ctypes.Structure): 44 | _fields_ = [ 45 | ('CHAR ld', UINT * 10), 46 | ] 47 | 48 | 49 | def _PTR_LD(x): 50 | return x 51 | 52 | 53 | class _CRT_DOUBLE(ctypes.Structure): 54 | _fields_ = [ 55 | ('x', DOUBLE), 56 | ] 57 | 58 | 59 | class _CRT_FLOAT(ctypes.Structure): 60 | _fields_ = [ 61 | ('f', FLOAT), 62 | ] 63 | 64 | 65 | class _LONGDOUBLE(ctypes.Structure): 66 | _fields_ = [ 67 | ('x', LONG), 68 | ] 69 | 70 | 71 | class _LDBL12(ctypes.Structure): 72 | _fields_ = [ 73 | ('CHAR ld12', UINT * 12), 74 | ] 75 | 76 | 77 | RAND_MAX = 0x00007FFF 78 | 79 | 80 | def __max(a, b): 81 | if a > b: 82 | return a 83 | else: 84 | return b 85 | 86 | 87 | def __min(a, b): 88 | if a < b: 89 | return a 90 | else: 91 | return b 92 | 93 | 94 | _MAX_PATH = 0x00000104 95 | _MAX_DRIVE = 0x00000003 96 | _MAX_DIR = 0x00000100 97 | _MAX_FNAME = 0x00000100 98 | _MAX_EXT = 0x00000100 99 | _OUT_TO_DEFAULT = 0x00000000 100 | _OUT_TO_STDERR = 0x00000001 101 | _OUT_TO_MSGBOX = 0x00000002 102 | _REPORT_ERRMODE = 0x00000003 103 | _WRITE_ABORT_MSG = 0x00000001 104 | _CALL_REPORTFAULT = 0x00000002 105 | _MAX_ENV = 0x00007FFF 106 | 107 | 108 | def _countof(_Array): 109 | return ctypes.sizeof(_Array) / ctypes.sizeof(_Array[0]) 110 | 111 | 112 | _CVTBUFSIZE = 309 + 40 113 | max = __max 114 | min = __min 115 | 116 | __all__ = ( 117 | '_CVTBUFSIZE', '_OUT_TO_STDERR', '_MAX_ENV', '_REPORT_ERRMODE', 118 | '_WRITE_ABORT_MSG', '_OUT_TO_DEFAULT', '_PTR_LD', 'RAND_MAX', '_MAX_EXT', 119 | '_countof', '_MAX_DRIVE', '_MAX_DIR', 'MB_LEN_MAX', '_CALL_REPORTFAULT', 120 | '_OUT_TO_MSGBOX', '_MAX_FNAME', 'EXIT_SUCCESS', 'EXIT_FAILURE', 121 | '_MAX_PATH', 'onexit_t', '_LDOUBLE', '_ldiv_t', '_CRT_FLOAT', 'div_t', 122 | '_CRT_DOUBLE', '_LONGDOUBLE', 'ldiv_t', '_LDBL12', '_div_t', '_onexit_m_t', 123 | 'min', 'max' 124 | ) 125 | -------------------------------------------------------------------------------- /um/spapidef_h.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | from pyWinAPI import * 3 | from pyWinAPI.shared.wtypes_h import * 4 | 5 | _INC_SPAPIDEF = None 6 | SP_LOG_TOKEN = None 7 | 8 | # + + Copyright (c) Microsoft Corporation. All rights reserved. Module Name: 9 | # spapidef.h Abstract: Public header file for Windows NT Setup and Device 10 | # Installer services Dll. - - 11 | if not defined(_INC_SPAPIDEF): 12 | _INC_SPAPIDEF = 1 13 | 14 | from pyWinAPI.shared.winapifamily_h import * 15 | from pyWinAPI.shared.guiddef_h import * 16 | 17 | if _MSC_VER > 1000: 18 | pass 19 | # END IF 20 | 21 | if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP): 22 | if not defined(SP_LOG_TOKEN): 23 | SP_LOG_TOKEN = DWORDLONG 24 | PSP_LOG_TOKEN = POINTER(DWORDLONG) 25 | # END IF 26 | 27 | # Special txtlog token values 28 | LOGTOKEN_TYPE_MASK = 3 29 | LOGTOKEN_UNSPECIFIED = 0 30 | LOGTOKEN_NO_LOG = 1 31 | LOGTOKEN_SETUPAPI_APPLOG = 2 32 | LOGTOKEN_SETUPAPI_DEVLOG = 3 33 | 34 | # Flags for SetupCreateTextLogSection 35 | TXTLOG_SETUPAPI_DEVLOG = 0x00000001 36 | TXTLOG_SETUPAPI_CMDLINE = 0x00000002 37 | TXTLOG_SETUPAPI_BITS = 0x00000003 38 | 39 | # Flags for SetupWriteTextLog 40 | 41 | # Event Levels (bits 0 - 3) 42 | TXTLOG_ERROR = 0x1 43 | TXTLOG_WARNING = 0x2 44 | TXTLOG_SYSTEM_STATE_CHANGE = 0x3 45 | TXTLOG_SUMMARY = 0x4 46 | TXTLOG_DETAILS = 0x5 47 | TXTLOG_VERBOSE = 0x6 48 | TXTLOG_VERY_VERBOSE = 0x7 49 | 50 | # Bits reserved for internal use 51 | TXTLOG_RESERVED_FLAGS = 0x0000FFF0 52 | 53 | # Basic flags (bits 4 - 31) 54 | TXTLOG_TIMESTAMP = 0x00010000 55 | TXTLOG_DEPTH_INCR = 0x00020000 56 | TXTLOG_DEPTH_DECR = 0x00040000 57 | TXTLOG_TAB_1 = 0x00080000 58 | TXTLOG_FLUSH_FILE = 0x00100000 59 | 60 | 61 | def TXTLOG_LEVEL(flags): 62 | return flags & 0xF 63 | 64 | 65 | # Setupapi, Setupdi event categories 66 | TXTLOG_DEVINST = 0x00000001 67 | TXTLOG_INF = 0x00000002 68 | TXTLOG_FILEQ = 0x00000004 69 | TXTLOG_COPYFILES = 0x00000008 70 | TXTLOG_SIGVERIF = 0x00000020 71 | TXTLOG_BACKUP = 0x00000080 72 | TXTLOG_UI = 0x00000100 73 | TXTLOG_UTIL = 0x00000200 74 | TXTLOG_INFDB = 0x00000400 75 | TXTLOG_POLICY = 0x00800000 76 | TXTLOG_NEWDEV = 0x01000000 77 | TXTLOG_UMPNPMGR = 0x02000000 78 | TXTLOG_DRIVER_STORE = 0x04000000 79 | TXTLOG_SETUP = 0x08000000 80 | TXTLOG_CMI = 0x10000000 81 | TXTLOG_DEVMGR = 0x20000000 82 | TXTLOG_INSTALLER = 0x40000000 83 | TXTLOG_VENDOR = 0x80000000 84 | # END IF WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) 85 | # END IF _INC_SPAPIDEF 86 | -------------------------------------------------------------------------------- /km/rxtimer_h.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | from pyWinAPI import * 3 | from pyWinAPI.shared.wtypes_h import * 4 | 5 | 6 | class _RX_WORK_ITEM_(ctypes.Structure): 7 | pass 8 | 9 | 10 | RX_WORK_ITEM = _RX_WORK_ITEM_ 11 | PRX_WORK_ITEM = POINTER(_RX_WORK_ITEM_) 12 | 13 | 14 | # /* + + Copyright (c) 1994 Microsoft Corporation Module Name: RxTimer.h 15 | # Abstract: This module defines the prototypes and structures for the timer on 16 | # the rdbss architecture. What is provided is a 55ms timer...that is, if you 17 | # register a routine then you get a call every 55ms. On NT, you're at DPC 18 | # level. Also contained here are the routines for posting to a thread from DPC 19 | # level. Author: - - 20 | 21 | _RXTIMER_H_ = None 22 | if not defined(_RXTIMER_H_): 23 | _RXTIMER_H_ = 1 24 | 25 | from pyWinAPI.km.rxworkq_h import * # NOQA 26 | 27 | # The RX_WORK_ITEM encapsulates the context for posting to a worker thread 28 | # as well as 29 | # a timer routine to be triggered after a specific interval. 30 | _RX_WORK_ITEM_._fields_ = [ 31 | ('WorkQueueItem', RX_WORK_QUEUE_ITEM), 32 | ('LastTick', ULONG), 33 | ('Options', ULONG), 34 | ] 35 | rdbss = ctypes.windll.RDBSS 36 | 37 | # extern NTSTATUS 38 | # NTAPI 39 | # RxPostOneShotTimerRequest( 40 | # IN PRDBSS_DEVICE_OBJECT pDeviceObject, 41 | # IN PRX_WORK_ITEM pWorkItem, 42 | # IN PRX_WORKERTHREAD_ROUTINE Routine, 43 | # IN PVOID pContext, 44 | # IN LARGE_INTEGER TimeInterval); 45 | RxPostOneShotTimerRequest = rdbss.RxPostOneShotTimerRequest 46 | RxPostOneShotTimerRequest.restype = NTSTATUS 47 | 48 | # extern NTSTATUS 49 | # NTAPI 50 | # RxPostRecurrentTimerRequest( 51 | # IN PRDBSS_DEVICE_OBJECT pDeviceObject, 52 | # IN PRX_WORKERTHREAD_ROUTINE Routine, 53 | # IN PVOID pContext, 54 | # IN LARGE_INTEGER TimeInterval); 55 | RxPostRecurrentTimerRequest = rdbss.RxPostRecurrentTimerRequest 56 | RxPostRecurrentTimerRequest.restype = NTSTATUS 57 | 58 | # extern NTSTATUS 59 | # NTAPI 60 | # RxCancelTimerRequest( 61 | # IN PRDBSS_DEVICE_OBJECT pDeviceObject, 62 | # IN PRX_WORKERTHREAD_ROUTINE Routine, 63 | # IN PVOID pContext 64 | # ); 65 | RxCancelTimerRequest = rdbss.RxCancelTimerRequest 66 | RxCancelTimerRequest.restype = NTSTATUS 67 | 68 | # Routines for initializing and tearing down the timer service in RDBSS 69 | 70 | # extern NTSTATUS 71 | # NTAPI 72 | # RxInitializeRxTimer(); 73 | RxInitializeRxTimer = rdbss.RxInitializeRxTimer 74 | RxInitializeRxTimer.restype = NTSTATUS 75 | 76 | # extern VOID 77 | # NTAPI 78 | # RxTearDownRxTimer(void); 79 | RxTearDownRxTimer = rdbss.RxTearDownRxTimer 80 | RxTearDownRxTimer.restype = VOID 81 | # END IF _RXTIMER_STUFF_DEFINED_ 82 | -------------------------------------------------------------------------------- /code_converter/utils.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EventGhost. 4 | # Copyright © 2005-2018 EventGhost Project 5 | # 6 | # EventGhost is free software: you can redistribute it and/or modify it under 7 | # the terms of the GNU General Public License as published by the Free 8 | # Software Foundation, either version 2 of the License, or (at your option) 9 | # any later version. 10 | # 11 | # EventGhost is distributed in the hope that it will be useful, but WITHOUT 12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 14 | # more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with EventGhost. If not, see . 18 | 19 | from __future__ import print_function, absolute_import 20 | 21 | OPERATORS = ['<<', '>>', '|', '&', '+', '-', '*', '/'] 22 | ALLOWED_HEX = '0123456789ABCDEF' 23 | 24 | 25 | def process_hex(code): 26 | 27 | def modify_code(marker, temp_code): 28 | new_code = '' 29 | while marker in temp_code: 30 | t_code, h_code = temp_code.split(marker, 1) 31 | new_code += t_code 32 | hex_code = '0x' 33 | for char in list(h_code[:]): 34 | if not char.upper() in ALLOWED_HEX: 35 | break 36 | hex_code += char.upper() 37 | h_code = h_code[1:] 38 | new_code += hex_code 39 | if h_code.upper().startswith('L'): 40 | h_code = h_code[1:] 41 | 42 | elif h_code.upper().startswith('UL'): 43 | h_code = h_code[2:] 44 | 45 | temp_code = h_code 46 | 47 | new_code += temp_code 48 | return new_code 49 | 50 | code = modify_code('0x', code) 51 | code = modify_code('0X', code) 52 | return code 53 | 54 | 55 | def split_strip(item, marker, count=1): 56 | return list(itm.strip() for itm in item.strip().split(marker, count)) 57 | 58 | 59 | def process_param(key, value): 60 | if '[' in key: 61 | key, array = split_strip(key, '[') 62 | array = array[:-1].strip() 63 | if not array: 64 | array = 0 65 | 66 | array = ' * {0}'.format(array) 67 | else: 68 | array = '' 69 | 70 | key = key.strip() 71 | value = value.strip() 72 | 73 | if key == value: 74 | return None, None 75 | 76 | while value.endswith('*'): 77 | key = '*' + key 78 | value = value[:-1] 79 | value = value.strip() 80 | value += array 81 | 82 | while key.startswith('*'): 83 | value = 'POINTER(' + value + ')' 84 | key = key[1:].strip() 85 | 86 | if 'comtypes.IUnknown' not in value: 87 | value = value.replace('IUnknown', 'comtypes.IUnknown') 88 | 89 | return key, value 90 | -------------------------------------------------------------------------------- /km/crt/exception: -------------------------------------------------------------------------------- 1 | #if defined _STL70_ 2 | #include "_70_exception" 3 | #elif defined _STL100_ 4 | #include "_100_exception" 5 | #elif defined _STL110_ 6 | #include "_110_exception" 7 | #else 8 | 9 | /*** 10 | *exception - Defines class exception and related functions 11 | * 12 | * Copyright (c) Microsoft Corporation. All rights reserved. 13 | * Modified January 1996 by P.J. Plauger 14 | * 15 | *Purpose: 16 | * Defines class exception (and derived class bad_exception) 17 | * plus new and unexpected handler functions. 18 | * 19 | * [Public] 20 | * 21 | ****/ 22 | 23 | #ifndef _EXCEPTION_ 24 | #define _EXCEPTION_ 25 | #include 26 | #include 27 | #include 28 | 29 | #ifdef _MSC_VER 30 | #pragma pack(push,8) 31 | #endif /* _MSC_VER */ 32 | 33 | class _CRTIMP exception 34 | { 35 | typedef const char *__exString; 36 | public: 37 | exception(); 38 | exception(const __exString&); 39 | exception(const __exString&, int); // This is exported from 2003 msvcrt.dll but not XP msvcrt.dll. 40 | exception(const exception&); 41 | exception& operator= (const exception&); 42 | #if defined (_X86_) 43 | friend void _SetExceptionString(exception* e, __exString String); 44 | #endif /* _SYSCRT */ 45 | virtual ~exception(); 46 | virtual __exString what() const; 47 | private: 48 | __exString _m_what; 49 | int _m_doFree; 50 | }; 51 | #if defined (_X86_) 52 | __forceinline void _SetExceptionString(exception* e, const char* String) 53 | { 54 | if (!(e->_m_what) && !(e->_m_doFree)) 55 | { 56 | e->_m_what = String; 57 | } 58 | } 59 | #endif /* _SYSCRT */ 60 | _STD_BEGIN 61 | using ::exception; 62 | 63 | // CLASS bad_exception 64 | class _CRTIMP2 bad_exception : public exception { 65 | public: 66 | bad_exception(const char *_S = "bad exception") _THROW0() 67 | : exception(_S) {} 68 | virtual ~bad_exception() _THROW0() 69 | {} 70 | protected: 71 | virtual void _Doraise() const 72 | {_RAISE(*this); } 73 | }; 74 | 75 | _CRTIMP2 bool __cdecl uncaught_exception(); 76 | 77 | _STD_END 78 | 79 | #ifdef __RTTI_OLDNAMES 80 | typedef exception xmsg; // A synonym for folks using older standard 81 | #endif 82 | 83 | #ifdef _MSC_VER 84 | #pragma pack(pop) 85 | #endif /* _MSC_VER */ 86 | 87 | #endif /* _EXCEPTION_ */ 88 | 89 | /* 90 | * 1994-2000, Microsoft Corporation. All rights reserved. 91 | * Modified January 1996 by P.J. Plauger 92 | * Consult your license regarding permissions and restrictions. 93 | */ 94 | // The file \sdpublic\sdk\inc\crt\exception was reviewed by LCA in June 2011 and per license is 95 | // acceptable for Microsoft use under Dealpoint ID 46582, 201971 96 | /* 88bf0570-3001-4e78-a5f2-be5765546192 */ 97 | 98 | #endif // _STL70_ or _STL100_ or _STL110_ 99 | /* 88bf0570-3001-4e78-a5f2-be5765546192 */ 100 | -------------------------------------------------------------------------------- /um/adc_h.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | from wtypes_h import ( 4 | ENUM, 5 | VOID 6 | ) 7 | from guiddef_h import IID, GUID, CLSID 8 | from winapifamily_h import * # NOQA 9 | ADCDECLSPEC = VOID 10 | 11 | CLSID_FoxRowset = CLSID( 12 | 0x3ff292b6, 13 | 0xb204, 14 | 0x11cf, 15 | 0x8d, 16 | 0x23, 17 | 0x00, 18 | 0xaa, 19 | 0x00, 20 | 0x5f, 21 | 0xfe, 22 | 0x58 23 | ) 24 | DBPROPSET_ADC = GUID( 25 | 0xb68e3cc1, 26 | 0x6deb, 27 | 0x11d0, 28 | 0x8d, 29 | 0xf6, 30 | 0x00, 31 | 0xaa, 32 | 0x00, 33 | 0x5f, 34 | 0xfe, 35 | 0x58 36 | ) 37 | IID_IAsyncAllowed = GUID( 38 | 0xf5f2893a, 39 | 0xba9e, 40 | 0x11d0, 41 | 0xab, 42 | 0xb9, 43 | 0x00, 44 | 0xc0, 45 | 0x4f, 46 | 0xc2, 47 | 0x9f, 48 | 0x8f 49 | ) 50 | IID_IRowsetADCExtensions = IID( 51 | 0xF17324c4, 52 | 0x68E0, 53 | 0x11D0, 54 | 0xAD, 55 | 0x45, 56 | 0x00, 57 | 0xC0, 58 | 0x4F, 59 | 0xC2, 60 | 0x98, 61 | 0x63 62 | ) 63 | IID_IUpdateInfo = IID( 64 | 0xa0385420, 65 | 0x62b8, 66 | 0x11d1, 67 | 0x9a, 68 | 0x06, 69 | 0x00, 70 | 0xa0, 71 | 0xc9, 72 | 0x03, 73 | 0xaa, 74 | 0x45 75 | ) 76 | IID_IRowsetSynchronize = IID( 77 | 0x1be41e60, 78 | 0x807a, 79 | 0x11d1, 80 | 0x9a, 81 | 0x14, 82 | 0x00, 83 | 0xa0, 84 | 0xc9, 85 | 0x03, 86 | 0xaa, 87 | 0x45 88 | ) 89 | IID_IRowsetProperties = IID( 90 | 0x1e837070, 91 | 0xbcfc, 92 | 0x11d1, 93 | 0x9a, 94 | 0x2c, 95 | 0x00, 96 | 0xa0, 97 | 0xc9, 98 | 0x03, 99 | 0xaa, 100 | 0x45 101 | ) 102 | 103 | 104 | class ADCPROPENUM(ENUM): 105 | DBPROP_ADC_ASYNCHFETCHSIZE = 3 106 | DBPROP_ADC_BATCHSIZE = 4 107 | DBPROP_ADC_UPDATECRITERIA = 5 108 | DBPROP_ADC_ASYNCHPREFETCHSIZE = 7 109 | DBPROP_ADC_ASYNCHTHREADPRIORITY = 8 110 | DBPROP_ADC_CACHECHILDROWS = 9 111 | DBPROP_ADC_MAINTAINCHANGESTATUS = 10 112 | DBPROP_ADC_AUTORECALC = 11 113 | DBPROP_ADC_UNIQUETABLE = 13 114 | DBPROP_ADC_UNIQUESCHEMA = 14 115 | DBPROP_ADC_UNIQUECATALOG = 15 116 | DBPROP_ADC_CUSTOMRESYNCH = 16 117 | DBPROP_ADC_CEVER = 17 118 | DBPROP_ADC_RESHAPENAME = 18 119 | DBPROP_ADC_UPDATERESYNC = 19 120 | DBPROP_ADC_BACKINGSTORE = 21 121 | DBPROP_ADC_RELEASESHAPEONDISCONNECT = 22 122 | 123 | 124 | class ADCPROP_AUTORECALC_ENUM(ENUM): 125 | adRecalcUpFront = 0 126 | adRecalcAlways = 1 127 | 128 | 129 | class FOXROWSETPROPENUM(ENUM): 130 | DBPROP_FOXTABLENAME = 0 131 | 132 | 133 | __all__ = ( 134 | 'ADCDECLSPEC', '', 'ADCPROP_AUTORECALC_ENUM', 'FOXROWSETPROPENUM', 135 | 'ADCPROPENUM', 'CLSID_FoxRowset', 'DBPROPSET_ADC', 'IID_IAsyncAllowed', 136 | 'IID_IRowsetADCExtensions', 'IID_IUpdateInfo', 'IID_IRowsetSynchronize', 137 | 'IID_IRowsetProperties' 138 | ) 139 | -------------------------------------------------------------------------------- /um/adsnms_h.py: -------------------------------------------------------------------------------- 1 | 2 | from wtypes_h import ( 3 | TEXT 4 | ) 5 | 6 | 7 | from winapifamily_h import * # NOQA 8 | NAMESPACE_CLASS_NAME = TEXT("Namespace") 9 | COUNTRY_CLASS_NAME = TEXT("Country") 10 | LOCALITY_CLASS_NAME = TEXT("Locality") 11 | ORGANIZATION_CLASS_NAME = TEXT("Organization") 12 | ORGANIZATIONUNIT_CLASS_NAME = TEXT("Organizational Unit") 13 | DOMAIN_CLASS_NAME = TEXT("Domain") 14 | COMPUTER_CLASS_NAME = TEXT("Computer") 15 | USER_CLASS_NAME = TEXT("User") 16 | GROUP_CLASS_NAME = TEXT("Group") 17 | GLOBALGROUP_CLASS_NAME = TEXT("GlobalGroup") 18 | LOCALGROUP_CLASS_NAME = TEXT("LocalGroup") 19 | SERVICE_CLASS_NAME = TEXT("Service") 20 | FILESERVICE_CLASS_NAME = TEXT("FileService") 21 | SESSION_CLASS_NAME = TEXT("Session") 22 | RESOURCE_CLASS_NAME = TEXT("Resource") 23 | FILESHARE_CLASS_NAME = TEXT("FileShare") 24 | PRINTER_CLASS_NAME = TEXT("PrINTQueue") 25 | PRINTJOB_CLASS_NAME = TEXT("PrINTJob") 26 | SCHEMA_CLASS_NAME = TEXT("Schema") 27 | CLASS_CLASS_NAME = TEXT("Class") 28 | PROPERTY_CLASS_NAME = TEXT("Property") 29 | SYNTAX_CLASS_NAME = TEXT("Syntax") 30 | ROOTDSE_CLASS_NAME = TEXT("RootDSE") 31 | NO_SCHEMA = TEXT("") 32 | DOMAIN_SCHEMA_NAME = TEXT("Domain") 33 | COMPUTER_SCHEMA_NAME = TEXT("Computer") 34 | USER_SCHEMA_NAME = TEXT("User") 35 | GROUP_SCHEMA_NAME = TEXT("Group") 36 | GLOBALGROUP_SCHEMA_NAME = TEXT("GlobalGroup") 37 | LOCALGROUP_SCHEMA_NAME = TEXT("LocalGroup") 38 | SERVICE_SCHEMA_NAME = TEXT("Service") 39 | PRINTER_SCHEMA_NAME = TEXT("PrINTQueue") 40 | PRINTJOB_SCHEMA_NAME = TEXT("PrINTJob") 41 | FILESERVICE_SCHEMA_NAME = TEXT("FileService") 42 | SESSION_SCHEMA_NAME = TEXT("Session") 43 | RESOURCE_SCHEMA_NAME = TEXT("Resource") 44 | FILESHARE_SCHEMA_NAME = TEXT("FileShare") 45 | FPNW_FILESERVICE_SCHEMA_NAME = TEXT("FPNWFileService") 46 | FPNW_SESSION_SCHEMA_NAME = TEXT("FPNWSession") 47 | FPNW_RESOURCE_SCHEMA_NAME = TEXT("FPNWResource") 48 | FPNW_FILESHARE_SCHEMA_NAME = TEXT("FPNWFileShare") 49 | 50 | __all__ = ( 51 | 'LOCALITY_CLASS_NAME', 'FILESERVICE_CLASS_NAME', 'SESSION_CLASS_NAME', 52 | 'FILESERVICE_SCHEMA_NAME', 'FPNW_RESOURCE_SCHEMA_NAME', 'NO_SCHEMA', 53 | 'FPNW_FILESERVICE_SCHEMA_NAME', 'GROUP_SCHEMA_NAME', 'COUNTRY_CLASS_NAME', 54 | 'SERVICE_SCHEMA_NAME', 'LOCALGROUP_CLASS_NAME', 'ROOTDSE_CLASS_NAME', 55 | 'RESOURCE_CLASS_NAME', 'PROPERTY_CLASS_NAME', 'COMPUTER_CLASS_NAME', 56 | 'FPNW_FILESHARE_SCHEMA_NAME', 'GLOBALGROUP_CLASS_NAME', 'USER_CLASS_NAME', 57 | 'PRINTER_SCHEMA_NAME', 'PRINTJOB_CLASS_NAME', 'SERVICE_CLASS_NAME', 58 | 'ORGANIZATION_CLASS_NAME', 'GROUP_CLASS_NAME', 'PRINTER_CLASS_NAME', 59 | 'COMPUTER_SCHEMA_NAME', 'FILESHARE_CLASS_NAME', 'NAMESPACE_CLASS_NAME', 60 | 'RESOURCE_SCHEMA_NAME', 'FILESHARE_SCHEMA_NAME', 'DOMAIN_CLASS_NAME', 61 | 'SESSION_SCHEMA_NAME', 'ORGANIZATIONUNIT_CLASS_NAME', 'USER_SCHEMA_NAME', 62 | 'LOCALGROUP_SCHEMA_NAME', 'DOMAIN_SCHEMA_NAME', 'SCHEMA_CLASS_NAME', 63 | 'CLASS_CLASS_NAME', 'FPNW_SESSION_SCHEMA_NAME', 'GLOBALGROUP_SCHEMA_NAME', 64 | 'PRINTJOB_SCHEMA_NAME', 'SYNTAX_CLASS_NAME', 65 | ) 66 | -------------------------------------------------------------------------------- /km/crt/new: -------------------------------------------------------------------------------- 1 | #if defined _STL70_ 2 | #include "_70_new" 3 | #elif defined _STL100_ 4 | #include "_100_new" 5 | #elif defined _STL110_ 6 | #include "_110_new" 7 | #else 8 | 9 | // new standard header 10 | #ifndef _NEW_ 11 | #define _NEW_ 12 | #include 13 | #include 14 | 15 | #ifdef _MSC_VER 16 | #pragma pack(push,8) 17 | #endif /* _MSC_VER */ 18 | 19 | /* Define _CRTIMP3 */ 20 | /* Special case (this file only) for msvcp60.dll exports */ 21 | #ifdef CRTDLL3 22 | #define _CRTIMP3 __declspec(dllexport) 23 | #else /* CRTDLL3 */ 24 | #define _CRTIMP3 25 | #endif /* CRTDLL3 */ 26 | 27 | _STD_BEGIN 28 | 29 | extern __declspec(selectany) const char * _bad_alloc_Message = "bad allocation"; 30 | 31 | // CLASS bad_alloc 32 | class _CRTIMP3 bad_alloc : public exception { 33 | public: 34 | bad_alloc(const char *_S) _THROW0() 35 | : exception(_S) {} 36 | 37 | bad_alloc() _THROW0() 38 | #if defined (_X86_) 39 | { 40 | _SetExceptionString(this, _bad_alloc_Message); 41 | } 42 | #else /* _SYSCRT */ 43 | : exception(_bad_alloc_Message, 1) 44 | { // construct from message string with no memory allocation 45 | } 46 | #endif /* _SYSCRT */ 47 | 48 | virtual ~bad_alloc() _THROW0() 49 | {} 50 | 51 | protected: 52 | virtual void _Doraise() const 53 | {_RAISE(*this); } 54 | }; 55 | // SUPPORT TYPES 56 | #ifndef __NOTHROW_T_DEFINED 57 | struct nothrow_t { }; 58 | 59 | extern const nothrow_t nothrow; 60 | #endif /* __NOTHROW_T_DEFINED */ 61 | _STD_END 62 | 63 | typedef void (__cdecl *new_handler)(); 64 | extern new_handler _New_hand; 65 | 66 | // new AND delete DECLARATIONS 67 | void __cdecl operator delete(void *) _THROW0(); 68 | void *__cdecl operator new(size_t) _THROW1(std::bad_alloc); 69 | #ifndef __NOTHROW_T_DEFINED 70 | #define __NOTHROW_T_DEFINED 71 | void *__cdecl operator new(size_t, const std::nothrow_t&) 72 | _THROW0(); 73 | 74 | #if _MSC_VER >= 1200 75 | void __cdecl operator delete(void *, 76 | const std::nothrow_t&) _THROW0(); 77 | #endif 78 | #endif /* __NOTHROW_T_DEFINED */ 79 | 80 | #ifndef __PLACEMENT_NEW_INLINE 81 | #define __PLACEMENT_NEW_INLINE 82 | inline void *__CRTDECL operator new(size_t, void *_P) 83 | {return (_P); } 84 | #if _MSC_VER >= 1200 85 | inline void __CRTDECL operator delete(void *, void *) 86 | {return; } 87 | #endif 88 | #endif 89 | 90 | #ifdef _CRTIMP 91 | _CRTIMP 92 | #endif 93 | new_handler __cdecl set_new_handler(new_handler) _THROW0(); 94 | 95 | #ifdef _MSC_VER 96 | #pragma pack(pop) 97 | #endif /* _MSC_VER */ 98 | 99 | #endif /* _NEW_ */ 100 | 101 | /* 102 | * Copyright (c) 1994 by P.J. Plauger. ALL RIGHTS RESERVED. 103 | * Consult your license regarding permissions and restrictions. 104 | */ 105 | // The file \sdpublic\sdk\inc\crt\new was reviewed by LCA in June 2011 and per license is 106 | // acceptable for Microsoft use under Dealpoint ID 46582, 201971 107 | 108 | #endif // _STL70_ or _STL100_ or _STL110_ 109 | /* 88bf0570-3001-4e78-a5f2-be5765546192 */ 110 | -------------------------------------------------------------------------------- /code_converter/includes.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EventGhost. 4 | # Copyright © 2005-2016 EventGhost Project 5 | # 6 | # EventGhost is free software: you can redistribute it and/or modify it under 7 | # the terms of the GNU General Public License as published by the Free 8 | # Software Foundation, either version 2 of the License, or (at your option) 9 | # any later version. 10 | # 11 | # EventGhost is distributed in the hope that it will be useful, but WITHOUT 12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 14 | # more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with EventGhost. If not, see . 18 | 19 | from __future__ import print_function, absolute_import 20 | 21 | import os 22 | from code_converter.comment import parse_comment 23 | 24 | base_path = os.path.dirname(__file__) 25 | module_path = os.path.abspath(os.path.join(base_path, '..')) 26 | 27 | 28 | def locate_module(include, module_name, mods, path): 29 | 30 | module_name += '_h.py' 31 | 32 | files = os.listdir(path) 33 | 34 | if module_name in files or include in files: 35 | return mods + '.' + module_name[:-3] 36 | 37 | for f in files: 38 | new_path = os.path.join(path, f) 39 | if os.path.isdir(new_path): 40 | res = locate_module( 41 | include, 42 | module_name[:-3], 43 | mods + '.' + f, 44 | new_path 45 | ) 46 | 47 | if res is not None: 48 | if res == mods + '.': 49 | if path == base_path: 50 | return None 51 | 52 | return locate_module( 53 | include, 54 | module_name[:-3], 55 | res, 56 | os.path.split(path)[1] 57 | ) 58 | else: 59 | return res 60 | 61 | if path == base_path: 62 | return None 63 | 64 | for i in range(1, 10): 65 | if mods == '.' * i: 66 | return mods + '.' 67 | 68 | 69 | def parse_include(indent, include, path): 70 | if 'pack' in include: 71 | return 72 | 73 | include, comment = parse_comment(include) 74 | 75 | module_name = include.replace('#include', '').replace('# include', '') 76 | module_name = module_name.replace('<', '').replace('>', '').strip() 77 | if module_name.endswith('.h'): 78 | module_name = module_name[:-2] 79 | 80 | module_name = module_name.replace('.', '_').replace('"', '').lower() 81 | 82 | if module_name.isdigit(): 83 | module_name = '_' + module_name 84 | 85 | print(module_name) 86 | res = locate_module(include, module_name, '.', path) 87 | 88 | if res is not None: 89 | print('{0}from .{1} import *{2}'.format(indent, res, comment)) 90 | 91 | -------------------------------------------------------------------------------- /km/sdpnode_h.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | from pyWinAPI import * 3 | from pyWinAPI.shared.wtypes_h import * 4 | from pyWinAPI.shared.sdkddkver_h import * 5 | 6 | 7 | class _SDP_NODE_HEADER(ctypes.Structure): 8 | pass 9 | 10 | 11 | SDP_NODE_HEADER = _SDP_NODE_HEADER 12 | PSDP_NODE_HEADER = POINTER(_SDP_NODE_HEADER) 13 | 14 | 15 | class _SDP_NODE_DATA(ctypes.Union): 16 | pass 17 | 18 | 19 | SDP_NODE_DATA = _SDP_NODE_DATA 20 | PSDP_NODE_DATA = POINTER(_SDP_NODE_DATA) 21 | 22 | 23 | class _SDP_NODE(ctypes.Structure): 24 | pass 25 | 26 | 27 | SDP_NODE = _SDP_NODE 28 | PSDP_NODE = POINTER(_SDP_NODE) 29 | 30 | 31 | class _SDP_TREE_ROOT_NODE(ctypes.Structure): 32 | pass 33 | 34 | 35 | SDP_TREE_ROOT_NODE = _SDP_TREE_ROOT_NODE 36 | PSDP_TREE_ROOT_NODE = POINTER(_SDP_TREE_ROOT_NODE) 37 | 38 | 39 | class ISdpNodeContainer(ctypes.Structure): 40 | pass 41 | 42 | 43 | # Copyright (C) Microsoft. All rights reserved. 44 | __SDPNODE_H__ = None 45 | if not defined(__SDPNODE_H__): 46 | __SDPNODE_H__ = 1 47 | 48 | if _MSC_VER >= 1200: 49 | pass 50 | # END IF 51 | 52 | if NTDDI_VERSION >= NTDDI_VISTA: 53 | if defined(__cplusplus): 54 | pass 55 | # END IF 56 | 57 | from pyWinAPI.shared.bthsdpdef_h import * # NOQA 58 | 59 | SDP_BOOLEAN = UCHAR 60 | _SDP_NODE_HEADER._fields_ = [ 61 | ('Link', LIST_ENTRY), 62 | ('Type', USHORT), 63 | ('SpecificType', USHORT), 64 | ] 65 | _SDP_NODE_DATA._fields_ = [ 66 | # ISSUE is there a better way to represent a 16 byte int??? 67 | ('int128', SDP_LARGE_INTEGER_16), 68 | ('uint128', SDP_ULARGE_INTEGER_16), 69 | # UUID 70 | ('uuid128', GUID), 71 | ('uuid32', ULONG), 72 | ('uuid16', USHORT), 73 | # 8 byte integers 74 | ('int64', LONGLONG), 75 | ('uint64', ULONGLONG), 76 | # 4 byte integers 77 | ('int32', LONG), 78 | ('uint32', ULONG), 79 | # 2 byte integers 80 | ('int16', SHORT), 81 | ('uint16', USHORT), 82 | # 1 bytes integers 83 | ('int8', CHAR), 84 | ('uint8', UCHAR), 85 | # Boolean 86 | ('boolean', SDP_BOOLEAN), 87 | # string 88 | ('string', PCHAR), 89 | # URL 90 | ('url', PCHAR), 91 | # Sequence 92 | ('sequence', SDP_NODE_HEADER), 93 | # Alt list 94 | ('alternative', SDP_NODE_HEADER), 95 | ('container', POINTER(ISdpNodeContainer)), 96 | ] 97 | _SDP_NODE._fields_ = [ 98 | ('hdr', SDP_NODE_HEADER), 99 | ('DataSize', ULONG), 100 | ('u', SDP_NODE_DATA), 101 | ('Reserved', PVOID), 102 | ] 103 | _SDP_TREE_ROOT_NODE._fields_ = [ 104 | ('RootNode', SDP_NODE), 105 | ] 106 | 107 | if defined(__cplusplus): 108 | pass 109 | # END IF 110 | 111 | # END IF (NTDDI_VERSION >= NTDDI_VISTA) 112 | 113 | if _MSC_VER >= 1200: 114 | pass 115 | else: 116 | pass 117 | # END IF 118 | 119 | # END IF __SDPNODE_H__ 120 | -------------------------------------------------------------------------------- /um/lmconfig_h.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | from pyWinAPI import * 3 | from pyWinAPI.shared.wtypes_h import * 4 | from pyWinAPI.shared.winapifamily_h import * 5 | from pyWinAPI.shared.sdkddkver_h import * 6 | from pyWinAPI.shared.guiddef_h import * 7 | 8 | 9 | _LMCONFIG_ = None 10 | 11 | 12 | class _CONFIG_INFO_0(ctypes.Structure): 13 | pass 14 | 15 | 16 | CONFIG_INFO_0 = _CONFIG_INFO_0 17 | PCONFIG_INFO_0 = POINTER(_CONFIG_INFO_0) 18 | LPCONFIG_INFO_0 = POINTER(_CONFIG_INFO_0) 19 | 20 | 21 | # /* + + BUILD Version: 0003 // Increment this if a change has global effects 22 | # Copyright (c) 1991-1999 Microsoft Corporation Module Name: lmconfig.h 23 | # Abstract: This module defines the API function prototypes and data 24 | # structures for the following groups of NT API functions: NetConfig 25 | # Environment: User Mode - Win32 Notes: You must include NETCONS.H before this 26 | # file, since this file depends on values defined in NETCONS.H. -- 27 | if not defined(_LMCONFIG_): 28 | _LMCONFIG_ = VOID 29 | if _MSC_VER > 1000: 30 | pass 31 | # END IF 32 | 33 | from pyWinAPI.shared.winapifamily_h import * # NOQA 34 | if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP): 35 | if defined(__cplusplus): 36 | pass 37 | # ENDIF 38 | 39 | from pyWinAPI.shared.lmcons_h import * # NOQA 40 | 41 | netapi32 = ctypes.windll.NETAPI32 42 | 43 | REVISED_CONFIG_APIS = VOID 44 | # // Function Prototypes - Config 45 | # // SAL Annotations not available for obsolete APIs 46 | 47 | # NET_API_STATUS NET_API_FUNCTION 48 | # NetConfigGet( 49 | # IN LPCWSTR server OPTIONAL, 50 | # IN LPCWSTR component, 51 | # IN LPCWSTR parameter, 52 | # #ifdef REVISED_CONFIG_APIS 53 | # OUT LPBYTE *bufptr 54 | # #else 55 | # OUT LPBYTE *bufptr, 56 | # OUT LPDWORD totalavailable 57 | # #endif 58 | # ); 59 | NetConfigGet = netapi32.NetConfigGet 60 | NetConfigGet.restype = NET_API_STATUS 61 | 62 | # NET_API_STATUS NET_API_FUNCTION 63 | # NetConfigGetAll( 64 | # IN LPCWSTR server OPTIONAL, 65 | # IN LPCWSTR component, 66 | # #ifdef REVISED_CONFIG_APIS 67 | # OUT LPBYTE *bufptr 68 | # #else 69 | # OUT LPBYTE *bufptr, 70 | # OUT LPDWORD totalavailable 71 | # #endif 72 | # ); 73 | NetConfigGetAll = netapi32.NetConfigGetAll 74 | NetConfigGetAll.restype = NET_API_STATUS 75 | 76 | # NET_API_STATUS NET_API_FUNCTION 77 | # NetConfigSet( 78 | # IN LPCWSTR server OPTIONAL, 79 | # IN LPCWSTR reserved1 OPTIONAL, 80 | # IN LPCWSTR component, 81 | # IN DWORD level, 82 | # IN DWORD reserved2, 83 | # IN LPBYTE buf, 84 | # IN DWORD reserved3 85 | # ); 86 | NetConfigSet = netapi32.NetConfigSet 87 | NetConfigSet.restype = NET_API_STATUS 88 | 89 | # Data Structures - Config 90 | _CONFIG_INFO_0._fields_ = [ 91 | ('cfgi0_key', LPWSTR), 92 | ('cfgi0_data', LPWSTR), 93 | ] 94 | if defined(__cplusplus): 95 | pass 96 | # END IF 97 | 98 | # END IF WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) 99 | # END IF _LMCONFIG_ 100 | 101 | 102 | -------------------------------------------------------------------------------- /shared/apisetcconv_h.py: -------------------------------------------------------------------------------- 1 | from pyWinAPI import * 2 | from pyWinAPI.shared.wtypes_h import * 3 | 4 | # ********************************************************************** 5 | # * apisetcconv.h - - Contains Win32 Calling Conventions for APISETs * that 6 | # were a part of the old legacy APIs * Copyright (c) Microsoft Corp. All 7 | # rights reserved. * * 8 | # ********************************************************************* 9 | _APISETCCONV_ = None 10 | if not defined(_APISETCCONV_): 11 | _APISETCCONV_ = 1 12 | 13 | WINADVAPI = None 14 | if not defined(WINADVAPI): 15 | _ADVAPI32_ = None 16 | if not defined(_ADVAPI32_): 17 | WINADVAPI = DECLSPEC_IMPORT 18 | else: 19 | WINADVAPI = 1 20 | # END IF 21 | # END IF 22 | WINBASEAPI = None 23 | if not defined(WINBASEAPI): 24 | _KERNEL32_ = None 25 | if not defined(_KERNEL32_): 26 | WINBASEAPI = DECLSPEC_IMPORT 27 | else: 28 | WINBASEAPI = 1 29 | # END IF 30 | # END IF 31 | ZAWPROXYAPI = None 32 | if not defined(ZAWPROXYAPI): 33 | _ZAWPROXY_ = None 34 | if not defined(_ZAWPROXY_): 35 | ZAWPROXYAPI = DECLSPEC_IMPORT 36 | else: 37 | ZAWPROXYAPI = 1 38 | # END IF 39 | # END IF 40 | WINUSERAPI = None 41 | if not defined(WINUSERAPI): 42 | _USER32_ = None 43 | if not defined(_USER32_): 44 | WINUSERAPI = DECLSPEC_IMPORT 45 | WINABLEAPI = DECLSPEC_IMPORT 46 | else: 47 | WINUSERAPI = 1 48 | WINABLEAPI = 1 49 | # END IF 50 | # END IF 51 | else: 52 | WINABLEAPI = None 53 | 54 | if not defined(WINABLEAPI): 55 | _USER32_ = None 56 | if not defined(_USER32_): 57 | WINABLEAPI = DECLSPEC_IMPORT 58 | else: 59 | WINABLEAPI = 1 60 | # END IF 61 | # END IF 62 | WINCFGMGR32API = None 63 | if not defined(WINCFGMGR32API): 64 | _SETUPAPI_ = None 65 | if not defined(_SETUPAPI_): 66 | WINCFGMGR32API = DECLSPEC_IMPORT 67 | else: 68 | WINCFGMGR32API = 1 69 | # END IF 70 | # END IF 71 | WINDEVQUERYAPI = None 72 | if not defined(WINDEVQUERYAPI): 73 | _CFGMGR32_ = None 74 | if not defined(_CFGMGR32_): 75 | WINDEVQUERYAPI = DECLSPEC_IMPORT 76 | else: 77 | WINDEVQUERYAPI = 1 78 | # END IF 79 | # END IF 80 | 81 | WINSWDEVICEAPI = None 82 | if not defined(WINSWDEVICEAPI): 83 | _CFGMGR32_ = None 84 | if not defined(_CFGMGR32_): 85 | WINSWDEVICEAPI = DECLSPEC_IMPORT 86 | else: 87 | WINSWDEVICEAPI = 1 88 | # END IF 89 | # END IF 90 | 91 | CMAPI = None 92 | if not defined(CMAPI): 93 | _CFGMGR32_ = None 94 | if not defined(_CFGMGR32_): 95 | CMAPI = DECLSPEC_IMPORT 96 | else: 97 | CMAPI = 1 98 | # END IF 99 | # END IF 100 | 101 | WINPATHCCHAPI = None 102 | if not defined(WINPATHCCHAPI): 103 | STATIC_PATHCCH = None 104 | if not defined(STATIC_PATHCCH): 105 | WINPATHCCHAPI = WINBASEAPI 106 | else: 107 | WINPATHCCHAPI = 1 108 | # END IF 109 | # END IF 110 | # END IF _APISETCCONV_ 111 | -------------------------------------------------------------------------------- /shared/exposeenums2managed_h.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | from pyWinAPI import * 3 | from pyWinAPI.shared.wtypes_h import * 4 | from pyWinAPI.shared.winapifamily_h import * 5 | from pyWinAPI.shared.sdkddkver_h import * 6 | from pyWinAPI.shared.guiddef_h import * 7 | 8 | 9 | _MANAGED = None 10 | MANAGED_ENUMS = None 11 | USING_EHRECVR_NAMESPACE = None 12 | 13 | 14 | # ---------------------------------------------------------------------------- 15 | # File: exposeenums2managed.h 16 | # Desc: macros to allow the same enum to be exposed to native and managed 17 | # USAGE: 18 | # in your whatever.h file that defines the enums use ENUM or 19 | # FLAGS(for enums defining bitmasks/flags) 20 | # at the top of the file include this .h 21 | # at the bottom of the file include 22 | # unexposeenums2managed.h(resets the macro state) 23 | # in a native client .idl/.h/.cpp file as normal just 24 | # include < whatever.h > 25 | # this will include the file normally 26 | # in a mgd cpp file 27 | # include < whatever.h > 28 | # once normally, this will make the enums available to native 29 | # Copyright (c) 2003-2004, Microsoft Corporation. All rights reserved. 30 | # ---------------------------------------------------------------------------- 31 | # not not not do not pragma once or macro guard this file. 32 | # it gets used multiple times by the same compilation units 33 | from pyWinAPI.shared.winapifamily_h import * # NOQA 34 | 35 | 36 | if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP): 37 | if defined(MANAGED_ENUMS): 38 | if not defined(_MANAGED): 39 | pass 40 | # END IF 41 | 42 | 43 | def ENUMG(g): 44 | return ENUM(g) 45 | 46 | ENUM16 = ENUM 47 | FLAGS = ENUM 48 | FLAGS16 = ENUM16 49 | 50 | def TAG(x): 51 | return x 52 | 53 | 54 | def RATLEVEL(x): 55 | return x 56 | 57 | def RATATTR(x): 58 | return x 59 | 60 | if defined(USING_EHRECVR_NAMESPACE): 61 | EHRECVR_MGD_OUTER_NAMESPACE = VOID 62 | 63 | def EHRECVR_MGD_NAMESPACE(x): 64 | return EHRECVR_MGD_OUTER_NAMESPACE(x) 65 | 66 | def ANALOG_VIDEO_STANDARD_NAMESPACE(x): 67 | return EHRECVR_MGD_NAMESPACEAnalogVideoStandard(x) 68 | else: 69 | def EHRECVR_MGD_NAMESPACE(x): 70 | return x 71 | 72 | def ANALOG_VIDEO_STANDARD_NAMESPACE(x): 73 | return x 74 | # END IF 75 | 76 | else: 77 | if defined(__midl): 78 | V1_ENUM = [v1_enum] 79 | 80 | def V1_ENUMG(g): 81 | return [uuid(g), v1_enum] 82 | else: 83 | V1_ENUM = VOID 84 | V1_ENUMG = VOID 85 | 86 | # END IF 87 | 88 | def RATLEVEL(x): 89 | return x 90 | 91 | def RATATTR(x): 92 | return x 93 | 94 | def ENUMG(g): 95 | return V1_ENUMG(g) 96 | 97 | 98 | ENUM16 = ENUM 99 | FLAGS = ENUM 100 | FLAGS16 = ENUM16 101 | 102 | def TAG(x): 103 | return x 104 | 105 | def EHRECVR_MGD_NAMESPACE(x): 106 | return x 107 | 108 | def ANALOG_VIDEO_STANDARD_NAMESPACE(x): 109 | return x 110 | # END IF 111 | 112 | # end of file - exposeenums2managed.h 113 | # END IF WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) 114 | 115 | -------------------------------------------------------------------------------- /shared/minwindef_h.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EventGhost. 4 | # Copyright © 2005-2016 EventGhost Project 5 | # 6 | # EventGhost is free software: you can redistribute it and/or modify it under 7 | # the terms of the GNU General Public License as published by the Free 8 | # Software Foundation, either version 2 of the License, or (at your option) 9 | # any later version. 10 | # 11 | # EventGhost is distributed in the hope that it will be useful, but WITHOUT 12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 14 | # more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with EventGhost. If not, see . 18 | 19 | from shared.wtypes_h import ( 20 | cdecl, 21 | pascal, 22 | far, 23 | near, 24 | NULL, 25 | PSZ, 26 | CDECL, 27 | CALLBACK, 28 | WINAPI, 29 | WINAPIV, 30 | APIENTRY, 31 | APIPRIVATE, 32 | PASCAL, 33 | WINAPI_INLINE, 34 | FAR, 35 | NEAR, 36 | WPARAM, 37 | LPARAM, 38 | LRESULT, 39 | SPHANDLE, 40 | LPHANDLE, 41 | HGLOBAL, 42 | HLOCAL, 43 | GLOBALHANDLE, 44 | LOCALHANDLE, 45 | FARPROC, 46 | NEARPROC, 47 | PROC, 48 | HKEY, 49 | PHKEY, 50 | HMETAFILE, 51 | HINSTANCE, 52 | HMODULE, 53 | HRGN, 54 | HRSRC, 55 | HSPRITE, 56 | HLSURF, 57 | HSTR, 58 | HTASK, 59 | HWINSTA, 60 | HKL, 61 | HFILE, 62 | FILETIME as _FILETIME, 63 | PFILETIME as _PFILETIME, 64 | LPFILETIME as _LPFILETIME, 65 | DWORD, 66 | BOOL, 67 | BYTE, 68 | WORD, 69 | FLOAT, 70 | PFLOAT, 71 | PBOOL, 72 | INT, 73 | UINT, 74 | PUINT, 75 | ULONG as _ULONG, 76 | PULONG, 77 | USHORT, 78 | PUSHORT, 79 | UCHAR, 80 | PUCHAR, 81 | ATOM, 82 | LONG 83 | ) 84 | 85 | FALSE = 0 86 | TRUE = 1 87 | IN = None 88 | OUT = None 89 | OPTIONAL = None 90 | MAX_PATH = 260 91 | 92 | FILETIME = _FILETIME 93 | PFILETIME = _PFILETIME 94 | LPFILETIME = _LPFILETIME 95 | ULONG = _ULONG 96 | 97 | 98 | def MAKEWORD(a, b): 99 | return WORD(((a & 0xff) | b & 0xff) << 8) 100 | 101 | 102 | def MAKELONG(a, b): 103 | return LONG((a & 0xffff) | (b & 0xffff) << 16) 104 | 105 | 106 | def LOWORD(l): 107 | return WORD(l & 0xffff) 108 | 109 | 110 | def HIWORD(l): 111 | return WORD((l >> 16) & 0xffff) 112 | 113 | 114 | def LOBYTE(w): 115 | return BYTE(w & 0xff) 116 | 117 | 118 | def HIBYTE(w): 119 | return BYTE((w >> 8) & 0xff) 120 | 121 | __all__ = ( 122 | 'APIENTRY', 'APIPRIVATE', 'ATOM', 'BOOL', 'BYTE', 'CALLBACK', 'CDECL', 123 | 'DWORD', 'FALSE', 'FAR', 'FARPROC', 'FILETIME', 'FLOAT', 'HFILE', 124 | 'GLOBALHANDLE', 'HGLOBAL', 'HIBYTE', 'HINSTANCE', 'HIWORD', 'HKEY', 125 | 'HKL', 'HLOCAL', 'HLSURF', 'HMETAFILE', 'HMODULE', 'HRGN', 'HRSRC', 126 | 'HSPRITE', 'HSTR', 'HTASK', 'HWINSTA', 'IN', 'INT', 'LOBYTE', 'LONG', 127 | 'LOCALHANDLE', 'LOWORD', 'LPARAM', 'LPFILETIME', 'LPHANDLE', 'NEAR', 128 | 'LRESULT', 'MAKELONG', 'MAKEWORD', 'MAX_PATH', 'NEARPROC', 'NULL', 129 | 'OPTIONAL', 'OUT', 'PASCAL', 'PBOOL', 'PFILETIME', 'PFLOAT', 'PHKEY', 130 | 'PROC', 'PSZ', 'PUCHAR', 'PUINT', 'PULONG', 'PUSHORT', 'SPHANDLE', 131 | 'TRUE', 'UCHAR', 'UINT', 'ULONG', 'USHORT', 'WINAPI', 'WINAPIV', 132 | 'WINAPI_INLINE', 'WORD', 'WPARAM', '_FILETIME', '_LPFILETIME', 'far', 133 | '_PFILETIME', '_ULONG', 'cdecl', 'near', 'pascal', 134 | ) 135 | 136 | -------------------------------------------------------------------------------- /km/crt/excpt_h.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | from pyWinAPI import * 3 | from pyWinAPI.shared.wtypes_h import * 4 | from pyWinAPI.shared.winapifamily_h import * 5 | from pyWinAPI.shared.sdkddkver_h import * 6 | from pyWinAPI.shared.guiddef_h import * 7 | 8 | 9 | _INC_EXCPT = None 10 | 11 | 12 | 13 | # * excpt.h - defines exception values, types and routines Copyright (c) 14 | # Microsoft Corporation. All rights reserved. Purpose: This file contains the 15 | # definitions and prototypes for the compiler- dependent intrinsics, support 16 | # functions and keywords which implement the structured exception handling 17 | # extensions. [Public] * 18 | if _MSC_VER > 1000: 19 | pass 20 | # END IF 21 | 22 | 23 | if not defined(_INC_EXCPT): 24 | _INC_EXCPT = 1 25 | from pyWinAPI.km.crt.crtdefs_h import * # NOQA 26 | 27 | # /* Currently, all MS C compilers for Win32 platforms default to 8 28 | # byte alignment. 29 | if defined(_MSC_VER): 30 | pass 31 | # END IF _MSC_VER 32 | 33 | if defined(__cplusplus): 34 | pass 35 | # END IF 36 | 37 | 38 | # /* Exception disposition return values. 39 | class _EXCEPTION_DISPOSITION(ENUM): 40 | ExceptionContinueExecution = 1 41 | ExceptionContinueSearch = 2 42 | ExceptionNestedException = 3 43 | ExceptionCollidedUnwind = 4 44 | 45 | EXCEPTION_DISPOSITION = _EXCEPTION_DISPOSITION 46 | 47 | # /* Prototype for SEH support function. 48 | # /* Declarations to keep MS C 8 (386/486) compiler happy 49 | if defined(_M_IX86): 50 | 51 | class _EXCEPTION_RECORD(ctypes.Structure): 52 | pass 53 | 54 | class _CONTEXT(ctypes.Structure): 55 | pass 56 | 57 | # END IF 58 | 59 | 60 | # /* Declarations to keep AMD64 compiler happy 61 | if defined(_M_AMD64) or defined(_M_ARM) or defined(_M_ARM64) or defined(_M_HYBRID): 62 | class _EXCEPTION_RECORD(ctypes.Structure): 63 | pass 64 | 65 | class _CONTEXT(ctypes.Structure): 66 | pass 67 | 68 | class _DISPATCHER_CONTEXT(ctypes.Structure): 69 | pass 70 | 71 | if not defined(_M_CEE_PURE): 72 | ntdll = ctypes.windll.NTDLL 73 | 74 | 75 | # _CRTIMP EXCEPTION_DISPOSITION __cdecl __C_specific_handler( 76 | # _In_ struct _EXCEPTION_RECORD * ExceptionRecord, 77 | # _In_ VOID * EstablisherFrame, 78 | # _Inout_ struct _CONTEXT * ContextRecord, 79 | # _Inout_ struct _DISPATCHER_CONTEXT * DispatcherContext 80 | # ); 81 | __C_specific_handler = ntdll.__C_specific_handler 82 | __C_specific_handler.restype = EXCEPTION_DISPOSITION 83 | # END IF 84 | 85 | # END IF 86 | 87 | # /* Keywords and intrinsics for SEH 88 | if defined(_MSC_VER): 89 | # GetExceptionCode = _exception_code 90 | # exception_code = _exception_code 91 | # GetExceptionInformation = (struct _EXCEPTION_POINTERS *)_exception_info 92 | # exception_info = (struct _EXCEPTION_POINTERS *)_exception_info 93 | # AbnormalTermination = _abnormal_termination 94 | # abnormal_termination = _abnormal_termination 95 | pass 96 | # END IF 97 | 98 | # /* Legal values for expression in except(). 99 | EXCEPTION_EXECUTE_HANDLER = 1 100 | EXCEPTION_CONTINUE_SEARCH = 0 101 | EXCEPTION_CONTINUE_EXECUTION = -1 102 | if defined(__cplusplus): 103 | pass 104 | # END IF 105 | 106 | if defined(_MSC_VER): 107 | pass 108 | # END IF _MSC_VER 109 | # END IF _INC_EXCPT 110 | 111 | # 88bf0570-3001-4e78-a5f2-be5765546192 112 | -------------------------------------------------------------------------------- /um/lmapibuf_h.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | from pyWinAPI import * 3 | from pyWinAPI.shared.wtypes_h import * 4 | from pyWinAPI.shared.winapifamily_h import * 5 | from pyWinAPI.shared.sdkddkver_h import * 6 | from pyWinAPI.shared.guiddef_h import * 7 | 8 | 9 | _LMAPIBUF_ = None 10 | 11 | 12 | # /* + + BUILD Version: 0001 // Increment this if a change has global effects 13 | # Copyright (c) 1991-1999 Microsoft Corporation Module Name: lmapibuf.h 14 | # Abstract: This file contains information about NetApiBuffer APIs. 15 | # Environment: User Mode - Win32 Notes: You must include LMCONS.H before this 16 | # file, since this file depends on values defined in LMCONS.H. -- 17 | if not defined(_LMAPIBUF_): 18 | _LMAPIBUF_ = VOID 19 | if _MSC_VER > 1000: 20 | pass 21 | # END IF 22 | 23 | 24 | from pyWinAPI.shared.winapifamily_h import * # NOQA 25 | if defined(__cplusplus): 26 | pass 27 | # END IF 28 | 29 | netapi32 = ctypes.windll.NETAPI32 30 | from pyWinAPI.shared.lmcons_h import * # NOQA 31 | 32 | 33 | if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM): 34 | # // Function Prototypes 35 | # 36 | # 37 | # _Success_( return == 0 ) 38 | # NET_API_STATUS NET_API_FUNCTION 39 | # NetApiBufferAllocate( 40 | # _In_ DWORD ByteCount, 41 | # _Outptr_result_bytebuffer_(ByteCount) LPVOID * Buffer 42 | # ); 43 | NetApiBufferAllocate = netapi32.NetApiBufferAllocate 44 | NetApiBufferAllocate.restype = NET_API_STATUS 45 | 46 | # _Success_( return == 0 ) 47 | # NET_API_STATUS NET_API_FUNCTION 48 | # NetApiBufferFree( 49 | # _Frees_ptr_opt_ LPVOID Buffer 50 | # ); 51 | NetApiBufferFree = netapi32.NetApiBufferFree 52 | NetApiBufferFree.restype = NET_API_STATUS 53 | 54 | # _Success_( return == 0 ) 55 | # NET_API_STATUS NET_API_FUNCTION 56 | # NetApiBufferReallocate( 57 | # _Frees_ptr_opt_ LPVOID OldBuffer, 58 | # _In_ DWORD NewByteCount, 59 | # _Outptr_result_bytebuffer_(NewByteCount) LPVOID * NewBuffer 60 | # ); 61 | NetApiBufferReallocate = netapi32.NetApiBufferReallocate 62 | NetApiBufferReallocate.restype = NET_API_STATUS 63 | 64 | # _Success_( return == 0 ) 65 | # NET_API_STATUS NET_API_FUNCTION 66 | # NetApiBufferSize( 67 | # _In_ LPVOID Buffer, 68 | # _Out_ LPDWORD ByteCount 69 | # ); 70 | NetApiBufferSize = netapi32.NetApiBufferSize 71 | NetApiBufferSize.restype = NET_API_STATUS 72 | 73 | # END IF WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM) 74 | 75 | if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP): 76 | # The following private function will go away eventually. 77 | # Call NetApiBufferAllocate instead. 78 | # Internal Function 79 | pass 80 | 81 | # END IF WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) 82 | 83 | if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_APP): 84 | # _Success_( return == 0 ) 85 | # NET_API_STATUS NET_API_FUNCTION 86 | # NetApiBufferFree( 87 | # _Frees_ptr_opt_ LPVOID Buffer 88 | # ); 89 | NetApiBufferFree = netapi32.NetApiBufferFree 90 | NetApiBufferFree.restype = NET_API_STATUS 91 | 92 | # END IF WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_APP) 93 | 94 | if defined(__cplusplus): 95 | pass 96 | # END IF 97 | 98 | # END IF _LMAPIBUF_ 99 | 100 | 101 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | pyWinAPI 2 | 3 | NOTICE 4 | 5 | This project is never intended to run. It is to be used as a reference in order to obtain python version of the c code located in the Windows SDK. TheWindows SDK is a behemoth clockin in at almost 10 million lines of code. I think that Python would cringe and then run away if we tried to run a program that contained that many lines of code. Not to mention what the memory hit would be if we loaded that much code. 6 | 7 | WARNING 8 | 9 | Most objects created using ctypes or comtypes is going to require you to release them explicitly. Releasing an object is freeing the memory the object is using. Simply deleting the object in python is not going to release the memory that is being used. This is extremely important because if you do not do this you are going to end up with memory fragmentation and leaks, and this is never a nice thing to have to deal with. Make sure you read the Windows SDK documentation, it will tell you if you need to release or (free) an object. and if it tells you that you do then you MUST do it. 10 | 11 | Another suggestion is when you need to access some information from an object in the Windows API DO NOT HOLD REFERENCE to this object.. collect whatever data it is you need then release (free) it. It is far easier then having to keep tack of objects. and quite often the objct can become invalid which is a whole other issue because the invalid object you are not going to be able to release so you end up with your memory being held hostage. 12 | 13 | 14 | This is a work in progress. If you feel like helping to build the file and clean them up let me know ahead of time so we do not work on the same files. 15 | 16 | Plus I will need to explain how to use the code converter. It does a pretty decent job. It is not 100% so there is manual work that does need to be done to each file. It sure does speed up the process of creating a python version of the Windows SDK. 17 | 18 | If you are interested in helping there is a special set of h and idl files that needs to be used with the code converter. these special files are from the latest Windows 10 sdk and have been formatted to make reading them alot easier. the preprocessor commands are indented like you would see in python. so following the code to make any manual alterations is far easier. 19 | 20 | Now that I have come up with a layout I am going to stick to you will see additions and changes to this repo pretty often. My goal is to do the whole Windows SDK. creating what would be a pure python version of pywin32. except it will include the whole Windows API. 21 | 22 | The file/folder structure is an identical replica of the latest Windows 10 SDK this makes it easier to locate things because you can use the information found on the Microsoft Developer website along with the Microsoft docs. if it tells you what file in the SDK something is located it will be in the same location with this package 23 | 24 | I am still learning how to handle some of the conversions from c/cpp to ctypes. so some things may not work properly. There are also unfinished conversions that could throw you an exception. let me know if there is a specific part you need and i will shift gears and get that part working for ya. 25 | 26 | These are incorrect statictics. 27 | 28 | total number of C code files 2397 29 | number of files converted 335 30 | 31 | total number of C code lines 3823868 32 | number of line converted 667026 33 | 34 | percentage of files completed: 13.98 % 35 | percentage of line of code converted 17.44 % 36 | 37 | There are actually 38 | c header files ( .h) 3966 files containing 7,303,908 lines of code. 39 | interface files (.idl) 892 files containing 607,420 lines of code. 40 | 41 | Where I am currently 42 | python files ( .py) 432 files containing 780,000 lines of code 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /shared/winusbio_h.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | from pyWinAPI import * 3 | from pyWinAPI.shared.wtypes_h import * 4 | from pyWinAPI.shared.winapifamily_h import * 5 | from pyWinAPI.shared.sdkddkver_h import * 6 | from pyWinAPI.shared.guiddef_h import * 7 | 8 | 9 | class _WINUSB_PIPE_INFORMATION(ctypes.Structure): 10 | pass 11 | 12 | 13 | WINUSB_PIPE_INFORMATION = _WINUSB_PIPE_INFORMATION 14 | PWINUSB_PIPE_INFORMATION = POINTER(_WINUSB_PIPE_INFORMATION) 15 | 16 | 17 | class _WINUSB_PIPE_INFORMATION_EX(ctypes.Structure): 18 | pass 19 | 20 | 21 | WINUSB_PIPE_INFORMATION_EX = _WINUSB_PIPE_INFORMATION_EX 22 | PWINUSB_PIPE_INFORMATION_EX = POINTER(_WINUSB_PIPE_INFORMATION_EX) 23 | 24 | 25 | # ************************************************************************* 26 | # Copyright (c) 2002 Microsoft Corporation Module Name: wusbio.h Abstract: 27 | # Public header for WINUSB Environment: User and Kernel Mode Notes: THIS CODE 28 | # AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 29 | # EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF 30 | # MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. Copyright (c) 2001 31 | # Microsoft Corporation. All Rights Reserved. Revision History: 11/12/2002 : 32 | # created * 33 | 34 | __WUSBIO_H__ = None 35 | 36 | if not defined(__WUSBIO_H__): 37 | __WUSBIO_H__ = 1 38 | from pyWinAPI.shared.winapifamily_h import * # NOQA 39 | 40 | if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP): 41 | if NTDDI_VERSION >= NTDDI_WINXP: 42 | from pyWinAPI.shared.usb_h import * # NOQA 43 | 44 | # Pipe policy types 45 | SHORT_PACKET_TERMINATE = 0x01 46 | AUTO_CLEAR_STALL = 0x02 47 | PIPE_TRANSFER_TIMEOUT = 0x03 48 | IGNORE_SHORT_PACKETS = 0x04 49 | ALLOW_PARTIAL_READS = 0x05 50 | AUTO_FLUSH = 0x06 51 | RAW_IO = 0x07 52 | MAXIMUM_TRANSFER_SIZE = 0x08 53 | RESET_PIPE_ON_RESUME = 0x09 54 | 55 | # Power policy types 56 | # Add 0x80 for Power policy types in order to prevent overlap with 57 | # Pipe policy types to prevent "accidentally" setting the wrong 58 | # value for the 59 | # wrong type. 60 | AUTO_SUSPEND = 0x81 61 | SUSPEND_DELAY = 0x83 62 | 63 | # Device Information types 64 | DEVICE_SPEED = 0x01 65 | 66 | # Device Speeds 67 | LowSpeed = 0x01 68 | FullSpeed = 0x02 69 | HighSpeed = 0x03 70 | 71 | # {DA812BFF - 12C3 - 46a2 - 8E2B - DBD3B7834C43} 72 | from pyWinAPI.shared.initguid_h import * # NOQA 73 | WinUSB_TestGuid = DEFINE_GUID( 74 | 0xDA812BFF, 75 | 0x12C3, 76 | 0x46A2, 77 | 0x8E, 78 | 0x2B, 79 | 0xDB, 80 | 0xD3, 81 | 0xB7, 82 | 0x83, 83 | 0x4C, 84 | 0x43 85 | ) 86 | _WINUSB_PIPE_INFORMATION._fields_ = [ 87 | ('PipeType', USBD_PIPE_TYPE), 88 | ('PipeId', UCHAR), 89 | ('MaximumPacketSize', USHORT), 90 | ('Interval', UCHAR), 91 | ] 92 | _WINUSB_PIPE_INFORMATION_EX._fields_ = [ 93 | ('PipeType', USBD_PIPE_TYPE), 94 | ('PipeId', UCHAR), 95 | ('MaximumPacketSize', USHORT), 96 | ('Interval', UCHAR), 97 | ('MaximumBytesPerInterval', ULONG), 98 | ] 99 | # END IF (NTDDI_VERSION >= NTDDI_WINXP) 100 | # END IF WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) 101 | # END IF __WUSBIO_H__ 102 | -------------------------------------------------------------------------------- /shared/nettypes_h.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | from pyWinAPI import * 3 | from pyWinAPI.shared.wtypes_h import * 4 | from pyWinAPI.shared.winapifamily_h import * 5 | from pyWinAPI.shared.sdkddkver_h import * 6 | from pyWinAPI.shared.guiddef_h import * 7 | 8 | 9 | _NETTYPES_ = None 10 | 11 | class _FLAT_STRING(ctypes.Structure): 12 | pass 13 | 14 | 15 | FLAT_STRING = _FLAT_STRING 16 | PFLAT_STRING = POINTER(_FLAT_STRING) 17 | 18 | 19 | class _NETWORK_NAME(ctypes.Structure): 20 | pass 21 | 22 | 23 | NETWORK_NAME = _NETWORK_NAME 24 | PNETWORK_NAME = POINTER(_NETWORK_NAME) 25 | 26 | 27 | class _HARDWARE_ADDRESS(ctypes.Structure): 28 | pass 29 | 30 | 31 | HARDWARE_ADDRESS = _HARDWARE_ADDRESS 32 | PHARDWARE_ADDRESS = POINTER(_HARDWARE_ADDRESS) 33 | 34 | 35 | 36 | 37 | # /* + + Copyright (c) Microsoft Corporation. All rights reserved. Module 38 | # Name: nettypes.h Abstract: This header file contains type definitions for 39 | # the NT TDI, NDI, DDI, and PDI interfaces which are not specific to a single 40 | # interface. Revision History: -- 41 | if not defined(_NETTYPES_): 42 | _NETTYPES_ = VOID 43 | from winapifamily_h import * # NOQA 44 | 45 | if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP): 46 | # The following basic type is used to provide extensibility in request 47 | # and response packets. The OFFSET type is used to contain a value 48 | # which 49 | # is interpreted as a relative address consisting of a number of bytes 50 | # from the beginning of the immediate parent structure. 51 | OFFSET = ULONG 52 | 53 | 54 | # The following basic type is used throughout all the layers to pass a 55 | # string through an I/O interface which does not allow embedded 56 | # pointers. 57 | # To allocate a FLAT_STRING, one must make room for the correct number 58 | # of 59 | # buffer bytes in the allocation. 60 | # total size of string buffer. 61 | _FLAT_STRING._fields_ = [ 62 | ('MaximumLength', SHORT), 63 | # number of bytes represented in string. 64 | ('Length', SHORT), 65 | # the buffer itself follows this struct. 66 | ('Buffer', CHAR * 1), 67 | ] 68 | 69 | 70 | # Basic type used to represent a network name, typically as a 71 | # component of 72 | # a transport address structure through the TDI. This type is also 73 | # passed 74 | # through the NDI interface. This type is declared as a structure so 75 | # that 76 | # it can be extended easily without modifying applications, even 77 | # though it 78 | # currently only has one element. 79 | # network name in FLAT_STRING format. 80 | _NETWORK_NAME._fields_ = [ 81 | ('Name', FLAT_STRING), 82 | ] 83 | 84 | # Basic type used to represent an address at the hardware level of the 85 | # network. Hardware addresses are abstract types which are mapped to 86 | # adapter addresses by the physical provider. See the Physical Driver 87 | # Interface specification for details on how this is accomplished. 88 | HARDWARE_ADDRESS_LENGTH = 6 # number of octets in a hardware address. 89 | 90 | 91 | _HARDWARE_ADDRESS._fields_ = [ 92 | ('Address', UCHAR * HARDWARE_ADDRESS_LENGTH), 93 | ] 94 | 95 | # Network management variable types used by all interface levels. 96 | NETMAN_VARTYPE_ULONG = 0 # type is a ULONG. 97 | NETMAN_VARTYPE_HARDWARE_ADDRESS = 1 # type is a HARDWARE_ADDRESS. 98 | NETMAN_VARTYPE_STRING = 2 # type is a FLAT_STRING. 99 | # END IF WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) 100 | # END IF _NETTYPES_ 101 | 102 | 103 | -------------------------------------------------------------------------------- /shared/tvout_h.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | from wtypes_h import ( 4 | GUID, 5 | ULONG, 6 | UCHAR, 7 | POINTER, 8 | ) 9 | import ctypes 10 | import ntdef_h 11 | 12 | 13 | from winapifamily_h import * # NOQA 14 | from guiddef_h import * # NOQA 15 | 16 | class _VIDEOPARAMETERS(ctypes.Structure): 17 | _fields_ = [ 18 | ('Guid', GUID), 19 | ('dwOffset', ULONG), 20 | ('dwCommand', ULONG), 21 | ('dwFlags', ULONG), 22 | ('dwMode', ULONG), 23 | ('dwTVStandard', ULONG), 24 | ('dwAvailableModes', ULONG), 25 | ('dwAvailableTVStandard', ULONG), 26 | ('dwFlickerFilter', ULONG), 27 | ('dwOverScanX', ULONG), 28 | ('dwOverScanY', ULONG), 29 | ('dwMaxUnscaledX', ULONG), 30 | ('dwMaxUnscaledY', ULONG), 31 | ('dwPositionX', ULONG), 32 | ('dwPositionY', ULONG), 33 | ('dwBrightness', ULONG), 34 | ('dwContrast', ULONG), 35 | ('dwCPType', ULONG), 36 | ('dwCPCommand', ULONG), 37 | ('dwCPStandard', ULONG), 38 | ('dwCPKey', ULONG), 39 | ('bCP_APSTriggerBits', ULONG), 40 | ('bOEMCopyProtection', UCHAR * 256), 41 | ] 42 | 43 | 44 | VIDEOPARAMETERS = _VIDEOPARAMETERS 45 | PVIDEOPARAMETERS = POINTER(_VIDEOPARAMETERS) 46 | LPVIDEOPARAMETERS = POINTER(_VIDEOPARAMETERS) 47 | 48 | 49 | VP_COMMAND_GET = 0x00000001 50 | VP_COMMAND_SET = 0x00000002 51 | VP_FLAGS_TV_MODE = 0x00000001 52 | VP_FLAGS_TV_STANDARD = 0x00000002 53 | VP_FLAGS_FLICKER = 0x00000004 54 | VP_FLAGS_OVERSCAN = 0x00000008 55 | VP_FLAGS_MAX_UNSCALED = 0x00000010 56 | VP_FLAGS_POSITION = 0x00000020 57 | VP_FLAGS_BRIGHTNESS = 0x00000040 58 | VP_FLAGS_CONTRAST = 0x00000080 59 | VP_FLAGS_COPYPROTECT = 0x00000100 60 | VP_MODE_WIN_GRAPHICS = 0x00000001 61 | VP_MODE_TV_PLAYBACK = 0x00000002 62 | VP_TV_STANDARD_NTSC_M = 0x00000001 63 | VP_TV_STANDARD_NTSC_M_J = 0x00000002 64 | VP_TV_STANDARD_PAL_B = 0x00000004 65 | VP_TV_STANDARD_PAL_D = 0x00000008 66 | VP_TV_STANDARD_PAL_H = 0x00000010 67 | VP_TV_STANDARD_PAL_I = 0x00000020 68 | VP_TV_STANDARD_PAL_M = 0x00000040 69 | VP_TV_STANDARD_PAL_N = 0x00000080 70 | VP_TV_STANDARD_SECAM_B = 0x00000100 71 | VP_TV_STANDARD_SECAM_D = 0x00000200 72 | VP_TV_STANDARD_SECAM_G = 0x00000400 73 | VP_TV_STANDARD_SECAM_H = 0x00000800 74 | VP_TV_STANDARD_SECAM_K = 0x00001000 75 | VP_TV_STANDARD_SECAM_K1 = 0x00002000 76 | VP_TV_STANDARD_SECAM_L = 0x00004000 77 | VP_TV_STANDARD_WIN_VGA = 0x00008000 78 | VP_TV_STANDARD_NTSC_433 = 0x00010000 79 | VP_TV_STANDARD_PAL_G = 0x00020000 80 | VP_TV_STANDARD_PAL_60 = 0x00040000 81 | VP_TV_STANDARD_SECAM_L1 = 0x00080000 82 | VP_CP_TYPE_APS_TRIGGER = 0x00000001 83 | VP_CP_TYPE_MACROVISION = 0x00000002 84 | VP_CP_CMD_ACTIVATE = 0x00000001 85 | VP_CP_CMD_DEACTIVATE = 0x00000002 86 | VP_CP_CMD_CHANGE = 0x00000004 87 | 88 | __all__ = ( 89 | 'VP_TV_STANDARD_WIN_VGA', 'VP_CP_CMD_CHANGE', 'VP_FLAGS_BRIGHTNESS', 90 | 'VP_CP_CMD_DEACTIVATE', 'VP_FLAGS_FLICKER', 'VP_TV_STANDARD_PAL_B', 91 | 'VP_TV_STANDARD_SECAM_D', 'VP_COMMAND_SET', 'VP_FLAGS_OVERSCAN', 92 | 'VP_MODE_WIN_GRAPHICS', 'VP_CP_CMD_ACTIVATE', 'VP_TV_STANDARD_SECAM_K1', 93 | 'VP_FLAGS_TV_STANDARD', 'VP_CP_TYPE_MACROVISION', 'VP_FLAGS_MAX_UNSCALED', 94 | 'VP_CP_TYPE_APS_TRIGGER', 'VP_FLAGS_TV_MODE', 'VP_TV_STANDARD_PAL_G', 95 | 'VP_TV_STANDARD_PAL_D', 'VP_COMMAND_GET', 'VP_MODE_TV_PLAYBACK', 96 | 'VP_TV_STANDARD_PAL_N', 'VP_TV_STANDARD_NTSC_M', 'VP_TV_STANDARD_PAL_M', 97 | 'VP_TV_STANDARD_PAL_H', 'VP_TV_STANDARD_PAL_I', 'VP_TV_STANDARD_SECAM_L', 98 | 'VP_TV_STANDARD_SECAM_K', 'VP_TV_STANDARD_SECAM_H', 'VP_FLAGS_CONTRAST', 99 | 'VP_TV_STANDARD_SECAM_G', 'VP_TV_STANDARD_SECAM_B', 'VP_FLAGS_POSITION', 100 | 'VP_TV_STANDARD_SECAM_L1', 'VP_FLAGS_COPYPROTECT', '_VIDEOPARAMETERS', 101 | 'VP_TV_STANDARD_NTSC_433', 'VP_TV_STANDARD_NTSC_M_J', 'PVIDEOPARAMETERS', 102 | 'VP_TV_STANDARD_PAL_60', 'LPVIDEOPARAMETERS', 'VIDEOPARAMETERS', 103 | ) 104 | -------------------------------------------------------------------------------- /shared/clfslsn_h.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | from pyWinAPI import * 3 | from pyWinAPI.shared.wtypes_h import * 4 | from pyWinAPI.shared.winapifamily_h import * 5 | from pyWinAPI.shared.sdkddkver_h import * 6 | from pyWinAPI.shared.guiddef_h import * 7 | 8 | 9 | _CLFS_LSN_H_ = None 10 | 11 | 12 | class _CLS_LSN(ctypes.Union): 13 | pass 14 | 15 | CLS_LSN = _CLS_LSN 16 | PCLS_LSN = POINTER(_CLS_LSN) 17 | PPCLS_LSN = POINTER(POINTER(_CLS_LSN)) 18 | 19 | 20 | from pyWinAPI.shared.winapifamily_h import * # NOQA 21 | 22 | # /* == == == == == == == == == == == == == == == == == == == == == == == == 23 | # == == == == == == == == == == == == == == = Copyright (c) 1998 Microsoft 24 | # Corporation Module Name: clfslsn.h Abstract: Header file containing the 25 | # private definition for the common log file system's log sequence number 26 | # structure. Author: Dexter Bradshaw [DexterB] 09-Dec-1998 Revision History: 27 | # == == == == == == == == == == == == == == == == == == == == == == == == == 28 | # == == == == == == == == == == == == == = 29 | if not defined(_CLFS_LSN_H_): 30 | _CLFS_LSN_H_ = VOID 31 | 32 | if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP): 33 | if (NTDDI_VERSION >= NTDDI_WS03SP1) or (_WIN32_WINNT >= _WIN32_WINNT_WS03): 34 | # CLFS_RECORD_INDEX 35 | # Log record offset on container file. The log record offset 36 | # consists of a block 37 | # offset in the container and a bucket identifier indexing the 38 | # records in the block. 39 | # Declared up here because including clfs_x.h will try to define 40 | # the LSN, which needs 41 | # this. 42 | CLFS_RECORD_INDEX = UINT32 43 | # END IF NTDDI_VERSION or _WIN32_WINNT 44 | 45 | if (NTDDI_VERSION >= NTDDI_WS03SP1) or (_WIN32_WINNT >= _WIN32_WINNT_WS03): 46 | # CLS_LSN 47 | # The log sequence number (LSN) is a valid log file address. The 48 | # LSN consists of 49 | # three (3) parts: (a) a log identifier to identify which physical 50 | # log the log record 51 | # belongs to, (b) a container index identifying the log container 52 | # where the log record 53 | # lies, and (c) a record offset identified by the offset of the 54 | # block in the container 55 | # and an ordinal number for the record within the container. 56 | # The structure of the LSN poses some inherent limitations of the 57 | # number of logs, 58 | # the number of containers, the size of a container, and the 59 | # number of log records in 60 | # a log block. 61 | # Maximum number of physical log files is 64K. 62 | # Maximum number of container identifiers is 4G. 63 | # Maximum size of a container is 4G. 64 | # Maximum number of sector-aligned log blocks is 8M 65 | # Maximum number of record buckets in a log block is 512 66 | class offset(ctypes.Structure): 67 | pass 68 | 69 | 70 | offset._fields_ = [ 71 | # Record offset on container. 72 | ('idxRecord', CLFS_RECORD_INDEX), 73 | # Container identifier. 74 | ('cidContainer', CLFS_CONTAINER_ID), 75 | ] 76 | _CLS_LSN.offset = offset 77 | 78 | _CLS_LSN._fields_ = [ 79 | # Container identifier 80 | ('offset', _CLS_LSN.offset), 81 | # Sequence number within physical log. 82 | ('ULONGLONG ullOffset', __volatile), 83 | ] 84 | 85 | # Alias CLS prefixed types with CLFS prefixes. 86 | CLFS_LSN = CLS_LSN 87 | PCLFS_LSN = POINTER(CLFS_LSN) 88 | PPCLFS_LSN = PONITER(POINTER(CLFS_LSN)) 89 | # END IF NTDDI_VERSION or _WIN32_WINNT 90 | # END IF WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) 91 | # END IF 92 | 93 | 94 | -------------------------------------------------------------------------------- /um/timeapi_h.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | from pyWinAPI import * 3 | from pyWinAPI.shared.wtypes_h import * 4 | from pyWinAPI.shared.winapifamily_h import * 5 | from pyWinAPI.shared.sdkddkver_h import * 6 | from pyWinAPI.shared.guiddef_h import * 7 | 8 | 9 | _TIMERAPI_H_ = None 10 | MMNOTIMER = None 11 | 12 | 13 | class timecaps_tag(ctypes.Structure): 14 | pass 15 | 16 | 17 | TIMECAPS = timecaps_tag 18 | PTIMECAPS = POINTER(timecaps_tag) 19 | NPTIMECAPS = POINTER(timecaps_tag) 20 | LPTIMECAPS = POINTER(timecaps_tag) 21 | 22 | 23 | # ***************************************************************************** 24 | # timerapi.h -- ApiSet Contract for api-ms-win-mm-time-l1-1-0 25 | # Copyright (c) Microsoft Corporation. All rights reserved. 26 | # ***************************************************************************** 27 | 28 | if defined(_MSC_VER): 29 | pass 30 | # END IF _MSC_VER 31 | 32 | if not defined(_TIMERAPI_H_): 33 | _TIMERAPI_H_ = VOID 34 | from pyWinAPI.shared.apiset_h import * # NOQA 35 | from pyWinAPI.shared.apisetcconv_h import * # NOQA 36 | from pyWinAPI.um.mmsyscom_h import * # NOQA 37 | if defined(__cplusplus): 38 | pass 39 | # END IF 40 | 41 | if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM): 42 | if not defined(MMNOTIMER): 43 | # ***************************************************************** 44 | # Timer support 45 | # ***************************************************************** 46 | 47 | # timer error return values 48 | TIMERR_NOERROR = 0 # no error 49 | TIMERR_NOCANDO = TIMERR_BASE + 1 # request not completed 50 | TIMERR_STRUCT = TIMERR_BASE + 33 # time struct size 51 | 52 | # timer device capabilities data structure 53 | # minimum period supported 54 | timecaps_tag._fields_ = [ 55 | ('wPeriodMin', UINT), 56 | # maximum period supported 57 | ('wPeriodMax', UINT), 58 | ] 59 | 60 | # timer function prototypes 61 | winmm = ctypes.windll.WINMM 62 | 63 | # WINMMAPI 64 | # MMRESULT 65 | # WINAPI 66 | # timeGetSystemTime( 67 | # _Out_writes_bytes_(cbmmt) LPMMTIME pmmt, 68 | # _In_ UINT cbmmt 69 | # ); 70 | timeGetSystemTime = winmm.timeGetSystemTime 71 | timeGetSystemTime.restype = MMRESULT 72 | 73 | # WINMMAPI 74 | # DWORD 75 | # WINAPI 76 | # timeGetTime( 77 | # void 78 | # ); 79 | timeGetTime = winmm.timeGetTime 80 | timeGetTime.restype = DWORD 81 | 82 | # WINMMAPI 83 | # MMRESULT 84 | # WINAPI 85 | # timeGetDevCaps( 86 | # _Out_writes_bytes_(cbtc) LPTIMECAPS ptc, 87 | # _In_ UINT cbtc 88 | # ); 89 | timeGetDevCaps = winmm.timeGetDevCaps 90 | timeGetDevCaps.restype = MMRESULT 91 | 92 | # WINMMAPI 93 | # MMRESULT 94 | # WINAPI 95 | # timeBeginPeriod( 96 | # _In_ UINT uPeriod 97 | # ); 98 | timeBeginPeriod = winmm.timeBeginPeriod 99 | timeBeginPeriod.restype = MMRESULT 100 | 101 | # WINMMAPI 102 | # MMRESULT 103 | # WINAPI 104 | # timeEndPeriod( 105 | # _In_ UINT uPeriod 106 | # ); 107 | timeEndPeriod = winmm.timeEndPeriod 108 | timeEndPeriod.restype = MMRESULT 109 | # END IF ifndef MMNOTIMER 110 | # END IF WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM) 111 | 112 | if defined(__cplusplus): 113 | pass 114 | # END IF 115 | # END IF _TIMERAPI_H_ 116 | 117 | 118 | -------------------------------------------------------------------------------- /code_converter/sort_code.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EventGhost. 4 | # Copyright © 2005-2016 EventGhost Project 5 | # 6 | # EventGhost is free software: you can redistribute it and/or modify it under 7 | # the terms of the GNU General Public License as published by the Free 8 | # Software Foundation, either version 2 of the License, or (at your option) 9 | # any later version. 10 | # 11 | # EventGhost is distributed in the hope that it will be useful, but WITHOUT 12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 14 | # more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with EventGhost. If not, see . 18 | 19 | 20 | # this module iterates over the sdk directory which is shown below in the 21 | # "in_path", The out_path is one folder level down from this module. it will 22 | # make a replica of the SDK folder at this location. 23 | # this module opens up every .h file and indents the file based on the 24 | # preprocessor syntax, #ifndef, #ifdef, #if, #elif and #else. 25 | # 26 | # By doing this it make it far easier to follow the nested 27 | # preprocessor commands. It is with these commands where most of the issue 28 | # arise from so being able to easily read the .h file to be able to fix a 29 | # converted file is extremely important. 30 | 31 | from __future__ import print_function, absolute_import 32 | import os 33 | 34 | in_path = r'C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0' 35 | out_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) 36 | 37 | 38 | class SortCode(object): 39 | 40 | def __init__(self, data): 41 | if_count = 0 42 | lines = [] 43 | 44 | for line in data: 45 | if line.strip().startswith('#'): 46 | cut_index = 1 47 | 48 | for char in list(line.strip())[1:]: 49 | if not char == ' ': 50 | break 51 | 52 | cut_index += 1 53 | 54 | line = '#' + line.strip()[cut_index:] 55 | 56 | for item in ('#if', '#ifdef', '#ifndef'): 57 | if line.strip().startswith(item): 58 | lines += [' ' * if_count + line] 59 | if_count += 1 60 | break 61 | else: 62 | for item in ('#elif', '#else'): 63 | if line.strip().startswith(item): 64 | lines += [' ' * (if_count - 1) + line] 65 | break 66 | else: 67 | if line.strip().startswith('#endif'): 68 | if_count -= 1 69 | 70 | lines += [' ' * if_count + line] 71 | self.lines = lines 72 | 73 | def __str__(self): 74 | return '\n'.join(self.lines) 75 | 76 | 77 | def iter_path(p, indent=''): 78 | files = os.listdir(p) 79 | root = p.replace(in_path, out_path) 80 | if os.path.isdir(p) and not os.path.exists(root): 81 | os.makedirs(root) 82 | print(indent + p) 83 | 84 | for f in files: 85 | in_file = os.path.join(p, f) 86 | out_file = os.path.join(root, f) 87 | 88 | if os.path.isdir(in_file): 89 | iter_path(in_file, indent + ' ') 90 | elif f.endswith('.h'): 91 | print(indent + ' ' + f) 92 | with open(in_file, 'r') as f1: 93 | with open(out_file, 'w') as f2: 94 | f2.write(str(SortCode(f1.read().split('\n')))) 95 | else: 96 | print(indent + ' ' + f) 97 | with open(in_file, 'r') as f1: 98 | with open(out_file, 'w') as f2: 99 | f2.write(f1.read()) 100 | 101 | 102 | iter_path(in_path) 103 | 104 | 105 | 106 | -------------------------------------------------------------------------------- /km/bthxddi_h.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | from pyWinAPI import * 3 | from pyWinAPI.shared.wtypes_h import * 4 | from pyWinAPI.shared.sdkddkver_h import * 5 | from pyWinAPI.shared.guiddef_h import * 6 | 7 | 8 | class _BTHX_VERSION(ctypes.Structure): 9 | pass 10 | 11 | 12 | BTHX_VERSION = _BTHX_VERSION 13 | PBTHX_VERSION = POINTER(_BTHX_VERSION) 14 | 15 | 16 | class _BTHX_CAPABILITIES(ctypes.Structure): 17 | pass 18 | 19 | 20 | BTHX_CAPABILITIES = _BTHX_CAPABILITIES 21 | PBTHX_CAPABILITIES = POINTER(_BTHX_CAPABILITIES) 22 | 23 | 24 | class _BTHX_HCI_READ_WRITE_CONTEXT(ctypes.Structure): 25 | pass 26 | 27 | 28 | BTHX_HCI_READ_WRITE_CONTEXT = _BTHX_HCI_READ_WRITE_CONTEXT 29 | PBTHX_HCI_READ_WRITE_CONTEXT = POINTER(_BTHX_HCI_READ_WRITE_CONTEXT) 30 | 31 | 32 | # ************************************************************************** 33 | # Copyright (c) Microsoft Corporation. All Rights Reserved Module Name: 34 | # BthXDDI.h Abstract: Public IOCTL codes and structure common to BTHMINI and 35 | # its Bluetooth extensible transport driver. Environment: Kernel mode only 36 | # Revision History: 37 | # ************************************************************************* 38 | 39 | __BTHXDDI_H__ = None 40 | 41 | if not defined(__BTHXDDI_H__): 42 | __BTHXDDI_H__ = 1 43 | 44 | if NTDDI_VERSION >= NTDDI_WIN8: 45 | from pyWinAPI.shared.devioctl_h import * # NOQA 46 | # DDI Version definition 47 | BTHX_DDI_VERSION_1 = 0x00000001 # Initial release version 48 | 49 | # HCI packet types 50 | class _BTHX_HCI_PACKET_TYPE(ENUM): 51 | HciPacketCommand = 0x01 52 | HciPacketAclData = 0x02 53 | HciPacketEvent = 0x04 54 | 55 | BTHX_HCI_PACKET_TYPE = _BTHX_HCI_PACKET_TYPE 56 | 57 | # IOCTL definitions. 58 | BTHX_IOCTL_BASE = 0 59 | 60 | 61 | def BTHX_CTL(id): 62 | return CTL_CODE( 63 | FILE_DEVICE_BLUETOOTH, 64 | id, 65 | METHOD_NEITHER, 66 | FILE_ANY_ACCESS 67 | ) 68 | 69 | 70 | # kernel - level (internal) IOCTLs 71 | IOCTL_BTHX_GET_VERSION = BTHX_CTL(BTHX_IOCTL_BASE + 0x100) 72 | IOCTL_BTHX_SET_VERSION = BTHX_CTL(BTHX_IOCTL_BASE + 0x101) 73 | IOCTL_BTHX_QUERY_CAPABILITIES = BTHX_CTL(BTHX_IOCTL_BASE + 0x102) 74 | IOCTL_BTHX_WRITE_HCI = BTHX_CTL(BTHX_IOCTL_BASE + 0x103) 75 | IOCTL_BTHX_READ_HCI = BTHX_CTL(BTHX_IOCTL_BASE + 0x104) 76 | 77 | # BTH XDDI Interface Version Structure 78 | _BTHX_VERSION._fields_ = [ 79 | ('Version', ULONG), 80 | ] 81 | 82 | # Initialize the version data 83 | # Bluetooth SCO support option. 84 | class _BTHX_SCO_SUPPORT(ENUM): 85 | ScoSupportNone = 0 86 | ScoSupportHCI = 1 87 | ScoSupportHCIBypass = 2 88 | 89 | BTHX_SCO_SUPPORT = _BTHX_SCO_SUPPORT 90 | PBTHX_SCO_SUPPORT = POINTER(_BTHX_SCO_SUPPORT) 91 | 92 | # Bluetooth transport driver's capabilities. 93 | _BTHX_CAPABILITIES._fields_ = [ 94 | # [out] Max ACL IN transfer. 95 | ('MaxAclTransferInSize', ULONG), 96 | # [out] Type of SCO support 97 | ('ScoSupport', BTHX_SCO_SUPPORT), 98 | # [out] Max SCO channels supported. 99 | ('MaxScoChannels', ULONG), 100 | # [out] TRUE if device can support idle/sleep state. 101 | ('IsDeviceIdleCapable', BOOLEAN), 102 | # [out] TRUE if device can support remote wake. 103 | ('IsDeviceWakeCapable', BOOLEAN), 104 | ] 105 | 106 | # READ/WRITE context 107 | _BTHX_HCI_READ_WRITE_CONTEXT._fields_ = [ 108 | # Size of Data 109 | ('DataLen', ULONG), 110 | # Packet Type 111 | ('Type', UCHAR), 112 | # Actual data 113 | ('Data', UCHAR * 1), 114 | ] 115 | 116 | # END IF NTDDI_VERSION 117 | # END IF __BTHXDDI_H__ 118 | -------------------------------------------------------------------------------- /shared/winpackagefamily_h.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Microsoft Corporation. All rights reserved. 2 | # Module Name: 3 | # winpackagefamily.h 4 | # Abstract: 5 | # API family partitioning based on packages. 6 | 7 | 8 | from pyWinAPI import * 9 | 10 | 11 | if not defined(_INC_WINPACKAGEFAMILY): 12 | _INC_WINPACKAGEFAMILY = 1 13 | from shared.winapifamily_h import * 14 | 15 | if defined(_MSC_VER) and not defined(MOFCOMP_PASS): 16 | if _MSC_VER >= 1200: 17 | pass 18 | # ENDIF defined(_MSC_VER) and not defined(MOFCOMP_PASS) 19 | # ENDIF defined(_MSC_VER) and not defined(MOFCOMP_PASS) 20 | WINAPI_PARTITION_ONECORE_APP = 0 21 | 22 | if not defined(WINAPI_PARTITION_SERVER): 23 | WINAPI_PARTITION_SERVER = ( 24 | WINAPI_FAMILY == WINAPI_FAMILY_SERVER 25 | ) 26 | # ENDIF not defined(WINAPI_PARTITION_SERVER) 27 | 28 | # PARTITIONS based on packages are each #undef'ed below, and then will be 29 | # #define-ed to be either 1 or 0 or depending on the active WINAPI_FAMILY. 30 | # PARTITIONS for feature packages. Each package might be active for 31 | # one or more editions 32 | WINAPI_PARTITION_PKG_WINTRUST = WINAPI_PARTITION_SERVER == 1 33 | WINAPI_PARTITION_PKG_WEBSERVICES = ( 34 | WINAPI_PARTITION_SERVER == 1 35 | ) 36 | WINAPI_PARTITION_PKG_EVENTLOGSERVICE = ( 37 | WINAPI_PARTITION_SERVER == 1 38 | ) 39 | WINAPI_PARTITION_PKG_VHD = WINAPI_PARTITION_SERVER == 1 40 | WINAPI_PARTITION_PKG_PERFCOUNTER = ( 41 | WINAPI_PARTITION_SERVER == 1 42 | ) 43 | WINAPI_PARTITION_PKG_SECURESTARTUP = ( 44 | WINAPI_PARTITION_SERVER == 1 45 | ) 46 | WINAPI_PARTITION_PKG_REMOTEFS = WINAPI_PARTITION_SERVER == 1 47 | WINAPI_PARTITION_PKG_BOOTABLESKU = ( 48 | WINAPI_PARTITION_SERVER == 1 49 | ) 50 | WINAPI_PARTITION_PKG_CMDTOOLS = ( 51 | WINAPI_PARTITION_SERVER == 1 52 | ) 53 | WINAPI_PARTITION_PKG_DISM = ( 54 | WINAPI_PARTITION_SERVER == 1 55 | ) 56 | WINAPI_PARTITION_PKG_CORESETUP = WINAPI_PARTITION_SERVER == 1 57 | WINAPI_PARTITION_PKG_APPRUNTIME = ( 58 | WINAPI_PARTITION_SERVER == 1 59 | ) 60 | WINAPI_PARTITION_PKG_ESENT = WINAPI_PARTITION_SERVER == 1 61 | WINAPI_PARTITION_PKG_WINMGMT = WINAPI_PARTITION_SERVER == 1 62 | WINAPI_PARTITION_PKG_WNV = WINAPI_PARTITION_SERVER == 1 63 | WINAPI_PARTITION_PKG_CLUSTER = WINAPI_PARTITION_SERVER == 1 64 | WINAPI_PARTITION_PKG_VSS = WINAPI_PARTITION_SERVER == 1 65 | WINAPI_PARTITION_PKG_TRAFFIC = WINAPI_PARTITION_SERVER == 1 66 | WINAPI_PARTITION_PKG_ISCSI = WINAPI_PARTITION_SERVER == 1 67 | WINAPI_PARTITION_PKG_STORAGE = WINAPI_PARTITION_SERVER == 1 68 | WINAPI_PARTITION_PKG_MPSSVC = WINAPI_PARTITION_SERVER == 1 69 | WINAPI_PARTITION_PKG_APPXDEPLOYMENT = ( 70 | WINAPI_PARTITION_SERVER == 1 71 | ) 72 | WINAPI_PARTITION_PKG_WER = WINAPI_PARTITION_SERVER == 1 73 | 74 | if defined(_MSC_VER) and not defined(MOFCOMP_PASS): 75 | if _MSC_VER >= 1200: 76 | pass 77 | # ENDIF if _MSC_VER >= 1200 78 | # endif defined(_MSC_VER) and not defined(MOFCOMP_PASS) 79 | 80 | # ENDIF not defined(_INC_WINPACKAGEFAMILY) 81 | 82 | __all__ = ( 83 | 'WINAPI_PARTITION_PHONE', 84 | 'WINAPI_PARTITION_PKG_APPRUNTIME', 'WINAPI_PARTITION_PKG_BOOTABLESKU', 85 | 'WINAPI_PARTITION_PKG_APPXDEPLOYMENT', 'WINAPI_PARTITION_PKG_CLUSTER', 86 | 'WINAPI_PARTITION_PKG_CMDTOOLS', 'WINAPI_PARTITION_PKG_CORESETUP', 87 | 'WINAPI_PARTITION_PKG_DISM', 'WINAPI_PARTITION_PKG_ESENT', 88 | 'WINAPI_PARTITION_PKG_EVENTLOGSERVICE', 'WINAPI_PARTITION_PKG_ISCSI', 89 | 'WINAPI_PARTITION_PKG_MPSSVC', 'WINAPI_PARTITION_PKG_PERFCOUNTER', 90 | 'WINAPI_PARTITION_PKG_REMOTEFS', 'WINAPI_PARTITION_PKG_SECURESTARTUP', 91 | 'WINAPI_PARTITION_PKG_STORAGE', 'WINAPI_PARTITION_PKG_TRAFFIC', 92 | 'WINAPI_PARTITION_PKG_VHD', 'WINAPI_PARTITION_PKG_VSS', 93 | 'WINAPI_PARTITION_PKG_WEBSERVICES', 'WINAPI_PARTITION_PKG_WER', 94 | 'WINAPI_PARTITION_PKG_WINMGMT', 'WINAPI_PARTITION_PKG_WINTRUST', 95 | 'WINAPI_PARTITION_PKG_WNV', 'WINAPI_PARTITION_ONECORE_APP' 96 | ) 97 | -------------------------------------------------------------------------------- /km/rxdata_h.py: -------------------------------------------------------------------------------- 1 | from pyWinAPI import * 2 | 3 | # /* + + Copyright (c) 1989 Microsoft Corporation Module Name: RxData.h 4 | # Abstract: This module declares the global data used by the RDBSS file 5 | # system. Author: Revision History: - - 6 | 7 | _RDBSSDATA_ = None 8 | if not defined(_RDBSSDATA_): 9 | _RDBSSDATA_ = 1 10 | 11 | from pyWinAPI.km.rxworkq_h import * # NOQA 12 | 13 | MONOLITHIC_MINIRDR = None 14 | if not defined(MONOLITHIC_MINIRDR): 15 | RxIoWorkItem = PIO_WORKITEM 16 | 17 | # END IF 18 | 19 | RxDispatcher = RX_DISPATCHER 20 | RxDispatcherWorkQueues = RX_WORK_QUEUE_DISPATCHER 21 | 22 | # this constants are the same as the versions in ntexapi.h 23 | # but drivers are not supposed to import thatnot 24 | RX_PROCESSOR_ARCHITECTURE_INTEL = 0 25 | RX_PROCESSOR_ARCHITECTURE_MIPS = 1 26 | RX_PROCESSOR_ARCHITECTURE_ALPHA = 2 27 | RX_PROCESSOR_ARCHITECTURE_PPC = 3 28 | RX_PROCESSOR_ARCHITECTURE_UNKNOWN = 0xFFFF 29 | 30 | RxSerializationMutex = KMUTEX 31 | 32 | # RX_CONTEXT serialization 33 | def RxAcquireSerializationMutex(): 34 | return KeWaitForSingleObject( 35 | ctypes.byref(RxSerializationMutex), 36 | Executive, 37 | KernelMode, 38 | FALSE, 39 | NULL 40 | ) 41 | 42 | 43 | def RxReleaseSerializationMutex(): 44 | return KeReleaseMutex(ctypes.byref(RxSerializationMutex), FALSE) 45 | 46 | # The global fsd data record, and global large integer constants 47 | # The status actually returned by the FsdDispatchStub.....usually not 48 | # implemented 49 | # The FCB for opens that refer to the device object directly or 50 | # for file objects that reference nonFcbs (like treecons) 51 | 52 | RxElapsedSecondsSinceStart = ULONG 53 | RxFileSystemDeviceObject = PRDBSS_DEVICE_OBJECT 54 | RxLargeZero = LARGE_INTEGER 55 | RxMaxLarge = LARGE_INTEGER 56 | Rx30Milliseconds = LARGE_INTEGER 57 | RxOneSecond = LARGE_INTEGER 58 | RxOneDay = LARGE_INTEGER 59 | RxJanOne1980 = LARGE_INTEGER 60 | RxDecThirtyOne1979 = LARGE_INTEGER 61 | 62 | # The status actually returned by the FsdDispatchStub.....usually not 63 | # implemented 64 | RxStubStatus = NTSTATUS 65 | 66 | # The FCB for opens that refer to the device object directly or 67 | # for file objects that reference nonFcbs (like treecons) 68 | RxDeviceFCB = FCB 69 | 70 | if 0: 71 | # Define maximum number of parallel Reads or Writes that will be 72 | # generated 73 | # per one request. 74 | RDBSS_MAX_IO_RUNS_ON_STACK = 5 75 | 76 | # Define the maximum number of delayed closes. 77 | RDBSS_MAX_DELAYED_CLOSES = 16 78 | RxMaxDelayedCloseCount = ULONG 79 | # END IF 0 80 | if DBG: 81 | # The following variables are used to keep track of the total amount 82 | # of requests processed by the file system, and the number of requests 83 | # that end up being processed by the Fsp thread. The first variable 84 | # is incremented whenever an Irp context is created (which is always 85 | # at the start of an Fsd entry point) and the second is incremented 86 | # by read request. 87 | 88 | RxFsdEntryCount = ULONG 89 | # extern ULONG RxFspEntryCount; 90 | # extern ULONG RxIoCallDriverCount; 91 | # extern ULONG RxTotalTicks[]; 92 | RxIrpCodeCount = ULONG * 0 93 | 94 | # END IF 95 | 96 | # The list of active RxContexts being processed by the RDBSS 97 | RxSrvCalldownList = LIST_ENTRY 98 | RxActiveContexts = LIST_ENTRY 99 | RxNumberOfActiveFcbs = LONG 100 | 101 | s_PipeShareName = UNICODE_STRING 102 | s_MailSlotShareName = UNICODE_STRING 103 | s_MailSlotServerPrefix = UNICODE_STRING 104 | s_IpcShareName = UNICODE_STRING 105 | s_PrimaryDomainName = UNICODE_STRING 106 | # To allow NFS to run RDBSS on W2K, we now look up the kenel routine 107 | # FsRtlTeardownPerStreamContexts dynamically at run time. 108 | # This is the global variable that contains the function pointer or NULL 109 | # if the routine could not be found (as on W2K. 110 | # END IF _RDBSSDATA_ 111 | -------------------------------------------------------------------------------- /um/lmmsg_h.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | from pyWinAPI import * 3 | from pyWinAPI.shared.wtypes_h import * 4 | from pyWinAPI.shared.winapifamily_h import * 5 | from pyWinAPI.shared.sdkddkver_h import * 6 | from pyWinAPI.shared.guiddef_h import * 7 | 8 | 9 | _LMMSG_ = None 10 | 11 | 12 | class _MSG_INFO_0(ctypes.Structure): 13 | pass 14 | 15 | 16 | MSG_INFO_0 = _MSG_INFO_0 17 | PMSG_INFO_0 = POINTER(_MSG_INFO_0) 18 | LPMSG_INFO_0 = POINTER(_MSG_INFO_0) 19 | 20 | 21 | class _MSG_INFO_1(ctypes.Structure): 22 | pass 23 | 24 | 25 | MSG_INFO_1 = _MSG_INFO_1 26 | PMSG_INFO_1 = POINTER(_MSG_INFO_1) 27 | LPMSG_INFO_1 = POINTER(_MSG_INFO_1) 28 | 29 | 30 | # /* + + BUILD Version: 0001 // Increment this if a change has global effects 31 | # Copyright (c) 1991-1999 Microsoft Corporation Module Name: lmmsg.h Abstract: 32 | # This file contains structures, function prototypes, and definitions for the 33 | # NetMessage API. [Environment:] User Mode - Win32 [Notes:] You must include 34 | # NETCONS.H before this file, since this file depends on values defined in 35 | # NETCONS.H. -- 36 | if not defined(_LMMSG_): 37 | _LMMSG_ = VOID 38 | if _MSC_VER > 1000: 39 | pass 40 | # END IF 41 | 42 | from pyWinAPI.shared.winapifamily_h import * # NOQA 43 | from pyWinAPI.shared.lmcons_h import * # NOQA 44 | 45 | netapi32 = ctypes.windll.NETAPI32 46 | 47 | if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP): 48 | if defined(__cplusplus): 49 | pass 50 | # END IF 51 | 52 | # // Function Prototypes 53 | 54 | # NET_API_STATUS NET_API_FUNCTION 55 | # NetMessageNameAdd( 56 | # _In_opt_ LPCWSTR servername, 57 | # _In_ LPCWSTR msgname 58 | # ); 59 | NetMessageNameAdd = netapi32.NetMessageNameAdd 60 | NetMessageNameAdd.restype = NET_API_STATUS 61 | 62 | # NET_API_STATUS NET_API_FUNCTION 63 | # NetMessageNameEnum( 64 | # _In_opt_ LPCWSTR servername, 65 | # _In_ DWORD level, 66 | # _In_ LPBYTE *bufptr, 67 | # _In_ DWORD prefmaxlen, 68 | # _Out_ LPDWORD entriesread, 69 | # _Out_ LPDWORD totalentries, 70 | # _Out_ LPDWORD resume_handle 71 | # ); 72 | NetMessageNameEnum = netapi32.NetMessageNameEnum 73 | NetMessageNameEnum.restype = NET_API_STATUS 74 | 75 | # NET_API_STATUS NET_API_FUNCTION 76 | # NetMessageNameGetInfo( 77 | # _In_opt_ LPCWSTR servername, 78 | # _In_ LPCWSTR msgname, 79 | # _In_ DWORD level, 80 | # _In_ LPBYTE *bufptr 81 | # ); 82 | NetMessageNameGetInfo = netapi32.NetMessageNameGetInfo 83 | NetMessageNameGetInfo.restype = NET_API_STATUS 84 | 85 | # NET_API_STATUS NET_API_FUNCTION 86 | # NetMessageNameDel( 87 | # _In_opt_ LPCWSTR servername, 88 | # _In_ LPCWSTR msgname 89 | # ); 90 | NetMessageNameDel = netapi32.NetMessageNameDel 91 | NetMessageNameDel.restype = NET_API_STATUS 92 | 93 | # NET_API_STATUS NET_API_FUNCTION 94 | # NetMessageBufferSend( 95 | # _In_opt_ LPCWSTR servername, 96 | # _In_ LPCWSTR msgname, 97 | # _In_ LPCWSTR fromname, 98 | # _In_ LPBYTE buf, 99 | # _In_ DWORD buflen 100 | # ); 101 | NetMessageBufferSend = netapi32.NetMessageBufferSend 102 | NetMessageBufferSend.restype = NET_API_STATUS 103 | 104 | 105 | # Data Structures 106 | _MSG_INFO_0._fields_ = [ 107 | ('msgi0_name', LPWSTR), 108 | ] 109 | _MSG_INFO_1._fields_ = [ 110 | ('msgi1_name', LPWSTR), 111 | ('msgi1_forward_flag', DWORD), 112 | ('msgi1_forward', LPWSTR), 113 | ] 114 | # Special Values and Constants 115 | # Values for msgi1_forward_flag. 116 | MSGNAME_NOT_FORWARDED = 0 # Name not forwarded 117 | MSGNAME_FORWARDED_TO = 0x04 # Name forward to remote station 118 | MSGNAME_FORWARDED_FROM = 0x10 # Name forwarded from remote station 119 | 120 | if defined(__cplusplus): 121 | pass 122 | # END IF 123 | 124 | # END IF WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) 125 | # END IF _LMMSG_ 126 | -------------------------------------------------------------------------------- /um/lmsname_h.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | from pyWinAPI import * 3 | from pyWinAPI.shared.wtypes_h import * 4 | from pyWinAPI.shared.winapifamily_h import * 5 | from pyWinAPI.shared.sdkddkver_h import * 6 | from pyWinAPI.shared.guiddef_h import * 7 | 8 | 9 | _LMSNAME_ = None 10 | 11 | # /* + + BUILD Version: 0002 // Increment this if a change has global effects 12 | # Copyright (c) 1991-1999 Microsoft Corporation Module Name: lmsname.h 13 | # Abstract: This file contains service name strings. It is included by 14 | # lmsvc.h. Environment: User Mode -Win32 -- 15 | if not defined(_LMSNAME_): 16 | _LMSNAME_ = VOID 17 | 18 | if _MSC_VER > 1000: 19 | pass 20 | # END IF 21 | 22 | from pyWinAPI.shared.winapifamily_h import * # NOQA 23 | 24 | if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP): 25 | # Standard LAN Manager service names. 26 | SERVICE_WORKSTATION = TEXT("LanmanWorkstation") 27 | SERVICE_LM20_WORKSTATION = TEXT("WORKSTATION") 28 | WORKSTATION_DISPLAY_NAME = TEXT("Workstation") 29 | SERVICE_SERVER = TEXT("LanmanServer") 30 | SERVICE_LM20_SERVER = TEXT("SERVER") 31 | SERVER_DISPLAY_NAME = TEXT("Server") 32 | SERVICE_BROWSER = TEXT("BROWSER") 33 | SERVICE_LM20_BROWSER = SERVICE_BROWSER 34 | SERVICE_MESSENGER = TEXT("MESSENGER") 35 | SERVICE_LM20_MESSENGER = SERVICE_MESSENGER 36 | SERVICE_NETRUN = TEXT("NETRUN") 37 | SERVICE_LM20_NETRUN = SERVICE_NETRUN 38 | SERVICE_SPOOLER = TEXT("SPOOLER") 39 | SERVICE_LM20_SPOOLER = SERVICE_SPOOLER 40 | SERVICE_ALERTER = TEXT("ALERTER") 41 | SERVICE_LM20_ALERTER = SERVICE_ALERTER 42 | SERVICE_NETLOGON = TEXT("NETLOGON") 43 | SERVICE_LM20_NETLOGON = SERVICE_NETLOGON 44 | SERVICE_NETPOPUP = TEXT("NETPOPUP") 45 | SERVICE_LM20_NETPOPUP = SERVICE_NETPOPUP 46 | SERVICE_SQLSERVER = TEXT("SQLSERVER") 47 | SERVICE_LM20_SQLSERVER = SERVICE_SQLSERVER 48 | SERVICE_REPL = TEXT("REPLICATOR") 49 | SERVICE_LM20_REPL = SERVICE_REPL 50 | SERVICE_RIPL = TEXT("REMOTEBOOT") 51 | SERVICE_LM20_RIPL = SERVICE_RIPL 52 | SERVICE_TIMESOURCE = TEXT("TIMESOURCE") 53 | SERVICE_LM20_TIMESOURCE = SERVICE_TIMESOURCE 54 | SERVICE_AFP = TEXT("AFP") 55 | SERVICE_LM20_AFP = SERVICE_AFP 56 | SERVICE_UPS = TEXT("UPS") 57 | SERVICE_LM20_UPS = SERVICE_UPS 58 | SERVICE_XACTSRV = TEXT("XACTSRV") 59 | SERVICE_LM20_XACTSRV = SERVICE_XACTSRV 60 | SERVICE_TCPIP = TEXT("TCPIP") 61 | SERVICE_LM20_TCPIP = SERVICE_TCPIP 62 | SERVICE_NBT = TEXT("NBT") 63 | SERVICE_LM20_NBT = SERVICE_NBT 64 | SERVICE_LMHOSTS = TEXT("LMHOSTS") 65 | SERVICE_LM20_LMHOSTS = SERVICE_LMHOSTS 66 | SERVICE_TELNET = TEXT("Telnet") 67 | SERVICE_LM20_TELNET = SERVICE_TELNET 68 | SERVICE_SCHEDULE = TEXT("Schedule") 69 | SERVICE_LM20_SCHEDULE = SERVICE_SCHEDULE 70 | SERVICE_NTLMSSP = TEXT("NtLmSsp") 71 | SERVICE_DHCP = TEXT("DHCP") 72 | SERVICE_LM20_DHCP = SERVICE_DHCP 73 | SERVICE_NWSAP = TEXT("NwSapAgent") 74 | SERVICE_LM20_NWSAP = SERVICE_NWSAP 75 | NWSAP_DISPLAY_NAME = TEXT("NW Sap Agent") 76 | SERVICE_NWCS = TEXT("NWCWorkstation") 77 | SERVICE_DNS_CACHE = TEXT("DnsCache") 78 | SERVICE_W32TIME = TEXT("w32time") 79 | SERVCE_LM20_W32TIME = SERVICE_W32TIME 80 | SERVICE_KDC = TEXT("kdc") 81 | SERVICE_LM20_KDC = SERVICE_KDC 82 | SERVICE_RPCLOCATOR = TEXT("RPCLOCATOR") 83 | SERVICE_LM20_RPCLOCATOR = SERVICE_RPCLOCATOR 84 | SERVICE_TRKSVR = TEXT("TrkSvr") 85 | SERVICE_LM20_TRKSVR = SERVICE_TRKSVR 86 | SERVICE_TRKWKS = TEXT("TrkWks") 87 | SERVICE_LM20_TRKWKS = SERVICE_TRKWKS 88 | SERVICE_NTFRS = TEXT("NtFrs") 89 | SERVICE_LM20_NTFRS = SERVICE_NTFRS 90 | SERVICE_ISMSERV = TEXT("IsmServ") 91 | SERVICE_LM20_ISMSERV = SERVICE_ISMSERV 92 | SERVICE_NTDS = TEXT("NTDS") 93 | SERVICE_LM20_NTDS = SERVICE_NTDS 94 | SERVICE_ADWS = TEXT("ADWS") 95 | SERVICE_DSROLE = TEXT("DsRoleSvc") 96 | SERVICE_LM20_DSROLE = SERVICE_DSROLE 97 | # END IF WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) 98 | # END IF 99 | 100 | 101 | -------------------------------------------------------------------------------- /code_converter/importer.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EventGhost. 4 | # Copyright © 2005-2016 EventGhost Project 5 | # 6 | # EventGhost is free software: you can redistribute it and/or modify it under 7 | # the terms of the GNU General Public License as published by the Free 8 | # Software Foundation, either version 2 of the License, or (at your option) 9 | # any later version. 10 | # 11 | # EventGhost is distributed in the hope that it will be useful, but WITHOUT 12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 14 | # more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with EventGhost. If not, see . 18 | from __future__ import print_function, absolute_import 19 | 20 | import os 21 | 22 | TEMPLATE = '''from {module_name} import ( 23 | {imports} 24 | ) 25 | ''' 26 | 27 | IMPORT_TEMPLATE = ''' {imprt},''' 28 | 29 | import imp 30 | import sys 31 | 32 | 33 | base_path = os.path.dirname(__file__) 34 | import_start = os.path.abspath(os.path.join(base_path, '..')) 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | class Importer(object): 43 | 44 | def __init__(self, module_name='wtypes_h', parent=None, path=None): 45 | self._allowed = [] 46 | if 'pyWinAPI' not in sys.modules: 47 | res = imp.find_module('pyWinAPI', [os.path.split(path)[0]]) 48 | mod = imp.load_module('pyWinAPI', *res) 49 | sys.modules['pyWinAPI'] = mod 50 | if path is not None: 51 | try: 52 | res = imp.find_module(module_name, [path]) 53 | mod = imp.load_module('pyWinAPI.' + module_name, *res) 54 | sys.modules['pyWinAPI.' + module_name] = mod 55 | 56 | mod_path = os.path.join(path, module_name + '.py') 57 | if os.path.exists(mod_path): 58 | mod = sys.modules['pyWinAPI.' + module_name] 59 | namespace = mod.__dict__ 60 | self._allowed = list( 61 | key for key in namespace.keys() 62 | if not key.startswith('__') 63 | ) 64 | except ImportError: 65 | mod = __import__(module_name) 66 | namespace = mod.__dict__ 67 | self._allowed = list( 68 | key for key in namespace.keys() 69 | if not key.startswith('__') 70 | ) 71 | 72 | self.module_name = module_name 73 | self.parent = parent 74 | self.path = path 75 | self._modules = {} 76 | self._imports = [] 77 | 78 | if module_name == 'wtypes_h': 79 | importer = self.add_importer('ntdef_h') 80 | self._allowed += importer.allowed[:] 81 | 82 | def process(self): 83 | if self._imports: 84 | imports = list( 85 | IMPORT_TEMPLATE.format(imprt=imprt) for imprt in self._imports 86 | ) 87 | 88 | yield TEMPLATE.format( 89 | module_name=self.module_name, imports='\n'.join(imports) 90 | ) 91 | 92 | elif self.module_name != 'wtypes_h': 93 | yield 'import ' + self.module_name + '\n' 94 | 95 | for importer in self._modules.values(): 96 | for impt in importer.process(): 97 | yield impt 98 | 99 | def add_importer(self, module_name): 100 | if module_name == self.module_name: 101 | return self 102 | 103 | if self.parent is not None: 104 | return self.parent.add_importer(module_name) 105 | 106 | for m_name, importer in self._modules.items(): 107 | if m_name == module_name: 108 | return importer 109 | 110 | importer = Importer(module_name, self, path=self.path) 111 | self._modules[module_name] = importer 112 | 113 | return importer 114 | 115 | @property 116 | def allowed(self): 117 | return self._allowed 118 | 119 | def add(self, item): 120 | 121 | if item in self._imports: 122 | return True 123 | 124 | if item in self.allowed: 125 | self._imports += [item] 126 | return True 127 | 128 | return False 129 | 130 | -------------------------------------------------------------------------------- /winrt/inspectable_h.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | from wtypes_h import ( 4 | ENUM, 5 | ULONG, 6 | POINTER, 7 | HRESULT, 8 | ) 9 | from guiddef_h import ( 10 | IID, 11 | ) 12 | import comtypes 13 | 14 | 15 | # this ALWAYS GENERATED file contains the definitions for the INTerfaces 16 | # File created by MIDL compiler version 8.01.0622 17 | # @@MIDL_FILE_HEADING( ) 18 | # verify that the version is high enough to compile this file 19 | __REQUIRED_RPCNDR_H_VERSION__ = 0x000001F4 20 | # verify that the version is high enough to compile this file 21 | __REQUIRED_RPCSAL_H_VERSION__ = 0x00000064 22 | # from rpc_h import * # NOQA 23 | # from rpcndr_h import * # NOQA 24 | # # __RPCNDR_H_VERSION__ 25 | # from windows_h import * # NOQA 26 | # from ole2_h import * # NOQA 27 | # COM_NO_WINDOWS_H 28 | # Forward Declarations 29 | IID_IInspectable = IID( 30 | '{AF86E2E0-B12D-4c6a-9C5A-D7AA65101E90}' 31 | ) 32 | 33 | 34 | class IInspectable(comtypes.IUnknown): 35 | _case_insensitive_ = True 36 | _iid_ = IID_IInspectable 37 | _idlflags_ = [] 38 | 39 | 40 | # __IInspectable_FWD_DEFINED__ 41 | # header files for imported files 42 | from unknwn_h import * # NOQA 43 | from hstring_h import * # NOQA 44 | # INTerface __MIDL_itf_inspectable_0000_0000 45 | # [local] 46 | # +------------------------------------------------------------------------- 47 | 48 | # Microsoft Windows 49 | # Copyright (c) Microsoft Corporation. All rights reserved. 50 | 51 | # -------------------------------------------------------------------------- 52 | # [unique] 53 | LPINSPECTABLE = POINTER(IInspectable) 54 | # [v1_enum] 55 | 56 | 57 | class TrustLevel(ENUM): 58 | BaseTrust = 0 59 | PartialTrust = BaseTrust + 1 60 | FullTrust = PartialTrust + 1 61 | 62 | 63 | # INTerface IInspectable 64 | # [unique][uuid][object] 65 | COMMETHOD = comtypes.COMMETHOD 66 | 67 | 68 | IInspectable._methods_ = [ 69 | COMMETHOD( 70 | [], 71 | HRESULT, 72 | 'GetIids', 73 | (['out'], POINTER(ULONG), 'iidCount'), 74 | (['out'], POINTER(POINTER(IID)), 'iids'), 75 | ), 76 | COMMETHOD( 77 | [], 78 | HRESULT, 79 | 'GetRuntimeClassName', 80 | (['out'], POINTER(HSTRING), 'className'), 81 | ), 82 | COMMETHOD( 83 | [], 84 | HRESULT, 85 | 'GetTrustLevel', 86 | (['out'], POINTER(TrustLevel), 'trustLevel'), 87 | ), 88 | ] 89 | 90 | 91 | # C style INTerface 92 | # [in] __RPC__in REFIID riid, 93 | # [annotation][iid_is][out] 94 | # [out] __RPC__out ULONG *iidCount, 95 | # [size_is][size_is][out] __RPC__deref_out_ecount_full_opt(*iidCount) IID 96 | # **iids); 97 | 98 | # HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )( 99 | # __RPC__in IInspectable * This, 100 | # [out] __RPC__deref_out_opt HSTRING *className); 101 | 102 | # HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )( 103 | # __RPC__in IInspectable * This, 104 | # [out] __RPC__out TrustLevel *trustLevel); 105 | 106 | # END_INTERFACE 107 | # } IInspectableVtbl; 108 | # INTerface IInspectable 109 | # { 110 | # CONST_VTBL struct IInspectableVtbl *lpVtbl; 111 | # }; 112 | 113 | # #ifdef COBJMACROS 114 | # #define IInspectable_QueryInterface(This,riid,ppvObject) \ 115 | # ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 116 | # #define IInspectable_AddRef(This) \ 117 | # ( (This)->lpVtbl -> AddRef(This) ) 118 | # #define IInspectable_Release(This) \ 119 | # ( (This)->lpVtbl -> Release(This) ) 120 | # #define IInspectable_GetIids(This,iidCount,iids) \ 121 | # ( (This)->lpVtbl -> GetIids(This,iidCount,iids) ) 122 | # #define IInspectable_GetRuntimeClassName(This,className) \ 123 | # ( (This)->lpVtbl -> GetRuntimeClassName(This,className) ) 124 | # #define IInspectable_GetTrustLevel(This,trustLevel) \ 125 | # ( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) ) 126 | # #endif COBJMACROS 127 | # C style INTerface 128 | # __IInspectable_INTERFACE_DEFINED__ 129 | # INTerface __MIDL_itf_inspectable_0000_0001 130 | # [local] 131 | # IInspectable equivalent of IID_PPV_ARGS 132 | # IID_INS_ARGS(ppType) 133 | # ppType is the variable of type IType that will be filled 134 | 135 | # RESULTS in: IID_IType, ppvType 136 | # will create a compiler error if wrong level of indirection is used. 137 | 138 | # make sure everyone derives from IInspectable 139 | 140 | 141 | def IID_INS_ARGS(ppType): 142 | return ppType._iid_ 143 | 144 | # Additional Prototypes for ALL INTerfaces 145 | # end of Additional Prototypes 146 | 147 | __all__ = ( 148 | 'IInspectable', '__REQUIRED_RPCSAL_H_VERSION__', 'IID_INS_ARGS', 149 | '__REQUIRED_RPCNDR_H_VERSION__', 'TrustLevel', 'LPINSPECTABLE', 150 | ) 151 | -------------------------------------------------------------------------------- /um/mfgphone_h.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | from pyWinAPI import * 3 | from pyWinAPI.shared.wtypes_h import * 4 | from pyWinAPI.shared.winapifamily_h import * 5 | from pyWinAPI.shared.sdkddkver_h import * 6 | from pyWinAPI.shared.guiddef_h import * 7 | 8 | _MFGPHONE_ = None 9 | 10 | 11 | class _MFGPHONE_SIMLINEDETAIL(ctypes.Structure): 12 | pass 13 | 14 | 15 | MFGPHONE_SIMLINEDETAIL = _MFGPHONE_SIMLINEDETAIL 16 | PMFGPHONE_SIMLINEDETAIL = POINTER(_MFGPHONE_SIMLINEDETAIL) 17 | 18 | # Copyright (c) Microsoft Corporation. All rights reserved. 19 | if defined(_MSC_VER): 20 | pass 21 | # END IF _MSC_VER 22 | 23 | if not defined(_MFGPHONE_): 24 | _MFGPHONE_ = VOID 25 | from pyWinAPI.shared.winapifamily_h import * # NOQA 26 | if defined(__cplusplus): 27 | pass 28 | # END IF 29 | 30 | if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_ONECORE_APP): 31 | if NTDDI_VERSION >= NTDDI_WIN10: 32 | # Manufacturing Phone API 33 | # Get the number of available SIM slots 34 | # Callback to receive SIM line change event notification 35 | class _MFGPHONE_SIMLINEEVENT(ENUM): 36 | MFGPHONE_SIMLINEEVENT_UNKNOWN = 0 37 | MFGPHONE_SIMLINEEVENT_SIMSTATE = 1 38 | MFGPHONE_SIMLINEEVENT_REGISTRATIONSTATE = 2 39 | MFGPHONE_SIMLINEEVENT_NETWORKNAME = 3 40 | MFGPHONE_SIMLINEEVENT_LINESYSTEMTYPE = 4 41 | MFGPHONE_SIMLINEEVENT_SIGNALSTRENGTH = 5 42 | MFGPHONE_SIMLINEEVENT_CALLSTATUS = 6 43 | 44 | MFGPHONE_SIMLINEEVENT = _MFGPHONE_SIMLINEEVENT 45 | 46 | # typedef VOID (CALLBACK *MFGPHONE_SIMLINEEVENT_NOTIFY_CALLBACK)( 47 | # _In_ UINT SimSlot, 48 | # _In_ MFGPHONE_SIMLINEEVENT SimLineEvent, 49 | # _In_ PVOID Context 50 | # ); 51 | MFGPHONE_SIMLINEEVENT_NOTIFY_CALLBACK = CALLBACK( 52 | VOID, 53 | UINT, 54 | MFGPHONE_SIMLINEEVENT, 55 | PVOID, 56 | ) 57 | 58 | # Detailed SIM slot line information 59 | MFGPHONE_SIMSLOT_NONE = -1 60 | 61 | 62 | class _MFGPHONE_SIMSTATE(ENUM): 63 | MFGPHONE_SIMSTATE_UNKNOWN = 0 64 | MFGPHONE_SIMSTATE_NONE = 1 65 | MFGPHONE_SIMSTATE_ACTIVE = 2 66 | MFGPHONE_SIMSTATE_INVALID = 3 67 | MFGPHONE_SIMSTATE_LOCKED = 4 68 | MFGPHONE_SIMSTATE_DISABLED = 5 69 | 70 | MFGPHONE_SIMSTATE = _MFGPHONE_SIMSTATE 71 | 72 | 73 | class _MFGPHONE_REGISTRATIONSTATE(ENUM): 74 | MFGPHONE_REGISTRATIONSTATE_UNKNOWN = 0 75 | MFGPHONE_REGISTRATIONSTATE_NOSIGNAL = 1 76 | MFGPHONE_REGISTRATIONSTATE_UNREGISTERED = 2 77 | MFGPHONE_REGISTRATIONSTATE_REGISTERING = 3 78 | MFGPHONE_REGISTRATIONSTATE_REGISTERED = 4 79 | MFGPHONE_REGISTRATIONSTATE_DENIED = 5 80 | 81 | MFGPHONE_REGISTRATIONSTATE = _MFGPHONE_REGISTRATIONSTATE 82 | 83 | 84 | class _MFGPHONE_CALLSTATUS(ENUM): 85 | MFGPHONE_CALLSTATUS_UNKNOWN = 0 86 | MFGPHONE_CALLSTATUS_IDLE = 1 87 | MFGPHONE_CALLSTATUS_CALLING = 2 88 | MFGPHONE_CALLSTATUS_INCOMING = 3 89 | MFGPHONE_CALLSTATUS_ACTIVE = 4 90 | 91 | MFGPHONE_CALLSTATUS = _MFGPHONE_CALLSTATUS 92 | 93 | 94 | class _MFGPHONE_LINESYSTEMTYPE(ENUM): 95 | MFGPHONE_LINESYSTEMTYPE_UNKNOWN = 0 96 | MFGPHONE_LINESYSTEMTYPE_GSM = 1 97 | MFGPHONE_LINESYSTEMTYPE_CDMA = 2 98 | MFGPHONE_LINESYSTEMTYPE_IMS = 3 99 | 100 | MFGPHONE_LINESYSTEMTYPE = _MFGPHONE_LINESYSTEMTYPE 101 | 102 | _MFGPHONE_SIMLINEDETAIL._fields_ = [ 103 | ('SimSlot', UINT), 104 | ('SimState', MFGPHONE_SIMSTATE), 105 | ('RegistrationState', MFGPHONE_REGISTRATIONSTATE), 106 | ('NetworkName', WCHAR * 64), 107 | ('LineSystemType', MFGPHONE_LINESYSTEMTYPE), 108 | ('SignalStrength', UINT), 109 | ('CallStatus', MFGPHONE_CALLSTATUS), 110 | ] 111 | 112 | # Dial, End call 113 | # Speaker control while in a call 114 | # END IF End NTDDI_WIN10 and greater 115 | # END IF WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_ONECORE_APP) 116 | 117 | if defined(__cplusplus): 118 | pass 119 | # END IF 120 | 121 | # END IF _MFGPHONE_ 122 | 123 | 124 | -------------------------------------------------------------------------------- /km/ksdebug_h.py: -------------------------------------------------------------------------------- 1 | from pyWinAPI import * 2 | 3 | # /* + + Copyright (c) Microsoft Corporation. All rights reserved. Module 4 | # Name: ksdebug.h Abstract: Debug header. - - 5 | 6 | from pyWinAPI.shared.evntrace_h import * # NOQA 7 | _KSDEBUG_ = None 8 | 9 | KSDEBUG_INIT = None 10 | DEBUG_VARIABLE = None 11 | DEBUG_LEVEL = None 12 | 13 | if not defined(_KSDEBUG_): 14 | _KSDEBUG_ = 1 15 | 16 | REMIND = None 17 | if not defined(REMIND): 18 | def QUOTE(x): 19 | return '"' + x + '"' 20 | 21 | 22 | def QQUOTE(y): 23 | return QUOTE(y) 24 | 25 | 26 | def REMIND(str): 27 | return "(" + QQUOTE(str) + ")" 28 | 29 | # END IF not defined(REMIND) 30 | if defined(__cplusplus): 31 | pass 32 | # END IF defined(__cplusplus) 33 | 34 | if defined(_NTDDK_): 35 | DEBUGLVL_BLAB = TRACE_LEVEL_VERBOSE 36 | DEBUGLVL_VERBOSE = TRACE_LEVEL_VERBOSE 37 | DEBUGLVL_TERSE = TRACE_LEVEL_INFORMATION 38 | DEBUGLVL_ERROR = TRACE_LEVEL_ERROR 39 | DEBUGLVL_WARNING = TRACE_LEVEL_WARNING 40 | DEBUGLVL_INFO = TRACE_LEVEL_INFORMATION 41 | 42 | if DBG: 43 | if not defined(DEBUG_LEVEL): 44 | if defined(DEBUG_VARIABLE): 45 | if defined(KSDEBUG_INIT): 46 | DEBUG_VARIABLE = DEBUGLVL_TERSE 47 | else: 48 | DEBUG_VARIABLE = DEBUGLVL_TERSE 49 | # END IF 50 | else: 51 | DEBUG_VARIABLE = DEBUGLVL_TERSE 52 | # END IF 53 | else: 54 | if defined( DEBUG_VARIABLE ): 55 | if defined(KSDEBUG_INIT): 56 | DEBUG_VARIABLE = DEBUG_LEVEL 57 | else: 58 | DEBUG_VARIABLE = ULONG 59 | # END IF 60 | else: 61 | DEBUG_VARIABLE = DEBUG_LEVEL 62 | # END IF 63 | # END IF 64 | 65 | def _DbgPrintF(lvl, strings): 66 | if lvl == DEBUG_VARIABLE or lvl < DEBUG_VARIABLE: 67 | DbgPrint(STR_MODULENAME) 68 | DbgPrint(strings) 69 | DbgPrint("\n") 70 | if lvl == DEBUGLVL_ERROR: 71 | DbgBreakPoint() 72 | 73 | 74 | if NTDDI_VERSION >= NTDDI_WINXP: 75 | def _DbgPrintFEx(component, lvl, strings): 76 | if lvl <= DEBUG_VARIABLE: 77 | DbgPrintEx(component, lvl, STR_MODULENAME) 78 | DbgPrintEx(component, lvl, strings) 79 | DbgPrintEx(component, lvl, "\n") 80 | if lvl == DEBUGLVL_ERROR: 81 | DbgBreakPoint() 82 | 83 | # END IF 84 | else: 85 | def _DbgPrintF(lvl, strings): 86 | pass 87 | 88 | 89 | if NTDDI_VERSION >= NTDDI_WINXP: 90 | def _DbgPrintFEx(component, lvl, strings): 91 | pass 92 | # END IF 93 | # END IF not DBG 94 | # END IF not defined(_NTDDK_) 95 | 96 | # macros 97 | if defined(__cplusplus): 98 | pass 99 | # END IF defined(__cplusplus) 100 | 101 | # constants 102 | 103 | if DBG: 104 | IRPMJFUNCDESC = None 105 | if defined(IRPMJFUNCDESC): 106 | IrpMjFuncDesc = [ 107 | "IRP_MJ_CREATE", 108 | "IRP_MJ_CREATE_NAMED_PIPE", 109 | "IRP_MJ_CLOSE", 110 | "IRP_MJ_READ", 111 | "IRP_MJ_WRITE", 112 | "IRP_MJ_QUERY_INFORMATION", 113 | "IRP_MJ_SET_INFORMATION", 114 | "IRP_MJ_QUERY_EA", 115 | "IRP_MJ_SET_EA", 116 | "IRP_MJ_FLUSH_BUFFERS", 117 | "IRP_MJ_QUERY_VOLUME_INFORMATION", 118 | "IRP_MJ_SET_VOLUME_INFORMATION", 119 | "IRP_MJ_DIRECTORY_CONTROL", 120 | "IRP_MJ_FILE_SYSTEM_CONTROL", 121 | "IRP_MJ_DEVICE_CONTROL", 122 | "IRP_MJ_INTERNAL_DEVICE_CONTROL", 123 | "IRP_MJ_SHUTDOWN", 124 | "IRP_MJ_LOCK_CONTROL", 125 | "IRP_MJ_CLEANUP", 126 | "IRP_MJ_CREATE_MAILSLOT", 127 | "IRP_MJ_QUERY_SECURITY", 128 | "IRP_MJ_SET_SECURITY", 129 | "IRP_MJ_SET_POWER", 130 | "IRP_MJ_QUERY_POWER" 131 | ] 132 | # END IF defined(IRPMJFUNCDESC) 133 | # END IF DBG 134 | # END IF not _KSDEBUG_ 135 | -------------------------------------------------------------------------------- /um/mfgrl_h.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | from pyWinAPI import * 3 | from pyWinAPI.shared.wtypes_h import * 4 | from pyWinAPI.shared.guiddef_h import * 5 | 6 | __MFGRL_H_ = None 7 | 8 | 9 | class _GRL_HEADER(ctypes.Structure): 10 | pass 11 | 12 | 13 | GRL_HEADER = _GRL_HEADER 14 | 15 | 16 | class _GRL_ENTRY(ctypes.Structure): 17 | pass 18 | 19 | 20 | GRL_ENTRY = _GRL_ENTRY 21 | 22 | 23 | class _GRL_EXTENSIBLE_ENTRY(ctypes.Structure): 24 | pass 25 | 26 | 27 | GRL_EXTENSIBLE_ENTRY = _GRL_EXTENSIBLE_ENTRY 28 | 29 | 30 | class _GRL_RENEWAL_ENTRY(ctypes.Structure): 31 | pass 32 | 33 | 34 | GRL_RENEWAL_ENTRY = _GRL_RENEWAL_ENTRY 35 | 36 | 37 | class _MF_SIGNATURE(ctypes.Structure): 38 | pass 39 | 40 | 41 | MF_SIGNATURE = _MF_SIGNATURE 42 | 43 | # @@@ + + + 44 | # @@@@****************************************************************** 45 | # Microsoft Windows Media 46 | # Copyright (C) Microsoft Corporation. All rights reserved. 47 | # @@@---@@@@****************************************************************** 48 | # mfgrl.h 49 | 50 | if not defined(__MFGRL_H_): 51 | __MFGRL_H_ = VOID 52 | 53 | # Values GRLReader will match against GRL header to verify it recognizes 54 | # the format 55 | GRL_HEADER_IDENTIFIER = "MSGRL" 56 | GRL_FORMAT_MAJOR = 1 57 | GRL_FORMAT_MINOR = 0 58 | 59 | # Very very conservative max sizes (in bytes) for each section. 60 | # This allows GRLReader to avoid over-allocating memory for corrupted / 61 | # malicious data 62 | GRL_CORE_SIZE_MAX = 1048576 63 | GRL_EXT_SIZE_MAX = 1048576 64 | GRL_RENEWAL_SIZE_MAX = 1048576 65 | GRL_CORE_SIG_SIZE_MAX = 1048576 66 | GRL_EXT_SIG_SIZE_MAX = 1048576 67 | GRL_PATH_KEY = "System\\CurrentControlSet\\Services\\PEAuth" 68 | GRL_PATH_KEY_KERNEL = ( 69 | "\\Registry\\Machine\\System\\CurrentControlSet\\Services\\PEAuth" 70 | ) 71 | GRL_PATH_VALUE = "DataPath" 72 | 73 | # ///////////////////////////////////////////////////////////////////////////// 74 | # 75 | _GRL_HEADER._fields_ = [ 76 | ('wszIdentifier', WCHAR * 6), 77 | ('wFormatMajor', WORD), 78 | ('wFormatMinor', WORD), 79 | ('CreationTime', FILETIME), 80 | ('dwSequenceNumber', DWORD), 81 | ('dwForceRebootVersion', DWORD), 82 | ('dwForceProcessRestartVersion', DWORD), 83 | ('cbRevocationSectionOffset', DWORD), 84 | ('cRevokedKernelBinaries', DWORD), 85 | ('cRevokedUserBinaries', DWORD), 86 | ('cRevokedCertificates', DWORD), 87 | ('cTrustedRoots', DWORD), 88 | ('cbExtensibleSectionOffset', DWORD), 89 | ('cExtensibleEntries', DWORD), 90 | ('cbRenewalSectionOffset', DWORD), 91 | ('cRevokedKernelBinaryRenewals', DWORD), 92 | ('cRevokedUserBinaryRenewals', DWORD), 93 | ('cRevokedCertificateRenewals', DWORD), 94 | ('cbSignatureCoreOffset', DWORD), 95 | ('cbSignatureExtOffset', DWORD), 96 | ] 97 | 98 | # ///////////////////////////////////////////////////////////////////////// 99 | # This corresponds to RTL_MAX_HASH_LEN_V1 100 | GRL_HASH_SIZE = 20 101 | GRL_EXTENSIBLE_ENTRY_SIZE = 4096 102 | 103 | # ///////////////////////////////////////////////////////////////////////// 104 | _GRL_ENTRY._fields_ = [ 105 | ('rgbGRLEntry', BYTE * GRL_HASH_SIZE), 106 | ] 107 | 108 | # ///////////////////////////////////////////////////////////////////////// 109 | _GRL_EXTENSIBLE_ENTRY._fields_ = [ 110 | ('guidExtensionID', GUID), 111 | ('rgbExtensibleEntry', BYTE * GRL_EXTENSIBLE_ENTRY_SIZE), 112 | ] 113 | 114 | # ///////////////////////////////////////////////////////////////////////// 115 | _GRL_RENEWAL_ENTRY._fields_ = [ 116 | ('grlEntry', GRL_ENTRY), 117 | ('guidRenewalID', GUID), 118 | ] 119 | 120 | # ///////////////////////////////////////////////////////////////////////// 121 | _MF_SIGNATURE._fields_ = [ 122 | ('dwSignVer', DWORD), 123 | ('cbSign', DWORD), 124 | ('rgSign', BYTE * 1), 125 | ] 126 | 127 | # ///////////////////////////////////////////////////////////////////////// 128 | # Other GRL constants 129 | # ///////////////////////////////////////////////////////////////////////// 130 | # The value of dwForceRebootVersion in the GRL header before the first 131 | # component 132 | # is added to the GRL that requires a reboot. 133 | GRL_FORCEREBOOTVERSION_INITIAL = 0 134 | 135 | # The value of dwForceProcessRestartVersion in the GRL header before the 136 | # first component 137 | # is added to the GRL that requires processes to be restarted. 138 | GRL_FORCEPROCESSRESTARTVERSION_INITIAL = 0 139 | # END IF __MFGRL_H_ 140 | -------------------------------------------------------------------------------- /overloaded_methods.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import sys 4 | 5 | PY3 = sys.version_info[0] >= 3 6 | 7 | declared_overloads = {} 8 | 9 | 10 | def _get_func_name(arg_names, arg_defaults): 11 | 12 | if len(arg_defaults) < len(arg_names): 13 | args = arg_names[:-len(arg_defaults)] 14 | arg_names = arg_names[-len(arg_defaults):] 15 | else: 16 | args = [] 17 | 18 | for i, arg_name in enumerate(arg_names): 19 | arg_default = ( 20 | str(type(arg_defaults[i])).split("'", 1)[1].rsplit("'")[0] 21 | ) 22 | args += [arg_name + '=' + arg_default] 23 | 24 | return args 25 | 26 | 27 | class _OverloadedMetaClass(type): 28 | 29 | def __new__(mcs, name, bases, dct): 30 | 31 | if declared_overloads: 32 | dct['__overloaded_funcs'] = {} 33 | 34 | for func_name, overloaded_funcs in declared_overloads.items(): 35 | if func_name in dct: 36 | del dct[func_name] 37 | 38 | for items in overloaded_funcs: 39 | name = items[0] 40 | wrapper = items[3] 41 | dct[name] = wrapper 42 | 43 | dct['__overloaded_funcs'][func_name] = overloaded_funcs[:] 44 | 45 | declared_overloads.clear() 46 | 47 | return type.__new__(mcs, name, bases, dct) 48 | 49 | 50 | def overload(func): 51 | arg_names = func.__code__.co_varnames 52 | arg_defaults = func.__defaults__ 53 | 54 | if func.__name__ not in declared_overloads: 55 | declared_overloads[func.__name__] = [] 56 | 57 | def wrapper(*args, **kwargs): 58 | return func(*args, **kwargs) 59 | 60 | if arg_names and arg_names[0] == 'self': 61 | arg_names =arg_names[1:] 62 | 63 | args = _get_func_name(arg_names, arg_defaults) 64 | 65 | wrapper.__name__ = 'overloaded_{0}({1})'.format( 66 | func.__name__, 67 | ', '.join(args) 68 | ) 69 | 70 | declared_overloads[func.__name__] += [ 71 | [wrapper.__name__, arg_names, arg_defaults, wrapper] 72 | ] 73 | 74 | return wrapper 75 | 76 | 77 | class _OverloadedWrapper(object): 78 | 79 | def __init__(self, parent, name, funcs): 80 | self.parent = parent 81 | self.__name__ = name 82 | self.funcs = funcs 83 | 84 | def __call__(self, *args, **kwargs): 85 | 86 | for wrapper_name, arg_names, arg_defaults, wrapper in self.funcs: 87 | 88 | if len(args) + len(list(kwargs.keys())) != len(arg_names): 89 | continue 90 | 91 | if len(arg_defaults) != len(list(kwargs.keys())): 92 | continue 93 | 94 | kwarg_types = [] 95 | 96 | arg_defaults = list(type(arg) for arg in arg_defaults) 97 | 98 | if len(arg_defaults) < len(arg_names): 99 | keyword_names = arg_names[-len(arg_defaults):] 100 | else: 101 | keyword_names = arg_names 102 | 103 | for name in keyword_names: 104 | if name in kwargs: 105 | kwarg_types += [type(kwargs[name])] 106 | 107 | if kwarg_types != arg_defaults: 108 | continue 109 | 110 | return getattr(self.parent, wrapper_name)(*args, **kwargs) 111 | 112 | 113 | if PY3: 114 | class OverloadedClass(object, metaclass=_OverloadedMetaClass): 115 | 116 | def __getattr__(self, item): 117 | if item in self.__dict__: 118 | return self.__dict__[item] 119 | 120 | if '__overloaded_funcs' in self.__class__.__dict__: 121 | if item in self.__class__.__dict__['__overloaded_funcs']: 122 | return _OverloadedWrapper( 123 | self, 124 | item, 125 | self.__class__.__dict__['__overloaded_funcs'][item] 126 | ) 127 | 128 | if item in self.__class__.__dict__: 129 | return self.__class__.__dict__[item] 130 | 131 | raise AttributeError(item) 132 | 133 | else: 134 | class OverloadedClass(object): 135 | __metaclass__ = _OverloadedMetaClass 136 | 137 | def __getattr__(self, item): 138 | if item in self.__dict__: 139 | return self.__dict__[item] 140 | 141 | if '__overloaded_funcs' in self.__class__.__dict__: 142 | if item in self.__class__.__dict__['__overloaded_funcs']: 143 | return _OverloadedWrapper( 144 | self, 145 | item, 146 | self.__class__.__dict__['__overloaded_funcs'][item] 147 | ) 148 | 149 | if item in self.__class__.__dict__: 150 | return self.__class__.__dict__[item] 151 | 152 | raise AttributeError(item) 153 | --------------------------------------------------------------------------------