Debian Codegraph @

stubs/calibre_extensions/winutil.pyi

raw
1 from typing import Any
2
3 class Handle:
4 def __init__(self, handle: int | None = None, handle_type: int = 0, associated_name: str | None = None) -> None:
5 "Wrappers for Win32 handles that free the handle on delete automatically"
6 pass
7
8 def close(self) -> None:
9 "Close the underlying Win32 handle now, instead of when this object is deleted"
10 pass
11
12 def detach(self) -> int:
13 "Return the underlying handle as an integer and stop owning it, it will no longer be closed automatically"
14 pass
15
16 def __int__(self) -> int:
17 "Return the underlying handle as an integer"
18 pass
19
20 def __bool__(self) -> bool:
21 "Return False if the underlying handle is NULL"
22 pass
23
24 def __repr__(self) -> str:
25 "Return a representation of this handle, including its type and associated name"
26 pass
27
28 class GUID:
29 def __init__(self, guid_string: str) -> None:
30 "Wrapper for Win32 GUID"
31 pass
32
33 def __repr__(self) -> str:
34 "Return the string form of this GUID, as returned by StringFromIID()"
35 pass
36
37 def run_cmdline(cmdline: str, flags: int, wait_for: int = 0) -> None:
38 "Run the specified command line using CreateProcess(), optionally waiting for it to become idle"
39 pass
40
41 def is_wow64_process() -> bool:
42 "Return True if the current process is a 32-bit process running on 64-bit Windows"
43 pass
44
45 def get_dll_directory() -> str:
46 "Wrapper for GetDllDirectory"
47 pass
48
49 def create_mutex(name: str | None, allow_existing: bool = True, initial_owner: bool = False) -> Handle:
50 "Wrapper for CreateMutex, raises FileExistsError if allow_existing is False and the mutex already exists"
51 pass
52
53 def supports_hardlinks(path: str) -> bool:
54 "Return True if the volume containing path supports hard links"
55 pass
56
57 def filesystem_type_name(path: str) -> str:
58 "Return the name of the filesystem (e.g. NTFS) for the volume containing path"
59 pass
60
61 def get_async_key_state(key: int) -> int:
62 "Wrapper for GetAsyncKeyState"
63 pass
64
65 def create_named_pipe(
66 name: str,
67 open_mode: int,
68 pipe_mode: int,
69 max_instances: int,
70 out_buffer_size: int,
71 in_buffer_size: int,
72 default_time_out: int,
73 ) -> Handle:
74 "Wrapper for CreateNamedPipe"
75 pass
76
77 def connect_named_pipe(handle: Handle) -> None:
78 "Wrapper for ConnectNamedPipe"
79 pass
80
81 def set_handle_information(handle: Handle, mask: int, flags: int) -> None:
82 "Wrapper for SetHandleInformation"
83 pass
84
85 def set_pipe_blocking(handle: Handle, blocking: bool = False) -> None:
86 "Set the specified pipe handle to blocking or non-blocking mode"
87 pass
88
89 def wait_for_single_object(handle: Handle, timeout_ms: int = -1) -> int:
90 "Wrapper for WaitForSingleObject, timeout_ms < 0 means wait forever, raises TimeoutError if the wait times out"
91 pass
92
93 def wait_for_multiple_objects(handles: list[Handle] | tuple[Handle, ...], wait_all: bool = False, timeout_ms: int = -1) -> int:
94 "Wrapper for WaitForMultipleObjects, timeout_ms < 0 means wait forever, raises TimeoutError if the wait times out"
95 pass
96
97 def get_long_path_name(path: str) -> str:
98 "Wrapper for GetLongPathName"
99 pass
100
101 def get_process_times(pid: int | None) -> tuple[int, int, int, int]:
102 "Returns (creation, exit, kernel, user) times as 64-bit integers, for the process with the specified pid, or the current process if pid is None"
103 pass
104
105 def get_handle_information(handle: Handle) -> int:
106 "Wrapper for GetHandleInformation"
107 pass
108
109 def get_last_error() -> int:
110 "Wrapper for GetLastError"
111 pass
112
113 def load_library(path: str, flags: int = 0) -> Handle:
114 "Wrapper for LoadLibraryEx"
115 pass
116
117 def load_icons(handle: Handle, index: int) -> list[tuple[bytes, Handle]]:
118 "Load the icons in the icon group resource at the specified index (or resource id if index is negative) from the specified module handle"
119 pass
120
121 def get_icon_for_file(path: str, width: int = 256, height: int = 256) -> Handle:
122 "Get an icon of the specified size for the specified file, uses IShellItemImageFactory"
123 pass
124
125 def parse_cmdline(cmdline: str) -> tuple[str, ...]:
126 "Parse the specified command line into arguments using CommandLineToArgvW"
127 pass
128
129 def write_file(handle: Handle, data: bytes, offset: int = 0) -> int:
130 "Wrapper for WriteFile, returns the number of bytes written"
131 pass
132
133 def wait_named_pipe(path: str, timeout: int = 0) -> bool:
134 "Wrapper for WaitNamedPipe"
135 pass
136
137 def set_thread_execution_state(new_state: int) -> None:
138 "Wrapper for SetThreadExecutionState"
139 pass
140
141 def known_folder_path(id: GUID, flags: int = 0) -> str:
142 "Wrapper for SHGetKnownFolderPath, id should be one of the FOLDERID_* constants defined in this module"
143 pass
144
145 def get_computer_name(fmt: int = 3) -> str:
146 "Wrapper for GetComputerNameEx, fmt should be one of the ComputerName* constants defined in this module (default ComputerNameDnsFullyQualified)"
147 pass
148
149 def special_folder_path(csidl_id: int, flags: int = 0) -> str:
150 """special_folder_path(csidl_id) -> path
151
152 Get paths to common system folders. See windows documentation of SHGetFolderPath.
153 The paths are returned as unicode objects. csidl_id should be one of the symbolic
154 constants defined in this module. You can also OR a symbolic constant with
155 CSIDL_FLAG_CREATE to force the operating system to create a folder if it does not
156 exist.
157 """
158 pass
159
160 def internet_connected() -> bool:
161 "internet_connected()\n\nReturn True if there is an active internet connection"
162 pass
163
164 def prepare_for_restart() -> None:
165 "prepare_for_restart()\n\nRedirect output streams so that the child process does not lock the temp files"
166 pass
167
168 def getmaxstdio() -> int:
169 "getmaxstdio()\n\nThe maximum number of open file handles."
170 pass
171
172 def setmaxstdio(num: int) -> None:
173 "setmaxstdio(num)\n\nSet the maximum number of open file handles."
174 pass
175
176 def username() -> str:
177 "username()\n\nGet the current username as a unicode string."
178 pass
179
180 def temp_path() -> str:
181 "temp_path()\n\nGet the current temporary dir as a unicode string."
182 pass
183
184 def locale_name() -> str:
185 "locale_name()\n\nGet the current locale name as a unicode string."
186 pass
187
188 def localeconv() -> dict[str, str]:
189 "localeconv()\n\nGet the locale conventions as unicode strings."
190 pass
191
192 def move_file(a: str, b: str, flags: int = 9) -> None:
193 "move_file(a, b, flags)\n\nWrapper for MoveFileEx"
194 pass
195
196 def add_to_recent_docs(path: str, app_id: str | None = None) -> None:
197 "add_to_recent_docs()\n\nAdd a path to the recent documents list"
198 pass
199
200 def file_association(ext: str | None) -> str | None:
201 "file_association()\n\nGet the executable associated with the given file extension"
202 pass
203
204 def friendly_name(prog_id: str | None, exe: str | None) -> str | None:
205 "friendly_name()\n\nGet the friendly name for the specified prog_id/exe"
206 pass
207
208 def notify_associations_changed() -> None:
209 "notify_associations_changed()\n\nNotify the OS that file associations have changed"
210 pass
211
212 def move_to_trash(path: str) -> None:
213 "move_to_trash()\n\nMove the specified path to trash"
214 pass
215
216 def manage_shortcut(path: str, target: str | None, description: str | None, quoted_args: str | None) -> str | None:
217 "manage_shortcut()\n\nManage a shortcut"
218 pass
219
220 def resolve_lnk(path: str, timeout: int = 0, win_id: int | None = None) -> str:
221 "resolve_lnk()\n\nGet the target of a lnk file."
222 pass
223
224 def get_file_id(path: str | None) -> tuple[int, int, int] | None:
225 "get_file_id(path)\n\nGet the windows file id (volume_num, file_index_high, file_index_low)"
226 pass
227
228 def create_file(path: str, desired_access: int, share_mode: int, creation_disposition: int, flags_and_attributes: int) -> Handle:
229 "create_file(path, desired_access, share_mode, creation_disposition, flags_and_attributes)\n\nWrapper for CreateFile"
230 pass
231
232 def get_file_size(handle: Handle) -> int:
233 "get_file_size(handle)\n\nWrapper for GetFileSizeEx"
234 pass
235
236 def set_file_pointer(handle: Handle, pos: int, method: int = 0) -> int:
237 "set_file_pointer(handle, pos, method=FILE_BEGIN)\n\nWrapper for SetFilePointer"
238 pass
239
240 def set_file_handle_delete_on_close(handle: Handle, delete_on_close: bool) -> None:
241 """set_file_handle_delete_on_close(handle, delete_on_close)
242
243 Set the delete on close flag on the specified handle. Note only works if CreateFile()
244 is called with DELETE generic access, and without FILE_FLAG_DELETE_ON_CLOSE.
245 """
246 pass
247
248 def read_file(handle: Handle, chunk_size: int = 16384) -> bytes:
249 "read_file(handle, chunk_size=16KB)\n\nWrapper for ReadFile"
250 pass
251
252 def get_disk_free_space(path: str | None) -> tuple[int, int, int]:
253 "get_disk_free_space(path)\n\nWrapper for GetDiskFreeSpaceEx"
254 pass
255
256 def delete_file(path: str) -> None:
257 "delete_file(path)\n\nWrapper for DeleteFile"
258 pass
259
260 def create_hard_link(path: str, existing_path: str) -> None:
261 "create_hard_link(path, existing_path)\n\nWrapper for CreateHardLink"
262 pass
263
264 def nlinks(path: str) -> int:
265 "nlinks(path)\n\nReturn the number of hardlinks"
266 pass
267
268 def set_file_attributes(path: str, attrs: int = 128) -> None:
269 "set_file_attributes(path, attrs)\n\nWrapper for SetFileAttributes"
270 pass
271
272 def read_directory_changes(handle: Handle, buffer: bytes, subtree: bool, flags: int) -> list[tuple[int, str]]:
273 "read_directory_changes(handle, buffer, subtree, flags)\n\nWrapper for ReadDirectoryChangesW"
274 pass
275
276 def get_processes_using_files(*paths: str) -> list[dict[str, Any]]:
277 "get_processes_using_files(path1, path2, ...)\n\nGet information about processes that have the specified files open."
278 pass
279
280 NormalHandle: int
281 ModuleHandle: int
282 IconHandle: int
283 BitmapHandle: int
284
285 CSIDL_ADMINTOOLS: int
286 CSIDL_APPDATA: int
287 CSIDL_COMMON_ADMINTOOLS: int
288 CSIDL_COMMON_APPDATA: int
289 CSIDL_COMMON_DOCUMENTS: int
290 CSIDL_COOKIES: int
291 CSIDL_FLAG_CREATE: int
292 CSIDL_FLAG_DONT_VERIFY: int
293 CSIDL_FONTS: int
294 CSIDL_HISTORY: int
295 CSIDL_INTERNET_CACHE: int
296 CSIDL_LOCAL_APPDATA: int
297 CSIDL_MYPICTURES: int
298 CSIDL_PERSONAL: int
299 CSIDL_PROGRAM_FILES: int
300 CSIDL_PROGRAM_FILES_COMMON: int
301 CSIDL_SYSTEM: int
302 CSIDL_WINDOWS: int
303 CSIDL_PROFILE: int
304 CSIDL_STARTUP: int
305 CSIDL_COMMON_STARTUP: int
306
307 CREATE_NEW: int
308 CREATE_ALWAYS: int
309 OPEN_EXISTING: int
310 OPEN_ALWAYS: int
311 TRUNCATE_EXISTING: int
312
313 FILE_SHARE_READ: int
314 FILE_SHARE_WRITE: int
315 FILE_SHARE_DELETE: int
316 FILE_SHARE_VALID_FLAGS: int
317
318 FILE_ATTRIBUTE_READONLY: int
319 FILE_ATTRIBUTE_NORMAL: int
320 FILE_ATTRIBUTE_HIDDEN: int
321 FILE_ATTRIBUTE_NOT_CONTENT_INDEXED: int
322 FILE_ATTRIBUTE_OFFLINE: int
323 FILE_ATTRIBUTE_SYSTEM: int
324 FILE_ATTRIBUTE_TEMPORARY: int
325
326 FILE_FLAG_DELETE_ON_CLOSE: int
327 FILE_FLAG_SEQUENTIAL_SCAN: int
328 FILE_FLAG_RANDOM_ACCESS: int
329 FILE_FLAG_BACKUP_SEMANTICS: int
330 FILE_FLAG_OPEN_REPARSE_POINT: int
331
332 GENERIC_READ: int
333 GENERIC_WRITE: int
334 DELETE: int
335
336 FILE_BEGIN: int
337 FILE_CURRENT: int
338 FILE_END: int
339
340 MOVEFILE_COPY_ALLOWED: int
341 MOVEFILE_CREATE_HARDLINK: int
342 MOVEFILE_DELAY_UNTIL_REBOOT: int
343 MOVEFILE_FAIL_IF_NOT_TRACKABLE: int
344 MOVEFILE_REPLACE_EXISTING: int
345 MOVEFILE_WRITE_THROUGH: int
346
347 FILE_NOTIFY_CHANGE_FILE_NAME: int
348 FILE_NOTIFY_CHANGE_DIR_NAME: int
349 FILE_NOTIFY_CHANGE_ATTRIBUTES: int
350 FILE_NOTIFY_CHANGE_SIZE: int
351 FILE_NOTIFY_CHANGE_LAST_WRITE: int
352 FILE_NOTIFY_CHANGE_LAST_ACCESS: int
353 FILE_NOTIFY_CHANGE_CREATION: int
354 FILE_NOTIFY_CHANGE_SECURITY: int
355
356 FILE_ACTION_ADDED: int
357 FILE_ACTION_REMOVED: int
358 FILE_ACTION_MODIFIED: int
359 FILE_ACTION_RENAMED_OLD_NAME: int
360 FILE_ACTION_RENAMED_NEW_NAME: int
361
362 FILE_LIST_DIRECTORY: int
363
364 SHGFP_TYPE_CURRENT: int
365 SHGFP_TYPE_DEFAULT: int
366
367 PIPE_ACCESS_INBOUND: int
368 PIPE_ACCESS_OUTBOUND: int
369 PIPE_ACCESS_DUPLEX: int
370 FILE_FLAG_FIRST_PIPE_INSTANCE: int
371 PIPE_TYPE_BYTE: int
372 PIPE_READMODE_BYTE: int
373 PIPE_WAIT: int
374 PIPE_REJECT_REMOTE_CLIENTS: int
375
376 HANDLE_FLAG_INHERIT: int
377 HANDLE_FLAG_PROTECT_FROM_CLOSE: int
378
379 VK_RMENU: int
380
381 DONT_RESOLVE_DLL_REFERENCES: int
382 LOAD_LIBRARY_AS_DATAFILE: int
383 LOAD_LIBRARY_AS_IMAGE_RESOURCE: int
384
385 INFINITE: int
386 REG_QWORD: int
387
388 ERROR_SUCCESS: int
389 ERROR_MORE_DATA: int
390 ERROR_NO_MORE_ITEMS: int
391 ERROR_FILE_NOT_FOUND: int
392 ERROR_GEN_FAILURE: int
393 ERROR_INSUFFICIENT_BUFFER: int
394 ERROR_BAD_COMMAND: int
395 ERROR_INVALID_DATA: int
396 ERROR_NOT_READY: int
397 ERROR_SHARING_VIOLATION: int
398 ERROR_LOCK_VIOLATION: int
399 ERROR_ALREADY_EXISTS: int
400 ERROR_BROKEN_PIPE: int
401 ERROR_PIPE_BUSY: int
402 ERROR_DIR_NOT_EMPTY: int
403 ERROR_ACCESS_DENIED: int
404 ERROR_NO_DATA: int
405
406 KF_FLAG_DEFAULT: int
407 KF_FLAG_FORCE_APP_DATA_REDIRECTION: int
408 KF_FLAG_RETURN_FILTER_REDIRECTION_TARGET: int
409 KF_FLAG_FORCE_PACKAGE_REDIRECTION: int
410 KF_FLAG_NO_PACKAGE_REDIRECTION: int
411 KF_FLAG_FORCE_APPCONTAINER_REDIRECTION: int
412 KF_FLAG_NO_APPCONTAINER_REDIRECTION: int
413 KF_FLAG_CREATE: int
414 KF_FLAG_DONT_VERIFY: int
415 KF_FLAG_DONT_UNEXPAND: int
416 KF_FLAG_NO_ALIAS: int
417 KF_FLAG_INIT: int
418 KF_FLAG_DEFAULT_PATH: int
419 KF_FLAG_NOT_PARENT_RELATIVE: int
420 KF_FLAG_SIMPLE_IDLIST: int
421 KF_FLAG_ALIAS_ONLY: int
422
423 ComputerNameDnsDomain: int
424 ComputerNameDnsFullyQualified: int
425 ComputerNameDnsHostname: int
426 ComputerNameNetBIOS: int
427 ComputerNamePhysicalDnsDomain: int
428 ComputerNamePhysicalDnsFullyQualified: int
429 ComputerNamePhysicalDnsHostname: int
430 ComputerNamePhysicalNetBIOS: int
431
432 ES_AWAYMODE_REQUIRED: int
433 ES_CONTINUOUS: int
434 ES_DISPLAY_REQUIRED: int
435 ES_SYSTEM_REQUIRED: int
436 ES_USER_PRESENT: int
437
438 WAIT_OBJECT_0: int
439 WAIT_ABANDONED_0: int
440 WAIT_TIMEOUT: int
441 WAIT_FAILED: int
442
443 FOLDERID_AdminTools: GUID
444 FOLDERID_Startup: GUID
445 FOLDERID_RoamingAppData: GUID
446 FOLDERID_RecycleBinFolder: GUID
447 FOLDERID_CDBurning: GUID
448 FOLDERID_CommonAdminTools: GUID
449 FOLDERID_CommonStartup: GUID
450 FOLDERID_ProgramData: GUID
451 FOLDERID_PublicDesktop: GUID
452 FOLDERID_PublicDocuments: GUID
453 FOLDERID_Favorites: GUID
454 FOLDERID_PublicMusic: GUID
455 FOLDERID_CommonOEMLinks: GUID
456 FOLDERID_PublicPictures: GUID
457 FOLDERID_CommonPrograms: GUID
458 FOLDERID_CommonStartMenu: GUID
459 FOLDERID_CommonTemplates: GUID
460 FOLDERID_PublicVideos: GUID
461 FOLDERID_NetworkFolder: GUID
462 FOLDERID_ConnectionsFolder: GUID
463 FOLDERID_ControlPanelFolder: GUID
464 FOLDERID_Cookies: GUID
465 FOLDERID_Desktop: GUID
466 FOLDERID_ComputerFolder: GUID
467 FOLDERID_Fonts: GUID
468 FOLDERID_History: GUID
469 FOLDERID_InternetFolder: GUID
470 FOLDERID_InternetCache: GUID
471 FOLDERID_LocalAppData: GUID
472 FOLDERID_Documents: GUID
473 FOLDERID_Music: GUID
474 FOLDERID_Pictures: GUID
475 FOLDERID_Videos: GUID
476 FOLDERID_NetHood: GUID
477 FOLDERID_PrintersFolder: GUID
478 FOLDERID_PrintHood: GUID
479 FOLDERID_Profile: GUID
480 FOLDERID_ProgramFiles: GUID
481 FOLDERID_ProgramFilesX86: GUID
482 FOLDERID_ProgramFilesCommon: GUID
483 FOLDERID_ProgramFilesCommonX86: GUID
484 FOLDERID_Programs: GUID
485 FOLDERID_Recent: GUID
486 FOLDERID_ResourceDir: GUID
487 FOLDERID_LocalizedResourcesDir: GUID
488 FOLDERID_SendTo: GUID
489 FOLDERID_StartMenu: GUID
490 FOLDERID_System: GUID
491 FOLDERID_SystemX86: GUID
492 FOLDERID_Templates: GUID
493 FOLDERID_Windows: GUID