summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/inject.cpp1
-rw-r--r--src/shared/oblivioninfo.cpp1
-rw-r--r--src/shared/skyriminfo.cpp8
-rw-r--r--src/shared/skyriminfo.h4
-rw-r--r--src/shared/util.cpp7
-rw-r--r--src/shared/util.h3
6 files changed, 21 insertions, 3 deletions
diff --git a/src/shared/inject.cpp b/src/shared/inject.cpp
index 9fea7fc8..5a111c4a 100644
--- a/src/shared/inject.cpp
+++ b/src/shared/inject.cpp
@@ -136,6 +136,7 @@ void injectDLL(HANDLE processHandle, HANDLE threadHandle, const std::string &dll
(written != sizeof(stubLocal))) {
throw windows_error("failed to write stub to target process");
}
+
// finally, make the stub the new next thing for the thread to execute
threadContext.Eip = (ULONG)stubRemote;
if (::SetThreadContext(threadHandle, &threadContext) == 0) {
diff --git a/src/shared/oblivioninfo.cpp b/src/shared/oblivioninfo.cpp
index 1c714072..73e841a7 100644
--- a/src/shared/oblivioninfo.cpp
+++ b/src/shared/oblivioninfo.cpp
@@ -134,7 +134,6 @@ void OblivionInfo::createProfile(const std::wstring &directory, bool useDefaults
if (!FileExists(target.str())) {
std::wostringstream source;
- source << getMyGamesDirectory() << L"\\Oblivion\\oblivion.ini";
if (useDefaults) {
source << getGameDirectory() << L"\\oblivion_default.ini";
} else {
diff --git a/src/shared/skyriminfo.cpp b/src/shared/skyriminfo.cpp
index 6302cef3..1c13effb 100644
--- a/src/shared/skyriminfo.cpp
+++ b/src/shared/skyriminfo.cpp
@@ -27,6 +27,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include "error_report.h"
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
+#include <Shlwapi.h>
#include <boost/assign.hpp>
namespace MOShared {
@@ -36,6 +37,11 @@ SkyrimInfo::SkyrimInfo(const std::wstring &omoDirectory, const std::wstring &gam
: GameInfo(omoDirectory, gameDirectory)
{
identifyMyGamesDirectory(L"skyrim");
+
+ wchar_t appDataPath[MAX_PATH];
+ if (SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, appDataPath))) {
+ m_AppData = appDataPath;
+ }
}
bool SkyrimInfo::identifyGame(const std::wstring &searchPath)
@@ -259,7 +265,7 @@ bool SkyrimInfo::rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPa
}
if ((_wcsicmp(fileName, L"plugins.txt") == 0) &&
- (wcsstr(fullPath, L"AppData") != NULL)){
+ (m_AppData.empty() || (StrStrIW(fullPath, m_AppData.c_str()) != NULL))) {
return true;
}
diff --git a/src/shared/skyriminfo.h b/src/shared/skyriminfo.h
index b12a5d58..024d0395 100644
--- a/src/shared/skyriminfo.h
+++ b/src/shared/skyriminfo.h
@@ -97,6 +97,10 @@ private:
static bool identifyGame(const std::wstring &searchPath);
+private:
+
+ std::wstring m_AppData;
+
};
} // namespace MOShared
diff --git a/src/shared/util.cpp b/src/shared/util.cpp
index a6378a74..e61ae8a6 100644
--- a/src/shared/util.cpp
+++ b/src/shared/util.cpp
@@ -79,6 +79,13 @@ std::string &ToLower(std::string &text)
return text;
}
+std::string ToLower(const std::string &text)
+{
+ std::string temp = text;
+
+ std::transform(temp.begin(), temp.end(), temp.begin(), tolower);
+ return temp;
+}
std::wstring &ToLower(std::wstring &text)
{
diff --git a/src/shared/util.h b/src/shared/util.h
index 9c59f6db..80983cb0 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -39,8 +39,9 @@ std::string ToString(const std::wstring &source, bool utf8);
std::wstring ToWString(const std::string &source, bool utf8);
std::string &ToLower(std::string &text);
-std::wstring &ToLower(std::wstring &text);
+std::string ToLower(const std::string &text);
+std::wstring &ToLower(std::wstring &text);
std::wstring ToLower(const std::wstring &text);
VS_FIXEDFILEINFO GetFileVersion(const std::wstring &fileName);