diff --git a/docs/build/html/_modules/ctypes.html b/docs/build/html/_modules/ctypes.html new file mode 100644 index 0000000..90808a8 --- /dev/null +++ b/docs/build/html/_modules/ctypes.html @@ -0,0 +1,647 @@ + + + + + + + ctypes — PythonForWindows 1.0.1 documentation + + + + + + + + + + + + + +
+
+
+
+ +

Source code for ctypes

+"""create and manipulate C data types in Python"""
+
+import os as _os, sys as _sys
+import types as _types
+
+__version__ = "1.1.0"
+
+from _ctypes import Union, Structure, Array
+from _ctypes import _Pointer
+from _ctypes import CFuncPtr as _CFuncPtr
+from _ctypes import __version__ as _ctypes_version
+from _ctypes import RTLD_LOCAL, RTLD_GLOBAL
+from _ctypes import ArgumentError
+
+from struct import calcsize as _calcsize
+
+if __version__ != _ctypes_version:
+    raise Exception("Version number mismatch", __version__, _ctypes_version)
+
+if _os.name == "nt":
+    from _ctypes import FormatError
+
+DEFAULT_MODE = RTLD_LOCAL
+if _os.name == "posix" and _sys.platform == "darwin":
+    # On OS X 10.3, we use RTLD_GLOBAL as default mode
+    # because RTLD_LOCAL does not work at least on some
+    # libraries.  OS X 10.3 is Darwin 7, so we check for
+    # that.
+
+    if int(_os.uname().release.split('.')[0]) < 8:
+        DEFAULT_MODE = RTLD_GLOBAL
+
+from _ctypes import FUNCFLAG_CDECL as _FUNCFLAG_CDECL, \
+     FUNCFLAG_PYTHONAPI as _FUNCFLAG_PYTHONAPI, \
+     FUNCFLAG_USE_ERRNO as _FUNCFLAG_USE_ERRNO, \
+     FUNCFLAG_USE_LASTERROR as _FUNCFLAG_USE_LASTERROR
+
+# WINOLEAPI -> HRESULT
+# WINOLEAPI_(type)
+#
+# STDMETHODCALLTYPE
+#
+# STDMETHOD(name)
+# STDMETHOD_(type, name)
+#
+# STDAPICALLTYPE
+
+def create_string_buffer(init, size=None):
+    """create_string_buffer(aBytes) -> character array
+    create_string_buffer(anInteger) -> character array
+    create_string_buffer(aBytes, anInteger) -> character array
+    """
+    if isinstance(init, bytes):
+        if size is None:
+            size = len(init)+1
+        _sys.audit("ctypes.create_string_buffer", init, size)
+        buftype = c_char * size
+        buf = buftype()
+        buf.value = init
+        return buf
+    elif isinstance(init, int):
+        _sys.audit("ctypes.create_string_buffer", None, init)
+        buftype = c_char * init
+        buf = buftype()
+        return buf
+    raise TypeError(init)
+
+# Alias to create_string_buffer() for backward compatibility
+c_buffer = create_string_buffer
+
+_c_functype_cache = {}
+def CFUNCTYPE(restype, *argtypes, **kw):
+    """CFUNCTYPE(restype, *argtypes,
+                 use_errno=False, use_last_error=False) -> function prototype.
+
+    restype: the result type
+    argtypes: a sequence specifying the argument types
+
+    The function prototype can be called in different ways to create a
+    callable object:
+
+    prototype(integer address) -> foreign function
+    prototype(callable) -> create and return a C callable function from callable
+    prototype(integer index, method name[, paramflags]) -> foreign function calling a COM method
+    prototype((ordinal number, dll object)[, paramflags]) -> foreign function exported by ordinal
+    prototype((function name, dll object)[, paramflags]) -> foreign function exported by name
+    """
+    flags = _FUNCFLAG_CDECL
+    if kw.pop("use_errno", False):
+        flags |= _FUNCFLAG_USE_ERRNO
+    if kw.pop("use_last_error", False):
+        flags |= _FUNCFLAG_USE_LASTERROR
+    if kw:
+        raise ValueError("unexpected keyword argument(s) %s" % kw.keys())
+
+    try:
+        return _c_functype_cache[(restype, argtypes, flags)]
+    except KeyError:
+        pass
+
+    class CFunctionType(_CFuncPtr):
+        _argtypes_ = argtypes
+        _restype_ = restype
+        _flags_ = flags
+    _c_functype_cache[(restype, argtypes, flags)] = CFunctionType
+    return CFunctionType
+
+if _os.name == "nt":
+    from _ctypes import LoadLibrary as _dlopen
+    from _ctypes import FUNCFLAG_STDCALL as _FUNCFLAG_STDCALL
+
+    _win_functype_cache = {}
+    def WINFUNCTYPE(restype, *argtypes, **kw):
+        # docstring set later (very similar to CFUNCTYPE.__doc__)
+        flags = _FUNCFLAG_STDCALL
+        if kw.pop("use_errno", False):
+            flags |= _FUNCFLAG_USE_ERRNO
+        if kw.pop("use_last_error", False):
+            flags |= _FUNCFLAG_USE_LASTERROR
+        if kw:
+            raise ValueError("unexpected keyword argument(s) %s" % kw.keys())
+
+        try:
+            return _win_functype_cache[(restype, argtypes, flags)]
+        except KeyError:
+            pass
+
+        class WinFunctionType(_CFuncPtr):
+            _argtypes_ = argtypes
+            _restype_ = restype
+            _flags_ = flags
+        _win_functype_cache[(restype, argtypes, flags)] = WinFunctionType
+        return WinFunctionType
+    if WINFUNCTYPE.__doc__:
+        WINFUNCTYPE.__doc__ = CFUNCTYPE.__doc__.replace("CFUNCTYPE", "WINFUNCTYPE")
+
+elif _os.name == "posix":
+    from _ctypes import dlopen as _dlopen
+
+from _ctypes import sizeof, byref, addressof, alignment, resize
+from _ctypes import get_errno, set_errno
+from _ctypes import _SimpleCData
+
+def _check_size(typ, typecode=None):
+    # Check if sizeof(ctypes_type) against struct.calcsize.  This
+    # should protect somewhat against a misconfigured libffi.
+    from struct import calcsize
+    if typecode is None:
+        # Most _type_ codes are the same as used in struct
+        typecode = typ._type_
+    actual, required = sizeof(typ), calcsize(typecode)
+    if actual != required:
+        raise SystemError("sizeof(%s) wrong: %d instead of %d" % \
+                          (typ, actual, required))
+
+class py_object(_SimpleCData):
+    _type_ = "O"
+    def __repr__(self):
+        try:
+            return super().__repr__()
+        except ValueError:
+            return "%s(<NULL>)" % type(self).__name__
+_check_size(py_object, "P")
+
+class c_short(_SimpleCData):
+    _type_ = "h"
+_check_size(c_short)
+
+class c_ushort(_SimpleCData):
+    _type_ = "H"
+_check_size(c_ushort)
+
+class c_long(_SimpleCData):
+    _type_ = "l"
+_check_size(c_long)
+
+class c_ulong(_SimpleCData):
+    _type_ = "L"
+_check_size(c_ulong)
+
+if _calcsize("i") == _calcsize("l"):
+    # if int and long have the same size, make c_int an alias for c_long
+    c_int = c_long
+    c_uint = c_ulong
+else:
+    class c_int(_SimpleCData):
+        _type_ = "i"
+    _check_size(c_int)
+
+    class c_uint(_SimpleCData):
+        _type_ = "I"
+    _check_size(c_uint)
+
+class c_float(_SimpleCData):
+    _type_ = "f"
+_check_size(c_float)
+
+class c_double(_SimpleCData):
+    _type_ = "d"
+_check_size(c_double)
+
+class c_longdouble(_SimpleCData):
+    _type_ = "g"
+if sizeof(c_longdouble) == sizeof(c_double):
+    c_longdouble = c_double
+
+if _calcsize("l") == _calcsize("q"):
+    # if long and long long have the same size, make c_longlong an alias for c_long
+    c_longlong = c_long
+    c_ulonglong = c_ulong
+else:
+    class c_longlong(_SimpleCData):
+        _type_ = "q"
+    _check_size(c_longlong)
+
+    class c_ulonglong(_SimpleCData):
+        _type_ = "Q"
+    ##    def from_param(cls, val):
+    ##        return ('d', float(val), val)
+    ##    from_param = classmethod(from_param)
+    _check_size(c_ulonglong)
+
+class c_ubyte(_SimpleCData):
+    _type_ = "B"
+c_ubyte.__ctype_le__ = c_ubyte.__ctype_be__ = c_ubyte
+# backward compatibility:
+##c_uchar = c_ubyte
+_check_size(c_ubyte)
+
+class c_byte(_SimpleCData):
+    _type_ = "b"
+c_byte.__ctype_le__ = c_byte.__ctype_be__ = c_byte
+_check_size(c_byte)
+
+class c_char(_SimpleCData):
+    _type_ = "c"
+c_char.__ctype_le__ = c_char.__ctype_be__ = c_char
+_check_size(c_char)
+
+class c_char_p(_SimpleCData):
+    _type_ = "z"
+    def __repr__(self):
+        return "%s(%s)" % (self.__class__.__name__, c_void_p.from_buffer(self).value)
+_check_size(c_char_p, "P")
+
+class c_void_p(_SimpleCData):
+    _type_ = "P"
+c_voidp = c_void_p # backwards compatibility (to a bug)
+_check_size(c_void_p)
+
+class c_bool(_SimpleCData):
+    _type_ = "?"
+
+from _ctypes import POINTER, pointer, _pointer_type_cache
+
+class c_wchar_p(_SimpleCData):
+    _type_ = "Z"
+    def __repr__(self):
+        return "%s(%s)" % (self.__class__.__name__, c_void_p.from_buffer(self).value)
+
+class c_wchar(_SimpleCData):
+    _type_ = "u"
+
+def _reset_cache():
+    _pointer_type_cache.clear()
+    _c_functype_cache.clear()
+    if _os.name == "nt":
+        _win_functype_cache.clear()
+    # _SimpleCData.c_wchar_p_from_param
+    POINTER(c_wchar).from_param = c_wchar_p.from_param
+    # _SimpleCData.c_char_p_from_param
+    POINTER(c_char).from_param = c_char_p.from_param
+    _pointer_type_cache[None] = c_void_p
+
+def create_unicode_buffer(init, size=None):
+    """create_unicode_buffer(aString) -> character array
+    create_unicode_buffer(anInteger) -> character array
+    create_unicode_buffer(aString, anInteger) -> character array
+    """
+    if isinstance(init, str):
+        if size is None:
+            if sizeof(c_wchar) == 2:
+                # UTF-16 requires a surrogate pair (2 wchar_t) for non-BMP
+                # characters (outside [U+0000; U+FFFF] range). +1 for trailing
+                # NUL character.
+                size = sum(2 if ord(c) > 0xFFFF else 1 for c in init) + 1
+            else:
+                # 32-bit wchar_t (1 wchar_t per Unicode character). +1 for
+                # trailing NUL character.
+                size = len(init) + 1
+        _sys.audit("ctypes.create_unicode_buffer", init, size)
+        buftype = c_wchar * size
+        buf = buftype()
+        buf.value = init
+        return buf
+    elif isinstance(init, int):
+        _sys.audit("ctypes.create_unicode_buffer", None, init)
+        buftype = c_wchar * init
+        buf = buftype()
+        return buf
+    raise TypeError(init)
+
+
+# XXX Deprecated
+def SetPointerType(pointer, cls):
+    if _pointer_type_cache.get(cls, None) is not None:
+        raise RuntimeError("This type already exists in the cache")
+    if id(pointer) not in _pointer_type_cache:
+        raise RuntimeError("What's this???")
+    pointer.set_type(cls)
+    _pointer_type_cache[cls] = pointer
+    del _pointer_type_cache[id(pointer)]
+
+# XXX Deprecated
+def ARRAY(typ, len):
+    return typ * len
+
+################################################################
+
+
+class CDLL(object):
+    """An instance of this class represents a loaded dll/shared
+    library, exporting functions using the standard C calling
+    convention (named 'cdecl' on Windows).
+
+    The exported functions can be accessed as attributes, or by
+    indexing with the function name.  Examples:
+
+    <obj>.qsort -> callable object
+    <obj>['qsort'] -> callable object
+
+    Calling the functions releases the Python GIL during the call and
+    reacquires it afterwards.
+    """
+    _func_flags_ = _FUNCFLAG_CDECL
+    _func_restype_ = c_int
+    # default values for repr
+    _name = '<uninitialized>'
+    _handle = 0
+    _FuncPtr = None
+
+    def __init__(self, name, mode=DEFAULT_MODE, handle=None,
+                 use_errno=False,
+                 use_last_error=False,
+                 winmode=None):
+        self._name = name
+        flags = self._func_flags_
+        if use_errno:
+            flags |= _FUNCFLAG_USE_ERRNO
+        if use_last_error:
+            flags |= _FUNCFLAG_USE_LASTERROR
+        if _sys.platform.startswith("aix"):
+            """When the name contains ".a(" and ends with ")",
+               e.g., "libFOO.a(libFOO.so)" - this is taken to be an
+               archive(member) syntax for dlopen(), and the mode is adjusted.
+               Otherwise, name is presented to dlopen() as a file argument.
+            """
+            if name and name.endswith(")") and ".a(" in name:
+                mode |= ( _os.RTLD_MEMBER | _os.RTLD_NOW )
+        if _os.name == "nt":
+            if winmode is not None:
+                mode = winmode
+            else:
+                import nt
+                mode = nt._LOAD_LIBRARY_SEARCH_DEFAULT_DIRS
+                if '/' in name or '\\' in name:
+                    self._name = nt._getfullpathname(self._name)
+                    mode |= nt._LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR
+
+        class _FuncPtr(_CFuncPtr):
+            _flags_ = flags
+            _restype_ = self._func_restype_
+        self._FuncPtr = _FuncPtr
+
+        if handle is None:
+            self._handle = _dlopen(self._name, mode)
+        else:
+            self._handle = handle
+
+    def __repr__(self):
+        return "<%s '%s', handle %x at %#x>" % \
+               (self.__class__.__name__, self._name,
+                (self._handle & (_sys.maxsize*2 + 1)),
+                id(self) & (_sys.maxsize*2 + 1))
+
+    def __getattr__(self, name):
+        if name.startswith('__') and name.endswith('__'):
+            raise AttributeError(name)
+        func = self.__getitem__(name)
+        setattr(self, name, func)
+        return func
+
+    def __getitem__(self, name_or_ordinal):
+        func = self._FuncPtr((name_or_ordinal, self))
+        if not isinstance(name_or_ordinal, int):
+            func.__name__ = name_or_ordinal
+        return func
+
+class PyDLL(CDLL):
+    """This class represents the Python library itself.  It allows
+    accessing Python API functions.  The GIL is not released, and
+    Python exceptions are handled correctly.
+    """
+    _func_flags_ = _FUNCFLAG_CDECL | _FUNCFLAG_PYTHONAPI
+
+if _os.name == "nt":
+
+    class WinDLL(CDLL):
+        """This class represents a dll exporting functions using the
+        Windows stdcall calling convention.
+        """
+        _func_flags_ = _FUNCFLAG_STDCALL
+
+    # XXX Hm, what about HRESULT as normal parameter?
+    # Mustn't it derive from c_long then?
+    from _ctypes import _check_HRESULT, _SimpleCData
+    class HRESULT(_SimpleCData):
+        _type_ = "l"
+        # _check_retval_ is called with the function's result when it
+        # is used as restype.  It checks for the FAILED bit, and
+        # raises an OSError if it is set.
+        #
+        # The _check_retval_ method is implemented in C, so that the
+        # method definition itself is not included in the traceback
+        # when it raises an error - that is what we want (and Python
+        # doesn't have a way to raise an exception in the caller's
+        # frame).
+        _check_retval_ = _check_HRESULT
+
+    class OleDLL(CDLL):
+        """This class represents a dll exporting functions using the
+        Windows stdcall calling convention, and returning HRESULT.
+        HRESULT error values are automatically raised as OSError
+        exceptions.
+        """
+        _func_flags_ = _FUNCFLAG_STDCALL
+        _func_restype_ = HRESULT
+
+class LibraryLoader(object):
+    def __init__(self, dlltype):
+        self._dlltype = dlltype
+
+    def __getattr__(self, name):
+        if name[0] == '_':
+            raise AttributeError(name)
+        dll = self._dlltype(name)
+        setattr(self, name, dll)
+        return dll
+
+    def __getitem__(self, name):
+        return getattr(self, name)
+
+    def LoadLibrary(self, name):
+        return self._dlltype(name)
+
+    __class_getitem__ = classmethod(_types.GenericAlias)
+
+cdll = LibraryLoader(CDLL)
+pydll = LibraryLoader(PyDLL)
+
+if _os.name == "nt":
+    pythonapi = PyDLL("python dll", None, _sys.dllhandle)
+elif _sys.platform == "cygwin":
+    pythonapi = PyDLL("libpython%d.%d.dll" % _sys.version_info[:2])
+else:
+    pythonapi = PyDLL(None)
+
+
+if _os.name == "nt":
+    windll = LibraryLoader(WinDLL)
+    oledll = LibraryLoader(OleDLL)
+
+    GetLastError = windll.kernel32.GetLastError
+    from _ctypes import get_last_error, set_last_error
+
+    def WinError(code=None, descr=None):
+        if code is None:
+            code = GetLastError()
+        if descr is None:
+            descr = FormatError(code).strip()
+        return OSError(None, descr, None, code)
+
+if sizeof(c_uint) == sizeof(c_void_p):
+    c_size_t = c_uint
+    c_ssize_t = c_int
+elif sizeof(c_ulong) == sizeof(c_void_p):
+    c_size_t = c_ulong
+    c_ssize_t = c_long
+elif sizeof(c_ulonglong) == sizeof(c_void_p):
+    c_size_t = c_ulonglong
+    c_ssize_t = c_longlong
+
+# functions
+
+from _ctypes import _memmove_addr, _memset_addr, _string_at_addr, _cast_addr
+
+## void *memmove(void *, const void *, size_t);
+memmove = CFUNCTYPE(c_void_p, c_void_p, c_void_p, c_size_t)(_memmove_addr)
+
+## void *memset(void *, int, size_t)
+memset = CFUNCTYPE(c_void_p, c_void_p, c_int, c_size_t)(_memset_addr)
+
+def PYFUNCTYPE(restype, *argtypes):
+    class CFunctionType(_CFuncPtr):
+        _argtypes_ = argtypes
+        _restype_ = restype
+        _flags_ = _FUNCFLAG_CDECL | _FUNCFLAG_PYTHONAPI
+    return CFunctionType
+
+_cast = PYFUNCTYPE(py_object, c_void_p, py_object, py_object)(_cast_addr)
+def cast(obj, typ):
+    return _cast(obj, obj, typ)
+
+_string_at = PYFUNCTYPE(py_object, c_void_p, c_int)(_string_at_addr)
+def string_at(ptr, size=-1):
+    """string_at(addr[, size]) -> string
+
+    Return the string at addr."""
+    return _string_at(ptr, size)
+
+try:
+    from _ctypes import _wstring_at_addr
+except ImportError:
+    pass
+else:
+    _wstring_at = PYFUNCTYPE(py_object, c_void_p, c_int)(_wstring_at_addr)
+    def wstring_at(ptr, size=-1):
+        """wstring_at(addr[, size]) -> string
+
+        Return the string at addr."""
+        return _wstring_at(ptr, size)
+
+
+if _os.name == "nt": # COM stuff
+    def DllGetClassObject(rclsid, riid, ppv):
+        try:
+            ccom = __import__("comtypes.server.inprocserver", globals(), locals(), ['*'])
+        except ImportError:
+            return -2147221231 # CLASS_E_CLASSNOTAVAILABLE
+        else:
+            return ccom.DllGetClassObject(rclsid, riid, ppv)
+
+    def DllCanUnloadNow():
+        try:
+            ccom = __import__("comtypes.server.inprocserver", globals(), locals(), ['*'])
+        except ImportError:
+            return 0 # S_OK
+        return ccom.DllCanUnloadNow()
+
+from ctypes._endian import BigEndianStructure, LittleEndianStructure
+from ctypes._endian import BigEndianUnion, LittleEndianUnion
+
+# Fill in specifically-sized types
+c_int8 = c_byte
+c_uint8 = c_ubyte
+for kind in [c_short, c_int, c_long, c_longlong]:
+    if sizeof(kind) == 2: c_int16 = kind
+    elif sizeof(kind) == 4: c_int32 = kind
+    elif sizeof(kind) == 8: c_int64 = kind
+for kind in [c_ushort, c_uint, c_ulong, c_ulonglong]:
+    if sizeof(kind) == 2: c_uint16 = kind
+    elif sizeof(kind) == 4: c_uint32 = kind
+    elif sizeof(kind) == 8: c_uint64 = kind
+del(kind)
+
+_reset_cache()
+
+ +
+
+
+
+ +
+
+ + + + \ No newline at end of file diff --git a/docs/build/html/_modules/ctypes/wintypes.html b/docs/build/html/_modules/ctypes/wintypes.html new file mode 100644 index 0000000..a372a44 --- /dev/null +++ b/docs/build/html/_modules/ctypes/wintypes.html @@ -0,0 +1,285 @@ + + + + + + + ctypes.wintypes — PythonForWindows 1.0.1 documentation + + + + + + + + + + + + + +
+
+
+
+ +

