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");