mirror of
https://github.com/hakril/PythonForWindows
synced 2026-06-08 14:31:45 +00:00
Small COM fix/improvements
This commit is contained in:
@@ -69,12 +69,22 @@ class TypeInfo(interfaces.ITypeInfo):
|
||||
self.GetDocumentation(id, res, None, None, None)
|
||||
return res
|
||||
|
||||
|
||||
class MemoryIStream(gdef.IStream):
|
||||
@classmethod
|
||||
def create(cls):
|
||||
self = cls()
|
||||
windows.winproxy.CreateStreamOnHGlobal(ppstm=self)
|
||||
return self
|
||||
|
||||
def create_instance(clsiid, targetinterface, custom_iid=None, context=CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER):
|
||||
"""A simple wrapper around ``CoCreateInstance <https://msdn.microsoft.com/en-us/library/windows/desktop/ms686615(v=vs.85).aspx>``"""
|
||||
if custom_iid is None:
|
||||
custom_iid = targetinterface.IID
|
||||
if isinstance(clsiid, basestring):
|
||||
clsiid = IID.from_string(clsiid)
|
||||
if isinstance(custom_iid, basestring):
|
||||
custom_iid = IID.from_string(custom_iid)
|
||||
winproxy.CoCreateInstance(byref(clsiid), None, context, byref(custom_iid), byref(targetinterface))
|
||||
return targetinterface
|
||||
|
||||
|
||||
@@ -238,6 +238,8 @@ class SymbolType(object):
|
||||
@property
|
||||
def children(self):
|
||||
count = self.nb_children
|
||||
if count is None:
|
||||
return None
|
||||
class res_struct(ctypes.Structure):
|
||||
_fields_ = [("Count", gdef.ULONG), ("Start", gdef.ULONG), ("Types", (gdef.ULONG * count))]
|
||||
x = res_struct()
|
||||
@@ -520,7 +522,7 @@ class SymbolHandler(object):
|
||||
else:
|
||||
callback = ctypes.WINFUNCTYPE(gdef.BOOL, ctypes.POINTER(SymbolInfo), gdef.ULONG , ctypes.py_object)(callback)
|
||||
|
||||
addr = getattr(mod, "addr", mod) # Retrieve mod.addr, else us the value directly
|
||||
addr = getattr(mod, "addr", mod) # Retrieve mod.addr, else use the value directly
|
||||
windows.winproxy.SymSearchW(self.handle, gdef.DWORD64(addr), 0, tag, mask, 0, callback, res, options)
|
||||
for sym in res:
|
||||
sym.resolver = self
|
||||
|
||||
@@ -218,6 +218,7 @@ SPECIFIC_ACCESS_RIGTH_BY_TYPE = {
|
||||
"callback": CALLBACK_ACCESS_RIGHT,
|
||||
"mutant": MUTANT_ACCESS_RIGHT,
|
||||
"event": EVENT_ACCESS_RIGHT,
|
||||
"section": SECTION_ACCESS_RIGHT,
|
||||
"semaphore": SEMAPHORE_ACCESS_RIGHT,
|
||||
"io_completion": IO_COMPLETION_ACCESS_RIGHT,
|
||||
"port": PORT_ACCESS_RIGHT,
|
||||
|
||||
Reference in New Issue
Block a user