Add GetTempPathA (#68)

* Add GetTempPathA

* Update dll/kernel32.cpp

Co-authored-by: Anghelo Carvajal <angheloalf95@gmail.com>

---------

Co-authored-by: Anghelo Carvajal <angheloalf95@gmail.com>
This commit is contained in:
Mark Street 2024-02-10 22:09:28 +00:00 committed by GitHub
parent a1b929a413
commit d71a902ace
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 17 additions and 0 deletions

View File

@ -633,6 +633,22 @@ namespace kernel32 {
}
}
DWORD WIN_FUNC GetTempPathA(DWORD nBufferLength, LPSTR lpBuffer) {
DEBUG_LOG("GetTempPathA\n");
if ((nBufferLength == 0) || (lpBuffer == 0)) {
return 0;
}
const char* tmp_dir;
if (!(tmp_dir = getenv("WIBO_TMP_DIR"))) {
tmp_dir = "Z:\\tmp\\";
}
strcpy(lpBuffer, tmp_dir);
return strlen(tmp_dir);
}
struct FILETIME {
unsigned int dwLowDateTime;
unsigned int dwHighDateTime;
@ -2265,6 +2281,7 @@ static void *resolveByName(const char *name) {
if (strcmp(name, "GetFileType") == 0) return (void *) kernel32::GetFileType;
if (strcmp(name, "FileTimeToLocalFileTime") == 0) return (void *) kernel32::FileTimeToLocalFileTime;
if (strcmp(name, "GetFileInformationByHandle") == 0) return (void *) kernel32::GetFileInformationByHandle;
if (strcmp(name, "GetTempPathA") == 0) return (void *) kernel32::GetTempPathA;
// sysinfoapi.h
if (strcmp(name, "GetSystemTime") == 0) return (void *) kernel32::GetSystemTime;