Source code for ctypes.wintypes

+# The most useful windows datatypes
+import ctypes
+
+BYTE = ctypes.c_byte
+WORD = ctypes.c_ushort
+DWORD = ctypes.c_ulong
+
+#UCHAR = ctypes.c_uchar
+CHAR = ctypes.c_char
+WCHAR = ctypes.c_wchar
+UINT = ctypes.c_uint
+INT = ctypes.c_int
+
+DOUBLE = ctypes.c_double
+FLOAT = ctypes.c_float
+
+BOOLEAN = BYTE
+BOOL = ctypes.c_long
+
+class VARIANT_BOOL(ctypes._SimpleCData):
+    _type_ = "v"
+    def __repr__(self):
+        return "%s(%r)" % (self.__class__.__name__, self.value)
+
+ULONG = ctypes.c_ulong
+LONG = ctypes.c_long
+
+USHORT = ctypes.c_ushort
+SHORT = ctypes.c_short
+
+# in the windows header files, these are structures.
+_LARGE_INTEGER = LARGE_INTEGER = ctypes.c_longlong
+_ULARGE_INTEGER = ULARGE_INTEGER = ctypes.c_ulonglong
+
+LPCOLESTR = LPOLESTR = OLESTR = ctypes.c_wchar_p
+LPCWSTR = LPWSTR = ctypes.c_wchar_p
+LPCSTR = LPSTR = ctypes.c_char_p
+LPCVOID = LPVOID = ctypes.c_void_p
+
+# WPARAM is defined as UINT_PTR (unsigned type)
+# LPARAM is defined as LONG_PTR (signed type)
+if ctypes.sizeof(ctypes.c_long) == ctypes.sizeof(ctypes.c_void_p):
+    WPARAM = ctypes.c_ulong
+    LPARAM = ctypes.c_long
+elif ctypes.sizeof(ctypes.c_longlong) == ctypes.sizeof(ctypes.c_void_p):
+    WPARAM = ctypes.c_ulonglong
+    LPARAM = ctypes.c_longlong
+
+ATOM = WORD
+LANGID = WORD
+
+COLORREF = DWORD
+LGRPID = DWORD
+LCTYPE = DWORD
+
+LCID = DWORD
+
+################################################################
+# HANDLE types
+HANDLE = ctypes.c_void_p # in the header files: void *
+
+HACCEL = HANDLE
+HBITMAP = HANDLE
+HBRUSH = HANDLE
+HCOLORSPACE = HANDLE
+HDC = HANDLE
+HDESK = HANDLE
+HDWP = HANDLE
+HENHMETAFILE = HANDLE
+HFONT = HANDLE
+HGDIOBJ = HANDLE
+HGLOBAL = HANDLE
+HHOOK = HANDLE
+HICON = HANDLE
+HINSTANCE = HANDLE
+HKEY = HANDLE
+HKL = HANDLE
+HLOCAL = HANDLE
+HMENU = HANDLE
+HMETAFILE = HANDLE
+HMODULE = HANDLE
+HMONITOR = HANDLE
+HPALETTE = HANDLE
+HPEN = HANDLE
+HRGN = HANDLE
+HRSRC = HANDLE
+HSTR = HANDLE
+HTASK = HANDLE
+HWINSTA = HANDLE
+HWND = HANDLE
+SC_HANDLE = HANDLE
+SERVICE_STATUS_HANDLE = HANDLE
+
+################################################################
+# Some important structure definitions
+
+class RECT(ctypes.Structure):
+    _fields_ = [("left", LONG),
+                ("top", LONG),
+                ("right", LONG),
+                ("bottom", LONG)]
+tagRECT = _RECTL = RECTL = RECT
+
+class _SMALL_RECT(ctypes.Structure):
+    _fields_ = [('Left', SHORT),
+                ('Top', SHORT),
+                ('Right', SHORT),
+                ('Bottom', SHORT)]
+SMALL_RECT = _SMALL_RECT
+
+class _COORD(ctypes.Structure):
+    _fields_ = [('X', SHORT),
+                ('Y', SHORT)]
+
+class POINT(ctypes.Structure):
+    _fields_ = [("x", LONG),
+                ("y", LONG)]
+tagPOINT = _POINTL = POINTL = POINT
+
+class SIZE(ctypes.Structure):
+    _fields_ = [("cx", LONG),
+                ("cy", LONG)]
+tagSIZE = SIZEL = SIZE
+
+def RGB(red, green, blue):
+    return red + (green << 8) + (blue << 16)
+
+class FILETIME(ctypes.Structure):
+    _fields_ = [("dwLowDateTime", DWORD),
+                ("dwHighDateTime", DWORD)]
+_FILETIME = FILETIME
+
+class MSG(ctypes.Structure):
+    _fields_ = [("hWnd", HWND),
+                ("message", UINT),
+                ("wParam", WPARAM),
+                ("lParam", LPARAM),
+                ("time", DWORD),
+                ("pt", POINT)]
+tagMSG = MSG
+MAX_PATH = 260
+
+class WIN32_FIND_DATAA(ctypes.Structure):
+    _fields_ = [("dwFileAttributes", DWORD),
+                ("ftCreationTime", FILETIME),
+                ("ftLastAccessTime", FILETIME),
+                ("ftLastWriteTime", FILETIME),
+                ("nFileSizeHigh", DWORD),
+                ("nFileSizeLow", DWORD),
+                ("dwReserved0", DWORD),
+                ("dwReserved1", DWORD),
+                ("cFileName", CHAR * MAX_PATH),
+                ("cAlternateFileName", CHAR * 14)]
+
+class WIN32_FIND_DATAW(ctypes.Structure):
+    _fields_ = [("dwFileAttributes", DWORD),
+                ("ftCreationTime", FILETIME),
+                ("ftLastAccessTime", FILETIME),
+                ("ftLastWriteTime", FILETIME),
+                ("nFileSizeHigh", DWORD),
+                ("nFileSizeLow", DWORD),
+                ("dwReserved0", DWORD),
+                ("dwReserved1", DWORD),
+                ("cFileName", WCHAR * MAX_PATH),
+                ("cAlternateFileName", WCHAR * 14)]
+
+################################################################
+# Pointer types
+
+LPBOOL = PBOOL = ctypes.POINTER(BOOL)
+PBOOLEAN = ctypes.POINTER(BOOLEAN)
+LPBYTE = PBYTE = ctypes.POINTER(BYTE)
+PCHAR = ctypes.POINTER(CHAR)
+LPCOLORREF = ctypes.POINTER(COLORREF)
+LPDWORD = PDWORD = ctypes.POINTER(DWORD)
+LPFILETIME = PFILETIME = ctypes.POINTER(FILETIME)
+PFLOAT = ctypes.POINTER(FLOAT)
+LPHANDLE = PHANDLE = ctypes.POINTER(HANDLE)
+PHKEY = ctypes.POINTER(HKEY)
+LPHKL = ctypes.POINTER(HKL)
+LPINT = PINT = ctypes.POINTER(INT)
+PLARGE_INTEGER = ctypes.POINTER(LARGE_INTEGER)
+PLCID = ctypes.POINTER(LCID)
+LPLONG = PLONG = ctypes.POINTER(LONG)
+LPMSG = PMSG = ctypes.POINTER(MSG)
+LPPOINT = PPOINT = ctypes.POINTER(POINT)
+PPOINTL = ctypes.POINTER(POINTL)
+LPRECT = PRECT = ctypes.POINTER(RECT)
+LPRECTL = PRECTL = ctypes.POINTER(RECTL)
+LPSC_HANDLE = ctypes.POINTER(SC_HANDLE)
+PSHORT = ctypes.POINTER(SHORT)
+LPSIZE = PSIZE = ctypes.POINTER(SIZE)
+LPSIZEL = PSIZEL = ctypes.POINTER(SIZEL)
+PSMALL_RECT = ctypes.POINTER(SMALL_RECT)
+LPUINT = PUINT = ctypes.POINTER(UINT)
+PULARGE_INTEGER = ctypes.POINTER(ULARGE_INTEGER)
+PULONG = ctypes.POINTER(ULONG)
+PUSHORT = ctypes.POINTER(USHORT)
+PWCHAR = ctypes.POINTER(WCHAR)
+LPWIN32_FIND_DATAA = PWIN32_FIND_DATAA = ctypes.POINTER(WIN32_FIND_DATAA)
+LPWIN32_FIND_DATAW = PWIN32_FIND_DATAW = ctypes.POINTER(WIN32_FIND_DATAW)
+LPWORD = PWORD = ctypes.POINTER(WORD)
+
+ +
+
+
+
+ +
+
+ + + + \ No newline at end of file diff --git a/docs/build/html/_modules/windows/debug/symbols.html b/docs/build/html/_modules/windows/debug/symbols.html index df432c8..e430ecd 100644 --- a/docs/build/html/_modules/windows/debug/symbols.html +++ b/docs/build/html/_modules/windows/debug/symbols.html @@ -4,12 +4,12 @@ - windows.debug.symbols — PythonForWindows 1.0.0 documentation + windows.debug.symbols — PythonForWindows 1.0.1 documentation - + @@ -25,7 +25,7 @@
  • modules |
  • - + @@ -605,6 +605,12 @@ windows.winproxy.SymGetTypeFromNameW(self.handle, mod, name, buff) return SymbolType.from_symbol_info(buff[0], resolver=self) + # + def types(self, mod=None): + typeslist = [] # Iter on types of all modules if None provided ? + windows.winproxy.SymEnumTypes(self.handle, mod, self.simple_aggregator, typeslist) + return [SymbolType.from_symbol_info(t, resolver=self) for t in typeslist] + # TODO: mets de l'huile pour w4kfu class StackWalker(object): @@ -863,7 +869,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/windows/generated_def/flag.html b/docs/build/html/_modules/windows/generated_def/flag.html index 3ab6943..5fd5bc0 100644 --- a/docs/build/html/_modules/windows/generated_def/flag.html +++ b/docs/build/html/_modules/windows/generated_def/flag.html @@ -4,12 +4,12 @@ - windows.generated_def.flag — PythonForWindows 1.0.0 documentation + windows.generated_def.flag — PythonForWindows 1.0.1 documentation - + @@ -25,7 +25,7 @@
  • modules |
  • - + @@ -145,7 +145,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/windows/generated_def/interfaces.html b/docs/build/html/_modules/windows/generated_def/interfaces.html index 152e676..af764c0 100644 --- a/docs/build/html/_modules/windows/generated_def/interfaces.html +++ b/docs/build/html/_modules/windows/generated_def/interfaces.html @@ -4,12 +4,12 @@ - windows.generated_def.interfaces — PythonForWindows 1.0.0 documentation + windows.generated_def.interfaces — PythonForWindows 1.0.1 documentation - + @@ -25,7 +25,7 @@
  • modules |
  • - + @@ -117,12 +117,6 @@ -
    -[docs] -class IActivationStageInfo(COMInterface): - IID = generate_IID(0x000001A8, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, name="IActivationStageInfo", strid="000001A8-0000-0000-C000-000000000046")
    - -
    [docs] class ICallFactory(COMInterface): @@ -405,6 +399,12 @@ IID = generate_IID(0x000001A2, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, name="IActivationPropertiesIn", strid="000001A2-0000-0000-C000-000000000046")
    +
    +[docs] +class IActivationStageInfo(COMInterface): + IID = generate_IID(0x000001A8, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, name="IActivationStageInfo", strid="000001A8-0000-0000-C000-000000000046")
    + +
    [docs] class IClassClassicInfo(COMInterface): @@ -801,21 +801,6 @@ IID = generate_IID(0x0EFA6E54, 0xF313, 0x405D, 0xB5, 0xD8, 0x83, 0x0A, 0x91, 0x4F, 0x64, 0x96, name="IWbemServices", strid="0EFA6E54-F313-405D-B5D8-830A914F6496")
    -IActivationStageInfo._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"), - # SetStageAndIndex -> stage:ACTIVATION_STAGE, index:INT - "SetStageAndIndex": ctypes.WINFUNCTYPE(HRESULT, ACTIVATION_STAGE, INT)(3, "SetStageAndIndex"), - # GetStage -> pstage:*ACTIVATION_STAGE - "GetStage": ctypes.WINFUNCTYPE(HRESULT, POINTER(ACTIVATION_STAGE))(4, "GetStage"), - # GetIndex -> pindex:*INT - "GetIndex": ctypes.WINFUNCTYPE(HRESULT, POINTER(INT))(5, "GetIndex"), - } - ICallFactory._functions_ = { # QueryInterface -> riid:REFIID, ppvObject:**void "QueryInterface": ctypes.WINFUNCTYPE(HRESULT, REFIID, POINTER(PVOID))(0, "QueryInterface"), @@ -2021,6 +2006,21 @@ "GetReturnActivationProperties": ctypes.WINFUNCTYPE(HRESULT, IUnknown, POINTER(IActivationPropertiesOut))(12, "GetReturnActivationProperties"), } +IActivationStageInfo._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"), + # SetStageAndIndex -> stage:ACTIVATION_STAGE, index:INT + "SetStageAndIndex": ctypes.WINFUNCTYPE(HRESULT, ACTIVATION_STAGE, INT)(3, "SetStageAndIndex"), + # GetStage -> pstage:*ACTIVATION_STAGE + "GetStage": ctypes.WINFUNCTYPE(HRESULT, POINTER(ACTIVATION_STAGE))(4, "GetStage"), + # GetIndex -> pindex:*INT + "GetIndex": ctypes.WINFUNCTYPE(HRESULT, POINTER(INT))(5, "GetIndex"), + } + IClassClassicInfo._functions_ = { # QueryInterface -> riid:REFIID, ppvObject:**void "QueryInterface": ctypes.WINFUNCTYPE(HRESULT, REFIID, POINTER(PVOID))(0, "QueryInterface"), @@ -3998,7 +3998,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/windows/generated_def/winstructs.html b/docs/build/html/_modules/windows/generated_def/winstructs.html index c648c67..347a036 100644 --- a/docs/build/html/_modules/windows/generated_def/winstructs.html +++ b/docs/build/html/_modules/windows/generated_def/winstructs.html @@ -4,12 +4,12 @@ - windows.generated_def.winstructs — PythonForWindows 1.0.0 documentation + windows.generated_def.winstructs — PythonForWindows 1.0.1 documentation - + @@ -25,7 +25,7 @@
  • modules |
  • - + @@ -346,6 +346,8 @@ LPSERVICE_MAIN_FUNCTIONW = PVOID LPOVERLAPPED_COMPLETION_ROUTINE = PVOID PDNS_QUERY_COMPLETION_ROUTINE = PVOID +LPHANDLER_FUNCTION = PVOID +LPHANDLER_FUNCTION_EX = PVOID LPCONTEXT = PVOID HCERTSTORE = PVOID HCRYPTMSG = PVOID @@ -11231,6 +11233,42 @@ PFILE_INFORMATION_CLASS = POINTER(_FILE_INFORMATION_CLASS) +FileBasicInfo = EnumValue("_FILE_INFO_BY_HANDLE_CLASS", "FileBasicInfo", 0x0) +FileStandardInfo = EnumValue("_FILE_INFO_BY_HANDLE_CLASS", "FileStandardInfo", 0x1) +FileNameInfo = EnumValue("_FILE_INFO_BY_HANDLE_CLASS", "FileNameInfo", 0x2) +FileRenameInfo = EnumValue("_FILE_INFO_BY_HANDLE_CLASS", "FileRenameInfo", 0x3) +FileDispositionInfo = EnumValue("_FILE_INFO_BY_HANDLE_CLASS", "FileDispositionInfo", 0x4) +FileAllocationInfo = EnumValue("_FILE_INFO_BY_HANDLE_CLASS", "FileAllocationInfo", 0x5) +FileEndOfFileInfo = EnumValue("_FILE_INFO_BY_HANDLE_CLASS", "FileEndOfFileInfo", 0x6) +FileStreamInfo = EnumValue("_FILE_INFO_BY_HANDLE_CLASS", "FileStreamInfo", 0x7) +FileCompressionInfo = EnumValue("_FILE_INFO_BY_HANDLE_CLASS", "FileCompressionInfo", 0x8) +FileAttributeTagInfo = EnumValue("_FILE_INFO_BY_HANDLE_CLASS", "FileAttributeTagInfo", 0x9) +FileIdBothDirectoryInfo = EnumValue("_FILE_INFO_BY_HANDLE_CLASS", "FileIdBothDirectoryInfo", 0xa) +FileIdBothDirectoryRestartInfo = EnumValue("_FILE_INFO_BY_HANDLE_CLASS", "FileIdBothDirectoryRestartInfo", 0xb) +FileIoPriorityHintInfo = EnumValue("_FILE_INFO_BY_HANDLE_CLASS", "FileIoPriorityHintInfo", 0xc) +FileRemoteProtocolInfo = EnumValue("_FILE_INFO_BY_HANDLE_CLASS", "FileRemoteProtocolInfo", 0xd) +FileFullDirectoryInfo = EnumValue("_FILE_INFO_BY_HANDLE_CLASS", "FileFullDirectoryInfo", 0xe) +FileFullDirectoryRestartInfo = EnumValue("_FILE_INFO_BY_HANDLE_CLASS", "FileFullDirectoryRestartInfo", 0xf) +FileStorageInfo = EnumValue("_FILE_INFO_BY_HANDLE_CLASS", "FileStorageInfo", 0x10) +FileAlignmentInfo = EnumValue("_FILE_INFO_BY_HANDLE_CLASS", "FileAlignmentInfo", 0x11) +FileIdInfo = EnumValue("_FILE_INFO_BY_HANDLE_CLASS", "FileIdInfo", 0x12) +FileIdExtdDirectoryInfo = EnumValue("_FILE_INFO_BY_HANDLE_CLASS", "FileIdExtdDirectoryInfo", 0x13) +FileIdExtdDirectoryRestartInfo = EnumValue("_FILE_INFO_BY_HANDLE_CLASS", "FileIdExtdDirectoryRestartInfo", 0x14) +FileDispositionInfoEx = EnumValue("_FILE_INFO_BY_HANDLE_CLASS", "FileDispositionInfoEx", 0x15) +FileRenameInfoEx = EnumValue("_FILE_INFO_BY_HANDLE_CLASS", "FileRenameInfoEx", 0x16) +FileCaseSensitiveInfo = EnumValue("_FILE_INFO_BY_HANDLE_CLASS", "FileCaseSensitiveInfo", 0x17) +FileNormalizedNameInfo = EnumValue("_FILE_INFO_BY_HANDLE_CLASS", "FileNormalizedNameInfo", 0x18) +MaximumFileInfoByHandleClass = EnumValue("_FILE_INFO_BY_HANDLE_CLASS", "MaximumFileInfoByHandleClass", 0x19) +
    +[docs] +class _FILE_INFO_BY_HANDLE_CLASS(EnumType): + values = [FileBasicInfo, FileStandardInfo, FileNameInfo, FileRenameInfo, FileDispositionInfo, FileAllocationInfo, FileEndOfFileInfo, FileStreamInfo, FileCompressionInfo, FileAttributeTagInfo, FileIdBothDirectoryInfo, FileIdBothDirectoryRestartInfo, FileIoPriorityHintInfo, FileRemoteProtocolInfo, FileFullDirectoryInfo, FileFullDirectoryRestartInfo, FileStorageInfo, FileAlignmentInfo, FileIdInfo, FileIdExtdDirectoryInfo, FileIdExtdDirectoryRestartInfo, FileDispositionInfoEx, FileRenameInfoEx, FileCaseSensitiveInfo, FileNormalizedNameInfo, MaximumFileInfoByHandleClass] + mapper = FlagMapper(*values)
    + +FILE_INFO_BY_HANDLE_CLASS = _FILE_INFO_BY_HANDLE_CLASS +PFILE_INFO_BY_HANDLE_CLASS = POINTER(_FILE_INFO_BY_HANDLE_CLASS) + + IoPriorityVeryLow = EnumValue("_IO_PRIORITY_HINT", "IoPriorityVeryLow", 0x0) IoPriorityLow = EnumValue("_IO_PRIORITY_HINT", "IoPriorityLow", 0x1) IoPriorityNormal = EnumValue("_IO_PRIORITY_HINT", "IoPriorityNormal", 0x2) @@ -11472,6 +11510,26 @@ FILE_GET_EA_INFORMATION = _FILE_GET_EA_INFORMATION PFILE_GET_EA_INFORMATION = POINTER(_FILE_GET_EA_INFORMATION) +
    +[docs] +class _BY_HANDLE_FILE_INFORMATION(Structure): + _fields_ = [ + ("dwFileAttributes", DWORD), + ("ftCreationTime", FILETIME), + ("ftLastAccessTime", FILETIME), + ("ftLastWriteTime", FILETIME), + ("dwVolumeSerialNumber", DWORD), + ("nFileSizeHigh", DWORD), + ("nFileSizeLow", DWORD), + ("nNumberOfLinks", DWORD), + ("nFileIndexHigh", DWORD), + ("nFileIndexLow", DWORD), + ]
    + +BY_HANDLE_FILE_INFORMATION = _BY_HANDLE_FILE_INFORMATION +LPBY_HANDLE_FILE_INFORMATION = POINTER(_BY_HANDLE_FILE_INFORMATION) +PBY_HANDLE_FILE_INFORMATION = POINTER(_BY_HANDLE_FILE_INFORMATION) +
    [docs] class tagVS_FIXEDFILEINFO(Structure): @@ -14964,7 +15022,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/windows/pe_parse.html b/docs/build/html/_modules/windows/pe_parse.html index 9ca89e4..898690c 100644 --- a/docs/build/html/_modules/windows/pe_parse.html +++ b/docs/build/html/_modules/windows/pe_parse.html @@ -4,12 +4,12 @@ - windows.pe_parse — PythonForWindows 1.0.0 documentation + windows.pe_parse — PythonForWindows 1.0.1 documentation - + @@ -25,7 +25,7 @@
  • modules |
  • - + @@ -503,7 +503,20 @@ iat_entry.name = str(name) if name else "" name = get_string(self.target, self.baseaddr + import_descriptor.Name) res.setdefault(name.lower(), []).extend(IAT) - return res
    + return res + + @utils.fixedpropety + def binid(self): + """Return the hex-string {TimeStamp}{SizeOfCode} used by PDB to identify a PE. + + I do not know the official name of this value... + + :type: :class:`str` + """ + nth = self.get_NT_HEADER() + timestamp = nth.FileHeader.TimeDateStamp + image_size = nth.OptionalHeader.SizeOfImage + return "{timestamp:08x}{image_size:x}".format(timestamp=timestamp, image_size=image_size) @@ -536,7 +549,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/windows/utils/winutils.html b/docs/build/html/_modules/windows/utils/winutils.html index 2f83409..c5381a1 100644 --- a/docs/build/html/_modules/windows/utils/winutils.html +++ b/docs/build/html/_modules/windows/utils/winutils.html @@ -4,12 +4,12 @@ - windows.utils.winutils — PythonForWindows 1.0.0 documentation + windows.utils.winutils — PythonForWindows 1.0.1 documentation - + @@ -25,7 +25,7 @@
  • modules |
  • - + @@ -620,11 +620,11 @@ def create_file(name, access=gdef.GENERIC_READ, share=gdef.FILE_SHARE_READ, security=None, creation=gdef.OPEN_EXISTING, flags=gdef.FILE_ATTRIBUTE_NORMAL): return windows.winproxy.CreateFileW(name, access, share, security, creation, flags, 0) -def mapfile(file): - fhandle = get_handle_from_file(file) - h = windows.winproxy.CreateFileMappingA(fhandle, None, PAGE_READONLY, 0, 0, None) - addr = windows.winproxy.MapViewOfFile(h, dwDesiredAccess=FILE_MAP_READ, dwNumberOfBytesToMap=0) - return addr +#def mapfile(file): +# fhandle = get_handle_from_file(file) +# h = windows.winproxy.CreateFileMappingA(fhandle, None, PAGE_READONLY, 0, 1, None) +# addr = windows.winproxy.MapViewOfFile(h, dwDesiredAccess=FILE_MAP_READ, dwNumberOfBytesToMap=1) +# return addr def decompress_buffer(buffer, comptype=gdef.COMPRESSION_FORMAT_LZNT1, uncompress_size=None): if uncompress_size is None: @@ -752,7 +752,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/windows/winobject/event_log.html b/docs/build/html/_modules/windows/winobject/event_log.html index fced8fa..33ab14c 100644 --- a/docs/build/html/_modules/windows/winobject/event_log.html +++ b/docs/build/html/_modules/windows/winobject/event_log.html @@ -4,12 +4,12 @@ - windows.winobject.event_log — PythonForWindows 1.0.0 documentation + windows.winobject.event_log — PythonForWindows 1.0.1 documentation - + @@ -25,7 +25,7 @@
  • modules |
  • - + @@ -437,6 +437,7 @@ gdef.EvtVarTypeUInt16 + gdef.EVT_VARIANT_TYPE_ARRAY : "UInt16Arr", gdef.EvtVarTypeUInt32 + gdef.EVT_VARIANT_TYPE_ARRAY : "UInt32Arr", gdef.EvtVarTypeUInt64 + gdef.EVT_VARIANT_TYPE_ARRAY : "UInt64Arr", + gdef.EvtVarTypeHexInt64 + gdef.EVT_VARIANT_TYPE_ARRAY : "UInt64Arr", } NoneValue = None @@ -1278,7 +1279,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/windows/winobject/service.html b/docs/build/html/_modules/windows/winobject/service.html index 455557c..068d223 100644 --- a/docs/build/html/_modules/windows/winobject/service.html +++ b/docs/build/html/_modules/windows/winobject/service.html @@ -4,12 +4,12 @@ - windows.winobject.service — PythonForWindows 1.0.0 documentation + windows.winobject.service — PythonForWindows 1.0.1 documentation - + @@ -25,7 +25,7 @@
  • modules |
  • - + @@ -193,7 +193,13 @@ def enumerate_services(self): return list(self._enumerate_services_generator()) - def create(self, name, description, access, type, start, path): +
    +[docs] + def create(self, name, description, access, type, start, path, user=None): + """Create a new service + + :return: :class:`Service` -- The newly created service + """ newservice_handle = windows.winproxy.CreateServiceW( self.handle, # hSCManager name, # lpServiceName @@ -206,10 +212,11 @@ None, # lpLoadOrderGroup None, # lpdwTagId None, # lpDependencies - None, # lpServiceStartName + user, # lpServiceStartName None) # lpPassword return Service(handle=newservice_handle, name=name, description=description)
    + @@ -291,6 +298,13 @@ return status +
    +[docs] + def delete(self): + """Delete the service""" + return windows.winproxy.DeleteService(self)
    + + def __repr__(self): return urepr_encode(u"""<{0} "{1}" {2!r}>""".format(type(self).__name__, self.name, self.status.state)) @@ -328,7 +342,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_sources/interfaces_generated.rst.txt b/docs/build/html/_sources/interfaces_generated.rst.txt index 561b2b8..b0017f6 100644 --- a/docs/build/html/_sources/interfaces_generated.rst.txt +++ b/docs/build/html/_sources/interfaces_generated.rst.txt @@ -2,16 +2,6 @@ Interfaces ---------- -.. class:: IActivationStageInfo - - .. method:: QueryInterface - .. method:: AddRef - .. method:: Release - .. method:: SetStageAndIndex - .. method:: GetStage - .. method:: GetIndex - - .. class:: ICallFactory .. method:: QueryInterface @@ -722,6 +712,16 @@ Interfaces .. method:: GetReturnActivationProperties +.. class:: IActivationStageInfo + + .. method:: QueryInterface + .. method:: AddRef + .. method:: Release + .. method:: SetStageAndIndex + .. method:: GetStage + .. method:: GetIndex + + .. class:: IClassClassicInfo .. method:: QueryInterface diff --git a/docs/build/html/_sources/sample.rst.txt b/docs/build/html/_sources/sample.rst.txt index 792f3ee..dc255cf 100644 --- a/docs/build/html/_sources/sample.rst.txt +++ b/docs/build/html/_sources/sample.rst.txt @@ -103,7 +103,17 @@ Output .. literalinclude:: samples_output\service_service_demo.txt +Windows Service in Python +''''''''''''''''''''''''' +This script can register itself as a service and act on `stop` request. +It also can delete its own service. + +.. literalinclude:: ..\..\samples\service\python_service.py + +Output + +.. literalinclude:: samples_output\service_python_service.txt .. _sample_network_exploration: diff --git a/docs/build/html/_sources/winfuncs_generated.rst.txt b/docs/build/html/_sources/winfuncs_generated.rst.txt index b28c738..80cb453 100644 --- a/docs/build/html/_sources/winfuncs_generated.rst.txt +++ b/docs/build/html/_sources/winfuncs_generated.rst.txt @@ -488,6 +488,12 @@ Functions .. function:: LockFileEx(hFile, dwFlags, dwReserved, nNumberOfBytesToLockLow, nNumberOfBytesToLockHigh, lpOverlapped) +.. function:: SetFileInformationByHandle(hFile, FileInformationClass, lpFileInformation, dwBufferSize) + +.. function:: GetFileInformationByHandle(hFile, lpFileInformation) + +.. function:: GetFileInformationByHandleEx(hFile, FileInformationClass, lpFileInformation, dwBufferSize) + .. function:: HeapAlloc(hHeap, dwFlags, dwBytes) .. function:: InternetCheckConnectionA(lpszUrl, dwFlags, dwReserved) @@ -916,6 +922,18 @@ Functions .. function:: StartServiceCtrlDispatcherW(lpServiceStartTable) +.. function:: RegisterServiceCtrlHandlerExA(lpServiceName, lpHandlerProc, lpContext) + +.. function:: RegisterServiceCtrlHandlerExW(lpServiceName, lpHandlerProc, lpContext) + +.. function:: RegisterServiceCtrlHandlerA(lpServiceName, lpHandlerProc) + +.. function:: RegisterServiceCtrlHandlerW(lpServiceName, lpHandlerProc) + +.. function:: SetServiceStatus(hServiceStatus, lpServiceStatus) + +.. function:: SetServiceBits(hServiceStatus, dwServiceBits, bSetBitsOn, bUpdateImmediately) + .. function:: SetupDiClassNameFromGuidA(ClassGuid, ClassName, ClassNameSize, RequiredSize) .. function:: SetupDiClassNameFromGuidW(ClassGuid, ClassName, ClassNameSize, RequiredSize) diff --git a/docs/build/html/_sources/winstructs_generated.rst.txt b/docs/build/html/_sources/winstructs_generated.rst.txt index 3878cb3..3892063 100644 --- a/docs/build/html/_sources/winstructs_generated.rst.txt +++ b/docs/build/html/_sources/winstructs_generated.rst.txt @@ -511,6 +511,10 @@ Simple types .. autoclass:: PDNS_QUERY_COMPLETION_ROUTINE +.. autoclass:: LPHANDLER_FUNCTION + +.. autoclass:: LPHANDLER_FUNCTION_EX + .. autoclass:: LPCONTEXT .. autoclass:: HCERTSTORE @@ -21089,6 +21093,71 @@ _FILE_GET_EA_INFORMATION :class:`CHAR` +_BY_HANDLE_FILE_INFORMATION +''''''''''''''''''''''''''' +.. class:: BY_HANDLE_FILE_INFORMATION + + Alias for :class:`_BY_HANDLE_FILE_INFORMATION` + +.. class:: LPBY_HANDLE_FILE_INFORMATION + + Pointer to :class:`_BY_HANDLE_FILE_INFORMATION` + +.. class:: PBY_HANDLE_FILE_INFORMATION + + Pointer to :class:`_BY_HANDLE_FILE_INFORMATION` + +.. class:: _BY_HANDLE_FILE_INFORMATION + + .. attribute:: dwFileAttributes + + :class:`DWORD` + + + .. attribute:: ftCreationTime + + :class:`FILETIME` + + + .. attribute:: ftLastAccessTime + + :class:`FILETIME` + + + .. attribute:: ftLastWriteTime + + :class:`FILETIME` + + + .. attribute:: dwVolumeSerialNumber + + :class:`DWORD` + + + .. attribute:: nFileSizeHigh + + :class:`DWORD` + + + .. attribute:: nFileSizeLow + + :class:`DWORD` + + + .. attribute:: nNumberOfLinks + + :class:`DWORD` + + + .. attribute:: nFileIndexHigh + + :class:`DWORD` + + + .. attribute:: nFileIndexLow + + :class:`DWORD` + tagVS_FIXEDFILEINFO ''''''''''''''''''' .. class:: VS_FIXEDFILEINFO @@ -32567,6 +32636,98 @@ _FILE_INFORMATION_CLASS .. attribute:: FileMaximumInformation(67) +_FILE_INFO_BY_HANDLE_CLASS +'''''''''''''''''''''''''' +.. class:: FILE_INFO_BY_HANDLE_CLASS + + Alias for :class:`_FILE_INFO_BY_HANDLE_CLASS` + + +.. class:: PFILE_INFO_BY_HANDLE_CLASS + + Pointer to :class:`_FILE_INFO_BY_HANDLE_CLASS` + + +.. class:: _FILE_INFO_BY_HANDLE_CLASS + + + .. attribute:: FileBasicInfo(0) + + + .. attribute:: FileStandardInfo(1) + + + .. attribute:: FileNameInfo(2) + + + .. attribute:: FileRenameInfo(3) + + + .. attribute:: FileDispositionInfo(4) + + + .. attribute:: FileAllocationInfo(5) + + + .. attribute:: FileEndOfFileInfo(6) + + + .. attribute:: FileStreamInfo(7) + + + .. attribute:: FileCompressionInfo(8) + + + .. attribute:: FileAttributeTagInfo(9) + + + .. attribute:: FileIdBothDirectoryInfo(10) + + + .. attribute:: FileIdBothDirectoryRestartInfo(11) + + + .. attribute:: FileIoPriorityHintInfo(12) + + + .. attribute:: FileRemoteProtocolInfo(13) + + + .. attribute:: FileFullDirectoryInfo(14) + + + .. attribute:: FileFullDirectoryRestartInfo(15) + + + .. attribute:: FileStorageInfo(16) + + + .. attribute:: FileAlignmentInfo(17) + + + .. attribute:: FileIdInfo(18) + + + .. attribute:: FileIdExtdDirectoryInfo(19) + + + .. attribute:: FileIdExtdDirectoryRestartInfo(20) + + + .. attribute:: FileDispositionInfoEx(21) + + + .. attribute:: FileRenameInfoEx(22) + + + .. attribute:: FileCaseSensitiveInfo(23) + + + .. attribute:: FileNormalizedNameInfo(24) + + + .. attribute:: MaximumFileInfoByHandleClass(25) + _IO_PRIORITY_HINT ''''''''''''''''' .. class:: IO_PRIORITY_HINT diff --git a/docs/build/html/genindex.html b/docs/build/html/genindex.html index 94e1ecc..87d5279 100644 --- a/docs/build/html/genindex.html +++ b/docs/build/html/genindex.html @@ -303,6 +303,8 @@
  • _BG_JOB_TIMES (class in windows.generated_def.winstructs)
  • _BG_JOB_TYPE (class in windows.generated_def.winstructs) +
  • +
  • _BY_HANDLE_FILE_INFORMATION (class in windows.generated_def.winstructs)
  • _CALLFRAME_COPY (class in windows.generated_def.winstructs)
  • @@ -669,6 +671,8 @@
  • _FILE_FULL_EA_INFORMATION (class in windows.generated_def.winstructs)
  • _FILE_GET_EA_INFORMATION (class in windows.generated_def.winstructs) +
  • +
  • _FILE_INFO_BY_HANDLE_CLASS (class in windows.generated_def.winstructs)
  • _FILE_INFORMATION_CLASS (class in windows.generated_def.winstructs)
  • @@ -755,11 +759,11 @@
  • _IMAGEHLP_CBA_EVENTW (class in windows.generated_def.winstructs)
  • _IMAGEHLP_CBA_READ_MEMORY (class in windows.generated_def.winstructs) -
  • -
  • _IMAGEHLP_DEFERRED_SYMBOL_LOAD (class in windows.generated_def.winstructs)
  • BindToObject() (windows.generated_def.interfaces.IMoniker method)
  • - - +
  • delete() (windows.winobject.registry.PyHKey method) + +
  • delete_folder() (windows.winobject.task_scheduler.TaskFolder method)
  • delete_instance() (windows.winobject.wmi.WmiNamespace method) @@ -8828,10 +8842,10 @@
  • DNS_QUERY_NO_WIRE_QUERY (in module windows.generated_def)
  • - - + -
  • dwFileAttributes (windows.generated_def.winstructs._WIN32_FIND_DATAA attribute) +
  • dwFileAttributes (windows.generated_def.winstructs._BY_HANDLE_FILE_INFORMATION attribute)
  • @@ -10144,6 +10160,8 @@
  • (windows.generated_def.winstructs._CTL_INFO attribute)
  • +
  • dwVolumeSerialNumber (windows.generated_def.winstructs._BY_HANDLE_FILE_INFORMATION attribute) +
  • dwWaitHint (windows.generated_def.winstructs._SERVICE_STATUS attribute)
  • +
  • FileAlignmentInfo (windows.generated_def.winstructs._FILE_INFO_BY_HANDLE_CLASS attribute) +
  • FileAlignmentInformation (windows.generated_def.winstructs._FILE_INFORMATION_CLASS attribute)
  • FileAllInformation (windows.generated_def.winstructs._FILE_INFORMATION_CLASS attribute) +
  • +
  • FileAllocationInfo (windows.generated_def.winstructs._FILE_INFO_BY_HANDLE_CLASS attribute)
  • FileAllocationInformation (windows.generated_def.winstructs._FILE_INFORMATION_CLASS attribute)
  • @@ -19764,23 +19788,37 @@
  • (windows.generated_def.winstructs._FILE_NOTIFY_EXTENDED_INFORMATION attribute)
  • +
  • FileAttributeTagInfo (windows.generated_def.winstructs._FILE_INFO_BY_HANDLE_CLASS attribute) +
  • FileAttributeTagInformation (windows.generated_def.winstructs._FILE_INFORMATION_CLASS attribute) +
  • +
  • FileBasicInfo (windows.generated_def.winstructs._FILE_INFO_BY_HANDLE_CLASS attribute)
  • FileBasicInformation (windows.generated_def.winstructs._FILE_INFORMATION_CLASS attribute)
  • FileBothDirectoryInformation (windows.generated_def.winstructs._FILE_INFORMATION_CLASS attribute) +
  • +
  • FileCaseSensitiveInfo (windows.generated_def.winstructs._FILE_INFO_BY_HANDLE_CLASS attribute)
  • FileCompletionInformation (windows.generated_def.winstructs._FILE_INFORMATION_CLASS attribute) +
  • +
  • FileCompressionInfo (windows.generated_def.winstructs._FILE_INFO_BY_HANDLE_CLASS attribute)
  • FileCompressionInformation (windows.generated_def.winstructs._FILE_INFORMATION_CLASS attribute)
  • FileDirectoryInformation (windows.generated_def.winstructs._FILE_INFORMATION_CLASS attribute) +
  • +
  • FileDispositionInfo (windows.generated_def.winstructs._FILE_INFO_BY_HANDLE_CLASS attribute) +
  • +
  • FileDispositionInfoEx (windows.generated_def.winstructs._FILE_INFO_BY_HANDLE_CLASS attribute)
  • FileDispositionInformation (windows.generated_def.winstructs._FILE_INFORMATION_CLASS attribute)
  • FileDispositionInformationEx (windows.generated_def.winstructs._FILE_INFORMATION_CLASS attribute)
  • FileEaInformation (windows.generated_def.winstructs._FILE_INFORMATION_CLASS attribute) +
  • +
  • FileEndOfFileInfo (windows.generated_def.winstructs._FILE_INFO_BY_HANDLE_CLASS attribute)
  • FileEndOfFileInformation (windows.generated_def.winstructs._FILE_INFORMATION_CLASS attribute)
  • @@ -19805,8 +19843,12 @@
  • FileFsVolumeFlagsInformation (windows.generated_def.winstructs._FS_INFORMATION_CLASS attribute)
  • FileFsVolumeInformation (windows.generated_def.winstructs._FS_INFORMATION_CLASS attribute) +
  • +
  • FileFullDirectoryInfo (windows.generated_def.winstructs._FILE_INFO_BY_HANDLE_CLASS attribute)
  • FileFullDirectoryInformation (windows.generated_def.winstructs._FILE_INFORMATION_CLASS attribute) +
  • +
  • FileFullDirectoryRestartInfo (windows.generated_def.winstructs._FILE_INFO_BY_HANDLE_CLASS attribute)
  • FileFullEaInformation (windows.generated_def.winstructs._FILE_INFORMATION_CLASS attribute)
  • @@ -19821,22 +19863,34 @@
  • FileId (windows.generated_def.winstructs._FILE_NOTIFY_EXTENDED_INFORMATION attribute) +
  • +
  • FileIdBothDirectoryInfo (windows.generated_def.winstructs._FILE_INFO_BY_HANDLE_CLASS attribute)
  • FileIdBothDirectoryInformation (windows.generated_def.winstructs._FILE_INFORMATION_CLASS attribute) +
  • +
  • FileIdBothDirectoryRestartInfo (windows.generated_def.winstructs._FILE_INFO_BY_HANDLE_CLASS attribute)
  • FileIdExtdBothDirectoryInformation (windows.generated_def.winstructs._FILE_INFORMATION_CLASS attribute) +
  • +
  • FileIdExtdDirectoryInfo (windows.generated_def.winstructs._FILE_INFO_BY_HANDLE_CLASS attribute)
  • FileIdExtdDirectoryInformation (windows.generated_def.winstructs._FILE_INFORMATION_CLASS attribute) +
  • +
  • FileIdExtdDirectoryRestartInfo (windows.generated_def.winstructs._FILE_INFO_BY_HANDLE_CLASS attribute)
  • FileIdFullDirectoryInformation (windows.generated_def.winstructs._FILE_INFORMATION_CLASS attribute)
  • FileIdGlobalTxDirectoryInformation (windows.generated_def.winstructs._FILE_INFORMATION_CLASS attribute) +
  • +
  • FileIdInfo (windows.generated_def.winstructs._FILE_INFO_BY_HANDLE_CLASS attribute)
  • FileIdInformation (windows.generated_def.winstructs._FILE_INFORMATION_CLASS attribute)
  • FileInternalInformation (windows.generated_def.winstructs._FILE_INFORMATION_CLASS attribute)
  • FileIoCompletionNotificationInformation (windows.generated_def.winstructs._FILE_INFORMATION_CLASS attribute) +
  • +
  • FileIoPriorityHintInfo (windows.generated_def.winstructs._FILE_INFO_BY_HANDLE_CLASS attribute)
  • FileIoPriorityHintInformation (windows.generated_def.winstructs._FILE_INFORMATION_CLASS attribute)
  • @@ -19881,6 +19935,8 @@
  • filename2 (windows.winproxy.WinproxyError attribute)
  • FileNameId (windows.generated_def.winstructs._DEBUG_SYMBOL_SOURCE_ENTRY attribute) +
  • +
  • FileNameInfo (windows.generated_def.winstructs._FILE_INFO_BY_HANDLE_CLASS attribute)
  • FileNameInformation (windows.generated_def.winstructs._FILE_INFORMATION_CLASS attribute)
  • @@ -19903,6 +19959,8 @@
  • FileNetworkOpenInformation (windows.generated_def.winstructs._FILE_INFORMATION_CLASS attribute)
  • FileNetworkPhysicalNameInformation (windows.generated_def.winstructs._FILE_INFORMATION_CLASS attribute) +
  • +
  • FileNormalizedNameInfo (windows.generated_def.winstructs._FILE_INFO_BY_HANDLE_CLASS attribute)
  • FileNormalizedNameInformation (windows.generated_def.winstructs._FILE_INFORMATION_CLASS attribute)
  • @@ -19923,8 +19981,14 @@
  • FileProcessIdsUsingFileInformation (windows.generated_def.winstructs._FILE_INFORMATION_CLASS attribute)
  • FileQuotaInformation (windows.generated_def.winstructs._FILE_INFORMATION_CLASS attribute) +
  • +
  • FileRemoteProtocolInfo (windows.generated_def.winstructs._FILE_INFO_BY_HANDLE_CLASS attribute)
  • FileRemoteProtocolInformation (windows.generated_def.winstructs._FILE_INFORMATION_CLASS attribute) +
  • +
  • FileRenameInfo (windows.generated_def.winstructs._FILE_INFO_BY_HANDLE_CLASS attribute) +
  • +
  • FileRenameInfoEx (windows.generated_def.winstructs._FILE_INFO_BY_HANDLE_CLASS attribute)
  • FileRenameInformation (windows.generated_def.winstructs._FILE_INFORMATION_CLASS attribute)
  • @@ -19945,14 +20009,20 @@
  • FileShortNameInformation (windows.generated_def.winstructs._FILE_INFORMATION_CLASS attribute)
  • FileSize (windows.generated_def.winstructs._FILE_NOTIFY_EXTENDED_INFORMATION attribute) +
  • +
  • FileStandardInfo (windows.generated_def.winstructs._FILE_INFO_BY_HANDLE_CLASS attribute)
  • FileStandardInformation (windows.generated_def.winstructs._FILE_INFORMATION_CLASS attribute)
  • FileStandardLinkInformation (windows.generated_def.winstructs._FILE_INFORMATION_CLASS attribute) +
  • +
  • FileStorageInfo (windows.generated_def.winstructs._FILE_INFO_BY_HANDLE_CLASS attribute)
  • FilesTotal (windows.generated_def.winstructs._BG_JOB_PROGRESS attribute)
  • FilesTransferred (windows.generated_def.winstructs._BG_JOB_PROGRESS attribute) +
  • +
  • FileStreamInfo (windows.generated_def.winstructs._FILE_INFO_BY_HANDLE_CLASS attribute)
  • FileStreamInformation (windows.generated_def.winstructs._FILE_INFORMATION_CLASS attribute)
  • @@ -20984,21 +21054,27 @@
  • FSCTL_WRITE_USN_REASON (in module windows.generated_def)
  • -
  • ftCreationTime (windows.generated_def.winstructs._WIN32_FIND_DATAA attribute) +
  • ftCreationTime (windows.generated_def.winstructs._BY_HANDLE_FILE_INFORMATION attribute)
  • -
  • ftLastAccessTime (windows.generated_def.winstructs._WIN32_FIND_DATAA attribute) +
  • ftLastAccessTime (windows.generated_def.winstructs._BY_HANDLE_FILE_INFORMATION attribute)
  • -
  • ftLastWriteTime (windows.generated_def.winstructs._WIN32_FIND_DATAA attribute) +
  • ftLastWriteTime (windows.generated_def.winstructs._BY_HANDLE_FILE_INFORMATION attribute)
  • @@ -22431,6 +22507,10 @@
  • GetExtendedUdpTable() (in module windows.generated_def.winfuncs)
  • GetFile() (windows.generated_def.interfaces.IBackgroundCopyError method) +
  • +
  • GetFileInformationByHandle() (in module windows.generated_def.winfuncs) +
  • +
  • GetFileInformationByHandleEx() (in module windows.generated_def.winfuncs)
  • GetFileRanges() (windows.generated_def.interfaces.IBackgroundCopyFile2 method) @@ -22575,11 +22655,11 @@
  • GetIIDAndMethod() (windows.generated_def.interfaces.ICallFrame method)
  • GetIIDFromOBJREF() (windows.generated_def.interfaces.IRpcHelper method) -
  • -
  • GetImplementedClsid() (windows.generated_def.interfaces.IClassClassicInfo method)
  • - + -
  • nFileSizeHigh (windows.generated_def.winstructs._WIN32_FIND_DATAA attribute) +
  • nFileIndexHigh (windows.generated_def.winstructs._BY_HANDLE_FILE_INFORMATION attribute) +
  • +
  • nFileIndexLow (windows.generated_def.winstructs._BY_HANDLE_FILE_INFORMATION attribute) +
  • +
  • nFileSizeHigh (windows.generated_def.winstructs._BY_HANDLE_FILE_INFORMATION attribute)
  • -
  • nFileSizeLow (windows.generated_def.winstructs._WIN32_FIND_DATAA attribute) +
  • nFileSizeLow (windows.generated_def.winstructs._BY_HANDLE_FILE_INFORMATION attribute)
  • @@ -29290,6 +29386,8 @@
  • NMPWAIT_USE_DEFAULT_WAIT (in module windows.generated_def)
  • NMPWAIT_WAIT_FOREVER (in module windows.generated_def) +
  • +
  • nNumberOfLinks (windows.generated_def.winstructs._BY_HANDLE_FILE_INFORMATION attribute)
  • NO_ERROR (in module windows.generated_def)
  • @@ -30778,6 +30876,8 @@
  • pbVal (windows.generated_def.winstructs._ANON_TMP_variant_sub_union attribute)
  • pbValue (windows.generated_def.winstructs.CRYPTCATATTRIBUTE_ attribute) +
  • +
  • PBY_HANDLE_FILE_INFORMATION (class in windows.generated_def.winstructs)
  • PBYTE (class in windows.generated_def.winstructs)
  • @@ -31654,6 +31754,8 @@
  • PFILE_FULL_EA_INFORMATION (class in windows.generated_def.winstructs)
  • PFILE_GET_EA_INFORMATION (class in windows.generated_def.winstructs) +
  • +
  • PFILE_INFO_BY_HANDLE_CLASS (class in windows.generated_def.winstructs)
  • PFILE_INFORMATION_CLASS (class in windows.generated_def.winstructs)
  • @@ -32272,11 +32374,11 @@
  • POBJECTS_AND_NAME_A (class in windows.generated_def.winstructs)
  • POBJECTS_AND_NAME_W (class in windows.generated_def.winstructs) -
  • -
  • POBJECTS_AND_SID (class in windows.generated_def.winstructs)
  • + - -