NOEXPORT BOOL CALLBACK enum_windows(HWND other_window_handle, LPARAM lParam) {
    DWORD pid;
    HMODULE module;
    HANDLE process_handle;
    TCHAR window_exe_path[MAX_PATH];
    LPTSTR stunnel_exe_path=(LPTSTR)lParam;

    if(!other_window_handle)
        return TRUE;
    module=(HMODULE)GetWindowLongPtr(other_window_handle, GWLP_HINSTANCE);
    GetWindowThreadProcessId(other_window_handle, &pid);
    process_handle=OpenProcess(SYNCHRONIZE|         /* WaitForSingleObject() */
        PROCESS_TERMINATE|                          /* TerminateProcess()    */
        PROCESS_QUERY_INFORMATION|PROCESS_VM_READ,  /* GetModuleFileNameEx() */
        FALSE, pid);
    if(!process_handle)
        return TRUE;
    if(!GetModuleFileNameEx(process_handle,
            module, window_exe_path, MAX_PATH)) {
        CloseHandle(process_handle);
        return TRUE;
    }
    if(_tcscmp(stunnel_exe_path, window_exe_path)) {
        CloseHandle(process_handle);
        return TRUE;
    }
    if(cmdline.exit) {
        PostMessage(other_window_handle, WM_COMMAND, IDM_EXIT, 0);
        if(WaitForSingleObject(process_handle, 3000)==WAIT_TIMEOUT) {
            TerminateProcess(process_handle, 0);
            WaitForSingleObject(process_handle, 3000);
        }
    } else {
        ShowWindow(other_window_handle, SW_SHOWNORMAL); /* show window */
        SetForegroundWindow(other_window_handle); /* bring on top */
    }
    CloseHandle(process_handle);
    exit(0);
    return FALSE; /* should never be executed */
}
NOEXPORT BOOL CALLBACK enum_windows(HWND other_window_handle, LPARAM lParam) {
    DWORD pid;
    HMODULE module;
    HANDLE process_handle;
    TCHAR window_exe_path[MAX_PATH];
    LPTSTR stunnel_exe_path=(LPTSTR)lParam;

    if(!other_window_handle)
        return TRUE;
    module=(HMODULE)GetWindowLongPtr(other_window_handle, GWLP_HINSTANCE);
    GetWindowThreadProcessId(other_window_handle, &pid);
    process_handle=OpenProcess(SYNCHRONIZE|          
        PROCESS_TERMINATE|                           
        PROCESS_QUERY_INFORMATION|PROCESS_VM_READ,   
        FALSE, pid);
    if(!process_handle)
        return TRUE;
    if(!GetModuleFileNameEx(process_handle,
            module, window_exe_path, MAX_PATH)) {
        CloseHandle(process_handle);
        return TRUE;
    }
    if(_tcscmp(stunnel_exe_path, window_exe_path)) {
        CloseHandle(process_handle);
        return TRUE;
    }
    if(cmdline.exit) {
        PostMessage(other_window_handle, WM_COMMAND, IDM_EXIT, 0);
        if(WaitForSingleObject(process_handle, 3000)==WAIT_TIMEOUT) {
            TerminateProcess(process_handle, 0);
            WaitForSingleObject(process_handle, 3000);
        }
    } else {
        ShowWindow(other_window_handle, SW_SHOWNORMAL);  
        SetForegroundWindow(other_window_handle);  
    }
    CloseHandle(process_handle);
    exit(0);
    return FALSE;  
}