summaryrefslogtreecommitdiff
path: root/plugins/MimCmd
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-02-22 23:16:49 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-02-22 23:16:49 +0300
commit7199eca4895b8ba0da40857275094220170b25a5 (patch)
tree595a3ad367aaf992d38a5201632cc1913cd21e56 /plugins/MimCmd
parent1163cd367fc081b85e4ec56b0299775453395702 (diff)
fixes #1160 (MimCmd: cannot locate runtime library)
Diffstat (limited to 'plugins/MimCmd')
-rw-r--r--plugins/MimCmd/MimCmd.vcxproj3
-rw-r--r--plugins/MimCmd/src/MimCmd.cpp25
2 files changed, 26 insertions, 2 deletions
diff --git a/plugins/MimCmd/MimCmd.vcxproj b/plugins/MimCmd/MimCmd.vcxproj
index a567479d8f..00a6f44102 100644
--- a/plugins/MimCmd/MimCmd.vcxproj
+++ b/plugins/MimCmd/MimCmd.vcxproj
@@ -31,8 +31,7 @@
<ItemDefinitionGroup>
<Link>
<SubSystem>Console</SubSystem>
- <DelayLoadDLLs>mir_core.mir</DelayLoadDLLs>
- <AdditionalDependencies>delayimp.lib;comctl32.lib;ws2_32.lib;UxTheme.lib;Iphlpapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <DelayLoadDLLs>api-ms-win-crt-heap-l1-1-0.dll;api-ms-win-crt-locale-l1-1-0.dll;api-ms-win-crt-math-l1-1-0.dll;api-ms-win-crt-runtime-l1-1-0.dll;api-ms-win-crt-stdio-l1-1-0.dll;api-ms-win-crt-string-l1-1-0.dll;mir_core.mir</DelayLoadDLLs>
</Link>
<ClCompile>
<ExceptionHandling>Sync</ExceptionHandling>
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();