From e798892743918858f1ee4576594c6f704f5b59a2 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sat, 3 Jun 2017 22:29:16 +0000 Subject: [PATCH] [MPR_WINETEST] Sync with Wine Staging 2.9. CORE-13362 svn path=/trunk/; revision=74815 --- rostests/winetests/mpr/mpr.c | 84 ++++++++++++++++++------------------ 1 file changed, 43 insertions(+), 41 deletions(-) diff --git a/rostests/winetests/mpr/mpr.c b/rostests/winetests/mpr/mpr.c index ee9e220ada6..c8ca2445cb3 100644 --- a/rostests/winetests/mpr/mpr.c +++ b/rostests/winetests/mpr/mpr.c @@ -259,54 +259,56 @@ static void test_WNetCachePassword(void) static void test_WNetUseConnection(void) { - DWORD ret; - DWORD bufSize; - DWORD outRes; + DWORD ret, bufSize, outRes; LPNETRESOURCEA netRes; - CHAR outBuf[4]; + char outBuf[4], drive[] = "J:", letter; - if (pWNetUseConnectionA) + if (!pWNetUseConnectionA) { - netRes = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(NETRESOURCEA) + sizeof("\\\\127.0.0.1\\c$") + sizeof("J:")); - netRes->dwType = RESOURCETYPE_DISK; - netRes->dwDisplayType = RESOURCEDISPLAYTYPE_SHARE; - netRes->dwUsage = RESOURCEUSAGE_CONNECTABLE; - netRes->lpLocalName = (LPSTR)((LPBYTE)netRes + sizeof(NETRESOURCEA)); - netRes->lpRemoteName = (LPSTR)((LPBYTE)netRes + sizeof(NETRESOURCEA) + sizeof("J:")); - strcpy(netRes->lpLocalName, "J:"); + win_skip("WNetUseConnection() is not supported.\n"); + return; + } + netRes = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(NETRESOURCEA) + sizeof("\\\\127.0.0.1\\c$") + sizeof("J:")); + netRes->dwType = RESOURCETYPE_DISK; + netRes->dwDisplayType = RESOURCEDISPLAYTYPE_SHARE; + netRes->dwUsage = RESOURCEUSAGE_CONNECTABLE; + netRes->lpLocalName = (LPSTR)((LPBYTE)netRes + sizeof(NETRESOURCEA)); + netRes->lpRemoteName = (LPSTR)((LPBYTE)netRes + sizeof(NETRESOURCEA) + sizeof("J:")); + + for (letter = 'J'; letter <= 'Z'; letter++) + { + drive[0] = letter; + strcpy(netRes->lpLocalName, drive); strcpy(netRes->lpRemoteName, "\\\\127.0.0.1\\c$"); bufSize = 0; ret = pWNetUseConnectionA(NULL, netRes, NULL, NULL, 0, NULL, &bufSize, &outRes); - todo_wine - ok(ret == WN_SUCCESS, "Unexpected return: %u\n", ret); - ok(bufSize == 0, "Unexpected buffer size: %u\n", bufSize); - if (ret == WN_SUCCESS) - WNetCancelConnectionA("J:", TRUE); - bufSize = 0; - ret = pWNetUseConnectionA(NULL, netRes, NULL, NULL, 0, outBuf, &bufSize, &outRes); - todo_wine - ok(ret == ERROR_INVALID_PARAMETER, "Unexpected return: %u\n", ret); - ok(bufSize == 0, "Unexpected buffer size: %u\n", bufSize); - if (ret == WN_SUCCESS) - WNetCancelConnectionA("J:", TRUE); - bufSize = 1; - todo_wine { - ret = pWNetUseConnectionA(NULL, netRes, NULL, NULL, 0, outBuf, &bufSize, &outRes); - ok(ret == ERROR_MORE_DATA, "Unexpected return: %u\n", ret); - ok(bufSize == 3, "Unexpected buffer size: %u\n", bufSize); - if (ret == WN_SUCCESS) - WNetCancelConnectionA("J:", TRUE); - bufSize = 4; - ret = pWNetUseConnectionA(NULL, netRes, NULL, NULL, 0, outBuf, &bufSize, &outRes); - ok(ret == WN_SUCCESS, "Unexpected return: %u\n", ret); - } - ok(bufSize == 4, "Unexpected buffer size: %u\n", bufSize); - if (ret == WN_SUCCESS) - WNetCancelConnectionA("J:", TRUE); - HeapFree(GetProcessHeap(), 0, netRes); - } else { - win_skip("WNetUseConnection() is not supported.\n"); + if (ret == ERROR_ALREADY_ASSIGNED) continue; } + todo_wine ok(ret == WN_SUCCESS, "Unexpected return: %u\n", ret); + ok(bufSize == 0, "Unexpected buffer size: %u\n", bufSize); + if (ret == WN_SUCCESS) WNetCancelConnectionA(drive, TRUE); + + bufSize = 0; + ret = pWNetUseConnectionA(NULL, netRes, NULL, NULL, 0, outBuf, &bufSize, &outRes); + todo_wine ok(ret == ERROR_INVALID_PARAMETER, "Unexpected return: %u\n", ret); + ok(bufSize == 0, "Unexpected buffer size: %u\n", bufSize); + if (ret == WN_SUCCESS) WNetCancelConnectionA(drive, TRUE); + + todo_wine { + bufSize = 1; + ret = pWNetUseConnectionA(NULL, netRes, NULL, NULL, 0, outBuf, &bufSize, &outRes); + ok(ret == ERROR_MORE_DATA, "Unexpected return: %u\n", ret); + ok(bufSize == 3, "Unexpected buffer size: %u\n", bufSize); + if (ret == WN_SUCCESS) WNetCancelConnectionA(drive, TRUE); + + bufSize = 4; + ret = pWNetUseConnectionA(NULL, netRes, NULL, NULL, 0, outBuf, &bufSize, &outRes); + ok(ret == WN_SUCCESS, "Unexpected return: %u\n", ret); + } + ok(bufSize == 4, "Unexpected buffer size: %u\n", bufSize); + if (ret == WN_SUCCESS) WNetCancelConnectionA(drive, TRUE); + + HeapFree(GetProcessHeap(), 0, netRes); } START_TEST(mpr)