Please use this version

Am Sunday 06 July 2008 13:49 schrieb Stefan Leichter:
ChangeLog
---------
        added some more tests for RasEnumDevicesA, fix wine not to crash on the 
tests
--- dlls/rasapi32/rasapi.c.2	2008-07-06 13:30:22.000000000 +0200
+++ dlls/rasapi32/rasapi.c	2008-07-06 13:31:11.000000000 +0200
@@ -249,7 +249,7 @@
        return ERROR_INVALID_PARAMETER;
 
 	FIXME("(%p,%p,%p),stub!\n",lpRasDevinfo,lpcb,lpcDevices);
-	if (*lpcb < sizeof(RASDEVINFOA)) {
+	if (!lpRasDevinfo || (*lpcb < sizeof(RASDEVINFOA))) {
 		*lpcb = sizeof(RASDEVINFOA);
 		return ERROR_BUFFER_TOO_SMALL;
 	}
--- dlls/rasapi32/tests/rasapi.c.orig	2008-07-06 11:51:19.000000000 +0200
+++ dlls/rasapi32/tests/rasapi.c	2008-07-06 13:33:54.000000000 +0200
@@ -53,14 +53,78 @@
         return;
     }
 
+    /* test first parameter */
     result = pRasEnumDevicesA(NULL, &cb, &cDevices);
     trace("RasEnumDevicesA: buffersize %d\n", cb);
     ok(result == ERROR_BUFFER_TOO_SMALL,
     "Expected ERROR_BUFFER_TOO_SMALL, got %08d\n", result);
 
+    cb = sizeof(rasDevInfo);
+    result = pRasEnumDevicesA(NULL, &cb, &cDevices);
+    ok(result == ERROR_BUFFER_TOO_SMALL,
+    "Expected ERROR_BUFFER_TOO_SMALL, got %08d\n", result);
+
+    rasDevInfo.dwSize = 0;
+    result = pRasEnumDevicesA(&rasDevInfo, &cb, &cDevices);
+    todo_wine
+    ok(result == ERROR_INVALID_SIZE,
+    "Expected ERROR_INVALID_SIZE, got %08d\n", result);
+
+    rasDevInfo.dwSize = sizeof(rasDevInfo) -1;
+    result = pRasEnumDevicesA(&rasDevInfo, &cb, &cDevices);
+    todo_wine
+    ok(result == ERROR_INVALID_SIZE,
+    "Expected ERROR_INVALID_SIZE, got %08d\n", result);
+
+    rasDevInfo.dwSize = sizeof(rasDevInfo) +1;
+    result = pRasEnumDevicesA(&rasDevInfo, &cb, &cDevices);
+    todo_wine
+    ok(result == ERROR_INVALID_SIZE,
+    "Expected ERROR_INVALID_SIZE, got %08d\n", result);
+
+    /* test second parameter */
+    rasDevInfo.dwSize = sizeof(rasDevInfo);
     result = pRasEnumDevicesA(&rasDevInfo, NULL, &cDevices);
     ok(result == ERROR_INVALID_PARAMETER,
     "Expected ERROR_INVALID_PARAMETER, got %08d\n", result);
+
+    cb = 0;
+    result = pRasEnumDevicesA(&rasDevInfo, &cb, &cDevices);
+    ok(result == ERROR_BUFFER_TOO_SMALL,
+    "Expected ERROR_BUFFER_TOO_SMALL, got %08d\n", result);
+
+    cb = sizeof(rasDevInfo) -1;
+    result = pRasEnumDevicesA(&rasDevInfo, &cb, &cDevices);
+    ok(result == ERROR_BUFFER_TOO_SMALL,
+    "Expected ERROR_BUFFER_TOO_SMALL, got %08d\n", result);
+
+    cb = sizeof(rasDevInfo) +1;
+    result = pRasEnumDevicesA(&rasDevInfo, &cb, &cDevices);
+    todo_wine
+    ok(result == ERROR_BUFFER_TOO_SMALL,
+    "Expected ERROR_BUFFER_TOO_SMALL, got %08d\n", result);
+
+    /* test third parameter */
+    cb = sizeof(rasDevInfo);
+    result = pRasEnumDevicesA(&rasDevInfo, &cb, NULL);
+    ok(result == ERROR_INVALID_PARAMETER,
+    "Expected ERROR_INVALID_PARAMETER, got %08d\n", result);
+
+    /* test combinations of invalid parameters */
+    result = pRasEnumDevicesA(NULL, NULL, &cDevices);
+    ok(result == ERROR_INVALID_PARAMETER,
+    "Expected ERROR_INVALID_PARAMETER, got %08d\n", result);
+
+    result = pRasEnumDevicesA(NULL, &cb, NULL);
+    ok(result == ERROR_INVALID_PARAMETER,
+    "Expected ERROR_INVALID_PARAMETER, got %08d\n", result);
+
+    cb = 0;
+    rasDevInfo.dwSize = 0;
+    result = pRasEnumDevicesA(&rasDevInfo, &cb, &cDevices);
+    todo_wine
+    ok(result == ERROR_INVALID_SIZE,
+    "Expected ERROR_INVALID_SIZE, got %08d\n", result);
 }
 
 START_TEST(rasapi)


Reply via email to