"""
Auto-generated Python stub file from w32.fileio.py
Module: w32.fileio
"""


import t, c
from stdint import *
import stdio
import w32.win32base
import w32.win32file

class MODE(t.CEnum):
    R = 0
    W = 1
    A = 2
    RP = 3
    WP = 4
    AP = 5
    X = 6
    XP = 7
class FRESULT(t.CEnum):
    OK = 0
    ERR = -1
    ERR_CLOSED = -2
    ERR_PERM = -3
    ERR_IO = -4
    ERR_NOTFOUND = -5

SEEK_SET: t.CDefine = 0
SEEK_CUR: t.CDefine = 1
SEEK_END: t.CDefine = 2
INVALID_SET_FILE_POINTER: t.CDefine = -1
SHARE_READ: t.CDefine = 0x00000001
SHARE_WRITE: t.CDefine = 0x00000002
SHARE_DELETE: t.CDefine = 0x00000004

class File:
    handle: w32.win32base.HANDLE
    closed: bool
    can_read: bool
    can_write: bool
    is_append: bool
    _share_mode: ULONG
    def __init__(self: File, filename: str, mode: ULONG, share: ULONG) -> t.CInt: pass
    def __enter__(self: File) -> 'File' | t.CPtr: pass
    def __exit__(self: File) -> t.CInt: pass
    def read(self: File, buf: bytes, count: ULONG) -> LONG: pass
    def write(self: File, buf: bytes, count: ULONG) -> LONG: pass
    def write_str(self: File, s: str) -> LONG: pass
    def seek(self: File, offset: LONG, origin: ULONG) -> LONG: pass
    def tell(self: File) -> LONG: pass
    def close(self: File) -> LONG: pass
    def flush(self: File) -> LONG: pass
    def size(self: File) -> LONGLONG: pass
    def readline(self: File, buf: bytes, max_count: ULONG) -> LONG: pass
    def read_all(self: File, buf: bytes, max_count: ULONG) -> LONG: pass
class FileW:
    handle: w32.win32base.HANDLE
    closed: bool
    can_read: bool
    can_write: bool
    is_append: bool
    _share_mode: ULONG
    def __init__(self: FileW, filename: w32.win32base.LPCWSTR, mode: ULONG, share: ULONG) -> t.CInt: pass
    def __enter__(self: FileW) -> 'FileW' | t.CPtr: pass
    def __exit__(self: FileW) -> t.CInt: pass
    def read(self: FileW, buf: bytes, count: ULONG) -> LONG: pass
    def write(self: FileW, buf: bytes, count: ULONG) -> LONG: pass
    def write_str(self: FileW, s: str) -> LONG: pass
    def seek(self: FileW, offset: LONG, origin: ULONG) -> LONG: pass
    def tell(self: FileW) -> LONG: pass
    def close(self: FileW) -> LONG: pass
    def flush(self: FileW) -> LONG: pass
    def size(self: FileW) -> LONGLONG: pass
    def readline(self: FileW, buf: bytes, max_count: ULONG) -> LONG: pass
    def read_all(self: FileW, buf: bytes, max_count: ULONG) -> LONG: pass

def open(filename: str, mode: ULONG, share: ULONG) -> File | t.CPtr: pass

def openw(filename: LPCWSTR, mode: ULONG, share: ULONG) -> FileW | t.CPtr: pass
