First I had to learn COM (Aaaahhg!!!...), then learnt to translate COM to C++. (Learning COM was the hardest part since I had to hire some computer time from our local computer parlour which has Windows boxes alongwith VC++, and then I had to juggle to and forth from there to home after my college hours..)
Then created my OWN Win32 app (from scratch..) to read and resolve .lnk files. Then translated the Win32 app to PURE C++, so that it ran under GNU/Linux...
Then applied the knowledge to Wine, and got the IPersistFile::Load() working...
So the attachment "ShellLink.zip" contains the modified "dll/shell32/shellink.c" file which fixes the BUG in Load().
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 ?)
So in the meantime befor I submit a proper patch, check it out.
Instructions: (duh!) --------------------
Just create a backup of the existing "shelllink.c" and then copy this attached "shelllink.c" to "dlls/shell32/shelllink.c" Type 'make'; copy the new "shell32.dll.so" to your installed wine folder (you should be root), and run any program which resolves shortcuts.
You can try the "linkresolve.exe.so" (from my previous posts. See the archvies..) or WineMenuBuilder.
Hoping to recive reports soon (send them at [subhobrotosinha at yahoo.com]
Regards
Subhobroto Sinha
__________________________________ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com
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)); }