WineHQ: PATCH to fix IPersistFile::Load() and associated functions
Subhobroto Sinha
pasha_3d at yahoo.com
Fri Oct 24 12:21:14 CDT 2003
Hi.
I finally produced the "official patch" after
verifying that everything is OK.
Thanks to Dimi for putting up a temporary diff for me
meanwhile ;)
This patch has been inlined as well as attached as a
ZIP file, so suit yourself.
All reports regaring this patch is to be sent to
<subhobrotosinha at yahoo.com> with a proper subject
prefixed by "IPersistFile patch" in the subject
header.
For the uninitiated, here's what has to be done:
Please make sure that you have the 20031016 source
(latest tarball)
(1)Copy this .diff to dlls/shell32/
(2)Run 'patch' on this diff file
(3)It should patch "shelllink.c"
(4)Type 'make' to rebuild 'shell32.dll.so'
(5)'su' out and overwrite/symlink the current
'shell32.dll.so' over the installed one
Now IPersistFile::Load() should work as intended. Try
out McCormack's 'winemenubuilder' or my WineLib
'linkresolve' (NOT my C++ version)
If the diff is not proper, etc, please alert me at the
mentioned address
BTW: If I should have submitted at 'wine-patches'
rather at 'wine-devel', please let me know :=)
I really want this BUG fixed you know ;-)
Regards
Subhobroto Sinha
--- shelllink.c.original 2003-10-22 17:56:31.000000000
+0530
+++ shelllink.c 2003-10-24 13:09:59.000000000 +0530
@@ -18,7 +18,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111-1307 USA
*
* NOTES
- * Nearly complete informations about the binary
formats
+ * Nearly complete informations about the binary
formats
* of .lnk files avaiable at http://www.wotsit.org
*
*/
@@ -401,9 +401,49 @@
return S_OK;
}
+static HRESULT wineStream_LoadString( IStream* stm,
LPWSTR *pstr )
+{
+ DWORD count=0;
+ USHORT len;
+ LPWSTR str=NULL;
+ 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>.
+ */
+ TRACE("%p\n", stm);
+
+ r = IStream_Read(stm, &len, sizeof(len), &count);
+ if(FAILED(r)||(count != sizeof(len))) return
E_FAIL;
+
+ len *= sizeof(WCHAR);
+
+ TRACE("reading %d\n", len);
+ str = HeapAlloc(GetProcessHeap(), 0,
len+sizeof(WCHAR));
+ if(!str) return E_OUTOFMEMORY;
+
+ count = 0;
+ r = IStream_Read(stm, str, len, &count);
+ if( FAILED(r)||( count!=len) )
+ {
+ HeapFree( GetProcessHeap(), 0, str );
+ return E_FAIL;
+ }
+
+ TRACE("read %s\n", debugstr_w(str));
+ str[count/2]=0;
+ *pstr = str;
+ return S_OK;
+}
static HRESULT Stream_LoadString( IStream* stm, BOOL
unicode, LPWSTR *pstr )
{
+/*This is the original function short circuited to
the above till we find out correct 'SCF_UNICODE'.
+Now it's assumed that the data's unicode. (This
assumption failes iff the OS was <=Win95*/
+return (wineStream_LoadString(stm,pstr));
+#if 0
DWORD count;
USHORT len;
LPVOID temp;
@@ -453,6 +493,7 @@
*pstr = str;
return S_OK;
+#endif
}
static HRESULT Stream_LoadLocation( IStream* stm )
@@ -533,6 +574,27 @@
if( FAILED( r ) )
return r;
}
+ /*Fill in the target path. This marked portion
will be rewritten once GetPathFromIDList() is
completed*/
+ //LPITEMIDLIST
pidltemp=_dbg_ILGetNext(This->pPidl);
+ LPITEMIDLIST pidltemp=ILGetNext(This->pPidl);
+ char
szPasha[128][MAX_PATH]={{0},{0}},szTemp[MAX_PATH]={0};
+ int i=0,j=1;
+ do
+ {
+
_ILSimpleGetText(pidltemp,szPasha[i++],MAX_PATH);
+ pidltemp=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));
+
MultiByteToWideChar(CP_ACP,0,szTemp,(strlen(szTemp)+1),This->sPath,(strlen(szTemp)+1));
+ TRACE("%s\n",szTemp);
+ /*End marking*/
This->wHotKey = hdr.wHotKey;
This->iIcoNdx = hdr.nIcon;
FileTimeToSystemTime (&hdr.Time1, &This->time1);
__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.zip
Type: application/x-zip-compressed
Size: 1516 bytes
Desc: patch.zip
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20031024/a4fa1a15/patch.bin
More information about the wine-devel
mailing list