Hello all
I finally produced the "official patch" after verifying that everything is OK.
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. Just don't simply hit the 'Reply' button !
This patch fixes:
(1) Stream_LoadString: Conflict of unicode strings being taken as LPSTR and AGAIN being converted to Unicode due to wrong value of SCF_UNICODE .(I have really NOT changed the original code, but redirected this call to a fixed function which I named wineStream_LoadString. This should remain so until SCF_UNICODE value is corrected) (2) Stream_LoadLocation: Previously the GetPath() failed. It works great now.
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 the root folder of the Wine source (2)Run 'patch' on this diff file (3)It should patch "dlls/shell32/shelllink.c". Change to that directory (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
PS: As I am not a member of 'wine-patches',can the moderator be kind enough... :=) I really want these functions to get fixed. That's all.
Regards
Subhobroto Sinha
__________________________________ Do you Yahoo!? Exclusive Video Premiere - Britney Spears http://launch.yahoo.com/promos/britneyspears/
--- dlls/shell32/shelllink.c.original 2003-10-22 17:56:31.000000000 +0530 +++ dlls/shell32/shelllink.c 2003-10-26 16:30:57.000000000 +0530 @@ -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; + } + + str[count/2]=0; + *pstr = str; + TRACE("read %s\n", debugstr_w(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,14 @@ if( FAILED( r ) ) return r; } + ////////////////////////////////////////////////////////////////////////////////////// + char szTemp[MAX_PATH]={0}; + SHGetPathFromIDListA(This->pPidl,szTemp); + 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); + ////////////////////////////////////////////////////////////////////////////////////// + This->wHotKey = hdr.wHotKey; This->iIcoNdx = hdr.nIcon; FileTimeToSystemTime (&hdr.Time1, &This->time1);
Le dim 26/10/2003 à 12:20, Subhobroto Sinha a écrit :
Hello all
Hello,
This patch has been inlined as well as attached as a ZIP file, so suit yourself.
Compressed patches are not the preferred way. Totally inlined is the preferred way, then plain-text attachment (no quoted-printable stuff). Only if the patch is way too big compress it.
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. Just don't simply hit the 'Reply' button !
Would be easier to reach you...
This patch fixes:
(1) Stream_LoadString: Conflict of unicode strings being taken as LPSTR and AGAIN being converted to Unicode due to wrong value of SCF_UNICODE .(I have really NOT changed the original code, but redirected this call to a fixed function which I named wineStream_LoadString. This should remain so until SCF_UNICODE value is corrected) (2) Stream_LoadLocation: Previously the GetPath() failed. It works great now.
For the uninitiated, here's what has to be done:
They won't be reading wine-devel, no need to repeat patching instructions each time :)
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
PS: As I am not a member of 'wine-patches',can the moderator be kind enough... :=)
You can choose to not receive mails from wine-patches while still being subscribed.
@@ -533,6 +574,14 @@ if( FAILED( r ) ) return r; }
- //////////////////////////////////////////////////////////////////////////////////////
- char szTemp[MAX_PATH]={0};
- SHGetPathFromIDListA(This->pPidl,szTemp);
- 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);
- //////////////////////////////////////////////////////////////////////////////////////
Please don't use // style comments. Not all C compilers accept them.
Vincent
Hi Subhobroto,
Vincent Béron wrote:
}
- //////////////////////////////////////////////////////////////////////////////////////
- char szTemp[MAX_PATH]={0};
...
Please don't use // style comments. Not all C compilers accept them.
Please don't use any features of C++. The above variable declaration is not valid C either (it needs to be at the start of a block).
Mike
Le lun 27/10/2003 à 06:05, Mike McCormack a écrit :
Hi Subhobroto,
Vincent Béron wrote:
}
- //////////////////////////////////////////////////////////////////////////////////////
- char szTemp[MAX_PATH]={0};
...
Please don't use // style comments. Not all C compilers accept them.
Please don't use any features of C++. The above variable declaration is not valid C either (it needs to be at the start of a block).
Doesn't C99 support that? Of course, older compilers don'tm, so it's best to avoid.
Vincent