MCPcopy Create free account
hub / github.com/Kitware/CMake / kwsysProcess_New

Function kwsysProcess_New

Source/kwsys/ProcessWin32.c:311–454  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

309};
310
311kwsysProcess* kwsysProcess_New(void)
312{
313 int i;
314
315 /* Process control structure. */
316 kwsysProcess* cp;
317
318 /* Windows version number data. */
319 OSVERSIONINFO osv;
320
321 /* Initialize list of processes before we get any farther. It's especially
322 important that the console Ctrl handler be added BEFORE starting the
323 first process. This prevents the risk of an orphaned process being
324 started by the main thread while the default Ctrl handler is in
325 progress. */
326 if (!kwsysProcessesInitialize()) {
327 return 0;
328 }
329
330 /* Allocate a process control structure. */
331 cp = (kwsysProcess*)malloc(sizeof(kwsysProcess));
332 if (!cp) {
333 /* Could not allocate memory for the control structure. */
334 return 0;
335 }
336 ZeroMemory(cp, sizeof(*cp));
337
338 /* Share stdin with the parent process by default. */
339 cp->PipeSharedSTDIN = 1;
340
341 /* Set initial status. */
342 cp->State = kwsysProcess_State_Starting;
343
344 /* Choose a method of running the child based on version of
345 windows. */
346 ZeroMemory(&osv, sizeof(osv));
347 osv.dwOSVersionInfoSize = sizeof(osv);
348#ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx
349# pragma warning(push)
350# ifdef __INTEL_COMPILER
351# pragma warning(disable : 1478)
352# elif defined __clang__
353# pragma clang diagnostic push
354# pragma clang diagnostic ignored "-Wdeprecated-declarations"
355# else
356# pragma warning(disable : 4996)
357# endif
358#endif
359 GetVersionEx(&osv);
360#ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx
361# ifdef __clang__
362# pragma clang diagnostic pop
363# else
364# pragma warning(pop)
365# endif
366#endif
367 if (osv.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) {
368 /* Win9x no longer supported. */

Callers

nothing calls this directly

Calls 2

kwsysProcessesInitializeFunction · 0.85
kwsysProcess_DeleteFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…