Hello,
I'm trying to use the lib to format a USB Disk connected to my PC. I began by doing everything manually, but already got some problems. disk.is_offline() fails with:
Traceback (most recent call last):
File "", line 1, in
File "C:\bruno\dls_testbench\venv_385\lib\site-packages\infi\diskmanagement\disk__init.py", line 460, in is_offline
return self._io.ioctl_disk_get_disk_attributes().Attributes & constants.DISK_ATTRIBUTE_OFFLINE
File "C:\bruno\dls_testbench\venv_385\lib\site-packages\infi\diskmanagement\ioctl__init.py", line 129, in ioctl_disk_get_disk_attributes
self.ioctl(infi.wioctl.constants.IOCTL_DISK_GET_DISK_ATTRIBUTES, 0, 0, buffer, size)
File "C:\bruno\dls_testbench\venv_385\lib\site-packages\infi\wioctl\init__.py", line 40, in ioctl
with self.open_handle() as handle:
File "C:\Python\WPy64-3850\python-3.8.5.amd64\lib\contextlib.py", line 113, in enter
return next(self.gen)
File "C:\bruno\dls_testbench\venv_385\lib\site-packages\infi\wioctl__init__.py", line 36, in open_handle
with open_handle(self.device_path, self._open_generic, self._open_shared) as handle:
File "C:\Python\WPy64-3850\python-3.8.5.amd64\lib\contextlib.py", line 113, in enter
return next(self.gen)
File "C:\bruno\dls_testbench\venv_385\lib\site-packages\infi\wioctl\init.py", line 12, in open_handle
handle = api.CreateFileW(ctypes.create_unicode_buffer(device_path),
File "C:\bruno\dls_testbench\venv_385\lib\site-packages\infi\cwrap\init.py", line 138, in new__
return_value = function(*args[1:], **kwargs)
File "C:\bruno\dls_testbench\venv_385\lib\site-packages\infi\wioctl\api.py", line 16, in errcheck
raise InvalidHandle(last_error)
infi.wioctl.errors.InvalidHandle: 5, Access is denied.
Also this
infi\diskmanagement\ioctl__init__.py @ line 128
buffer = ctypes.c_buffer('\x00' * size, size)
doesn't work and I changed to
buffer = ctypes.create_string_buffer(bytes('\x00' * size, encoding='ascii'), size)
Hello, I'm trying to use the lib to format a USB Disk connected to my PC. I began by doing everything manually, but already got some problems. disk.is_offline() fails with:
Also this
buffer = ctypes.c_buffer('\x00' * size, size)
doesn't work and I changed tobuffer = ctypes.create_string_buffer(bytes('\x00' * size, encoding='ascii'), size)