From 6f1b8f04c61d2db6e95cc1d45a826eeda9acfdce Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Thu, 21 Dec 2017 14:39:32 +0100 Subject: [PATCH] Fixed check for reserved com devices. --- winpr/libwinpr/comm/comm.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/winpr/libwinpr/comm/comm.c b/winpr/libwinpr/comm/comm.c index 746ce7b0a..40e1da412 100644 --- a/winpr/libwinpr/comm/comm.c +++ b/winpr/libwinpr/comm/comm.c @@ -1065,7 +1065,7 @@ BOOL DefineCommDevice(/* DWORD dwFlags,*/ LPCTSTR lpDeviceName, if (_tcsncmp(lpDeviceName, _T("\\\\.\\"), 4) != 0) { - if (!_IsReservedCommDeviceName(lpDeviceName)) + if (_IsReservedCommDeviceName(lpDeviceName)) { SetLastError(ERROR_INVALID_DATA); goto error_handle; @@ -1470,9 +1470,7 @@ HANDLE CommCreateFileA(LPCSTR lpDeviceName, DWORD dwDesiredAccess, return (HANDLE)pComm; error_handle: - CloseHandle(pComm); - return INVALID_HANDLE_VALUE; }