@@ -78,6 +78,19 @@ def is_equal_guid(guid1, guid2):
7878)
7979
8080
81+ def  create_shelllink_persist (typ ):
82+     ppst  =  typ ()
83+     # https://learn.microsoft.com/en-us/windows/win32/api/combaseapi/nf-combaseapi-cocreateinstance 
84+     ole32 .CoCreateInstance (
85+         byref (CLSID_ShellLink ),
86+         None ,
87+         CLSCTX_SERVER ,
88+         byref (IID_IPersist ),
89+         byref (ppst ),
90+     )
91+     return  ppst 
92+ 
93+ 
8194class  ForeignFunctionsThatWillCallComMethodsTests (unittest .TestCase ):
8295    def  setUp (self ):
8396        # https://learn.microsoft.com/en-us/windows/win32/api/combaseapi/nf-combaseapi-coinitializeex 
@@ -88,19 +101,6 @@ def tearDown(self):
88101        ole32 .CoUninitialize ()
89102        gc .collect ()
90103
91-     @staticmethod  
92-     def  create_shelllink_persist (typ ):
93-         ppst  =  typ ()
94-         # https://learn.microsoft.com/en-us/windows/win32/api/combaseapi/nf-combaseapi-cocreateinstance 
95-         ole32 .CoCreateInstance (
96-             byref (CLSID_ShellLink ),
97-             None ,
98-             CLSCTX_SERVER ,
99-             byref (IID_IPersist ),
100-             byref (ppst ),
101-         )
102-         return  ppst 
103- 
104104    def  test_without_paramflags_and_iid (self ):
105105        class  IUnknown (c_void_p ):
106106            QueryInterface  =  proto_query_interface ()
@@ -110,7 +110,7 @@ class IUnknown(c_void_p):
110110        class  IPersist (IUnknown ):
111111            GetClassID  =  proto_get_class_id ()
112112
113-         ppst  =  self . create_shelllink_persist (IPersist )
113+         ppst  =  create_shelllink_persist (IPersist )
114114
115115        clsid  =  GUID ()
116116        hr_getclsid  =  ppst .GetClassID (byref (clsid ))
@@ -142,7 +142,7 @@ class IUnknown(c_void_p):
142142        class  IPersist (IUnknown ):
143143            GetClassID  =  proto_get_class_id (((OUT , "pClassID" ),))
144144
145-         ppst  =  self . create_shelllink_persist (IPersist )
145+         ppst  =  create_shelllink_persist (IPersist )
146146
147147        clsid  =  ppst .GetClassID ()
148148        self .assertEqual (TRUE , is_equal_guid (CLSID_ShellLink , clsid ))
@@ -167,7 +167,7 @@ class IUnknown(c_void_p):
167167        class  IPersist (IUnknown ):
168168            GetClassID  =  proto_get_class_id (((OUT , "pClassID" ),), IID_IPersist )
169169
170-         ppst  =  self . create_shelllink_persist (IPersist )
170+         ppst  =  create_shelllink_persist (IPersist )
171171
172172        clsid  =  ppst .GetClassID ()
173173        self .assertEqual (TRUE , is_equal_guid (CLSID_ShellLink , clsid ))
0 commit comments