| 2253 | }; |
| 2254 | |
| 2255 | static kwsysProcess_List* kwsysProcess_List_New(void) |
| 2256 | { |
| 2257 | OSVERSIONINFO osv; |
| 2258 | kwsysProcess_List* self; |
| 2259 | |
| 2260 | /* Allocate and initialize the list object. */ |
| 2261 | if (!(self = (kwsysProcess_List*)malloc(sizeof(kwsysProcess_List)))) { |
| 2262 | return 0; |
| 2263 | } |
| 2264 | memset(self, 0, sizeof(*self)); |
| 2265 | |
| 2266 | /* Select an implementation. */ |
| 2267 | ZeroMemory(&osv, sizeof(osv)); |
| 2268 | osv.dwOSVersionInfoSize = sizeof(osv); |
| 2269 | #ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx |
| 2270 | # pragma warning(push) |
| 2271 | # ifdef __INTEL_COMPILER |
| 2272 | # pragma warning(disable : 1478) |
| 2273 | # elif defined __clang__ |
| 2274 | # pragma clang diagnostic push |
| 2275 | # pragma clang diagnostic ignored "-Wdeprecated-declarations" |
| 2276 | # else |
| 2277 | # pragma warning(disable : 4996) |
| 2278 | # endif |
| 2279 | #endif |
| 2280 | GetVersionEx(&osv); |
| 2281 | #ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx |
| 2282 | # ifdef __clang__ |
| 2283 | # pragma clang diagnostic pop |
| 2284 | # else |
| 2285 | # pragma warning(pop) |
| 2286 | # endif |
| 2287 | #endif |
| 2288 | self->NT4 = |
| 2289 | (osv.dwPlatformId == VER_PLATFORM_WIN32_NT && osv.dwMajorVersion < 5) ? 1 |
| 2290 | : 0; |
| 2291 | |
| 2292 | /* Initialize the selected implementation. */ |
| 2293 | if (!(self->NT4 ? kwsysProcess_List__New_NT4(self) |
| 2294 | : kwsysProcess_List__New_Snapshot(self))) { |
| 2295 | kwsysProcess_List_Delete(self); |
| 2296 | return 0; |
| 2297 | } |
| 2298 | |
| 2299 | /* Update to the current set of processes. */ |
| 2300 | if (!kwsysProcess_List_Update(self)) { |
| 2301 | kwsysProcess_List_Delete(self); |
| 2302 | return 0; |
| 2303 | } |
| 2304 | return self; |
| 2305 | } |
| 2306 | |
| 2307 | static void kwsysProcess_List_Delete(kwsysProcess_List* self) |
| 2308 | { |
no test coverage detected
searching dependent graphs…