Module win32file
An interface to the win32 File API's
This module includes the tranactional NTFS operations introduced with
Vista. The transacted functions are not wrapped separately, but are invoked by
passing a transaction handle to the corresponding Unicode API function.
This makes it simple to convert a set of file operations into a transaction by
simply adding Transaction=PyHANDLE to the passed arguments.
If Transaction is None, 0, or not specified, the non-transacted API function will
be called.
Functions combined in this manner:
CreateFile / CreateFileTransacted
DeleteFile / DeleteFileTransacted
CreateDirectoryEx / CreateDirectoryTransacted
MoveFileWithProgress / MoveFileTransacted
CopyFileEx / CopyFileTransacted
GetFileAttributes / GetFileAttributesTransacted
SetFileAttributes / SetFileAttributesTransacted
CreateHardLink / CreateHardLinkTransacted
CreateSymbolicLink / CreateSymbolicLinkTransacted
RemoveDirectory / RemoveDirectoryTransacted
Methods
- AreFileApisANSI
- Determines whether a set of Win32 file functions is using the ANSI or OEM character set code page. This function is useful for 8-bit console input and output operations.
- CancelIo
- Cancels pending IO requests for the object.
- CopyFile
- Copies a file
- CopyFileW
- Copies a file
- CreateDirectory
- Creates a directory
- CreateDirectoryW
- Creates a directory
- CreateDirectoryEx
- Creates a directory
- CreateFile
- Creates or opens the a file or other object and returns a handle that can be used to access the object.
- CreateIoCompletionPort
- Can associate an instance of an opened file with a newly created or an existing input/output (I/O) completion port; or it can create an I/O completion port without associating it with a file.
- CreateMailslot
- Creates a mailslot on the local machine
- GetMailslotInfo
- Retrieves information about a mailslot
- SetMailslotInfo
- Sets a mailslot's timeout
- DefineDosDevice
- Lets an application define, redefine, or delete MS-DOS device names.
- DefineDosDeviceW
- Lets an application define, redefine, or delete MS-DOS device names.
- DeleteFile
- Deletes a file.
- DeviceIoControl
- Sends a control code to a device or file system driver
- FindClose
- Closes a find handle.
- FindCloseChangeNotification
- Closes a handle.
- FindFirstChangeNotification
- Creates a change notification handle and sets up initial change notification filter conditions. A wait on a notification handle succeeds when a change matching the filter conditions occurs in the specified directory or subtree.
- FindNextChangeNotification
- Requests that the operating system signal a change notification handle the next time it detects an appropriate change,
- FlushFileBuffers
- Clears the buffers for the specified file and causes all buffered data to be written to the file.
- GetBinaryType
- Determines whether a file is executable, and if so, what type of executable file it is. That last property determines which subsystem an executable file runs under.
- GetDiskFreeSpace
- Determines the free space on a device.
- GetDiskFreeSpaceEx
- Determines the free space on a device.
- GetDriveType
- Determines whether a disk drive is a removable, fixed, CD-ROM, RAM disk, or network drive.
- GetDriveTypeW
- Determines whether a disk drive is a removable, fixed, CD-ROM, RAM disk, or network drive.
- GetFileAttributes
- Determines a files attributes.
- GetFileAttributesW
- Determines a files attributes
- GetFileTime
- Returns a file's creation, last access, and modification times.
- SetFileTime
- Sets the date and time that a file was created, last accessed, or last modified.
- GetFileInformationByHandle
- Retrieves file information for a specified file.
- GetCompressedFileSize
- Determines the compressed size of a file.
- GetFileSize
- Determines the size of a file.
- AllocateReadBuffer
- Allocates a buffer which can be used with an overlapped Read operation using win32file::ReadFile
- ReadFile
- Reads a string from a file
- WriteFile
- Writes a string to a file
- CloseHandle
- Closes an open handle.
- LockFileEx
- Locks a file. Wrapper for LockFileEx win32 API.
- UnlockFileEx
- Unlocks a file. Wrapper for UnlockFileEx win32 API.
- GetQueuedCompletionStatus
- Attempts to dequeue an I/O completion packet from a specified input/output completion port.
- PostQueuedCompletionStatus
- lets you post an I/O completion packet to an I/O completion port. The I/O completion packet will satisfy an outstanding call to the GetQueuedCompletionStatus function.
- GetFileType
- Determines the type of a file.
- GetLogicalDrives
- Returns a bitmaks of the logical drives installed.
- GetOverlappedResult
- Determines the result of the most recent call with an OVERLAPPED object.
- LockFile
- Locks a specified file for exclusive access by the calling process.
- MoveFile
- Renames an existing file or a directory (including all its children).
- MoveFileW
- Renames an existing file or a directory (including all its children).
- MoveFileEx
- Renames an existing file or a directory (including all its children).
- MoveFileExW
- Renames an existing file or a directory (including all its children).
- QueryDosDevice
- Returns the mapping for a device name, or all device names
- ReadDirectoryChangesW
- retrieves information describing the changes occurring within a directory.
- FILE_NOTIFY_INFORMATION
- Decodes a PyFILE_NOTIFY_INFORMATION buffer.
- SetCurrentDirectory
- Sets the current directory.
- SetEndOfFile
- Moves the end-of-file (EOF) position for the specified file to the current position of the file pointer.
- SetFileApisToANSI
- Causes a set of Win32 file functions to use the ANSI character set code page. This function is useful for 8-bit console input and output operations.
- SetFileApisToOEM
- Causes a set of Win32 file functions to use the OEM character set code page. This function is useful for 8-bit console input and output operations.
- SetFileAttributes
- Changes a file's attributes.
- SetFilePointer
- Moves the file pointer of an open file.
- SetVolumeLabel
- Sets a volume label for a disk drive.
- UnlockFile
- Unlocks a region of a file locked by win32file::LockFile or win32file::LockFileEx
- _get_osfhandle
- Gets operating-system file handle associated with existing stream
- _open_osfhandle
- Associates a C run-time file handle with a existing operating-system file handle.
- _setmaxstdio
- Set the maximum allowed number of open stdio handles
- _getmaxstdio
- Returns the maximum number of CRT io streams.
- TransmitFile
- Transmits a file over a socket
TransmitFile(sock, filehandle, bytes_to_write, bytes_per_send, overlap, flags [, (prepend_buf, postpend_buf)])
- ConnectEx
- Version of connect that uses Overlapped I/O
ConnectEx(sock, (addr, port), buf, overlap)
- AcceptEx
- Version of accept that uses Overlapped I/O
- CalculateSocketEndPointSize
- Calculate how many bytes are needed for the connection endpoints data for a socket.
- GetAcceptExSockaddrs
- Parses the connection endpoints from the buffer passed into AcceptEx
- WSAEventSelect
- Specifies an event object to be associated with the supplied set of FD_XXXX network events.
- WSAEnumNetworkEvents
- Return network events that caused the event associated with the socket to be signaled.
- WSAAsyncSelect
- Request windows message notification for the supplied set of FD_XXXX network events.
- WSASend
- Winsock send() equivalent function for Overlapped I/O.
- WSARecv
- Winsock recv() equivalent function for Overlapped I/O.
- BuildCommDCB
- Fills the specified DCB structure with values specified in a device-control string. The device-control string uses the syntax of the mode command
- ClearCommError
- retrieves information about a communications error and reports the current status of a communications device.
- EscapeCommFunction
- directs a specified communications device to perform an extended function.
- GetCommState
- Returns a device-control block (a DCB structure) with the current control settings for a specified communications device.
- SetCommState
- Configures a communications device according to the specifications in a device-control block.
The function reinitializes all hardware and control settings, but it does not empty output or input queues.
- ClearCommBreak
- Restores character transmission for a specified communications device and places the transmission line in a nonbreak state
- GetCommMask
- Retrieves the value of the event mask for a specified communications device.
- SetCommMask
- Sets the value of the event mask for a specified communications device.
- GetCommModemStatus
- Retrieves modem control-register values.
- GetCommTimeouts
- Retrieves the time-out parameters for all read and write operations on a specified communications device.
- SetCommTimeouts
- Sets the time-out parameters for all read and write operations on a specified communications device.
- PurgeComm
- Discards all characters from the output or input buffer of a specified communications resource. It can also terminate pending read or write operations on the resource.
- SetCommBreak
- Suspends character transmission for a specified communications device and places the transmission line in a break state until the win32file::ClearCommBreak function is called.
- SetupComm
- Initializes the communications parameters for a specified communications device.
- TransmitCommChar
- Transmits a specified character ahead of any pending data in the output buffer of the specified communications device.
- WaitCommEvent
- Waits for an event to occur for a specified communications device. The set of events that are monitored by this function is contained in the event mask associated with the device handle.
- SetVolumeMountPoint
- Mounts the specified volume at the specified volume mount point.
- DeleteVolumeMountPoint
- Unmounts the volume from the specified volume mount point.
- GetVolumeNameForVolumeMountPoint
- Returns unique volume name.
- GetVolumePathName
- Returns volume mount point for a path
- GetVolumePathNamesForVolumeName
- Returns mounted paths for a volume
- CreateHardLink
- Establishes an NTFS hard link between an existing file and a new file.
- CreateSymbolicLink
- Creates a symbolic link (reparse point)
- EncryptFile
- Encrypts specified file (requires Win2k or higher and NTFS)
- DecryptFile
- Decrypts specified file (requires Win2k or higher and NTFS)
- EncryptionDisable
- Enables/disables encryption for a directory (requires Win2k or higher and NTFS)
- FileEncryptionStatus
- retrieves the encryption status of the specified file.
- QueryUsersOnEncryptedFile
- Returns list of users for an encrypted file as tuples of (SID, certificate hash blob, display info)
- QueryRecoveryAgentsOnEncryptedFile
- Lists recovery agents for file as a tuple of tuples.
- RemoveUsersFromEncryptedFile
- Removes specified certificates from file - if certificate is not found, it is ignored
- AddUsersToEncryptedFile
- Allows user identified by SID and EFS certificate access to decrypt specified file
- DuplicateEncryptionInfoFile
- Duplicates EFS encryption from one file to another
- BackupRead
- Reads streams of data from a file
- BackupSeek
- Seeks forward in a file stream
- BackupWrite
- Restores file data
- SetFileShortName
- Set the 8.3 name of a file
- CopyFileEx
- Restartable file copy with optional progress routine
- MoveFileWithProgress
- Moves a file, and reports progress to a callback function
- ReplaceFile
- Replaces one file with another
- OpenEncryptedFileRaw
- Initiates a backup or restore operation on an encrypted file
- ReadEncryptedFileRaw
- Reads the encrypted bytes of a file for backup and restore purposes
- WriteEncryptedFileRaw
- Writes raw bytes to an encrypted file
- CloseEncryptedFileRaw
- Frees a context created by win32file::OpenEncryptedFileRaw
- CreateFileW
- Unicode version of CreateFile - see win32file::CreateFile for more information.
- DeleteFileW
- Deletes a file
- GetFileAttributesEx
- Retrieves attributes for a specified file or directory.
- SetFileAttributesW
- Sets a file's attributes
- CreateDirectoryExW
- Creates a directory
- RemoveDirectory
- Removes an existing directory
- FindFilesW
- Retrieves a list of matching filenames, using the Windows Unicode API. An interface to the API FindFirstFileW/FindNextFileW/Find close functions.
- FindFilesIterator
- Returns an interator based on
FindFirstFile/FindNextFile. Similar to win32file::FindFiles
, but
avoids the creation of the list for huge directories.
- FindStreams
- List the data streams for a file
- FindFileNames
- Enumerates hard links that point to specified file
- GetFinalPathNameByHandle
- Returns the file name for an open file handle
- SfcGetNextProtectedFile
- Returns list of protected operating system files
- SfcIsFileProtected
- Checks if a file is protected
- GetLongPathName
- Retrieves the long path for a short path (8.3 filename)
- GetFullPathName
- Returns full path for path passed in
- Wow64DisableWow64FsRedirection
- Disables file system redirection for 32-bit processes running on a 64-bit system
- Wow64RevertWow64FsRedirection
- Reenables file system redirection for 32-bit processes running on a 64-bit system
- GetFileInformationByHandleEx
- Retrieves extended file information for an open file handle.
- SetFileInformationByHandle
- Changes file characteristics by file handle
- ReOpenFile
- Creates a new handle to an open file
- OpenFileById
- Opens a file by File Id or Object Id