dlls/ws2_32/tests/sock.c
/* checks for a sequence of events, (order only checked if window is used) */
checks for a sequence of events, (order only checked if window is used)
checks for a sequence of events ( order only checked if window is used )
static void ok_event_sequence(SOCKET s, HANDLE hEvent, const LPARAM *seq, const LPARAM **broken_seqs, int completelyBroken)
{
    MSG msg;
    WSANETWORKEVENTS events, *netEvents = NULL;
    int ret;
    DWORD dwRet;
    if (hEvent != INVALID_HANDLE_VALUE)
    {
        netEvents = &events;
        dwRet = WaitForSingleObject(hEvent, 200);
        if (dwRet == WAIT_OBJECT_0)
        {
            ret = WSAEnumNetworkEvents(s, hEvent, netEvents);
            if (ret)
            {
                winetest_ok(0, "WSAEnumNetworkEvents failed, error %d\n", ret);
                return;
            }
        }
        else
            memset(netEvents, 0, sizeof(*netEvents));
    }
    else
    {
        Sleep(200);
        while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE ))
        {
            DispatchMessageA(&msg);
        }
    }
    if (match_event_sequence(s, netEvents, seq))
    {
        winetest_ok(1, "Sequence matches expected: %s\n", dbgstr_event_seq(seq));
        flush_events(s, hEvent);
        return;
    }
    if (broken_seqs)
    {
        for (; *broken_seqs; broken_seqs++)
        {
            if (match_event_sequence(s, netEvents, *broken_seqs))
            {
                winetest_ok(broken(1), "Sequence matches broken: %s, expected %s\n", dbgstr_event_seq_result(s, netEvents), dbgstr_event_seq(seq));
                flush_events(s, hEvent);
                return;
            }
        }
    }
    winetest_ok(broken(completelyBroken), "Expected event sequence %s, got %s\n", dbgstr_event_seq(seq),
                dbgstr_event_seq_result(s, netEvents));
    flush_events(s, hEvent);
}
static void ok_event_sequence ( SOCKET s , HANDLE hEvent , const LPARAM * seq , const LPARAM * * broken_seqs , int completelyBroken ) { MSG msg ; WSANETWORKEVENTS events , * netEvents = NULL ; int ret ; DWORD dwRet ; if ( hEvent != INVALID_HANDLE_VALUE ) { netEvents = & events ; dwRet = WaitForSingleObject ( hEvent , 200 ) ; if ( dwRet == WAIT_OBJECT_0 ) { ret = WSAEnumNetworkEvents ( s , hEvent , netEvents ) ; if ( ret ) { winetest_ok ( 0 , " \n " , ret ) ; return ; } } else memset ( netEvents , 0 , sizeof ( * netEvents ) ) ; } else { Sleep ( 200 ) ; while ( PeekMessageA ( & msg , 0 , 0 , 0 , PM_REMOVE ) ) { DispatchMessageA ( & msg ) ; } } if ( match_event_sequence ( s , netEvents , seq ) ) { winetest_ok ( 1 , " \n " , dbgstr_event_seq ( seq ) ) ; flush_events ( s , hEvent ) ; return ; } if ( broken_seqs ) { for ( ; * broken_seqs ; broken_seqs ++ ) { if ( match_event_sequence ( s , netEvents , * broken_seqs ) ) { winetest_ok ( broken ( 1 ) , " \n " , dbgstr_event_seq_result ( s , netEvents ) , dbgstr_event_seq ( seq ) ) ; flush_events ( s , hEvent ) ; return ; } } } winetest_ok ( broken ( completelyBroken ) , " \n " , dbgstr_event_seq ( seq ) , dbgstr_event_seq_result ( s , netEvents ) ) ; flush_events ( s , hEvent ) ; }
checks for a sequence of events, (order only checked if window is used)
checks for a sequence of events ( order only checked if window is used )
/* Run the message loop a little */