Commit 25868cb2 by rfkelly0

dokan: basic outputting of file/directory attributes

parent ab0c29e9
"""
fs.expose.dokan.dokan_ctypes: low-level ctypes interface to Dokan
"""
from ctypes import * from ctypes import *
try: try:
DokanMain = windll.Dokan.DokanMain DokanMain = windll.Dokan.DokanMain
DokanVersion = windll.Dokan.DokanVersion
except AttributeError: except AttributeError:
raise ImportError("Dokan DLL not found") raise ImportError("Dokan DLL not found")
...@@ -15,6 +21,13 @@ UCHAR = c_ubyte ...@@ -15,6 +21,13 @@ UCHAR = c_ubyte
LPDWORD = POINTER(DWORD) LPDWORD = POINTER(DWORD)
LONGLONG = c_longlong LONGLONG = c_longlong
DokanVersion.restype = ULONG
DokanVersion.argtypes = ()
if DokanVersion() < 0: # TODO: find min supported version
raise ImportError("Dokan DLL is too old")
MAX_PATH = 260 MAX_PATH = 260
class FILETIME(Structure): class FILETIME(Structure):
...@@ -197,7 +210,9 @@ class DokanOperations(object): ...@@ -197,7 +210,9 @@ class DokanOperations(object):
try: try:
setattr(self.buffer,nm,typ(getattr(self,nm))) setattr(self.buffer,nm,typ(getattr(self,nm)))
except AttributeError: except AttributeError:
setattr(self.buffer,nm,typ(self._noop)) #setattr(self.buffer,nm,typ(self._noop))
# This bizarre syntax creates a NULL function pointer.
setattr(self.buffer,nm,typ())
def _noop(self,*args): def _noop(self,*args):
return -1 return -1
...@@ -226,12 +241,6 @@ DokanUnmount.argtypes = ( ...@@ -226,12 +241,6 @@ DokanUnmount.argtypes = (
BOOL, # ignore case BOOL, # ignore case
) )
DokanVersion = windll.Dokan.DokanVersion
DokanVersion.restype = ULONG
DokanVersion.argtypes = (
)
DokanDriverVersion = windll.Dokan.DokanDriverVersion DokanDriverVersion = windll.Dokan.DokanDriverVersion
DokanDriverVersion.restype = ULONG DokanDriverVersion.restype = ULONG
DokanDriverVersion.argtypes = ( DokanDriverVersion.argtypes = (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment