Skip to content

Commit db14bc0

Browse files
committed
Small COM fix/improvements
1 parent 979f7ec commit db14bc0

3 files changed

Lines changed: 14 additions & 1 deletion

File tree

windows/com.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,22 @@ def docu(self, id):
6969
self.GetDocumentation(id, res, None, None, None)
7070
return res
7171

72+
73+
class MemoryIStream(gdef.IStream):
74+
@classmethod
75+
def create(cls):
76+
self = cls()
77+
windows.winproxy.CreateStreamOnHGlobal(ppstm=self)
78+
return self
79+
7280
def create_instance(clsiid, targetinterface, custom_iid=None, context=CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER):
7381
"""A simple wrapper around ``CoCreateInstance <https://msdn.microsoft.com/en-us/library/windows/desktop/ms686615(v=vs.85).aspx>``"""
7482
if custom_iid is None:
7583
custom_iid = targetinterface.IID
7684
if isinstance(clsiid, basestring):
7785
clsiid = IID.from_string(clsiid)
86+
if isinstance(custom_iid, basestring):
87+
custom_iid = IID.from_string(custom_iid)
7888
winproxy.CoCreateInstance(byref(clsiid), None, context, byref(custom_iid), byref(targetinterface))
7989
return targetinterface
8090

windows/debug/symbols.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,8 @@ def address(self):
238238
@property
239239
def children(self):
240240
count = self.nb_children
241+
if count is None:
242+
return None
241243
class res_struct(ctypes.Structure):
242244
_fields_ = [("Count", gdef.ULONG), ("Start", gdef.ULONG), ("Types", (gdef.ULONG * count))]
243245
x = res_struct()
@@ -520,7 +522,7 @@ def search(self, mask, mod=0, tag=0, options=gdef.SYMSEARCH_ALLITEMS, callback=N
520522
else:
521523
callback = ctypes.WINFUNCTYPE(gdef.BOOL, ctypes.POINTER(SymbolInfo), gdef.ULONG , ctypes.py_object)(callback)
522524

523-
addr = getattr(mod, "addr", mod) # Retrieve mod.addr, else us the value directly
525+
addr = getattr(mod, "addr", mod) # Retrieve mod.addr, else use the value directly
524526
windows.winproxy.SymSearchW(self.handle, gdef.DWORD64(addr), 0, tag, mask, 0, callback, res, options)
525527
for sym in res:
526528
sym.resolver = self

windows/security.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@
218218
"callback": CALLBACK_ACCESS_RIGHT,
219219
"mutant": MUTANT_ACCESS_RIGHT,
220220
"event": EVENT_ACCESS_RIGHT,
221+
"section": SECTION_ACCESS_RIGHT,
221222
"semaphore": SEMAPHORE_ACCESS_RIGHT,
222223
"io_completion": IO_COMPLETION_ACCESS_RIGHT,
223224
"port": PORT_ACCESS_RIGHT,

0 commit comments

Comments
 (0)