Author: tfaber
Date: Sun Nov 22 13:51:19 2015
New Revision: 70022
URL:
http://svn.reactos.org/svn/reactos?rev=70022&view=rev
Log:
[CRT_APITEST]
- Fix dll loading in static_construct test
CORE-10562
Modified:
trunk/rostests/apitests/crt/static_construct.cpp
Modified: trunk/rostests/apitests/crt/static_construct.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/crt/static_const…
==============================================================================
--- trunk/rostests/apitests/crt/static_construct.cpp [iso-8859-1] (original)
+++ trunk/rostests/apitests/crt/static_construct.cpp [iso-8859-1] Sun Nov 22 13:51:19
2015
@@ -6,6 +6,7 @@
*/
#include <apitest.h>
+#include <strsafe.h>
#include "dll_startup.h"
extern "C"
@@ -35,7 +36,9 @@
}
} init_static;
-START_TEST(static_construct)
+static
+VOID
+TestInitStatic(VOID)
{
ok(static_init_counter_at_startup == 123, "static_init_counter at startup:
%d\n", static_init_counter_at_startup);
ok(static_construct_counter_at_startup == 789, "static_construct_counter at
startup: %d\n", static_construct_counter_at_startup);
@@ -46,15 +49,25 @@
ok(static_construct_counter == 790, "static_construct_counter: %d\n",
static_construct_counter);
ok(init_static.m_counter == 2, "init_static.m_counter: %d\n",
init_static.m_counter);
ok(init_static.m_uninit == 1, "init_static.m_uninit: %d\n",
init_static.m_uninit);
+}
- counter_values values;
+static
+VOID
+TestDllStartup(VOID)
+{
#if defined(TEST_MSVCRT)
- HMODULE hDll = LoadLibraryW(L"msvcrt_crt_dll_startup.dll");
+ const PCWSTR DllName = L"msvcrt_crt_dll_startup.dll";
#elif defined(TEST_STATIC_CRT)
- HMODULE hDll = LoadLibraryW(L"static_crt_dll_startup.dll");
+ const PCWSTR DllName = L"static_crt_dll_startup.dll";
#else
#error This test only makes sense for static CRT and msvcrt.dll
#endif
+ WCHAR DllPath[MAX_PATH];
+ GetModuleFileNameW(NULL, DllPath, _countof(DllPath));
+ wcsrchr(DllPath, L'\\')[1] = UNICODE_NULL;
+ StringCchCatW(DllPath, _countof(DllPath), DllName);
+
+ HMODULE hDll = LoadLibraryW(DllPath);
if (hDll == NULL)
{
skip("Helper dll not found\n");
@@ -67,6 +80,7 @@
FreeLibrary(hDll);
return;
}
+ counter_values values;
pSetCounterValuesPointer(&values);
ok(values.m_uninit_at_startup == 0, "m_uninit_at_startup = %d\n",
values.m_uninit_at_startup);
ok(values.m_uninit == 1, "m_uninit = %d\n", values.m_uninit);
@@ -86,3 +100,9 @@
ok(values.dtor_counter_at_detach == 7878, "dtor_counter_at_detach = %d\n",
values.dtor_counter_at_detach);
ok(values.dtor_counter == 7879, "dtor_counter = %d\n",
values.dtor_counter);
}
+
+START_TEST(static_construct)
+{
+ TestInitStatic();
+ TestDllStartup();
+}