Exetools  

Go Back   Exetools > General > General Discussion

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 03-03-2020, 07:09
binarylaw binarylaw is offline
Friend
 
Join Date: Jul 2019
Posts: 42
Rept. Given: 0
Rept. Rcvd 0 Times in 0 Posts
Thanks Given: 524
Thanks Rcvd at 10 Times in 7 Posts
binarylaw Reputation: 0
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?
Reply With Quote
  #2  
Old 03-03-2020, 13:21
chants chants is offline
VIP
 
Join Date: Jul 2016
Posts: 826
Rept. Given: 47
Rept. Rcvd 50 Times in 31 Posts
Thanks Given: 737
Thanks Rcvd at 1,140 Times in 529 Posts
chants Reputation: 51
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.
Reply With Quote
The Following User Says Thank You to chants For This Useful Post:
binarylaw (03-04-2020)
  #3  
Old 03-03-2020, 19:32
Kurapica's Avatar
Kurapica Kurapica is offline
VIP
 
Join Date: Jun 2009
Location: Archives
Posts: 198
Rept. Given: 20
Rept. Rcvd 144 Times in 43 Posts
Thanks Given: 74
Thanks Rcvd at 426 Times in 90 Posts
Kurapica Reputation: 100-199 Kurapica Reputation: 100-199
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.
Reply With Quote
The Following User Says Thank You to Kurapica For This Useful Post:
binarylaw (03-04-2020)
  #4  
Old 03-04-2020, 05:09
atom0s's Avatar
atom0s atom0s is offline
Family
 
Join Date: Jan 2015
Location: 127.0.0.1
Posts: 431
Rept. Given: 26
Rept. Rcvd 130 Times in 67 Posts
Thanks Given: 54
Thanks Rcvd at 837 Times in 306 Posts
atom0s Reputation: 100-199 atom0s Reputation: 100-199
For the API on Windows to work with menus:
https://docs.microsoft.com/en-us/windows/win32/menurc/menus
__________________
Personal Projects Site: https://atom0s.com
Reply With Quote
  #5  
Old 03-04-2020, 05:38
chants chants is offline
VIP
 
Join Date: Jul 2016
Posts: 826
Rept. Given: 47
Rept. Rcvd 50 Times in 31 Posts
Thanks Given: 737
Thanks Rcvd at 1,140 Times in 529 Posts
chants Reputation: 51
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.

Last edited by chants; 03-04-2020 at 05:45.
Reply With Quote
  #6  
Old 03-04-2020, 05:42
binarylaw binarylaw is offline
Friend
 
Join Date: Jul 2019
Posts: 42
Rept. Given: 0
Rept. Rcvd 0 Times in 0 Posts
Thanks Given: 524
Thanks Rcvd at 10 Times in 7 Posts
binarylaw Reputation: 0
Quote:
Originally Posted by Kurapica View Post
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 View Post
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.
Reply With Quote
  #7  
Old 03-04-2020, 14:03
fqjp fqjp is offline
Friend
 
Join Date: Apr 2011
Posts: 46
Rept. Given: 1
Rept. Rcvd 2 Times in 1 Post
Thanks Given: 2
Thanks Rcvd at 38 Times in 20 Posts
fqjp Reputation: 2
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
Reply With Quote
The Following 2 Users Say Thank You to fqjp For This Useful Post:
chants (03-05-2020), niculaita (03-04-2020)
  #8  
Old 03-06-2020, 03:32
LordGarfio LordGarfio is offline
Friend
 
Join Date: Jan 2005
Posts: 75
Rept. Given: 7
Rept. Rcvd 5 Times in 4 Posts
Thanks Given: 89
Thanks Rcvd at 101 Times in 35 Posts
LordGarfio Reputation: 5
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).
Reply With Quote
  #9  
Old 03-06-2020, 17:51
Kurapica's Avatar
Kurapica Kurapica is offline
VIP
 
Join Date: Jun 2009
Location: Archives
Posts: 198
Rept. Given: 20
Rept. Rcvd 144 Times in 43 Posts
Thanks Given: 74
Thanks Rcvd at 426 Times in 90 Posts
Kurapica Reputation: 100-199 Kurapica Reputation: 100-199
@binarylaw : I would start by finding out which language the app is written with.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How you inject codes? Hero General Discussion 8 10-10-2005 20:11
How to inject my dll into all user processes [Win]? bearek General Discussion 17 03-08-2005 02:12
Very Easy way to Inject a Dll Rhodium General Discussion 9 10-28-2004 16:52


All times are GMT +8. The time now is 20:17.


Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX, chessgod101
( Since 1998 )