mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-20 13:23:18 -07:00
Move Windows libs to libs/windows
This commit is contained in:
parent
3975aaceb2
commit
3a692c94a5
684 changed files with 4 additions and 1 deletions
35
libs/win/jaraco/windows/reparse.py
Normal file
35
libs/win/jaraco/windows/reparse.py
Normal file
|
@ -0,0 +1,35 @@
|
|||
from __future__ import division
|
||||
|
||||
import ctypes.wintypes
|
||||
|
||||
from .error import handle_nonzero_success
|
||||
from .api import filesystem
|
||||
|
||||
|
||||
def DeviceIoControl(
|
||||
device, io_control_code, in_buffer, out_buffer, overlapped=None):
|
||||
if overlapped is not None:
|
||||
raise NotImplementedError("overlapped handles not yet supported")
|
||||
|
||||
if isinstance(out_buffer, int):
|
||||
out_buffer = ctypes.create_string_buffer(out_buffer)
|
||||
|
||||
in_buffer_size = len(in_buffer) if in_buffer is not None else 0
|
||||
out_buffer_size = len(out_buffer)
|
||||
assert isinstance(out_buffer, ctypes.Array)
|
||||
|
||||
returned_bytes = ctypes.wintypes.DWORD()
|
||||
|
||||
res = filesystem.DeviceIoControl(
|
||||
device,
|
||||
io_control_code,
|
||||
in_buffer, in_buffer_size,
|
||||
out_buffer, out_buffer_size,
|
||||
returned_bytes,
|
||||
overlapped,
|
||||
)
|
||||
|
||||
handle_nonzero_success(res)
|
||||
handle_nonzero_success(returned_bytes)
|
||||
|
||||
return out_buffer[:returned_bytes.value]
|
Loading…
Add table
Add a link
Reference in a new issue