"Fossies" - the Fresh Open Source Software Archive

Member "hashcat-6.2.6/deps/LZMA-SDK/C/7zFile.h" (2 Sep 2022, 1771 Bytes) of package /linux/privat/hashcat-6.2.6.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "7zFile.h": 6.2.1_vs_6.2.2.

    1 /* 7zFile.h -- File IO
    2 2021-02-15 : Igor Pavlov : Public domain */
    3 
    4 #ifndef __7Z_FILE_H
    5 #define __7Z_FILE_H
    6 
    7 #ifdef _WIN32
    8 #define USE_WINDOWS_FILE
    9 // #include <windows.h>
   10 #endif
   11 
   12 #ifdef USE_WINDOWS_FILE
   13 #include <windows.h>
   14 #else
   15 // note: USE_FOPEN mode is limited to 32-bit file size
   16 // #define USE_FOPEN
   17 // #include <stdio.h>
   18 #endif
   19 
   20 #include "7zTypes.h"
   21 
   22 EXTERN_C_BEGIN
   23 
   24 /* ---------- File ---------- */
   25 
   26 typedef struct
   27 {
   28   #ifdef USE_WINDOWS_FILE
   29   HANDLE handle;
   30   #elif defined(USE_FOPEN)
   31   FILE *file;
   32   #else
   33   int fd;
   34   #endif
   35 } CSzFile;
   36 
   37 void File_Construct(CSzFile *p);
   38 #if !defined(UNDER_CE) || !defined(USE_WINDOWS_FILE)
   39 WRes InFile_Open(CSzFile *p, const char *name);
   40 WRes OutFile_Open(CSzFile *p, const char *name);
   41 #endif
   42 #ifdef USE_WINDOWS_FILE
   43 WRes InFile_OpenW(CSzFile *p, const WCHAR *name);
   44 WRes OutFile_OpenW(CSzFile *p, const WCHAR *name);
   45 #endif
   46 WRes File_Close(CSzFile *p);
   47 
   48 /* reads max(*size, remain file's size) bytes */
   49 WRes File_Read(CSzFile *p, void *data, size_t *size);
   50 
   51 /* writes *size bytes */
   52 WRes File_Write(CSzFile *p, const void *data, size_t *size);
   53 
   54 WRes File_Seek(CSzFile *p, Int64 *pos, ESzSeek origin);
   55 WRes File_GetLength(CSzFile *p, UInt64 *length);
   56 
   57 
   58 /* ---------- FileInStream ---------- */
   59 
   60 typedef struct
   61 {
   62   ISeqInStream vt;
   63   CSzFile file;
   64   WRes wres;
   65 } CFileSeqInStream;
   66 
   67 void FileSeqInStream_CreateVTable(CFileSeqInStream *p);
   68 
   69 
   70 typedef struct
   71 {
   72   ISeekInStream vt;
   73   CSzFile file;
   74   WRes wres;
   75 } CFileInStream;
   76 
   77 void FileInStream_CreateVTable(CFileInStream *p);
   78 
   79 
   80 typedef struct
   81 {
   82   ISeqOutStream vt;
   83   CSzFile file;
   84   WRes wres;
   85 } CFileOutStream;
   86 
   87 void FileOutStream_CreateVTable(CFileOutStream *p);
   88 
   89 EXTERN_C_END
   90 
   91 #endif