Skip to content

Commit

Permalink
[test\test_storage.py] Use WinDLL instead of oledll/windll
Browse files Browse the repository at this point in the history
Partially fix enthought#735
  • Loading branch information
moi15moi committed Jan 12, 2025
1 parent a93a571 commit 548661f
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions comtypes/test/test_storage.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from _ctypes import COMError
from ctypes import byref, c_ubyte, POINTER
import contextlib
from pathlib import Path
import unittest
from _ctypes import COMError
from ctypes import HRESULT, POINTER, WinDLL, byref, c_ubyte
from ctypes.wintypes import DWORD, WCHAR
from pathlib import Path

import comtypes
import comtypes.client


Expand All @@ -28,6 +28,11 @@

STG_E_PATHNOTFOUND = -2147287038

_ole32 = WinDLL("ole32")

_StgCreateDocfile = _ole32.StgCreateDocfile
_StgCreateDocfile.argtypes = [POINTER(WCHAR), DWORD, DWORD, POINTER(POINTER(IStorage))]
_StgCreateDocfile.restype = HRESULT

class Test_IStorage(unittest.TestCase):
CREATE_DOC_FLAG = (
Expand All @@ -44,7 +49,7 @@ class Test_IStorage(unittest.TestCase):

def _create_docfile(self) -> IStorage:
stg = POINTER(IStorage)()
comtypes._ole32.StgCreateDocfile(None, self.CREATE_DOC_FLAG, 0, byref(stg))
_StgCreateDocfile(None, self.CREATE_DOC_FLAG, 0, byref(stg))
return stg # type: ignore

def test_CreateStream(self):
Expand Down

0 comments on commit 548661f

Please sign in to comment.