shlwapi: SHLoadIndirectString
Huw D M Davies
h.davies1 at physics.ox.ac.uk
Thu Aug 11 11:14:39 CDT 2005
Huw Davies <huw at codeweavers.com>
Implement SHLoadIndirectString.
--
Huw Davies
huw at codeweavers.com
Index: dlls/shlwapi/shlwapi.spec
===================================================================
RCS file: /home/wine/wine/dlls/shlwapi/shlwapi.spec,v
retrieving revision 1.106
diff -u -p -r1.106 shlwapi.spec
--- dlls/shlwapi/shlwapi.spec 10 Aug 2005 15:01:07 -0000 1.106
+++ dlls/shlwapi/shlwapi.spec 11 Aug 2005 16:11:43 -0000
@@ -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)
Index: dlls/shlwapi/string.c
===================================================================
RCS file: /home/wine/wine/dlls/shlwapi/string.c,v
retrieving revision 1.55
diff -u -p -r1.55 string.c
--- dlls/shlwapi/string.c 28 Mar 2005 14:58:52 -0000 1.55
+++ dlls/shlwapi/string.c 11 Aug 2005 16:11:43 -0000
@@ -2698,3 +2698,58 @@ BOOL WINAPI DoesStringRoundTripW(LPCWSTR
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;
+}
More information about the wine-patches
mailing list