From 3903f3de80242752e168f556da572d70470236f8 Mon Sep 17 00:00:00 2001 From: Florian Roth Date: Sun, 3 Jan 2021 14:16:04 +0100 Subject: [PATCH] refactor: changed temp context firectory https://github.com/Neo23x0/Raccine/issues/116 --- source/Raccine/Version.h | 10 +++++----- source/RaccineLib/Raccine.h | 2 +- source/RaccineLib/raccine.cpp | 6 ++++++ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/source/Raccine/Version.h b/source/Raccine/Version.h index bbdae9c..4b5dad1 100644 --- a/source/Raccine/Version.h +++ b/source/Raccine/Version.h @@ -1,16 +1,16 @@ #ifndef VERSIONINFO_H #define VERSIONINFO_H -#define VER_FILEVERSION 1,4,1,0 -#define VER_FILEVERSION_STR "1.4.1.0 BETA\0" +#define VER_FILEVERSION 1,4,2,0 +#define VER_FILEVERSION_STR "1.4.2.0 BETA\0" -#define VER_PRODUCTVERSION 1,4,1,0 -#define VER_PRODUCTVERSION_STR "1.4.1.0\0" +#define VER_PRODUCTVERSION 1,4,2,0 +#define VER_PRODUCTVERSION_STR "1.4.2.0\0" #define VER_COMPANYNAME_STR "Raccine" #define VER_FILEDESCRIPTION_STR "A Simple Ransomware Vaccine - see https://github.com/Neo23x0/Raccine" #define VER_INTERNALNAME_STR "Raccine" -#define VER_LEGALCOPYRIGHT_STR "Copyright 2020" +#define VER_LEGALCOPYRIGHT_STR "Copyright 2021" #define VER_LEGALTRADEMARKS1_STR "All Rights Reserved" #define VER_LEGALTRADEMARKS2_STR VER_LEGALTRADEMARKS1_STR #define VER_ORIGINALFILENAME_STR "Raccine.exe" diff --git a/source/RaccineLib/Raccine.h b/source/RaccineLib/Raccine.h index 6640998..a9ea55f 100644 --- a/source/RaccineLib/Raccine.h +++ b/source/RaccineLib/Raccine.h @@ -25,7 +25,7 @@ #define RACCINE_DATA_DIRECTORY L"%PROGRAMDATA%\\Raccine" #define RACCINE_YARA_DIRECTORY L"%PROGRAMFILES%\\Raccine\\yara" #define RACCINE_PROGRAM_DIRECTORY L"%PROGRAMFILES%\\Raccine" -#define RACCINE_USER_CONTEXT_DIRECTORY L"%TEMP%\\RaccineUserContext" +#define RACCINE_USER_CONTEXT_DIRECTORY L"%PROGRAMDATA%\\Raccine\\RaccineUserContext\\%USERNAME%" /// diff --git a/source/RaccineLib/raccine.cpp b/source/RaccineLib/raccine.cpp index fbcdcc2..bc4d949 100644 --- a/source/RaccineLib/raccine.cpp +++ b/source/RaccineLib/raccine.cpp @@ -52,6 +52,12 @@ bool EvaluateYaraRules(const RaccineConfig& raccine_config, ExpandEnvironmentStringsW(RACCINE_USER_CONTEXT_DIRECTORY, wTestFilename, ARRAYSIZE(wTestFilename) - 1); + if (std::filesystem::create_directories(wTestFilename) == false) { + if (raccine_config.is_debug_mode()) { + wprintf(L"Unable to create temporary user folder: %s\n", wTestFilename); + } + } + const int c = GetTempFileNameW(wTestFilename, L"Raccine", 0, wTestFilename); if (c == 0) { return false;