Removes process to global process list. */
| 2703 | |
| 2704 | /* Removes process to global process list. */ |
| 2705 | static void kwsysProcessesRemove(HANDLE hProcess) |
| 2706 | { |
| 2707 | size_t i; |
| 2708 | |
| 2709 | if (!hProcess || hProcess == INVALID_HANDLE_VALUE) { |
| 2710 | return; |
| 2711 | } |
| 2712 | |
| 2713 | EnterCriticalSection(&kwsysProcesses.Lock); |
| 2714 | |
| 2715 | /* Find the given process in the set. */ |
| 2716 | for (i = 0; i < kwsysProcesses.Count; ++i) { |
| 2717 | if (kwsysProcesses.Processes[i].hProcess == hProcess) { |
| 2718 | break; |
| 2719 | } |
| 2720 | } |
| 2721 | if (i < kwsysProcesses.Count) { |
| 2722 | /* Found it! Remove the process from the set. */ |
| 2723 | --kwsysProcesses.Count; |
| 2724 | for (; i < kwsysProcesses.Count; ++i) { |
| 2725 | kwsysProcesses.Processes[i] = kwsysProcesses.Processes[i + 1]; |
| 2726 | } |
| 2727 | |
| 2728 | /* If this was the last process, free the array. */ |
| 2729 | if (kwsysProcesses.Count == 0) { |
| 2730 | kwsysProcesses.Size = 0; |
| 2731 | free(kwsysProcesses.Processes); |
| 2732 | kwsysProcesses.Processes = 0; |
| 2733 | } |
| 2734 | } |
| 2735 | |
| 2736 | LeaveCriticalSection(&kwsysProcesses.Lock); |
| 2737 | } |
| 2738 | |
| 2739 | static BOOL WINAPI kwsysCtrlHandler(DWORD dwCtrlType) |
| 2740 | { |
no outgoing calls
no test coverage detected
searching dependent graphs…