Author: hbelusca
Date: Tue Jan 17 21:32:18 2017
New Revision: 73573
URL:
http://svn.reactos.org/svn/reactos?rev=73573&view=rev
Log:
[SHELL32]: CShellLink fixups Part 1:
- Use STDMETHODCALLTYPE for the interface methods calling convention;
- Use the naming convention "m_Member" for the class members (note that I
haven't applied the convention for some members: because they will go away in the next
commits);
- Use _countof() where needed;
- Make the ANSI CShellLink::GetIconLocation call the UNICODE version;
- Move some functions around to put them closer to the functions that call them;
- Very minor code formatting.
CORE-12682
Modified:
trunk/reactos/dll/win32/shell32/CShellLink.cpp
trunk/reactos/dll/win32/shell32/CShellLink.h
Modified: trunk/reactos/dll/win32/shell32/CShellLink.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/CShellLi…
==============================================================================
--- trunk/reactos/dll/win32/shell32/CShellLink.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/CShellLink.cpp [iso-8859-1] Tue Jan 17 21:32:18 2017
@@ -76,43 +76,6 @@
#include "poppack.h"
-/**************************************************************************
-* SH_GetTargetTypeByPath
-*
-* Function to get target type by passing full path to it
-*/
-LPWSTR SH_GetTargetTypeByPath(LPCWSTR lpcwFullPath)
-{
- LPCWSTR pwszExt;
- static WCHAR wszBuf[MAX_PATH];
-
- /* Get file information */
- SHFILEINFO fi;
- if (!SHGetFileInfoW(lpcwFullPath, 0, &fi, sizeof(fi), SHGFI_TYPENAME |
SHGFI_USEFILEATTRIBUTES ))
- {
- ERR("SHGetFileInfoW failed for %ls (%lu)\n", lpcwFullPath,
GetLastError());
- fi.szTypeName[0] = L'\0';
- fi.hIcon = NULL;
- }
-
- pwszExt = PathFindExtensionW(lpcwFullPath);
- if (pwszExt[0])
- {
- if (!fi.szTypeName[0])
- {
- /* The file type is unknown, so default to string "FileExtension
File" */
- size_t cchRemaining = 0;
- LPWSTR pwszEnd = NULL;
-
- StringCchPrintfExW(wszBuf, _countof(wszBuf), &pwszEnd, &cchRemaining,
0, L"%s ", pwszExt + 1);
- }
- else
- StringCbPrintfW(wszBuf, sizeof(wszBuf), L"%s (%s)", fi.szTypeName,
pwszExt); /* Update file type */
- }
-
- return wszBuf;
-}
-
/* IShellLink Implementation */
static HRESULT ShellLink_UpdatePath(LPCWSTR sPathRel, LPCWSTR path, LPCWSTR sWorkDir,
LPWSTR* psPath);
@@ -145,44 +108,49 @@
CShellLink::CShellLink()
{
- pPidl = NULL;
wHotKey = 0;
memset(&time1, 0, sizeof(time1));
memset(&time2, 0, sizeof(time2));
memset(&time3, 0, sizeof(time3));
iShowCmd = SW_SHOWNORMAL;
- sIcoPath = NULL;
iIcoNdx = 0;
- sPath = NULL;
- sArgs = NULL;
- sWorkDir = NULL;
- sDescription = NULL;
- sPathRel = NULL;
- sProduct = NULL;
- sComponent = NULL;
- memset(&volume, 0, sizeof(volume));
- sLinkPath = NULL;
- bRunAs = FALSE;
- bDirty = FALSE;
- iIdOpen = -1;
+
+ m_pPidl = NULL;
+
+ m_sPath = NULL;
+ ZeroMemory(&volume, sizeof(volume));
+
+ m_sDescription = NULL;
+ m_sPathRel = NULL;
+ m_sWorkDir = NULL;
+ m_sArgs = NULL;
+ m_sIcoPath = NULL;
+ m_bRunAs = FALSE;
+ m_bDirty = FALSE;
+
+ m_sLinkPath = NULL;
+ m_iIdOpen = -1;
+
+ /**/sProduct = sComponent = NULL;/**/
}
CShellLink::~CShellLink()
{
TRACE("-- destroying IShellLink(%p)\n", this);
- HeapFree(GetProcessHeap(), 0, sIcoPath);
- HeapFree(GetProcessHeap(), 0, sArgs);
- HeapFree(GetProcessHeap(), 0, sWorkDir);
- HeapFree(GetProcessHeap(), 0, sDescription);
- HeapFree(GetProcessHeap(), 0, sPath);
- HeapFree(GetProcessHeap(), 0, sLinkPath);
-
- if (pPidl)
- ILFree(pPidl);
-}
-
-HRESULT WINAPI CShellLink::GetClassID(CLSID *pclsid)
+ ILFree(m_pPidl);
+
+ HeapFree(GetProcessHeap(), 0, m_sPath);
+
+ HeapFree(GetProcessHeap(), 0, m_sDescription);
+ HeapFree(GetProcessHeap(), 0, m_sPathRel);
+ HeapFree(GetProcessHeap(), 0, m_sWorkDir);
+ HeapFree(GetProcessHeap(), 0, m_sArgs);
+ HeapFree(GetProcessHeap(), 0, m_sIcoPath);
+ HeapFree(GetProcessHeap(), 0, m_sLinkPath);
+}
+
+HRESULT STDMETHODCALLTYPE CShellLink::GetClassID(CLSID *pclsid)
{
TRACE("%p %p\n", this, pclsid);
@@ -192,17 +160,16 @@
return S_OK;
}
-HRESULT WINAPI CShellLink::IsDirty()
+/************************************************************************
+ * IPersistStream_IsDirty (IPersistStream)
+ */
+HRESULT STDMETHODCALLTYPE CShellLink::IsDirty()
{
TRACE("(%p)\n", this);
-
- if (bDirty)
- return S_OK;
-
- return S_FALSE;
-}
-
-HRESULT WINAPI CShellLink::Load(LPCOLESTR pszFileName, DWORD dwMode)
+ return (m_bDirty ? S_OK : S_FALSE);
+}
+
+HRESULT STDMETHODCALLTYPE CShellLink::Load(LPCOLESTR pszFileName, DWORD dwMode)
{
TRACE("(%p, %s, %x)\n", this, debugstr_w(pszFileName), dwMode);
@@ -213,17 +180,17 @@
HRESULT hr = SHCreateStreamOnFileW(pszFileName, dwMode, &stm);
if (SUCCEEDED(hr))
{
- HeapFree(GetProcessHeap(), 0, sLinkPath);
- sLinkPath = strdupW(pszFileName);
+ HeapFree(GetProcessHeap(), 0, m_sLinkPath);
+ m_sLinkPath = strdupW(pszFileName);
hr = Load(stm);
- ShellLink_UpdatePath(sPathRel, pszFileName, sWorkDir, &sPath);
- bDirty = FALSE;
+ ShellLink_UpdatePath(m_sPathRel, pszFileName, m_sWorkDir, &m_sPath);
+ m_bDirty = FALSE;
}
TRACE("-- returning hr %08x\n", hr);
return hr;
}
-HRESULT WINAPI CShellLink::Save(LPCOLESTR pszFileName, BOOL fRemember)
+HRESULT STDMETHODCALLTYPE CShellLink::Save(LPCOLESTR pszFileName, BOOL fRemember)
{
TRACE("(%p)->(%s)\n", this, debugstr_w(pszFileName));
@@ -238,14 +205,14 @@
if (SUCCEEDED(hr))
{
- if (sLinkPath)
- HeapFree(GetProcessHeap(), 0, sLinkPath);
-
- sLinkPath = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, (wcslen(pszFileName) + 1)
* sizeof(WCHAR));
- if (sLinkPath)
- wcscpy(sLinkPath, pszFileName);
-
- bDirty = FALSE;
+ if (m_sLinkPath)
+ HeapFree(GetProcessHeap(), 0, m_sLinkPath);
+
+ m_sLinkPath = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, (wcslen(pszFileName) +
1) * sizeof(WCHAR));
+ if (m_sLinkPath)
+ wcscpy(m_sLinkPath, pszFileName);
+
+ m_bDirty = FALSE;
}
else
{
@@ -257,23 +224,23 @@
return hr;
}
-HRESULT WINAPI CShellLink::SaveCompleted(LPCOLESTR pszFileName)
+HRESULT STDMETHODCALLTYPE CShellLink::SaveCompleted(LPCOLESTR pszFileName)
{
FIXME("(%p)->(%s)\n", this, debugstr_w(pszFileName));
return S_OK;
}
-HRESULT WINAPI CShellLink::GetCurFile(LPOLESTR *ppszFileName)
+HRESULT STDMETHODCALLTYPE CShellLink::GetCurFile(LPOLESTR *ppszFileName)
{
*ppszFileName = NULL;
- if (!sLinkPath)
+ if (!m_sLinkPath)
{
/* IPersistFile::GetCurFile called before IPersistFile::Save */
return S_FALSE;
}
- *ppszFileName = (LPOLESTR)CoTaskMemAlloc((wcslen(sLinkPath) + 1) * sizeof(WCHAR));
+ *ppszFileName = (LPOLESTR)CoTaskMemAlloc((wcslen(m_sLinkPath) + 1) * sizeof(WCHAR));
if (!*ppszFileName)
{
/* out of memory */
@@ -281,14 +248,10 @@
}
/* copy last saved filename */
- wcscpy(*ppszFileName, sLinkPath);
-
- return S_OK;
-}
-
-/************************************************************************
- * IPersistStream_IsDirty (IPersistStream)
- */
+ wcscpy(*ppszFileName, m_sLinkPath);
+
+ return S_OK;
+}
static HRESULT Stream_LoadString(IStream* stm, BOOL unicode, LPWSTR *pstr)
{
@@ -301,7 +264,7 @@
return E_FAIL;
if (unicode)
- len *= sizeof (WCHAR);
+ len *= sizeof(WCHAR);
TRACE("reading %d\n", len);
LPSTR temp = (LPSTR)HeapAlloc(GetProcessHeap(), 0, len + sizeof(WCHAR));
@@ -309,7 +272,7 @@
return E_OUTOFMEMORY;
count = 0;
hr = stm->Read(temp, len, &count);
- if(FAILED(hr) || count != len)
+ if (FAILED(hr) || count != len)
{
HeapFree(GetProcessHeap(), 0, temp);
return E_FAIL;
@@ -322,7 +285,7 @@
if (!unicode)
{
count = MultiByteToWideChar(CP_ACP, 0, temp, len, NULL, 0);
- str = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, (count + 1) * sizeof (WCHAR));
+ str = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, (count + 1) * sizeof(WCHAR));
if (!str)
{
HeapFree(GetProcessHeap(), 0, temp);
@@ -333,7 +296,7 @@
}
else
{
- count /= 2;
+ count /= sizeof(WCHAR);
str = (LPWSTR)temp;
}
str[count] = 0;
@@ -341,6 +304,21 @@
*pstr = str;
return S_OK;
+}
+
+
+/*
+ * NOTE: The following 5 functions are part of LINKINFO.DLL
+ */
+static BOOL ShellLink_GetVolumeInfo(LPCWSTR path, CShellLink::volume_info *volume)
+{
+ WCHAR drive[4] = { path[0], ':', '\\', 0 };
+
+ volume->type = GetDriveTypeW(drive);
+ BOOL bRet = GetVolumeInformationW(drive, volume->label,
_countof(volume->label), &volume->serial, NULL, NULL, NULL, 0);
+ TRACE("ret = %d type %d serial %08x name %s\n", bRet,
+ volume->type, volume->serial, debugstr_w(volume->label));
+ return bRet;
}
static HRESULT Stream_ReadChunk(IStream* stm, LPVOID *data)
@@ -414,7 +392,7 @@
}
static HRESULT Stream_LoadLocation(IStream *stm,
- CShellLink::volume_info *volume, LPWSTR *path)
+ CShellLink::volume_info *volume, LPWSTR *path)
{
char *p = NULL;
HRESULT hr = Stream_ReadChunk(stm, (LPVOID*) &p);
@@ -462,7 +440,7 @@
* 8+0x104 string data in UNICODE
*
* In the original Win32 implementation the buffers are not initialized
- * to zero, so data trailing the string is random garbage.
+ * to zero, so data trailing the string is random garbage.
*/
static HRESULT Stream_LoadAdvertiseInfo(IStream* stm, LPWSTR *str)
{
@@ -507,7 +485,7 @@
/************************************************************************
* IPersistStream_Load (IPersistStream)
*/
-HRESULT WINAPI CShellLink::Load(IStream *stm)
+HRESULT STDMETHODCALLTYPE CShellLink::Load(IStream *stm)
{
TRACE("%p %p\n", this, stm);
@@ -528,21 +506,21 @@
return E_FAIL;
/* free all the old stuff */
- ILFree(pPidl);
- pPidl = NULL;
+ ILFree(m_pPidl);
+ m_pPidl = NULL;
memset(&volume, 0, sizeof volume);
- HeapFree(GetProcessHeap(), 0, sPath);
- sPath = NULL;
- HeapFree(GetProcessHeap(), 0, sDescription);
- sDescription = NULL;
- HeapFree(GetProcessHeap(), 0, sPathRel);
- sPathRel = NULL;
- HeapFree(GetProcessHeap(), 0, sWorkDir);
- sWorkDir = NULL;
- HeapFree(GetProcessHeap(), 0, sArgs);
- sArgs = NULL;
- HeapFree(GetProcessHeap(), 0, sIcoPath);
- sIcoPath = NULL;
+ HeapFree(GetProcessHeap(), 0, m_sPath);
+ m_sPath = NULL;
+ HeapFree(GetProcessHeap(), 0, m_sDescription);
+ m_sDescription = NULL;
+ HeapFree(GetProcessHeap(), 0, m_sPathRel);
+ m_sPathRel = NULL;
+ HeapFree(GetProcessHeap(), 0, m_sWorkDir);
+ m_sWorkDir = NULL;
+ HeapFree(GetProcessHeap(), 0, m_sArgs);
+ m_sArgs = NULL;
+ HeapFree(GetProcessHeap(), 0, m_sIcoPath);
+ m_sIcoPath = NULL;
HeapFree(GetProcessHeap(), 0, sProduct);
sProduct = NULL;
HeapFree(GetProcessHeap(), 0, sComponent);
@@ -572,15 +550,15 @@
/* load all the new stuff */
if (ShlLnkHeader.dwFlags & SLDF_HAS_ID_LIST)
{
- hr = ILLoadFromStream(stm, &pPidl);
+ hr = ILLoadFromStream(stm, &m_pPidl);
if (FAILED(hr))
return hr;
}
- pdump(pPidl);
+ pdump(m_pPidl);
/* load the location information */
if (ShlLnkHeader.dwFlags & SLDF_HAS_LINK_INFO)
- hr = Stream_LoadLocation(stm, &volume, &sPath);
+ hr = Stream_LoadLocation(stm, &volume, &m_sPath);
if (FAILED(hr))
goto end;
@@ -589,41 +567,41 @@
if (ShlLnkHeader.dwFlags & SLDF_HAS_NAME)
{
- hr = Stream_LoadString(stm, unicode, &sDescription);
- TRACE("Description -> %s\n", debugstr_w(sDescription));
+ hr = Stream_LoadString(stm, unicode, &m_sDescription);
+ TRACE("Description -> %s\n", debugstr_w(m_sDescription));
}
if (FAILED(hr))
goto end;
if (ShlLnkHeader.dwFlags & SLDF_HAS_RELPATH)
{
- hr = Stream_LoadString(stm, unicode, &sPathRel);
- TRACE("Relative Path-> %s\n", debugstr_w(sPathRel));
+ hr = Stream_LoadString(stm, unicode, &m_sPathRel);
+ TRACE("Relative Path-> %s\n", debugstr_w(m_sPathRel));
}
if (FAILED(hr))
goto end;
if (ShlLnkHeader.dwFlags & SLDF_HAS_WORKINGDIR)
{
- hr = Stream_LoadString(stm, unicode, &sWorkDir);
- PathRemoveBackslash(sWorkDir);
- TRACE("Working Dir -> %s\n", debugstr_w(sWorkDir));
+ hr = Stream_LoadString(stm, unicode, &m_sWorkDir);
+ PathRemoveBackslash(m_sWorkDir);
+ TRACE("Working Dir -> %s\n", debugstr_w(m_sWorkDir));
}
if (FAILED(hr))
goto end;
if (ShlLnkHeader.dwFlags & SLDF_HAS_ARGS)
{
- hr = Stream_LoadString(stm, unicode, &sArgs);
- TRACE("Arguments -> %s\n", debugstr_w(sArgs));
+ hr = Stream_LoadString(stm, unicode, &m_sArgs);
+ TRACE("Arguments -> %s\n", debugstr_w(m_sArgs));
}
if (FAILED(hr))
goto end;
if (ShlLnkHeader.dwFlags & SLDF_HAS_ICONLOCATION)
{
- hr = Stream_LoadString(stm, unicode, &sIcoPath);
- TRACE("Icon file -> %s\n", debugstr_w(sIcoPath));
+ hr = Stream_LoadString(stm, unicode, &m_sIcoPath);
+ TRACE("Icon file -> %s\n", debugstr_w(m_sIcoPath));
}
if (FAILED(hr))
goto end;
@@ -645,11 +623,11 @@
}
if (ShlLnkHeader.dwFlags & SLDF_RUNAS_USER)
{
- bRunAs = TRUE;
+ m_bRunAs = TRUE;
}
else
{
- bRunAs = FALSE;
+ m_bRunAs = FALSE;
}
if (FAILED(hr))
@@ -662,7 +640,7 @@
TRACE("OK\n");
- pdump (pPidl);
+ pdump(m_pPidl);
return S_OK;
@@ -729,25 +707,25 @@
/* fill in the location information header */
loc->dwTotalSize = total_size;
- loc->dwHeaderSize = sizeof (*loc);
+ loc->dwHeaderSize = sizeof(*loc);
loc->dwFlags = 1;
- loc->dwVolTableOfs = sizeof (*loc);
- loc->dwLocalPathOfs = sizeof (*loc) + volume_info_size;
+ loc->dwVolTableOfs = sizeof(*loc);
+ loc->dwLocalPathOfs = sizeof(*loc) + volume_info_size;
loc->dwNetworkVolTableOfs = 0;
- loc->dwFinalPathOfs = sizeof (*loc) + volume_info_size + path_size;
+ loc->dwFinalPathOfs = sizeof(*loc) + volume_info_size + path_size;
/* fill in the volume information */
vol->dwSize = volume_info_size;
vol->dwType = volume->type;
vol->dwVolSerial = volume->serial;
- vol->dwVolLabelOfs = sizeof (*vol);
+ vol->dwVolLabelOfs = sizeof(*vol);
/* copy in the strings */
WideCharToMultiByte(CP_ACP, 0, volume->label, -1,
szLabel, label_size, NULL, NULL);
WideCharToMultiByte(CP_ACP, 0, path, -1,
szPath, path_size, NULL, NULL);
- szFinalPath[0] = 0;
+ *szFinalPath = 0;
ULONG count = 0;
HRESULT hr = stm->Write(loc, total_size, &count);
@@ -782,7 +760,7 @@
*
* FIXME: makes assumptions about byte order
*/
-HRESULT WINAPI CShellLink::Save(IStream *stm, BOOL fClearDirty)
+HRESULT STDMETHODCALLTYPE CShellLink::Save(IStream *stm, BOOL fClearDirty)
{
TRACE("%p %p %x\n", this, stm, fClearDirty);
@@ -795,17 +773,17 @@
ShlLnkHeader.wHotKey = wHotKey;
ShlLnkHeader.nIconIndex = iIcoNdx;
ShlLnkHeader.dwFlags = SLDF_UNICODE; /* strings are in unicode */
- if (pPidl)
+ if (m_pPidl)
ShlLnkHeader.dwFlags |= SLDF_HAS_ID_LIST;
- if (sPath)
+ if (m_sPath)
ShlLnkHeader.dwFlags |= SLDF_HAS_LINK_INFO;
- if (sDescription)
+ if (m_sDescription)
ShlLnkHeader.dwFlags |= SLDF_HAS_NAME;
- if (sWorkDir)
+ if (m_sWorkDir)
ShlLnkHeader.dwFlags |= SLDF_HAS_WORKINGDIR;
- if (sArgs)
+ if (m_sArgs)
ShlLnkHeader.dwFlags |= SLDF_HAS_ARGS;
- if (sIcoPath)
+ if (m_sIcoPath)
ShlLnkHeader.dwFlags |= SLDF_HAS_ICONLOCATION;
#if (NTDDI_VERSION < NTDDI_LONGHORN)
if (sProduct)
@@ -813,7 +791,7 @@
#endif
if (sComponent)
ShlLnkHeader.dwFlags |= SLDF_HAS_DARWINID;
- if (bRunAs)
+ if (m_bRunAs)
ShlLnkHeader.dwFlags |= SLDF_RUNAS_USER;
SystemTimeToFileTime (&time1, &ShlLnkHeader.ftCreationTime);
@@ -832,9 +810,9 @@
TRACE("Writing pidl\n");
/* write the PIDL to the shortcut */
- if (pPidl)
- {
- hr = ILSaveToStream(stm, pPidl);
+ if (m_pPidl)
+ {
+ hr = ILSaveToStream(stm, m_pPidl);
if (FAILED(hr))
{
ERR("Failed to write PIDL\n");
@@ -842,23 +820,23 @@
}
}
- if (sPath)
- Stream_WriteLocationInfo(stm, sPath, &volume);
-
- if (sDescription)
- hr = Stream_WriteString(stm, sDescription);
-
- if (sPathRel)
- hr = Stream_WriteString(stm, sPathRel);
-
- if (sWorkDir)
- hr = Stream_WriteString(stm, sWorkDir);
-
- if (sArgs)
- hr = Stream_WriteString(stm, sArgs);
-
- if (sIcoPath)
- hr = Stream_WriteString(stm, sIcoPath);
+ if (m_sPath)
+ Stream_WriteLocationInfo(stm, m_sPath, &volume);
+
+ if (m_sDescription)
+ hr = Stream_WriteString(stm, m_sDescription);
+
+ if (m_sPathRel)
+ hr = Stream_WriteString(stm, m_sPathRel);
+
+ if (m_sWorkDir)
+ hr = Stream_WriteString(stm, m_sWorkDir);
+
+ if (m_sArgs)
+ hr = Stream_WriteString(stm, m_sArgs);
+
+ if (m_sIcoPath)
+ hr = Stream_WriteString(stm, m_sIcoPath);
if (sProduct)
hr = Stream_WriteAdvertiseInfo(stm, sProduct, EXP_SZ_ICON_SIG);
@@ -876,10 +854,9 @@
/************************************************************************
* IPersistStream_GetSizeMax (IPersistStream)
*/
-HRESULT WINAPI CShellLink::GetSizeMax(ULARGE_INTEGER *pcbSize)
+HRESULT STDMETHODCALLTYPE CShellLink::GetSizeMax(ULARGE_INTEGER *pcbSize)
{
TRACE("(%p)\n", this);
-
return E_NOTIMPL;
}
@@ -947,10 +924,10 @@
return S_OK;
}
-HRESULT WINAPI CShellLink::GetPath(LPSTR pszFile, INT cchMaxPath, WIN32_FIND_DATAA *pfd,
DWORD fFlags)
+HRESULT STDMETHODCALLTYPE CShellLink::GetPath(LPSTR pszFile, INT cchMaxPath,
WIN32_FIND_DATAA *pfd, DWORD fFlags)
{
TRACE("(%p)->(pfile=%p len=%u find_data=%p flags=%u)(%s)\n",
- this, pszFile, cchMaxPath, pfd, fFlags, debugstr_w(sPath));
+ this, pszFile, cchMaxPath, pfd, fFlags, debugstr_w(m_sPath));
if (sComponent || sProduct)
return S_FALSE;
@@ -958,8 +935,8 @@
if (cchMaxPath)
pszFile[0] = 0;
- if (sPath)
- WideCharToMultiByte(CP_ACP, 0, sPath, -1,
+ if (m_sPath)
+ WideCharToMultiByte(CP_ACP, 0, m_sPath, -1,
pszFile, cchMaxPath, NULL, NULL);
if (pfd) FIXME("(%p): WIN32_FIND_DATA is not yet filled.\n", this);
@@ -967,183 +944,426 @@
return S_OK;
}
-HRESULT WINAPI CShellLink::GetIDList(LPITEMIDLIST * ppidl)
+HRESULT STDMETHODCALLTYPE CShellLink::GetIDList(LPITEMIDLIST *ppidl)
{
TRACE("(%p)->(ppidl=%p)\n", this, ppidl);
- if (!pPidl)
+ if (!m_pPidl)
{
*ppidl = NULL;
return S_FALSE;
}
- *ppidl = ILClone(pPidl);
- return S_OK;
-}
-
-HRESULT WINAPI CShellLink::SetIDList(LPCITEMIDLIST pidl)
+ *ppidl = ILClone(m_pPidl);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CShellLink::SetIDList(LPCITEMIDLIST pidl)
{
TRACE("(%p)->(pidl=%p)\n", this, pidl);
- if (pPidl)
- ILFree(pPidl);
-
- pPidl = ILClone(pidl);
- if (!pPidl)
+ if (m_pPidl)
+ ILFree(m_pPidl);
+
+ m_pPidl = ILClone(pidl);
+ if (!m_pPidl)
return E_FAIL;
- bDirty = TRUE;
-
- return S_OK;
-}
-
-HRESULT WINAPI CShellLink::GetDescription(LPSTR pszName, INT cchMaxName)
+ m_bDirty = TRUE;
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CShellLink::GetDescription(LPSTR pszName, INT cchMaxName)
{
TRACE("(%p)->(%p len=%u)\n", this, pszName, cchMaxName);
if (cchMaxName)
- pszName[0] = 0;
-
- if (sDescription)
- WideCharToMultiByte(CP_ACP, 0, sDescription, -1,
+ *pszName = 0;
+
+ if (m_sDescription)
+ WideCharToMultiByte(CP_ACP, 0, m_sDescription, -1,
pszName, cchMaxName, NULL, NULL);
return S_OK;
}
-HRESULT WINAPI CShellLink::SetDescription(LPCSTR pszName)
+HRESULT STDMETHODCALLTYPE CShellLink::SetDescription(LPCSTR pszName)
{
TRACE("(%p)->(pName=%s)\n", this, pszName);
- HeapFree(GetProcessHeap(), 0, sDescription);
- sDescription = NULL;
+ HeapFree(GetProcessHeap(), 0, m_sDescription);
+ m_sDescription = NULL;
if (pszName)
{
- sDescription = HEAP_strdupAtoW(GetProcessHeap(), 0, pszName);
- if (!sDescription)
+ m_sDescription = HEAP_strdupAtoW(GetProcessHeap(), 0, pszName);
+ if (!m_sDescription)
return E_OUTOFMEMORY;
}
- bDirty = TRUE;
-
- return S_OK;
-}
-
-HRESULT WINAPI CShellLink::GetWorkingDirectory(LPSTR pszDir, INT cchMaxPath)
+ m_bDirty = TRUE;
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CShellLink::GetWorkingDirectory(LPSTR pszDir, INT cchMaxPath)
{
TRACE("(%p)->(%p len=%u)\n", this, pszDir, cchMaxPath);
if (cchMaxPath)
- pszDir[0] = 0;
-
- if (sWorkDir)
- WideCharToMultiByte(CP_ACP, 0, sWorkDir, -1,
+ *pszDir = 0;
+
+ if (m_sWorkDir)
+ WideCharToMultiByte(CP_ACP, 0, m_sWorkDir, -1,
pszDir, cchMaxPath, NULL, NULL);
return S_OK;
}
-HRESULT WINAPI CShellLink::SetWorkingDirectory(LPCSTR pszDir)
+HRESULT STDMETHODCALLTYPE CShellLink::SetWorkingDirectory(LPCSTR pszDir)
{
TRACE("(%p)->(dir=%s)\n", this, pszDir);
- HeapFree(GetProcessHeap(), 0, sWorkDir);
- sWorkDir = NULL;
+ HeapFree(GetProcessHeap(), 0, m_sWorkDir);
+ m_sWorkDir = NULL;
if (pszDir)
{
- sWorkDir = HEAP_strdupAtoW(GetProcessHeap(), 0, pszDir);
- if (!sWorkDir)
+ m_sWorkDir = HEAP_strdupAtoW(GetProcessHeap(), 0, pszDir);
+ if (!m_sWorkDir)
return E_OUTOFMEMORY;
}
- bDirty = TRUE;
-
- return S_OK;
-}
-
-HRESULT WINAPI CShellLink::GetArguments(LPSTR pszArgs, INT cchMaxPath)
+ m_bDirty = TRUE;
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CShellLink::GetArguments(LPSTR pszArgs, INT cchMaxPath)
{
TRACE("(%p)->(%p len=%u)\n", this, pszArgs, cchMaxPath);
if (cchMaxPath)
- pszArgs[0] = 0;
- if (sArgs)
- WideCharToMultiByte(CP_ACP, 0, sArgs, -1,
+ *pszArgs = 0;
+
+ if (m_sArgs)
+ WideCharToMultiByte(CP_ACP, 0, m_sArgs, -1,
pszArgs, cchMaxPath, NULL, NULL);
return S_OK;
}
-HRESULT WINAPI CShellLink::SetArguments(LPCSTR pszArgs)
+HRESULT STDMETHODCALLTYPE CShellLink::SetArguments(LPCSTR pszArgs)
{
TRACE("(%p)->(args=%s)\n", this, pszArgs);
- HeapFree(GetProcessHeap(), 0, sArgs);
- sArgs = NULL;
+ HeapFree(GetProcessHeap(), 0, m_sArgs);
+ m_sArgs = NULL;
if (pszArgs)
{
- sArgs = HEAP_strdupAtoW(GetProcessHeap(), 0, pszArgs);
- if (!sArgs)
+ m_sArgs = HEAP_strdupAtoW(GetProcessHeap(), 0, pszArgs);
+ if (!m_sArgs)
return E_OUTOFMEMORY;
}
- bDirty = TRUE;
-
- return S_OK;
-}
-
-HRESULT WINAPI CShellLink::GetHotkey(WORD *pwHotkey)
+ m_bDirty = TRUE;
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CShellLink::GetHotkey(WORD *pwHotkey)
{
TRACE("(%p)->(%p)(0x%08x)\n", this, pwHotkey, wHotKey);
-
*pwHotkey = wHotKey;
-
- return S_OK;
-}
-
-HRESULT WINAPI CShellLink::SetHotkey(WORD wHotkey)
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CShellLink::SetHotkey(WORD wHotkey)
{
TRACE("(%p)->(hotkey=%x)\n", this, wHotkey);
wHotKey = wHotkey;
- bDirty = TRUE;
-
- return S_OK;
-}
-
-HRESULT WINAPI CShellLink::GetShowCmd(INT *piShowCmd)
-{
- TRACE("(%p)->(%p)\n", this, piShowCmd);
+ m_bDirty = TRUE;
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CShellLink::GetShowCmd(INT *piShowCmd)
+{
+ TRACE("(%p)->(%p) %d\n", this, piShowCmd, iShowCmd);
*piShowCmd = iShowCmd;
return S_OK;
}
-HRESULT WINAPI CShellLink::SetShowCmd(INT iShowCmd)
+HRESULT STDMETHODCALLTYPE CShellLink::SetShowCmd(INT iShowCmd)
{
TRACE("(%p) %d\n", this, iShowCmd);
this->iShowCmd = iShowCmd;
- bDirty = TRUE;
-
- return S_OK;
-}
-
-static HRESULT SHELL_PidlGeticonLocationA(IShellFolder* psf, LPCITEMIDLIST pidl,
- LPSTR pszIconPath, int cchIconPath, int* piIcon)
+ m_bDirty = TRUE;
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CShellLink::GetIconLocation(LPSTR pszIconPath, INT cchIconPath,
INT *piIcon)
+{
+ HRESULT hr;
+ LPWSTR pszIconPathW;
+
+ TRACE("(%p)->(%p len=%u iicon=%p)\n", this, pszIconPath, cchIconPath,
piIcon);
+
+ /* Allocate a temporary UNICODE buffer */
+ pszIconPathW = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, cchIconPath * sizeof(WCHAR));
+ if (!pszIconPathW)
+ return E_OUTOFMEMORY;
+
+ /* Call the UNICODE function */
+ hr = GetIconLocation(pszIconPathW, cchIconPath, piIcon);
+
+ /* Convert the file path back to ANSI */
+ WideCharToMultiByte(CP_ACP, 0, pszIconPathW, -1,
+ pszIconPath, cchIconPath, NULL, NULL);
+
+ /* Free the temporary buffer */
+ HeapFree(GetProcessHeap(), 0, pszIconPathW);
+
+ return hr;
+}
+
+HRESULT STDMETHODCALLTYPE CShellLink::SetIconLocation(LPCSTR pszIconPath, INT iIcon)
+{
+ TRACE("(%p)->(path=%s iicon=%u)\n", this, pszIconPath, iIcon);
+
+ HeapFree(GetProcessHeap(), 0, m_sIcoPath);
+ m_sIcoPath = NULL;
+
+ if (pszIconPath)
+ {
+ m_sIcoPath = HEAP_strdupAtoW(GetProcessHeap(), 0, pszIconPath);
+ if (!m_sIcoPath)
+ return E_OUTOFMEMORY;
+ }
+
+ iIcoNdx = iIcon;
+ m_bDirty = TRUE;
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CShellLink::SetRelativePath(LPCSTR pszPathRel, DWORD
dwReserved)
+{
+ TRACE("(%p)->(path=%s %x)\n", this, pszPathRel, dwReserved);
+
+ HeapFree(GetProcessHeap(), 0, m_sPathRel);
+ m_sPathRel = NULL;
+
+ if (pszPathRel)
+ {
+ m_sPathRel = HEAP_strdupAtoW(GetProcessHeap(), 0, pszPathRel);
+ m_bDirty = TRUE;
+ }
+
+ return ShellLink_UpdatePath(m_sPathRel, m_sPath, m_sWorkDir, &m_sPath);
+}
+
+HRESULT STDMETHODCALLTYPE CShellLink::Resolve(HWND hwnd, DWORD fFlags)
+{
+ HRESULT hr = S_OK;
+ BOOL bSuccess;
+
+ TRACE("(%p)->(hwnd=%p flags=%x)\n", this, hwnd, fFlags);
+
+ /*FIXME: use IResolveShellLink interface */
+
+ if (!m_sPath && m_pPidl)
+ {
+ WCHAR buffer[MAX_PATH];
+
+ bSuccess = SHGetPathFromIDListW(m_pPidl, buffer);
+
+ if (bSuccess && *buffer)
+ {
+ m_sPath = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, (wcslen(buffer) + 1) *
sizeof(WCHAR));
+
+ if (!m_sPath)
+ return E_OUTOFMEMORY;
+
+ wcscpy(m_sPath, buffer);
+
+ m_bDirty = TRUE;
+ }
+ else
+ hr = S_OK; /* don't report an error occurred while just caching
information */
+ }
+
+ if (!m_sIcoPath && m_sPath)
+ {
+ m_sIcoPath = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, (wcslen(m_sPath) + 1) *
sizeof(WCHAR));
+
+ if (!m_sIcoPath)
+ return E_OUTOFMEMORY;
+
+ wcscpy(m_sIcoPath, m_sPath);
+ iIcoNdx = 0;
+
+ m_bDirty = TRUE;
+ }
+
+ return hr;
+}
+
+HRESULT STDMETHODCALLTYPE CShellLink::SetPath(LPCSTR pszFile)
+{
+ TRACE("(%p)->(path=%s)\n", this, pszFile);
+
+ if (!pszFile)
+ return E_INVALIDARG;
+
+ LPWSTR str = HEAP_strdupAtoW(GetProcessHeap(), 0, pszFile);
+ if (!str)
+ return E_OUTOFMEMORY;
+
+ HRESULT hr = SetPath(str);
+ HeapFree(GetProcessHeap(), 0, str);
+
+ return hr;
+}
+
+HRESULT STDMETHODCALLTYPE CShellLink::GetPath(LPWSTR pszFile, INT cchMaxPath,
WIN32_FIND_DATAW *pfd, DWORD fFlags)
+{
+ TRACE("(%p)->(pfile=%p len=%u find_data=%p flags=%u)(%s)\n",
+ this, pszFile, cchMaxPath, pfd, fFlags, debugstr_w(m_sPath));
+
+ if (sComponent || sProduct)
+ return S_FALSE;
+
+ if (cchMaxPath)
+ *pszFile = 0;
+
+ if (m_sPath)
+ lstrcpynW(pszFile, m_sPath, cchMaxPath);
+
+ if (pfd) FIXME("(%p): WIN32_FIND_DATA is not yet filled.\n", this);
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CShellLink::GetDescription(LPWSTR pszName, INT cchMaxName)
+{
+ TRACE("(%p)->(%p len=%u)\n", this, pszName, cchMaxName);
+
+ *pszName = 0;
+ if (m_sDescription)
+ lstrcpynW(pszName, m_sDescription, cchMaxName);
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CShellLink::SetDescription(LPCWSTR pszName)
+{
+ TRACE("(%p)->(desc=%s)\n", this, debugstr_w(pszName));
+
+ HeapFree(GetProcessHeap(), 0, m_sDescription);
+ if (pszName)
+ {
+ m_sDescription = (LPWSTR)HeapAlloc(GetProcessHeap(), 0,
+ (wcslen(pszName) + 1) * sizeof(WCHAR));
+ if (!m_sDescription)
+ return E_OUTOFMEMORY;
+
+ wcscpy(m_sDescription, pszName);
+ }
+ else
+ m_sDescription = NULL;
+
+ m_bDirty = TRUE;
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CShellLink::GetWorkingDirectory(LPWSTR pszDir, INT cchMaxPath)
+{
+ TRACE("(%p)->(%p len %u)\n", this, pszDir, cchMaxPath);
+
+ if (cchMaxPath)
+ *pszDir = 0;
+
+ if (m_sWorkDir)
+ lstrcpynW(pszDir, m_sWorkDir, cchMaxPath);
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CShellLink::SetWorkingDirectory(LPCWSTR pszDir)
+{
+ TRACE("(%p)->(dir=%s)\n", this, debugstr_w(pszDir));
+
+ HeapFree(GetProcessHeap(), 0, m_sWorkDir);
+ if (pszDir)
+ {
+ m_sWorkDir = (LPWSTR)HeapAlloc(GetProcessHeap(), 0,
+ (wcslen(pszDir) + 1) * sizeof(WCHAR));
+ if (!m_sWorkDir)
+ return E_OUTOFMEMORY;
+ wcscpy(m_sWorkDir, pszDir);
+ }
+ else
+ m_sWorkDir = NULL;
+
+ m_bDirty = TRUE;
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CShellLink::GetArguments(LPWSTR pszArgs, INT cchMaxPath)
+{
+ TRACE("(%p)->(%p len=%u)\n", this, pszArgs, cchMaxPath);
+
+ if (cchMaxPath)
+ *pszArgs = 0;
+
+ if (m_sArgs)
+ lstrcpynW(pszArgs, m_sArgs, cchMaxPath);
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CShellLink::SetArguments(LPCWSTR pszArgs)
+{
+ TRACE("(%p)->(args=%s)\n", this, debugstr_w(pszArgs));
+
+ HeapFree(GetProcessHeap(), 0, m_sArgs);
+ if (pszArgs)
+ {
+ m_sArgs = (LPWSTR)HeapAlloc(GetProcessHeap(), 0,
+ (wcslen(pszArgs) + 1) * sizeof(WCHAR));
+ if (!m_sArgs)
+ return E_OUTOFMEMORY;
+
+ wcscpy(m_sArgs, pszArgs);
+ }
+ else
+ m_sArgs = NULL;
+
+ m_bDirty = TRUE;
+
+ return S_OK;
+}
+
+static HRESULT SHELL_PidlGetIconLocationW(IShellFolder* psf, LPCITEMIDLIST pidl,
+ PWSTR pszIconFile, UINT cchMax, int *piIndex)
{
LPCITEMIDLIST pidlLast;
+ UINT wFlags;
HRESULT hr = SHBindToParent(pidl, IID_PPV_ARG(IShellFolder, &psf),
&pidlLast);
-
if (SUCCEEDED(hr))
{
- CComPtr<IExtractIconA> pei;
-
- hr = psf->GetUIObjectOf(0, 1, &pidlLast, IID_NULL_PPV_ARG(IExtractIconA,
&pei));
-
+ CComPtr<IExtractIconW> pei;
+
+ hr = psf->GetUIObjectOf(0, 1, &pidlLast, IID_NULL_PPV_ARG(IExtractIconW,
&pei));
if (SUCCEEDED(hr))
- hr = pei->GetIconLocation(0, pszIconPath, MAX_PATH, piIcon, NULL);
+ hr = pei->GetIconLocation(0, pszIconFile, cchMax, piIndex, &wFlags);
psf->Release();
}
@@ -1151,331 +1371,45 @@
return hr;
}
-HRESULT WINAPI CShellLink::GetIconLocation(LPSTR pszIconPath, INT cchIconPath, INT
*piIcon)
+HRESULT STDMETHODCALLTYPE CShellLink::GetIconLocation(LPWSTR pszIconPath, INT
cchIconPath, INT *piIcon)
{
TRACE("(%p)->(%p len=%u iicon=%p)\n", this, pszIconPath, cchIconPath,
piIcon);
- pszIconPath[0] = 0;
+ if (cchIconPath)
+ *pszIconPath = 0;
+
*piIcon = iIcoNdx;
- if (sIcoPath)
- {
- WideCharToMultiByte(CP_ACP, 0, sIcoPath, -1, pszIconPath, cchIconPath, NULL,
NULL);
+ if (m_sIcoPath)
+ {
+ lstrcpynW(pszIconPath, m_sIcoPath, cchIconPath);
return S_OK;
}
- if (pPidl || sPath)
- {
- CComPtr<IShellFolder> pdsk;
+ if (m_pPidl || m_sPath)
+ {
+ CComPtr<IShellFolder> pdsk;
HRESULT hr = SHGetDesktopFolder(&pdsk);
if (SUCCEEDED(hr))
{
/* first look for an icon using the PIDL (if present) */
- if (pPidl)
- hr = SHELL_PidlGeticonLocationA(pdsk, pPidl, pszIconPath, cchIconPath,
piIcon);
+ if (m_pPidl)
+ hr = SHELL_PidlGetIconLocationW(pdsk, m_pPidl, pszIconPath, cchIconPath,
piIcon);
else
hr = E_FAIL;
/* if we couldn't find an icon yet, look for it using the file system
path */
- if (FAILED(hr) && sPath)
+ if (FAILED(hr) && m_sPath)
{
LPITEMIDLIST pidl;
- hr = pdsk->ParseDisplayName(0, NULL, sPath, NULL, &pidl, NULL);
+ hr = pdsk->ParseDisplayName(0, NULL, m_sPath, NULL, &pidl, NULL);
if (SUCCEEDED(hr))
{
- hr = SHELL_PidlGeticonLocationA(pdsk, pidl, pszIconPath, cchIconPath,
piIcon);
-
- SHFree(pidl);
- }
- }
- }
-
- return hr;
- }
- return S_OK;
-}
-
-HRESULT WINAPI CShellLink::SetIconLocation(LPCSTR pszIconPath, INT iIcon)
-{
- TRACE("(%p)->(path=%s iicon=%u)\n", this, pszIconPath, iIcon);
-
- HeapFree(GetProcessHeap(), 0, sIcoPath);
- sIcoPath = NULL;
-
- if (pszIconPath)
- {
- sIcoPath = HEAP_strdupAtoW(GetProcessHeap(), 0, pszIconPath);
- if (!sIcoPath)
- return E_OUTOFMEMORY;
- }
-
- iIcoNdx = iIcon;
- bDirty = TRUE;
-
- return S_OK;
-}
-
-HRESULT WINAPI CShellLink::SetRelativePath(LPCSTR pszPathRel, DWORD dwReserved)
-{
- TRACE("(%p)->(path=%s %x)\n", this, pszPathRel, dwReserved);
-
- HeapFree(GetProcessHeap(), 0, sPathRel);
- sPathRel = NULL;
-
- if (pszPathRel)
- {
- sPathRel = HEAP_strdupAtoW(GetProcessHeap(), 0, pszPathRel);
- bDirty = TRUE;
- }
-
- return ShellLink_UpdatePath(sPathRel, sPath, sWorkDir, &sPath);
-}
-
-HRESULT WINAPI CShellLink::Resolve(HWND hwnd, DWORD fFlags)
-{
- HRESULT hr = S_OK;
- BOOL bSuccess;
-
- TRACE("(%p)->(hwnd=%p flags=%x)\n", this, hwnd, fFlags);
-
- /*FIXME: use IResolveShellLink interface */
-
- if (!sPath && pPidl)
- {
- WCHAR buffer[MAX_PATH];
-
- bSuccess = SHGetPathFromIDListW(pPidl, buffer);
-
- if (bSuccess && *buffer)
- {
- sPath = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, (wcslen(buffer) + 1) *
sizeof(WCHAR));
-
- if (!sPath)
- return E_OUTOFMEMORY;
-
- wcscpy(sPath, buffer);
-
- bDirty = TRUE;
- }
- else
- hr = S_OK; /* don't report an error occurred while just caching
information */
- }
-
- if (!sIcoPath && sPath)
- {
- sIcoPath = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, (wcslen(sPath) + 1) *
sizeof(WCHAR));
-
- if (!sIcoPath)
- return E_OUTOFMEMORY;
-
- wcscpy(sIcoPath, sPath);
- iIcoNdx = 0;
-
- bDirty = TRUE;
- }
-
- return hr;
-}
-
-HRESULT WINAPI CShellLink::SetPath(LPCSTR pszFile)
-{
- TRACE("(%p)->(path=%s)\n", this, pszFile);
- if (pszFile == NULL)
- return E_INVALIDARG;
-
- LPWSTR str = HEAP_strdupAtoW(GetProcessHeap(), 0, pszFile);
- if (!str)
- return E_OUTOFMEMORY;
-
- HRESULT hr = SetPath(str);
- HeapFree(GetProcessHeap(), 0, str);
-
- return hr;
-}
-
-HRESULT WINAPI CShellLink::GetPath(LPWSTR pszFile, INT cchMaxPath, WIN32_FIND_DATAW *pfd,
DWORD fFlags)
-{
- TRACE("(%p)->(pfile=%p len=%u find_data=%p flags=%u)(%s)\n",
- this, pszFile, cchMaxPath, pfd, fFlags, debugstr_w(sPath));
-
- if (sComponent || sProduct)
- return S_FALSE;
-
- if (cchMaxPath)
- pszFile[0] = 0;
-
- if (sPath)
- lstrcpynW(pszFile, sPath, cchMaxPath);
-
- if (pfd) FIXME("(%p): WIN32_FIND_DATA is not yet filled.\n", this);
-
- return S_OK;
-}
-
-HRESULT WINAPI CShellLink::GetDescription(LPWSTR pszName, INT cchMaxName)
-{
- TRACE("(%p)->(%p len=%u)\n", this, pszName, cchMaxName);
-
- pszName[0] = 0;
- if (sDescription)
- lstrcpynW(pszName, sDescription, cchMaxName);
-
- return S_OK;
-}
-
-HRESULT WINAPI CShellLink::SetDescription(LPCWSTR pszName)
-{
- TRACE("(%p)->(desc=%s)\n", this, debugstr_w(pszName));
-
- HeapFree(GetProcessHeap(), 0, sDescription);
- if (pszName)
- {
- sDescription = (LPWSTR)HeapAlloc(GetProcessHeap(), 0,
- (wcslen(pszName) + 1) * sizeof(WCHAR));
- if (!sDescription)
- return E_OUTOFMEMORY;
-
- wcscpy(sDescription, pszName);
- }
- else
- sDescription = NULL;
-
- bDirty = TRUE;
-
- return S_OK;
-}
-
-HRESULT WINAPI CShellLink::GetWorkingDirectory(LPWSTR pszDir, INT cchMaxPath)
-{
- TRACE("(%p)->(%p len %u)\n", this, pszDir, cchMaxPath);
-
- if (cchMaxPath)
- pszDir[0] = 0;
- if (sWorkDir)
- lstrcpynW(pszDir, sWorkDir, cchMaxPath);
-
- return S_OK;
-}
-
-HRESULT WINAPI CShellLink::SetWorkingDirectory(LPCWSTR pszDir)
-{
- TRACE("(%p)->(dir=%s)\n", this, debugstr_w(pszDir));
-
- HeapFree(GetProcessHeap(), 0, sWorkDir);
- if (pszDir)
- {
- sWorkDir = (LPWSTR)HeapAlloc(GetProcessHeap(), 0,
- (wcslen(pszDir) + 1) * sizeof (WCHAR));
- if (!sWorkDir)
- return E_OUTOFMEMORY;
- wcscpy(sWorkDir, pszDir);
- }
- else
- sWorkDir = NULL;
-
- bDirty = TRUE;
-
- return S_OK;
-}
-
-HRESULT WINAPI CShellLink::GetArguments(LPWSTR pszArgs, INT cchMaxPath)
-{
- TRACE("(%p)->(%p len=%u)\n", this, pszArgs, cchMaxPath);
-
- if (cchMaxPath)
- pszArgs[0] = 0;
- if (sArgs)
- lstrcpynW(pszArgs, sArgs, cchMaxPath);
-
- return S_OK;
-}
-
-HRESULT WINAPI CShellLink::SetArguments(LPCWSTR pszArgs)
-{
- TRACE("(%p)->(args=%s)\n", this, debugstr_w(pszArgs));
-
- HeapFree(GetProcessHeap(), 0, sArgs);
- if (pszArgs)
- {
- sArgs = (LPWSTR)HeapAlloc(GetProcessHeap(), 0,
- (wcslen(pszArgs) + 1) * sizeof (WCHAR));
- if (!sArgs)
- return E_OUTOFMEMORY;
-
- wcscpy(sArgs, pszArgs);
- }
- else
- sArgs = NULL;
-
- bDirty = TRUE;
-
- return S_OK;
-}
-
-static HRESULT SHELL_PidlGeticonLocationW(IShellFolder* psf, LPCITEMIDLIST pidl,
- LPWSTR pszIconPath, int cchIconPath, int* piIcon)
-{
- LPCITEMIDLIST pidlLast;
- UINT wFlags;
-
- HRESULT hr = SHBindToParent(pidl, IID_PPV_ARG(IShellFolder, &psf),
&pidlLast);
-
- if (SUCCEEDED(hr))
- {
- CComPtr<IExtractIconW> pei;
-
- hr = psf->GetUIObjectOf(0, 1, &pidlLast, IID_NULL_PPV_ARG(IExtractIconW,
&pei));
-
- if (SUCCEEDED(hr))
- hr = pei->GetIconLocation(0, pszIconPath, MAX_PATH, piIcon, &wFlags);
-
- psf->Release();
- }
-
- return hr;
-}
-
-HRESULT WINAPI CShellLink::GetIconLocation(LPWSTR pszIconPath, INT cchIconPath, INT
*piIcon)
-{
- TRACE("(%p)->(%p len=%u iicon=%p)\n", this, pszIconPath, cchIconPath,
piIcon);
-
- pszIconPath[0] = 0;
- *piIcon = iIcoNdx;
-
- if (sIcoPath)
- {
- lstrcpynW(pszIconPath, sIcoPath, cchIconPath);
- return S_OK;
- }
-
- if (pPidl || sPath)
- {
- CComPtr<IShellFolder> pdsk;
-
- HRESULT hr = SHGetDesktopFolder(&pdsk);
-
- if (SUCCEEDED(hr))
- {
- /* first look for an icon using the PIDL (if present) */
- if (pPidl)
- hr = SHELL_PidlGeticonLocationW(pdsk, pPidl, pszIconPath, cchIconPath,
piIcon);
- else
- hr = E_FAIL;
-
- /* if we couldn't find an icon yet, look for it using the file system
path */
- if (FAILED(hr) && sPath)
- {
- LPITEMIDLIST pidl;
-
- hr = pdsk->ParseDisplayName(0, NULL, sPath, NULL, &pidl, NULL);
-
- if (SUCCEEDED(hr))
- {
- hr = SHELL_PidlGeticonLocationW(pdsk, pidl, pszIconPath, cchIconPath,
piIcon);
+ hr = SHELL_PidlGetIconLocationW(pdsk, pidl, pszIconPath, cchIconPath,
piIcon);
SHFree(pidl);
}
@@ -1486,50 +1420,50 @@
return S_OK;
}
-HRESULT WINAPI CShellLink::SetIconLocation(LPCWSTR pszIconPath, INT iIcon)
+HRESULT STDMETHODCALLTYPE CShellLink::SetIconLocation(LPCWSTR pszIconPath, INT iIcon)
{
TRACE("(%p)->(path=%s iicon=%u)\n", this, debugstr_w(pszIconPath),
iIcon);
- HeapFree(GetProcessHeap(), 0, sIcoPath);
+ HeapFree(GetProcessHeap(), 0, m_sIcoPath);
if (pszIconPath)
{
- sIcoPath = (LPWSTR)HeapAlloc(GetProcessHeap(), 0,
+ m_sIcoPath = (LPWSTR)HeapAlloc(GetProcessHeap(), 0,
(wcslen(pszIconPath) + 1) * sizeof (WCHAR));
- if (!sIcoPath)
+ if (!m_sIcoPath)
return E_OUTOFMEMORY;
- wcscpy(sIcoPath, pszIconPath);
+ wcscpy(m_sIcoPath, pszIconPath);
}
else
- sIcoPath = NULL;
+ m_sIcoPath = NULL;
iIcoNdx = iIcon;
- bDirty = TRUE;
-
- return S_OK;
-}
-
-HRESULT WINAPI CShellLink::SetRelativePath(LPCWSTR pszPathRel, DWORD dwReserved)
+ m_bDirty = TRUE;
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CShellLink::SetRelativePath(LPCWSTR pszPathRel, DWORD
dwReserved)
{
TRACE("(%p)->(path=%s %x)\n", this, debugstr_w(pszPathRel),
dwReserved);
- HeapFree(GetProcessHeap(), 0, sPathRel);
+ HeapFree(GetProcessHeap(), 0, m_sPathRel);
if (pszPathRel)
{
- sPathRel = (LPWSTR)HeapAlloc(GetProcessHeap(), 0,
- (wcslen(pszPathRel) + 1) * sizeof (WCHAR));
- if (!sPathRel)
+ m_sPathRel = (LPWSTR)HeapAlloc(GetProcessHeap(), 0,
+ (wcslen(pszPathRel) + 1) * sizeof(WCHAR));
+ if (!m_sPathRel)
return E_OUTOFMEMORY;
- wcscpy(sPathRel, pszPathRel);
+ wcscpy(m_sPathRel, pszPathRel);
}
else
- sPathRel = NULL;
-
- bDirty = TRUE;
-
- return ShellLink_UpdatePath(sPathRel, sPath, sWorkDir, &sPath);
-}
-
-LPWSTR CShellLink::ShellLink_GetAdvertisedArg(LPCWSTR str)
+ m_sPathRel = NULL;
+
+ m_bDirty = TRUE;
+
+ return ShellLink_UpdatePath(m_sPathRel, m_sPath, m_sWorkDir, &m_sPath);
+}
+
+static LPWSTR GetAdvertisedArg(LPCWSTR str)
{
if (!str)
return NULL;
@@ -1537,16 +1471,18 @@
LPCWSTR p = wcschr(str, L':');
if (!p)
return NULL;
+
DWORD len = p - str;
LPWSTR ret = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR) * (len + 1));
if (!ret)
return ret;
+
memcpy(ret, str, sizeof(WCHAR)*len);
ret[len] = 0;
return ret;
}
-HRESULT CShellLink::ShellLink_SetAdvertiseInfo(LPCWSTR str)
+HRESULT CShellLink::SetAdvertiseInfo(LPCWSTR str)
{
LPCWSTR szComponent = NULL, szProduct = NULL;
@@ -1569,7 +1505,7 @@
if (len != 38)
return E_FAIL;
- /* get the guid, and check it's validly formatted */
+ /* get the guid, and check if it's validly formatted */
WCHAR szGuid[39];
memcpy(szGuid, str, sizeof(WCHAR)*len);
szGuid[len] = 0;
@@ -1598,8 +1534,8 @@
if (!szComponent)
return E_FAIL;
- sComponent = ShellLink_GetAdvertisedArg(szComponent);
- sProduct = ShellLink_GetAdvertisedArg(szProduct);
+ sComponent = GetAdvertisedArg(szComponent);
+ sProduct = GetAdvertisedArg(szProduct);
TRACE("Component = %s\n", debugstr_w(sComponent));
TRACE("Product = %s\n", debugstr_w(sProduct));
@@ -1607,18 +1543,7 @@
return S_OK;
}
-static BOOL ShellLink_GetVolumeInfo(LPCWSTR path, CShellLink::volume_info *volume)
-{
- WCHAR drive[4] = { path[0], ':', '\\', 0 };
-
- volume->type = GetDriveTypeW(drive);
- BOOL bRet = GetVolumeInformationW(drive, volume->label,
_countof(volume->label), &volume->serial, NULL, NULL, NULL, 0);
- TRACE("ret = %d type %d serial %08x name %s\n", bRet,
- volume->type, volume->serial, debugstr_w(volume->label));
- return bRet;
-}
-
-HRESULT WINAPI CShellLink::SetPath(LPCWSTR pszFile)
+HRESULT STDMETHODCALLTYPE CShellLink::SetPath(LPCWSTR pszFile)
{
LPWSTR unquoted = NULL;
HRESULT hr = S_OK;
@@ -1629,8 +1554,8 @@
return E_INVALIDARG;
/* quotes at the ends of the string are stripped */
- UINT len = wcslen(pszFile);
- if (pszFile[0] == '"' && pszFile[len-1] == '"')
+ SIZE_T len = wcslen(pszFile);
+ if (pszFile[0] == L'"' && pszFile[len-1] == L'"')
{
unquoted = strdupW(pszFile);
PathUnquoteSpacesW(unquoted);
@@ -1638,23 +1563,23 @@
}
/* any other quote marks are invalid */
- if (wcschr(pszFile, '"'))
+ if (wcschr(pszFile, L'"'))
{
HeapFree(GetProcessHeap(), 0, unquoted);
return S_FALSE;
}
- HeapFree(GetProcessHeap(), 0, sPath);
- sPath = NULL;
+ HeapFree(GetProcessHeap(), 0, m_sPath);
+ m_sPath = NULL;
HeapFree(GetProcessHeap(), 0, sComponent);
sComponent = NULL;
- if (pPidl)
- ILFree(pPidl);
- pPidl = NULL;
-
- if (S_OK != ShellLink_SetAdvertiseInfo(pszFile))
+ if (m_pPidl)
+ ILFree(m_pPidl);
+ m_pPidl = NULL;
+
+ if (S_OK != SetAdvertiseInfo(pszFile))
{
WCHAR buffer[MAX_PATH];
LPWSTR fname;
@@ -1667,30 +1592,30 @@
!SearchPathW(NULL, pszFile, NULL, MAX_PATH, buffer, NULL))
hr = S_FALSE;
- pPidl = SHSimpleIDListFromPathW(pszFile);
+ m_pPidl = SHSimpleIDListFromPathW(pszFile);
ShellLink_GetVolumeInfo(buffer, &volume);
- sPath = (LPWSTR)HeapAlloc(GetProcessHeap(), 0,
+ m_sPath = (LPWSTR)HeapAlloc(GetProcessHeap(), 0,
(wcslen(buffer) + 1) * sizeof (WCHAR));
- if (!sPath)
+ if (!m_sPath)
return E_OUTOFMEMORY;
- wcscpy(sPath, buffer);
- }
-
- bDirty = TRUE;
+ wcscpy(m_sPath, buffer);
+ }
+
+ m_bDirty = TRUE;
HeapFree(GetProcessHeap(), 0, unquoted);
return hr;
}
-HRESULT WINAPI CShellLink::AddDataBlock(void* pDataBlock)
+HRESULT STDMETHODCALLTYPE CShellLink::AddDataBlock(void* pDataBlock)
{
FIXME("\n");
return E_NOTIMPL;
}
-HRESULT WINAPI CShellLink::CopyDataBlock(DWORD dwSig, void** ppDataBlock)
+HRESULT STDMETHODCALLTYPE CShellLink::CopyDataBlock(DWORD dwSig, void** ppDataBlock)
{
LPVOID block = NULL;
HRESULT hr = E_FAIL;
@@ -1719,30 +1644,30 @@
return hr;
}
-HRESULT WINAPI CShellLink::RemoveDataBlock(DWORD dwSig)
+HRESULT STDMETHODCALLTYPE CShellLink::RemoveDataBlock(DWORD dwSig)
{
FIXME("\n");
return E_NOTIMPL;
}
-HRESULT WINAPI CShellLink::GetFlags(DWORD *pdwFlags)
+HRESULT STDMETHODCALLTYPE CShellLink::GetFlags(DWORD *pdwFlags)
{
DWORD flags = 0;
FIXME("%p %p\n", this, pdwFlags);
/* FIXME: add more */
- if (sArgs)
+ if (m_sArgs)
flags |= SLDF_HAS_ARGS;
if (sComponent)
flags |= SLDF_HAS_DARWINID;
- if (sIcoPath)
+ if (m_sIcoPath)
flags |= SLDF_HAS_ICONLOCATION;
#if (NTDDI_VERSION < NTDDI_LONGHORN)
if (sProduct)
flags |= SLDF_HAS_LOGO3ID;
#endif
- if (pPidl)
+ if (m_pPidl)
flags |= SLDF_HAS_ID_LIST;
*pdwFlags = flags;
@@ -1750,7 +1675,7 @@
return S_OK;
}
-HRESULT WINAPI CShellLink::SetFlags(DWORD dwFlags)
+HRESULT STDMETHODCALLTYPE CShellLink::SetFlags(DWORD dwFlags)
{
FIXME("\n");
return E_NOTIMPL;
@@ -1761,7 +1686,7 @@
*
* Loads the shelllink from the dataobject the shell is pointing to.
*/
-HRESULT WINAPI CShellLink::Initialize(LPCITEMIDLIST pidlFolder, IDataObject *pdtobj, HKEY
hkeyProgID)
+HRESULT STDMETHODCALLTYPE CShellLink::Initialize(LPCITEMIDLIST pidlFolder, IDataObject
*pdtobj, HKEY hkeyProgID)
{
TRACE("%p %p %p %p\n", this, pidlFolder, pdtobj, hkeyProgID);
@@ -1798,7 +1723,7 @@
return S_OK;
}
-HRESULT WINAPI CShellLink::QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst,
UINT idCmdLast, UINT uFlags)
+HRESULT STDMETHODCALLTYPE CShellLink::QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT
idCmdFirst, UINT idCmdLast, UINT uFlags)
{
int id = 1;
@@ -1810,11 +1735,11 @@
WCHAR wszOpen[20];
if (!LoadStringW(shell32_hInstance, IDS_OPEN_VERB, wszOpen, _countof(wszOpen)))
- wszOpen[0] = L'\0';
+ *wszOpen = L'\0';
MENUITEMINFOW mii;
- memset(&mii, 0, sizeof(mii));
- mii.cbSize = sizeof (mii);
+ ZeroMemory(&mii, sizeof(mii));
+ mii.cbSize = sizeof(mii);
mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE;
mii.dwTypeData = wszOpen;
mii.cch = wcslen(mii.dwTypeData);
@@ -1823,7 +1748,7 @@
mii.fType = MFT_STRING;
if (!InsertMenuItemW(hMenu, indexMenu, TRUE, &mii))
return E_FAIL;
- iIdOpen = 1;
+ m_iIdOpen = 1;
return MAKE_HRESULT(SEVERITY_SUCCESS, 0, id);
}
@@ -1851,7 +1776,7 @@
return path;
}
-HRESULT WINAPI CShellLink::InvokeCommand(LPCMINVOKECOMMANDINFO lpici)
+HRESULT STDMETHODCALLTYPE CShellLink::InvokeCommand(LPCMINVOKECOMMANDINFO lpici)
{
HWND hwnd = NULL; /* FIXME: get using interface set from IObjectWithSite */
LPWSTR args = NULL;
@@ -1859,7 +1784,7 @@
TRACE("%p %p\n", this, lpici);
- if (lpici->cbSize < sizeof (CMINVOKECOMMANDINFO))
+ if (lpici->cbSize < sizeof(CMINVOKECOMMANDINFO))
return E_INVALIDARG;
HRESULT hr = Resolve(hwnd, 0);
@@ -1875,48 +1800,48 @@
return E_FAIL;
}
else
- path = strdupW(sPath);
+ path = strdupW(m_sPath);
if ( lpici->cbSize == sizeof(CMINVOKECOMMANDINFOEX) &&
(lpici->fMask & CMIC_MASK_UNICODE) )
{
LPCMINVOKECOMMANDINFOEX iciex = (LPCMINVOKECOMMANDINFOEX)lpici;
- DWORD len = 2;
-
- if (sArgs)
- len += wcslen(sArgs);
+ SIZE_T len = 2;
+
+ if (m_sArgs)
+ len += wcslen(m_sArgs);
if (iciex->lpParametersW)
len += wcslen(iciex->lpParametersW);
args = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
- args[0] = 0;
- if (sArgs)
- wcscat(args, sArgs);
+ *args = 0;
+ if (m_sArgs)
+ wcscat(args, m_sArgs);
if (iciex->lpParametersW)
{
wcscat(args, L" ");
wcscat(args, iciex->lpParametersW);
}
}
- else if (sArgs != NULL)
- {
- args = strdupW(sArgs);
+ else if (m_sArgs != NULL)
+ {
+ args = strdupW(m_sArgs);
}
SHELLEXECUTEINFOW sei;
- memset(&sei, 0, sizeof sei);
- sei.cbSize = sizeof sei;
+ ZeroMemory(&sei, sizeof(sei));
+ sei.cbSize = sizeof(sei);
sei.fMask = SEE_MASK_HASLINKNAME | SEE_MASK_UNICODE |
(lpici->fMask & (SEE_MASK_NOASYNC | SEE_MASK_ASYNCOK |
SEE_MASK_FLAG_NO_UI));
sei.lpFile = path;
- sei.lpClass = sLinkPath;
+ sei.lpClass = m_sLinkPath;
sei.nShow = iShowCmd;
- sei.lpDirectory = sWorkDir;
+ sei.lpDirectory = m_sWorkDir;
sei.lpParameters = args;
sei.lpVerb = L"open";
// HACK for ShellExecuteExW
- if (sPath && wcsstr(sPath, L".cpl"))
+ if (m_sPath && wcsstr(m_sPath, L".cpl"))
sei.lpVerb = L"cplopen";
if (ShellExecuteExW(&sei))
@@ -1930,10 +1855,9 @@
return hr;
}
-HRESULT WINAPI CShellLink::GetCommandString(UINT_PTR idCmd, UINT uType, UINT* pwReserved,
LPSTR pszName, UINT cchMax)
+HRESULT STDMETHODCALLTYPE CShellLink::GetCommandString(UINT_PTR idCmd, UINT uType, UINT*
pwReserved, LPSTR pszName, UINT cchMax)
{
FIXME("%p %lu %u %p %p %u\n", this, idCmd, uType, pwReserved, pszName,
cchMax);
-
return E_NOTIMPL;
}
@@ -1983,6 +1907,43 @@
DWORD dwFlags);
/**************************************************************************
+* SH_GetTargetTypeByPath
+*
+* Function to get target type by passing full path to it
+*/
+LPWSTR SH_GetTargetTypeByPath(LPCWSTR lpcwFullPath)
+{
+ LPCWSTR pwszExt;
+ static WCHAR wszBuf[MAX_PATH];
+
+ /* Get file information */
+ SHFILEINFOW fi;
+ if (!SHGetFileInfoW(lpcwFullPath, 0, &fi, sizeof(fi), SHGFI_TYPENAME |
SHGFI_USEFILEATTRIBUTES))
+ {
+ ERR("SHGetFileInfoW failed for %ls (%lu)\n", lpcwFullPath,
GetLastError());
+ fi.szTypeName[0] = L'\0';
+ fi.hIcon = NULL;
+ }
+
+ pwszExt = PathFindExtensionW(lpcwFullPath);
+ if (pwszExt[0])
+ {
+ if (!fi.szTypeName[0])
+ {
+ /* The file type is unknown, so default to string "FileExtension
File" */
+ size_t cchRemaining = 0;
+ LPWSTR pwszEnd = NULL;
+
+ StringCchPrintfExW(wszBuf, _countof(wszBuf), &pwszEnd, &cchRemaining,
0, L"%s ", pwszExt + 1);
+ }
+ else
+ StringCbPrintfW(wszBuf, sizeof(wszBuf), L"%s (%s)", fi.szTypeName,
pwszExt); /* Update file type */
+ }
+
+ return wszBuf;
+}
+
+/**************************************************************************
* SH_ShellLinkDlgProc
*
* dialog proc of the shortcut property dialog
@@ -2005,14 +1966,14 @@
pThis = reinterpret_cast<CShellLink *>(ppsp->lParam);
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pThis);
- TRACE("sArgs: %S sComponent: %S sDescription: %S sIcoPath: %S sPath: %S
sPathRel: %S sProduct: %S sWorkDir: %S\n", pThis->sArgs, pThis->sComponent,
pThis->sDescription,
- pThis->sIcoPath, pThis->sPath, pThis->sPathRel,
pThis->sProduct, pThis->sWorkDir);
+ TRACE("m_sArgs: %S sComponent: %S m_sDescription: %S m_sIcoPath: %S
m_sPath: %S m_sPathRel: %S sProduct: %S m_sWorkDir: %S\n", pThis->m_sArgs,
pThis->sComponent, pThis->m_sDescription,
+ pThis->m_sIcoPath, pThis->m_sPath, pThis->m_sPathRel,
pThis->sProduct, pThis->m_sWorkDir);
/* Get file information */
- SHFILEINFO fi;
- if (!SHGetFileInfoW(pThis->sLinkPath, 0, &fi, sizeof(fi),
SHGFI_TYPENAME|SHGFI_ICON))
+ SHFILEINFOW fi;
+ if (!SHGetFileInfoW(pThis->m_sLinkPath, 0, &fi, sizeof(fi),
SHGFI_TYPENAME|SHGFI_ICON))
{
- ERR("SHGetFileInfoW failed for %ls (%lu)\n",
pThis->sLinkPath, GetLastError());
+ ERR("SHGetFileInfoW failed for %ls (%lu)\n",
pThis->m_sLinkPath, GetLastError());
fi.szTypeName[0] = L'\0';
fi.hIcon = NULL;
}
@@ -2020,39 +1981,39 @@
if (fi.hIcon) // TODO: destroy icon
SendDlgItemMessageW(hwndDlg, 14000, STM_SETICON, (WPARAM)fi.hIcon, 0);
else
- ERR("ExtractIconW failed %ls %u\n", pThis->sIcoPath,
pThis->iIcoNdx);
+ ERR("ExtractIconW failed %ls %u\n", pThis->m_sIcoPath,
pThis->iIcoNdx);
/* target type */
- if (pThis->sPath)
- SetDlgItemTextW(hwndDlg, 14005,
SH_GetTargetTypeByPath(pThis->sPath));
+ if (pThis->m_sPath)
+ SetDlgItemTextW(hwndDlg, 14005,
SH_GetTargetTypeByPath(pThis->m_sPath));
/* target location */
- if (pThis->sWorkDir)
- SetDlgItemTextW(hwndDlg, 14007, PathFindFileName(pThis->sWorkDir));
+ if (pThis->m_sWorkDir)
+ SetDlgItemTextW(hwndDlg, 14007, PathFindFileName(pThis->m_sWorkDir));
/* target path */
- if (pThis->sPath)
+ if (pThis->m_sPath)
{
WCHAR newpath[2*MAX_PATH] = L"\0";
- if (wcschr(pThis->sPath, ' '))
- StringCchPrintfExW(newpath, 2*MAX_PATH, NULL, NULL, 0,
L"\"%ls\"", pThis->sPath);
+ if (wcschr(pThis->m_sPath, ' '))
+ StringCchPrintfExW(newpath, _countof(newpath), NULL, NULL, 0,
L"\"%ls\"", pThis->m_sPath);
else
- StringCchCopyExW(newpath, 2*MAX_PATH, pThis->sPath, NULL, NULL,
0);
+ StringCchCopyExW(newpath, _countof(newpath), pThis->m_sPath, NULL,
NULL, 0);
- if (pThis->sArgs && pThis->sArgs[0])
+ if (pThis->m_sArgs && pThis->m_sArgs[0])
{
- StringCchCatW(newpath, 2*MAX_PATH, L" ");
- StringCchCatW(newpath, 2*MAX_PATH, pThis->sArgs);
+ StringCchCatW(newpath, _countof(newpath), L" ");
+ StringCchCatW(newpath, _countof(newpath), pThis->m_sArgs);
}
SetDlgItemTextW(hwndDlg, 14009, newpath);
}
/* working dir */
- if (pThis->sWorkDir)
- SetDlgItemTextW(hwndDlg, 14011, pThis->sWorkDir);
+ if (pThis->m_sWorkDir)
+ SetDlgItemTextW(hwndDlg, 14011, pThis->m_sWorkDir);
/* description */
- if (pThis->sDescription)
- SetDlgItemTextW(hwndDlg, 14019, pThis->sDescription);
+ if (pThis->m_sDescription)
+ SetDlgItemTextW(hwndDlg, 14019, pThis->m_sDescription);
return TRUE;
}
@@ -2063,10 +2024,10 @@
{
WCHAR wszBuf[MAX_PATH];
/* set working directory */
- GetDlgItemTextW(hwndDlg, 14011, wszBuf, MAX_PATH);
+ GetDlgItemTextW(hwndDlg, 14011, wszBuf, _countof(wszBuf));
pThis->SetWorkingDirectory(wszBuf);
/* set link destination */
- GetDlgItemTextW(hwndDlg, 14009, wszBuf, MAX_PATH);
+ GetDlgItemTextW(hwndDlg, 14009, wszBuf, _countof(wszBuf));
LPWSTR lpszArgs = NULL;
LPWSTR unquoted = strdupW(wszBuf);
StrTrimW(unquoted, L" ");
@@ -2105,9 +2066,10 @@
HeapFree(GetProcessHeap(), 0, unquoted);
- TRACE("This %p sLinkPath %S\n", pThis, pThis->sLinkPath);
- pThis->Save(pThis->sLinkPath, TRUE);
- SetWindowLongPtr(hwndDlg, DWL_MSGRESULT, PSNRET_NOERROR);
return TRUE;
+ TRACE("This %p m_sLinkPath %S\n", pThis,
pThis->m_sLinkPath);
+ pThis->Save(pThis->m_sLinkPath, TRUE);
+ SetWindowLongPtr(hwndDlg, DWL_MSGRESULT, PSNRET_NOERROR);
+ return TRUE;
}
break;
}
@@ -2115,7 +2077,7 @@
switch(LOWORD(wParam))
{
case 14020:
- SHOpenFolderAndSelectItems(pThis->pPidl, 0, NULL, 0);
+ SHOpenFolderAndSelectItems(pThis->m_pPidl, 0, NULL, 0);
///
/// FIXME
/// open target directory
@@ -2125,10 +2087,10 @@
{
WCHAR wszPath[MAX_PATH] = L"";
- if (pThis->sIcoPath)
- wcscpy(wszPath, pThis->sIcoPath);
+ if (pThis->m_sIcoPath)
+ wcscpy(wszPath, pThis->m_sIcoPath);
INT IconIndex = pThis->iIcoNdx;
- if (PickIconDlg(hwndDlg, wszPath, MAX_PATH, &IconIndex))
+ if (PickIconDlg(hwndDlg, wszPath, _countof(wszPath),
&IconIndex))
{
pThis->SetIconLocation(wszPath, IconIndex);
///
@@ -2139,20 +2101,20 @@
case 14022:
{
- INT_PTR result = DialogBoxParamW(shell32_hInstance,
MAKEINTRESOURCEW(IDD_SHORTCUT_EXTENDED_PROPERTIES), hwndDlg, ExtendedShortcutProc,
(LPARAM)pThis->bRunAs);
+ INT_PTR result = DialogBoxParamW(shell32_hInstance,
MAKEINTRESOURCEW(IDD_SHORTCUT_EXTENDED_PROPERTIES), hwndDlg, ExtendedShortcutProc,
(LPARAM)pThis->m_bRunAs);
if (result == 1 || result == 0)
{
- if (pThis->bRunAs != result)
+ if (pThis->m_bRunAs != result)
{
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
}
- pThis->bRunAs = result;
+ pThis->m_bRunAs = result;
}
return TRUE;
}
}
- if(HIWORD(wParam) == EN_CHANGE)
+ if (HIWORD(wParam) == EN_CHANGE)
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
break;
default:
@@ -2165,7 +2127,7 @@
* ShellLink_IShellPropSheetExt interface
*/
-HRESULT WINAPI CShellLink::AddPages(LPFNADDPROPSHEETPAGE pfnAddPage, LPARAM lParam)
+HRESULT STDMETHODCALLTYPE CShellLink::AddPages(LPFNADDPROPSHEETPAGE pfnAddPage, LPARAM
lParam)
{
HPROPSHEETPAGE hPage = SH_CreatePropertySheetPage(IDD_SHORTCUT_PROPERTIES,
SH_ShellLinkDlgProc, (LPARAM)this, NULL);
if (hPage == NULL)
@@ -2180,46 +2142,46 @@
return S_OK;
}
-HRESULT WINAPI CShellLink::ReplacePage(UINT uPageID, LPFNADDPROPSHEETPAGE pfnReplacePage,
LPARAM lParam)
+HRESULT STDMETHODCALLTYPE CShellLink::ReplacePage(UINT uPageID, LPFNADDPROPSHEETPAGE
pfnReplacePage, LPARAM lParam)
{
TRACE("(%p) (uPageID %u, pfnReplacePage %p lParam %p\n", this, uPageID,
pfnReplacePage, lParam);
return E_NOTIMPL;
}
-HRESULT WINAPI CShellLink::SetSite(IUnknown *punk)
+HRESULT STDMETHODCALLTYPE CShellLink::SetSite(IUnknown *punk)
{
TRACE("%p %p\n", this, punk);
- site = punk;
-
- return S_OK;
-}
-
-HRESULT WINAPI CShellLink::GetSite(REFIID iid, void ** ppvSite)
+ m_site = punk;
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CShellLink::GetSite(REFIID iid, void ** ppvSite)
{
TRACE("%p %s %p\n", this, debugstr_guid(&iid), ppvSite);
- if (site == NULL)
+ if (m_site == NULL)
return E_FAIL;
- return site->QueryInterface(iid, ppvSite);
-}
-
-HRESULT WINAPI CShellLink::DragEnter(IDataObject *pDataObject,
+ return m_site->QueryInterface(iid, ppvSite);
+}
+
+HRESULT STDMETHODCALLTYPE CShellLink::DragEnter(IDataObject *pDataObject,
DWORD dwKeyState, POINTL pt, DWORD *pdwEffect)
{
TRACE("(%p)->(DataObject=%p)\n", this, pDataObject);
LPCITEMIDLIST pidlLast;
CComPtr<IShellFolder> psf;
- HRESULT hr = SHBindToParent(pPidl, IID_PPV_ARG(IShellFolder, &psf),
&pidlLast);
+ HRESULT hr = SHBindToParent(m_pPidl, IID_PPV_ARG(IShellFolder, &psf),
&pidlLast);
if (SUCCEEDED(hr))
{
- hr = psf->GetUIObjectOf(0, 1, &pidlLast, IID_NULL_PPV_ARG(IDropTarget,
&mDropTarget));
+ hr = psf->GetUIObjectOf(0, 1, &pidlLast, IID_NULL_PPV_ARG(IDropTarget,
&m_DropTarget));
if (SUCCEEDED(hr))
- hr = mDropTarget->DragEnter(pDataObject, dwKeyState, pt, pdwEffect);
+ hr = m_DropTarget->DragEnter(pDataObject, dwKeyState, pt, pdwEffect);
else
*pdwEffect = DROPEFFECT_NONE;
}
@@ -2229,38 +2191,36 @@
return S_OK;
}
-
-
-HRESULT WINAPI CShellLink::DragOver(DWORD dwKeyState, POINTL pt,
+HRESULT STDMETHODCALLTYPE CShellLink::DragOver(DWORD dwKeyState, POINTL pt,
DWORD *pdwEffect)
{
TRACE("(%p)\n", this);
HRESULT hr = S_OK;
- if (mDropTarget)
- hr = mDropTarget->DragOver(dwKeyState, pt, pdwEffect);
+ if (m_DropTarget)
+ hr = m_DropTarget->DragOver(dwKeyState, pt, pdwEffect);
return hr;
}
-HRESULT WINAPI CShellLink::DragLeave()
+HRESULT STDMETHODCALLTYPE CShellLink::DragLeave()
{
TRACE("(%p)\n", this);
HRESULT hr = S_OK;
- if (mDropTarget)
- {
- hr = mDropTarget->DragLeave();
- mDropTarget.Release();
+ if (m_DropTarget)
+ {
+ hr = m_DropTarget->DragLeave();
+ m_DropTarget.Release();
}
return hr;
}
-HRESULT WINAPI CShellLink::Drop(IDataObject *pDataObject,
+HRESULT STDMETHODCALLTYPE CShellLink::Drop(IDataObject *pDataObject,
DWORD dwKeyState, POINTL pt, DWORD *pdwEffect)
{
TRACE("(%p)\n", this);
HRESULT hr = S_OK;
- if (mDropTarget)
- hr = mDropTarget->Drop(pDataObject, dwKeyState, pt, pdwEffect);
+ if (m_DropTarget)
+ hr = m_DropTarget->Drop(pDataObject, dwKeyState, pt, pdwEffect);
return hr;
}
Modified: trunk/reactos/dll/win32/shell32/CShellLink.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/CShellLi…
==============================================================================
--- trunk/reactos/dll/win32/shell32/CShellLink.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/CShellLink.h [iso-8859-1] Tue Jan 17 21:32:18 2017
@@ -39,134 +39,143 @@
public IShellPropSheetExt
{
public:
- /* link file formats */
+ /* Link file formats */
#include "pshpack1.h"
struct volume_info
{
- DWORD type;
- DWORD serial;
- WCHAR label[12]; /* assume 8.3 */
+ DWORD type;
+ DWORD serial;
+ WCHAR label[12]; /* assume 8.3 */
};
#include "poppack.h"
private:
/* data structures according to the information in the link */
- LPITEMIDLIST pPidl;
WORD wHotKey;
SYSTEMTIME time1;
SYSTEMTIME time2;
SYSTEMTIME time3;
DWORD iShowCmd;
- LPWSTR sIcoPath;
INT iIcoNdx;
- LPWSTR sPath;
- LPWSTR sArgs;
- LPWSTR sWorkDir;
- LPWSTR sDescription;
- LPWSTR sPathRel;
- LPWSTR sProduct;
- LPWSTR sComponent;
+
+ /* Cached data set according to m_Header.dwFlags (SHELL_LINK_DATA_FLAGS) */
+
+ LPITEMIDLIST m_pPidl;
+
+ /* Link tracker information */
+ LPWSTR m_sPath;
volume_info volume;
- LPWSTR sLinkPath;
- BOOL bRunAs;
- BOOL bDirty;
- INT iIdOpen; /* id of the "Open" entry in the context menu */
- CComPtr<IUnknown> site;
- CComPtr<IDropTarget> mDropTarget;
+
+ LPWSTR m_sDescription;
+ LPWSTR m_sPathRel;
+ LPWSTR m_sWorkDir;
+ LPWSTR m_sArgs;
+ LPWSTR m_sIcoPath;
+ BOOL m_bRunAs;
+ BOOL m_bDirty;
+
+ LPWSTR sProduct;
+ LPWSTR sComponent;
+
+ LPWSTR m_sLinkPath;
+ INT m_iIdOpen; /* ID of the "Open" entry in the context menu
*/
+
+ CComPtr<IUnknown> m_site;
+ CComPtr<IDropTarget> m_DropTarget;
+
public:
CShellLink();
~CShellLink();
- LPWSTR ShellLink_GetAdvertisedArg(LPCWSTR str);
- HRESULT ShellLink_SetAdvertiseInfo(LPCWSTR str);
+ HRESULT SetAdvertiseInfo(LPCWSTR str);
static INT_PTR CALLBACK SH_ShellLinkDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
LPARAM lParam);
// IPersistFile
- virtual HRESULT WINAPI GetClassID(CLSID *pclsid);
- virtual HRESULT WINAPI IsDirty();
- virtual HRESULT WINAPI Load(LPCOLESTR pszFileName, DWORD dwMode);
- virtual HRESULT WINAPI Save(LPCOLESTR pszFileName, BOOL fRemember);
- virtual HRESULT WINAPI SaveCompleted(LPCOLESTR pszFileName);
- virtual HRESULT WINAPI GetCurFile(LPOLESTR *ppszFileName);
+ virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pclsid);
+ virtual HRESULT STDMETHODCALLTYPE IsDirty();
+ virtual HRESULT STDMETHODCALLTYPE Load(LPCOLESTR pszFileName, DWORD dwMode);
+ virtual HRESULT STDMETHODCALLTYPE Save(LPCOLESTR pszFileName, BOOL fRemember);
+ virtual HRESULT STDMETHODCALLTYPE SaveCompleted(LPCOLESTR pszFileName);
+ virtual HRESULT STDMETHODCALLTYPE GetCurFile(LPOLESTR *ppszFileName);
// IPersistStream
- // virtual WINAPI HRESULT GetClassID(CLSID *pclsid);
- // virtual HRESULT WINAPI IsDirty();
- virtual HRESULT WINAPI Load(IStream *stm);
- virtual HRESULT WINAPI Save(IStream *stm, BOOL fClearDirty);
- virtual HRESULT WINAPI GetSizeMax(ULARGE_INTEGER *pcbSize);
+ // virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pclsid);
+ // virtual HRESULT STDMETHODCALLTYPE IsDirty();
+ virtual HRESULT STDMETHODCALLTYPE Load(IStream *stm);
+ virtual HRESULT STDMETHODCALLTYPE Save(IStream *stm, BOOL fClearDirty);
+ virtual HRESULT STDMETHODCALLTYPE GetSizeMax(ULARGE_INTEGER *pcbSize);
// IShellLinkA
- virtual HRESULT WINAPI GetPath(LPSTR pszFile, INT cchMaxPath, WIN32_FIND_DATAA *pfd,
DWORD fFlags);
- virtual HRESULT WINAPI GetIDList(LPITEMIDLIST * ppidl);
- virtual HRESULT WINAPI SetIDList(LPCITEMIDLIST pidl);
- virtual HRESULT WINAPI GetDescription(LPSTR pszName,INT cchMaxName);
- virtual HRESULT WINAPI SetDescription(LPCSTR pszName);
- virtual HRESULT WINAPI GetWorkingDirectory(LPSTR pszDir,INT cchMaxPath);
- virtual HRESULT WINAPI SetWorkingDirectory(LPCSTR pszDir);
- virtual HRESULT WINAPI GetArguments(LPSTR pszArgs,INT cchMaxPath);
- virtual HRESULT WINAPI SetArguments(LPCSTR pszArgs);
- virtual HRESULT WINAPI GetHotkey(WORD *pwHotkey);
- virtual HRESULT WINAPI SetHotkey(WORD wHotkey);
- virtual HRESULT WINAPI GetShowCmd(INT *piShowCmd);
- virtual HRESULT WINAPI SetShowCmd(INT iShowCmd);
- virtual HRESULT WINAPI GetIconLocation(LPSTR pszIconPath,INT cchIconPath,INT
*piIcon);
- virtual HRESULT WINAPI SetIconLocation(LPCSTR pszIconPath,INT iIcon);
- virtual HRESULT WINAPI SetRelativePath(LPCSTR pszPathRel, DWORD dwReserved);
- virtual HRESULT WINAPI Resolve(HWND hwnd, DWORD fFlags);
- virtual HRESULT WINAPI SetPath(LPCSTR pszFile);
+ virtual HRESULT STDMETHODCALLTYPE GetPath(LPSTR pszFile, INT cchMaxPath,
WIN32_FIND_DATAA *pfd, DWORD fFlags);
+ virtual HRESULT STDMETHODCALLTYPE GetIDList(LPITEMIDLIST *ppidl);
+ virtual HRESULT STDMETHODCALLTYPE SetIDList(LPCITEMIDLIST pidl);
+ virtual HRESULT STDMETHODCALLTYPE GetDescription(LPSTR pszName, INT cchMaxName);
+ virtual HRESULT STDMETHODCALLTYPE SetDescription(LPCSTR pszName);
+ virtual HRESULT STDMETHODCALLTYPE GetWorkingDirectory(LPSTR pszDir, INT cchMaxPath);
+ virtual HRESULT STDMETHODCALLTYPE SetWorkingDirectory(LPCSTR pszDir);
+ virtual HRESULT STDMETHODCALLTYPE GetArguments(LPSTR pszArgs, INT cchMaxPath);
+ virtual HRESULT STDMETHODCALLTYPE SetArguments(LPCSTR pszArgs);
+ virtual HRESULT STDMETHODCALLTYPE GetHotkey(WORD *pwHotkey);
+ virtual HRESULT STDMETHODCALLTYPE SetHotkey(WORD wHotkey);
+ virtual HRESULT STDMETHODCALLTYPE GetShowCmd(INT *piShowCmd);
+ virtual HRESULT STDMETHODCALLTYPE SetShowCmd(INT iShowCmd);
+ virtual HRESULT STDMETHODCALLTYPE GetIconLocation(LPSTR pszIconPath, INT cchIconPath,
INT *piIcon);
+ virtual HRESULT STDMETHODCALLTYPE SetIconLocation(LPCSTR pszIconPath, INT iIcon);
+ virtual HRESULT STDMETHODCALLTYPE SetRelativePath(LPCSTR pszPathRel, DWORD
dwReserved);
+ virtual HRESULT STDMETHODCALLTYPE Resolve(HWND hwnd, DWORD fFlags);
+ virtual HRESULT STDMETHODCALLTYPE SetPath(LPCSTR pszFile);
// IShellLinkW
- virtual HRESULT WINAPI GetPath(LPWSTR pszFile, INT cchMaxPath, WIN32_FIND_DATAW *pfd,
DWORD fFlags);
- // virtual HRESULT WINAPI GetIDList(LPITEMIDLIST *ppidl);
- // virtual HRESULT WINAPI SetIDList(LPCITEMIDLIST pidl);
- virtual HRESULT WINAPI GetDescription(LPWSTR pszName, INT cchMaxName);
- virtual HRESULT WINAPI SetDescription(LPCWSTR pszName);
- virtual HRESULT WINAPI GetWorkingDirectory(LPWSTR pszDir, INT cchMaxPath);
- virtual HRESULT WINAPI SetWorkingDirectory(LPCWSTR pszDir);
- virtual HRESULT WINAPI GetArguments(LPWSTR pszArgs,INT cchMaxPath);
- virtual HRESULT WINAPI SetArguments(LPCWSTR pszArgs);
- // virtual HRESULT WINAPI GetHotkey(WORD *pwHotkey);
- // virtual HRESULT WINAPI SetHotkey(WORD wHotkey);
- // virtual HRESULT WINAPI GetShowCmd(INT *piShowCmd);
- // virtual HRESULT WINAPI SetShowCmd(INT iShowCmd);
- virtual HRESULT WINAPI GetIconLocation(LPWSTR pszIconPath,INT cchIconPath,INT
*piIcon);
- virtual HRESULT WINAPI SetIconLocation(LPCWSTR pszIconPath,INT iIcon);
- virtual HRESULT WINAPI SetRelativePath(LPCWSTR pszPathRel, DWORD dwReserved);
- // virtual HRESULT WINAPI Resolve(HWND hwnd, DWORD fFlags);
- virtual HRESULT WINAPI SetPath(LPCWSTR pszFile);
+ virtual HRESULT STDMETHODCALLTYPE GetPath(LPWSTR pszFile, INT cchMaxPath,
WIN32_FIND_DATAW *pfd, DWORD fFlags);
+ // virtual HRESULT STDMETHODCALLTYPE GetIDList(LPITEMIDLIST *ppidl);
+ // virtual HRESULT STDMETHODCALLTYPE SetIDList(LPCITEMIDLIST pidl);
+ virtual HRESULT STDMETHODCALLTYPE GetDescription(LPWSTR pszName, INT cchMaxName);
+ virtual HRESULT STDMETHODCALLTYPE SetDescription(LPCWSTR pszName);
+ virtual HRESULT STDMETHODCALLTYPE GetWorkingDirectory(LPWSTR pszDir, INT
cchMaxPath);
+ virtual HRESULT STDMETHODCALLTYPE SetWorkingDirectory(LPCWSTR pszDir);
+ virtual HRESULT STDMETHODCALLTYPE GetArguments(LPWSTR pszArgs, INT cchMaxPath);
+ virtual HRESULT STDMETHODCALLTYPE SetArguments(LPCWSTR pszArgs);
+ // virtual HRESULT STDMETHODCALLTYPE GetHotkey(WORD *pwHotkey);
+ // virtual HRESULT STDMETHODCALLTYPE SetHotkey(WORD wHotkey);
+ // virtual HRESULT STDMETHODCALLTYPE GetShowCmd(INT *piShowCmd);
+ // virtual HRESULT STDMETHODCALLTYPE SetShowCmd(INT iShowCmd);
+ virtual HRESULT STDMETHODCALLTYPE GetIconLocation(LPWSTR pszIconPath, INT
cchIconPath, INT *piIcon);
+ virtual HRESULT STDMETHODCALLTYPE SetIconLocation(LPCWSTR pszIconPath, INT iIcon);
+ virtual HRESULT STDMETHODCALLTYPE SetRelativePath(LPCWSTR pszPathRel, DWORD
dwReserved);
+ // virtual HRESULT STDMETHODCALLTYPE Resolve(HWND hwnd, DWORD fFlags);
+ virtual HRESULT STDMETHODCALLTYPE SetPath(LPCWSTR pszFile);
// IShellLinkDataList
- virtual HRESULT WINAPI AddDataBlock(void *pDataBlock);
- virtual HRESULT WINAPI CopyDataBlock(DWORD dwSig, void **ppDataBlock);
- virtual HRESULT WINAPI RemoveDataBlock(DWORD dwSig);
- virtual HRESULT WINAPI GetFlags(DWORD *pdwFlags);
- virtual HRESULT WINAPI SetFlags(DWORD dwFlags);
+ virtual HRESULT STDMETHODCALLTYPE AddDataBlock(void *pDataBlock);
+ virtual HRESULT STDMETHODCALLTYPE CopyDataBlock(DWORD dwSig, void **ppDataBlock);
+ virtual HRESULT STDMETHODCALLTYPE RemoveDataBlock(DWORD dwSig);
+ virtual HRESULT STDMETHODCALLTYPE GetFlags(DWORD *pdwFlags);
+ virtual HRESULT STDMETHODCALLTYPE SetFlags(DWORD dwFlags);
// IShellExtInit
- virtual HRESULT WINAPI Initialize(LPCITEMIDLIST pidlFolder, IDataObject *pdtobj, HKEY
hkeyProgID);
+ virtual HRESULT STDMETHODCALLTYPE Initialize(LPCITEMIDLIST pidlFolder, IDataObject
*pdtobj, HKEY hkeyProgID);
// IContextMenu
- virtual HRESULT WINAPI QueryContextMenu(HMENU hmenu, UINT indexMenu, UINT idCmdFirst,
UINT idCmdLast, UINT uFlags);
- virtual HRESULT WINAPI InvokeCommand(LPCMINVOKECOMMANDINFO lpici);
- virtual HRESULT WINAPI GetCommandString(UINT_PTR idCmd, UINT uType, UINT *pwReserved,
LPSTR pszName, UINT cchMax);
+ virtual HRESULT STDMETHODCALLTYPE QueryContextMenu(HMENU hmenu, UINT indexMenu, UINT
idCmdFirst, UINT idCmdLast, UINT uFlags);
+ virtual HRESULT STDMETHODCALLTYPE InvokeCommand(LPCMINVOKECOMMANDINFO lpici);
+ virtual HRESULT STDMETHODCALLTYPE GetCommandString(UINT_PTR idCmd, UINT uType, UINT
*pwReserved, LPSTR pszName, UINT cchMax);
// IShellPropSheetExt
- virtual HRESULT WINAPI AddPages(LPFNADDPROPSHEETPAGE pfnAddPage, LPARAM lParam);
- virtual HRESULT WINAPI ReplacePage(UINT uPageID, LPFNADDPROPSHEETPAGE pfnReplacePage,
LPARAM lParam);
+ virtual HRESULT STDMETHODCALLTYPE AddPages(LPFNADDPROPSHEETPAGE pfnAddPage, LPARAM
lParam);
+ virtual HRESULT STDMETHODCALLTYPE ReplacePage(UINT uPageID, LPFNADDPROPSHEETPAGE
pfnReplacePage, LPARAM lParam);
// IObjectWithSite
- virtual HRESULT WINAPI SetSite(IUnknown *punk);
- virtual HRESULT WINAPI GetSite(REFIID iid, void **ppvSite);
+ virtual HRESULT STDMETHODCALLTYPE SetSite(IUnknown *punk);
+ virtual HRESULT STDMETHODCALLTYPE GetSite(REFIID iid, void **ppvSite);
// IDropTarget
- virtual HRESULT WINAPI DragEnter(IDataObject *pDataObject, DWORD dwKeyState, POINTL
pt, DWORD *pdwEffect);
- virtual HRESULT WINAPI DragOver(DWORD dwKeyState, POINTL pt, DWORD *pdwEffect);
- virtual HRESULT WINAPI DragLeave();
- virtual HRESULT WINAPI Drop(IDataObject *pDataObject, DWORD dwKeyState, POINTL pt,
DWORD *pdwEffect);
+ virtual HRESULT STDMETHODCALLTYPE DragEnter(IDataObject *pDataObject, DWORD
dwKeyState, POINTL pt, DWORD *pdwEffect);
+ virtual HRESULT STDMETHODCALLTYPE DragOver(DWORD dwKeyState, POINTL pt, DWORD
*pdwEffect);
+ virtual HRESULT STDMETHODCALLTYPE DragLeave();
+ virtual HRESULT STDMETHODCALLTYPE Drop(IDataObject *pDataObject, DWORD dwKeyState,
POINTL pt, DWORD *pdwEffect);
DECLARE_REGISTRY_RESOURCEID(IDR_SHELLLINK)
DECLARE_NOT_AGGREGATABLE(CShellLink)