This looks great, but I hope you're aware of the limitations of DllMain. If the test gets more complex, it might be better to do a separate CreateRemoteThread call on an exported function after the dll has been loaded. Although I guess as long as things work, this is fine ;)
(maybe this is related to the SEH issue you mention in the next commit, not sure)
On 2015-06-08 19:15, cfinck@svn.reactos.org wrote:
[LOCALSPL_APITEST] Write an API-Test for localspl.dll. As the original localspl.dll from Windows Server 2003 relies on proper initialization inside spoolsv.exe, we cannot test it standalone as usual.
+// Running the tests from the injected DLL and redirecting their output to the pipe. +BOOL WINAPI +DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +{
- char szTestName[150];
- DWORD cbRead;
- FILE* fpStdout;
- HANDLE hCommandPipe;
- int iOldStdout;
- // We only want to run our test once when the DLL is injected to the process.
- if (fdwReason != DLL_PROCESS_ATTACH)
return TRUE;