SHELL32: use structure defined in standard headers for advertised shortcut info

Mike McCormack mike at codeweavers.com
Tue Mar 15 20:13:06 CST 2005


The next step is to implement IShellLinkDataList.

Mike


ChangeLog:
* use structure defined in standard headers for advertised shortcut info
-------------- next part --------------
Index: dlls/shell32/shelllink.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shelllink.c,v
retrieving revision 1.85
diff -u -p -r1.85 shelllink.c
--- dlls/shell32/shelllink.c	2 Mar 2005 13:53:51 -0000	1.85
+++ dlls/shell32/shelllink.c	16 Mar 2005 02:10:34 -0000
@@ -131,14 +131,6 @@ typedef struct _LOCAL_VOLUME_INFO
     DWORD dwVolLabelOfs;
 } LOCAL_VOLUME_INFO;
 
-typedef struct tagLINK_ADVERTISEINFO
-{
-    DWORD size;
-    DWORD magic;
-    CHAR  bufA[MAX_PATH];
-    WCHAR bufW[MAX_PATH];
-} LINK_ADVERTISEINFO;
-
 typedef struct volume_info_t
 {
     DWORD type;
@@ -638,40 +630,40 @@ static HRESULT Stream_LoadAdvertiseInfo(
     DWORD size;
     ULONG count;
     HRESULT r;
-    LINK_ADVERTISEINFO buffer;
+    EXP_DARWIN_LINK buffer;
     
     TRACE("%p\n",stm);
 
-    r = IStream_Read( stm, &buffer.size, sizeof (DWORD), &count );
+    r = IStream_Read( stm, &buffer.dbh.cbSize, sizeof (DWORD), &count );
     if( FAILED( r ) )
         return r;
 
     /* make sure that we read the size of the structure even on error */
     size = sizeof buffer - sizeof (DWORD);
-    if( buffer.size != sizeof buffer )
+    if( buffer.dbh.cbSize != sizeof buffer )
     {
         ERR("Ooops.  This structure is not as expected...\n");
         return E_FAIL;
     }
 
-    r = IStream_Read( stm, &buffer.magic, size, &count );
+    r = IStream_Read( stm, &buffer.dbh.dwSignature, size, &count );
     if( FAILED( r ) )
         return r;
 
     if( count != size )
         return E_FAIL;
 
-    TRACE("magic %08lx  string = %s\n", buffer.magic, debugstr_w(buffer.bufW));
+    TRACE("magic %08lx  string = %s\n", buffer.dbh.dwSignature, debugstr_w(buffer.szwDarwinID));
 
-    if( (buffer.magic&0xffff0000) != 0xa0000000 )
+    if( (buffer.dbh.dwSignature&0xffff0000) != 0xa0000000 )
     {
-        ERR("Unknown magic number %08lx in advertised shortcut\n", buffer.magic);
+        ERR("Unknown magic number %08lx in advertised shortcut\n", buffer.dbh.dwSignature);
         return E_FAIL;
     }
 
     *str = HeapAlloc( GetProcessHeap(), 0, 
-                     (strlenW(buffer.bufW)+1) * sizeof(WCHAR) );
-    strcpyW( *str, buffer.bufW );
+                     (strlenW(buffer.szwDarwinID)+1) * sizeof(WCHAR) );
+    strcpyW( *str, buffer.szwDarwinID );
 
     return S_OK;
 }
@@ -680,7 +672,7 @@ static HRESULT Stream_LoadAdvertiseInfo(
  * IPersistStream_Load (IPersistStream)
  */
 static HRESULT WINAPI IPersistStream_fnLoad(
-	IPersistStream*  iface,
+    IPersistStream*  iface,
     IStream*         stm)
 {
     LINK_HEADER hdr;
@@ -694,7 +686,7 @@ static HRESULT WINAPI IPersistStream_fnL
     TRACE("%p %p\n", This, stm);
 
     if( !stm )
-	  return STG_E_INVALIDPOINTER;
+        return STG_E_INVALIDPOINTER;
 
     dwBytesRead = 0;
     r = IStream_Read(stm, &hdr, sizeof(hdr), &dwBytesRead);
@@ -922,17 +914,17 @@ static HRESULT Stream_WriteLocationInfo(
 static HRESULT Stream_WriteAdvertiseInfo( IStream* stm, LPCWSTR string, DWORD magic )
 {
     ULONG count;
-    LINK_ADVERTISEINFO buffer;
+    EXP_DARWIN_LINK buffer;
     
     TRACE("%p\n",stm);
 
     memset( &buffer, 0, sizeof buffer );
-    buffer.size = sizeof buffer;
-    buffer.magic = magic;
-    strncpyW( buffer.bufW, string, MAX_PATH );
-    WideCharToMultiByte(CP_ACP, 0, string, -1, buffer.bufA, MAX_PATH, NULL, NULL );
+    buffer.dbh.cbSize = sizeof buffer;
+    buffer.dbh.dwSignature = magic;
+    strncpyW( buffer.szwDarwinID, string, MAX_PATH );
+    WideCharToMultiByte(CP_ACP, 0, string, -1, buffer.szDarwinID, MAX_PATH, NULL, NULL );
 
-    return IStream_Write( stm, &buffer, buffer.size, &count );
+    return IStream_Write( stm, &buffer, buffer.dbh.cbSize, &count );
 }
 
 /************************************************************************
@@ -1040,10 +1032,10 @@ static HRESULT WINAPI IPersistStream_fnS
         r = Stream_WriteString( stm, This->sIcoPath );
 
     if( This->sProduct )
-        r = Stream_WriteAdvertiseInfo( stm, This->sProduct, 0xa0000007 );
+        r = Stream_WriteAdvertiseInfo( stm, This->sProduct, EXP_SZ_ICON_SIG );
 
     if( This->sComponent )
-        r = Stream_WriteAdvertiseInfo( stm, This->sComponent, 0xa0000006 );
+        r = Stream_WriteAdvertiseInfo( stm, This->sComponent, EXP_DARWIN_ID_SIG );
 
     /* the last field is a single zero dword */
     zero = 0;


More information about the wine-patches mailing list