shlwapi: Fix writing an empty DataBlock list in SHWriteDataBlockList()

Thomas Weidenmueller wine-patches at reactsoft.com
Tue Aug 22 13:36:42 CDT 2006


SHWriteDataBlockList shouldn't fail writing an empty DataBlock list. It
should just write the empty termination entry so it's possible to read
the DataBlock list again (although it's empty). Also ensure correct
alignment in the SHLWAPI_CLIST structure as it's written to the stream.

- Thomas


-------------- next part --------------
Index: dlls/shlwapi/clist.c
===================================================================
RCS file: /home/wine/wine/dlls/shlwapi/clist.c,v
retrieving revision 1.12
diff -u -r1.12 clist.c
--- dlls/shlwapi/clist.c	23 May 2006 12:48:43 -0000	1.12
+++ dlls/shlwapi/clist.c	24 May 2006 17:23:15 -0000
@@ -29,6 +29,8 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(shell);
 
+#include "pshpack1.h"
+
 /* DataBlock list element (ordinals 17-22) */
 typedef struct tagSHLWAPI_CLIST
 {
@@ -37,6 +39,8 @@
   /* Item data (or a contained SHLWAPI_CLIST) follows...         */
 } SHLWAPI_CLIST, *LPSHLWAPI_CLIST;
 
+#include "poppack.h"
+
 typedef const SHLWAPI_CLIST* LPCSHLWAPI_CLIST;
 
 /* ulId for contained SHLWAPI_CLIST items */
@@ -96,12 +100,13 @@
 HRESULT WINAPI SHWriteDataBlockList(IStream* lpStream, LPSHLWAPI_CLIST lpList)
 {
   ULONG ulSize;
-  HRESULT hRet = E_FAIL;
+  HRESULT hRet = S_OK;
 
   TRACE("(%p,%p)\n", lpStream, lpList);
 
   if(lpList)
   {
+    hRet = E_FAIL;
     while (lpList->ulSize)
     {
       LPSHLWAPI_CLIST lpItem = lpList;


More information about the wine-patches mailing list