From 247457c1846dd82994794b30e975a6621df04e79 Mon Sep 17 00:00:00 2001 From: Rolf Kalbermatter Date: Fri, 6 Dec 2002 23:20:52 +0000 Subject: [PATCH] Implement ParseFieldW function based on its ANSI sibling. --- dlls/shell32/shell32_main.h | 3 ++- dlls/shell32/shellord.c | 22 +++++++++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/dlls/shell32/shell32_main.h b/dlls/shell32/shell32_main.h index 3ff90ea2161..d1f752e16af 100644 --- a/dlls/shell32/shell32_main.h +++ b/dlls/shell32/shell32_main.h @@ -64,7 +64,8 @@ BOOL HCR_GetClassName (REFIID riid, LPSTR szDest, DWORD len); BOOL HCR_GetFolderAttributes (REFIID riid, LPDWORD szDest); INT_PTR CALLBACK AboutDlgProc(HWND,UINT,WPARAM,LPARAM); -DWORD WINAPI ParseFieldA(LPCSTR src,DWORD field,LPSTR dst,DWORD len); +DWORD WINAPI ParseFieldA(LPCSTR src, DWORD nField, LPSTR dst, DWORD len); +DWORD WINAPI ParseFieldW(LPCWSTR src, DWORD nField, LPWSTR dst, DWORD len); /**************************************************************************** * Class constructors diff --git a/dlls/shell32/shellord.c b/dlls/shell32/shellord.c index 78daae8f7a1..aa4a8e3b863 100644 --- a/dlls/shell32/shellord.c +++ b/dlls/shell32/shellord.c @@ -107,9 +107,25 @@ DWORD WINAPI ParseFieldA( */ DWORD WINAPI ParseFieldW(LPCWSTR src, DWORD nField, LPWSTR dst, DWORD len) { - FIXME("(%s,0x%08lx,%p,%ld) stub\n", - debugstr_w(src), nField, dst, len); - return FALSE; + WARN("(%s,0x%08lx,%p,%ld) semi-stub.\n", debugstr_w(src), nField, dst, len); + + if (!src || !src[0] || !dst || !len) + return 0; + + /* skip n fields delimited by ',' */ + while (nField > 1) + { + if (*src == 0x0) return FALSE; + if (*src++ == ',') nField--; + } + + /* copy part till the next ',' to dst */ + while ( *src != 0x0 && *src != ',' && (len--)>0 ) *(dst++) = *(src++); + + /* finalize the string */ + *dst = 0x0; + + return TRUE; } /*************************************************************************