Of games and shorcuts [was -> Re:More Games Tested]

Subhobroto Sinha subhobrotosinha at rediffmail.com
Tue Jan 6 11:51:16 CST 2004


Skipped content of type multipart/alternative-------------- next part --------------
--- shelllink.c.original	2003-10-22 17:56:30.000000000 +0530
+++ shelllink.c	2003-12-24 22:29:59.000000000 +0530
@@ -401,9 +400,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, even if it's unicode.
+    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 +493,7 @@
 
     return S_OK;
 }
+#endif
 
 static HRESULT Stream_LoadLocation( IStream* stm )
 {
@@ -503,9 +543,10 @@
     IStream*         stm)
 {
     LINK_HEADER hdr;
-    ULONG    dwBytesRead;
+    ULONG    dwBytesRead=0;
     BOOL     unicode;
     WCHAR    sTemp[MAX_PATH];
+    WCHAR wszTemp[MAX_PATH]={0};
     HRESULT  r;
 
     _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface);
@@ -515,7 +556,6 @@
     if( !stm )
 	  return STG_E_INVALIDPOINTER;
 
-    dwBytesRead = 0;
     r = IStream_Read(stm, &hdr, sizeof(hdr), &dwBytesRead);
     if( FAILED( r ) )
         return r;
@@ -533,6 +573,12 @@
         if( FAILED( r ) )
             return r;
     }
+
+    SHGetPathFromIDListW(This->pPidl,wszTemp);
+    This->sPath = HeapAlloc( GetProcessHeap(), 0, lstrlenW(wszTemp)*sizeof(WCHAR) );
+    lstrcpyW(This->sPath,wszTemp);
+    TRACE("%s\n",debugstr_w(This->sPath));
+
     This->wHotKey = hdr.wHotKey;
     This->iIcoNdx = hdr.nIcon;
     FileTimeToSystemTime (&hdr.Time1, &This->time1);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: diff.zip
Type: application/x-zip-compressed
Size: 1416 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20040106/b1f6bb58/diff.bin


More information about the wine-devel mailing list