Module: wine Branch: refs/heads/master Commit: a796b8a3f7a7776876ea16cc9613a537c60a4fcb URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=a796b8a3f7a7776876ea16cc...
Author: Paul Vriens Paul.Vriens@xs4all.nl Date: Fri Jun 23 15:21:02 2006 +0200
shlwapi: PathCombineW should return NULL on invalid parameters.
---
dlls/shlwapi/path.c | 2 +- dlls/shlwapi/tests/path.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletions(-)
diff --git a/dlls/shlwapi/path.c b/dlls/shlwapi/path.c index cc134b2..5e9bd68 100644 --- a/dlls/shlwapi/path.c +++ b/dlls/shlwapi/path.c @@ -163,7 +163,7 @@ LPWSTR WINAPI PathCombineW(LPWSTR lpszDe TRACE("(%p,%s,%s)\n", lpszDest, debugstr_w(lpszDir), debugstr_w(lpszFile));
if (!lpszDest || (!lpszDir && !lpszFile)) - return lpszDest; /* Invalid parameters */ + return NULL; /* Invalid parameters */
if (!lpszFile || !*lpszFile) { diff --git a/dlls/shlwapi/tests/path.c b/dlls/shlwapi/tests/path.c index 043e899..168671e 100644 --- a/dlls/shlwapi/tests/path.c +++ b/dlls/shlwapi/tests/path.c @@ -31,6 +31,7 @@ #include "wininet.h" static HMODULE hShlwapi; static HRESULT (WINAPI *pPathIsValidCharA)(char,DWORD); static HRESULT (WINAPI *pPathIsValidCharW)(WCHAR,DWORD); +static LPWSTR (WINAPI *pPathCombineW)(LPWSTR, LPCWSTR, LPCWSTR);
const char* TEST_URL_1 = "http://www.winehq.org/tests?date=10/10/1923"; const char* TEST_URL_2 = "http://localhost:8080/tests%2e.html?date=Mon%2010/10/1923"; @@ -860,6 +861,37 @@ static void test_PathMatchSpec(void) ok (PathMatchSpecA(file, spec13) == TRUE, "PathMatchSpec: Spec13 failed\n"); }
+static void test_PathCombine(void) +{ + LPSTR szString, szString2; + LPWSTR wszString, wszString2; + + szString2 = HeapAlloc(GetProcessHeap(), 0, MAX_PATH * sizeof(char)); + wszString2 = HeapAlloc(GetProcessHeap(), 0, MAX_PATH * sizeof(WCHAR)); + + /* NULL test */ + szString = PathCombineA(NULL, NULL, NULL); + ok (szString == NULL, "Expected a NULL return\n"); + + if (pPathCombineW) + { + wszString = pPathCombineW(NULL, NULL, NULL); + ok (wszString == NULL, "Expected a NULL return\n"); + } + + /* Some NULL */ + szString = PathCombineA(szString2, NULL, NULL); + ok (szString == NULL, "Expected a NULL return\n"); + + if (pPathCombineW) + { + wszString = pPathCombineW(wszString2, NULL, NULL); + ok (wszString == NULL, "Expected a NULL return\n"); + } + + HeapFree(GetProcessHeap(), 0, szString2); + HeapFree(GetProcessHeap(), 0, wszString2); +}
START_TEST(path) { @@ -893,4 +925,7 @@ START_TEST(path) pPathIsValidCharW = (void*)GetProcAddress(hShlwapi, (LPSTR)456); if (pPathIsValidCharW) test_PathIsValidCharW(); } + + pPathCombineW = (void*)GetProcAddress(hShlwapi, "PathCombineW"); + test_PathCombine(); }