mirror of https://github.com/FreeRDP/FreeRDP
winpr-comm: fixed QueryCommDevice() when used with some wide characters
This commit is contained in:
parent
94dfce4f52
commit
37dc55d7c2
|
@ -970,7 +970,7 @@ static BOOL _IsReservedCommDeviceName(LPCTSTR lpName)
|
|||
for (i=1; i<10; i++)
|
||||
{
|
||||
TCHAR genericName[5];
|
||||
if (_stprintf_s(genericName, 5, "COM%d", i) < 0)
|
||||
if (_stprintf_s(genericName, 5, _T("COM%d"), i) < 0)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -983,7 +983,7 @@ static BOOL _IsReservedCommDeviceName(LPCTSTR lpName)
|
|||
for (i=1; i<10; i++)
|
||||
{
|
||||
TCHAR genericName[5];
|
||||
if (_stprintf_s(genericName, 5, "LPT%d", i) < 0)
|
||||
if (_stprintf_s(genericName, 5, _T("LPT%d"), i) < 0)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -1172,7 +1172,7 @@ DWORD QueryCommDevice(LPCTSTR lpDeviceName, LPTSTR lpTargetPath, DWORD ucchMax)
|
|||
}
|
||||
|
||||
_tcscpy(lpTargetPath, storedTargetPath);
|
||||
_tcscat(lpTargetPath, ""); /* 2nd final '\0' */
|
||||
lpTargetPath[_tcslen(storedTargetPath) + 1] = '\0'; /* 2nd final '\0' */
|
||||
|
||||
return _tcslen(lpTargetPath) + 2;
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ static int test_CommDevice(LPCTSTR lpDeviceName, BOOL expectedResult)
|
|||
tcslen = QueryCommDevice(lpDeviceName, lpTargetPath, MAX_PATH);
|
||||
if (expectedResult)
|
||||
{
|
||||
if (tcslen <= _tcslen(lpDeviceName)) /* at least 2 more TCHAR are expected */
|
||||
if (tcslen <= _tcslen(lpTargetPath)) /* at least 2 more TCHAR are expected */
|
||||
{
|
||||
_tprintf(_T("QueryCommDevice failure: didn't found the device name: %s\n"), lpDeviceName);
|
||||
return FALSE;
|
||||
|
|
Loading…
Reference in New Issue