From 7025db431b8086a1ca5156fe0bb2e290f824a999 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Tue, 6 Sep 2011 22:51:44 +1000 Subject: [PATCH] rasapi32: Return error on invalid parameters. --- dlls/rasapi32/rasapi.c | 4 ++++ dlls/rasapi32/tests/rasapi.c | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dlls/rasapi32/rasapi.c b/dlls/rasapi32/rasapi.c index 704a8bcfe1e..2184a2204fa 100644 --- a/dlls/rasapi32/rasapi.c +++ b/dlls/rasapi32/rasapi.c @@ -250,6 +250,10 @@ DWORD WINAPI RasEnumDevicesA(LPRASDEVINFOA lpRasDevinfo, LPDWORD lpcb, LPDWORD l return ERROR_INVALID_PARAMETER; FIXME("(%p,%p,%p),stub!\n",lpRasDevinfo,lpcb,lpcDevices); + + if(lpRasDevinfo && lpRasDevinfo->dwSize != sizeof(RASDEVINFOA)) + return ERROR_INVALID_SIZE; + if (!lpRasDevinfo || (*lpcb < sizeof(RASDEVINFOA))) { *lpcb = sizeof(RASDEVINFOA); return ERROR_BUFFER_TOO_SMALL; diff --git a/dlls/rasapi32/tests/rasapi.c b/dlls/rasapi32/tests/rasapi.c index d25c7411301..e0ff25f8578 100644 --- a/dlls/rasapi32/tests/rasapi.c +++ b/dlls/rasapi32/tests/rasapi.c @@ -85,7 +85,6 @@ static void test_rasenum(void) rasDevInfo[0].dwSize = 0; cb = bufsize; result = pRasEnumDevicesA(rasDevInfo, &cb, &cDevices); - todo_wine ok(result == ERROR_INVALID_SIZE || result == ERROR_INVALID_USER_BUFFER, /* win98 */ "Expected ERROR_INVALID_SIZE, got %08d\n", result); @@ -93,7 +92,6 @@ static void test_rasenum(void) rasDevInfo[0].dwSize = sizeof(RASDEVINFOA) -1; cb = bufsize; result = pRasEnumDevicesA(rasDevInfo, &cb, &cDevices); - todo_wine ok(result == ERROR_INVALID_SIZE || result == ERROR_INVALID_USER_BUFFER, /* win98 */ "Expected ERROR_INVALID_SIZE, got %08d\n", result); @@ -101,7 +99,6 @@ static void test_rasenum(void) rasDevInfo[0].dwSize = sizeof(RASDEVINFOA) +1; cb = bufsize; result = pRasEnumDevicesA(rasDevInfo, &cb, &cDevices); - todo_wine ok(result == ERROR_INVALID_SIZE || result == ERROR_INVALID_USER_BUFFER, /* win98 */ "Expected ERROR_INVALID_SIZE, got %08d\n", result); @@ -151,7 +148,6 @@ static void test_rasenum(void) cb = 0; rasDevInfo[0].dwSize = 0; result = pRasEnumDevicesA(rasDevInfo, &cb, &cDevices); - todo_wine ok(result == ERROR_INVALID_SIZE || broken(result == ERROR_BUFFER_TOO_SMALL), /* win98 */ "Expected ERROR_INVALID_SIZE, got %08d\n", result);