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: 16
Rept. Given: 0
Rept. Rcvd 0 Times in 0 Posts
Thanks Given: 42
Thanks Rcvd at 2 Times in 2 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 online now
Family
 
Join Date: Jul 2016
Posts: 497
Rept. Given: 4
Rept. Rcvd 33 Times in 19 Posts
Thanks Given: 422
Thanks Rcvd at 766 Times in 355 Posts
chants Reputation: 33
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: 122
Rept. Given: 13
Rept. Rcvd 126 Times in 35 Posts
Thanks Given: 21
Thanks Rcvd at 191 Times in 43 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: 253
Rept. Given: 24
Rept. Rcvd 101 Times in 47 Posts
Thanks Given: 42
Thanks Rcvd at 423 Times in 167 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 online now
Family
 
Join Date: Jul 2016
Posts: 497
Rept. Given: 4
Rept. Rcvd 33 Times in 19 Posts
Thanks Given: 422
Thanks Rcvd at 766 Times in 355 Posts
chants Reputation: 33
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: 16
Rept. Given: 0
Rept. Rcvd 0 Times in 0 Posts
Thanks Given: 42
Thanks Rcvd at 2 Times in 2 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: 24
Rept. Given: 1
Rept. Rcvd 2 Times in 1 Post
Thanks Given: 0
Thanks Rcvd at 12 Times in 7 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: 14
Rept. Given: 7
Rept. Rcvd 1 Time in 1 Post
Thanks Given: 39
Thanks Rcvd at 1 Time in 1 Post
LordGarfio Reputation: 1
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: 122
Rept. Given: 13
Rept. Rcvd 126 Times in 35 Posts
Thanks Given: 21
Thanks Rcvd at 191 Times in 43 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

Thread Tools
Display Modes

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 code into a process? jonwil General Discussion 7 06-01-2005 23:23
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 05:28.


Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX
( 1998 - 2020 )