Commit 0a66cfa9 authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

shell32: Don't use strdupW or heap_* functions in shelllink.c.

parent e3a74a91
...@@ -208,7 +208,7 @@ static HRESULT ShellLink_UpdatePath(LPCWSTR sPathRel, LPCWSTR path, LPCWSTR sWor ...@@ -208,7 +208,7 @@ static HRESULT ShellLink_UpdatePath(LPCWSTR sPathRel, LPCWSTR path, LPCWSTR sWor
static inline LPWSTR heap_strdupAtoW( LPCSTR str) static inline LPWSTR heap_strdupAtoW( LPCSTR str)
{ {
INT len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 ); INT len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
LPWSTR p = heap_alloc( len*sizeof (WCHAR) ); WCHAR *p = malloc( len * sizeof(WCHAR) );
if( !p ) if( !p )
return p; return p;
MultiByteToWideChar( CP_ACP, 0, str, -1, p, len ); MultiByteToWideChar( CP_ACP, 0, str, -1, p, len );
...@@ -286,8 +286,8 @@ static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile* iface, LPCOLESTR pszFile ...@@ -286,8 +286,8 @@ static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile* iface, LPCOLESTR pszFile
IStream_Release( stm ); IStream_Release( stm );
/* update file path */ /* update file path */
heap_free(This->filepath); free(This->filepath);
This->filepath = strdupW(pszFileName); This->filepath = wcsdup(pszFileName);
This->bDirty = FALSE; This->bDirty = FALSE;
} }
...@@ -309,7 +309,7 @@ BOOL run_winemenubuilder( const WCHAR *args ) ...@@ -309,7 +309,7 @@ BOOL run_winemenubuilder( const WCHAR *args )
lstrcatW( app, L"\\winemenubuilder.exe" ); lstrcatW( app, L"\\winemenubuilder.exe" );
len = (lstrlenW( app ) + lstrlenW( args ) + 1) * sizeof(WCHAR); len = (lstrlenW( app ) + lstrlenW( args ) + 1) * sizeof(WCHAR);
buffer = heap_alloc( len ); buffer = malloc( len );
if( !buffer ) if( !buffer )
return FALSE; return FALSE;
...@@ -325,7 +325,7 @@ BOOL run_winemenubuilder( const WCHAR *args ) ...@@ -325,7 +325,7 @@ BOOL run_winemenubuilder( const WCHAR *args )
ret = CreateProcessW( app, buffer, NULL, NULL, FALSE, DETACHED_PROCESS, NULL, NULL, &si, &pi ); ret = CreateProcessW( app, buffer, NULL, NULL, FALSE, DETACHED_PROCESS, NULL, NULL, &si, &pi );
Wow64RevertWow64FsRedirection( redir ); Wow64RevertWow64FsRedirection( redir );
heap_free( buffer ); free( buffer );
if (ret) if (ret)
{ {
...@@ -343,13 +343,13 @@ static BOOL StartLinkProcessor( LPCOLESTR szLink ) ...@@ -343,13 +343,13 @@ static BOOL StartLinkProcessor( LPCOLESTR szLink )
BOOL ret; BOOL ret;
len = (lstrlenW( szLink ) + 7) * sizeof(WCHAR); len = (lstrlenW( szLink ) + 7) * sizeof(WCHAR);
buffer = heap_alloc( len ); buffer = malloc( len );
if( !buffer ) if( !buffer )
return FALSE; return FALSE;
swprintf( buffer, len, L" -w \"%s\"", szLink ); swprintf( buffer, len, L" -w \"%s\"", szLink );
ret = run_winemenubuilder( buffer ); ret = run_winemenubuilder( buffer );
heap_free( buffer ); free( buffer );
return ret; return ret;
} }
...@@ -383,8 +383,8 @@ static HRESULT WINAPI IPersistFile_fnSave(IPersistFile* iface, LPCOLESTR pszFile ...@@ -383,8 +383,8 @@ static HRESULT WINAPI IPersistFile_fnSave(IPersistFile* iface, LPCOLESTR pszFile
if (fRemember) if (fRemember)
{ {
/* update file path */ /* update file path */
heap_free(This->filepath); free(This->filepath);
This->filepath = strdupW(pszFileName); This->filepath = wcsdup(pszFileName);
} }
This->bDirty = FALSE; This->bDirty = FALSE;
...@@ -516,14 +516,14 @@ static HRESULT Stream_LoadString( IStream* stm, BOOL unicode, LPWSTR *pstr ) ...@@ -516,14 +516,14 @@ static HRESULT Stream_LoadString( IStream* stm, BOOL unicode, LPWSTR *pstr )
len *= sizeof (WCHAR); len *= sizeof (WCHAR);
TRACE("reading %d\n", len); TRACE("reading %d\n", len);
temp = heap_alloc(len + sizeof(WCHAR)); temp = malloc(len + sizeof(WCHAR));
if( !temp ) if( !temp )
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
count = 0; count = 0;
r = IStream_Read(stm, temp, len, &count); r = IStream_Read(stm, temp, len, &count);
if( FAILED (r) || ( count != len ) ) if( FAILED (r) || ( count != len ) )
{ {
heap_free( temp ); free( temp );
return E_FAIL; return E_FAIL;
} }
...@@ -533,14 +533,14 @@ static HRESULT Stream_LoadString( IStream* stm, BOOL unicode, LPWSTR *pstr ) ...@@ -533,14 +533,14 @@ static HRESULT Stream_LoadString( IStream* stm, BOOL unicode, LPWSTR *pstr )
if( !unicode ) if( !unicode )
{ {
count = MultiByteToWideChar( CP_ACP, 0, temp, len, NULL, 0 ); count = MultiByteToWideChar( CP_ACP, 0, temp, len, NULL, 0 );
str = heap_alloc( (count+1)*sizeof (WCHAR) ); str = malloc( (count + 1) * sizeof(WCHAR) );
if( !str ) if( !str )
{ {
heap_free( temp ); free( temp );
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
MultiByteToWideChar( CP_ACP, 0, temp, len, str, count ); MultiByteToWideChar( CP_ACP, 0, temp, len, str, count );
heap_free( temp ); free( temp );
} }
else else
{ {
...@@ -570,7 +570,7 @@ static HRESULT Stream_ReadChunk( IStream* stm, LPVOID *data ) ...@@ -570,7 +570,7 @@ static HRESULT Stream_ReadChunk( IStream* stm, LPVOID *data )
if( FAILED( r ) || count != sizeof(size) ) if( FAILED( r ) || count != sizeof(size) )
return E_FAIL; return E_FAIL;
chunk = heap_alloc( size ); chunk = malloc( size );
if( !chunk ) if( !chunk )
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -578,7 +578,7 @@ static HRESULT Stream_ReadChunk( IStream* stm, LPVOID *data ) ...@@ -578,7 +578,7 @@ static HRESULT Stream_ReadChunk( IStream* stm, LPVOID *data )
r = IStream_Read( stm, chunk->data, size - sizeof(size), &count ); r = IStream_Read( stm, chunk->data, size - sizeof(size), &count );
if( FAILED( r ) || count != (size - sizeof(size)) ) if( FAILED( r ) || count != (size - sizeof(size)) )
{ {
heap_free( chunk ); free( chunk );
return E_FAIL; return E_FAIL;
} }
...@@ -620,7 +620,7 @@ static LPWSTR Stream_LoadPath( LPCSTR p, DWORD maxlen ) ...@@ -620,7 +620,7 @@ static LPWSTR Stream_LoadPath( LPCSTR p, DWORD maxlen )
len++; len++;
wlen = MultiByteToWideChar(CP_ACP, 0, p, len, NULL, 0); wlen = MultiByteToWideChar(CP_ACP, 0, p, len, NULL, 0);
path = heap_alloc((wlen + 1) * sizeof(WCHAR)); path = malloc((wlen + 1) * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, p, len, path, wlen); MultiByteToWideChar(CP_ACP, 0, p, len, path, wlen);
path[wlen] = 0; path[wlen] = 0;
...@@ -642,7 +642,7 @@ static HRESULT Stream_LoadLocation( IStream *stm, ...@@ -642,7 +642,7 @@ static HRESULT Stream_LoadLocation( IStream *stm,
loc = (LOCATION_INFO*) p; loc = (LOCATION_INFO*) p;
if (loc->dwTotalSize < sizeof(LOCATION_INFO)) if (loc->dwTotalSize < sizeof(LOCATION_INFO))
{ {
heap_free( p ); free( p );
return E_FAIL; return E_FAIL;
} }
...@@ -664,7 +664,7 @@ static HRESULT Stream_LoadLocation( IStream *stm, ...@@ -664,7 +664,7 @@ static HRESULT Stream_LoadLocation( IStream *stm,
TRACE("type %ld serial %08lx name %s path %s\n", volume->type, TRACE("type %ld serial %08lx name %s path %s\n", volume->type,
volume->serial, debugstr_w(volume->label), debugstr_w(*path)); volume->serial, debugstr_w(volume->label), debugstr_w(*path));
heap_free( p ); free( p );
return S_OK; return S_OK;
} }
...@@ -718,7 +718,7 @@ static HRESULT Stream_LoadAdvertiseInfo( IStream* stm, LPWSTR *str ) ...@@ -718,7 +718,7 @@ static HRESULT Stream_LoadAdvertiseInfo( IStream* stm, LPWSTR *str )
return E_FAIL; return E_FAIL;
} }
*str = heap_alloc((lstrlenW(buffer.szwDarwinID) + 1) * sizeof(WCHAR) ); *str = malloc( (lstrlenW(buffer.szwDarwinID) + 1) * sizeof(WCHAR) );
lstrcpyW( *str, buffer.szwDarwinID ); lstrcpyW( *str, buffer.szwDarwinID );
return S_OK; return S_OK;
...@@ -760,21 +760,21 @@ static HRESULT WINAPI IPersistStream_fnLoad( ...@@ -760,21 +760,21 @@ static HRESULT WINAPI IPersistStream_fnLoad(
ILFree(This->pPidl); ILFree(This->pPidl);
This->pPidl = NULL; This->pPidl = NULL;
memset( &This->volume, 0, sizeof This->volume ); memset( &This->volume, 0, sizeof This->volume );
heap_free(This->sPath); free(This->sPath);
This->sPath = NULL; This->sPath = NULL;
heap_free(This->sDescription); free(This->sDescription);
This->sDescription = NULL; This->sDescription = NULL;
heap_free(This->sPathRel); free(This->sPathRel);
This->sPathRel = NULL; This->sPathRel = NULL;
heap_free(This->sWorkDir); free(This->sWorkDir);
This->sWorkDir = NULL; This->sWorkDir = NULL;
heap_free(This->sArgs); free(This->sArgs);
This->sArgs = NULL; This->sArgs = NULL;
heap_free(This->sIcoPath); free(This->sIcoPath);
This->sIcoPath = NULL; This->sIcoPath = NULL;
heap_free(This->sProduct); free(This->sProduct);
This->sProduct = NULL; This->sProduct = NULL;
heap_free(This->sComponent); free(This->sComponent);
This->sComponent = NULL; This->sComponent = NULL;
This->wHotKey = hdr.wHotKey; This->wHotKey = hdr.wHotKey;
...@@ -941,7 +941,7 @@ static HRESULT Stream_WriteLocationInfo( IStream* stm, LPCWSTR path, ...@@ -941,7 +941,7 @@ static HRESULT Stream_WriteLocationInfo( IStream* stm, LPCWSTR path,
total_size = sizeof *loc + volume_info_size + path_size + final_path_size; total_size = sizeof *loc + volume_info_size + path_size + final_path_size;
/* create pointers to everything */ /* create pointers to everything */
loc = heap_alloc_zero(total_size); loc = calloc(1, total_size);
vol = (LOCAL_VOLUME_INFO*) &loc[1]; vol = (LOCAL_VOLUME_INFO*) &loc[1];
szLabel = (LPSTR) &vol[1]; szLabel = (LPSTR) &vol[1];
szPath = &szLabel[label_size]; szPath = &szLabel[label_size];
...@@ -970,7 +970,7 @@ static HRESULT Stream_WriteLocationInfo( IStream* stm, LPCWSTR path, ...@@ -970,7 +970,7 @@ static HRESULT Stream_WriteLocationInfo( IStream* stm, LPCWSTR path,
szFinalPath[0] = 0; szFinalPath[0] = 0;
hr = IStream_Write( stm, loc, total_size, &count ); hr = IStream_Write( stm, loc, total_size, &count );
heap_free(loc); free(loc);
return hr; return hr;
} }
...@@ -1174,7 +1174,7 @@ static HRESULT ShellLink_UpdatePath(LPCWSTR sPathRel, LPCWSTR path, LPCWSTR sWor ...@@ -1174,7 +1174,7 @@ static HRESULT ShellLink_UpdatePath(LPCWSTR sPathRel, LPCWSTR path, LPCWSTR sWor
if (!*abs_path) if (!*abs_path)
lstrcpyW(abs_path, sPathRel); lstrcpyW(abs_path, sPathRel);
*psPath = heap_alloc((lstrlenW(abs_path) + 1) * sizeof(WCHAR)); *psPath = malloc((lstrlenW(abs_path) + 1) * sizeof(WCHAR));
if (!*psPath) if (!*psPath)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -1351,7 +1351,7 @@ static HRESULT WINAPI IShellLinkA_fnSetDescription(IShellLinkA *iface, LPCSTR ps ...@@ -1351,7 +1351,7 @@ static HRESULT WINAPI IShellLinkA_fnSetDescription(IShellLinkA *iface, LPCSTR ps
descrW = NULL; descrW = NULL;
hr = IShellLinkW_SetDescription(&This->IShellLinkW_iface, descrW); hr = IShellLinkW_SetDescription(&This->IShellLinkW_iface, descrW);
heap_free(descrW); free(descrW);
return hr; return hr;
} }
...@@ -1384,7 +1384,7 @@ static HRESULT WINAPI IShellLinkA_fnSetWorkingDirectory(IShellLinkA *iface, LPCS ...@@ -1384,7 +1384,7 @@ static HRESULT WINAPI IShellLinkA_fnSetWorkingDirectory(IShellLinkA *iface, LPCS
if (!dirW) return E_OUTOFMEMORY; if (!dirW) return E_OUTOFMEMORY;
hr = IShellLinkW_SetWorkingDirectory(&This->IShellLinkW_iface, dirW); hr = IShellLinkW_SetWorkingDirectory(&This->IShellLinkW_iface, dirW);
heap_free(dirW); free(dirW);
return hr; return hr;
} }
...@@ -1421,7 +1421,7 @@ static HRESULT WINAPI IShellLinkA_fnSetArguments(IShellLinkA *iface, LPCSTR pszA ...@@ -1421,7 +1421,7 @@ static HRESULT WINAPI IShellLinkA_fnSetArguments(IShellLinkA *iface, LPCSTR pszA
argsW = NULL; argsW = NULL;
hr = IShellLinkW_SetArguments(&This->IShellLinkW_iface, argsW); hr = IShellLinkW_SetArguments(&This->IShellLinkW_iface, argsW);
heap_free(argsW); free(argsW);
return hr; return hr;
} }
...@@ -1483,7 +1483,7 @@ static HRESULT WINAPI IShellLinkA_fnSetIconLocation(IShellLinkA *iface, LPCSTR p ...@@ -1483,7 +1483,7 @@ static HRESULT WINAPI IShellLinkA_fnSetIconLocation(IShellLinkA *iface, LPCSTR p
} }
hr = IShellLinkW_SetIconLocation(&This->IShellLinkW_iface, path ? pathW : NULL, icon); hr = IShellLinkW_SetIconLocation(&This->IShellLinkW_iface, path ? pathW : NULL, icon);
heap_free(pathW); free(pathW);
return hr; return hr;
} }
...@@ -1501,7 +1501,7 @@ static HRESULT WINAPI IShellLinkA_fnSetRelativePath(IShellLinkA *iface, LPCSTR p ...@@ -1501,7 +1501,7 @@ static HRESULT WINAPI IShellLinkA_fnSetRelativePath(IShellLinkA *iface, LPCSTR p
if (!pathW) return E_OUTOFMEMORY; if (!pathW) return E_OUTOFMEMORY;
hr = IShellLinkW_SetRelativePath(&This->IShellLinkW_iface, pathW, dwReserved); hr = IShellLinkW_SetRelativePath(&This->IShellLinkW_iface, pathW, dwReserved);
heap_free(pathW); free(pathW);
return hr; return hr;
} }
...@@ -1530,7 +1530,7 @@ static HRESULT WINAPI IShellLinkA_fnSetPath(IShellLinkA *iface, LPCSTR pszFile) ...@@ -1530,7 +1530,7 @@ static HRESULT WINAPI IShellLinkA_fnSetPath(IShellLinkA *iface, LPCSTR pszFile)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
r = IShellLinkW_SetPath(&This->IShellLinkW_iface, str); r = IShellLinkW_SetPath(&This->IShellLinkW_iface, str);
heap_free( str ); free( str );
return r; return r;
} }
...@@ -1652,15 +1652,15 @@ static ULONG WINAPI IShellLinkW_fnRelease(IShellLinkW * iface) ...@@ -1652,15 +1652,15 @@ static ULONG WINAPI IShellLinkW_fnRelease(IShellLinkW * iface)
TRACE("-- destroying IShellLink(%p)\n",This); TRACE("-- destroying IShellLink(%p)\n",This);
heap_free(This->sIcoPath); free(This->sIcoPath);
heap_free(This->sArgs); free(This->sArgs);
heap_free(This->sWorkDir); free(This->sWorkDir);
heap_free(This->sDescription); free(This->sDescription);
heap_free(This->sPath); free(This->sPath);
heap_free(This->sPathRel); free(This->sPathRel);
heap_free(This->sProduct); free(This->sProduct);
heap_free(This->sComponent); free(This->sComponent);
heap_free(This->filepath); free(This->filepath);
if (This->site) if (This->site)
IUnknown_Release( This->site ); IUnknown_Release( This->site );
...@@ -1754,12 +1754,12 @@ static HRESULT WINAPI IShellLinkW_fnSetIDList(IShellLinkW * iface, LPCITEMIDLIST ...@@ -1754,12 +1754,12 @@ static HRESULT WINAPI IShellLinkW_fnSetIDList(IShellLinkW * iface, LPCITEMIDLIST
if( !This->pPidl ) if( !This->pPidl )
return E_FAIL; return E_FAIL;
heap_free( This->sPath ); free( This->sPath );
This->sPath = NULL; This->sPath = NULL;
if ( SHGetPathFromIDListW( pidl, path ) ) if ( SHGetPathFromIDListW( pidl, path ) )
{ {
This->sPath = heap_alloc((lstrlenW(path) + 1) * sizeof(WCHAR)); This->sPath = malloc((lstrlenW(path) + 1) * sizeof(WCHAR));
if (!This->sPath) if (!This->sPath)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -1790,10 +1790,10 @@ static HRESULT WINAPI IShellLinkW_fnSetDescription(IShellLinkW * iface, LPCWSTR ...@@ -1790,10 +1790,10 @@ static HRESULT WINAPI IShellLinkW_fnSetDescription(IShellLinkW * iface, LPCWSTR
TRACE("(%p)->(desc=%s)\n",This, debugstr_w(pszName)); TRACE("(%p)->(desc=%s)\n",This, debugstr_w(pszName));
heap_free(This->sDescription); free(This->sDescription);
if (pszName) if (pszName)
{ {
This->sDescription = heap_alloc((lstrlenW( pszName )+1)*sizeof(WCHAR) ); This->sDescription = malloc( (lstrlenW( pszName ) + 1) * sizeof(WCHAR) );
if ( !This->sDescription ) if ( !This->sDescription )
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -1826,8 +1826,8 @@ static HRESULT WINAPI IShellLinkW_fnSetWorkingDirectory(IShellLinkW * iface, LPC ...@@ -1826,8 +1826,8 @@ static HRESULT WINAPI IShellLinkW_fnSetWorkingDirectory(IShellLinkW * iface, LPC
TRACE("(%p)->(dir=%s)\n",This, debugstr_w(pszDir)); TRACE("(%p)->(dir=%s)\n",This, debugstr_w(pszDir));
heap_free(This->sWorkDir); free(This->sWorkDir);
This->sWorkDir = heap_alloc((lstrlenW( pszDir ) + 1) * sizeof (WCHAR) ); This->sWorkDir = malloc( (lstrlenW( pszDir ) + 1) * sizeof(WCHAR) );
if ( !This->sWorkDir ) if ( !This->sWorkDir )
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
lstrcpyW( This->sWorkDir, pszDir ); lstrcpyW( This->sWorkDir, pszDir );
...@@ -1856,10 +1856,10 @@ static HRESULT WINAPI IShellLinkW_fnSetArguments(IShellLinkW * iface, LPCWSTR ps ...@@ -1856,10 +1856,10 @@ static HRESULT WINAPI IShellLinkW_fnSetArguments(IShellLinkW * iface, LPCWSTR ps
TRACE("(%p)->(args=%s)\n",This, debugstr_w(pszArgs)); TRACE("(%p)->(args=%s)\n",This, debugstr_w(pszArgs));
heap_free(This->sArgs); free(This->sArgs);
if (pszArgs) if (pszArgs)
{ {
This->sArgs = heap_alloc((lstrlenW( pszArgs )+1)*sizeof (WCHAR) ); This->sArgs = malloc( (lstrlenW( pszArgs ) + 1) * sizeof(WCHAR) );
if ( !This->sArgs ) if ( !This->sArgs )
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
lstrcpyW( This->sArgs, pszArgs ); lstrcpyW( This->sArgs, pszArgs );
...@@ -1939,11 +1939,11 @@ static HRESULT WINAPI IShellLinkW_fnSetIconLocation(IShellLinkW * iface, const W ...@@ -1939,11 +1939,11 @@ static HRESULT WINAPI IShellLinkW_fnSetIconLocation(IShellLinkW * iface, const W
TRACE("(%p)->(path=%s icon=%u)\n", This, debugstr_w(path), icon); TRACE("(%p)->(path=%s icon=%u)\n", This, debugstr_w(path), icon);
heap_free(This->sIcoPath); free(This->sIcoPath);
if (path) if (path)
{ {
size_t len = (lstrlenW(path) + 1) * sizeof(WCHAR); size_t len = (lstrlenW(path) + 1) * sizeof(WCHAR);
This->sIcoPath = heap_alloc(len); This->sIcoPath = malloc(len);
if (!This->sIcoPath) if (!This->sIcoPath)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
memcpy(This->sIcoPath, path, len); memcpy(This->sIcoPath, path, len);
...@@ -1962,8 +1962,8 @@ static HRESULT WINAPI IShellLinkW_fnSetRelativePath(IShellLinkW * iface, LPCWSTR ...@@ -1962,8 +1962,8 @@ static HRESULT WINAPI IShellLinkW_fnSetRelativePath(IShellLinkW * iface, LPCWSTR
TRACE("(%p)->(path=%s %lx)\n",This, debugstr_w(pszPathRel), dwReserved); TRACE("(%p)->(path=%s %lx)\n",This, debugstr_w(pszPathRel), dwReserved);
heap_free(This->sPathRel); free(This->sPathRel);
This->sPathRel = heap_alloc((lstrlenW( pszPathRel )+1) * sizeof (WCHAR) ); This->sPathRel = malloc( (lstrlenW( pszPathRel ) + 1) * sizeof(WCHAR) );
if ( !This->sPathRel ) if ( !This->sPathRel )
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
lstrcpyW( This->sPathRel, pszPathRel ); lstrcpyW( This->sPathRel, pszPathRel );
...@@ -1989,7 +1989,7 @@ static HRESULT WINAPI IShellLinkW_fnResolve(IShellLinkW * iface, HWND hwnd, DWOR ...@@ -1989,7 +1989,7 @@ static HRESULT WINAPI IShellLinkW_fnResolve(IShellLinkW * iface, HWND hwnd, DWOR
bSuccess = SHGetPathFromIDListW(This->pPidl, buffer); bSuccess = SHGetPathFromIDListW(This->pPidl, buffer);
if (bSuccess && *buffer) { if (bSuccess && *buffer) {
This->sPath = heap_alloc((lstrlenW(buffer)+1)*sizeof(WCHAR)); This->sPath = malloc((lstrlenW(buffer) + 1) * sizeof(WCHAR));
if (!This->sPath) if (!This->sPath)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -2001,7 +2001,7 @@ static HRESULT WINAPI IShellLinkW_fnResolve(IShellLinkW * iface, HWND hwnd, DWOR ...@@ -2001,7 +2001,7 @@ static HRESULT WINAPI IShellLinkW_fnResolve(IShellLinkW * iface, HWND hwnd, DWOR
} }
if (!This->sIcoPath && This->sPath) { if (!This->sIcoPath && This->sPath) {
This->sIcoPath = heap_alloc((lstrlenW(This->sPath)+1)*sizeof(WCHAR)); This->sIcoPath = malloc((lstrlenW(This->sPath) + 1) * sizeof(WCHAR));
if (!This->sIcoPath) if (!This->sIcoPath)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -2027,7 +2027,7 @@ static LPWSTR ShellLink_GetAdvertisedArg(LPCWSTR str) ...@@ -2027,7 +2027,7 @@ static LPWSTR ShellLink_GetAdvertisedArg(LPCWSTR str)
if( !p ) if( !p )
return NULL; return NULL;
len = p - str; len = p - str;
ret = heap_alloc(sizeof(WCHAR)*(len+1)); ret = malloc(sizeof(WCHAR) * (len + 1));
if( !ret ) if( !ret )
return ret; return ret;
memcpy( ret, str, sizeof(WCHAR)*len ); memcpy( ret, str, sizeof(WCHAR)*len );
...@@ -2127,7 +2127,7 @@ static HRESULT WINAPI IShellLinkW_fnSetPath(IShellLinkW * iface, LPCWSTR pszFile ...@@ -2127,7 +2127,7 @@ static HRESULT WINAPI IShellLinkW_fnSetPath(IShellLinkW * iface, LPCWSTR pszFile
len = lstrlenW(pszFile); len = lstrlenW(pszFile);
if (pszFile[0] == '"' && pszFile[len-1] == '"') if (pszFile[0] == '"' && pszFile[len-1] == '"')
{ {
unquoted = strdupW(pszFile); unquoted = wcsdup(pszFile);
PathUnquoteSpacesW(unquoted); PathUnquoteSpacesW(unquoted);
pszFile = unquoted; pszFile = unquoted;
} }
...@@ -2135,14 +2135,14 @@ static HRESULT WINAPI IShellLinkW_fnSetPath(IShellLinkW * iface, LPCWSTR pszFile ...@@ -2135,14 +2135,14 @@ static HRESULT WINAPI IShellLinkW_fnSetPath(IShellLinkW * iface, LPCWSTR pszFile
/* any other quote marks are invalid */ /* any other quote marks are invalid */
if (wcschr(pszFile, '"')) if (wcschr(pszFile, '"'))
{ {
heap_free(unquoted); free(unquoted);
return S_FALSE; return S_FALSE;
} }
heap_free(This->sPath); free(This->sPath);
This->sPath = NULL; This->sPath = NULL;
heap_free(This->sComponent); free(This->sComponent);
This->sComponent = NULL; This->sComponent = NULL;
if (This->pPidl) if (This->pPidl)
...@@ -2155,7 +2155,7 @@ static HRESULT WINAPI IShellLinkW_fnSetPath(IShellLinkW * iface, LPCWSTR pszFile ...@@ -2155,7 +2155,7 @@ static HRESULT WINAPI IShellLinkW_fnSetPath(IShellLinkW * iface, LPCWSTR pszFile
*buffer = '\0'; *buffer = '\0';
else if (!GetFullPathNameW(pszFile, MAX_PATH, buffer, &fname)) else if (!GetFullPathNameW(pszFile, MAX_PATH, buffer, &fname))
{ {
heap_free(unquoted); free(unquoted);
return E_FAIL; return E_FAIL;
} }
else if(!PathFileExistsW(buffer) && else if(!PathFileExistsW(buffer) &&
...@@ -2165,17 +2165,17 @@ static HRESULT WINAPI IShellLinkW_fnSetPath(IShellLinkW * iface, LPCWSTR pszFile ...@@ -2165,17 +2165,17 @@ static HRESULT WINAPI IShellLinkW_fnSetPath(IShellLinkW * iface, LPCWSTR pszFile
This->pPidl = SHSimpleIDListFromPathW(pszFile); This->pPidl = SHSimpleIDListFromPathW(pszFile);
ShellLink_GetVolumeInfo(buffer, &This->volume); ShellLink_GetVolumeInfo(buffer, &This->volume);
This->sPath = heap_alloc( (lstrlenW( buffer )+1) * sizeof (WCHAR) ); This->sPath = malloc( (lstrlenW( buffer ) + 1) * sizeof(WCHAR) );
if (!This->sPath) if (!This->sPath)
{ {
heap_free(unquoted); free(unquoted);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
lstrcpyW(This->sPath, buffer); lstrcpyW(This->sPath, buffer);
} }
This->bDirty = TRUE; This->bDirty = TRUE;
heap_free(unquoted); free(unquoted);
return hr; return hr;
} }
...@@ -2376,14 +2376,14 @@ ShellLink_ExtInit_Initialize( IShellExtInit* iface, LPCITEMIDLIST pidlFolder, ...@@ -2376,14 +2376,14 @@ ShellLink_ExtInit_Initialize( IShellExtInit* iface, LPCITEMIDLIST pidlFolder,
count = DragQueryFileW( stgm.u.hGlobal, 0, NULL, 0 ); count = DragQueryFileW( stgm.u.hGlobal, 0, NULL, 0 );
count++; count++;
path = heap_alloc(count*sizeof(WCHAR) ); path = malloc( count * sizeof(WCHAR) );
if( path ) if( path )
{ {
IPersistFile *pf = &This->IPersistFile_iface; IPersistFile *pf = &This->IPersistFile_iface;
count = DragQueryFileW( stgm.u.hGlobal, 0, path, count ); count = DragQueryFileW( stgm.u.hGlobal, 0, path, count );
r = IPersistFile_Load( pf, path, 0 ); r = IPersistFile_Load( pf, path, 0 );
heap_free( path ); free( path );
} }
} }
ReleaseStgMedium( &stgm ); ReleaseStgMedium( &stgm );
...@@ -2460,11 +2460,11 @@ shelllink_get_msi_component_path( LPWSTR component ) ...@@ -2460,11 +2460,11 @@ shelllink_get_msi_component_path( LPWSTR component )
return NULL; return NULL;
sz++; sz++;
path = heap_alloc( sz*sizeof(WCHAR) ); path = malloc( sz * sizeof(WCHAR) );
r = CommandLineFromMsiDescriptor( component, path, &sz ); r = CommandLineFromMsiDescriptor( component, path, &sz );
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
{ {
heap_free( path ); free( path );
path = NULL; path = NULL;
} }
...@@ -2505,7 +2505,7 @@ ShellLink_InvokeCommand( IContextMenu* iface, LPCMINVOKECOMMANDINFO lpici ) ...@@ -2505,7 +2505,7 @@ ShellLink_InvokeCommand( IContextMenu* iface, LPCMINVOKECOMMANDINFO lpici )
return E_FAIL; return E_FAIL;
} }
else else
path = strdupW( This->sPath ); path = wcsdup( This->sPath );
if ( lpici->cbSize == sizeof (CMINVOKECOMMANDINFOEX) && if ( lpici->cbSize == sizeof (CMINVOKECOMMANDINFOEX) &&
( lpici->fMask & CMIC_MASK_UNICODE ) ) ( lpici->fMask & CMIC_MASK_UNICODE ) )
...@@ -2518,7 +2518,7 @@ ShellLink_InvokeCommand( IContextMenu* iface, LPCMINVOKECOMMANDINFO lpici ) ...@@ -2518,7 +2518,7 @@ ShellLink_InvokeCommand( IContextMenu* iface, LPCMINVOKECOMMANDINFO lpici )
if ( iciex->lpParametersW ) if ( iciex->lpParametersW )
len += lstrlenW( iciex->lpParametersW ); len += lstrlenW( iciex->lpParametersW );
args = heap_alloc( len*sizeof(WCHAR) ); args = malloc( len * sizeof(WCHAR) );
args[0] = 0; args[0] = 0;
if ( This->sArgs ) if ( This->sArgs )
lstrcatW( args, This->sArgs ); lstrcatW( args, This->sArgs );
...@@ -2544,8 +2544,8 @@ ShellLink_InvokeCommand( IContextMenu* iface, LPCMINVOKECOMMANDINFO lpici ) ...@@ -2544,8 +2544,8 @@ ShellLink_InvokeCommand( IContextMenu* iface, LPCMINVOKECOMMANDINFO lpici )
else else
r = E_FAIL; r = E_FAIL;
heap_free( args ); free( args );
heap_free( path ); free( path );
return r; return r;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment