From a6eb669099986382efb1582ab4c938a64124e650 Mon Sep 17 00:00:00 2001 From: Clement Rouault Date: Mon, 10 Apr 2017 15:02:47 +0200 Subject: [PATCH] Imprive windows.com.IID + add some BITS Interface/structs --- ctypes_generation/com_parser.py | 2 +- .../definitions/com/IBackgroundCopyError.txt | 41 +++ .../definitions/com/IBackgroundCopyFile.txt | 30 ++ .../definitions/com/IBackgroundCopyJob.txt | 147 +++++++++ .../com/IBackgroundCopyManager.txt | 41 +++ .../com/IEnumBackgroundCopyFiles.txt | 39 +++ .../com/IEnumBackgroundCopyJobs.txt | 39 +++ .../definitions/winstruct_bits.txt | 71 +++++ ctypes_generation/generate.py | 39 ++- windows/generated_def/interfaces.py | 279 +++++++++++++++--- windows/generated_def/winstructs.py | 92 +++++- 11 files changed, 775 insertions(+), 45 deletions(-) create mode 100644 ctypes_generation/definitions/com/IBackgroundCopyError.txt create mode 100644 ctypes_generation/definitions/com/IBackgroundCopyFile.txt create mode 100644 ctypes_generation/definitions/com/IBackgroundCopyJob.txt create mode 100644 ctypes_generation/definitions/com/IBackgroundCopyManager.txt create mode 100644 ctypes_generation/definitions/com/IEnumBackgroundCopyFiles.txt create mode 100644 ctypes_generation/definitions/com/IEnumBackgroundCopyJobs.txt create mode 100644 ctypes_generation/definitions/winstruct_bits.txt diff --git a/ctypes_generation/com_parser.py b/ctypes_generation/com_parser.py index 0eb4af7..c06d3b9 100644 --- a/ctypes_generation/com_parser.py +++ b/ctypes_generation/com_parser.py @@ -58,7 +58,7 @@ def initial_processing( data): class WinComParser(Parser): PARAM_INFO = ["__RPC__deref_out", "__RPC__in", "__RPC__deref_out_opt", "__RPC__out", "__RPC__in_opt", "__RPC__deref_opt_inout_opt", "__in", "__out", "__out_opt", "__in_opt", "__inout", - "__reserved"] + "__reserved", "__RPC__in_opt_string", "__RPC__inout_opt"] PARAM_INFO_WITH_VALUE = ["__RPC__in_ecount", "__RPC__out_ecount_part", "__RPC__in_ecount_full", "__RPC__in_range", "__RPC__out_ecount_full", "__out_ecount_opt", "__out_ecount", "__in_ecount_opt", "__in_ecount", "__out_bcount_opt", "__out_bcount", "__in_bcount", "__in_bcount_opt"] diff --git a/ctypes_generation/definitions/com/IBackgroundCopyError.txt b/ctypes_generation/definitions/com/IBackgroundCopyError.txt new file mode 100644 index 0000000..d61f1fe --- /dev/null +++ b/ctypes_generation/definitions/com/IBackgroundCopyError.txt @@ -0,0 +1,41 @@ +typedef struct IBackgroundCopyErrorVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + __RPC__in IBackgroundCopyError * This, + /* [in] */ __RPC__in REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + __RPC__in IBackgroundCopyError * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + __RPC__in IBackgroundCopyError * This); + + HRESULT ( STDMETHODCALLTYPE *GetError )( + __RPC__in IBackgroundCopyError * This, + /* [ref][out] */ __RPC__out BG_ERROR_CONTEXT *pContext, + /* [ref][out] */ __RPC__out HRESULT *pCode); + + HRESULT ( STDMETHODCALLTYPE *GetFile )( + __RPC__in IBackgroundCopyError * This, + /* [out] */ __RPC__deref_out_opt IBackgroundCopyFile **pVal); + + HRESULT ( STDMETHODCALLTYPE *GetErrorDescription )( + __RPC__in IBackgroundCopyError * This, + /* [in] */ DWORD LanguageId, + /* [ref][out] */ __RPC__deref_out_opt LPWSTR *pErrorDescription); + + HRESULT ( STDMETHODCALLTYPE *GetErrorContextDescription )( + __RPC__in IBackgroundCopyError * This, + /* [in] */ DWORD LanguageId, + /* [ref][out] */ __RPC__deref_out_opt LPWSTR *pContextDescription); + + HRESULT ( STDMETHODCALLTYPE *GetProtocol )( + __RPC__in IBackgroundCopyError * This, + /* [ref][out] */ __RPC__deref_out_opt LPWSTR *pProtocol); + + END_INTERFACE + } IBackgroundCopyErrorVtbl; \ No newline at end of file diff --git a/ctypes_generation/definitions/com/IBackgroundCopyFile.txt b/ctypes_generation/definitions/com/IBackgroundCopyFile.txt new file mode 100644 index 0000000..83a99ee --- /dev/null +++ b/ctypes_generation/definitions/com/IBackgroundCopyFile.txt @@ -0,0 +1,30 @@ +typedef struct IBackgroundCopyFileVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + __RPC__in IBackgroundCopyFile * This, + /* [in] */ __RPC__in REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + __RPC__in IBackgroundCopyFile * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + __RPC__in IBackgroundCopyFile * This); + + HRESULT ( STDMETHODCALLTYPE *GetRemoteName )( + __RPC__in IBackgroundCopyFile * This, + /* [out] */ __RPC__deref_out_opt LPWSTR *pVal); + + HRESULT ( STDMETHODCALLTYPE *GetLocalName )( + __RPC__in IBackgroundCopyFile * This, + /* [out] */ __RPC__deref_out_opt LPWSTR *pVal); + + HRESULT ( STDMETHODCALLTYPE *GetProgress )( + __RPC__in IBackgroundCopyFile * This, + /* [out] */ __RPC__out BG_FILE_PROGRESS *pVal); + + END_INTERFACE + } IBackgroundCopyFileVtbl; \ No newline at end of file diff --git a/ctypes_generation/definitions/com/IBackgroundCopyJob.txt b/ctypes_generation/definitions/com/IBackgroundCopyJob.txt new file mode 100644 index 0000000..3f5aa74 --- /dev/null +++ b/ctypes_generation/definitions/com/IBackgroundCopyJob.txt @@ -0,0 +1,147 @@ +typedef struct IBackgroundCopyJobVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + __RPC__in IBackgroundCopyJob * This, + /* [in] */ __RPC__in REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + __RPC__in IBackgroundCopyJob * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + __RPC__in IBackgroundCopyJob * This); + + HRESULT ( STDMETHODCALLTYPE *AddFileSet )( + __RPC__in IBackgroundCopyJob * This, + /* [in] */ ULONG cFileCount, + /* [size_is][in] */ __RPC__in_ecount_full(cFileCount) BG_FILE_INFO *pFileSet); + + HRESULT ( STDMETHODCALLTYPE *AddFile )( + __RPC__in IBackgroundCopyJob * This, + /* [in] */ __RPC__in LPCWSTR RemoteUrl, + /* [in] */ __RPC__in LPCWSTR LocalName); + + HRESULT ( STDMETHODCALLTYPE *EnumFiles )( + __RPC__in IBackgroundCopyJob * This, + /* [out] */ __RPC__deref_out_opt IEnumBackgroundCopyFiles **pEnum); + + HRESULT ( STDMETHODCALLTYPE *Suspend )( + __RPC__in IBackgroundCopyJob * This); + + HRESULT ( STDMETHODCALLTYPE *Resume )( + __RPC__in IBackgroundCopyJob * This); + + HRESULT ( STDMETHODCALLTYPE *Cancel )( + __RPC__in IBackgroundCopyJob * This); + + HRESULT ( STDMETHODCALLTYPE *Complete )( + __RPC__in IBackgroundCopyJob * This); + + HRESULT ( STDMETHODCALLTYPE *GetId )( + __RPC__in IBackgroundCopyJob * This, + /* [out] */ __RPC__out GUID *pVal); + + HRESULT ( STDMETHODCALLTYPE *GetType )( + __RPC__in IBackgroundCopyJob * This, + /* [out] */ __RPC__out BG_JOB_TYPE *pVal); + + HRESULT ( STDMETHODCALLTYPE *GetProgress )( + __RPC__in IBackgroundCopyJob * This, + /* [out] */ __RPC__out BG_JOB_PROGRESS *pVal); + + HRESULT ( STDMETHODCALLTYPE *GetTimes )( + __RPC__in IBackgroundCopyJob * This, + /* [out] */ __RPC__out BG_JOB_TIMES *pVal); + + HRESULT ( STDMETHODCALLTYPE *GetState )( + __RPC__in IBackgroundCopyJob * This, + /* [out] */ __RPC__out BG_JOB_STATE *pVal); + + HRESULT ( STDMETHODCALLTYPE *GetError )( + __RPC__in IBackgroundCopyJob * This, + /* [out] */ __RPC__deref_out_opt IBackgroundCopyError **ppError); + + HRESULT ( STDMETHODCALLTYPE *GetOwner )( + __RPC__in IBackgroundCopyJob * This, + /* [out] */ __RPC__deref_out_opt LPWSTR *pVal); + + HRESULT ( STDMETHODCALLTYPE *SetDisplayName )( + __RPC__in IBackgroundCopyJob * This, + /* [in] */ __RPC__in LPCWSTR Val); + + HRESULT ( STDMETHODCALLTYPE *GetDisplayName )( + __RPC__in IBackgroundCopyJob * This, + /* [out] */ __RPC__deref_out_opt LPWSTR *pVal); + + HRESULT ( STDMETHODCALLTYPE *SetDescription )( + __RPC__in IBackgroundCopyJob * This, + /* [in] */ __RPC__in LPCWSTR Val); + + HRESULT ( STDMETHODCALLTYPE *GetDescription )( + __RPC__in IBackgroundCopyJob * This, + /* [out] */ __RPC__deref_out_opt LPWSTR *pVal); + + HRESULT ( STDMETHODCALLTYPE *SetPriority )( + __RPC__in IBackgroundCopyJob * This, + /* [in] */ BG_JOB_PRIORITY Val); + + HRESULT ( STDMETHODCALLTYPE *GetPriority )( + __RPC__in IBackgroundCopyJob * This, + /* [out] */ __RPC__out BG_JOB_PRIORITY *pVal); + + HRESULT ( STDMETHODCALLTYPE *SetNotifyFlags )( + __RPC__in IBackgroundCopyJob * This, + /* [in] */ ULONG Val); + + HRESULT ( STDMETHODCALLTYPE *GetNotifyFlags )( + __RPC__in IBackgroundCopyJob * This, + /* [out] */ __RPC__out ULONG *pVal); + + HRESULT ( STDMETHODCALLTYPE *SetNotifyInterface )( + __RPC__in IBackgroundCopyJob * This, + /* [in] */ __RPC__in_opt IUnknown *Val); + + HRESULT ( STDMETHODCALLTYPE *GetNotifyInterface )( + __RPC__in IBackgroundCopyJob * This, + /* [out] */ __RPC__deref_out_opt IUnknown **pVal); + + HRESULT ( STDMETHODCALLTYPE *SetMinimumRetryDelay )( + __RPC__in IBackgroundCopyJob * This, + /* [in] */ ULONG Seconds); + + HRESULT ( STDMETHODCALLTYPE *GetMinimumRetryDelay )( + __RPC__in IBackgroundCopyJob * This, + /* [out] */ __RPC__out ULONG *Seconds); + + HRESULT ( STDMETHODCALLTYPE *SetNoProgressTimeout )( + __RPC__in IBackgroundCopyJob * This, + /* [in] */ ULONG Seconds); + + HRESULT ( STDMETHODCALLTYPE *GetNoProgressTimeout )( + __RPC__in IBackgroundCopyJob * This, + /* [out] */ __RPC__out ULONG *Seconds); + + HRESULT ( STDMETHODCALLTYPE *GetErrorCount )( + __RPC__in IBackgroundCopyJob * This, + /* [out] */ __RPC__out ULONG *Errors); + + HRESULT ( STDMETHODCALLTYPE *SetProxySettings )( + __RPC__in IBackgroundCopyJob * This, + /* [in] */ BG_JOB_PROXY_USAGE ProxyUsage, + /* [unique][string][in] */ __RPC__in_opt_string const WCHAR *ProxyList, + /* [unique][string][in] */ __RPC__in_opt_string const WCHAR *ProxyBypassList); + + HRESULT ( STDMETHODCALLTYPE *GetProxySettings )( + __RPC__in IBackgroundCopyJob * This, + /* [out] */ __RPC__out BG_JOB_PROXY_USAGE *pProxyUsage, + /* [out] */ __RPC__deref_out_opt LPWSTR *pProxyList, + /* [out] */ __RPC__deref_out_opt LPWSTR *pProxyBypassList); + + HRESULT ( STDMETHODCALLTYPE *TakeOwnership )( + __RPC__in IBackgroundCopyJob * This); + + END_INTERFACE + } IBackgroundCopyJobVtbl; \ No newline at end of file diff --git a/ctypes_generation/definitions/com/IBackgroundCopyManager.txt b/ctypes_generation/definitions/com/IBackgroundCopyManager.txt new file mode 100644 index 0000000..6b69387 --- /dev/null +++ b/ctypes_generation/definitions/com/IBackgroundCopyManager.txt @@ -0,0 +1,41 @@ +typedef struct IBackgroundCopyManagerVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + __RPC__in IBackgroundCopyManager * This, + /* [in] */ __RPC__in REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + __RPC__in IBackgroundCopyManager * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + __RPC__in IBackgroundCopyManager * This); + + HRESULT ( STDMETHODCALLTYPE *CreateJob )( + __RPC__in IBackgroundCopyManager * This, + /* [in] */ __RPC__in LPCWSTR DisplayName, + /* [in] */ BG_JOB_TYPE Type, + /* [out] */ __RPC__out GUID *pJobId, + /* [out] */ __RPC__deref_out_opt IBackgroundCopyJob **ppJob); + + HRESULT ( STDMETHODCALLTYPE *GetJob )( + __RPC__in IBackgroundCopyManager * This, + /* [in] */ __RPC__in REFGUID jobID, + /* [out] */ __RPC__deref_out_opt IBackgroundCopyJob **ppJob); + + HRESULT ( STDMETHODCALLTYPE *EnumJobs )( + __RPC__in IBackgroundCopyManager * This, + /* [in] */ DWORD dwFlags, + /* [out] */ __RPC__deref_out_opt IEnumBackgroundCopyJobs **ppEnum); + + HRESULT ( STDMETHODCALLTYPE *GetErrorDescription )( + __RPC__in IBackgroundCopyManager * This, + /* [in] */ HRESULT hResult, + /* [in] */ DWORD LanguageId, + /* [out] */ __RPC__deref_out_opt LPWSTR *pErrorDescription); + + END_INTERFACE + } IBackgroundCopyManagerVtbl; \ No newline at end of file diff --git a/ctypes_generation/definitions/com/IEnumBackgroundCopyFiles.txt b/ctypes_generation/definitions/com/IEnumBackgroundCopyFiles.txt new file mode 100644 index 0000000..2a67794 --- /dev/null +++ b/ctypes_generation/definitions/com/IEnumBackgroundCopyFiles.txt @@ -0,0 +1,39 @@ +typedef struct IEnumBackgroundCopyFilesVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + __RPC__in IEnumBackgroundCopyFiles * This, + /* [in] */ __RPC__in REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + __RPC__in IEnumBackgroundCopyFiles * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + __RPC__in IEnumBackgroundCopyFiles * This); + + HRESULT ( STDMETHODCALLTYPE *Next )( + __RPC__in IEnumBackgroundCopyFiles * This, + /* [in] */ ULONG celt, + /* [length_is][size_is][out] */ __RPC__out_ecount_part(celt, pceltFetched ? *pceltFetched : celt) IBackgroundCopyFile **rgelt, + /* [unique][out][in] */ __RPC__inout_opt ULONG *pceltFetched); + + HRESULT ( STDMETHODCALLTYPE *Skip )( + __RPC__in IEnumBackgroundCopyFiles * This, + /* [in] */ ULONG celt); + + HRESULT ( STDMETHODCALLTYPE *Reset )( + __RPC__in IEnumBackgroundCopyFiles * This); + + HRESULT ( STDMETHODCALLTYPE *Clone )( + __RPC__in IEnumBackgroundCopyFiles * This, + /* [out] */ __RPC__deref_out_opt IEnumBackgroundCopyFiles **ppenum); + + HRESULT ( STDMETHODCALLTYPE *GetCount )( + __RPC__in IEnumBackgroundCopyFiles * This, + /* [out] */ __RPC__out ULONG *puCount); + + END_INTERFACE + } IEnumBackgroundCopyFilesVtbl; \ No newline at end of file diff --git a/ctypes_generation/definitions/com/IEnumBackgroundCopyJobs.txt b/ctypes_generation/definitions/com/IEnumBackgroundCopyJobs.txt new file mode 100644 index 0000000..557b90e --- /dev/null +++ b/ctypes_generation/definitions/com/IEnumBackgroundCopyJobs.txt @@ -0,0 +1,39 @@ +typedef struct IEnumBackgroundCopyJobsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + __RPC__in IEnumBackgroundCopyJobs * This, + /* [in] */ __RPC__in REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + __RPC__in IEnumBackgroundCopyJobs * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + __RPC__in IEnumBackgroundCopyJobs * This); + + HRESULT ( STDMETHODCALLTYPE *Next )( + __RPC__in IEnumBackgroundCopyJobs * This, + /* [in] */ ULONG celt, + /* [length_is][size_is][out] */ __RPC__out_ecount_part(celt, pceltFetched ? *pceltFetched : celt) IBackgroundCopyJob **rgelt, + /* [unique][out][in] */ __RPC__inout_opt ULONG *pceltFetched); + + HRESULT ( STDMETHODCALLTYPE *Skip )( + __RPC__in IEnumBackgroundCopyJobs * This, + /* [in] */ ULONG celt); + + HRESULT ( STDMETHODCALLTYPE *Reset )( + __RPC__in IEnumBackgroundCopyJobs * This); + + HRESULT ( STDMETHODCALLTYPE *Clone )( + __RPC__in IEnumBackgroundCopyJobs * This, + /* [out] */ __RPC__deref_out_opt IEnumBackgroundCopyJobs **ppenum); + + HRESULT ( STDMETHODCALLTYPE *GetCount )( + __RPC__in IEnumBackgroundCopyJobs * This, + /* [out] */ __RPC__out ULONG *puCount); + + END_INTERFACE + } IEnumBackgroundCopyJobsVtbl; \ No newline at end of file diff --git a/ctypes_generation/definitions/winstruct_bits.txt b/ctypes_generation/definitions/winstruct_bits.txt new file mode 100644 index 0000000..b7ea357 --- /dev/null +++ b/ctypes_generation/definitions/winstruct_bits.txt @@ -0,0 +1,71 @@ +typedef enum _BG_JOB_STATE{ + BG_JOB_STATE_QUEUED, + BG_JOB_STATE_CONNECTING, + BG_JOB_STATE_TRANSFERRING, + BG_JOB_STATE_SUSPENDED, + BG_JOB_STATE_ERROR, + BG_JOB_STATE_TRANSIENT_ERROR, + BG_JOB_STATE_TRANSFERRED, + BG_JOB_STATE_ACKNOWLEDGED, + BG_JOB_STATE_CANCELLED +} BG_JOB_STATE; + + +typedef enum _BG_JOB_PROXY_USAGE{ + BG_JOB_PROXY_USAGE_PRECONFIG, + BG_JOB_PROXY_USAGE_NO_PROXY, + BG_JOB_PROXY_USAGE_OVERRIDE, + BG_JOB_PROXY_USAGE_AUTODETECT +} BG_JOB_PROXY_USAGE; + + +typedef enum _BG_JOB_PRIORITY{ + BG_JOB_PRIORITY_FOREGROUND, + BG_JOB_PRIORITY_HIGH, + BG_JOB_PRIORITY_NORMAL, + BG_JOB_PRIORITY_LOW +} BG_JOB_PRIORITY; + +typedef enum _BG_ERROR_CONTEXT{ + BG_ERROR_CONTEXT_NONE = 0, + BG_ERROR_CONTEXT_UNKNOWN = 1, + BG_ERROR_CONTEXT_GENERAL_QUEUE_MANAGER = 2, + BG_ERROR_CONTEXT_QUEUE_MANAGER_NOTIFICATION = 3, + BG_ERROR_CONTEXT_LOCAL_FILE = 4, + BG_ERROR_CONTEXT_REMOTE_FILE = 5, + BG_ERROR_CONTEXT_GENERAL_TRANSPORT = 6, + BG_ERROR_CONTEXT_REMOTE_APPLICATION = 7 +} BG_ERROR_CONTEXT; + +typedef enum _BG_JOB_TYPE{ + BG_JOB_TYPE_DOWNLOAD, + BG_JOB_TYPE_UPLOAD, + BG_JOB_TYPE_UPLOAD_REPLY +} BG_JOB_TYPE; + +typedef struct _BG_FILE_PROGRESS { + UINT64 BytesTotal; + UINT64 BytesTransferred; + BOOL Completed; +} BG_FILE_PROGRESS; + + +typedef struct _BG_JOB_PROGRESS { + UINT64 BytesTotal; + UINT64 BytesTransferred; + ULONG FilesTotal; + ULONG FilesTransferred; +} BG_JOB_PROGRESS; + + +typedef struct _BG_FILE_INFO { + LPWSTR RemoteName; + LPWSTR LocalName; +} BG_FILE_INFO; + + +typedef struct _BG_JOB_TIMES { + FILETIME CreationTime; + FILETIME ModificationTime; + FILETIME TransferCompletionTime; +} BG_JOB_TIMES; \ No newline at end of file diff --git a/ctypes_generation/generate.py b/ctypes_generation/generate.py index f0d33a6..b11635b 100644 --- a/ctypes_generation/generate.py +++ b/ctypes_generation/generate.py @@ -61,6 +61,7 @@ TYPE_EQUIVALENCE = [ ('ULONGLONG', 'c_ulonglong'), ('LONGLONG', 'c_longlong'), ('ULONG64', 'c_ulonglong'), + ('UINT64', 'ULONG64'), ('LONG64', 'c_longlong'), ('LARGE_INTEGER', 'LONGLONG'), ('PLARGE_INTEGER', 'POINTER(LARGE_INTEGER)'), @@ -98,7 +99,8 @@ TYPE_EQUIVALENCE = [ ('SPC_UUID', 'BYTE * 16'), #STUFF FOR COM (will be replace at runtime # real def in com_interface_header - ('GUID', 'PVOID'), + # ('GUID', 'PVOID'), + #('REFGUID', 'PVOID'), #('LPGUID', 'PVOID'), # STUFF FOR DBGENGINE ('PWINDBG_EXTENSION_APIS32', 'PVOID'), @@ -196,6 +198,10 @@ class InitialDefGenerator(CtypesGenerator): __str__ = __repr__ + # Fix pickling with protocol 2 + def __getnewargs__(self, *args): + return self.name, long(self) + class StrFlags(str): def __new__(cls, name, value): if isinstance(value, cls): @@ -208,7 +214,11 @@ class InitialDefGenerator(CtypesGenerator): def __repr__(self): return "{0}({1})".format(self.name, str.__repr__(self)) - __str__ = __repr__ + # __str__ = __repr__ + + # Fix pickling with protocol 2 + def __getnewargs__(self, *args): + return self.name, str.__str__(self) def make_flag(name, value): if isinstance(value, (int, long)): @@ -427,9 +437,14 @@ class InitialCOMGenerator(CtypesGenerator): """) HEADER = dedent(""" class IID(IID): - def __init__(self, Data1, Data2, Data3, Data4, name=None, strid=None): + def __init__(self, Data1=None, Data2=None, Data3=None, Data4=None, name=None, strid=None): + data_tuple = (Data1, Data2, Data3, Data4) self.name = name self.strid = strid + if all(data is None for data in data_tuple): + return super(IID, self).__init__() + if any(data is None for data in data_tuple): + raise ValueError("All or none of (Data1, Data2, Data3, Data4) should be None") super(IID, self).__init__(Data1, Data2, Data3, Data4) def __repr__(self): @@ -439,6 +454,15 @@ class InitialCOMGenerator(CtypesGenerator): return ''.format(self.strid.upper()) return ''.format(self.strid.upper(), self.name) + def to_string(self): + data4_format = "{0:02X}{1:02X}-" + "".join("{{{i}:02X}}".format(i=i + 2) for i in range(6)) + data4_str = data4_format.format(*self.Data4) + return "{0:08X}-{1:04X}-{2:04X}-".format(self.Data1, self.Data2, self.Data3) + data4_str + + def update_strid(self): + new_strid = self.to_string() + self.strid = new_strid + @classmethod def from_string(cls, iid): part_iid = iid.split("-") @@ -457,6 +481,7 @@ class InitialCOMGenerator(CtypesGenerator): GUID = IID LPGUID = POINTER(GUID) + REFGUID = POINTER(GUID) class COMInterface(ctypes.c_void_p): _functions_ = { @@ -557,7 +582,8 @@ class InitialCOMGenerator(CtypesGenerator): self.real_type = {} self.add_exports("IID") self.add_exports("GUID") - self.add_exports("LPGUID") + self.add_exports("LPGUID") # setup in InitialCOMGenerator.HEADER + self.add_exports("REFGUID") # setup in InitialCOMGenerator.HEADER self.add_exports("COMInterface") self.add_exports("COMImplementation") for cominterface in data: @@ -571,6 +597,9 @@ class InitialCOMGenerator(CtypesGenerator): for pos, arg in enumerate(method.args): initial_arg = arg if arg.type in self.exports or arg.type in self.IGNORE_INTERFACE: + # GUID type ? + if arg.type in ["GUID", "REFGUID", "LPGUID", "IID"]: + continue # COM Interface ? -> PVOID ! atype = "PVOID" byreflevel = arg.byreflevel - 1 @@ -612,6 +641,7 @@ class InitialCOMGenerator(CtypesGenerator): for i in range(arg.byreflevel): type = "POINTER({0})".format(type) str_args.append(type) + methods_string.append(self.com_interface_method_template.format(method.name, ", ".join([method.ret_type] + str_args), method_nb)) #import pdb;pdb.set_trace() if cominterface.iid is not None: @@ -672,6 +702,7 @@ defs_with_ntstatus.append_input_file(from_here("definitions\\windef_error.txt")) structs = StructGenerator(from_here("definitions\\winstruct.txt"), from_here(r"..\windows\generated_def\\winstructs.py"), dependances=[defs_with_ntstatus]) structs.append_input_file(from_here("definitions\\display_struct.txt")) +structs.append_input_file(from_here("definitions\\winstruct_bits.txt")) functions = FuncGenerator(from_here("definitions\\winfunc.txt"), from_here(r"..\windows\generated_def\\winfuncs.py"), dependances=[structs]) functions.append_input_file(from_here("definitions\\wintrust_crypt_func.txt")) diff --git a/windows/generated_def/interfaces.py b/windows/generated_def/interfaces.py index 281e1ff..e2597a7 100644 --- a/windows/generated_def/interfaces.py +++ b/windows/generated_def/interfaces.py @@ -6,9 +6,14 @@ from winstructs import * class IID(IID): - def __init__(self, Data1, Data2, Data3, Data4, name=None, strid=None): + def __init__(self, Data1=None, Data2=None, Data3=None, Data4=None, name=None, strid=None): + data_tuple = (Data1, Data2, Data3, Data4) self.name = name self.strid = strid + if all(data is None for data in data_tuple): + return super(IID, self).__init__() + if any(data is None for data in data_tuple): + raise ValueError("All or none of (Data1, Data2, Data3, Data4) should be None") super(IID, self).__init__(Data1, Data2, Data3, Data4) def __repr__(self): @@ -18,6 +23,15 @@ class IID(IID): return ''.format(self.strid.upper()) return ''.format(self.strid.upper(), self.name) + def to_string(self): + data4_format = "{0:02X}{1:02X}-" + "".join("{{{i}:02X}}".format(i=i + 2) for i in range(6)) + data4_str = data4_format.format(*self.Data4) + return "{0:08X}-{1:04X}-{2:04X}-".format(self.Data1, self.Data2, self.Data3) + data4_str + + def update_strid(self): + new_strid = self.to_string() + self.strid = new_strid + @classmethod def from_string(cls, iid): part_iid = iid.split("-") @@ -36,6 +50,7 @@ generate_IID = IID.from_raw GUID = IID LPGUID = POINTER(GUID) +REFGUID = POINTER(GUID) class COMInterface(ctypes.c_void_p): _functions_ = { @@ -101,15 +116,155 @@ class COMImplementation(object): def Release(self, *args): return 0 +class IBackgroundCopyError(COMInterface): + IID = generate_IID(0x19C613A0, 0xFCB8, 0x4F28, 0x81, 0xAE, 0x89, 0x7C, 0x3D, 0x07, 0x8F, 0x81, name="IBackgroundCopyError", strid="19C613A0-FCB8-4F28-81AE-897C3D078F81") + + _functions_ = { + #QueryInterface -> riid:REFIID, ppvObject:**void + "QueryInterface": ctypes.WINFUNCTYPE(HRESULT, REFIID, POINTER(PVOID))(0, "QueryInterface"), + #AddRef -> + "AddRef": ctypes.WINFUNCTYPE(ULONG)(1, "AddRef"), + #Release -> + "Release": ctypes.WINFUNCTYPE(ULONG)(2, "Release"), + #GetError -> pContext:*BG_ERROR_CONTEXT, pCode:*HRESULT + "GetError": ctypes.WINFUNCTYPE(HRESULT, POINTER(BG_ERROR_CONTEXT), POINTER(HRESULT))(3, "GetError"), + #GetFile -> pVal:**IUnknown + "GetFile": ctypes.WINFUNCTYPE(HRESULT, POINTER(PVOID))(4, "GetFile"), + #GetErrorDescription -> LanguageId:DWORD, pErrorDescription:*LPWSTR + "GetErrorDescription": ctypes.WINFUNCTYPE(HRESULT, DWORD, POINTER(LPWSTR))(5, "GetErrorDescription"), + #GetErrorContextDescription -> LanguageId:DWORD, pContextDescription:*LPWSTR + "GetErrorContextDescription": ctypes.WINFUNCTYPE(HRESULT, DWORD, POINTER(LPWSTR))(6, "GetErrorContextDescription"), + #GetProtocol -> pProtocol:*LPWSTR + "GetProtocol": ctypes.WINFUNCTYPE(HRESULT, POINTER(LPWSTR))(7, "GetProtocol"), + } + + +class IBackgroundCopyFile(COMInterface): + IID = generate_IID(0x01B7BD23, 0xFB88, 0x4A77, 0x84, 0x90, 0x58, 0x91, 0xD3, 0xE4, 0x65, 0x3A, name="IBackgroundCopyFile", strid="01B7BD23-FB88-4A77-8490-5891D3E4653A") + + _functions_ = { + #QueryInterface -> riid:REFIID, ppvObject:**void + "QueryInterface": ctypes.WINFUNCTYPE(HRESULT, REFIID, POINTER(PVOID))(0, "QueryInterface"), + #AddRef -> + "AddRef": ctypes.WINFUNCTYPE(ULONG)(1, "AddRef"), + #Release -> + "Release": ctypes.WINFUNCTYPE(ULONG)(2, "Release"), + #GetRemoteName -> pVal:*LPWSTR + "GetRemoteName": ctypes.WINFUNCTYPE(HRESULT, POINTER(LPWSTR))(3, "GetRemoteName"), + #GetLocalName -> pVal:*LPWSTR + "GetLocalName": ctypes.WINFUNCTYPE(HRESULT, POINTER(LPWSTR))(4, "GetLocalName"), + #GetProgress -> pVal:*BG_FILE_PROGRESS + "GetProgress": ctypes.WINFUNCTYPE(HRESULT, POINTER(BG_FILE_PROGRESS))(5, "GetProgress"), + } + + +class IBackgroundCopyJob(COMInterface): + IID = generate_IID(0x37668D37, 0x507E, 0x4160, 0x93, 0x16, 0x26, 0x30, 0x6D, 0x15, 0x0B, 0x12, name="IBackgroundCopyJob", strid="37668D37-507E-4160-9316-26306D150B12") + + _functions_ = { + #QueryInterface -> riid:REFIID, ppvObject:**void + "QueryInterface": ctypes.WINFUNCTYPE(HRESULT, REFIID, POINTER(PVOID))(0, "QueryInterface"), + #AddRef -> + "AddRef": ctypes.WINFUNCTYPE(ULONG)(1, "AddRef"), + #Release -> + "Release": ctypes.WINFUNCTYPE(ULONG)(2, "Release"), + #AddFileSet -> cFileCount:ULONG, pFileSet:*BG_FILE_INFO + "AddFileSet": ctypes.WINFUNCTYPE(HRESULT, ULONG, POINTER(BG_FILE_INFO))(3, "AddFileSet"), + #AddFile -> RemoteUrl:LPCWSTR, LocalName:LPCWSTR + "AddFile": ctypes.WINFUNCTYPE(HRESULT, LPCWSTR, LPCWSTR)(4, "AddFile"), + #EnumFiles -> pEnum:**IEnumBackgroundCopyFiles + "EnumFiles": ctypes.WINFUNCTYPE(HRESULT, POINTER(PVOID))(5, "EnumFiles"), + #Suspend -> + "Suspend": ctypes.WINFUNCTYPE(HRESULT)(6, "Suspend"), + #Resume -> + "Resume": ctypes.WINFUNCTYPE(HRESULT)(7, "Resume"), + #Cancel -> + "Cancel": ctypes.WINFUNCTYPE(HRESULT)(8, "Cancel"), + #Complete -> + "Complete": ctypes.WINFUNCTYPE(HRESULT)(9, "Complete"), + #GetId -> pVal:*GUID + "GetId": ctypes.WINFUNCTYPE(HRESULT, POINTER(GUID))(10, "GetId"), + #GetType -> pVal:*BG_JOB_TYPE + "GetType": ctypes.WINFUNCTYPE(HRESULT, POINTER(BG_JOB_TYPE))(11, "GetType"), + #GetProgress -> pVal:*BG_JOB_PROGRESS + "GetProgress": ctypes.WINFUNCTYPE(HRESULT, POINTER(BG_JOB_PROGRESS))(12, "GetProgress"), + #GetTimes -> pVal:*BG_JOB_TIMES + "GetTimes": ctypes.WINFUNCTYPE(HRESULT, POINTER(BG_JOB_TIMES))(13, "GetTimes"), + #GetState -> pVal:*BG_JOB_STATE + "GetState": ctypes.WINFUNCTYPE(HRESULT, POINTER(BG_JOB_STATE))(14, "GetState"), + #GetError -> ppError:**IBackgroundCopyError + "GetError": ctypes.WINFUNCTYPE(HRESULT, POINTER(PVOID))(15, "GetError"), + #GetOwner -> pVal:*LPWSTR + "GetOwner": ctypes.WINFUNCTYPE(HRESULT, POINTER(LPWSTR))(16, "GetOwner"), + #SetDisplayName -> Val:LPCWSTR + "SetDisplayName": ctypes.WINFUNCTYPE(HRESULT, LPCWSTR)(17, "SetDisplayName"), + #GetDisplayName -> pVal:*LPWSTR + "GetDisplayName": ctypes.WINFUNCTYPE(HRESULT, POINTER(LPWSTR))(18, "GetDisplayName"), + #SetDescription -> Val:LPCWSTR + "SetDescription": ctypes.WINFUNCTYPE(HRESULT, LPCWSTR)(19, "SetDescription"), + #GetDescription -> pVal:*LPWSTR + "GetDescription": ctypes.WINFUNCTYPE(HRESULT, POINTER(LPWSTR))(20, "GetDescription"), + #SetPriority -> Val:BG_JOB_PRIORITY + "SetPriority": ctypes.WINFUNCTYPE(HRESULT, BG_JOB_PRIORITY)(21, "SetPriority"), + #GetPriority -> pVal:*BG_JOB_PRIORITY + "GetPriority": ctypes.WINFUNCTYPE(HRESULT, POINTER(BG_JOB_PRIORITY))(22, "GetPriority"), + #SetNotifyFlags -> Val:ULONG + "SetNotifyFlags": ctypes.WINFUNCTYPE(HRESULT, ULONG)(23, "SetNotifyFlags"), + #GetNotifyFlags -> pVal:*ULONG + "GetNotifyFlags": ctypes.WINFUNCTYPE(HRESULT, POINTER(ULONG))(24, "GetNotifyFlags"), + #SetNotifyInterface -> Val:*IUnknown + "SetNotifyInterface": ctypes.WINFUNCTYPE(HRESULT, PVOID)(25, "SetNotifyInterface"), + #GetNotifyInterface -> pVal:**IUnknown + "GetNotifyInterface": ctypes.WINFUNCTYPE(HRESULT, POINTER(PVOID))(26, "GetNotifyInterface"), + #SetMinimumRetryDelay -> Seconds:ULONG + "SetMinimumRetryDelay": ctypes.WINFUNCTYPE(HRESULT, ULONG)(27, "SetMinimumRetryDelay"), + #GetMinimumRetryDelay -> Seconds:*ULONG + "GetMinimumRetryDelay": ctypes.WINFUNCTYPE(HRESULT, POINTER(ULONG))(28, "GetMinimumRetryDelay"), + #SetNoProgressTimeout -> Seconds:ULONG + "SetNoProgressTimeout": ctypes.WINFUNCTYPE(HRESULT, ULONG)(29, "SetNoProgressTimeout"), + #GetNoProgressTimeout -> Seconds:*ULONG + "GetNoProgressTimeout": ctypes.WINFUNCTYPE(HRESULT, POINTER(ULONG))(30, "GetNoProgressTimeout"), + #GetErrorCount -> Errors:*ULONG + "GetErrorCount": ctypes.WINFUNCTYPE(HRESULT, POINTER(ULONG))(31, "GetErrorCount"), + #SetProxySettings -> ProxyUsage:BG_JOB_PROXY_USAGE, ProxyList:*WCHAR, ProxyBypassList:*WCHAR + "SetProxySettings": ctypes.WINFUNCTYPE(HRESULT, BG_JOB_PROXY_USAGE, POINTER(WCHAR), POINTER(WCHAR))(32, "SetProxySettings"), + #GetProxySettings -> pProxyUsage:*BG_JOB_PROXY_USAGE, pProxyList:*LPWSTR, pProxyBypassList:*LPWSTR + "GetProxySettings": ctypes.WINFUNCTYPE(HRESULT, POINTER(BG_JOB_PROXY_USAGE), POINTER(LPWSTR), POINTER(LPWSTR))(33, "GetProxySettings"), + #TakeOwnership -> + "TakeOwnership": ctypes.WINFUNCTYPE(HRESULT)(34, "TakeOwnership"), + } + + +class IBackgroundCopyManager(COMInterface): + IID = generate_IID(0x5CE34C0D, 0x0DC9, 0x4C1F, 0x89, 0x7C, 0xDA, 0xA1, 0xB7, 0x8C, 0xEE, 0x7C, name="IBackgroundCopyManager", strid="5CE34C0D-0DC9-4C1F-897C-DAA1B78CEE7C") + + _functions_ = { + #QueryInterface -> riid:REFIID, ppvObject:**void + "QueryInterface": ctypes.WINFUNCTYPE(HRESULT, REFIID, POINTER(PVOID))(0, "QueryInterface"), + #AddRef -> + "AddRef": ctypes.WINFUNCTYPE(ULONG)(1, "AddRef"), + #Release -> + "Release": ctypes.WINFUNCTYPE(ULONG)(2, "Release"), + #CreateJob -> DisplayName:LPCWSTR, Type:BG_JOB_TYPE, pJobId:*GUID, ppJob:**IBackgroundCopyJob + "CreateJob": ctypes.WINFUNCTYPE(HRESULT, LPCWSTR, BG_JOB_TYPE, POINTER(GUID), POINTER(PVOID))(3, "CreateJob"), + #GetJob -> jobID:REFGUID, ppJob:**IBackgroundCopyJob + "GetJob": ctypes.WINFUNCTYPE(HRESULT, REFGUID, POINTER(PVOID))(4, "GetJob"), + #EnumJobs -> dwFlags:DWORD, ppEnum:**IEnumWbemClassObject + "EnumJobs": ctypes.WINFUNCTYPE(HRESULT, DWORD, POINTER(PVOID))(5, "EnumJobs"), + #GetErrorDescription -> hResult:HRESULT, LanguageId:DWORD, pErrorDescription:*LPWSTR + "GetErrorDescription": ctypes.WINFUNCTYPE(HRESULT, HRESULT, DWORD, POINTER(LPWSTR))(6, "GetErrorDescription"), + } + + class IDispatch(COMInterface): IID = generate_IID(0x00020400, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, name="IDispatch", strid="00020400-0000-0000-C000-000000000046") _functions_ = { #QueryInterface -> riid:REFIID, ppvObject:**void "QueryInterface": ctypes.WINFUNCTYPE(HRESULT, REFIID, POINTER(PVOID))(0, "QueryInterface"), - #AddRef -> + #AddRef -> "AddRef": ctypes.WINFUNCTYPE(ULONG)(1, "AddRef"), - #Release -> + #Release -> "Release": ctypes.WINFUNCTYPE(ULONG)(2, "Release"), #GetTypeInfoCount -> pctinfo:*UINT "GetTypeInfoCount": ctypes.WINFUNCTYPE(HRESULT, POINTER(UINT))(3, "GetTypeInfoCount"), @@ -122,21 +277,67 @@ class IDispatch(COMInterface): } +class IEnumBackgroundCopyFiles(COMInterface): + IID = generate_IID(0xCA51E165, 0xC365, 0x424C, 0x8D, 0x41, 0x24, 0xAA, 0xA4, 0xFF, 0x3C, 0x40, name="IEnumBackgroundCopyFiles", strid="CA51E165-C365-424C-8D41-24AAA4FF3C40") + + _functions_ = { + #QueryInterface -> riid:REFIID, ppvObject:**void + "QueryInterface": ctypes.WINFUNCTYPE(HRESULT, REFIID, POINTER(PVOID))(0, "QueryInterface"), + #AddRef -> + "AddRef": ctypes.WINFUNCTYPE(ULONG)(1, "AddRef"), + #Release -> + "Release": ctypes.WINFUNCTYPE(ULONG)(2, "Release"), + #Next -> celt:ULONG, rgelt:**IBackgroundCopyJob, pceltFetched:*ULONG + "Next": ctypes.WINFUNCTYPE(HRESULT, ULONG, POINTER(PVOID), POINTER(ULONG))(3, "Next"), + #Skip -> celt:ULONG + "Skip": ctypes.WINFUNCTYPE(HRESULT, ULONG)(4, "Skip"), + #Reset -> + "Reset": ctypes.WINFUNCTYPE(HRESULT)(5, "Reset"), + #Clone -> ppenum:**IEnumBackgroundCopyJobs + "Clone": ctypes.WINFUNCTYPE(HRESULT, POINTER(PVOID))(6, "Clone"), + #GetCount -> puCount:*ULONG + "GetCount": ctypes.WINFUNCTYPE(HRESULT, POINTER(ULONG))(7, "GetCount"), + } + + +class IEnumBackgroundCopyJobs(COMInterface): + IID = generate_IID(0x1AF4F612, 0x3B71, 0x466F, 0x8F, 0x58, 0x7B, 0x6F, 0x73, 0xAC, 0x57, 0xAD, name="IEnumBackgroundCopyJobs", strid="1AF4F612-3B71-466F-8F58-7B6F73AC57AD") + + _functions_ = { + #QueryInterface -> riid:REFIID, ppvObject:**void + "QueryInterface": ctypes.WINFUNCTYPE(HRESULT, REFIID, POINTER(PVOID))(0, "QueryInterface"), + #AddRef -> + "AddRef": ctypes.WINFUNCTYPE(ULONG)(1, "AddRef"), + #Release -> + "Release": ctypes.WINFUNCTYPE(ULONG)(2, "Release"), + #Next -> celt:ULONG, rgelt:**IBackgroundCopyJob, pceltFetched:*ULONG + "Next": ctypes.WINFUNCTYPE(HRESULT, ULONG, POINTER(PVOID), POINTER(ULONG))(3, "Next"), + #Skip -> celt:ULONG + "Skip": ctypes.WINFUNCTYPE(HRESULT, ULONG)(4, "Skip"), + #Reset -> + "Reset": ctypes.WINFUNCTYPE(HRESULT)(5, "Reset"), + #Clone -> ppenum:**IEnumBackgroundCopyJobs + "Clone": ctypes.WINFUNCTYPE(HRESULT, POINTER(PVOID))(6, "Clone"), + #GetCount -> puCount:*ULONG + "GetCount": ctypes.WINFUNCTYPE(HRESULT, POINTER(ULONG))(7, "GetCount"), + } + + class IEnumVARIANT(COMInterface): IID = generate_IID(0x00020404, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, name="IEnumVARIANT", strid="00020404-0000-0000-C000-000000000046") _functions_ = { #QueryInterface -> riid:REFIID, ppvObject:**void "QueryInterface": ctypes.WINFUNCTYPE(HRESULT, REFIID, POINTER(PVOID))(0, "QueryInterface"), - #AddRef -> + #AddRef -> "AddRef": ctypes.WINFUNCTYPE(ULONG)(1, "AddRef"), - #Release -> + #Release -> "Release": ctypes.WINFUNCTYPE(ULONG)(2, "Release"), #Next -> celt:ULONG, rgVar:*VARIANT, pCeltFetched:*ULONG "Next": ctypes.WINFUNCTYPE(HRESULT, ULONG, POINTER(VARIANT), POINTER(ULONG))(3, "Next"), #Skip -> celt:ULONG "Skip": ctypes.WINFUNCTYPE(HRESULT, ULONG)(4, "Skip"), - #Reset -> + #Reset -> "Reset": ctypes.WINFUNCTYPE(HRESULT)(5, "Reset"), #Clone -> ppEnum:**IEnumWbemClassObject "Clone": ctypes.WINFUNCTYPE(HRESULT, POINTER(PVOID))(6, "Clone"), @@ -149,11 +350,11 @@ class IEnumWbemClassObject(COMInterface): _functions_ = { #QueryInterface -> riid:REFIID, ppvObject:**void "QueryInterface": ctypes.WINFUNCTYPE(HRESULT, REFIID, POINTER(PVOID))(0, "QueryInterface"), - #AddRef -> + #AddRef -> "AddRef": ctypes.WINFUNCTYPE(ULONG)(1, "AddRef"), - #Release -> + #Release -> "Release": ctypes.WINFUNCTYPE(ULONG)(2, "Release"), - #Reset -> + #Reset -> "Reset": ctypes.WINFUNCTYPE(HRESULT)(3, "Reset"), #Next -> lTimeout:LONG, uCount:ULONG, apObjects:**IWbemClassObject, puReturned:*ULONG "Next": ctypes.WINFUNCTYPE(HRESULT, LONG, ULONG, POINTER(PVOID), POINTER(ULONG))(4, "Next"), @@ -172,9 +373,9 @@ class INetFwPolicy2(COMInterface): _functions_ = { #QueryInterface -> riid:REFIID, ppvObject:**void "QueryInterface": ctypes.WINFUNCTYPE(HRESULT, REFIID, POINTER(PVOID))(0, "QueryInterface"), - #AddRef -> + #AddRef -> "AddRef": ctypes.WINFUNCTYPE(ULONG)(1, "AddRef"), - #Release -> + #Release -> "Release": ctypes.WINFUNCTYPE(ULONG)(2, "Release"), #GetTypeInfoCount -> pctinfo:*UINT "GetTypeInfoCount": ctypes.WINFUNCTYPE(HRESULT, POINTER(UINT))(3, "GetTypeInfoCount"), @@ -214,7 +415,7 @@ class INetFwPolicy2(COMInterface): "EnableRuleGroup": ctypes.WINFUNCTYPE(HRESULT, LONG, BSTR, VARIANT_BOOL)(20, "EnableRuleGroup"), #IsRuleGroupEnabled -> profileTypesBitmask:LONG, group:BSTR, enabled:*VARIANT_BOOL "IsRuleGroupEnabled": ctypes.WINFUNCTYPE(HRESULT, LONG, BSTR, POINTER(VARIANT_BOOL))(21, "IsRuleGroupEnabled"), - #RestoreLocalFirewallDefaults -> + #RestoreLocalFirewallDefaults -> "RestoreLocalFirewallDefaults": ctypes.WINFUNCTYPE(HRESULT)(22, "RestoreLocalFirewallDefaults"), #get_DefaultInboundAction -> profileType:NET_FW_PROFILE_TYPE2, action:*NET_FW_ACTION "get_DefaultInboundAction": ctypes.WINFUNCTYPE(HRESULT, NET_FW_PROFILE_TYPE2, POINTER(NET_FW_ACTION))(23, "get_DefaultInboundAction"), @@ -237,9 +438,9 @@ class INetFwRules(COMInterface): _functions_ = { #QueryInterface -> riid:REFIID, ppvObject:**void "QueryInterface": ctypes.WINFUNCTYPE(HRESULT, REFIID, POINTER(PVOID))(0, "QueryInterface"), - #AddRef -> + #AddRef -> "AddRef": ctypes.WINFUNCTYPE(ULONG)(1, "AddRef"), - #Release -> + #Release -> "Release": ctypes.WINFUNCTYPE(ULONG)(2, "Release"), #GetTypeInfoCount -> pctinfo:*UINT "GetTypeInfoCount": ctypes.WINFUNCTYPE(HRESULT, POINTER(UINT))(3, "GetTypeInfoCount"), @@ -268,9 +469,9 @@ class INetFwRule(COMInterface): _functions_ = { #QueryInterface -> riid:REFIID, ppvObject:**void "QueryInterface": ctypes.WINFUNCTYPE(HRESULT, REFIID, POINTER(PVOID))(0, "QueryInterface"), - #AddRef -> + #AddRef -> "AddRef": ctypes.WINFUNCTYPE(ULONG)(1, "AddRef"), - #Release -> + #Release -> "Release": ctypes.WINFUNCTYPE(ULONG)(2, "Release"), #GetTypeInfoCount -> pctinfo:*UINT "GetTypeInfoCount": ctypes.WINFUNCTYPE(HRESULT, POINTER(UINT))(3, "GetTypeInfoCount"), @@ -361,9 +562,9 @@ class INetFwServiceRestriction(COMInterface): _functions_ = { #QueryInterface -> riid:REFIID, ppvObject:**void "QueryInterface": ctypes.WINFUNCTYPE(HRESULT, REFIID, POINTER(PVOID))(0, "QueryInterface"), - #AddRef -> + #AddRef -> "AddRef": ctypes.WINFUNCTYPE(ULONG)(1, "AddRef"), - #Release -> + #Release -> "Release": ctypes.WINFUNCTYPE(ULONG)(2, "Release"), #GetTypeInfoCount -> pctinfo:*UINT "GetTypeInfoCount": ctypes.WINFUNCTYPE(HRESULT, POINTER(UINT))(3, "GetTypeInfoCount"), @@ -388,9 +589,9 @@ class IUnknown(COMInterface): _functions_ = { #QueryInterface -> riid:REFIID, ppvObject:**void "QueryInterface": ctypes.WINFUNCTYPE(HRESULT, REFIID, POINTER(PVOID))(0, "QueryInterface"), - #AddRef -> + #AddRef -> "AddRef": ctypes.WINFUNCTYPE(ULONG)(1, "AddRef"), - #Release -> + #Release -> "Release": ctypes.WINFUNCTYPE(ULONG)(2, "Release"), } @@ -401,9 +602,9 @@ class IWbemCallResult(COMInterface): _functions_ = { #QueryInterface -> riid:REFIID, ppvObject:**void "QueryInterface": ctypes.WINFUNCTYPE(HRESULT, REFIID, POINTER(PVOID))(0, "QueryInterface"), - #AddRef -> + #AddRef -> "AddRef": ctypes.WINFUNCTYPE(ULONG)(1, "AddRef"), - #Release -> + #Release -> "Release": ctypes.WINFUNCTYPE(ULONG)(2, "Release"), #GetResultObject -> lTimeout:LONG, ppResultObject:**IWbemClassObject "GetResultObject": ctypes.WINFUNCTYPE(HRESULT, LONG, POINTER(PVOID))(3, "GetResultObject"), @@ -422,9 +623,9 @@ class IWbemClassObject(COMInterface): _functions_ = { #QueryInterface -> riid:REFIID, ppvObject:**void "QueryInterface": ctypes.WINFUNCTYPE(HRESULT, REFIID, POINTER(PVOID))(0, "QueryInterface"), - #AddRef -> + #AddRef -> "AddRef": ctypes.WINFUNCTYPE(ULONG)(1, "AddRef"), - #Release -> + #Release -> "Release": ctypes.WINFUNCTYPE(ULONG)(2, "Release"), #GetQualifierSet -> ppQualSet:**IWbemQualifierSet "GetQualifierSet": ctypes.WINFUNCTYPE(HRESULT, POINTER(PVOID))(3, "GetQualifierSet"), @@ -440,7 +641,7 @@ class IWbemClassObject(COMInterface): "BeginEnumeration": ctypes.WINFUNCTYPE(HRESULT, LONG)(8, "BeginEnumeration"), #Next -> lFlags:LONG, strName:*BSTR, pVal:*VARIANT, pType:*CIMTYPE, plFlavor:*LONG "Next": ctypes.WINFUNCTYPE(HRESULT, LONG, POINTER(BSTR), POINTER(VARIANT), POINTER(CIMTYPE), POINTER(LONG))(9, "Next"), - #EndEnumeration -> + #EndEnumeration -> "EndEnumeration": ctypes.WINFUNCTYPE(HRESULT)(10, "EndEnumeration"), #GetPropertyQualifierSet -> wszProperty:LPCWSTR, ppQualSet:**IWbemQualifierSet "GetPropertyQualifierSet": ctypes.WINFUNCTYPE(HRESULT, LPCWSTR, POINTER(PVOID))(11, "GetPropertyQualifierSet"), @@ -468,7 +669,7 @@ class IWbemClassObject(COMInterface): "BeginMethodEnumeration": ctypes.WINFUNCTYPE(HRESULT, LONG)(22, "BeginMethodEnumeration"), #NextMethod -> lFlags:LONG, pstrName:*BSTR, ppInSignature:**IWbemClassObject, ppOutSignature:**IWbemClassObject "NextMethod": ctypes.WINFUNCTYPE(HRESULT, LONG, POINTER(BSTR), POINTER(PVOID), POINTER(PVOID))(23, "NextMethod"), - #EndMethodEnumeration -> + #EndMethodEnumeration -> "EndMethodEnumeration": ctypes.WINFUNCTYPE(HRESULT)(24, "EndMethodEnumeration"), #GetMethodQualifierSet -> wszMethod:LPCWSTR, ppQualSet:**IWbemQualifierSet "GetMethodQualifierSet": ctypes.WINFUNCTYPE(HRESULT, LPCWSTR, POINTER(PVOID))(25, "GetMethodQualifierSet"), @@ -483,9 +684,9 @@ class IWbemContext(COMInterface): _functions_ = { #QueryInterface -> riid:REFIID, ppvObject:**void "QueryInterface": ctypes.WINFUNCTYPE(HRESULT, REFIID, POINTER(PVOID))(0, "QueryInterface"), - #AddRef -> + #AddRef -> "AddRef": ctypes.WINFUNCTYPE(ULONG)(1, "AddRef"), - #Release -> + #Release -> "Release": ctypes.WINFUNCTYPE(ULONG)(2, "Release"), #Clone -> ppNewCopy:**IWbemContext "Clone": ctypes.WINFUNCTYPE(HRESULT, POINTER(PVOID))(3, "Clone"), @@ -495,7 +696,7 @@ class IWbemContext(COMInterface): "BeginEnumeration": ctypes.WINFUNCTYPE(HRESULT, LONG)(5, "BeginEnumeration"), #Next -> lFlags:LONG, pstrName:*BSTR, pValue:*VARIANT "Next": ctypes.WINFUNCTYPE(HRESULT, LONG, POINTER(BSTR), POINTER(VARIANT))(6, "Next"), - #EndEnumeration -> + #EndEnumeration -> "EndEnumeration": ctypes.WINFUNCTYPE(HRESULT)(7, "EndEnumeration"), #SetValue -> wszName:LPCWSTR, lFlags:LONG, pValue:*VARIANT "SetValue": ctypes.WINFUNCTYPE(HRESULT, LPCWSTR, LONG, POINTER(VARIANT))(8, "SetValue"), @@ -503,7 +704,7 @@ class IWbemContext(COMInterface): "GetValue": ctypes.WINFUNCTYPE(HRESULT, LPCWSTR, LONG, POINTER(VARIANT))(9, "GetValue"), #DeleteValue -> wszName:LPCWSTR, lFlags:LONG "DeleteValue": ctypes.WINFUNCTYPE(HRESULT, LPCWSTR, LONG)(10, "DeleteValue"), - #DeleteAll -> + #DeleteAll -> "DeleteAll": ctypes.WINFUNCTYPE(HRESULT)(11, "DeleteAll"), } @@ -514,9 +715,9 @@ class IWbemLocator(COMInterface): _functions_ = { #QueryInterface -> riid:REFIID, ppvObject:**void "QueryInterface": ctypes.WINFUNCTYPE(HRESULT, REFIID, POINTER(PVOID))(0, "QueryInterface"), - #AddRef -> + #AddRef -> "AddRef": ctypes.WINFUNCTYPE(ULONG)(1, "AddRef"), - #Release -> + #Release -> "Release": ctypes.WINFUNCTYPE(ULONG)(2, "Release"), #ConnectServer -> strNetworkResource:BSTR, strUser:BSTR, strPassword:BSTR, strLocale:BSTR, lSecurityFlags:LONG, strAuthority:BSTR, pCtx:*IWbemContext, ppNamespace:**IWbemServices "ConnectServer": ctypes.WINFUNCTYPE(HRESULT, BSTR, BSTR, BSTR, BSTR, LONG, BSTR, PVOID, POINTER(PVOID))(3, "ConnectServer"), @@ -529,9 +730,9 @@ class IWbemObjectSink(COMInterface): _functions_ = { #QueryInterface -> riid:REFIID, ppvObject:**void "QueryInterface": ctypes.WINFUNCTYPE(HRESULT, REFIID, POINTER(PVOID))(0, "QueryInterface"), - #AddRef -> + #AddRef -> "AddRef": ctypes.WINFUNCTYPE(ULONG)(1, "AddRef"), - #Release -> + #Release -> "Release": ctypes.WINFUNCTYPE(ULONG)(2, "Release"), #Indicate -> lObjectCount:LONG, apObjArray:**IWbemClassObject "Indicate": ctypes.WINFUNCTYPE(HRESULT, LONG, POINTER(PVOID))(3, "Indicate"), @@ -546,9 +747,9 @@ class IWbemQualifierSet(COMInterface): _functions_ = { #QueryInterface -> riid:REFIID, ppvObject:**void "QueryInterface": ctypes.WINFUNCTYPE(HRESULT, REFIID, POINTER(PVOID))(0, "QueryInterface"), - #AddRef -> + #AddRef -> "AddRef": ctypes.WINFUNCTYPE(ULONG)(1, "AddRef"), - #Release -> + #Release -> "Release": ctypes.WINFUNCTYPE(ULONG)(2, "Release"), #Get -> wszName:LPCWSTR, lFlags:LONG, pVal:*VARIANT, plFlavor:*LONG "Get": ctypes.WINFUNCTYPE(HRESULT, LPCWSTR, LONG, POINTER(VARIANT), POINTER(LONG))(3, "Get"), @@ -562,7 +763,7 @@ class IWbemQualifierSet(COMInterface): "BeginEnumeration": ctypes.WINFUNCTYPE(HRESULT, LONG)(7, "BeginEnumeration"), #Next -> lFlags:LONG, pstrName:*BSTR, pVal:*VARIANT, plFlavor:*LONG "Next": ctypes.WINFUNCTYPE(HRESULT, LONG, POINTER(BSTR), POINTER(VARIANT), POINTER(LONG))(8, "Next"), - #EndEnumeration -> + #EndEnumeration -> "EndEnumeration": ctypes.WINFUNCTYPE(HRESULT)(9, "EndEnumeration"), } @@ -573,9 +774,9 @@ class IWbemServices(COMInterface): _functions_ = { #QueryInterface -> riid:REFIID, ppvObject:**void "QueryInterface": ctypes.WINFUNCTYPE(HRESULT, REFIID, POINTER(PVOID))(0, "QueryInterface"), - #AddRef -> + #AddRef -> "AddRef": ctypes.WINFUNCTYPE(ULONG)(1, "AddRef"), - #Release -> + #Release -> "Release": ctypes.WINFUNCTYPE(ULONG)(2, "Release"), #OpenNamespace -> strNamespace:BSTR, lFlags:LONG, pCtx:*IWbemContext, ppWorkingNamespace:**IWbemServices, ppResult:**IWbemCallResult "OpenNamespace": ctypes.WINFUNCTYPE(HRESULT, BSTR, LONG, PVOID, POINTER(PVOID), POINTER(PVOID))(3, "OpenNamespace"), diff --git a/windows/generated_def/winstructs.py b/windows/generated_def/winstructs.py index ee87b29..901aba8 100644 --- a/windows/generated_def/winstructs.py +++ b/windows/generated_def/winstructs.py @@ -45,6 +45,7 @@ PVECTORED_EXCEPTION_HANDLER = PVOID ULONGLONG = c_ulonglong LONGLONG = c_longlong ULONG64 = c_ulonglong +UINT64 = ULONG64 LONG64 = c_longlong LARGE_INTEGER = LONGLONG PLARGE_INTEGER = POINTER(LARGE_INTEGER) @@ -80,7 +81,6 @@ MEMBERID = DISPID PSECURITY_DESCRIPTOR = PVOID LPUNKNOWN = POINTER(PVOID) SPC_UUID = BYTE * 16 -GUID = PVOID PWINDBG_EXTENSION_APIS32 = PVOID PWINDBG_EXTENSION_APIS64 = PVOID LPCONTEXT = PVOID @@ -840,6 +840,64 @@ class tagTYPEKIND(EnumType): TYPEKIND = tagTYPEKIND +BG_JOB_STATE_QUEUED = EnumValue("_BG_JOB_STATE", "BG_JOB_STATE_QUEUED", 0x0) +BG_JOB_STATE_CONNECTING = EnumValue("_BG_JOB_STATE", "BG_JOB_STATE_CONNECTING", 0x1) +BG_JOB_STATE_TRANSFERRING = EnumValue("_BG_JOB_STATE", "BG_JOB_STATE_TRANSFERRING", 0x2) +BG_JOB_STATE_SUSPENDED = EnumValue("_BG_JOB_STATE", "BG_JOB_STATE_SUSPENDED", 0x3) +BG_JOB_STATE_ERROR = EnumValue("_BG_JOB_STATE", "BG_JOB_STATE_ERROR", 0x4) +BG_JOB_STATE_TRANSIENT_ERROR = EnumValue("_BG_JOB_STATE", "BG_JOB_STATE_TRANSIENT_ERROR", 0x5) +BG_JOB_STATE_TRANSFERRED = EnumValue("_BG_JOB_STATE", "BG_JOB_STATE_TRANSFERRED", 0x6) +BG_JOB_STATE_ACKNOWLEDGED = EnumValue("_BG_JOB_STATE", "BG_JOB_STATE_ACKNOWLEDGED", 0x7) +BG_JOB_STATE_CANCELLED = EnumValue("_BG_JOB_STATE", "BG_JOB_STATE_CANCELLED", 0x8) +class _BG_JOB_STATE(EnumType): + values = [BG_JOB_STATE_QUEUED, BG_JOB_STATE_CONNECTING, BG_JOB_STATE_TRANSFERRING, BG_JOB_STATE_SUSPENDED, BG_JOB_STATE_ERROR, BG_JOB_STATE_TRANSIENT_ERROR, BG_JOB_STATE_TRANSFERRED, BG_JOB_STATE_ACKNOWLEDGED, BG_JOB_STATE_CANCELLED] + mapper = {x:x for x in values} +BG_JOB_STATE = _BG_JOB_STATE + + +BG_JOB_PROXY_USAGE_PRECONFIG = EnumValue("_BG_JOB_PROXY_USAGE", "BG_JOB_PROXY_USAGE_PRECONFIG", 0x0) +BG_JOB_PROXY_USAGE_NO_PROXY = EnumValue("_BG_JOB_PROXY_USAGE", "BG_JOB_PROXY_USAGE_NO_PROXY", 0x1) +BG_JOB_PROXY_USAGE_OVERRIDE = EnumValue("_BG_JOB_PROXY_USAGE", "BG_JOB_PROXY_USAGE_OVERRIDE", 0x2) +BG_JOB_PROXY_USAGE_AUTODETECT = EnumValue("_BG_JOB_PROXY_USAGE", "BG_JOB_PROXY_USAGE_AUTODETECT", 0x3) +class _BG_JOB_PROXY_USAGE(EnumType): + values = [BG_JOB_PROXY_USAGE_PRECONFIG, BG_JOB_PROXY_USAGE_NO_PROXY, BG_JOB_PROXY_USAGE_OVERRIDE, BG_JOB_PROXY_USAGE_AUTODETECT] + mapper = {x:x for x in values} +BG_JOB_PROXY_USAGE = _BG_JOB_PROXY_USAGE + + +BG_JOB_PRIORITY_FOREGROUND = EnumValue("_BG_JOB_PRIORITY", "BG_JOB_PRIORITY_FOREGROUND", 0x0) +BG_JOB_PRIORITY_HIGH = EnumValue("_BG_JOB_PRIORITY", "BG_JOB_PRIORITY_HIGH", 0x1) +BG_JOB_PRIORITY_NORMAL = EnumValue("_BG_JOB_PRIORITY", "BG_JOB_PRIORITY_NORMAL", 0x2) +BG_JOB_PRIORITY_LOW = EnumValue("_BG_JOB_PRIORITY", "BG_JOB_PRIORITY_LOW", 0x3) +class _BG_JOB_PRIORITY(EnumType): + values = [BG_JOB_PRIORITY_FOREGROUND, BG_JOB_PRIORITY_HIGH, BG_JOB_PRIORITY_NORMAL, BG_JOB_PRIORITY_LOW] + mapper = {x:x for x in values} +BG_JOB_PRIORITY = _BG_JOB_PRIORITY + + +BG_ERROR_CONTEXT_NONE = EnumValue("_BG_ERROR_CONTEXT", "BG_ERROR_CONTEXT_NONE", 0x0) +BG_ERROR_CONTEXT_UNKNOWN = EnumValue("_BG_ERROR_CONTEXT", "BG_ERROR_CONTEXT_UNKNOWN", 0x1) +BG_ERROR_CONTEXT_GENERAL_QUEUE_MANAGER = EnumValue("_BG_ERROR_CONTEXT", "BG_ERROR_CONTEXT_GENERAL_QUEUE_MANAGER", 0x2) +BG_ERROR_CONTEXT_QUEUE_MANAGER_NOTIFICATION = EnumValue("_BG_ERROR_CONTEXT", "BG_ERROR_CONTEXT_QUEUE_MANAGER_NOTIFICATION", 0x3) +BG_ERROR_CONTEXT_LOCAL_FILE = EnumValue("_BG_ERROR_CONTEXT", "BG_ERROR_CONTEXT_LOCAL_FILE", 0x4) +BG_ERROR_CONTEXT_REMOTE_FILE = EnumValue("_BG_ERROR_CONTEXT", "BG_ERROR_CONTEXT_REMOTE_FILE", 0x5) +BG_ERROR_CONTEXT_GENERAL_TRANSPORT = EnumValue("_BG_ERROR_CONTEXT", "BG_ERROR_CONTEXT_GENERAL_TRANSPORT", 0x6) +BG_ERROR_CONTEXT_REMOTE_APPLICATION = EnumValue("_BG_ERROR_CONTEXT", "BG_ERROR_CONTEXT_REMOTE_APPLICATION", 0x7) +class _BG_ERROR_CONTEXT(EnumType): + values = [BG_ERROR_CONTEXT_NONE, BG_ERROR_CONTEXT_UNKNOWN, BG_ERROR_CONTEXT_GENERAL_QUEUE_MANAGER, BG_ERROR_CONTEXT_QUEUE_MANAGER_NOTIFICATION, BG_ERROR_CONTEXT_LOCAL_FILE, BG_ERROR_CONTEXT_REMOTE_FILE, BG_ERROR_CONTEXT_GENERAL_TRANSPORT, BG_ERROR_CONTEXT_REMOTE_APPLICATION] + mapper = {x:x for x in values} +BG_ERROR_CONTEXT = _BG_ERROR_CONTEXT + + +BG_JOB_TYPE_DOWNLOAD = EnumValue("_BG_JOB_TYPE", "BG_JOB_TYPE_DOWNLOAD", 0x0) +BG_JOB_TYPE_UPLOAD = EnumValue("_BG_JOB_TYPE", "BG_JOB_TYPE_UPLOAD", 0x1) +BG_JOB_TYPE_UPLOAD_REPLY = EnumValue("_BG_JOB_TYPE", "BG_JOB_TYPE_UPLOAD_REPLY", 0x2) +class _BG_JOB_TYPE(EnumType): + values = [BG_JOB_TYPE_DOWNLOAD, BG_JOB_TYPE_UPLOAD, BG_JOB_TYPE_UPLOAD_REPLY] + mapper = {x:x for x in values} +BG_JOB_TYPE = _BG_JOB_TYPE + + # Self referencing struct tricks class _LIST_ENTRY(Structure): pass PLIST_ENTRY = POINTER(_LIST_ENTRY) @@ -3706,3 +3764,35 @@ class tagBITMAPCOREINFO(Structure): LPBITMAPCOREINFO = POINTER(tagBITMAPCOREINFO) BITMAPCOREINFO = tagBITMAPCOREINFO PBITMAPCOREINFO = POINTER(tagBITMAPCOREINFO) + +class _BG_FILE_PROGRESS(Structure): + _fields_ = [ + ("BytesTotal", UINT64), + ("BytesTransferred", UINT64), + ("Completed", BOOL), + ] +BG_FILE_PROGRESS = _BG_FILE_PROGRESS + +class _BG_JOB_PROGRESS(Structure): + _fields_ = [ + ("BytesTotal", UINT64), + ("BytesTransferred", UINT64), + ("FilesTotal", ULONG), + ("FilesTransferred", ULONG), + ] +BG_JOB_PROGRESS = _BG_JOB_PROGRESS + +class _BG_FILE_INFO(Structure): + _fields_ = [ + ("RemoteName", LPWSTR), + ("LocalName", LPWSTR), + ] +BG_FILE_INFO = _BG_FILE_INFO + +class _BG_JOB_TIMES(Structure): + _fields_ = [ + ("CreationTime", FILETIME), + ("ModificationTime", FILETIME), + ("TransferCompletionTime", FILETIME), + ] +BG_JOB_TIMES = _BG_JOB_TIMES