:py:mod:`os.windows.native_api` =============================== .. py:module:: os.windows.native_api .. autoapi-nested-parse:: Windows Native API (NT) wrappers using ctypes. Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: os.windows.native_api.FileAttribute os.windows.native_api.IOReparseTag os.windows.native_api.Access os.windows.native_api.Share os.windows.native_api.OpenOptions os.windows.native_api.Wait os.windows.native_api.Status os.windows.native_api.IOStatusBlock os.windows.native_api.ReparseGUIDDataBuffer os.windows.native_api.UnicodeString os.windows.native_api.FileTime os.windows.native_api.LargeFileTime os.windows.native_api.FindData os.windows.native_api.FileInfo os.windows.native_api.ObjectInfo os.windows.native_api.ProcessInfo os.windows.native_api.ObjectAttributes os.windows.native_api.NT Attributes ~~~~~~~~~~ .. autoapisummary:: os.windows.native_api.NTSTATUS os.windows.native_api.W32_EPOCH_OFFSET os.windows.native_api.NTException .. py:data:: NTSTATUS .. py:class:: FileAttribute Bases: :py:obj:`ctypes.Structure` list of file attributes constants. .. py:attribute:: READONLY :value: 1 .. py:attribute:: HIDDEN :value: 2 .. py:attribute:: SYSTEM :value: 4 .. py:attribute:: DIRECTORY :value: 16 .. py:attribute:: ARCHIVE :value: 32 .. py:attribute:: DEVICE :value: 64 .. py:attribute:: NORMAL :value: 128 .. py:attribute:: TEMPORARY :value: 256 .. py:attribute:: SPARSE_FILE :value: 512 .. py:attribute:: REPARSE_POINT :value: 1024 .. py:attribute:: COMPRESSED :value: 2048 .. py:attribute:: OFFLINE :value: 4096 .. py:attribute:: NOT_CONTENT_INDEXED :value: 8192 .. py:attribute:: ENCRYPTED :value: 16384 .. py:attribute:: INTEGRITY_STREAM :value: 32768 .. py:attribute:: VIRTUAL :value: 65536 .. py:attribute:: NO_SCRUB_DATA :value: 131072 .. py:attribute:: _fields_ :value: [('attr',)] .. py:method:: __str__() -> str Return string representation of active file attributes. .. py:class:: IOReparseTag Reparse Point Tag constants. This is important to note that symbolic links on Windows are always implemented using reparse points. Nevertheless a reparse point is a more general concept not always associated with the concept of symbolic links. In the present code we are only interested in checking whether a reparse point is a symbolic link or not. Currenly Windows supports two kinds of symbolic links. One for Win32 apps (SYMLINK) and one for WSL subsystem (WSL_SYMLINK). Note that Cygwin now uses the second one to implement symbolic links. Note that WSL symbolic links are not handled correctly by the Python runtime (for example os.path.islink will return False). .. py:attribute:: SYMLINK :value: 2684354572 .. py:attribute:: WSL_SYMLINK :value: 2684354589 .. py:class:: Access Desired Access constants. .. py:attribute:: LIST_DIRECTORY :value: 1 .. py:attribute:: READ_DATA :value: 1 .. py:attribute:: ADD_FILE :value: 2 .. py:attribute:: WRITE_DATA :value: 2 .. py:attribute:: ADD_SUBDIR :value: 4 .. py:attribute:: APPEND_DATA :value: 4 .. py:attribute:: READ_EA :value: 8 .. py:attribute:: WRITE_EA :value: 16 .. py:attribute:: EXECUTE :value: 32 .. py:attribute:: TRAVERSE :value: 32 .. py:attribute:: DELETE_CHILD :value: 64 .. py:attribute:: READ_ATTRS :value: 128 .. py:attribute:: WRITE_ATTRS :value: 256 .. py:attribute:: DELETE :value: 65536 .. py:attribute:: SYNCHRONIZE :value: 1048576 .. py:attribute:: PROCESS_QUERY_INFORMATION :value: 1024 .. py:class:: Share Share Access constants. .. py:attribute:: NOTHING :value: 0 .. py:attribute:: READ :value: 1 .. py:attribute:: WRITE :value: 2 .. py:attribute:: DELETE :value: 4 .. py:attribute:: ALL :value: 7 .. py:class:: OpenOptions File Open options. .. py:attribute:: BACKUP_INTENT :value: 16384 .. py:attribute:: SYNCHRONOUS_IO_NON_ALERT :value: 32 .. py:attribute:: DELETE_ON_CLOSE :value: 4096 .. py:attribute:: OPEN_REPARSE_POINT :value: 2097152 .. py:class:: Wait Constants for WaitFor* functions. .. py:attribute:: OBJECT :value: 0 .. py:attribute:: ABANDONED :value: 128 .. py:attribute:: TIMEOUT :value: 258 .. py:attribute:: FAILED :value: 4294967295 .. py:attribute:: INFINITE :value: 4294967295 .. py:class:: Status Error constants. .. py:attribute:: ACCESS_DENIED :value: 3221225506 .. py:attribute:: OBJECT_NAME_NOT_FOUND :value: 3221225524 .. py:attribute:: OBJECT_PATH_NOT_FOUND :value: 3221225530 .. py:attribute:: SHARING_VIOLATION :value: 3221225539 .. py:attribute:: DELETE_PENDING :value: 3221225558 .. py:attribute:: DIRECTORY_NOT_EMPTY :value: 3221225729 .. py:attribute:: CANNOT_DELETE :value: 3221225761 .. py:attribute:: NO_MORE_FILES :value: 2147483654 .. py:attribute:: msgs :type: ClassVar[dict[int, str]] .. py:class:: IOStatusBlock Bases: :py:obj:`ctypes.Structure` Map IO_STATUS_BLOCK structure. .. py:attribute:: _fields_ :value: [('status',), ('information',)] .. py:class:: ReparseGUIDDataBuffer Bases: :py:obj:`ctypes.Structure` Map Windows REPARSE_GUID_DATA_BUFFER structure. .. py:attribute:: _fields_ :value: [('tag',), ('length',), ('reserved',), ('guid',), ('data',)] .. py:class:: UnicodeString(value: str | None = None, max_length: int = 0) Bases: :py:obj:`ctypes.Structure` Map UNICODE_STRING structure. .. py:attribute:: _fields_ :value: [('length',), ('maximum_length',), ('buffer',)] .. py:method:: __len__() -> int Return the length of the Unicode string. .. py:data:: W32_EPOCH_OFFSET :value: 11644473600 .. py:class:: FileTime(t: datetime.datetime) Bases: :py:obj:`ctypes.Structure` Map FILETIME structure. .. py:property:: filetime :type: int Filetime. .. py:property:: as_datetime :type: datetime.datetime Convert to datetime object. .. py:attribute:: _fields_ :value: [('filetime_low',), ('filetime_high',)] .. py:method:: __str__() -> str Return string representation of file time. .. py:class:: LargeFileTime(t: datetime.datetime) Bases: :py:obj:`ctypes.Structure` Map filetime implemented using LARGE_INTEGER. .. py:property:: as_datetime :type: datetime.datetime Convert to datetime object. .. py:attribute:: _fields_ :value: [('filetime',)] .. py:method:: __str__() -> str Return string representation of large file time. .. py:class:: FindData Bases: :py:obj:`ctypes.Structure` Map Windows WIN32_FIND_DATA structure. .. py:attribute:: _fields_ :value: [('file_attributes',), ('creation_time',), ('last_access_time',), ('last_write_time',),... .. py:class:: FileInfo Declaration of structures returned by QueryInformationFile. .. py:class:: Names File names information class. .. py:attribute:: class_id :value: 12 .. py:class:: ReparsePoint Bases: :py:obj:`ctypes.Structure` Reparse point information structure. .. py:attribute:: _fields_ :value: [('file_reference',), ('tag',)] .. py:attribute:: class_id :value: 33 .. py:class:: Disposition Bases: :py:obj:`ctypes.Structure` File disposition information structure. .. py:attribute:: _fields_ :value: [('delete_file',)] .. py:attribute:: class_id :value: 13 .. py:class:: Internal Bases: :py:obj:`ctypes.Structure` File internal information structure. .. py:attribute:: _fields_ :value: [('index_number',)] .. py:attribute:: class_id :value: 6 .. py:class:: Rename Bases: :py:obj:`ctypes.Structure` File rename information structure. .. py:attribute:: _fields_ :value: [] .. py:attribute:: class_id :value: 10 .. py:class:: Basic Bases: :py:obj:`ctypes.Structure` Basic file information structure. .. py:attribute:: _fields_ :value: [('creation_time',), ('last_access_time',), ('last_write_time',), ('change_time',), ('file_attributes',)] .. py:attribute:: class_id :value: 4 .. py:method:: __str__() -> str Return string representation of basic file information. .. py:class:: ObjectInfo Declaration of structures returned by QueryObjectInformation. .. py:class:: Name Bases: :py:obj:`ctypes.Structure` Object name information structure. .. py:attribute:: _fields_ :value: [] .. py:attribute:: class_id :value: 1 .. py:class:: ProcessInfo Declaration of structure returned by QueryInformationProcess. .. py:class:: Basic Bases: :py:obj:`ctypes.Structure` Basic process information structure. .. py:attribute:: class_id :value: 0 .. py:attribute:: _fields_ :value: [('exit_status',), ('peb',), ('affinity_mask',), ('base_priority',), ('pid',), ('ppid',)] .. py:attribute:: STILL_ACTIVE :value: 259 .. py:class:: ObjectAttributes(name: UnicodeString, parent: ctypes.wintypes.HANDLE | None = None) Bases: :py:obj:`ctypes.Structure` OBJECT_ATTRIBUTES structure. .. py:attribute:: OBJ_CASE_INSENSITIVE :value: 64 .. py:attribute:: _fields_ :value: [('length',), ('root_directory',), ('object_name',), ('attributes',), ('security_descriptor',),... .. py:class:: NT Container for Windows NT API function bindings. .. py:attribute:: FindFirstFile .. py:attribute:: FindClose .. py:attribute:: FsControlFile .. py:attribute:: Sleep .. py:attribute:: GetVolumePathName .. py:attribute:: SetInformationFile .. py:attribute:: QueryInformationFile .. py:attribute:: QueryAttributesFile .. py:attribute:: OpenFile .. py:attribute:: QueryDirectoryFile .. py:attribute:: Close .. py:attribute:: QueryInformationProcess .. py:attribute:: WaitForMultipleObjects .. py:attribute:: OpenProcess .. py:attribute:: QueryObject .. py:method:: init_api() -> None :classmethod: Init api. .. py:exception:: NTExceptionError(status: int, message: str, origin: str | None = None) Bases: :py:obj:`e3.error.E3Error` Exception raised for Windows NT API errors. .. py:method:: __str__() -> str Return string representation of NT exception with status code. .. py:data:: NTException