pyfilesystem icon indicating copy to clipboard operation
pyfilesystem copied to clipboard

dokan unmount failed on windows7

Open Pagliacii opened this issue 8 years ago • 11 comments

OS: windows7 x64 Python: 2.7(32bit) Pyfilesystem: 0.5.5a1 Dokan: 1.0.3 x64

>>> from fs.expose import dokan
>>> from fs.memoryfs import MemoryFS
>>> memfs = MemoryFS()
>>> dokan.mount(memfs, 'Q:\\')
<fs.expose.dokan.MountProcess object at 0x02784350>
>>> dokan.unmount('Q:\\')
Traceback (most recent call last):
  File "<string>", line 3, in <module>
  File "C:\Python27\lib\site-packages\fs\expose\dokan\__init__.py", line 1107, in _do_mount
    mount(fs, path, **opts)
  File "C:\Python27\lib\site-packages\fs\expose\dokan\__init__.py", line 1009, in mount
    res = libdokan.DokanMain(ctypes.byref(opts), ctypes.byref(opstruct))
WindowsError: exception: access violation reading 0x0000004A
>>>

Anything wrong?

Pagliacii avatar Sep 15 '17 02:09 Pagliacii

@Liryna Do you have a clue?

Rondom avatar Sep 15 '17 10:09 Rondom

@Pagliacii @Rondom need to see if the correct dokan1.dll x86 is used since python 32bit is used here. I used the same code and never faced this 😢 otherwise would need more log to see what is happening.

Liryna avatar Sep 15 '17 11:09 Liryna

The dokan x86 could not be installed on x64 PC. When I use dokan.unmount in python 64 bit, it worked correctly.

Pagliacii avatar Sep 15 '17 12:09 Pagliacii

@Pagliacii Good to know it worked ! In case of, the x86 dokan1.dll is in the x64 package under the folder C:\Program Files\Dokan\ x86

Liryna avatar Sep 15 '17 19:09 Liryna

@Liryna Okay, I will try it next Monday! Thanks for your help!

Pagliacii avatar Sep 16 '17 02:09 Pagliacii

But then things should either work when it finds the DLL or not work when it does not find the DLL. If it crashes, it is a bug, isn't it?

Rondom avatar Sep 16 '17 08:09 Rondom

DLL has to be a side to side to the python project.

If it does not find it, there is an error at the start. If a dll is found x86 / x64, it will run. But if a different arch (python / dll) is used, you will get a crash at a moment.

I do not know if there is a way for python to tell if the dll is x86 or x64 before to load it.

Liryna avatar Sep 16 '17 09:09 Liryna

@Liryna How could I tell the python 32bit to find the x86 dokan1.dll? By the environment variable DokanLibrary1?

In my computer, I try to set the DokanLibrary1 as 'C:\Program Files\Dokan\x86', but it raised the windows error again.

And it could work correctly in python 64 bit.

>>> os.environ['DokanLibrary1']
'C:\\Program Files\\Dokan\\x86'

Pagliacii avatar Sep 18 '17 02:09 Pagliacii

@Liryna The access violation reading error happened when I try to unmount the virtual disk on python 32 bit with the x86 dokan1.dll in win7 x86.

I don't have another x86 pc to test the unmount, so I not sure that something wrong in x86 dokan1.dll.

Pagliacii avatar Sep 22 '17 01:09 Pagliacii

😢 would be interesting to know what is happening.

Liryna avatar Sep 22 '17 07:09 Liryna

I'm not familiar with the ctypes module, so I don't have any idea.

Pagliacii avatar Sep 22 '17 16:09 Pagliacii