diff options
| author | Yang Liu <liuyang22@iscas.ac.cn> | 2025-06-05 15:43:30 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-05 09:43:30 +0200 |
| commit | e9242b884980187cb2090ae6a589e74da9613311 (patch) | |
| tree | a1a5d294f133e63428a4cbef3e686e70dcdbb1ec /src/include | |
| parent | c5755c8241177c2cc7d95709fa0f0ac42111d141 (diff) | |
| download | box64-e9242b884980187cb2090ae6a589e74da9613311.tar.gz box64-e9242b884980187cb2090ae6a589e74da9613311.zip | |
[WOW64] Added rcfile support (#2708)
* [WOW64] Fixed more compilation warnings * [WOW64] Messing around with file APIs * [WOW64] Added rcfile support * [DOCS] Update rcfile usage on WowBox64
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/fileutils.h | 10 | ||||
| -rw-r--r-- | src/include/os.h | 27 |
2 files changed, 27 insertions, 10 deletions
diff --git a/src/include/fileutils.h b/src/include/fileutils.h index 858c6324..855eb8ff 100644 --- a/src/include/fileutils.h +++ b/src/include/fileutils.h @@ -3,13 +3,6 @@ #include "pathcoll.h" -#define IS_EXECUTABLE (1<<0) -#define IS_FILE (1<<1) - - -// 0 : doesn't exist, 1: Does exist -int FileExist(const char* filename, int flags); - // find a file, using Path if needed, resolving symlinks char* ResolveFile(const char* filename, path_collection_t* paths); // find a file, using Path if needed, NOT resolving symlinks @@ -23,9 +16,6 @@ int FileIsShell(const char* filename); // return temp folder (will return /tmp if nothing is correct) const char* GetTmpDir(void); -// will lower case the string and return a copy. Nothing fancy here, just A..Z transformed to a..z, rest is untouched -char* LowerCase(const char* s); - #if defined(RPI) || defined(RK3399) || defined(RK3326) void sanitize_mojosetup_gtk_background(void); #endif diff --git a/src/include/os.h b/src/include/os.h index f17a9a37..dc3e2c33 100644 --- a/src/include/os.h +++ b/src/include/os.h @@ -8,6 +8,7 @@ #include <dlfcn.h> #include <sys/mman.h> #else +#include <windows.h> typedef __int64 ssize_t; #define dlsym(a, b) NULL @@ -101,4 +102,30 @@ void PrintfFtrace(int prefix, const char* fmt, ...); void* GetEnv(const char* name); +#define IS_EXECUTABLE (1 << 0) +#define IS_FILE (1 << 1) + +// 0 : doesn't exist, 1: does exist. +int FileExist(const char* filename, int flags); + +#ifdef _WIN32 +#define BOXFILE_BUFSIZE 4096 +typedef struct { + HANDLE hFile; + char buffer[BOXFILE_BUFSIZE]; + size_t buf_pos; + size_t buf_size; + int eof; +} BOXFILE; + +BOXFILE* box_fopen(const char* filename, const char* mode); +char* box_fgets(char* str, int num, BOXFILE* stream); +int box_fclose(BOXFILE* stream); +#else +#define BOXFILE FILE +#define box_fopen fopen +#define box_fgets fgets +#define box_fclose fclose +#endif + #endif //__OS_H_ |