rasapi32: Set *lpcDevices in RasEnumDevicesA.

Signed-off-by: Bruno Jesus <bjesus@codeweavers.com>
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Sebastian Lackner 2017-03-08 11:59:31 -03:00 committed by Alexandre Julliard
parent a8082a634d
commit f3842e789b
2 changed files with 23 additions and 0 deletions

View File

@ -254,6 +254,8 @@ DWORD WINAPI RasEnumDevicesA(LPRASDEVINFOA lpRasDevinfo, LPDWORD lpcb, LPDWORD l
if(lpRasDevinfo && lpRasDevinfo->dwSize != sizeof(RASDEVINFOA))
return ERROR_INVALID_SIZE;
*lpcDevices = 1;
if (!lpRasDevinfo || (*lpcb < sizeof(RASDEVINFOA))) {
*lpcb = sizeof(RASDEVINFOA);
return ERROR_BUFFER_TOO_SMALL;

View File

@ -77,54 +77,71 @@ static void test_rasenum(void)
/* test first parameter */
cb = bufsize;
cDevices = 0xdeadbeef;
result = pRasEnumDevicesA(NULL, &cb, &cDevices);
ok(0 < cDevices && cDevices < 32, "expected 0 < cDevices < 32, got %u\n", cDevices);
ok(result == ERROR_BUFFER_TOO_SMALL ||
result == ERROR_INVALID_USER_BUFFER, /* win98 */
"Expected ERROR_BUFFER_TOO_SMALL, got %08d\n", result);
rasDevInfo[0].dwSize = 0;
cb = bufsize;
cDevices = 0xdeadbeef;
result = pRasEnumDevicesA(rasDevInfo, &cb, &cDevices);
ok(cDevices == 0xdeadbeef, "expected cDevices = 0xdeadbeef, got %u\n", cDevices);
ok(result == ERROR_INVALID_SIZE ||
result == ERROR_INVALID_USER_BUFFER, /* win98 */
"Expected ERROR_INVALID_SIZE, got %08d\n", result);
rasDevInfo[0].dwSize = sizeof(RASDEVINFOA) -1;
cb = bufsize;
cDevices = 0xdeadbeef;
result = pRasEnumDevicesA(rasDevInfo, &cb, &cDevices);
ok(cDevices == 0xdeadbeef, "expected cDevices = 0xdeadbeef, got %u\n", cDevices);
ok(result == ERROR_INVALID_SIZE ||
result == ERROR_INVALID_USER_BUFFER, /* win98 */
"Expected ERROR_INVALID_SIZE, got %08d\n", result);
rasDevInfo[0].dwSize = sizeof(RASDEVINFOA) +1;
cb = bufsize;
cDevices = 0xdeadbeef;
result = pRasEnumDevicesA(rasDevInfo, &cb, &cDevices);
ok(cDevices == 0xdeadbeef, "expected cDevices = 0xdeadbeef, got %u\n", cDevices);
ok(result == ERROR_INVALID_SIZE ||
result == ERROR_INVALID_USER_BUFFER, /* win98 */
"Expected ERROR_INVALID_SIZE, got %08d\n", result);
/* test second parameter */
rasDevInfo[0].dwSize = sizeof(RASDEVINFOA);
cDevices = 0xdeadbeef;
result = pRasEnumDevicesA(rasDevInfo, NULL, &cDevices);
ok(cDevices == 0xdeadbeef, "expected cDevices = 0xdeadbeef, got %u\n", cDevices);
ok(result == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %08d\n", result);
rasDevInfo[0].dwSize = sizeof(RASDEVINFOA);
cb = 0;
cDevices = 0xdeadbeef;
result = pRasEnumDevicesA(rasDevInfo, &cb, &cDevices);
todo_wine
ok(cDevices == 0xdeadbeef, "expected cDevices = 0xdeadbeef, got %u\n", cDevices);
ok(result == ERROR_BUFFER_TOO_SMALL ||
result == ERROR_INVALID_SIZE, /* vista, 2k8 */
"Expected ERROR_BUFFER_TOO_SMALL/ERROR_INVALID_SIZE, got %08d\n", result);
rasDevInfo[0].dwSize = sizeof(RASDEVINFOA);
cb = bufsize -1;
cDevices = 0xdeadbeef;
result = pRasEnumDevicesA(rasDevInfo, &cb, &cDevices);
ok(0 < cDevices && cDevices < 32, "expected 0 < cDevices < 32, got %u\n", cDevices);
ok(result == ERROR_BUFFER_TOO_SMALL,
"Expected ERROR_BUFFER_TOO_SMALL, got %08d\n", result);
rasDevInfo[0].dwSize = sizeof(RASDEVINFOA);
cb = bufsize +1;
cDevices = 0xdeadbeef;
result = pRasEnumDevicesA(rasDevInfo, &cb, &cDevices);
ok(0 < cDevices && cDevices < 32, "expected 0 < cDevices < 32, got %u\n", cDevices);
ok(result == ERROR_SUCCESS,
"Expected ERROR_SUCCESS, got %08d\n", result);
@ -136,7 +153,9 @@ static void test_rasenum(void)
"Expected ERROR_INVALID_PARAMETER, got %08d\n", result);
/* test combinations of invalid parameters */
cDevices = 0xdeadbeef;
result = pRasEnumDevicesA(NULL, NULL, &cDevices);
ok(cDevices == 0xdeadbeef, "expected cDevices = 0xdeadbeef, got %u\n", cDevices);
ok(result == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %08d\n", result);
@ -147,7 +166,9 @@ static void test_rasenum(void)
cb = 0;
rasDevInfo[0].dwSize = 0;
cDevices = 0xdeadbeef;
result = pRasEnumDevicesA(rasDevInfo, &cb, &cDevices);
ok(cDevices == 0xdeadbeef, "expected cDevices = 0xdeadbeef, got %u\n", cDevices);
ok(result == ERROR_INVALID_SIZE ||
broken(result == ERROR_BUFFER_TOO_SMALL), /* win98 */
"Expected ERROR_INVALID_SIZE, got %08d\n", result);