uLib  User mode C/C++ extended API library for Win32 programmers.
IoUtil.cpp File Reference
#include <uLib/Common.h>
#include <uLib/UtilFunc.h>
#include <uLib/Debug.h>
#include <uLib/StrFunc.h>
#include <uLib/NtFunc.h>
#include <uLib/_Internal.h>

Go to the source code of this file.

Classes

struct  PMappedFile
 

Macros

#define _TraceFmt   _F("Skip '%S' prefix --> '%S'\n")
 
#define _WRSTR_BUFLEN   512
 
#define IsConsoleHandle(h)   (( ULONG_PTR(h) & 0x10000003 ) == 0x3 )
 

Functions

bool FileExist (CSTR pathName)
 
bool DirExist (CSTR pathName)
 
bool IsDir (LPWIN32_FIND_DATA pFd)
 
bool IsSubdirName (CSTR Dir)
 
bool IsSubdir (LPWIN32_FIND_DATA pFd)
 
CSTR GetTempPathName (CSTR Prefix, CSTR dotExt)
 
bool GetWin32FileData (CSTR PathName, LPWIN32_FIND_DATA pFd)
 
ACSTR SkipPathPrefixA (ACSTR PathName)
 
WCSTR SkipPathPrefixW (WCSTR PathName)
 
bool GetFileInformationByName (CSTR FileName, LPBY_HANDLE_FILE_INFORMATION pInfo)
 
bool GetVolumeGuidOfShare (IN CSTR ShareName, OUT TSTR VolGuid, WORD ccGuid, OPTOUT TSTR DosDrv, WORD ccDrv)
 
bool GetVolumeGuidOfDevice (IN CSTR DevName, OUT TSTR VolGuid, WORD ccGuid, OPTOUT TSTR DosDrv, WORD ccDrv)
 
UINT64 GetFilePos (HANDLE hFile)
 
UINT64 SetFilePos (HANDLE hFile, INT64 Offset, UINT How)
 
bool Seek (HANDLE hFile, LONG Offs, DWORD How)
 
UINT Tell (HANDLE hFile)
 
UINT64 GetFileSize64 (HANDLE hFile)
 
UINT64 GetFileSize64Ex (CSTR FName)
 
UINT64 GetFileSizeByName (CSTR FName)
 
HANDLE OpenDirectory (CSTR DirPath, DWORD Flags)
 
bool IsEndOfFile (HANDLE hFile)
 
UINT PeekFile (HANDLE hFile, PVOID Buf, UINT nBytes)
 
UINT BlockRead (HANDLE hFile, PVOID Buf, UINT nBytes)
 
UINT BlockWrite (HANDLE hFile, PVOID Buf, UINT nBytes)
 
BOOL WriteLine (HANDLE hFile, CSTR Buf, UINT ccBuf)
 
UINT __cdecl WriteStrA (HANDLE hFile, IN const char *Fmt,...)
 
UINT __cdecl WriteStrW (HANDLE hFile, const wchar_t *Fmt,...)
 
UINT ReadLineA (HANDLE hFile, char *Buffer, UINT BufSize, bool TrimCrLf)
 
UINT ReadLineW (HANDLE hFile, wchar_t *Buffer, UINT BufLength, bool TrimCrLf)
 
TSTR GetPathFileName (TSTR PathName)
 
UINT GetFileNameFromHandle (HANDLE hFile, TSTR Buffer, UINT BufLen)
 
UINT GetNtDeviceName (HANDLE hObj, TSTR pzNTPath, UINT ccNTPath)
 
DWORD GetDosNameFromNtDeviceName (CSTR NtName, TSTR DosName, UINT ccDosName)
 
END_STRSAFE_OVERRIDE UINT DevicePathToDosPath (IN CSTR DevPath, OUT TSTR PathBuf, UINT ccPathBuf)
 
CSTR ChangeDirectory (CSTR Dir)
 
CSTR DoneDirectory (CSTR oldDir)
 
bool FindMoreFiles (HANDLE hFind, WIN32_FIND_DATA *Found, BYTE nTries, BYTE msWait)
 
HANDLE FindCloseEx (HANDLE hFind)
 
UINT EnumerateFileStreams (CSTR FileName, PFnEnumStreams Action, PVOID usrData)
 
HMAPFILE LoadAndMapFile (CSTR FName, DWORD PageAccess, PBYTE *ppData)
 
BOOL UnloadMappedFile (HMAPFILE hMap)
 
PVOID GetMappedFilePointer (HMAPFILE hMap)
 
UINT64 GetMappedFileSize (HMAPFILE hMap)
 
size_t PeekMappedFile (HMAPFILE hMapFile, PVOID Buffer, size_t cbRead)
 
size_t ReadMappedFile (HMAPFILE hMapFile, PVOID Buffer, size_t cbRead)
 
size_t WriteMappedFile (HMAPFILE hMapFile, PVOID Buffer, size_t cbWrite)
 
PBYTE GetMappedFilePtr (HMAPFILE hMapFile)
 
PBYTE SetMappedFilePtr (HMAPFILE hMapFile, INT64 Offset, UINT How)
 
UINT64 GetMappedFilePos (HMAPFILE hMapFile)
 
UINT64 SetMappedFilePos (HMAPFILE hMapFile, INT64 Offset, UINT How)
 

Class Documentation

◆ MappedFile

struct MappedFile

Definition at line 1136 of file IoUtil.cpp.

Class Members
HANDLE hFile
UINT64 cbFile
HANDLE hMap
PBYTE pMap
PBYTE pCurr

Macro Definition Documentation

◆ _TraceFmt

#define _TraceFmt   _F("Skip '%S' prefix --> '%S'\n")

◆ _WRSTR_BUFLEN

#define _WRSTR_BUFLEN   512

Definition at line 477 of file IoUtil.cpp.

◆ IsConsoleHandle

#define IsConsoleHandle (   h)    (( ULONG_PTR(h) & 0x10000003 ) == 0x3 )

Definition at line 843 of file IoUtil.cpp.

Function Documentation

◆ WriteStrA()

UINT __cdecl WriteStrA ( HANDLE  hFile,
IN const char *  Fmt,
  ... 
)

Definition at line 479 of file IoUtil.cpp.

◆ GetFileNameFromHandle()

UINT GetFileNameFromHandle ( HANDLE  hFile,
TSTR  Buffer,
UINT  BufLen 
)

GetFullFilePath gets, or checks, a file's full path name. If FileName contains no path, SearchPath is used to find the absolute path. If FileName contains a path, it checks FileExist and copies filepath verbatim.

Returns
Nr of chars copied to the caller's PathBuf.

Definition at line 660 of file IoUtil.cpp.

◆ GetNtDeviceName()

UINT GetNtDeviceName ( HANDLE  hObj,
TSTR  pzNTPath,
UINT  ccNTPath 
)

Definition at line 845 of file IoUtil.cpp.

◆ GetDosNameFromNtDeviceName()

DWORD GetDosNameFromNtDeviceName ( CSTR  NtName,
TSTR  DosName,
UINT  ccDosName 
)

Definition at line 909 of file IoUtil.cpp.

◆ FindMoreFiles()

bool FindMoreFiles ( HANDLE  hFind,
WIN32_FIND_DATA *  Found,
BYTE  nTries,
BYTE  msWait 
)

Definition at line 1048 of file IoUtil.cpp.