From 965d231e49b47ae56a8f00246a1911a65c35c041 Mon Sep 17 00:00:00 2001 From: akallabeth Date: Mon, 16 Sep 2024 04:58:36 +0200 Subject: [PATCH] [return checks] fix use of CloseHandle --- channels/ainput/server/ainput_main.c | 6 ++--- channels/audin/client/alsa/audin_alsa.c | 6 ++--- channels/audin/client/oss/audin_oss.c | 6 ++--- channels/audin/client/sndio/audin_sndio.c | 6 ++--- channels/audin/client/winmm/audin_winmm.c | 6 ++--- channels/audin/server/audin.c | 6 ++--- channels/client/addin.c | 2 +- channels/cliprdr/server/cliprdr_main.c | 6 ++--- channels/disp/server/disp_main.c | 6 ++--- channels/drdynvc/client/drdynvc_main.c | 2 +- channels/drdynvc/server/drdynvc_main.c | 4 +-- channels/drive/client/drive_file.c | 6 ++--- channels/drive/client/drive_main.c | 2 +- channels/echo/server/echo_main.c | 6 ++--- channels/encomsp/client/encomsp_main.c | 2 +- channels/encomsp/server/encomsp_main.c | 6 ++--- channels/gfxredir/server/gfxredir_main.c | 6 ++--- channels/location/server/location_main.c | 6 ++--- channels/parallel/client/parallel_main.c | 2 +- channels/printer/client/printer_main.c | 10 +++---- channels/rail/server/rail_main.c | 6 ++--- channels/rdp2tcp/client/rdp2tcp_main.c | 14 +++++----- channels/rdpdr/client/rdpdr_main.c | 8 +++--- channels/rdpdr/server/rdpdr_main.c | 6 ++--- channels/rdpecam/client/v4l/camera_v4l.c | 2 +- .../server/camera_device_enumerator_main.c | 6 ++--- channels/rdpecam/server/camera_device_main.c | 6 ++--- channels/rdpei/client/rdpei_main.c | 4 +-- channels/rdpemsc/server/mouse_cursor_main.c | 6 ++--- channels/rdpgfx/server/rdpgfx_main.c | 4 +-- channels/rdpsnd/client/rdpsnd_main.c | 2 +- channels/rdpsnd/client/winmm/rdpsnd_winmm.c | 2 +- channels/rdpsnd/server/rdpsnd_main.c | 6 ++--- channels/remdesk/client/remdesk_main.c | 2 +- channels/remdesk/server/remdesk_main.c | 6 ++--- channels/serial/client/serial_main.c | 8 +++--- channels/smartcard/client/smartcard_main.c | 4 +-- channels/sshagent/client/sshagent_main.c | 2 +- channels/telemetry/server/telemetry_main.c | 6 ++--- channels/tsmf/client/tsmf_media.c | 12 ++++----- .../urbdrc/client/libusb/libusb_udevman.c | 4 +-- .../src/main/cpp/android_cliprdr.c | 4 +-- .../freeRDPCore/src/main/cpp/android_event.c | 4 +-- client/Mac/Clipboard.m | 2 +- client/Mac/mf_client.m | 2 +- client/SDL/SDL2/sdl_utils.cpp | 2 +- client/SDL/SDL3/sdl_clip.cpp | 2 +- client/SDL/SDL3/sdl_utils.cpp | 2 +- client/Wayland/wlfreerdp.c | 4 +-- client/Windows/wf_client.c | 2 +- client/Windows/wf_cliprdr.c | 8 +++--- client/X11/xf_client.c | 8 +++--- client/common/client.c | 2 +- client/common/client_cliprdr_file.c | 8 +++--- client/iOS/FreeRDP/ios_cliprdr.m | 4 +-- client/iOS/FreeRDP/ios_freerdp_events.m | 2 +- libfreerdp/core/childsession.c | 6 ++--- libfreerdp/core/freerdp.c | 2 +- libfreerdp/core/gateway/rpc_client.c | 2 +- libfreerdp/core/listener.c | 2 +- libfreerdp/core/message.c | 2 +- libfreerdp/core/peer.c | 2 +- libfreerdp/core/rdp.c | 2 +- libfreerdp/core/tcp.c | 6 ++--- libfreerdp/core/test/TestConnect.c | 18 ++++++------- libfreerdp/core/transport.c | 6 ++--- libfreerdp/utils/smartcard_call.c | 2 +- server/Sample/sfreerdp.c | 6 ++--- server/Windows/wf_directsound.c | 2 +- server/Windows/wf_info.c | 16 ++++++------ server/Windows/wf_peer.c | 6 ++--- server/Windows/wf_wasapi.c | 2 +- server/proxy/pf_context.c | 8 +++--- server/proxy/pf_server.c | 6 ++--- server/shadow/Win/win_rdp.c | 4 +-- server/shadow/X11/x11_shadow.c | 4 +-- server/shadow/shadow_client.c | 2 +- server/shadow/shadow_mcevent.c | 12 ++++----- server/shadow/shadow_server.c | 4 +-- winpr/libwinpr/clipboard/synthetic_file.c | 2 +- winpr/libwinpr/comm/comm.c | 3 +-- winpr/libwinpr/comm/test/TestCommConfig.c | 2 +- winpr/libwinpr/comm/test/TestCommMonitor.c | 2 +- .../error/test/TestErrorSetLastError.c | 8 +++--- .../file/test/TestFileFindFirstFile.c | 4 +-- .../libwinpr/file/test/TestFileGetStdHandle.c | 2 +- .../file/test/TestSetFileAttributes.c | 4 +-- winpr/libwinpr/interlocked/interlocked.c | 2 +- .../pipe/test/TestPipeCreateNamedPipe.c | 26 +++++++++---------- .../test/TestPipeCreateNamedPipeOverlapped.c | 14 +++++----- winpr/libwinpr/pipe/test/TestPipeCreatePipe.c | 4 +-- winpr/libwinpr/pool/pool.c | 6 ++--- winpr/libwinpr/smartcard/smartcard_pcsc.c | 4 +-- winpr/libwinpr/synch/barrier.c | 6 ++--- winpr/libwinpr/synch/test/TestSynchAPC.c | 10 +++---- winpr/libwinpr/synch/test/TestSynchCritical.c | 6 ++--- winpr/libwinpr/synch/test/TestSynchEvent.c | 2 +- winpr/libwinpr/synch/test/TestSynchInit.c | 4 +-- winpr/libwinpr/synch/test/TestSynchMutex.c | 16 ++++++------ .../libwinpr/synch/test/TestSynchSemaphore.c | 2 +- .../libwinpr/synch/test/TestSynchTimerQueue.c | 2 +- .../synch/test/TestSynchWaitableTimer.c | 2 +- .../synch/test/TestSynchWaitableTimerAPC.c | 4 +-- .../thread/test/TestThreadCreateProcess.c | 16 ++++++------ .../thread/test/TestThreadExitThread.c | 2 +- .../utils/collections/CountdownEvent.c | 2 +- .../libwinpr/utils/collections/MessageQueue.c | 2 +- winpr/libwinpr/utils/collections/Queue.c | 2 +- winpr/libwinpr/utils/ssl.c | 6 ++--- winpr/libwinpr/utils/test/TestMessagePipe.c | 4 +-- winpr/libwinpr/utils/test/TestMessageQueue.c | 2 +- winpr/libwinpr/winsock/winsock.c | 3 +-- winpr/libwinpr/wtsapi/wtsapi_win32.c | 6 ++--- 113 files changed, 288 insertions(+), 290 deletions(-) diff --git a/channels/ainput/server/ainput_main.c b/channels/ainput/server/ainput_main.c index 7cbbdb29e..5659d5163 100644 --- a/channels/ainput/server/ainput_main.c +++ b/channels/ainput/server/ainput_main.c @@ -327,7 +327,7 @@ static UINT ainput_server_open(ainput_server_context* context) if (!ainput->thread) { WLog_ERR(TAG, "CreateEvent failed!"); - CloseHandle(ainput->stopEvent); + (void)CloseHandle(ainput->stopEvent); ainput->stopEvent = NULL; return ERROR_INTERNAL_ERROR; } @@ -360,8 +360,8 @@ static UINT ainput_server_close(ainput_server_context* context) return error; } - CloseHandle(ainput->thread); - CloseHandle(ainput->stopEvent); + (void)CloseHandle(ainput->thread); + (void)CloseHandle(ainput->stopEvent); ainput->thread = NULL; ainput->stopEvent = NULL; } diff --git a/channels/audin/client/alsa/audin_alsa.c b/channels/audin/client/alsa/audin_alsa.c index e82662451..e81ec63a5 100644 --- a/channels/audin/client/alsa/audin_alsa.c +++ b/channels/audin/client/alsa/audin_alsa.c @@ -302,7 +302,7 @@ static UINT audin_alsa_open(IAudinDevice* device, AudinReceive receive, void* us return CHANNEL_RC_OK; error_out: - CloseHandle(alsa->stopEvent); + (void)CloseHandle(alsa->stopEvent); alsa->stopEvent = NULL; return ERROR_INTERNAL_ERROR; } @@ -332,9 +332,9 @@ static UINT audin_alsa_close(IAudinDevice* device) return error; } - CloseHandle(alsa->stopEvent); + (void)CloseHandle(alsa->stopEvent); alsa->stopEvent = NULL; - CloseHandle(alsa->thread); + (void)CloseHandle(alsa->thread); alsa->thread = NULL; } diff --git a/channels/audin/client/oss/audin_oss.c b/channels/audin/client/oss/audin_oss.c index b9db46a88..7ffc0cdbc 100644 --- a/channels/audin/client/oss/audin_oss.c +++ b/channels/audin/client/oss/audin_oss.c @@ -309,7 +309,7 @@ static UINT audin_oss_open(IAudinDevice* device, AudinReceive receive, void* use if (!(oss->thread = CreateThread(NULL, 0, audin_oss_thread_func, oss, 0, NULL))) { WLog_ERR(TAG, "CreateThread failed!"); - CloseHandle(oss->stopEvent); + (void)CloseHandle(oss->stopEvent); oss->stopEvent = NULL; return ERROR_INTERNAL_ERROR; } @@ -341,9 +341,9 @@ static UINT audin_oss_close(IAudinDevice* device) return error; } - CloseHandle(oss->stopEvent); + (void)CloseHandle(oss->stopEvent); oss->stopEvent = NULL; - CloseHandle(oss->thread); + (void)CloseHandle(oss->thread); oss->thread = NULL; } diff --git a/channels/audin/client/sndio/audin_sndio.c b/channels/audin/client/sndio/audin_sndio.c index 291b16d20..af5426e72 100644 --- a/channels/audin/client/sndio/audin_sndio.c +++ b/channels/audin/client/sndio/audin_sndio.c @@ -204,7 +204,7 @@ static UINT audin_sndio_open(IAudinDevice* device, AudinReceive receive, void* u sndio, 0, NULL))) { WLog_ERR(TAG, "CreateThread failed"); - CloseHandle(sndio->stopEvent); + (void)CloseHandle(sndio->stopEvent); sndio->stopEvent = NULL; return ERROR_INTERNAL_ERROR; } @@ -236,9 +236,9 @@ static UINT audin_sndio_close(IAudinDevice* device) return error; } - CloseHandle(sndio->stopEvent); + (void)CloseHandle(sndio->stopEvent); sndio->stopEvent = NULL; - CloseHandle(sndio->thread); + (void)CloseHandle(sndio->thread); sndio->thread = NULL; } diff --git a/channels/audin/client/winmm/audin_winmm.c b/channels/audin/client/winmm/audin_winmm.c index c94e41a34..daa59254f 100644 --- a/channels/audin/client/winmm/audin_winmm.c +++ b/channels/audin/client/winmm/audin_winmm.c @@ -304,8 +304,8 @@ static UINT audin_winmm_close(IAudinDevice* device) return error; } - CloseHandle(winmm->thread); - CloseHandle(winmm->stopEvent); + (void)CloseHandle(winmm->thread); + (void)CloseHandle(winmm->stopEvent); winmm->thread = NULL; winmm->stopEvent = NULL; winmm->receive = NULL; @@ -436,7 +436,7 @@ static UINT audin_winmm_open(IAudinDevice* device, AudinReceive receive, void* u if (!(winmm->thread = CreateThread(NULL, 0, audin_winmm_thread_func, winmm, 0, NULL))) { WLog_Print(winmm->log, WLOG_ERROR, "CreateThread failed!"); - CloseHandle(winmm->stopEvent); + (void)CloseHandle(winmm->stopEvent); winmm->stopEvent = NULL; return ERROR_INTERNAL_ERROR; } diff --git a/channels/audin/server/audin.c b/channels/audin/server/audin.c index a898fff1c..0726632a8 100644 --- a/channels/audin/server/audin.c +++ b/channels/audin/server/audin.c @@ -489,7 +489,7 @@ static BOOL audin_server_open(audin_server_context* context) CreateThread(NULL, 0, audin_server_thread_func, (void*)audin, 0, NULL))) { WLog_Print(audin->log, WLOG_ERROR, "CreateThread failed!"); - CloseHandle(audin->stopEvent); + (void)CloseHandle(audin->stopEvent); audin->stopEvent = NULL; return FALSE; } @@ -525,8 +525,8 @@ static BOOL audin_server_close(audin_server_context* context) return FALSE; } - CloseHandle(audin->thread); - CloseHandle(audin->stopEvent); + (void)CloseHandle(audin->thread); + (void)CloseHandle(audin->stopEvent); audin->thread = NULL; audin->stopEvent = NULL; } diff --git a/channels/client/addin.c b/channels/client/addin.c index 76d96b215..4b9bf624b 100644 --- a/channels/client/addin.c +++ b/channels/client/addin.c @@ -594,7 +594,7 @@ static void channel_client_handler_free(msg_proc_internals* internals) return; if (internals->thread) - CloseHandle(internals->thread); + (void)CloseHandle(internals->thread); MessageQueue_Free(internals->queue); Stream_Free(internals->data_in, TRUE); free(internals->channel_name); diff --git a/channels/cliprdr/server/cliprdr_main.c b/channels/cliprdr/server/cliprdr_main.c index a14b5a45f..8e374eb20 100644 --- a/channels/cliprdr/server/cliprdr_main.c +++ b/channels/cliprdr/server/cliprdr_main.c @@ -1395,7 +1395,7 @@ static UINT cliprdr_server_start(CliprdrServerContext* context) if (!(cliprdr->Thread = CreateThread(NULL, 0, cliprdr_server_thread, (void*)context, 0, NULL))) { WLog_ERR(TAG, "CreateThread failed!"); - CloseHandle(cliprdr->StopEvent); + (void)CloseHandle(cliprdr->StopEvent); cliprdr->StopEvent = NULL; return ERROR_INTERNAL_ERROR; } @@ -1429,8 +1429,8 @@ static UINT cliprdr_server_stop(CliprdrServerContext* context) return error; } - CloseHandle(cliprdr->Thread); - CloseHandle(cliprdr->StopEvent); + (void)CloseHandle(cliprdr->Thread); + (void)CloseHandle(cliprdr->StopEvent); } if (cliprdr->ChannelHandle) diff --git a/channels/disp/server/disp_main.c b/channels/disp/server/disp_main.c index 49920e682..620cf8cd0 100644 --- a/channels/disp/server/disp_main.c +++ b/channels/disp/server/disp_main.c @@ -465,7 +465,7 @@ static UINT disp_server_open(DispServerContext* context) CreateThread(NULL, 0, disp_server_thread_func, (void*)context, 0, NULL))) { WLog_ERR(TAG, "CreateEvent failed!"); - CloseHandle(priv->stopEvent); + (void)CloseHandle(priv->stopEvent); priv->stopEvent = NULL; rc = ERROR_INTERNAL_ERROR; goto out_close; @@ -559,8 +559,8 @@ static UINT disp_server_close(DispServerContext* context) return error; } - CloseHandle(priv->thread); - CloseHandle(priv->stopEvent); + (void)CloseHandle(priv->thread); + (void)CloseHandle(priv->stopEvent); priv->thread = NULL; priv->stopEvent = NULL; } diff --git a/channels/drdynvc/client/drdynvc_main.c b/channels/drdynvc/client/drdynvc_main.c index 0ca38887e..4fb9f800e 100644 --- a/channels/drdynvc/client/drdynvc_main.c +++ b/channels/drdynvc/client/drdynvc_main.c @@ -1770,7 +1770,7 @@ static UINT drdynvc_virtual_channel_event_disconnected(drdynvcPlugin* drdynvc) return status; } - CloseHandle(drdynvc->thread); + (void)CloseHandle(drdynvc->thread); drdynvc->thread = NULL; } else diff --git a/channels/drdynvc/server/drdynvc_main.c b/channels/drdynvc/server/drdynvc_main.c index e6c951549..67cf6a5c4 100644 --- a/channels/drdynvc/server/drdynvc_main.c +++ b/channels/drdynvc/server/drdynvc_main.c @@ -138,7 +138,7 @@ static UINT drdynvc_server_start(DrdynvcServerContext* context) CreateThread(NULL, 0, drdynvc_server_thread, (void*)context, 0, NULL))) { WLog_ERR(TAG, "CreateThread failed!"); - CloseHandle(context->priv->StopEvent); + (void)CloseHandle(context->priv->StopEvent); context->priv->StopEvent = NULL; return ERROR_INTERNAL_ERROR; } @@ -163,7 +163,7 @@ static UINT drdynvc_server_stop(DrdynvcServerContext* context) return error; } - CloseHandle(context->priv->Thread); + (void)CloseHandle(context->priv->Thread); return CHANNEL_RC_OK; } diff --git a/channels/drive/client/drive_file.c b/channels/drive/client/drive_file.c index fef202687..840d9163b 100644 --- a/channels/drive/client/drive_file.c +++ b/channels/drive/client/drive_file.c @@ -361,7 +361,7 @@ BOOL drive_file_free(DRIVE_FILE* file) if (file->file_handle != INVALID_HANDLE_VALUE) { - CloseHandle(file->file_handle); + (void)CloseHandle(file->file_handle); file->file_handle = INVALID_HANDLE_VALUE; } @@ -585,7 +585,7 @@ BOOL drive_file_query_information(DRIVE_FILE* file, UINT32 FsInformationClass, w if (hFile != INVALID_HANDLE_VALUE) { status = GetFileInformationByHandle(hFile, &fileInformation); - CloseHandle(hFile); + (void)CloseHandle(hFile); if (!status) goto out_fail; @@ -790,7 +790,7 @@ BOOL drive_file_set_information(DRIVE_FILE* file, UINT32 FsInformationClass, UIN if (file->file_handle != INVALID_HANDLE_VALUE) { - CloseHandle(file->file_handle); + (void)CloseHandle(file->file_handle); file->file_handle = INVALID_HANDLE_VALUE; } diff --git a/channels/drive/client/drive_main.c b/channels/drive/client/drive_main.c index 089ea2cb7..b85fc7e24 100644 --- a/channels/drive/client/drive_main.c +++ b/channels/drive/client/drive_main.c @@ -822,7 +822,7 @@ static UINT drive_free_int(DRIVE_DEVICE* drive) if (!drive) return ERROR_INVALID_PARAMETER; - CloseHandle(drive->thread); + (void)CloseHandle(drive->thread); ListDictionary_Free(drive->files); MessageQueue_Free(drive->IrpQueue); Stream_Free(drive->device.data, TRUE); diff --git a/channels/echo/server/echo_main.c b/channels/echo/server/echo_main.c index 1eb416cda..52a4fa678 100644 --- a/channels/echo/server/echo_main.c +++ b/channels/echo/server/echo_main.c @@ -307,7 +307,7 @@ static UINT echo_server_open(echo_server_context* context) if (!(echo->thread = CreateThread(NULL, 0, echo_server_thread_func, (void*)echo, 0, NULL))) { WLog_ERR(TAG, "CreateEvent failed!"); - CloseHandle(echo->stopEvent); + (void)CloseHandle(echo->stopEvent); echo->stopEvent = NULL; return ERROR_INTERNAL_ERROR; } @@ -337,8 +337,8 @@ static UINT echo_server_close(echo_server_context* context) return error; } - CloseHandle(echo->thread); - CloseHandle(echo->stopEvent); + (void)CloseHandle(echo->thread); + (void)CloseHandle(echo->stopEvent); echo->thread = NULL; echo->stopEvent = NULL; } diff --git a/channels/encomsp/client/encomsp_main.c b/channels/encomsp/client/encomsp_main.c index a4fe9888e..e725872f7 100644 --- a/channels/encomsp/client/encomsp_main.c +++ b/channels/encomsp/client/encomsp_main.c @@ -1137,7 +1137,7 @@ static UINT encomsp_virtual_channel_event_disconnected(encomspPlugin* encomsp) } MessageQueue_Free(encomsp->queue); - CloseHandle(encomsp->thread); + (void)CloseHandle(encomsp->thread); encomsp->queue = NULL; encomsp->thread = NULL; diff --git a/channels/encomsp/server/encomsp_main.c b/channels/encomsp/server/encomsp_main.c index 009e2d9e0..2122bcb8f 100644 --- a/channels/encomsp/server/encomsp_main.c +++ b/channels/encomsp/server/encomsp_main.c @@ -311,7 +311,7 @@ static UINT encomsp_server_start(EncomspServerContext* context) CreateThread(NULL, 0, encomsp_server_thread, (void*)context, 0, NULL))) { WLog_ERR(TAG, "CreateThread failed!"); - CloseHandle(context->priv->StopEvent); + (void)CloseHandle(context->priv->StopEvent); context->priv->StopEvent = NULL; return ERROR_INTERNAL_ERROR; } @@ -336,8 +336,8 @@ static UINT encomsp_server_stop(EncomspServerContext* context) return error; } - CloseHandle(context->priv->Thread); - CloseHandle(context->priv->StopEvent); + (void)CloseHandle(context->priv->Thread); + (void)CloseHandle(context->priv->StopEvent); return error; } diff --git a/channels/gfxredir/server/gfxredir_main.c b/channels/gfxredir/server/gfxredir_main.c index 3b398a167..0d1b0371b 100644 --- a/channels/gfxredir/server/gfxredir_main.c +++ b/channels/gfxredir/server/gfxredir_main.c @@ -679,7 +679,7 @@ static UINT gfxredir_server_open(GfxRedirServerContext* context) CreateThread(NULL, 0, gfxredir_server_thread_func, (void*)context, 0, NULL))) { WLog_ERR(TAG, "CreateEvent failed!"); - CloseHandle(priv->stopEvent); + (void)CloseHandle(priv->stopEvent); priv->stopEvent = NULL; rc = ERROR_INTERNAL_ERROR; } @@ -714,8 +714,8 @@ static UINT gfxredir_server_close(GfxRedirServerContext* context) return error; } - CloseHandle(priv->thread); - CloseHandle(priv->stopEvent); + (void)CloseHandle(priv->thread); + (void)CloseHandle(priv->stopEvent); priv->thread = NULL; priv->stopEvent = NULL; } diff --git a/channels/location/server/location_main.c b/channels/location/server/location_main.c index 3f2e06d26..93f8cf339 100644 --- a/channels/location/server/location_main.c +++ b/channels/location/server/location_main.c @@ -456,7 +456,7 @@ static UINT location_server_open(LocationServerContext* context) if (!location->thread) { WLog_ERR(TAG, "CreateThread failed!"); - CloseHandle(location->stopEvent); + (void)CloseHandle(location->stopEvent); location->stopEvent = NULL; return ERROR_INTERNAL_ERROR; } @@ -484,8 +484,8 @@ static UINT location_server_close(LocationServerContext* context) return error; } - CloseHandle(location->thread); - CloseHandle(location->stopEvent); + (void)CloseHandle(location->thread); + (void)CloseHandle(location->stopEvent); location->thread = NULL; location->stopEvent = NULL; } diff --git a/channels/parallel/client/parallel_main.c b/channels/parallel/client/parallel_main.c index 1eb2320f6..c459a77d9 100644 --- a/channels/parallel/client/parallel_main.c +++ b/channels/parallel/client/parallel_main.c @@ -395,7 +395,7 @@ static UINT parallel_free_int(PARALLEL_DEVICE* parallel) "WaitForSingleObject failed with error %" PRIu32 "!", error); } - CloseHandle(parallel->thread); + (void)CloseHandle(parallel->thread); Stream_Free(parallel->device.data, TRUE); MessageQueue_Free(parallel->queue); } diff --git a/channels/printer/client/printer_main.c b/channels/printer/client/printer_main.c index 40cfeda70..fda39541f 100644 --- a/channels/printer/client/printer_main.c +++ b/channels/printer/client/printer_main.c @@ -139,7 +139,7 @@ static BOOL printer_write_setting(const char* path, prn_conf_t type, const void* rc = TRUE; fail: - CloseHandle(file); + (void)CloseHandle(file); free(base64); return rc; } @@ -194,7 +194,7 @@ static BOOL printer_read_setting(const char* path, prn_conf_t type, void** data, } fail: - CloseHandle(file); + (void)CloseHandle(file); if (rc && (lowSize <= INT_MAX)) { @@ -929,9 +929,9 @@ static UINT printer_free(DEVICE* device) irp->Discard(irp); } - CloseHandle(printer_dev->thread); - CloseHandle(printer_dev->stopEvent); - CloseHandle(printer_dev->event); + (void)CloseHandle(printer_dev->thread); + (void)CloseHandle(printer_dev->stopEvent); + (void)CloseHandle(printer_dev->event); winpr_aligned_free(printer_dev->pIrpList); } diff --git a/channels/rail/server/rail_main.c b/channels/rail/server/rail_main.c index fb76e5f44..428178db6 100644 --- a/channels/rail/server/rail_main.c +++ b/channels/rail/server/rail_main.c @@ -1459,7 +1459,7 @@ static UINT rail_server_start(RailServerContext* context) return CHANNEL_RC_OK; out_stop_event: - CloseHandle(context->priv->stopEvent); + (void)CloseHandle(context->priv->stopEvent); context->priv->stopEvent = NULL; out_close: (void)WTSVirtualChannelClose(context->priv->rail_channel); @@ -1481,8 +1481,8 @@ static BOOL rail_server_stop(RailServerContext* context) return FALSE; } - CloseHandle(priv->thread); - CloseHandle(priv->stopEvent); + (void)CloseHandle(priv->thread); + (void)CloseHandle(priv->stopEvent); priv->thread = NULL; priv->stopEvent = NULL; } diff --git a/channels/rdp2tcp/client/rdp2tcp_main.c b/channels/rdp2tcp/client/rdp2tcp_main.c index ac966c1e5..e59adf47b 100644 --- a/channels/rdp2tcp/client/rdp2tcp_main.c +++ b/channels/rdp2tcp/client/rdp2tcp_main.c @@ -103,9 +103,9 @@ static int init_external_addin(Plugin* plugin) } plugin->hProcess = procInfo.hProcess; - CloseHandle(procInfo.hThread); - CloseHandle(siStartInfo.hStdOutput); - CloseHandle(siStartInfo.hStdInput); + (void)CloseHandle(procInfo.hThread); + (void)CloseHandle(siStartInfo.hStdOutput); + (void)CloseHandle(siStartInfo.hStdInput); return 0; } @@ -263,12 +263,12 @@ static void channel_terminated(Plugin* plugin) if (plugin->copyThread) (void)TerminateThread(plugin->copyThread, 0); if (plugin->writeComplete) - CloseHandle(plugin->writeComplete); + (void)CloseHandle(plugin->writeComplete); - CloseHandle(plugin->hStdInputWrite); - CloseHandle(plugin->hStdOutputRead); + (void)CloseHandle(plugin->hStdInputWrite); + (void)CloseHandle(plugin->hStdOutputRead); TerminateProcess(plugin->hProcess, 0); - CloseHandle(plugin->hProcess); + (void)CloseHandle(plugin->hProcess); free(plugin->commandline); free(plugin); } diff --git a/channels/rdpdr/client/rdpdr_main.c b/channels/rdpdr/client/rdpdr_main.c index dbfebc343..9788736da 100644 --- a/channels/rdpdr/client/rdpdr_main.c +++ b/channels/rdpdr/client/rdpdr_main.c @@ -706,7 +706,7 @@ static DWORD WINAPI drive_hotplug_thread_func(LPVOID arg) out: if (rdpdr->stopEvent) { - CloseHandle(rdpdr->stopEvent); + (void)CloseHandle(rdpdr->stopEvent); rdpdr->stopEvent = NULL; } ExitThread(CHANNEL_RC_OK); @@ -1083,7 +1083,7 @@ out: if (rdpdr->stopEvent) { - CloseHandle(rdpdr->stopEvent); + (void)CloseHandle(rdpdr->stopEvent); rdpdr->stopEvent = NULL; } @@ -1123,7 +1123,7 @@ static UINT drive_hotplug_thread_terminate(rdpdrPlugin* rdpdr) return error; } - CloseHandle(rdpdr->hotplugThread); + (void)CloseHandle(rdpdr->hotplugThread); rdpdr->hotplugThread = NULL; } @@ -2193,7 +2193,7 @@ static UINT rdpdr_virtual_channel_event_disconnected(rdpdrPlugin* rdpdr) } if (rdpdr->thread) - CloseHandle(rdpdr->thread); + (void)CloseHandle(rdpdr->thread); MessageQueue_Free(rdpdr->queue); rdpdr->queue = NULL; rdpdr->thread = NULL; diff --git a/channels/rdpdr/server/rdpdr_main.c b/channels/rdpdr/server/rdpdr_main.c index 6d1c690ba..e0fde30a2 100644 --- a/channels/rdpdr/server/rdpdr_main.c +++ b/channels/rdpdr/server/rdpdr_main.c @@ -2147,7 +2147,7 @@ static UINT rdpdr_server_start(RdpdrServerContext* context) CreateThread(NULL, 0, rdpdr_server_thread, (void*)context, 0, NULL))) { WLog_Print(context->priv->log, WLOG_ERROR, "CreateThread failed!"); - CloseHandle(context->priv->StopEvent); + (void)CloseHandle(context->priv->StopEvent); context->priv->StopEvent = NULL; return ERROR_INTERNAL_ERROR; } @@ -2178,9 +2178,9 @@ static UINT rdpdr_server_stop(RdpdrServerContext* context) return error; } - CloseHandle(context->priv->Thread); + (void)CloseHandle(context->priv->Thread); context->priv->Thread = NULL; - CloseHandle(context->priv->StopEvent); + (void)CloseHandle(context->priv->StopEvent); context->priv->StopEvent = NULL; } diff --git a/channels/rdpecam/client/v4l/camera_v4l.c b/channels/rdpecam/client/v4l/camera_v4l.c index e27bd4b74..601ba083e 100644 --- a/channels/rdpecam/client/v4l/camera_v4l.c +++ b/channels/rdpecam/client/v4l/camera_v4l.c @@ -531,7 +531,7 @@ UINT cam_v4l_stream_stop(CamV4lStream* stream) if (stream->captureThread) { WaitForSingleObject(stream->captureThread, INFINITE); - CloseHandle(stream->captureThread); + (void)CloseHandle(stream->captureThread); stream->captureThread = NULL; } diff --git a/channels/rdpecam/server/camera_device_enumerator_main.c b/channels/rdpecam/server/camera_device_enumerator_main.c index 89fb75782..57e6c61d5 100644 --- a/channels/rdpecam/server/camera_device_enumerator_main.c +++ b/channels/rdpecam/server/camera_device_enumerator_main.c @@ -449,7 +449,7 @@ static UINT enumerator_server_open(CamDevEnumServerContext* context) if (!enumerator->thread) { WLog_ERR(TAG, "CreateThread failed!"); - CloseHandle(enumerator->stopEvent); + (void)CloseHandle(enumerator->stopEvent); enumerator->stopEvent = NULL; return ERROR_INTERNAL_ERROR; } @@ -477,8 +477,8 @@ static UINT enumerator_server_close(CamDevEnumServerContext* context) return error; } - CloseHandle(enumerator->thread); - CloseHandle(enumerator->stopEvent); + (void)CloseHandle(enumerator->thread); + (void)CloseHandle(enumerator->stopEvent); enumerator->thread = NULL; enumerator->stopEvent = NULL; } diff --git a/channels/rdpecam/server/camera_device_main.c b/channels/rdpecam/server/camera_device_main.c index 1b1915f97..555c39a3f 100644 --- a/channels/rdpecam/server/camera_device_main.c +++ b/channels/rdpecam/server/camera_device_main.c @@ -601,7 +601,7 @@ static UINT device_server_open(CameraDeviceServerContext* context) if (!device->thread) { WLog_ERR(TAG, "CreateThread failed!"); - CloseHandle(device->stopEvent); + (void)CloseHandle(device->stopEvent); device->stopEvent = NULL; return ERROR_INTERNAL_ERROR; } @@ -629,8 +629,8 @@ static UINT device_server_close(CameraDeviceServerContext* context) return error; } - CloseHandle(device->thread); - CloseHandle(device->stopEvent); + (void)CloseHandle(device->thread); + (void)CloseHandle(device->stopEvent); device->thread = NULL; device->stopEvent = NULL; } diff --git a/channels/rdpei/client/rdpei_main.c b/channels/rdpei/client/rdpei_main.c index 8a3e06109..4adb700d5 100644 --- a/channels/rdpei/client/rdpei_main.c +++ b/channels/rdpei/client/rdpei_main.c @@ -1447,11 +1447,11 @@ static void terminate_plugin_cb(GENERIC_DYNVC_PLUGIN* base) if (rdpei->thread) { WaitForSingleObject(rdpei->thread, INFINITE); - CloseHandle(rdpei->thread); + (void)CloseHandle(rdpei->thread); } if (rdpei->event) - CloseHandle(rdpei->event); + (void)CloseHandle(rdpei->event); DeleteCriticalSection(&rdpei->lock); free(rdpei->context); diff --git a/channels/rdpemsc/server/mouse_cursor_main.c b/channels/rdpemsc/server/mouse_cursor_main.c index 8e8aa899a..747bc77ef 100644 --- a/channels/rdpemsc/server/mouse_cursor_main.c +++ b/channels/rdpemsc/server/mouse_cursor_main.c @@ -406,7 +406,7 @@ static UINT mouse_cursor_server_open(MouseCursorServerContext* context) if (!mouse_cursor->thread) { WLog_ERR(TAG, "CreateThread failed!"); - CloseHandle(mouse_cursor->stopEvent); + (void)CloseHandle(mouse_cursor->stopEvent); mouse_cursor->stopEvent = NULL; return ERROR_INTERNAL_ERROR; } @@ -434,8 +434,8 @@ static UINT mouse_cursor_server_close(MouseCursorServerContext* context) return error; } - CloseHandle(mouse_cursor->thread); - CloseHandle(mouse_cursor->stopEvent); + (void)CloseHandle(mouse_cursor->thread); + (void)CloseHandle(mouse_cursor->stopEvent); mouse_cursor->thread = NULL; mouse_cursor->stopEvent = NULL; } diff --git a/channels/rdpgfx/server/rdpgfx_main.c b/channels/rdpgfx/server/rdpgfx_main.c index d9a92499b..2dc76b6cf 100644 --- a/channels/rdpgfx/server/rdpgfx_main.c +++ b/channels/rdpgfx/server/rdpgfx_main.c @@ -1638,8 +1638,8 @@ BOOL rdpgfx_server_close(RdpgfxServerContext* context) return FALSE; } - CloseHandle(priv->thread); - CloseHandle(priv->stopEvent); + (void)CloseHandle(priv->thread); + (void)CloseHandle(priv->stopEvent); priv->thread = NULL; priv->stopEvent = NULL; } diff --git a/channels/rdpsnd/client/rdpsnd_main.c b/channels/rdpsnd/client/rdpsnd_main.c index f87ab007c..6efefbeea 100644 --- a/channels/rdpsnd/client/rdpsnd_main.c +++ b/channels/rdpsnd/client/rdpsnd_main.c @@ -1462,7 +1462,7 @@ void rdpsnd_virtual_channel_event_terminated(rdpsndPlugin* rdpsnd) if (rdpsnd->thread) { WaitForSingleObject(rdpsnd->thread, INFINITE); - CloseHandle(rdpsnd->thread); + (void)CloseHandle(rdpsnd->thread); } MessageQueue_Free(rdpsnd->queue); diff --git a/channels/rdpsnd/client/winmm/rdpsnd_winmm.c b/channels/rdpsnd/client/winmm/rdpsnd_winmm.c index 205a6cb2d..6a39aebbb 100644 --- a/channels/rdpsnd/client/winmm/rdpsnd_winmm.c +++ b/channels/rdpsnd/client/winmm/rdpsnd_winmm.c @@ -181,7 +181,7 @@ static void rdpsnd_winmm_close(rdpsndDevicePlugin* device) if (winmm->hThread) { WaitForSingleObject(winmm->hThread, INFINITE); - CloseHandle(winmm->hThread); + (void)CloseHandle(winmm->hThread); winmm->hThread = NULL; } } diff --git a/channels/rdpsnd/server/rdpsnd_main.c b/channels/rdpsnd/server/rdpsnd_main.c index d7b498ddd..436060e84 100644 --- a/channels/rdpsnd/server/rdpsnd_main.c +++ b/channels/rdpsnd/server/rdpsnd_main.c @@ -957,7 +957,7 @@ static UINT rdpsnd_server_start(RdpsndServerContext* context) return CHANNEL_RC_OK; out_stopEvent: - CloseHandle(context->priv->StopEvent); + (void)CloseHandle(context->priv->StopEvent); context->priv->StopEvent = NULL; out_lock: DeleteCriticalSection(&context->priv->lock); @@ -998,8 +998,8 @@ static UINT rdpsnd_server_stop(RdpsndServerContext* context) return error; } - CloseHandle(context->priv->Thread); - CloseHandle(context->priv->StopEvent); + (void)CloseHandle(context->priv->Thread); + (void)CloseHandle(context->priv->StopEvent); context->priv->Thread = NULL; context->priv->StopEvent = NULL; } diff --git a/channels/remdesk/client/remdesk_main.c b/channels/remdesk/client/remdesk_main.c index 978f5c6e2..837f69dcc 100644 --- a/channels/remdesk/client/remdesk_main.c +++ b/channels/remdesk/client/remdesk_main.c @@ -970,7 +970,7 @@ static UINT remdesk_virtual_channel_event_disconnected(remdeskPlugin* remdesk) remdesk->OpenHandle = 0; } MessageQueue_Free(remdesk->queue); - CloseHandle(remdesk->thread); + (void)CloseHandle(remdesk->thread); Stream_Free(remdesk->data_in, TRUE); remdesk->data_in = NULL; remdesk->queue = NULL; diff --git a/channels/remdesk/server/remdesk_main.c b/channels/remdesk/server/remdesk_main.c index a1b24b87a..4c876819f 100644 --- a/channels/remdesk/server/remdesk_main.c +++ b/channels/remdesk/server/remdesk_main.c @@ -669,7 +669,7 @@ static UINT remdesk_server_start(RemdeskServerContext* context) CreateThread(NULL, 0, remdesk_server_thread, (void*)context, 0, NULL))) { WLog_ERR(TAG, "CreateThread failed!"); - CloseHandle(context->priv->StopEvent); + (void)CloseHandle(context->priv->StopEvent); context->priv->StopEvent = NULL; return ERROR_INTERNAL_ERROR; } @@ -694,8 +694,8 @@ static UINT remdesk_server_stop(RemdeskServerContext* context) return error; } - CloseHandle(context->priv->Thread); - CloseHandle(context->priv->StopEvent); + (void)CloseHandle(context->priv->Thread); + (void)CloseHandle(context->priv->StopEvent); return CHANNEL_RC_OK; } diff --git a/channels/serial/client/serial_main.c b/channels/serial/client/serial_main.c index eb4cf3952..fe363a46e 100644 --- a/channels/serial/client/serial_main.c +++ b/channels/serial/client/serial_main.c @@ -685,7 +685,7 @@ static void create_irp_thread(SERIAL_DEVICE* serial, IRP* irp) return; error_handle: if (irpThread) - CloseHandle(irpThread); + (void)CloseHandle(irpThread); irp->IoStatus = STATUS_NO_MEMORY; irp->Complete(irp); free(data); @@ -785,11 +785,11 @@ static UINT serial_free(DEVICE* device) WLog_Print(serial->log, WLOG_ERROR, "WaitForSingleObject failed with error %" PRIu32 "!", error); } - CloseHandle(serial->MainThread); + (void)CloseHandle(serial->MainThread); } if (serial->hComm) - CloseHandle(serial->hComm); + (void)CloseHandle(*serial->hComm); /* Clean up resources */ Stream_Free(serial->device.data, TRUE); @@ -827,7 +827,7 @@ static void irp_thread_close(void* arg) { (void)TerminateThread(hdl, 0); WaitForSingleObject(hdl, INFINITE); - CloseHandle(hdl); + (void)CloseHandle(hdl); } } } diff --git a/channels/smartcard/client/smartcard_main.c b/channels/smartcard/client/smartcard_main.c index 71951a6a5..00e559a98 100644 --- a/channels/smartcard/client/smartcard_main.c +++ b/channels/smartcard/client/smartcard_main.c @@ -232,7 +232,7 @@ void smartcard_context_free(void* pCtx) if (WaitForSingleObject(pContext->thread, INFINITE) == WAIT_FAILED) WLog_ERR(TAG, "WaitForSingleObject failed with error %" PRIu32 "!", GetLastError()); - CloseHandle(pContext->thread); + (void)CloseHandle(pContext->thread); } MessageQueue_Free(pContext->IrpQueue); } @@ -253,7 +253,7 @@ static UINT smartcard_free_(SMARTCARD_DEVICE* smartcard) if (smartcard->IrpQueue) { MessageQueue_Free(smartcard->IrpQueue); - CloseHandle(smartcard->thread); + (void)CloseHandle(smartcard->thread); } Stream_Free(smartcard->device.data, TRUE); diff --git a/channels/sshagent/client/sshagent_main.c b/channels/sshagent/client/sshagent_main.c index 293ea2989..508278908 100644 --- a/channels/sshagent/client/sshagent_main.c +++ b/channels/sshagent/client/sshagent_main.c @@ -233,7 +233,7 @@ static UINT sshagent_on_close(IWTSVirtualChannelCallback* pChannelCallback) return error; } - CloseHandle(callback->thread); + (void)CloseHandle(callback->thread); LeaveCriticalSection(&callback->lock); DeleteCriticalSection(&callback->lock); free(callback); diff --git a/channels/telemetry/server/telemetry_main.c b/channels/telemetry/server/telemetry_main.c index cf7a2d982..ae099f0f4 100644 --- a/channels/telemetry/server/telemetry_main.c +++ b/channels/telemetry/server/telemetry_main.c @@ -325,7 +325,7 @@ static UINT telemetry_server_open(TelemetryServerContext* context) if (!telemetry->thread) { WLog_ERR(TAG, "CreateThread failed!"); - CloseHandle(telemetry->stopEvent); + (void)CloseHandle(telemetry->stopEvent); telemetry->stopEvent = NULL; return ERROR_INTERNAL_ERROR; } @@ -353,8 +353,8 @@ static UINT telemetry_server_close(TelemetryServerContext* context) return error; } - CloseHandle(telemetry->thread); - CloseHandle(telemetry->stopEvent); + (void)CloseHandle(telemetry->thread); + (void)CloseHandle(telemetry->stopEvent); telemetry->thread = NULL; telemetry->stopEvent = NULL; } diff --git a/channels/tsmf/client/tsmf_media.c b/channels/tsmf/client/tsmf_media.c index 81717bc66..dcad0831f 100644 --- a/channels/tsmf/client/tsmf_media.c +++ b/channels/tsmf/client/tsmf_media.c @@ -1277,9 +1277,9 @@ error_play_thread: error_sample_ack_list: Queue_Free(stream->sample_list); error_sample_list: - CloseHandle(stream->ready); + (void)CloseHandle(stream->ready); error_ready: - CloseHandle(stream->stopEvent); + (void)CloseHandle(stream->stopEvent); error_stopEvent: free(stream); return NULL; @@ -1412,7 +1412,7 @@ void s_tsmf_stream_free(void* obj) return; } - CloseHandle(stream->play_thread); + (void)CloseHandle(stream->play_thread); stream->play_thread = NULL; } @@ -1424,7 +1424,7 @@ void s_tsmf_stream_free(void* obj) return; } - CloseHandle(stream->ack_thread); + (void)CloseHandle(stream->ack_thread); stream->ack_thread = NULL; } @@ -1437,8 +1437,8 @@ void s_tsmf_stream_free(void* obj) stream->decoder = NULL; } - CloseHandle(stream->stopEvent); - CloseHandle(stream->ready); + (void)CloseHandle(stream->stopEvent); + (void)CloseHandle(stream->ready); ZeroMemory(stream, sizeof(TSMF_STREAM)); free(stream); } diff --git a/channels/urbdrc/client/libusb/libusb_udevman.c b/channels/urbdrc/client/libusb/libusb_udevman.c index 541d0e366..1c5f45555 100644 --- a/channels/urbdrc/client/libusb/libusb_udevman.c +++ b/channels/urbdrc/client/libusb/libusb_udevman.c @@ -470,13 +470,13 @@ static void udevman_free(IUDEVMAN* idevman) if (udevman->thread) { WaitForSingleObject(udevman->thread, INFINITE); - CloseHandle(udevman->thread); + (void)CloseHandle(udevman->thread); } udevman_unregister_all_udevices(idevman); if (udevman->devman_loading) - CloseHandle(udevman->devman_loading); + (void)CloseHandle(udevman->devman_loading); libusb_exit(udevman->context); diff --git a/client/Android/Studio/freeRDPCore/src/main/cpp/android_cliprdr.c b/client/Android/Studio/freeRDPCore/src/main/cpp/android_cliprdr.c index b6601e95e..150ff64aa 100644 --- a/client/Android/Studio/freeRDPCore/src/main/cpp/android_cliprdr.c +++ b/client/Android/Studio/freeRDPCore/src/main/cpp/android_cliprdr.c @@ -475,7 +475,7 @@ BOOL android_cliprdr_init(androidContext* afc, CliprdrClientContext* cliprdr) if (!(clipboard = ClipboardCreate())) { - CloseHandle(hevent); + (void)CloseHandle(hevent); return FALSE; } @@ -504,6 +504,6 @@ BOOL android_cliprdr_uninit(androidContext* afc, CliprdrClientContext* cliprdr) cliprdr->custom = NULL; afc->cliprdr = NULL; ClipboardDestroy(afc->clipboard); - CloseHandle(afc->clipboardRequestEvent); + (void)CloseHandle(afc->clipboardRequestEvent); return TRUE; } 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 1a132534a..da3d2aab2 100644 --- a/client/Android/Studio/freeRDPCore/src/main/cpp/android_event.c +++ b/client/Android/Studio/freeRDPCore/src/main/cpp/android_event.c @@ -325,7 +325,7 @@ BOOL android_event_queue_init(freerdp* inst) if (!queue->events) { WLog_ERR(TAG, "android_event_queue_init: memory allocation failed"); - CloseHandle(queue->isSet); + (void)CloseHandle(queue->isSet); free(queue); return FALSE; } @@ -349,7 +349,7 @@ void android_event_queue_uninit(freerdp* inst) { if (queue->isSet) { - CloseHandle(queue->isSet); + (void)CloseHandle(queue->isSet); queue->isSet = NULL; } diff --git a/client/Mac/Clipboard.m b/client/Mac/Clipboard.m index 02d7b39be..e95424878 100644 --- a/client/Mac/Clipboard.m +++ b/client/Mac/Clipboard.m @@ -428,5 +428,5 @@ void mac_cliprdr_uninit(mfContext *mfc, CliprdrClientContext *cliprdr) mfc->cliprdr = NULL; ClipboardDestroy(mfc->clipboard); - CloseHandle(mfc->clipboardRequestEvent); + (void)CloseHandle(mfc->clipboardRequestEvent); } diff --git a/client/Mac/mf_client.m b/client/Mac/mf_client.m index 76c89b377..1dcc1577c 100644 --- a/client/Mac/mf_client.m +++ b/client/Mac/mf_client.m @@ -111,7 +111,7 @@ static void mfreerdp_client_free(freerdp *instance, rdpContext *context) return; mfc = (mfContext *)instance->context; - CloseHandle(mfc->stopEvent); + (void)CloseHandle(mfc->stopEvent); } static void mf_scale_mouse_coordinates(mfContext *mfc, UINT16 *px, UINT16 *py) diff --git a/client/SDL/SDL2/sdl_utils.cpp b/client/SDL/SDL2/sdl_utils.cpp index a10bd1ed3..b7729f1fe 100644 --- a/client/SDL/SDL2/sdl_utils.cpp +++ b/client/SDL/SDL2/sdl_utils.cpp @@ -260,7 +260,7 @@ WinPREvent::WinPREvent(bool initial) WinPREvent::~WinPREvent() { - CloseHandle(_handle); + (void)CloseHandle(_handle); } void WinPREvent::set() diff --git a/client/SDL/SDL3/sdl_clip.cpp b/client/SDL/SDL3/sdl_clip.cpp index 7e19d15b2..aa5a7ea60 100644 --- a/client/SDL/SDL3/sdl_clip.cpp +++ b/client/SDL/SDL3/sdl_clip.cpp @@ -101,7 +101,7 @@ sdlClip::~sdlClip() { cliprdr_file_context_free(_file); ClipboardDestroy(_system); - CloseHandle(_event); + (void)CloseHandle(_event); } BOOL sdlClip::init(CliprdrClientContext* clip) diff --git a/client/SDL/SDL3/sdl_utils.cpp b/client/SDL/SDL3/sdl_utils.cpp index 6e59a2b73..e46edb634 100644 --- a/client/SDL/SDL3/sdl_utils.cpp +++ b/client/SDL/SDL3/sdl_utils.cpp @@ -306,7 +306,7 @@ WinPREvent::WinPREvent(bool initial) WinPREvent::~WinPREvent() { - CloseHandle(_handle); + (void)CloseHandle(_handle); } void WinPREvent::set() diff --git a/client/Wayland/wlfreerdp.c b/client/Wayland/wlfreerdp.c index 5b44d74e8..023883d44 100644 --- a/client/Wayland/wlfreerdp.c +++ b/client/Wayland/wlfreerdp.c @@ -575,7 +575,7 @@ static int wlfreerdp_run(freerdp* instance) disconnect: if (timer) - CloseHandle(timer); + (void)CloseHandle(timer); freerdp_disconnect(instance); return status; } @@ -619,7 +619,7 @@ static void wlf_client_free(freerdp* instance, rdpContext* context) UwacCloseDisplay(&wlf->display); if (wlf->displayHandle) - CloseHandle(wlf->displayHandle); + (void)CloseHandle(wlf->displayHandle); ArrayList_Free(wlf->events); DeleteCriticalSection(&wlf->critical); } diff --git a/client/Windows/wf_client.c b/client/Windows/wf_client.c index 59f924f24..647090265 100644 --- a/client/Windows/wf_client.c +++ b/client/Windows/wf_client.c @@ -1467,7 +1467,7 @@ static int wfreerdp_client_stop(rdpContext* context) { PostThreadMessage(wfc->keyboardThreadId, WM_QUIT, 0, 0); WaitForSingleObject(wfc->keyboardThread, INFINITE); - CloseHandle(wfc->keyboardThread); + (void)CloseHandle(wfc->keyboardThread); wfc->keyboardThread = NULL; wfc->keyboardThreadId = 0; } diff --git a/client/Windows/wf_cliprdr.c b/client/Windows/wf_cliprdr.c index 97218ac1f..63f4b3fee 100644 --- a/client/Windows/wf_cliprdr.c +++ b/client/Windows/wf_cliprdr.c @@ -1672,7 +1672,7 @@ static FILEDESCRIPTORW* wf_cliprdr_get_file_descriptor(WCHAR* file_name, size_t fd->nFileSizeLow = GetFileSize(hFile, &fd->nFileSizeHigh); wcscpy_s(fd->cFileName, sizeof(fd->cFileName) / 2, file_name + pathLen); - CloseHandle(hFile); + (void)CloseHandle(hFile); return fd; } @@ -2536,14 +2536,14 @@ BOOL wf_cliprdr_uninit(wfContext* wfc, CliprdrClientContext* cliprdr) if (clipboard->thread) { WaitForSingleObject(clipboard->thread, INFINITE); - CloseHandle(clipboard->thread); + (void)CloseHandle(clipboard->thread); } if (clipboard->response_data_event) - CloseHandle(clipboard->response_data_event); + (void)CloseHandle(clipboard->response_data_event); if (clipboard->req_fevent) - CloseHandle(clipboard->req_fevent); + (void)CloseHandle(clipboard->req_fevent); clear_file_array(clipboard); clear_format_map(clipboard); diff --git a/client/X11/xf_client.c b/client/X11/xf_client.c index d02134830..3cf227e42 100644 --- a/client/X11/xf_client.c +++ b/client/X11/xf_client.c @@ -1452,7 +1452,7 @@ static void xf_post_disconnect(freerdp* instance) if (xfc->pipethread) { WaitForSingleObject(xfc->pipethread, INFINITE); - CloseHandle(xfc->pipethread); + (void)CloseHandle(xfc->pipethread); xfc->pipethread = NULL; } if (xfc->clipboard) @@ -1681,7 +1681,7 @@ static DWORD WINAPI xf_client_thread(LPVOID param) disconnect: if (timer) - CloseHandle(timer); + (void)CloseHandle(timer); freerdp_disconnect(instance); end: @@ -1832,13 +1832,13 @@ void xf_teardown_x11(xfContext* xfc) if (xfc->x11event) { - CloseHandle(xfc->x11event); + (void)CloseHandle(xfc->x11event); xfc->x11event = NULL; } if (xfc->mutex) { - CloseHandle(xfc->mutex); + (void)CloseHandle(xfc->mutex); xfc->mutex = NULL; } diff --git a/client/common/client.c b/client/common/client.c index 632d7e197..78805a8f8 100644 --- a/client/common/client.c +++ b/client/common/client.c @@ -1340,7 +1340,7 @@ int freerdp_client_common_stop(rdpContext* context) if (cctx->thread) { WaitForSingleObject(cctx->thread, INFINITE); - CloseHandle(cctx->thread); + (void)CloseHandle(cctx->thread); cctx->thread = NULL; } diff --git a/client/common/client_cliprdr_file.c b/client/common/client_cliprdr_file.c index 34cdefef3..7f86187fb 100644 --- a/client/common/client_cliprdr_file.c +++ b/client/common/client_cliprdr_file.c @@ -2079,12 +2079,12 @@ void cliprdr_file_context_free(CliprdrFileContext* file) WLog_Print(file->log, WLOG_DEBUG, "Waiting on FUSE thread"); WaitForSingleObject(file->fuse_thread, INFINITE); - CloseHandle(file->fuse_thread); + (void)CloseHandle(file->fuse_thread); } if (file->fuse_stop_sync) - CloseHandle(file->fuse_stop_sync); + (void)CloseHandle(file->fuse_stop_sync); if (file->fuse_start_sync) - CloseHandle(file->fuse_start_sync); + (void)CloseHandle(file->fuse_start_sync); HashTable_Free(file->request_table); HashTable_Free(file->clip_data_table); @@ -2198,7 +2198,7 @@ static BOOL is_directory(const char* path) BY_HANDLE_FILE_INFORMATION fileInformation = { 0 }; const BOOL status = GetFileInformationByHandle(hFile, &fileInformation); - CloseHandle(hFile); + (void)CloseHandle(hFile); if (!status) return FALSE; diff --git a/client/iOS/FreeRDP/ios_cliprdr.m b/client/iOS/FreeRDP/ios_cliprdr.m index 92780129a..e71a1ec7e 100644 --- a/client/iOS/FreeRDP/ios_cliprdr.m +++ b/client/iOS/FreeRDP/ios_cliprdr.m @@ -465,7 +465,7 @@ BOOL ios_cliprdr_init(mfContext *afc, CliprdrClientContext *cliprdr) if (!(clipboard = ClipboardCreate())) { - CloseHandle(hevent); + (void)CloseHandle(hevent); return FALSE; } @@ -494,6 +494,6 @@ BOOL ios_cliprdr_uninit(mfContext *afc, CliprdrClientContext *cliprdr) cliprdr->custom = NULL; afc->cliprdr = NULL; ClipboardDestroy(afc->clipboard); - CloseHandle(afc->clipboardRequestEvent); + (void)CloseHandle(afc->clipboardRequestEvent); return TRUE; } diff --git a/client/iOS/FreeRDP/ios_freerdp_events.m b/client/iOS/FreeRDP/ios_freerdp_events.m index e010f7949..b18de85ff 100644 --- a/client/iOS/FreeRDP/ios_freerdp_events.m +++ b/client/iOS/FreeRDP/ios_freerdp_events.m @@ -170,5 +170,5 @@ void ios_events_free_pipe(mfInfo *mfi) mfi->event_pipe_consumer = mfi->event_pipe_producer = -1; close(producer_fd); close(consumer_fd); - CloseHandle(mfi->handle); + (void)CloseHandle(mfi->handle); } diff --git a/libfreerdp/core/childsession.c b/libfreerdp/core/childsession.c index 17a9e0b46..e3408a72b 100644 --- a/libfreerdp/core/childsession.c +++ b/libfreerdp/core/childsession.c @@ -348,13 +348,13 @@ static void BIO_NAMED_free(WINPR_BIO_NAMED* ptr) if (ptr->hFile) { - CloseHandle(ptr->hFile); + (void)CloseHandle(ptr->hFile); ptr->hFile = NULL; } if (ptr->readEvent) { - CloseHandle(ptr->readEvent); + (void)CloseHandle(ptr->readEvent); ptr->readEvent = NULL; } @@ -530,7 +530,7 @@ BIO* createChildSessionBio(void) BIO* lowLevelBio = BIO_new(BIO_s_namedpipe()); if (!lowLevelBio) { - CloseHandle(f); + (void)CloseHandle(f); return NULL; } diff --git a/libfreerdp/core/freerdp.c b/libfreerdp/core/freerdp.c index 140de6591..cd951ce37 100644 --- a/libfreerdp/core/freerdp.c +++ b/libfreerdp/core/freerdp.c @@ -895,7 +895,7 @@ void freerdp_context_free(freerdp* instance) ctx->metrics = NULL; if (ctx->channelErrorEvent) - CloseHandle(ctx->channelErrorEvent); + (void)CloseHandle(ctx->channelErrorEvent); ctx->channelErrorEvent = NULL; free(ctx->errorDescription); diff --git a/libfreerdp/core/gateway/rpc_client.c b/libfreerdp/core/gateway/rpc_client.c index 3083d4aa2..c796ec625 100644 --- a/libfreerdp/core/gateway/rpc_client.c +++ b/libfreerdp/core/gateway/rpc_client.c @@ -1214,7 +1214,7 @@ void rpc_client_free(RpcClient* client) Stream_Free(client->ReceiveFragment, TRUE); if (client->PipeEvent) - CloseHandle(client->PipeEvent); + (void)CloseHandle(client->PipeEvent); ringbuffer_destroy(&(client->ReceivePipe)); DeleteCriticalSection(&(client->PipeLock)); diff --git a/libfreerdp/core/listener.c b/libfreerdp/core/listener.c index 4726b19b6..677ae5a7f 100644 --- a/libfreerdp/core/listener.c +++ b/libfreerdp/core/listener.c @@ -342,7 +342,7 @@ static void freerdp_listener_close(freerdp_listener* instance) for (int i = 0; i < listener->num_sockfds; i++) { closesocket((SOCKET)listener->sockfds[i]); - CloseHandle(listener->events[i]); + (void)CloseHandle(listener->events[i]); } listener->num_sockfds = 0; diff --git a/libfreerdp/core/message.c b/libfreerdp/core/message.c index bc00d7b87..be9936bdd 100644 --- a/libfreerdp/core/message.c +++ b/libfreerdp/core/message.c @@ -2907,7 +2907,7 @@ void update_message_proxy_free(rdpUpdateProxy* message) if (MessageQueue_PostQuit(up->queue, 0)) WaitForSingleObject(message->thread, INFINITE); - CloseHandle(message->thread); + (void)CloseHandle(message->thread); free(message); } } diff --git a/libfreerdp/core/peer.c b/libfreerdp/core/peer.c index e5b30b7f1..4bb33d58c 100644 --- a/libfreerdp/core/peer.c +++ b/libfreerdp/core/peer.c @@ -1340,7 +1340,7 @@ void freerdp_peer_context_free(freerdp_peer* client) { rdpContext* ctx = client->context; - CloseHandle(ctx->channelErrorEvent); + (void)CloseHandle(ctx->channelErrorEvent); ctx->channelErrorEvent = NULL; free(ctx->errorDescription); ctx->errorDescription = NULL; diff --git a/libfreerdp/core/rdp.c b/libfreerdp/core/rdp.c index 689c738b4..922cb3346 100644 --- a/libfreerdp/core/rdp.c +++ b/libfreerdp/core/rdp.c @@ -2512,7 +2512,7 @@ void rdp_free(rdpRdp* rdp) free(rdp->io); PubSub_Free(rdp->pubSub); if (rdp->abortEvent) - CloseHandle(rdp->abortEvent); + (void)CloseHandle(rdp->abortEvent); aad_free(rdp->aad); free(rdp); } diff --git a/libfreerdp/core/tcp.c b/libfreerdp/core/tcp.c index 62240361d..cd4ce1022 100644 --- a/libfreerdp/core/tcp.c +++ b/libfreerdp/core/tcp.c @@ -389,7 +389,7 @@ static int transport_bio_simple_uninit(BIO* bio) if (ptr && ptr->hEvent) { - CloseHandle(ptr->hEvent); + (void)CloseHandle(ptr->hEvent); ptr->hEvent = NULL; } @@ -874,7 +874,7 @@ static BOOL freerdp_tcp_connect_timeout(rdpContext* context, int sockfd, struct rc = TRUE; fail: - CloseHandle(handles[0]); + (void)CloseHandle(handles[0]); return rc; } @@ -1422,7 +1422,7 @@ static BOOL freerdp_tcp_layer_close(void* userContext) if (tcpLayer->sockfd >= 0) closesocket(tcpLayer->sockfd); if (tcpLayer->hEvent) - CloseHandle(tcpLayer->hEvent); + (void)CloseHandle(tcpLayer->hEvent); return TRUE; } diff --git a/libfreerdp/core/test/TestConnect.c b/libfreerdp/core/test/TestConnect.c index 306c824c6..350031ffb 100644 --- a/libfreerdp/core/test/TestConnect.c +++ b/libfreerdp/core/test/TestConnect.c @@ -143,7 +143,7 @@ static int testAbort(int port) if (!thread) { - CloseHandle(s_sync); + (void)CloseHandle(s_sync); s_sync = NULL; return -1; } @@ -156,8 +156,8 @@ static int testAbort(int port) if (!freerdp_shall_disconnect_context(instance->context)) { - CloseHandle(s_sync); - CloseHandle(thread); + (void)CloseHandle(s_sync); + (void)CloseHandle(thread); s_sync = NULL; return -1; } @@ -165,8 +165,8 @@ static int testAbort(int port) status = WaitForSingleObject(thread, 20000); end = GetTickCount(); - CloseHandle(s_sync); - CloseHandle(thread); + (void)CloseHandle(s_sync); + (void)CloseHandle(thread); s_sync = NULL; diff = end - start; @@ -227,8 +227,8 @@ static BOOL prepare_certificates(const char* path) goto fail; rc = TRUE; fail: - CloseHandle(process.hProcess); - CloseHandle(process.hThread); + (void)CloseHandle(process.hProcess); + (void)CloseHandle(process.hThread); return rc; } @@ -294,8 +294,8 @@ static int testSuccess(int port) goto fail; WaitForSingleObject(process.hProcess, INFINITE); - CloseHandle(process.hProcess); - CloseHandle(process.hThread); + (void)CloseHandle(process.hProcess); + (void)CloseHandle(process.hThread); printf("%s: returned %d!\n", __func__, r); rc = r; diff --git a/libfreerdp/core/transport.c b/libfreerdp/core/transport.c index 814f3d656..f83c24a16 100644 --- a/libfreerdp/core/transport.c +++ b/libfreerdp/core/transport.c @@ -1702,9 +1702,9 @@ void transport_free(rdpTransport* transport) nla_free(transport->nla); StreamPool_Free(transport->ReceivePool); - CloseHandle(transport->connectedEvent); - CloseHandle(transport->rereadEvent); - CloseHandle(transport->ioEvent); + (void)CloseHandle(transport->connectedEvent); + (void)CloseHandle(transport->rereadEvent); + (void)CloseHandle(transport->ioEvent); DeleteCriticalSection(&(transport->ReadLock)); DeleteCriticalSection(&(transport->WriteLock)); free(transport); diff --git a/libfreerdp/utils/smartcard_call.c b/libfreerdp/utils/smartcard_call.c index a598b8a0a..a00ee43ef 100644 --- a/libfreerdp/utils/smartcard_call.c +++ b/libfreerdp/utils/smartcard_call.c @@ -1959,7 +1959,7 @@ void smartcard_call_context_free(scard_call_context* ctx) ctx->pWinSCardApi = NULL; HashTable_Free(ctx->rgSCardContextList); - CloseHandle(ctx->stopEvent); + (void)CloseHandle(ctx->stopEvent); free(ctx); } diff --git a/server/Sample/sfreerdp.c b/server/Sample/sfreerdp.c index e64fbcccc..608e9cfd9 100644 --- a/server/Sample/sfreerdp.c +++ b/server/Sample/sfreerdp.c @@ -84,7 +84,7 @@ static void test_peer_context_free(freerdp_peer* client, rdpContext* ctx) WINPR_ASSERT(context->stopEvent); (void)SetEvent(context->stopEvent); WaitForSingleObject(context->debug_channel_thread, INFINITE); - CloseHandle(context->debug_channel_thread); + (void)CloseHandle(context->debug_channel_thread); } Stream_Free(context->s, TRUE); @@ -761,7 +761,7 @@ static BOOL tf_peer_post_connect(freerdp_peer* client) CreateThread(NULL, 0, tf_debug_channel_thread_func, (void*)context, 0, NULL))) { WLog_ERR(TAG, "Failed to create debug channel thread"); - CloseHandle(context->stopEvent); + (void)CloseHandle(context->stopEvent); context->stopEvent = NULL; return FALSE; } @@ -1275,7 +1275,7 @@ static BOOL test_peer_accepted(freerdp_listener* instance, freerdp_peer* client) if (!(hThread = CreateThread(NULL, 0, test_peer_mainloop, (void*)client, 0, NULL))) return FALSE; - CloseHandle(hThread); + (void)CloseHandle(hThread); return TRUE; } diff --git a/server/Windows/wf_directsound.c b/server/Windows/wf_directsound.c index 441397a0c..e116f4089 100644 --- a/server/Windows/wf_directsound.c +++ b/server/Windows/wf_directsound.c @@ -82,7 +82,7 @@ int wf_directsound_activate(RdpsndServerContext* context) WLog_ERR(TAG, "Failed to create direct sound thread"); return 1; } - CloseHandle(hThread); + (void)CloseHandle(hThread); return 0; } diff --git a/server/Windows/wf_info.c b/server/Windows/wf_info.c index 7ec754bce..f0d053b04 100644 --- a/server/Windows/wf_info.c +++ b/server/Windows/wf_info.c @@ -120,7 +120,7 @@ wfInfo* wf_info_init() if (!wfi->updateSemaphore) { WLog_ERR(TAG, "CreateSemaphore error: %lu", GetLastError()); - CloseHandle(wfi->mutex); + (void)CloseHandle(wfi->mutex); free(wfi); return NULL; } @@ -130,8 +130,8 @@ wfInfo* wf_info_init() if (!wfi->updateThread) { WLog_ERR(TAG, "Failed to create update thread"); - CloseHandle(wfi->mutex); - CloseHandle(wfi->updateSemaphore); + (void)CloseHandle(wfi->mutex); + (void)CloseHandle(wfi->updateSemaphore); free(wfi); return NULL; } @@ -142,9 +142,9 @@ wfInfo* wf_info_init() if (!wfi->peers) { WLog_ERR(TAG, "Failed to allocate memory for peer"); - CloseHandle(wfi->mutex); - CloseHandle(wfi->updateSemaphore); - CloseHandle(wfi->updateThread); + (void)CloseHandle(wfi->mutex); + (void)CloseHandle(wfi->updateSemaphore); + (void)CloseHandle(wfi->updateThread); free(wfi); return NULL; } @@ -244,7 +244,7 @@ BOOL wf_info_peer_register(wfInfo* wfi, wfPeerContext* context) wfreerdp_server_peer_callback_event(peerId, FREERDP_SERVER_WIN_SRV_CALLBACK_EVENT_CONNECT); return TRUE; fail_driver_init: - CloseHandle(context->updateEvent); + (void)CloseHandle(context->updateEvent); context->updateEvent = NULL; fail_update_event: fail_peer_count: @@ -261,7 +261,7 @@ void wf_info_peer_unregister(wfInfo* wfi, wfPeerContext* context) peerId = ((rdpContext*)context)->peer->pId; wfi->peers[peerId] = NULL; wfi->peerCount--; - CloseHandle(context->updateEvent); + (void)CloseHandle(context->updateEvent); WLog_INFO(TAG, "Unregistering Peer: id=%d, #=%d", peerId, wfi->peerCount); #ifdef WITH_DXGI_1_2 diff --git a/server/Windows/wf_peer.c b/server/Windows/wf_peer.c index bea273b8e..cfadf6926 100644 --- a/server/Windows/wf_peer.c +++ b/server/Windows/wf_peer.c @@ -182,7 +182,7 @@ BOOL wf_peer_accepted(freerdp_listener* instance, freerdp_peer* client) if (!(hThread = CreateThread(NULL, 0, wf_peer_main_loop, client, 0, NULL))) return FALSE; - CloseHandle(hThread); + (void)CloseHandle(hThread); return TRUE; } @@ -399,10 +399,10 @@ DWORD WINAPI wf_peer_main_loop(LPVOID lpParam) wf_update_peer_deactivate(wfi, context); client->Disconnect(client); fail_socket_thread: - CloseHandle(context->socketSemaphore); + (void)CloseHandle(context->socketSemaphore); context->socketSemaphore = NULL; fail_socket_semaphore: - CloseHandle(context->socketEvent); + (void)CloseHandle(context->socketEvent); context->socketEvent = NULL; fail_socket_event: fail_socked_closed: diff --git a/server/Windows/wf_wasapi.c b/server/Windows/wf_wasapi.c index 3925f99b3..c7b4408f5 100644 --- a/server/Windows/wf_wasapi.c +++ b/server/Windows/wf_wasapi.c @@ -58,7 +58,7 @@ int wf_wasapi_activate(RdpsndServerContext* context) WLog_ERR(TAG, "CreateThread failed"); return 1; } - CloseHandle(hThread); + (void)CloseHandle(hThread); return 0; } diff --git a/server/proxy/pf_context.c b/server/proxy/pf_context.c index 7b7e63416..e5d5bbde1 100644 --- a/server/proxy/pf_context.c +++ b/server/proxy/pf_context.c @@ -198,7 +198,7 @@ void client_to_proxy_context_free(freerdp_peer* client, rdpContext* ctx) if (context->dynvcReady) { - CloseHandle(context->dynvcReady); + (void)CloseHandle(context->dynvcReady); context->dynvcReady = NULL; } @@ -388,13 +388,13 @@ void proxy_data_free(proxyData* pdata) return; if (pdata->abort_event) - CloseHandle(pdata->abort_event); + (void)CloseHandle(pdata->abort_event); if (pdata->client_thread) - CloseHandle(pdata->client_thread); + (void)CloseHandle(pdata->client_thread); if (pdata->gfx_server_ready) - CloseHandle(pdata->gfx_server_ready); + (void)CloseHandle(pdata->gfx_server_ready); if (pdata->modules_info) HashTable_Free(pdata->modules_info); diff --git a/server/proxy/pf_server.c b/server/proxy/pf_server.c index 8f026fbbc..0415438e7 100644 --- a/server/proxy/pf_server.c +++ b/server/proxy/pf_server.c @@ -762,7 +762,7 @@ static BOOL pf_server_start_peer(freerdp_peer* client) args->thread = hThread; if (!ArrayList_Append(server->peer_list, hThread)) { - CloseHandle(hThread); + (void)CloseHandle(hThread); return FALSE; } @@ -911,7 +911,7 @@ static BOOL are_all_required_modules_loaded(proxyModule* module, const proxyConf static void peer_free(void* obj) { HANDLE hdl = (HANDLE)obj; - CloseHandle(hdl); + (void)CloseHandle(hdl); } proxyServer* pf_server_new(const proxyConfig* config) @@ -1063,7 +1063,7 @@ void pf_server_free(proxyServer* server) freerdp_listener_free(server->listener); if (server->stopEvent) - CloseHandle(server->stopEvent); + (void)CloseHandle(server->stopEvent); pf_server_config_free(server->config); pf_modules_free(server->module); diff --git a/server/shadow/Win/win_rdp.c b/server/shadow/Win/win_rdp.c index fc112ed43..077a6787f 100644 --- a/server/shadow/Win/win_rdp.c +++ b/server/shadow/Win/win_rdp.c @@ -408,9 +408,9 @@ int win_shadow_rdp_init(winShadowSubsystem* subsystem) subsystem->shw->subsystem = subsystem; return 1; fail_context: - CloseHandle(subsystem->RdpUpdateLeaveEvent); + (void)CloseHandle(subsystem->RdpUpdateLeaveEvent); fail_leave_event: - CloseHandle(subsystem->RdpUpdateEnterEvent); + (void)CloseHandle(subsystem->RdpUpdateEnterEvent); fail_enter_event: return -1; } diff --git a/server/shadow/X11/x11_shadow.c b/server/shadow/X11/x11_shadow.c index 8c43e25e3..f11d9e038 100644 --- a/server/shadow/X11/x11_shadow.c +++ b/server/shadow/X11/x11_shadow.c @@ -1420,7 +1420,7 @@ static int x11_shadow_subsystem_uninit(rdpShadowSubsystem* sub) if (subsystem->common.event) { - CloseHandle(subsystem->common.event); + (void)CloseHandle(subsystem->common.event); subsystem->common.event = NULL; } @@ -1462,7 +1462,7 @@ static int x11_shadow_subsystem_stop(rdpShadowSubsystem* sub) if (MessageQueue_PostQuit(subsystem->common.MsgPipe->In, 0)) WaitForSingleObject(subsystem->thread, INFINITE); - CloseHandle(subsystem->thread); + (void)CloseHandle(subsystem->thread); subsystem->thread = NULL; } diff --git a/server/shadow/shadow_client.c b/server/shadow/shadow_client.c index 60f0e06e2..48d4fa148 100644 --- a/server/shadow/shadow_client.c +++ b/server/shadow/shadow_client.c @@ -2586,7 +2586,7 @@ BOOL shadow_client_accepted(freerdp_listener* listener, freerdp_peer* peer) else { /* Close the thread handle to make it detached. */ - CloseHandle(client->thread); + (void)CloseHandle(client->thread); client->thread = NULL; } diff --git a/server/shadow/shadow_mcevent.c b/server/shadow/shadow_mcevent.c index 0829f86dd..602062380 100644 --- a/server/shadow/shadow_mcevent.c +++ b/server/shadow/shadow_mcevent.c @@ -79,11 +79,11 @@ rdpShadowMultiClientEvent* shadow_multiclient_new(void) out_free_subscribers: ArrayList_Free(event->subscribers); out_free_doneEvent: - CloseHandle(event->doneEvent); + (void)CloseHandle(event->doneEvent); out_free_barrierEvent: - CloseHandle(event->barrierEvent); + (void)CloseHandle(event->barrierEvent); out_free_event: - CloseHandle(event->event); + (void)CloseHandle(event->event); out_free: free(event); out_error: @@ -98,9 +98,9 @@ void shadow_multiclient_free(rdpShadowMultiClientEvent* event) DeleteCriticalSection(&(event->lock)); ArrayList_Free(event->subscribers); - CloseHandle(event->doneEvent); - CloseHandle(event->barrierEvent); - CloseHandle(event->event); + (void)CloseHandle(event->doneEvent); + (void)CloseHandle(event->barrierEvent); + (void)CloseHandle(event->event); free(event); } diff --git a/server/shadow/shadow_server.c b/server/shadow/shadow_server.c index 3962a8c70..40d41bb63 100644 --- a/server/shadow/shadow_server.c +++ b/server/shadow/shadow_server.c @@ -744,7 +744,7 @@ int shadow_server_stop(rdpShadowServer* server) { (void)SetEvent(server->StopEvent); WaitForSingleObject(server->thread, INFINITE); - CloseHandle(server->thread); + (void)CloseHandle(server->thread); server->thread = NULL; if (server->listener && server->listener->Close) server->listener->Close(server->listener); @@ -978,7 +978,7 @@ int shadow_server_uninit(rdpShadowServer* server) free(server->ConfigPath); server->ConfigPath = NULL; DeleteCriticalSection(&(server->lock)); - CloseHandle(server->StopEvent); + (void)CloseHandle(server->StopEvent); server->StopEvent = NULL; ArrayList_Free(server->clients); server->clients = NULL; diff --git a/winpr/libwinpr/clipboard/synthetic_file.c b/winpr/libwinpr/clipboard/synthetic_file.c index b930cbaa9..bfecd4e80 100644 --- a/winpr/libwinpr/clipboard/synthetic_file.c +++ b/winpr/libwinpr/clipboard/synthetic_file.c @@ -1106,7 +1106,7 @@ static UINT file_get_range(struct synthetic_file* file, UINT64 offset, UINT32 si if (!GetFileInformationByHandle(file->fd, &FileInfo)) { - CloseHandle(file->fd); + (void)CloseHandle(file->fd); file->fd = INVALID_HANDLE_VALUE; error = GetLastError(); WLog_ERR(TAG, "Get file [%s] information fail: 0x%08" PRIx32, file->local_name, error); diff --git a/winpr/libwinpr/comm/comm.c b/winpr/libwinpr/comm/comm.c index f8e30e793..dc4b02eb4 100644 --- a/winpr/libwinpr/comm/comm.c +++ b/winpr/libwinpr/comm/comm.c @@ -1356,8 +1356,7 @@ HANDLE CommCreateFileA(LPCSTR lpDeviceName, DWORD dwDesiredAccess, DWORD dwShare return (HANDLE)pComm; error_handle: WINPR_PRAGMA_DIAG_PUSH - WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC - CloseHandle(pComm); + WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC(void) CloseHandle(pComm); WINPR_PRAGMA_DIAG_POP return INVALID_HANDLE_VALUE; } diff --git a/winpr/libwinpr/comm/test/TestCommConfig.c b/winpr/libwinpr/comm/test/TestCommConfig.c index ecb6ffc0f..7bc829d87 100644 --- a/winpr/libwinpr/comm/test/TestCommConfig.c +++ b/winpr/libwinpr/comm/test/TestCommConfig.c @@ -144,7 +144,7 @@ int TestCommConfig(int argc, char* argv[]) dcb.BaudRate, dcb.ByteSize, dcb.Parity, dcb.StopBits); } - CloseHandle(hComm); + (void)CloseHandle(hComm); return 0; } diff --git a/winpr/libwinpr/comm/test/TestCommMonitor.c b/winpr/libwinpr/comm/test/TestCommMonitor.c index 57d11a19c..33c722df9 100644 --- a/winpr/libwinpr/comm/test/TestCommMonitor.c +++ b/winpr/libwinpr/comm/test/TestCommMonitor.c @@ -64,7 +64,7 @@ int TestCommMonitor(int argc, char* argv[]) } } - CloseHandle(hComm); + (void)CloseHandle(hComm); return 0; } diff --git a/winpr/libwinpr/error/test/TestErrorSetLastError.c b/winpr/libwinpr/error/test/TestErrorSetLastError.c index cb1ad87c6..310757cb0 100644 --- a/winpr/libwinpr/error/test/TestErrorSetLastError.c +++ b/winpr/libwinpr/error/test/TestErrorSetLastError.c @@ -118,10 +118,10 @@ int TestErrorSetLastError(int argc, char* argv[]) WaitForSingleObject(threads[2], INFINITE); WaitForSingleObject(threads[3], INFINITE); - CloseHandle(threads[0]); - CloseHandle(threads[1]); - CloseHandle(threads[2]); - CloseHandle(threads[3]); + (void)CloseHandle(threads[0]); + (void)CloseHandle(threads[1]); + (void)CloseHandle(threads[2]); + (void)CloseHandle(threads[3]); error = GetLastError(); diff --git a/winpr/libwinpr/file/test/TestFileFindFirstFile.c b/winpr/libwinpr/file/test/TestFileFindFirstFile.c index b40254840..7a2826a2b 100644 --- a/winpr/libwinpr/file/test/TestFileFindFirstFile.c +++ b/winpr/libwinpr/file/test/TestFileFindFirstFile.c @@ -26,7 +26,7 @@ static BOOL create_layout_files(size_t level, const char* BasePath, wArrayList* if (hdl == INVALID_HANDLE_VALUE) return FALSE; ArrayList_Append(files, FilePath); - CloseHandle(hdl); + (void)CloseHandle(hdl); } return TRUE; } @@ -228,7 +228,7 @@ static int TestFileFindFirstFileA(const char* str) CreateFileA(FilePath, GENERIC_ALL, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (hdl == INVALID_HANDLE_VALUE) goto fail; - CloseHandle(hdl); + (void)CloseHandle(hdl); if (!find_first_file_success(FilePath)) goto fail; diff --git a/winpr/libwinpr/file/test/TestFileGetStdHandle.c b/winpr/libwinpr/file/test/TestFileGetStdHandle.c index b61eb9d9d..7728f8418 100644 --- a/winpr/libwinpr/file/test/TestFileGetStdHandle.c +++ b/winpr/libwinpr/file/test/TestFileGetStdHandle.c @@ -43,7 +43,7 @@ int TestFileGetStdHandle(int argc, char* argv[]) (void)fprintf(stderr, "write failed\n"); return -1; } - CloseHandle(so); + (void)CloseHandle(so); return 0; } diff --git a/winpr/libwinpr/file/test/TestSetFileAttributes.c b/winpr/libwinpr/file/test/TestSetFileAttributes.c index f423ec296..b00c2ce1a 100644 --- a/winpr/libwinpr/file/test/TestSetFileAttributes.c +++ b/winpr/libwinpr/file/test/TestSetFileAttributes.c @@ -57,7 +57,7 @@ static BOOL test_SetFileAttributesA(void) FILE_ATTRIBUTE_NORMAL, NULL); if (handle == INVALID_HANDLE_VALUE) goto fail; - CloseHandle(handle); + (void)CloseHandle(handle); for (size_t x = 0; x < ARRAYSIZE(flags); x++) { @@ -113,7 +113,7 @@ static BOOL test_SetFileAttributesW(void) FILE_ATTRIBUTE_NORMAL, NULL); if (handle == INVALID_HANDLE_VALUE) goto fail; - CloseHandle(handle); + (void)CloseHandle(handle); for (size_t x = 0; x < ARRAYSIZE(flags); x++) { diff --git a/winpr/libwinpr/interlocked/interlocked.c b/winpr/libwinpr/interlocked/interlocked.c index c9a83de16..6f0151526 100644 --- a/winpr/libwinpr/interlocked/interlocked.c +++ b/winpr/libwinpr/interlocked/interlocked.c @@ -312,7 +312,7 @@ BOOL static_mutex_lock(volatile HANDLE* static_mutex) return FALSE; if (InterlockedCompareExchangePointer((PVOID*)static_mutex, (PVOID)handle, NULL) != NULL) - CloseHandle(handle); + (void)CloseHandle(handle); } return (WaitForSingleObject(*static_mutex, INFINITE) == WAIT_OBJECT_0); diff --git a/winpr/libwinpr/pipe/test/TestPipeCreateNamedPipe.c b/winpr/libwinpr/pipe/test/TestPipeCreateNamedPipe.c index b1849a8fd..f7b5da243 100644 --- a/winpr/libwinpr/pipe/test/TestPipeCreateNamedPipe.c +++ b/winpr/libwinpr/pipe/test/TestPipeCreateNamedPipe.c @@ -84,7 +84,7 @@ static DWORD WINAPI named_pipe_client_thread(LPVOID arg) out: free(lpReadBuffer); free(lpWriteBuffer); - CloseHandle(hNamedPipe); + (void)CloseHandle(hNamedPipe); if (!fSuccess) testFailed = TRUE; @@ -179,7 +179,7 @@ static DWORD WINAPI named_pipe_server_thread(LPVOID arg) out: free(lpReadBuffer); free(lpWriteBuffer); - CloseHandle(hNamedPipe); + (void)CloseHandle(hNamedPipe); if (!fSuccess) testFailed = TRUE; @@ -379,15 +379,15 @@ static DWORD WINAPI named_pipe_single_thread(LPVOID arg) goto out; } } - CloseHandle(servers[i]); - CloseHandle(clients[i]); + (void)CloseHandle(servers[i]); + (void)CloseHandle(clients[i]); numPipes--; /** * After CloseHandle (without calling DisconnectNamedPipe first) on server end * ReadFile/WriteFile must fail on client end */ i = numPipes - 1; - CloseHandle(servers[i]); + (void)CloseHandle(servers[i]); { char sndbuf[PIPE_BUFFER_SIZE] = { 0 }; @@ -409,14 +409,14 @@ static DWORD WINAPI named_pipe_single_thread(LPVOID arg) goto out; } } - CloseHandle(clients[i]); + (void)CloseHandle(clients[i]); numPipes--; /** * After CloseHandle on client end * ReadFile/WriteFile must fail on server end */ i = numPipes - 1; - CloseHandle(clients[i]); + (void)CloseHandle(clients[i]); { char sndbuf[PIPE_BUFFER_SIZE] = { 0 }; @@ -440,15 +440,15 @@ static DWORD WINAPI named_pipe_single_thread(LPVOID arg) } DisconnectNamedPipe(servers[i]); - CloseHandle(servers[i]); + (void)CloseHandle(servers[i]); numPipes--; /* Close all remaining pipes */ for (int i = 0; i < numPipes; i++) { DisconnectNamedPipe(servers[i]); - CloseHandle(servers[i]); - CloseHandle(clients[i]); + (void)CloseHandle(servers[i]); + (void)CloseHandle(clients[i]); } bSuccess = TRUE; @@ -503,8 +503,8 @@ int TestPipeCreateNamedPipe(int argc, char* argv[]) WaitForSingleObject(SingleThread, INFINITE); WaitForSingleObject(ClientThread, INFINITE); WaitForSingleObject(ServerThread, INFINITE); - CloseHandle(SingleThread); - CloseHandle(ClientThread); - CloseHandle(ServerThread); + (void)CloseHandle(SingleThread); + (void)CloseHandle(ClientThread); + (void)CloseHandle(ServerThread); return testFailed; } diff --git a/winpr/libwinpr/pipe/test/TestPipeCreateNamedPipeOverlapped.c b/winpr/libwinpr/pipe/test/TestPipeCreateNamedPipeOverlapped.c index a22b3ffdf..1fc2fdd0c 100644 --- a/winpr/libwinpr/pipe/test/TestPipeCreateNamedPipeOverlapped.c +++ b/winpr/libwinpr/pipe/test/TestPipeCreateNamedPipeOverlapped.c @@ -146,9 +146,9 @@ static DWORD WINAPI named_pipe_client_thread(LPVOID arg) finish: free(lpReadBuffer); if (hNamedPipe) - CloseHandle(hNamedPipe); + (void)CloseHandle(hNamedPipe); if (hEvent) - CloseHandle(hEvent); + (void)CloseHandle(hEvent); return 0; } @@ -324,8 +324,8 @@ static DWORD WINAPI named_pipe_server_thread(LPVOID arg) printf("server: finished successfully\n"); finish: - CloseHandle(hNamedPipe); - CloseHandle(hEvent); + (void)CloseHandle(hNamedPipe); + (void)CloseHandle(hEvent); free(lpReadBuffer); return 0; } @@ -373,11 +373,11 @@ int TestPipeCreateNamedPipeOverlapped(int argc, char* argv[]) out: if (ClientThread) - CloseHandle(ClientThread); + (void)CloseHandle(ClientThread); if (ServerThread) - CloseHandle(ServerThread); + (void)CloseHandle(ServerThread); if (serverReadyEvent) - CloseHandle(serverReadyEvent); + (void)CloseHandle(serverReadyEvent); #ifndef _WIN32 if (result == 0) diff --git a/winpr/libwinpr/pipe/test/TestPipeCreatePipe.c b/winpr/libwinpr/pipe/test/TestPipeCreatePipe.c index db346ef91..0537b8aed 100644 --- a/winpr/libwinpr/pipe/test/TestPipeCreatePipe.c +++ b/winpr/libwinpr/pipe/test/TestPipeCreatePipe.c @@ -65,8 +65,8 @@ int TestPipeCreatePipe(int argc, char* argv[]) return -1; } - CloseHandle(hReadPipe); - CloseHandle(hWritePipe); + (void)CloseHandle(hReadPipe); + (void)CloseHandle(hWritePipe); return 0; } diff --git a/winpr/libwinpr/pool/pool.c b/winpr/libwinpr/pool/pool.c index b3d2ce7a5..790f16189 100644 --- a/winpr/libwinpr/pool/pool.c +++ b/winpr/libwinpr/pool/pool.c @@ -101,7 +101,7 @@ static DWORD WINAPI thread_pool_work_func(LPVOID arg) static void threads_close(void* thread) { WaitForSingleObject(thread, INFINITE); - CloseHandle(thread); + (void)CloseHandle(thread); } static BOOL InitializeThreadpool(PTP_POOL pool) @@ -190,7 +190,7 @@ VOID winpr_CloseThreadpool(PTP_POOL ptpp) ArrayList_Free(ptpp->Threads); Queue_Free(ptpp->PendingQueue); CountdownEvent_Free(ptpp->WorkComplete); - CloseHandle(ptpp->TerminateEvent); + (void)CloseHandle(ptpp->TerminateEvent); { TP_POOL empty = { 0 }; @@ -220,7 +220,7 @@ BOOL winpr_SetThreadpoolThreadMinimum(PTP_POOL ptpp, DWORD cthrdMic) if (!ArrayList_Append(ptpp->Threads, thread)) { - CloseHandle(thread); + (void)CloseHandle(thread); goto fail; } } diff --git a/winpr/libwinpr/smartcard/smartcard_pcsc.c b/winpr/libwinpr/smartcard/smartcard_pcsc.c index a719d269d..95117d372 100644 --- a/winpr/libwinpr/smartcard/smartcard_pcsc.c +++ b/winpr/libwinpr/smartcard/smartcard_pcsc.c @@ -1461,7 +1461,7 @@ static HANDLE WINAPI PCSC_SCardAccessStartedEvent(void) if (!SetEvent(g_StartedEvent)) { - CloseHandle(g_StartedEvent); + (void)CloseHandle(g_StartedEvent); return NULL; } } @@ -1478,7 +1478,7 @@ static void WINAPI PCSC_SCardReleaseStartedEvent(void) { if (g_StartedEvent) { - CloseHandle(g_StartedEvent); + (void)CloseHandle(g_StartedEvent); g_StartedEvent = NULL; } } diff --git a/winpr/libwinpr/synch/barrier.c b/winpr/libwinpr/synch/barrier.c index ecee3b988..610adbb71 100644 --- a/winpr/libwinpr/synch/barrier.c +++ b/winpr/libwinpr/synch/barrier.c @@ -116,7 +116,7 @@ BOOL WINAPI winpr_InitializeSynchronizationBarrier(LPSYNCHRONIZATION_BARRIER lpB if (!(hEvent1 = CreateEvent(NULL, TRUE, FALSE, NULL))) { - CloseHandle(hEvent0); + (void)CloseHandle(hEvent0); return FALSE; } @@ -249,10 +249,10 @@ BOOL WINAPI winpr_DeleteSynchronizationBarrier(LPSYNCHRONIZATION_BARRIER lpBarri SwitchToThread(); if (lpBarrier->Reserved3[0]) - CloseHandle((HANDLE)lpBarrier->Reserved3[0]); + (void)CloseHandle((HANDLE)lpBarrier->Reserved3[0]); if (lpBarrier->Reserved3[1]) - CloseHandle((HANDLE)lpBarrier->Reserved3[1]); + (void)CloseHandle((HANDLE)lpBarrier->Reserved3[1]); ZeroMemory(lpBarrier, sizeof(SYNCHRONIZATION_BARRIER)); diff --git a/winpr/libwinpr/synch/test/TestSynchAPC.c b/winpr/libwinpr/synch/test/TestSynchAPC.c index d6239d818..edff1c0cf 100644 --- a/winpr/libwinpr/synch/test/TestSynchAPC.c +++ b/winpr/libwinpr/synch/test/TestSynchAPC.c @@ -66,7 +66,7 @@ static VOID CALLBACK Timer1APCProc(LPVOID lpArg, DWORD dwTimerLowValue, DWORD dw { UncleanCloseData* data = (UncleanCloseData*)lpArg; data->timer1Calls++; - CloseHandle(data->timer2); + (void)CloseHandle(data->timer2); data->endTest = TRUE; } @@ -128,7 +128,7 @@ int TestSynchAPC(int argc, char* argv[]) if (!thread) return 10; WaitForSingleObject(thread, INFINITE); - CloseHandle(thread); + (void)CloseHandle(thread); if (userApcArg.called || userApcArg.error) return 11; @@ -142,7 +142,7 @@ int TestSynchAPC(int argc, char* argv[]) return 21; WaitForSingleObject(thread, INFINITE); - CloseHandle(thread); + (void)CloseHandle(thread); if (!userApcArg.called) return 22; @@ -163,11 +163,11 @@ int TestSynchAPC(int argc, char* argv[]) return 33; WaitForSingleObject(thread, INFINITE); - CloseHandle(thread); +(void)CloseHandle(thread); if (uncleanCloseData.timer1Calls != 1 || uncleanCloseData.timer2Calls != 0) return 34; - CloseHandle(uncleanCloseData.timer1); +(void)CloseHandle(uncleanCloseData.timer1); #endif return 0; } diff --git a/winpr/libwinpr/synch/test/TestSynchCritical.c b/winpr/libwinpr/synch/test/TestSynchCritical.c index 800622ff5..0cdd6b847 100644 --- a/winpr/libwinpr/synch/test/TestSynchCritical.c +++ b/winpr/libwinpr/synch/test/TestSynchCritical.c @@ -263,7 +263,7 @@ static DWORD WINAPI TestSynchCritical_Main(LPVOID arg) dwThreadExitCode); goto fail; } - CloseHandle(hThreads[i]); + (void)CloseHandle(hThreads[i]); } if (gTestValueVulnerable != gTestValueSerialized) @@ -308,7 +308,7 @@ static DWORD WINAPI TestSynchCritical_Main(LPVOID arg) dwThreadExitCode); goto fail; } - CloseHandle(hThread); + (void)CloseHandle(hThread); *pbThreadTerminated = TRUE; /* requ. for winpr issue, see below */ return 0; @@ -362,7 +362,7 @@ int TestSynchCritical(int argc, char* argv[]) } GetExitCodeThread(hThread, &dwThreadExitCode); - CloseHandle(hThread); + (void)CloseHandle(hThread); if (dwThreadExitCode != 0) { diff --git a/winpr/libwinpr/synch/test/TestSynchEvent.c b/winpr/libwinpr/synch/test/TestSynchEvent.c index 083282ca4..1db566692 100644 --- a/winpr/libwinpr/synch/test/TestSynchEvent.c +++ b/winpr/libwinpr/synch/test/TestSynchEvent.c @@ -88,7 +88,7 @@ int TestSynchEvent(int argc, char* argv[]) return -1; } - CloseHandle(event); + (void)CloseHandle(event); return 0; } diff --git a/winpr/libwinpr/synch/test/TestSynchInit.c b/winpr/libwinpr/synch/test/TestSynchInit.c index 7e0ffd7c1..dcb64b468 100644 --- a/winpr/libwinpr/synch/test/TestSynchInit.c +++ b/winpr/libwinpr/synch/test/TestSynchInit.c @@ -155,11 +155,11 @@ out: winpr_aligned_free(pTestOnceFunctionCalls); winpr_aligned_free(pInitOnceExecuteOnceCalls); - CloseHandle(hStartEvent); + (void)CloseHandle(hStartEvent); for (DWORD i = 0; i < dwCreatedThreads; i++) { - CloseHandle(hThreads[i]); + (void)CloseHandle(hThreads[i]); } return (result ? 0 : 1); diff --git a/winpr/libwinpr/synch/test/TestSynchMutex.c b/winpr/libwinpr/synch/test/TestSynchMutex.c index 4744f054a..9088b1872 100644 --- a/winpr/libwinpr/synch/test/TestSynchMutex.c +++ b/winpr/libwinpr/synch/test/TestSynchMutex.c @@ -223,18 +223,18 @@ static BOOL test_mutex_threading(void) goto fail; } - CloseHandle(hThread); - CloseHandle(hStartEvent); - CloseHandle(thread1_mutex1); - CloseHandle(thread1_mutex2); + (void)CloseHandle(hThread); + (void)CloseHandle(hStartEvent); + (void)CloseHandle(thread1_mutex1); + (void)CloseHandle(thread1_mutex2); return TRUE; fail: (void)ReleaseMutex(thread1_mutex1); (void)ReleaseMutex(thread1_mutex2); - CloseHandle(thread1_mutex1); - CloseHandle(thread1_mutex2); - CloseHandle(hStartEvent); - CloseHandle(hThread); + (void)CloseHandle(thread1_mutex1); + (void)CloseHandle(thread1_mutex2); + (void)CloseHandle(hStartEvent); + (void)CloseHandle(hThread); return FALSE; } diff --git a/winpr/libwinpr/synch/test/TestSynchSemaphore.c b/winpr/libwinpr/synch/test/TestSynchSemaphore.c index d44446aac..aa29dd4a1 100644 --- a/winpr/libwinpr/synch/test/TestSynchSemaphore.c +++ b/winpr/libwinpr/synch/test/TestSynchSemaphore.c @@ -15,7 +15,7 @@ int TestSynchSemaphore(int argc, char* argv[]) return -1; } - CloseHandle(semaphore); + (void)CloseHandle(semaphore); return 0; } diff --git a/winpr/libwinpr/synch/test/TestSynchTimerQueue.c b/winpr/libwinpr/synch/test/TestSynchTimerQueue.c index 51d7fcd6c..55a88d92d 100644 --- a/winpr/libwinpr/synch/test/TestSynchTimerQueue.c +++ b/winpr/libwinpr/synch/test/TestSynchTimerQueue.c @@ -112,7 +112,7 @@ int TestSynchTimerQueue(int argc, char* argv[]) printf("DeleteTimerQueueTimer failed (%" PRIu32 ")\n", GetLastError()); return -1; } - CloseHandle(apcData[index].CompletionEvent); + (void)CloseHandle(apcData[index].CompletionEvent); } if (!DeleteTimerQueue(hTimerQueue)) diff --git a/winpr/libwinpr/synch/test/TestSynchWaitableTimer.c b/winpr/libwinpr/synch/test/TestSynchWaitableTimer.c index f61bbc141..1e7ebd6a9 100644 --- a/winpr/libwinpr/synch/test/TestSynchWaitableTimer.c +++ b/winpr/libwinpr/synch/test/TestSynchWaitableTimer.c @@ -78,6 +78,6 @@ int TestSynchWaitableTimer(int argc, char* argv[]) printf("Timer Signaled\n"); result = 0; out: - CloseHandle(timer); + (void)CloseHandle(timer); return result; } diff --git a/winpr/libwinpr/synch/test/TestSynchWaitableTimerAPC.c b/winpr/libwinpr/synch/test/TestSynchWaitableTimerAPC.c index bc289e97d..f28365b45 100644 --- a/winpr/libwinpr/synch/test/TestSynchWaitableTimerAPC.c +++ b/winpr/libwinpr/synch/test/TestSynchWaitableTimerAPC.c @@ -83,10 +83,10 @@ int TestSynchWaitableTimerAPC(int argc, char* argv[]) cleanup: if (hTimer) - CloseHandle(hTimer); + (void)CloseHandle(hTimer); if (g_Event) - CloseHandle(g_Event); + (void)CloseHandle(g_Event); return status; } diff --git a/winpr/libwinpr/thread/test/TestThreadCreateProcess.c b/winpr/libwinpr/thread/test/TestThreadCreateProcess.c index 1260c1b51..7fa458bab 100644 --- a/winpr/libwinpr/thread/test/TestThreadCreateProcess.c +++ b/winpr/libwinpr/thread/test/TestThreadCreateProcess.c @@ -79,8 +79,8 @@ int TestThreadCreateProcess(int argc, char* argv[]) printf("GetExitCodeProcess status: %" PRId32 "\n", status); printf("Process exited with code: 0x%08" PRIX32 "\n", exitCode); - CloseHandle(ProcessInformation.hProcess); - CloseHandle(ProcessInformation.hThread); + (void)CloseHandle(ProcessInformation.hProcess); + (void)CloseHandle(ProcessInformation.hThread); FreeEnvironmentStrings(lpszEnvironmentBlock); /* Test stdin,stdout,stderr redirection */ @@ -120,8 +120,8 @@ int TestThreadCreateProcess(int argc, char* argv[]) if (!status) { - CloseHandle(pipe_read); - CloseHandle(pipe_write); + (void)CloseHandle(pipe_read); + (void)CloseHandle(pipe_write); printf("CreateProcess failed. error=%" PRIu32 "\n", GetLastError()); return 1; } @@ -140,8 +140,8 @@ int TestThreadCreateProcess(int argc, char* argv[]) ret = 1; } - CloseHandle(pipe_read); - CloseHandle(pipe_write); + (void)CloseHandle(pipe_read); + (void)CloseHandle(pipe_write); exitCode = 0; status = GetExitCodeProcess(ProcessInformation.hProcess, &exitCode); @@ -149,8 +149,8 @@ int TestThreadCreateProcess(int argc, char* argv[]) printf("GetExitCodeProcess status: %" PRId32 "\n", status); printf("Process exited with code: 0x%08" PRIX32 "\n", exitCode); - CloseHandle(ProcessInformation.hProcess); - CloseHandle(ProcessInformation.hThread); + (void)CloseHandle(ProcessInformation.hProcess); + (void)CloseHandle(ProcessInformation.hThread); return ret; } diff --git a/winpr/libwinpr/thread/test/TestThreadExitThread.c b/winpr/libwinpr/thread/test/TestThreadExitThread.c index 46d81fa7f..ca7104f7e 100644 --- a/winpr/libwinpr/thread/test/TestThreadExitThread.c +++ b/winpr/libwinpr/thread/test/TestThreadExitThread.c @@ -47,7 +47,7 @@ int TestThreadExitThread(int argc, char* argv[]) return -1; } - CloseHandle(thread); + (void)CloseHandle(thread); } return 0; } diff --git a/winpr/libwinpr/utils/collections/CountdownEvent.c b/winpr/libwinpr/utils/collections/CountdownEvent.c index bbaa0fe09..487f21e35 100644 --- a/winpr/libwinpr/utils/collections/CountdownEvent.c +++ b/winpr/libwinpr/utils/collections/CountdownEvent.c @@ -204,7 +204,7 @@ void CountdownEvent_Free(wCountdownEvent* countdown) return; DeleteCriticalSection(&countdown->lock); - CloseHandle(countdown->event); + (void)CloseHandle(countdown->event); free(countdown); } diff --git a/winpr/libwinpr/utils/collections/MessageQueue.c b/winpr/libwinpr/utils/collections/MessageQueue.c index 0d1b6f312..f62e93c1c 100644 --- a/winpr/libwinpr/utils/collections/MessageQueue.c +++ b/winpr/libwinpr/utils/collections/MessageQueue.c @@ -273,7 +273,7 @@ void MessageQueue_Free(wMessageQueue* queue) if (queue->event) MessageQueue_Clear(queue); - CloseHandle(queue->event); + (void)CloseHandle(queue->event); DeleteCriticalSection(&queue->lock); free(queue->array); diff --git a/winpr/libwinpr/utils/collections/Queue.c b/winpr/libwinpr/utils/collections/Queue.c index 925d37632..8342bb0ad 100644 --- a/winpr/libwinpr/utils/collections/Queue.c +++ b/winpr/libwinpr/utils/collections/Queue.c @@ -343,7 +343,7 @@ void Queue_Free(wQueue* queue) Queue_Clear(queue); DeleteCriticalSection(&queue->lock); } - CloseHandle(queue->event); + (void)CloseHandle(queue->event); free(queue->array); free(queue); } diff --git a/winpr/libwinpr/utils/ssl.c b/winpr/libwinpr/utils/ssl.c index 08002dc1b..c4427808d 100644 --- a/winpr/libwinpr/utils/ssl.c +++ b/winpr/libwinpr/utils/ssl.c @@ -115,7 +115,7 @@ static void _winpr_openssl_dynlock_lock(int mode, struct CRYPTO_dynlock_value* d static void _winpr_openssl_dynlock_destroy(struct CRYPTO_dynlock_value* dynlock, const char* file, int line) { - CloseHandle(dynlock->mutex); + (void)CloseHandle(dynlock->mutex); free(dynlock); } @@ -150,7 +150,7 @@ static BOOL _winpr_openssl_initialize_locking(void) while (i--) { if (locks[i]) - CloseHandle(locks[i]); + (void)CloseHandle(locks[i]); } free(locks); @@ -203,7 +203,7 @@ static BOOL _winpr_openssl_cleanup_locking(void) for (int i = 0; i < g_winpr_openssl_num_locks; i++) { - CloseHandle(g_winpr_openssl_locks[i]); + (void)CloseHandle(g_winpr_openssl_locks[i]); } g_winpr_openssl_num_locks = 0; diff --git a/winpr/libwinpr/utils/test/TestMessagePipe.c b/winpr/libwinpr/utils/test/TestMessagePipe.c index c5a3ee2a6..c8b903978 100644 --- a/winpr/libwinpr/utils/test/TestMessagePipe.c +++ b/winpr/libwinpr/utils/test/TestMessagePipe.c @@ -97,9 +97,9 @@ out: if (EchoPipe) MessagePipe_Free(EchoPipe); if (ClientThread) - CloseHandle(ClientThread); + (void)CloseHandle(ClientThread); if (ServerThread) - CloseHandle(ServerThread); + (void)CloseHandle(ServerThread); return ret; } diff --git a/winpr/libwinpr/utils/test/TestMessageQueue.c b/winpr/libwinpr/utils/test/TestMessageQueue.c index b3245b1d3..0856f325f 100644 --- a/winpr/libwinpr/utils/test/TestMessageQueue.c +++ b/winpr/libwinpr/utils/test/TestMessageQueue.c @@ -50,7 +50,7 @@ int TestMessageQueue(int argc, char* argv[]) return -1; MessageQueue_Free(queue); - CloseHandle(thread); + (void)CloseHandle(thread); return 0; } diff --git a/winpr/libwinpr/winsock/winsock.c b/winpr/libwinpr/winsock/winsock.c index bb2b60c6c..1b053de4c 100644 --- a/winpr/libwinpr/winsock/winsock.c +++ b/winpr/libwinpr/winsock/winsock.c @@ -736,8 +736,7 @@ BOOL WSAResetEvent(HANDLE hEvent) BOOL WSACloseEvent(HANDLE hEvent) { - BOOL status = 0; - status = CloseHandle(hEvent); + BOOL status = CloseHandle(hEvent); if (!status) SetLastError(6); diff --git a/winpr/libwinpr/wtsapi/wtsapi_win32.c b/winpr/libwinpr/wtsapi/wtsapi_win32.c index b0cce7896..75d44a6e6 100644 --- a/winpr/libwinpr/wtsapi/wtsapi_win32.c +++ b/winpr/libwinpr/wtsapi/wtsapi_win32.c @@ -201,7 +201,7 @@ HANDLE WINAPI Win32_WTSVirtualChannelOpen_Internal(HANDLE hServer, DWORD Session if (!pChannel) { - CloseHandle(hFile); + (void)CloseHandle(hFile); SetLastError(ERROR_NOT_ENOUGH_MEMORY); return NULL; } @@ -214,7 +214,7 @@ HANDLE WINAPI Win32_WTSVirtualChannelOpen_Internal(HANDLE hServer, DWORD Session pChannel->VirtualName = _wts_calloc(1, virtualNameLen + 1); if (!pChannel->VirtualName) { - CloseHandle(hFile); + (void)CloseHandle(hFile); SetLastError(ERROR_NOT_ENOUGH_MEMORY); _wts_free(pChannel); return NULL; @@ -280,7 +280,7 @@ BOOL WINAPI Win32_WTSVirtualChannelClose(HANDLE hChannel) if (pChannel->hEvent) { - CloseHandle(pChannel->hEvent); + (void)CloseHandle(pChannel->hEvent); pChannel->hEvent = NULL; }