Skip to content

Commit

Permalink
[test\test_storage.py] Use OleDLL instead of oledll (#790)
Browse files Browse the repository at this point in the history
  • Loading branch information
moi15moi authored Feb 2, 2025
1 parent 88e0e6a commit 1a66805
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions comtypes/test/test_storage.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from _ctypes import COMError
from ctypes import byref, c_ubyte, POINTER
import contextlib
from ctypes import HRESULT, OleDLL, byref, c_ubyte, POINTER
from ctypes.wintypes import DWORD, PWCHAR
from pathlib import Path
import contextlib
import unittest

import comtypes
Expand Down Expand Up @@ -29,6 +30,13 @@
STG_E_PATHNOTFOUND = -2147287038


_ole32 = OleDLL("ole32")

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


class Test_IStorage(unittest.TestCase):
CREATE_DOC_FLAG = (
STGM_DIRECT
Expand All @@ -44,7 +52,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 1a66805

Please # to comment.