[EXPLORER-NEW]

* Cleanup in case of error. CID 1248426

[RSHELL]
* Add uninitialized class fields. CID 1248477
* Avoid leaking memory. CID 1248438

[BROWSEUI]
* Fix potential overwriting of a variable. CID 716363
* Save the rshell handle instead of loading it every time. CID 1248435
* Fix leaked PIDL. CID 1248418 

[SHELL32]
* Fix GCC build. And one small nickpick that has been bothering me for a long time.

svn path=/branches/shell-experiments/; revision=64864
This commit is contained in:
David Quintana 2014-10-21 12:24:15 +00:00
parent 96cdae0a7c
commit 9abc368186
7 changed files with 31 additions and 18 deletions

View file

@ -61,7 +61,7 @@ HRESULT InitShellServices(HDPA * phdpa)
HRESULT hr = S_OK;
int count = 0;
hdpa = DPA_Create(5);
*phdpa = NULL;
TRACE("Enumerating Shell Service Ojbect GUIDs...\n");
@ -73,6 +73,8 @@ HRESULT InitShellServices(HDPA * phdpa)
return HRESULT_FROM_WIN32(GetLastError());
}
hdpa = DPA_Create(5);
/* Enumerate */
do
{

View file

@ -35,8 +35,11 @@ HRESULT WINAPI CMenuDeskBar_Constructor(REFIID riid, LPVOID *ppv)
CMenuDeskBar::CMenuDeskBar() :
m_Client(NULL),
m_ClientWindow(NULL),
m_IconSize(0),
m_Banner(NULL),
m_Shown(FALSE)
m_Shown(FALSE),
m_ShowFlags(0)
{
}

View file

@ -1191,7 +1191,10 @@ HRESULT CMenuStaticToolbar::FillToolbar(BOOL clearFirst)
HRESULT hr = m_menuBand->_CallCBWithItemId(info.wID, SMC_GETINFO, 0, reinterpret_cast<LPARAM>(sminfo));
if (FAILED_UNEXPECTEDLY(hr))
{
delete sminfo;
return hr;
}
AddButton(info.wID, info.dwTypeData, info.hSubMenu != NULL, sminfo->iIcon, reinterpret_cast<DWORD_PTR>(sminfo), last);

View file

@ -337,7 +337,6 @@ HRESULT STDMETHODCALLTYPE CBandSiteBase::AddBand(IUnknown *punk)
/* Initialize the added bands */
memset(&NewBand[fBandsAllocated], 0, (NewAllocated - fBandsAllocated) * sizeof(struct BandObject));
NewBand = &fBands[fBandsAllocated];
fBandsAllocated = NewAllocated;
CoTaskMemFree(fBands);
fBands = NewBand;

View file

@ -30,6 +30,7 @@ toolbar, and address band for an explorer window
#define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp))
#define USE_CUSTOM_MENUBAND 1
HMODULE g_hRShell = NULL;
#if 1
// TODO: declare these GUIDs and interfaces in the right place (whatever that may be)
@ -729,13 +730,13 @@ HRESULT CInternetToolbar::CreateMenuBar(IShellMenu **pMenuBar)
hResult = E_FAIL;
#if USE_CUSTOM_MENUBAND
HMODULE hrs = GetModuleHandleW(L"rshell.dll");
if (!g_hRShell) g_hRShell = GetModuleHandleW(L"rshell.dll");
if (!hrs) hrs = LoadLibraryW(L"rshell.dll");
if (!g_hRShell) g_hRShell = LoadLibraryW(L"rshell.dll");
if (hrs)
if (g_hRShell)
{
PMENUBAND_CONSTRUCTOR func = (PMENUBAND_CONSTRUCTOR) GetProcAddress(hrs, "CMenuBand_Constructor");
PMENUBAND_CONSTRUCTOR func = (PMENUBAND_CONSTRUCTOR) GetProcAddress(g_hRShell, "CMenuBand_Constructor");
if (func)
{
hResult = func(IID_PPV_ARG(IShellMenu, &menubar));

View file

@ -897,28 +897,32 @@ HRESULT IEGetNameAndFlagsEx(LPITEMIDLIST pidl, SHGDNF uFlags, long param10,
LPWSTR pszBuf, UINT cchBuf, SFGAOF *rgfInOut)
{
CComPtr<IShellFolder> parentFolder;
LPITEMIDLIST childPIDL;
LPITEMIDLIST childPIDL = NULL;
STRRET L108;
HRESULT hResult;
hResult = SHBindToFolderIDListParent(NULL, pidl, &IID_PPV_ARG(IShellFolder, &parentFolder), &childPIDL);
if (FAILED(hResult))
return hResult;
goto cleanup;
hResult = parentFolder->GetDisplayNameOf(childPIDL, uFlags, &L108);
if (FAILED(hResult))
return hResult;
goto cleanup;
StrRetToBufW(&L108, childPIDL, pszBuf, cchBuf);
if (rgfInOut)
{
hResult = parentFolder->GetAttributesOf(1, const_cast<LPCITEMIDLIST *>(&childPIDL), rgfInOut);
if (FAILED(hResult))
return hResult;
goto cleanup;
}
ILFree(childPIDL);
return S_OK;
hResult = S_OK;
cleanup:
if (childPIDL)
ILFree(childPIDL);
return hResult;
}
long IEGetNameAndFlags(LPITEMIDLIST pidl, SHGDNF uFlags, LPWSTR pszBuf, UINT cchBuf, SFGAOF *rgfInOut)

View file

@ -59,7 +59,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(shell);
static const WCHAR SV_CLASS_NAME[] = {'S', 'H', 'E', 'L', 'L', 'D', 'L', 'L', '_', 'D', 'e', 'f', 'V', 'i', 'e', 'w', 0};
typedef struct
{ BOOL bIsAscending;
{
BOOL bIsAscending;
INT nHeaderID;
INT nLastHeaderID;
} LISTVIEW_SORT_INFO, *LPLISTVIEW_SORT_INFO;
@ -358,10 +359,10 @@ CDefView::CDefView() :
m_isEditing(FALSE),
m_hView(NULL)
{
m_FolderSettings = { 0 };
m_sortInfo = { 0 };
m_ptLastMousePos = { 0 };
m_Category = { 0 };
ZeroMemory(&m_FolderSettings, sizeof(m_FolderSettings));
ZeroMemory(&m_sortInfo, sizeof(m_sortInfo));
ZeroMemory(&m_ptLastMousePos, sizeof(m_ptLastMousePos));
ZeroMemory(&m_Category, sizeof(m_Category));
}
CDefView::~CDefView()