mirror of
https://github.com/reactos/reactos.git
synced 2025-06-12 10:08:28 +00:00
[EXPLORER-NEW] - Improve start menu initialization a bit so it shows what failed
svn path=/trunk/; revision=54546
This commit is contained in:
parent
a2b753d441
commit
f0fd524b40
1 changed files with 91 additions and 81 deletions
|
@ -843,110 +843,120 @@ CreateStartMenu(IN ITrayWindow *Tray,
|
||||||
IN HBITMAP hbmBanner OPTIONAL,
|
IN HBITMAP hbmBanner OPTIONAL,
|
||||||
IN BOOL bSmallIcons)
|
IN BOOL bSmallIcons)
|
||||||
{
|
{
|
||||||
HRESULT hRet;
|
HRESULT hr;
|
||||||
IObjectWithSite *pOws = NULL;
|
IObjectWithSite *pOws = NULL;
|
||||||
IMenuPopup *pMp = NULL;
|
IMenuPopup *pMp = NULL;
|
||||||
IStartMenuSite *pSms = NULL;
|
IStartMenuSite *pSms = NULL;
|
||||||
IMenuBand *pMb = NULL;
|
IMenuBand *pMb = NULL;
|
||||||
IInitializeObject *pIo;
|
IInitializeObject *pIo;
|
||||||
IUnknown *pUnk;
|
IUnknown *pUnk = NULL;
|
||||||
IBandSite *pBs;
|
IBandSite *pBs = NULL;
|
||||||
DWORD dwBandId = 0;
|
DWORD dwBandId = 0;
|
||||||
|
|
||||||
pSms = CreateStartMenuSite(Tray);
|
pSms = CreateStartMenuSite(Tray);
|
||||||
if (pSms == NULL)
|
if (pSms == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
hRet = CoCreateInstance(&CLSID_StartMenu,
|
hr = CoCreateInstance(&CLSID_StartMenu,
|
||||||
NULL,
|
NULL,
|
||||||
CLSCTX_INPROC_SERVER,
|
CLSCTX_INPROC_SERVER,
|
||||||
&IID_IMenuPopup,
|
&IID_IMenuPopup,
|
||||||
(PVOID*)&pMp);
|
(PVOID*)&pMp);
|
||||||
if (SUCCEEDED(hRet))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
hRet = IMenuPopup_QueryInterface(pMp,
|
DbgPrint("CoCreateInstance failed: %x\n", hr);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = IMenuPopup_QueryInterface(pMp,
|
||||||
&IID_IObjectWithSite,
|
&IID_IObjectWithSite,
|
||||||
(PVOID*)&pOws);
|
(PVOID*)&pOws);
|
||||||
if (SUCCEEDED(hRet))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
|
DbgPrint("IMenuPopup_QueryInterface failed: %x\n", hr);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
/* Set the menu site so we can handle messages */
|
/* Set the menu site so we can handle messages */
|
||||||
hRet = IObjectWithSite_SetSite(pOws,
|
hr = IObjectWithSite_SetSite(pOws, (IUnknown*)pSms);
|
||||||
(IUnknown*)pSms);
|
if (FAILED(hr))
|
||||||
if (SUCCEEDED(hRet))
|
|
||||||
{
|
{
|
||||||
|
DbgPrint("IObjectWithSite_SetSite failed: %x\n", hr);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
/* Initialize the menu object */
|
/* Initialize the menu object */
|
||||||
hRet = IMenuPopup_QueryInterface(pMp,
|
hr = IMenuPopup_QueryInterface(pMp, &IID_IInitializeObject, (PVOID*)&pIo);
|
||||||
&IID_IInitializeObject,
|
if (SUCCEEDED(hr))
|
||||||
(PVOID*)&pIo);
|
|
||||||
if (SUCCEEDED(hRet))
|
|
||||||
{
|
{
|
||||||
//hRet = IInitializeObject_Initialize(pIo);
|
//hr = IInitializeObject_Initialize(pIo);
|
||||||
hRet = pIo->lpVtbl->Initialize(pIo);
|
hr = pIo->lpVtbl->Initialize(pIo);
|
||||||
|
|
||||||
//IInitializeObject_Release(pIo);
|
//IInitializeObject_Release(pIo);
|
||||||
pIo->lpVtbl->Release(pIo);
|
pIo->lpVtbl->Release(pIo);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
hRet = S_OK;
|
hr = S_OK;
|
||||||
|
|
||||||
/* Everything is initialized now. Let's get the IMenuBand interface. */
|
/* Everything is initialized now. Let's get the IMenuBand interface. */
|
||||||
if (SUCCEEDED(hRet))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
hRet = IMenuPopup_GetClient(pMp,
|
DbgPrint("IMenuPopup_QueryInterface failed: %x\n", hr);
|
||||||
&pUnk);
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
if (SUCCEEDED(hRet))
|
hr = IMenuPopup_GetClient(pMp, &pUnk);
|
||||||
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
hRet = IUnknown_QueryInterface(pUnk,
|
DbgPrint("IMenuPopup_GetClient failed: %x\n", hr);
|
||||||
&IID_IBandSite,
|
goto cleanup;
|
||||||
(PVOID*)&pBs);
|
}
|
||||||
|
|
||||||
if (SUCCEEDED(hRet))
|
hr = IUnknown_QueryInterface(pUnk, &IID_IBandSite, (PVOID*)&pBs);
|
||||||
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
|
DbgPrint("IUnknown_QueryInterface pBs failed: %x\n", hr);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
/* Finally we have the IBandSite interface, there's only one
|
/* Finally we have the IBandSite interface, there's only one
|
||||||
band in it that apparently provides the IMenuBand interface */
|
band in it that apparently provides the IMenuBand interface */
|
||||||
hRet = IBandSite_EnumBands(pBs,
|
hr = IBandSite_EnumBands(pBs, 0, &dwBandId);
|
||||||
0,
|
if (FAILED(hr))
|
||||||
&dwBandId);
|
|
||||||
if (SUCCEEDED(hRet))
|
|
||||||
{
|
{
|
||||||
hRet = IBandSite_GetBandObject(pBs,
|
DbgPrint("IBandSite_EnumBands failed: %x\n", hr);
|
||||||
dwBandId,
|
goto cleanup;
|
||||||
&IID_IMenuBand,
|
|
||||||
(PVOID*)&pMb);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IBandSite_Release(pBs);
|
hr = IBandSite_GetBandObject(pBs, dwBandId, &IID_IMenuBand, (PVOID*)&pMb);
|
||||||
}
|
if (FAILED(hr))
|
||||||
|
|
||||||
IUnknown_Release(pUnk);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
IObjectWithSite_Release(pOws);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
IStartMenuSite_Release(pSms);
|
|
||||||
|
|
||||||
if (!SUCCEEDED(hRet))
|
|
||||||
{
|
{
|
||||||
DbgPrint("Failed to initialize the start menu: 0x%x!\n", hRet);
|
DbgPrint("IBandSite_GetBandObject failed: %x\n", hr);
|
||||||
|
goto cleanup;
|
||||||
if (pMp != NULL)
|
|
||||||
IMenuPopup_Release(pMp);
|
|
||||||
|
|
||||||
if (pMb != NULL)
|
|
||||||
IMenuBand_Release(pMb);
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateStartMenu(pMp,
|
UpdateStartMenu(pMp,
|
||||||
hbmBanner,
|
hbmBanner,
|
||||||
bSmallIcons);
|
bSmallIcons);
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
if (SUCCEEDED(hr))
|
||||||
*ppMenuBand = pMb;
|
*ppMenuBand = pMb;
|
||||||
|
else if (pMb != NULL)
|
||||||
|
IMenuBand_Release(pMb);
|
||||||
|
|
||||||
|
if (pBs != NULL)
|
||||||
|
IBandSite_Release(pBs);
|
||||||
|
if (pUnk != NULL)
|
||||||
|
IUnknown_Release(pUnk);
|
||||||
|
if (pOws != NULL)
|
||||||
|
IObjectWithSite_Release(pOws);
|
||||||
|
if (pMp != NULL)
|
||||||
|
IMenuPopup_Release(pMp);
|
||||||
|
if (pSms != NULL)
|
||||||
|
IStartMenuSite_Release(pSms);
|
||||||
|
|
||||||
|
if (FAILED(hr))
|
||||||
|
return NULL;
|
||||||
return pMp;
|
return pMp;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue