https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7d18e36a31988a6d12736…
commit 7d18e36a31988a6d12736d0a719dfcf969185cab
Author: Pierre Schweitzer <pierre(a)reactos.org>
AuthorDate: Tue Dec 11 22:38:36 2018 +0100
Commit: Pierre Schweitzer <pierre(a)reactos.org>
CommitDate: Tue Dec 11 23:41:01 2018 +0100
[ADVAPI32_APITEST] Add a test to show that main service thread is tagged
This test will fail on everything < W2K3 SP2. In spite of what a wide spread
rumor says, MS seems to have added that feature quite lately, but not starting
Vista! ;-)
---
modules/rostests/apitests/advapi32/ServiceEnv.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/modules/rostests/apitests/advapi32/ServiceEnv.c b/modules/rostests/apitests/advapi32/ServiceEnv.c
index b98a076b30..fd3520452f 100644
--- a/modules/rostests/apitests/advapi32/ServiceEnv.c
+++ b/modules/rostests/apitests/advapi32/ServiceEnv.c
@@ -70,6 +70,7 @@ service_main(DWORD dwArgc, LPWSTR* lpszArgv)
// SERVICE_STATUS_HANDLE status_handle;
LPWSTR lpEnvironment, lpEnvStr;
DWORD dwSize;
+ PTEB Teb;
UNREFERENCED_PARAMETER(dwArgc);
UNREFERENCED_PARAMETER(lpszArgv);
@@ -103,6 +104,9 @@ service_main(DWORD dwArgc, LPWSTR* lpszArgv)
service_ok(dwSize != 0, "USERNAME envvar not found, or GetEnvironmentVariableW failed: %lu\n", GetLastError());
#endif
+ Teb = NtCurrentTeb();
+ service_ok(Teb->SubProcessTag != 0, "SubProcessTag is not defined!\n");
+
/* Work is done */
report_service_status(SERVICE_STOPPED, NO_ERROR, 0);
}
@@ -244,6 +248,7 @@ START_TEST(ServiceEnv)
{
int argc;
char** argv;
+ PTEB Teb;
/* Check whether this test is started as a separated service process */
argc = winetest_get_mainargs(&argv);
@@ -253,6 +258,9 @@ START_TEST(ServiceEnv)
return;
}
+ Teb = NtCurrentTeb();
+ ok(Teb->SubProcessTag == 0, "SubProcessTag is defined: %p\n", Teb->SubProcessTag);
+
/* We are started as the real test */
test_runner(my_test_server, NULL);
// trace("Returned from test_runner\n");
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3de04ccace7d0b501608b…
commit 3de04ccace7d0b501608b633ff2f02113728eb95
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Sun Dec 9 17:51:50 2018 +0100
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Tue Dec 11 21:50:58 2018 +0100
[CMAKE] Fix problem with __RELFILE__ not working when compiler uses relative pathes
This usually happens when the build dir is a subdir of the source dir. It is now detected during runtime, using the length of the relative path from the build dir to the source dir as the length of the prefix to skip, if __FILE__ starts with a '.'.
Also fix the escaping of REACTOS_*_DIR defines. It was gracefully fixed up by CMake, but resulted in broken syntax highliting.
CORE-14839 #resolve
---
CMakeLists.txt | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d2e8b861ee..c931d018da 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -57,9 +57,14 @@ endif()
include(sdk/cmake/compilerflags.cmake)
add_definitions(-D__REACTOS__)
-add_definitions(-DREACTOS_SOURCE_DIR="\\"${REACTOS_SOURCE_DIR}\\"")
-add_definitions(-DREACTOS_BINARY_DIR="\\"${REACTOS_BINARY_DIR}\\"")
-add_compile_flags(-D__RELFILE__="&__FILE__[sizeof REACTOS_SOURCE_DIR]")
+
+# Double escape, since CMake unescapes before putting it on the command-line, where it's unescaped again by GCC/CL.
+add_definitions(-DREACTOS_SOURCE_DIR="\\\"${REACTOS_SOURCE_DIR}\\\"")
+add_definitions(-DREACTOS_BINARY_DIR="\\\"${REACTOS_BINARY_DIR}\\\"")
+
+# There doesn't seem to be a standard for __FILE__ being relative or absolute, so detect it at runtime.
+file(RELATIVE_PATH _PATH_PREFIX ${REACTOS_BINARY_DIR} ${REACTOS_SOURCE_DIR})
+add_compile_flags(-D__RELFILE__="&__FILE__[__FILE__[0] == '.' ? sizeof \\\"${_PATH_PREFIX}\\\" - 1 : sizeof REACTOS_SOURCE_DIR]")
if(MSVC_IDE)
add_compile_flags("/MP")