Exetools

Exetools (https://forum.exetools.com/index.php)
-   General Discussion (https://forum.exetools.com/forumdisplay.php?f=2)
-   -   Possible to inject new menus into GUIs? (https://forum.exetools.com/showthread.php?t=19451)

binarylaw 03-03-2020 07:09

Possible to inject new menus into GUIs?
 
Wondering if it'd be possible to inject additional menu/submenu items into a program's menu bar/submenus (GUIs in Windows). For example, would it be possible to inject a new submenu item under "File" to open another program or save directly to a specific folder?

chants 03-03-2020 13:21

Injecting the menu is not so hard it's just a Windows message as long as you have a way of getting the handle and have a way to locate where you want it. You could even use a resource editor to do it if the menu is statically created. But you need a click action handler and the logic in there would require you to know a good deal about the data structures of the underlying program. It's definitely possible but in complex apps can be prohibitively time consuming to figure out. Like adding the save menu back into IDA Pro demo for example. A complex database format like that has a large amount of C code to save with data structures gathered from all over. Sometimes it's very difficult. So it depends on the context if it is worth it or not.

Kurapica 03-03-2020 19:32

Make sure to know the (language / Technology) used to write that application, can be a major factor in deciding how complicated adding this new menu is.

atom0s 03-04-2020 05:09

For the API on Windows to work with menus:
https://docs.microsoft.com/en-us/windows/win32/menurc/menus

chants 03-04-2020 05:38

Yes as Kurapica points out I assumed Windows desktop API native apps as in link from atom0s. If its Delphi, .Net, Java or VB6 or the like different approaches are needed based on their interpreter. Further in UWP apps though there is no menu, such modifications are much harder due to the maze of security restrictions and limited API you will have access to, making it probably the hardest of all.

Also if it is a multithreaded app, accessing data structures may require sharing synchronization objects of the app.

Generally a task like this will be as much of a careful programming effort as it is a reversing one if you want a clean reliable solution. Adding functionality is significantly harder than modifying or removing it as a rule of thumb.

binarylaw 03-04-2020 05:42

Quote:

Originally Posted by Kurapica (Post 119464)
Make sure to know the (language / Technology) used to write that application, can be a major factor in deciding how complicated adding this new menu is.

Quote:

Originally Posted by chants (Post 119458)
Injecting the menu is not so hard it's just a Windows message as long as you have a way of getting the handle and have a way to locate where you want it. You could even use a resource editor to do it if the menu is statically created. But you need a click action handler and the logic in there would require you to know a good deal about the data structures of the underlying program. It's definitely possible but in complex apps can be prohibitively time consuming to figure out. Like adding the save menu back into IDA Pro demo for example. A complex database format like that has a large amount of C code to save with data structures gathered from all over. Sometimes it's very difficult. So it depends on the context if it is worth it or not.

Interesting, thanks. Any suggestions on where I might look or go to for any sort of walk-throughs or tutorials (or at least better search terms for finding this)? My searching so far is only pulling up things related to the general subject of GUI programming.

fqjp 03-04-2020 14:03

Try searching with "windows" "hook" "menu" as keywords.

such as:
https://stackoverflow.com/questions/12132056/creating-a-windows-hook-to-detect-menu-clicks
http://www.vbforums.com/showthread.php?776385-RESOLVED-Modify-right-click-context-menu-in-standard-controls

LordGarfio 03-06-2020 03:32

RegEditX does something similar to that for what you are asking with Microsoft's RegEdit (insert menu item).

dcsoft.com (Take it as an example).

Kurapica 03-06-2020 17:51

@binarylaw : I would start by finding out which language the app is written with.


All times are GMT +8. The time now is 18:16.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2026, vBulletin Solutions, Inc.
Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX