Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Confusing issue with mainmenu_manager::generate_menu_win32 (Read 1397 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Confusing issue with mainmenu_manager::generate_menu_win32

Member from my header...
Code: [Select]
mainmenu_manager::ptr m_mm;

My source...
Code: [Select]
MainMenuManager::MainMenuManager(const GUID& guid)
{
m_mm = mainmenu_manager::get();
m_mm->instantiate(guid);
}

STDMETHODIMP MainMenuManager::BuildMenu(IMenuObj* obj, UINT32 base_id)
{
RETURN_HR_IF(E_POINTER, m_mm.is_empty());

HMENU menu;
RETURN_IF_FAILED(obj->get(arg_helper(&menu)));

m_mm->generate_menu_win32(menu, base_id, UINT_MAX, mainmenu_manager::flag_show_shortcuts);
return S_OK;
}

STDMETHODIMP MainMenuManager::ExecuteByID(UINT32 id, VARIANT_BOOL* out)
{
RETURN_HR_IF_NULL(E_POINTER, out);
RETURN_HR_IF(E_POINTER, m_mm.is_empty());

*out = to_variant_bool(m_mm->execute_command(id));
return S_OK;
}

This code has seemingly worked for years and I'm using increments of 1000 for each base_id given I create 6 instances of this class for File, Edit, View etc. I've seen other code use UINT_MAX for the count.

But now I'm getting reports of totally wrong menu items from windows like this..



and WinRAR showing up here?



I can't reproduce myself but I have 2 different people reporting it.

I'm very confused.  :))

edit: it seems incrementing the base_id by 10000 might fix it but when I posted a bit of code that walks every available menu item (including dynamic ones). I was getting numbers in the hundreds for all combined. Still confused. :P