Fixed check for reserved com devices.

This commit is contained in:
Armin Novak 2017-12-21 14:39:32 +01:00
parent 7c3d75bf1d
commit 6f1b8f04c6

View File

@ -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;
}