[shlwapi] PathCombineW should return NULL on invalid parameters
Paul Vriens
Paul.Vriens at xs4all.nl
Fri Jun 23 08:21:02 CDT 2006
Hi,
PathCombineW should do the same on invalid parameters as PathCombineA
(with simple tests).
Changelog
PathCombineW should return NULL on invalid parameters
Cheers,
Paul.
---
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();
}
--
1.4.0
More information about the wine-patches
mailing list