From 752ac3b4799bddaf6f9e3abdaca38ced30980374 Mon Sep 17 00:00:00 2001 From: akallabeth Date: Wed, 13 Apr 2022 09:34:05 +0200 Subject: [PATCH] Fix #7793: Do not expose internal input API (#7794) * Fixed GetFileInformationByHandle initializers * Fix #7793: Do not expose internal input API Slow-Path input uses UINT16 for scancodes on wire, but only the lower byte is actually used. (the extended fields are sent in keyboardFlags field) Hide this implementation detail and adjust the API to use UINT8 for the code instead just like the corresponding Fast-Path PDU * Added a warning for problematic slow path keyCodes --- .../freeRDPCore/src/main/cpp/android_event.c | 7 ++-- client/iOS/FreeRDP/ios_freerdp_events.m | 4 +- include/freerdp/input.h | 4 +- include/freerdp/server/shadow.h | 2 +- libfreerdp/core/fastpath.c | 2 +- libfreerdp/core/input.c | 24 +++++++---- libfreerdp/core/message.c | 2 +- server/Mac/mf_peer.c | 6 +-- server/Sample/sfreerdp.c | 18 ++++---- server/Windows/wf_input.c | 4 +- server/Windows/wf_input.h | 4 +- server/proxy/pf_input.c | 2 +- server/shadow/Mac/mac_shadow.c | 2 +- server/shadow/Win/win_shadow.c | 2 +- server/shadow/X11/x11_shadow.c | 2 +- server/shadow/shadow_input.c | 2 +- winpr/libwinpr/comm/comm.c | 3 +- winpr/libwinpr/handle/nonehandle.c | 1 + winpr/libwinpr/input/keycode.c | 2 +- winpr/libwinpr/input/scancode.c | 2 +- winpr/libwinpr/pipe/pipe.c | 41 +++++++++++-------- winpr/libwinpr/sspicli/sspicli.c | 1 + winpr/libwinpr/synch/event.c | 31 +++++++++----- winpr/libwinpr/synch/mutex.c | 31 +++++++++----- winpr/libwinpr/synch/semaphore.c | 1 + winpr/libwinpr/synch/timer.c | 31 +++++++++----- winpr/libwinpr/thread/process.c | 1 + winpr/libwinpr/thread/thread.c | 1 + 28 files changed, 142 insertions(+), 91 deletions(-) diff --git a/client/Android/Studio/freeRDPCore/src/main/cpp/android_event.c b/client/Android/Studio/freeRDPCore/src/main/cpp/android_event.c index b423dde6f..5f730023b 100644 --- a/client/Android/Studio/freeRDPCore/src/main/cpp/android_event.c +++ b/client/Android/Studio/freeRDPCore/src/main/cpp/android_event.c @@ -96,14 +96,15 @@ static BOOL android_process_event(ANDROID_EVENT_QUEUE* queue, freerdp* inst) if (event->type == EVENT_TYPE_KEY) { ANDROID_EVENT_KEY* key_event = (ANDROID_EVENT_KEY*)event; - context->input->KeyboardEvent(context->input, key_event->flags, key_event->scancode); + freerdp_input_send_keyboard_event(context->input, key_event->flags, + key_event->scancode); android_event_free((ANDROID_EVENT*)key_event); } else if (event->type == EVENT_TYPE_KEY_UNICODE) { ANDROID_EVENT_KEY* key_event = (ANDROID_EVENT_KEY*)event; - context->input->UnicodeKeyboardEvent(context->input, key_event->flags, - key_event->scancode); + freerdp_input_send_keyboard_event(context->input, key_event->flags, + key_event->scancode); android_event_free((ANDROID_EVENT*)key_event); } else if (event->type == EVENT_TYPE_CURSOR) diff --git a/client/iOS/FreeRDP/ios_freerdp_events.m b/client/iOS/FreeRDP/ios_freerdp_events.m index 0685c42d9..11ed0c9e4 100644 --- a/client/iOS/FreeRDP/ios_freerdp_events.m +++ b/client/iOS/FreeRDP/ios_freerdp_events.m @@ -61,11 +61,11 @@ static BOOL ios_events_handle_event(mfInfo *mfi, NSDictionary *event_description else if ([event_type isEqualToString:@"keyboard"]) { if ([[event_description objectForKey:@"subtype"] isEqualToString:@"scancode"]) - instance->input->KeyboardEvent( + freerdp_input_send_keyboard_event( instance->input, [[event_description objectForKey:@"flags"] unsignedShortValue], [[event_description objectForKey:@"scancode"] unsignedShortValue]); else if ([[event_description objectForKey:@"subtype"] isEqualToString:@"unicode"]) - instance->input->UnicodeKeyboardEvent( + freerdp_input_send_unicode_keyboard_event( instance->input, [[event_description objectForKey:@"flags"] unsignedShortValue], [[event_description objectForKey:@"unicode_char"] unsignedShortValue]); else diff --git a/include/freerdp/input.h b/include/freerdp/input.h index 10f4141ae..dbc9d5eae 100644 --- a/include/freerdp/input.h +++ b/include/freerdp/input.h @@ -65,7 +65,7 @@ typedef struct rdp_input_proxy rdpInputProxy; /* Input Interface */ typedef BOOL (*pSynchronizeEvent)(rdpInput* input, UINT32 flags); -typedef BOOL (*pKeyboardEvent)(rdpInput* input, UINT16 flags, UINT16 code); +typedef BOOL (*pKeyboardEvent)(rdpInput* input, UINT16 flags, UINT8 code); typedef BOOL (*pUnicodeKeyboardEvent)(rdpInput* input, UINT16 flags, UINT16 code); typedef BOOL (*pMouseEvent)(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y); typedef BOOL (*pExtendedMouseEvent)(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y); @@ -95,7 +95,7 @@ extern "C" #endif FREERDP_API BOOL freerdp_input_send_synchronize_event(rdpInput* input, UINT32 flags); - FREERDP_API BOOL freerdp_input_send_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code); + FREERDP_API BOOL freerdp_input_send_keyboard_event(rdpInput* input, UINT16 flags, UINT8 code); FREERDP_API BOOL freerdp_input_send_keyboard_event_ex(rdpInput* input, BOOL down, UINT32 rdp_scancode); FREERDP_API BOOL freerdp_input_send_keyboard_pause_event(rdpInput* input); diff --git a/include/freerdp/server/shadow.h b/include/freerdp/server/shadow.h index e81d18397..9a786ec81 100644 --- a/include/freerdp/server/shadow.h +++ b/include/freerdp/server/shadow.h @@ -75,7 +75,7 @@ typedef BOOL (*pfnShadowClientCapabilities)(rdpShadowSubsystem* subsystem, rdpSh typedef BOOL (*pfnShadowSynchronizeEvent)(rdpShadowSubsystem* subsystem, rdpShadowClient* client, UINT32 flags); typedef BOOL (*pfnShadowKeyboardEvent)(rdpShadowSubsystem* subsystem, rdpShadowClient* client, - UINT16 flags, UINT16 code); + UINT16 flags, UINT8 code); typedef BOOL (*pfnShadowUnicodeKeyboardEvent)(rdpShadowSubsystem* subsystem, rdpShadowClient* client, UINT16 flags, UINT16 code); typedef BOOL (*pfnShadowMouseEvent)(rdpShadowSubsystem* subsystem, rdpShadowClient* client, diff --git a/libfreerdp/core/fastpath.c b/libfreerdp/core/fastpath.c index 7e10844e4..6df9ab6df 100644 --- a/libfreerdp/core/fastpath.c +++ b/libfreerdp/core/fastpath.c @@ -674,7 +674,7 @@ static BOOL fastpath_recv_input_event_scancode(rdpFastPath* fastpath, wStream* s { rdpInput* input; UINT16 flags; - UINT16 code; + UINT8 code; if (!fastpath || !fastpath->rdp || !fastpath->rdp->input || !s) return FALSE; diff --git a/libfreerdp/core/input.c b/libfreerdp/core/input.c index d478ba26f..90f1ba321 100644 --- a/libfreerdp/core/input.c +++ b/libfreerdp/core/input.c @@ -38,11 +38,9 @@ #define INPUT_EVENT_MOUSE 0x8001 #define INPUT_EVENT_MOUSEX 0x8002 -#define RDP_CLIENT_INPUT_PDU_HEADER_LENGTH 4 - static void rdp_write_client_input_pdu_header(wStream* s, UINT16 number) { - Stream_Write_UINT16(s, 1); /* numberEvents (2 bytes) */ + Stream_Write_UINT16(s, number); /* numberEvents (2 bytes) */ Stream_Write_UINT16(s, 0); /* pad2Octets (2 bytes) */ } @@ -67,6 +65,8 @@ static wStream* rdp_client_input_pdu_init(rdpRdp* rdp, UINT16 type) static BOOL rdp_send_client_input_pdu(rdpRdp* rdp, wStream* s) { + WINPR_ASSERT(rdp); + WINPR_ASSERT(rdp->mcs); return rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_INPUT, rdp->mcs->userId); } @@ -96,12 +96,15 @@ static BOOL input_send_synchronize_event(rdpInput* input, UINT32 flags) static void input_write_keyboard_event(wStream* s, UINT16 flags, UINT16 code) { + WINPR_ASSERT(s); + WINPR_ASSERT(code <= UINT8_MAX); + Stream_Write_UINT16(s, flags); /* keyboardFlags (2 bytes) */ Stream_Write_UINT16(s, code); /* keyCode (2 bytes) */ Stream_Write_UINT16(s, 0); /* pad2Octets (2 bytes) */ } -static BOOL input_send_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code) +static BOOL input_send_keyboard_event(rdpInput* input, UINT16 flags, UINT8 code) { wStream* s; rdpRdp* rdp; @@ -280,7 +283,7 @@ static BOOL input_send_fastpath_synchronize_event(rdpInput* input, UINT32 flags) return fastpath_send_input_pdu(rdp->fastpath, s); } -static BOOL input_send_fastpath_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code) +static BOOL input_send_fastpath_keyboard_event(rdpInput* input, UINT16 flags, UINT8 code) { wStream* s; BYTE eventFlags = 0; @@ -494,7 +497,13 @@ static BOOL input_recv_keyboard_event(rdpInput* input, wStream* s) else keyboardFlags |= KBD_FLAGS_DOWN; - return IFCALLRESULT(TRUE, input->KeyboardEvent, input, keyboardFlags, keyCode); + if (keyCode & 0xFF00) + WLog_WARN(TAG, + "Problematic [MS-RDPBCGR] 2.2.8.1.1.3.1.1.1 Keyboard Event (TS_KEYBOARD_EVENT) " + "keyCode=0x%04" PRIx16 + ", high byte values should be sent in keyboardFlags field, ignoring.", + keyCode); + return IFCALLRESULT(TRUE, input->KeyboardEvent, input, keyboardFlags, keyCode & 0xFF); } static BOOL input_recv_unicode_keyboard_event(rdpInput* input, wStream* s) @@ -625,7 +634,6 @@ BOOL input_recv(rdpInput* input, wStream* s) BOOL input_register_client_callbacks(rdpInput* input) { rdpSettings* settings; - rdp_input_internal* in = input_cast(input); if (!input->context) return FALSE; @@ -670,7 +678,7 @@ BOOL freerdp_input_send_synchronize_event(rdpInput* input, UINT32 flags) return IFCALLRESULT(TRUE, input->SynchronizeEvent, input, flags); } -BOOL freerdp_input_send_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code) +BOOL freerdp_input_send_keyboard_event(rdpInput* input, UINT16 flags, UINT8 code) { if (!input || !input->context) return FALSE; diff --git a/libfreerdp/core/message.c b/libfreerdp/core/message.c index 3dc17b91f..2f04e1df1 100644 --- a/libfreerdp/core/message.c +++ b/libfreerdp/core/message.c @@ -2967,7 +2967,7 @@ static int input_message_process_input_class(rdpInputProxy* proxy, wMessage* msg case Input_KeyboardEvent: IFCALL(proxy->KeyboardEvent, msg->context, (UINT16)(size_t)msg->wParam, - (UINT16)(size_t)msg->lParam); + (UINT8)(size_t)msg->lParam); break; case Input_UnicodeKeyboardEvent: diff --git a/server/Mac/mf_peer.c b/server/Mac/mf_peer.c index 70dc8a048..d2cfcb72a 100644 --- a/server/Mac/mf_peer.c +++ b/server/Mac/mf_peer.c @@ -329,13 +329,11 @@ static BOOL mf_peer_synchronize_event(rdpInput* input, UINT32 flags) return TRUE; } -void mf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code) +void mf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT8 code) { - UINT16 down = 0x4000; - // UINT16 up = 0x8000; bool state_down = FALSE; - if (flags == down) + if (flags == KBD_FLAGS_DOWN) { state_down = TRUE; } diff --git a/server/Sample/sfreerdp.c b/server/Sample/sfreerdp.c index 2b72eb066..f1f66e7fa 100644 --- a/server/Sample/sfreerdp.c +++ b/server/Sample/sfreerdp.c @@ -761,7 +761,7 @@ static BOOL tf_peer_synchronize_event(rdpInput* input, UINT32 flags) return TRUE; } -static BOOL tf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code) +static BOOL tf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT8 code) { freerdp_peer* client; rdpUpdate* update; @@ -786,10 +786,10 @@ static BOOL tf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code) tcontext = (testPeerContext*)context; WINPR_ASSERT(tcontext); - WLog_DBG(TAG, "Client sent a keyboard event (flags:0x%04" PRIX16 " code:0x%04" PRIX16 ")", - flags, code); + WLog_DBG(TAG, "Client sent a keyboard event (flags:0x%04" PRIX16 " code:0x%04" PRIX8 ")", flags, + code); - if ((flags & 0x4000) && code == 0x22) /* 'g' key */ + if ((flags & KBD_FLAGS_DOWN) && (code == RDP_SCANCODE_KEY_G)) /* 'g' key */ { if (settings->DesktopWidth != 800) { @@ -810,7 +810,7 @@ static BOOL tf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code) update->DesktopResize(update->context); tcontext->activated = FALSE; } - else if ((flags & 0x4000) && code == RDP_SCANCODE_KEY_C) /* 'c' key */ + else if ((flags & KBD_FLAGS_DOWN) && code == RDP_SCANCODE_KEY_C) /* 'c' key */ { if (tcontext->debug_channel) { @@ -818,22 +818,22 @@ static BOOL tf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code) WTSVirtualChannelWrite(tcontext->debug_channel, (PCHAR) "test2", 5, &written); } } - else if ((flags & 0x4000) && code == RDP_SCANCODE_KEY_X) /* 'x' key */ + else if ((flags & KBD_FLAGS_DOWN) && code == RDP_SCANCODE_KEY_X) /* 'x' key */ { WINPR_ASSERT(client->Close); client->Close(client); } - else if ((flags & 0x4000) && code == RDP_SCANCODE_KEY_R) /* 'r' key */ + else if ((flags & KBD_FLAGS_DOWN) && code == RDP_SCANCODE_KEY_R) /* 'r' key */ { tcontext->audin_open = !tcontext->audin_open; } #if defined(CHANNEL_AINPUT_SERVER) - else if ((flags & 0x4000) && code == RDP_SCANCODE_KEY_I) /* 'i' key */ + else if ((flags & KBD_FLAGS_DOWN) && code == RDP_SCANCODE_KEY_I) /* 'i' key */ { tcontext->ainput_open = !tcontext->ainput_open; } #endif - else if ((flags & 0x4000) && code == RDP_SCANCODE_KEY_S) /* 's' key */ + else if ((flags & KBD_FLAGS_DOWN) && code == RDP_SCANCODE_KEY_S) /* 's' key */ { } diff --git a/server/Windows/wf_input.c b/server/Windows/wf_input.c index 4e01b5cdd..aba1fcc55 100644 --- a/server/Windows/wf_input.c +++ b/server/Windows/wf_input.c @@ -24,7 +24,7 @@ #include "wf_input.h" #include "wf_info.h" -BOOL wf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code) +BOOL wf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT8 code) { INPUT keyboard_event; WINPR_UNUSED(input); @@ -188,7 +188,7 @@ BOOL wf_peer_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT1 return TRUE; } -BOOL wf_peer_keyboard_event_dummy(rdpInput* input, UINT16 flags, UINT16 code) +BOOL wf_peer_keyboard_event_dummy(rdpInput* input, UINT16 flags, UINT8 code) { WINPR_UNUSED(input); WINPR_UNUSED(flags); diff --git a/server/Windows/wf_input.h b/server/Windows/wf_input.h index b4e8c5778..8123652de 100644 --- a/server/Windows/wf_input.h +++ b/server/Windows/wf_input.h @@ -22,13 +22,13 @@ #include "wf_interface.h" -BOOL wf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code); +BOOL wf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT8 code); BOOL wf_peer_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code); BOOL wf_peer_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y); BOOL wf_peer_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y); // dummy versions -BOOL wf_peer_keyboard_event_dummy(rdpInput* input, UINT16 flags, UINT16 code); +BOOL wf_peer_keyboard_event_dummy(rdpInput* input, UINT16 flags, UINT8 code); BOOL wf_peer_unicode_keyboard_event_dummy(rdpInput* input, UINT16 flags, UINT16 code); BOOL wf_peer_mouse_event_dummy(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y); BOOL wf_peer_extended_mouse_event_dummy(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y); diff --git a/server/proxy/pf_input.c b/server/proxy/pf_input.c index 7a83b5ed5..862153f4a 100644 --- a/server/proxy/pf_input.c +++ b/server/proxy/pf_input.c @@ -62,7 +62,7 @@ static BOOL pf_server_synchronize_event(rdpInput* input, UINT32 flags) return TRUE; } -static BOOL pf_server_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code) +static BOOL pf_server_keyboard_event(rdpInput* input, UINT16 flags, UINT8 code) { const proxyConfig* config; proxyKeyboardEventInfo event; diff --git a/server/shadow/Mac/mac_shadow.c b/server/shadow/Mac/mac_shadow.c index 6dd3ba1ac..eccbdefc7 100644 --- a/server/shadow/Mac/mac_shadow.c +++ b/server/shadow/Mac/mac_shadow.c @@ -41,7 +41,7 @@ static BOOL mac_shadow_input_synchronize_event(rdpShadowSubsystem* subsystem, } static BOOL mac_shadow_input_keyboard_event(rdpShadowSubsystem* subsystem, rdpShadowClient* client, - UINT16 flags, UINT16 code) + UINT16 flags, UINT8 code) { DWORD vkcode; DWORD keycode; diff --git a/server/shadow/Win/win_shadow.c b/server/shadow/Win/win_shadow.c index d4fcf176f..0595d3ec4 100644 --- a/server/shadow/Win/win_shadow.c +++ b/server/shadow/Win/win_shadow.c @@ -45,7 +45,7 @@ static BOOL win_shadow_input_synchronize_event(rdpShadowSubsystem* subsystem, } static BOOL win_shadow_input_keyboard_event(rdpShadowSubsystem* subsystem, rdpShadowClient* client, - UINT16 flags, UINT16 code) + UINT16 flags, UINT8 code) { UINT rc; INPUT event; diff --git a/server/shadow/X11/x11_shadow.c b/server/shadow/X11/x11_shadow.c index 9e68ffc2b..4d0298604 100644 --- a/server/shadow/X11/x11_shadow.c +++ b/server/shadow/X11/x11_shadow.c @@ -206,7 +206,7 @@ static BOOL x11_shadow_input_synchronize_event(rdpShadowSubsystem* subsystem, } static BOOL x11_shadow_input_keyboard_event(rdpShadowSubsystem* subsystem, rdpShadowClient* client, - UINT16 flags, UINT16 code) + UINT16 flags, UINT8 code) { #ifdef WITH_XTEST x11ShadowSubsystem* x11 = (x11ShadowSubsystem*)subsystem; diff --git a/server/shadow/shadow_input.c b/server/shadow/shadow_input.c index b50ee0a7f..97268b8ae 100644 --- a/server/shadow/shadow_input.c +++ b/server/shadow/shadow_input.c @@ -31,7 +31,7 @@ static BOOL shadow_input_synchronize_event(rdpInput* input, UINT32 flags) return IFCALLRESULT(TRUE, subsystem->SynchronizeEvent, subsystem, client, flags); } -static BOOL shadow_input_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code) +static BOOL shadow_input_keyboard_event(rdpInput* input, UINT16 flags, UINT8 code) { rdpShadowClient* client = (rdpShadowClient*)input->context; rdpShadowSubsystem* subsystem = client->server->subsystem; diff --git a/winpr/libwinpr/comm/comm.c b/winpr/libwinpr/comm/comm.c index c51f8745f..3f8b935ea 100644 --- a/winpr/libwinpr/comm/comm.c +++ b/winpr/libwinpr/comm/comm.c @@ -1177,7 +1177,8 @@ static HANDLE_OPS ops = { CommIsHandled, CommCloseHandle, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL }; + NULL, NULL, + NULL }; /** * http://msdn.microsoft.com/en-us/library/windows/desktop/aa363198%28v=vs.85%29.aspx diff --git a/winpr/libwinpr/handle/nonehandle.c b/winpr/libwinpr/handle/nonehandle.c index 1fd254b1c..1de2ae2f9 100644 --- a/winpr/libwinpr/handle/nonehandle.c +++ b/winpr/libwinpr/handle/nonehandle.c @@ -73,6 +73,7 @@ static HANDLE_OPS ops = { NoneHandleIsHandle, NULL, NULL, NULL, + NULL, NULL }; HANDLE CreateNoneHandle() diff --git a/winpr/libwinpr/input/keycode.c b/winpr/libwinpr/input/keycode.c index cd630b6ee..cf634aa16 100644 --- a/winpr/libwinpr/input/keycode.c +++ b/winpr/libwinpr/input/keycode.c @@ -598,7 +598,7 @@ DWORD GetVirtualKeyCodeFromKeycode(DWORD keycode, DWORD dwFlags) DWORD GetKeycodeFromVirtualKeyCode(DWORD vkcode, DWORD dwFlags) { - int index; + DWORD index; DWORD keycode = 0; if (dwFlags & KEYCODE_TYPE_APPLE) diff --git a/winpr/libwinpr/input/scancode.c b/winpr/libwinpr/input/scancode.c index 76662752a..45064397c 100644 --- a/winpr/libwinpr/input/scancode.c +++ b/winpr/libwinpr/input/scancode.c @@ -133,7 +133,7 @@ DWORD GetVirtualKeyCodeFromVirtualScanCode(DWORD scancode, DWORD dwKeyboardType) DWORD GetVirtualScanCodeFromVirtualKeyCode(DWORD vkcode, DWORD dwKeyboardType) { - size_t i; + DWORD i; DWORD scancode; DWORD codeIndex; diff --git a/winpr/libwinpr/pipe/pipe.c b/winpr/libwinpr/pipe/pipe.c index b537fcbc1..6affbfda1 100644 --- a/winpr/libwinpr/pipe/pipe.c +++ b/winpr/libwinpr/pipe/pipe.c @@ -184,24 +184,28 @@ static BOOL PipeWrite(PVOID Object, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrit return TRUE; } -static HANDLE_OPS ops = { - PipeIsHandled, PipeCloseHandle, - PipeGetFd, NULL, /* CleanupHandle */ - PipeRead, NULL, /* FileReadEx */ - NULL, /* FileReadScatter */ - PipeWrite, NULL, /* FileWriteEx */ - NULL, /* FileWriteGather */ - NULL, /* FileGetFileSize */ - NULL, /* FlushFileBuffers */ - NULL, /* FileSetEndOfFile */ - NULL, /* FileSetFilePointer */ - NULL, /* SetFilePointerEx */ - NULL, /* FileLockFile */ - NULL, /* FileLockFileEx */ - NULL, /* FileUnlockFile */ - NULL, /* FileUnlockFileEx */ - NULL /* SetFileTime */ -}; +static HANDLE_OPS ops = { PipeIsHandled, + PipeCloseHandle, + PipeGetFd, + NULL, /* CleanupHandle */ + PipeRead, + NULL, /* FileReadEx */ + NULL, /* FileReadScatter */ + PipeWrite, + NULL, /* FileWriteEx */ + NULL, /* FileWriteGather */ + NULL, /* FileGetFileSize */ + NULL, /* FlushFileBuffers */ + NULL, /* FileSetEndOfFile */ + NULL, /* FileSetFilePointer */ + NULL, /* SetFilePointerEx */ + NULL, /* FileLockFile */ + NULL, /* FileLockFileEx */ + NULL, /* FileUnlockFile */ + NULL, /* FileUnlockFileEx */ + NULL /* SetFileTime */ + , + NULL }; static BOOL NamedPipeIsHandled(HANDLE handle) { @@ -457,6 +461,7 @@ static HANDLE_OPS namedOps = { NamedPipeIsHandled, NULL, NULL, NULL, + NULL, NULL }; static BOOL InitWinPRPipeModule() diff --git a/winpr/libwinpr/sspicli/sspicli.c b/winpr/libwinpr/sspicli/sspicli.c index 2ebac67d6..5908fcd77 100644 --- a/winpr/libwinpr/sspicli/sspicli.c +++ b/winpr/libwinpr/sspicli/sspicli.c @@ -133,6 +133,7 @@ static HANDLE_OPS ops = { LogonUserIsHandled, NULL, NULL, NULL, + NULL, NULL }; BOOL LogonUserA(LPCSTR lpszUsername, LPCSTR lpszDomain, LPCSTR lpszPassword, DWORD dwLogonType, diff --git a/winpr/libwinpr/synch/event.c b/winpr/libwinpr/synch/event.c index 4347e95b6..98919db0c 100644 --- a/winpr/libwinpr/synch/event.c +++ b/winpr/libwinpr/synch/event.c @@ -245,16 +245,27 @@ static BOOL EventCloseHandle(HANDLE handle) return EventCloseHandle_(event); } -static HANDLE_OPS ops = { EventIsHandled, EventCloseHandle, - EventGetFd, NULL, /* CleanupHandle */ - NULL, NULL, - NULL, NULL, - NULL, NULL, - NULL, NULL, - NULL, NULL, - NULL, NULL, - NULL, NULL, - NULL, NULL }; +static HANDLE_OPS ops = { EventIsHandled, + EventCloseHandle, + EventGetFd, + NULL, /* CleanupHandle */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL }; HANDLE CreateEventW(LPSECURITY_ATTRIBUTES lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCWSTR lpName) diff --git a/winpr/libwinpr/synch/mutex.c b/winpr/libwinpr/synch/mutex.c index 9da9bb753..7aca018e3 100644 --- a/winpr/libwinpr/synch/mutex.c +++ b/winpr/libwinpr/synch/mutex.c @@ -103,16 +103,27 @@ BOOL MutexCloseHandle(HANDLE handle) return TRUE; } -static HANDLE_OPS ops = { MutexIsHandled, MutexCloseHandle, - MutexGetFd, NULL, /* CleanupHandle */ - NULL, NULL, - NULL, NULL, - NULL, NULL, - NULL, NULL, - NULL, NULL, - NULL, NULL, - NULL, NULL, - NULL, NULL }; +static HANDLE_OPS ops = { MutexIsHandled, + MutexCloseHandle, + MutexGetFd, + NULL, /* CleanupHandle */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL }; HANDLE CreateMutexW(LPSECURITY_ATTRIBUTES lpMutexAttributes, BOOL bInitialOwner, LPCWSTR lpName) { diff --git a/winpr/libwinpr/synch/semaphore.c b/winpr/libwinpr/synch/semaphore.c index 881dd81dc..961d70af1 100644 --- a/winpr/libwinpr/synch/semaphore.c +++ b/winpr/libwinpr/synch/semaphore.c @@ -129,6 +129,7 @@ static HANDLE_OPS ops = { SemaphoreIsHandled, NULL, NULL, NULL, + NULL, NULL }; HANDLE CreateSemaphoreW(LPSECURITY_ATTRIBUTES lpSemaphoreAttributes, LONG lInitialCount, diff --git a/winpr/libwinpr/synch/timer.c b/winpr/libwinpr/synch/timer.c index 6f50400a5..4b78d9e72 100644 --- a/winpr/libwinpr/synch/timer.c +++ b/winpr/libwinpr/synch/timer.c @@ -300,16 +300,27 @@ static BOOL timer_drain_fd(int fd) return ret >= 0; } -static HANDLE_OPS ops = { TimerIsHandled, TimerCloseHandle, - TimerGetFd, TimerCleanupHandle, - NULL, NULL, - NULL, NULL, - NULL, NULL, - NULL, NULL, - NULL, NULL, - NULL, NULL, - NULL, NULL, - NULL, NULL }; +static HANDLE_OPS ops = { TimerIsHandled, + TimerCloseHandle, + TimerGetFd, + TimerCleanupHandle, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL }; /** * Waitable Timer diff --git a/winpr/libwinpr/thread/process.c b/winpr/libwinpr/thread/process.c index fe6e30680..2074f8e3b 100644 --- a/winpr/libwinpr/thread/process.c +++ b/winpr/libwinpr/thread/process.c @@ -526,6 +526,7 @@ static HANDLE_OPS ops = { ProcessHandleIsHandle, NULL, NULL, NULL, + NULL, NULL }; HANDLE CreateProcessHandle(pid_t pid) diff --git a/winpr/libwinpr/thread/thread.c b/winpr/libwinpr/thread/thread.c index 0d37a61e3..d22013b64 100644 --- a/winpr/libwinpr/thread/thread.c +++ b/winpr/libwinpr/thread/thread.c @@ -177,6 +177,7 @@ static HANDLE_OPS ops = { ThreadIsHandled, NULL, NULL, NULL, + NULL, NULL }; static void dump_thread(WINPR_THREAD* thread)