Skip to content

Commit

Permalink
Add GetTempPathA (#68)
Browse files Browse the repository at this point in the history
* Add GetTempPathA

* Update dll/kernel32.cpp

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

---------

Co-authored-by: Anghelo Carvajal <angheloalf95@gmail.com>
  • Loading branch information
mkst and AngheloAlf authored Feb 10, 2024
1 parent a1b929a commit d71a902
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions dll/kernel32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit d71a902

Please sign in to comment.