From 554357ec62f9d48c874be881e230f6e5e2225cb7 Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Thu, 11 Aug 2005 18:35:15 +0000 Subject: [PATCH] Implement SHLoadIndirectString. --- dlls/shlwapi/shlwapi.spec | 1 + dlls/shlwapi/string.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/dlls/shlwapi/shlwapi.spec b/dlls/shlwapi/shlwapi.spec index c9807c7e8af..85cf92d3521 100644 --- a/dlls/shlwapi/shlwapi.spec +++ b/dlls/shlwapi/shlwapi.spec @@ -699,6 +699,7 @@ @ stdcall SHGetValueA ( long str str ptr ptr ptr ) @ stdcall SHGetValueW ( long wstr wstr ptr ptr ptr ) @ stdcall SHIsLowMemoryMachine(long) +@ stdcall SHLoadIndirectString(wstr ptr long ptr) @ stdcall SHOpenRegStream2A(long str str long) @ stdcall SHOpenRegStream2W(long wstr str long) @ stdcall SHOpenRegStreamA(long str str long) diff --git a/dlls/shlwapi/string.c b/dlls/shlwapi/string.c index 494a7e17425..69db4c5db85 100644 --- a/dlls/shlwapi/string.c +++ b/dlls/shlwapi/string.c @@ -2698,3 +2698,58 @@ BOOL WINAPI DoesStringRoundTripW(LPCWSTR lpSrcStr, LPSTR lpDst, INT iLen) SHAnsiToUnicode(lpDst, szBuff, MAX_PATH); return !strcmpW(lpSrcStr, szBuff); } + +/************************************************************************* + * SHLoadIndirectString [SHLWAPI.@] + * + * If passed a string that begins with a '@' extract the string from the + * appropriate resource, otherwise do a straight copy. + * + */ +HRESULT WINAPI SHLoadIndirectString(LPCWSTR src, LPWSTR dst, UINT dst_len, void **reserved) +{ + WCHAR *dllname = NULL; + HMODULE hmod = NULL; + HRESULT hr = E_FAIL; + + TRACE("(%s %p %08x %p)\n", debugstr_w(src), dst, dst_len, reserved); + + if(src[0] == '@') + { + WCHAR *index_str; + int index; + + dst[0] = 0; + dllname = StrDupW(src + 1); + index_str = strchrW(dllname, ','); + + if(!index_str) goto end; + + *index_str = 0; + index_str++; + index = atoiW(index_str); + + hmod = LoadLibraryW(dllname); + if(!hmod) goto end; + + if(index < 0) + { + if(LoadStringW(hmod, -index, dst, dst_len)) + hr = S_OK; + } + else + FIXME("can't handle non-negative indicies (%d)\n", index); + } + else + { + if(dst != src) + lstrcpynW(dst, src, dst_len); + hr = S_OK; + } + + TRACE("returing %s\n", debugstr_w(dst)); +end: + if(hmod) FreeLibrary(hmod); + HeapFree(GetProcessHeap(), 0, dllname); + return hr; +} -- 2.11.4.GIT