[prev in list] [next in list] [prev in thread] [next in thread]
List: wine-patches
Subject: WineHQ: Corrected PATCH to fix IPersistFile::Load() and associated functions.
From: Subhobroto Sinha <pasha_3d () yahoo ! com>
Date: 2003-10-29 17:25:17
[Download RAW message or body]
Hello all
I corrected my last patch after replacing everything
C++ into C.
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.
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
preprocessed out the original code. This should remain
so until SCF_UNICODE value is corrected)
(2) Stream_LoadLocation: Previously the GetPath()
failed. It works great now.
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/
["Patch.tar.gz" (application/x-gzip-compressed)]
["Patch.diff" (text/plain)]
--- wine-20031016/dlls/shell32/shelllink.c 2003-10-29 21:07:43.000000000 +0530
+++ Shikayat/dlls/shell32/shelllink.c 2003-10-29 20:39:56.000000000 +0530
@@ -401,9 +401,49 @@
return S_OK;
}
+static HRESULT Stream_LoadString( IStream* stm, BOOL unicode,LPWSTR *pstr )
+{
+ DWORD count=0;
+ USHORT len;
+ LPWSTR str=NULL;
+ HRESULT r;
+ /*
+ From Win98 upwards everything internally is maintained as unicode.(Atleast M$ \
says so) + Also, the value of SCF_UNICODE does NOT seem to be 0x1000, hence the \
bitwise '&' returns a false. + Until the correct value is found, we assume it \
Unicode. This should not break ANYTHING >Win95 for shortcuts + 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;
+}
+
+#if 0
static HRESULT Stream_LoadString( IStream* stm, BOOL unicode, LPWSTR *pstr )
{
+ /*This is the original function now redirected 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, so I don't think it will hurt anybody)*/ +
DWORD count;
USHORT len;
LPVOID temp;
@@ -454,6 +494,7 @@
return S_OK;
}
+#endif
static HRESULT Stream_LoadLocation( IStream* stm )
{
@@ -503,9 +544,10 @@
IStream* stm)
{
LINK_HEADER hdr;
- ULONG dwBytesRead;
+ ULONG dwBytesRead=0;
BOOL unicode;
WCHAR sTemp[MAX_PATH];
+ char szTemp[MAX_PATH]={0};
HRESULT r;
_ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface);
@@ -515,7 +557,6 @@
if( !stm )
return STG_E_INVALIDPOINTER;
- dwBytesRead = 0;
r = IStream_Read(stm, &hdr, sizeof(hdr), &dwBytesRead);
if( FAILED( r ) )
return r;
@@ -533,6 +574,13 @@
if( FAILED( r ) )
return r;
}
+
+ SHGetPathFromIDListA(This->pPidl,szTemp);
+ This->sPath=HeapAlloc( GetProcessHeap(), 0,(strlen(szTemp)+1)*sizeof(WCHAR));
+ dwBytesRead=(strlen(szTemp)+1);/*Just to hold the length of the string*/
+ MultiByteToWideChar(CP_ACP,0,szTemp,dwBytesRead,This->sPath,dwBytesRead);
+ TRACE("%s\n",debugstr_w(This->sPath));
+
This->wHotKey = hdr.wHotKey;
This->iIcoNdx = hdr.nIcon;
FileTimeToSystemTime (&hdr.Time1, &This->time1);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic