summaryrefslogtreecommitdiff
path: root/plugins/MimCmd/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/MimCmd/src')
-rw-r--r--plugins/MimCmd/src/MimCmd.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/plugins/MimCmd/src/MimCmd.cpp b/plugins/MimCmd/src/MimCmd.cpp
index fea2335465..b077a9d434 100644
--- a/plugins/MimCmd/src/MimCmd.cpp
+++ b/plugins/MimCmd/src/MimCmd.cpp
@@ -20,6 +20,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
+#pragma comment(lib, "delayimp.lib")
+
int hLangpack = 0;
wchar_t* GetProgramName(wchar_t *programName, size_t size)
@@ -55,6 +57,29 @@ void ShowVersion()
int wmain(int argc, wchar_t *argv[])
{
+ wchar_t wszPath[MAX_PATH];
+ wcsncpy_s(wszPath, argv[0], _TRUNCATE);
+
+ // if current dir isn't set
+ for (int i = lstrlenW(wszPath); i >= 0; i--)
+ if (wszPath[i] == '\\') {
+ wszPath[i] = 0;
+ break;
+ }
+
+ SetCurrentDirectoryW(wszPath);
+
+ lstrcatW(wszPath, L"\\libs");
+ SetDllDirectoryW(wszPath);
+
+#ifdef _DEBUG
+ lstrcatW(wszPath, L"\\ucrtbased.dll");
+#else
+ lstrcatW(wszPath, L"\\ucrtbase.dll");
+#endif
+ LoadLibraryW(wszPath);
+
+ ////////////////////////////////////////////////////////////////////////////////////////
_setmode(_fileno(stdout), _O_U16TEXT);
if (argc == 2 && !wcscmp(argv[1], L"-v")) {
ShowVersion();