Skip to content

Commit be31c06

Browse files
committed
Add comments.
1 parent c43dfa4 commit be31c06

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Lib/test/test_ctypes/test_win32_com_foreign_func.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020

2121
class GUID(ctypes.Structure):
22+
# https://learn.microsoft.com/en-us/windows/win32/api/guiddef/ns-guiddef-guid
2223
_fields_ = [
2324
("Data1", DWORD),
2425
("Data2", WORD),
@@ -64,11 +65,13 @@ def __get__(self, instance, owner=None):
6465

6566
def create_guid(name):
6667
guid = GUID()
68+
# https://learn.microsoft.com/en-us/windows/win32/api/combaseapi/nf-combaseapi-clsidfromstring
6769
ole32.CLSIDFromString(name, byref(guid))
6870
return guid
6971

7072

7173
def is_equal_guid(guid1, guid2):
74+
# https://learn.microsoft.com/en-us/windows/win32/api/objbase/nf-objbase-isequalguid
7275
return ole32.IsEqualGUID(byref(guid1), byref(guid2))
7376

7477

@@ -83,26 +86,33 @@ def is_equal_guid(guid1, guid2):
8386
IID_IPersist = create_guid("{0000010C-0000-0000-C000-000000000046}")
8487
CLSID_ShellLink = create_guid("{00021401-0000-0000-C000-000000000046}")
8588

89+
# https://learn.microsoft.com/en-us/windows/win32/api/unknwn/nf-unknwn-iunknown-queryinterface(refiid_void)
8690
proto_query_interface = ProtoComMethod(
8791
0, HRESULT, POINTER(GUID), POINTER(c_void_p)
8892
)
93+
# https://learn.microsoft.com/en-us/windows/win32/api/unknwn/nf-unknwn-iunknown-addref
8994
proto_add_ref = ProtoComMethod(1, ctypes.c_long)
95+
# https://learn.microsoft.com/en-us/windows/win32/api/unknwn/nf-unknwn-iunknown-release
9096
proto_release = ProtoComMethod(2, ctypes.c_long)
97+
# https://learn.microsoft.com/en-us/windows/win32/api/objidl/nf-objidl-ipersist-getclassid
9198
proto_get_class_id = ProtoComMethod(3, HRESULT, POINTER(GUID))
9299

93100

94101
@unittest.skipUnless(sys.platform == "win32", "Windows-specific test")
95102
class ForeignFunctionsThatWillCallComMethodsTests(unittest.TestCase):
96103
def setUp(self):
104+
# https://learn.microsoft.com/en-us/windows/win32/api/combaseapi/nf-combaseapi-coinitializeex
97105
ole32.CoInitializeEx(None, COINIT_APARTMENTTHREADED)
98106

99107
def tearDown(self):
108+
# https://learn.microsoft.com/en-us/windows/win32/api/combaseapi/nf-combaseapi-couninitialize
100109
ole32.CoUninitialize()
101110
gc.collect()
102111

103112
@staticmethod
104113
def create_shelllink_persist(typ):
105114
ppst = typ()
115+
# https://learn.microsoft.com/en-us/windows/win32/api/combaseapi/nf-combaseapi-cocreateinstance
106116
ole32.CoCreateInstance(
107117
byref(CLSID_ShellLink),
108118
None,

0 commit comments

Comments
 (0)