CMake/Tests/RunCMake/testStartupInfo.c
Brad King fa8c04b421 Tests/RunCMake/execute_process: Check STARTUPINFOW reserved members
Verify that `execute_process` launches processes on Windows such that
`GetStartupInfoW` in the child does not populate `STARTUPINFOW` members
reserved for the MSVC C run-time.

Issue: #25996
2024-05-24 10:12:27 -04:00

26 lines
562 B
C

#ifndef _CRT_SECURE_NO_WARNINGS
# define _CRT_SECURE_NO_WARNINGS
#endif
#if defined(_MSC_VER) && _MSC_VER >= 1928
# pragma warning(disable : 5105) /* macro expansion warning in windows.h */
#endif
#include <windows.h>
#include <stdio.h>
#include <string.h>
int main(void)
{
STARTUPINFOW si;
memset(&si, 0, sizeof(si));
GetStartupInfoW(&si);
if (si.cbReserved2 != 0 || si.lpReserved2 != NULL) {
fprintf(stderr, "si.cbReserved2: %u\n", si.cbReserved2);
fprintf(stderr, "si.lpReserved2: %p\n", si.lpReserved2);
return 1;
}
return 0;
}