FIX for BUG in IPersistFile::Load() since Wine-20030618 !

Dimitrie O. Paun dimi at intelliware.ca
Thu Oct 16 15:38:58 CDT 2003


On Thu, 16 Oct 2003, Subhobroto Sinha wrote:

> Sorry, but it's the WHOLE file.
> I have changed the original file so much that to
> submit a proper patch I need an unmodified
> "shelllink.c" (I do have a backup, but where was that
> ?)

OK, here is the corresponding patch:


Index: dlls/shell32/shelllink.c
===================================================================
RCS file: /var/cvs/wine/dlls/shell32/shelllink.c,v
retrieving revision 1.58
diff -u -r1.58 shelllink.c
--- dlls/shell32/shelllink.c	9 Oct 2003 19:47:09 -0000	1.58
+++ dlls/shell32/shelllink.c	17 Oct 2003 03:53:26 -0000
@@ -16,11 +16,6 @@
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * NOTES
- *   Nearly complete informations about the binary formats 
- *   of .lnk files avaiable at http://www.wotsit.org
- *
  */
 
 #include "config.h"
@@ -409,7 +404,13 @@
     LPVOID temp;
     LPWSTR str;
     HRESULT r;
-
+    /*
+    From Win98 upwards unicode==TRUE.(Atleast for shortcuts..)
+    However, the value of SCF_UNICODE does NOT seem to be 0x1000.
+    Until then, we assume it true.
+    Anybody differing mail to <subhobrotosinha at yahoo.com>.
+    */
+    unicode=TRUE;
     TRACE("%p\n", stm);
 
     count = 0;
@@ -437,7 +438,8 @@
     /* convert to unicode if necessary */
     if( !unicode )
     {
-        count = MultiByteToWideChar( CP_ACP, 0, (LPSTR) temp, len, NULL, 0 );
+        TRACE("String not in Unicode..\n");
+	count = MultiByteToWideChar( CP_ACP, 0, (LPSTR) temp, len, NULL, 0 );
         str = HeapAlloc( GetProcessHeap(), 0, (count+1)*sizeof (WCHAR) );
         if( str )
             MultiByteToWideChar( CP_ACP, 0, (LPSTR) temp, len, str, count );
@@ -445,7 +447,8 @@
     }
     else
     {
-        count /= 2;
+        TRACE("String in Unicode..\n");
+	count /= 2;
         str = (LPWSTR) temp;
     }
     str[count] = 0;
@@ -505,7 +508,7 @@
     LINK_HEADER hdr;
     ULONG    dwBytesRead;
     BOOL     unicode;
-    WCHAR    sTemp[MAX_PATH];
+    //WCHAR    sTemp[MAX_PATH];
     HRESULT  r;
 
     _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface);
@@ -533,6 +536,27 @@
         if( FAILED( r ) )
             return r;
     }
+    //////////////////////////////////////////////////////////////////////////////////
+    LPITEMIDLIST pidltemp=_dbg_ILGetNext(This->pPidl);
+    char szPasha[128][MAX_PATH]={0},szTemp[MAX_PATH]={0};
+    int i=0,j=1;
+        do
+        {
+		_dbg_ILSimpleGetText(pidltemp,szPasha[i++],MAX_PATH);
+		pidltemp = _dbg_ILGetNext(pidltemp);
+	}while(pidltemp->mkid.cb);
+	strcpy(szTemp,szPasha[0]);
+	for(;j<i;j++)
+	{
+		strcat(szTemp,szPasha[j]);
+		if(j!=(i-1))strcat(szTemp,"\\");
+	}
+	strcat(szTemp,szPasha[j]);
+	This->sPath=HeapAlloc( GetProcessHeap(), 0,(strlen(szTemp)+1)*sizeof(WCHAR));
+	ULONG cCharacters=(strlen(szTemp)+1);
+	MultiByteToWideChar(CP_ACP,0,szTemp,cCharacters,This->sPath,cCharacters);
+	TRACE("%s\n",szTemp);
+    //////////////////////////////////////////////////////////////////////////////////
     This->wHotKey = hdr.wHotKey;
     This->iIcoNdx = hdr.nIcon;
     FileTimeToSystemTime (&hdr.Time1, &This->time1);
@@ -569,7 +593,7 @@
         goto end;
 
     if( hdr.dwFlags & SCF_WORKDIR )
-          {
+    {
         r = Stream_LoadString( stm, unicode, &This->sWorkDir );
         TRACE("Working Dir  -> %s\n",debugstr_w(This->sWorkDir));
     }

-- 
Dimi.




More information about the wine-devel mailing list