Hack Forums
[.NET] [SRC]Add Item To Windows Executable RightClick Menu! - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] [SRC]Add Item To Windows Executable RightClick Menu! (/showthread.php?tid=488382)



[SRC]Add Item To Windows Executable RightClick Menu! - ubbelol - Jun 18, 2010

Hey! A guy asked me on msn yesterday how you would add an item to the windows default right click menu when you right click any .exe file, so i googled up what registry keys had to be created and here's what i came up with. It's a simple function let you add your own item to the right click menu of executable files. (Thanks nathan my drunk friend for giving me an example on how to change the default value of a subkey :p)

Btw this require UAC to work.

Code
Private Function doAddToList(ByVal itemName As String, ByVal itemPath As String, ByVal itemArgs() As String)
  Dim regkey : regkey = CreateObject("wscript.shell") : Dim keyValue = Chr(34) & itemPath & Chr(34)
  If Not itemArgs.Length < 1 Then
    For i = 0 To itemArgs.Length - 1
    keyValue &= itemArgs(i)
    Next
  End If
  Try
    regkey.regwrite("HKEY_CLASSES_ROOT\*\shell\" & itemName & "\command\", keyValue, "REG_SZ")
  Catch
    Return False
  End Try
  Return True
    End Function

To use the function:

Code
If doAddToList("Item Name", "File Path", ArgumentArray) Then
    MsgBox("Success!") ' Successfully added item
  Else
    MsgBox("Fail!") ' Failed to add item
  End If

I added the ArgumentArray for people using console applications and wanting to open, edit, delete or modify the file in any way. Please read my tutorial on passing arguments to a console application here: https://hackforums.net/showthread.php?tid=488166

If you do not know how to create a simple string array with arguments, here's an example:

Code
dim argArray() as string = new string() {"-arg1", "-arg2", "-arg3"}

Another neat little thing i discovered is that if you add an argument like this:

Code
dim argArray() as string = new string() {"-%1", "-arg2", "-arg3"}

the "-%1" will return the full path of the file you right clicked! 😉

Here is a picture of when passing the "%1" argument to a console application:

[IMG]http://i350.photobucket.com/albums/q408/ubbe12/asfsfaaf.png[/IMG]

Thats it! :p Hope you can read my awful english.


* - xhtmlphpâ„¢ - Jun 18, 2010

You deserve a fucking medal for posting this!!<3


* - StRaXxXD - Jun 18, 2010

ohh this is awesome...This is very useful..More non hacking things in this section...I actually love it :P

Btw: YOur English is good...Or i am just blind..lol


* - ubbelol - Jun 18, 2010

(Jun 18, 2010 06:05 AM)StRaXxXD Wrote:  ohh this is awesome...This is very useful..More non hacking things in this section...I actually love it :P

Btw: YOur English is good...Or i am just blind..lol

Yup i'm tired of all the "L33T KEYLOGGERS" in the .net section.


* - iRtehLeetâ„¢ - Jun 18, 2010

Add a right click any .exe "Crypt" option like Japa did! Cool post UbbeLoL!


* - Apple - Jun 18, 2010

I fucking love you I'd +rep you if I didn't already. :D


* - ubbelol - Jun 18, 2010

(Jun 18, 2010 06:35 AM)The Cloak Wrote:  I fucking love you I'd +rep you if I didn't already. :D

Thank you alot :p Have fun with it


* - Feather - Jun 18, 2010

This is really good mate! thanks for the share UbbeLoL!


* - Romeo. - Jun 18, 2010

(Jun 18, 2010 06:35 AM)iRtehLeetâ„¢ Wrote:  Add a right click any .exe "Crypt" option like Japa did! Cool post UbbeLoL!

Japa made it in Delphi if i'm not wrong.

Cool post UbbeLoL!


* - Mar0x - Jun 18, 2010

Thanks for posting this, should be easy to use it in other languages.


* - MCart - Jun 18, 2010

Thanks a lot UbbeLoL! Very useful :)


* - newbie223 - Jun 18, 2010

i already knew this but nice post
but i never ever knew what to do with this
maybe if u code ur own .net reflector xD


* - ubbelol - Jun 18, 2010

(Jun 18, 2010 08:45 AM)MCart Wrote:  Thanks a lot UbbeLoL! Very useful :)

Thank you very much MCart. :)

Bump! :p


* - ★Cooldude★ - Jun 18, 2010

Thank you very much for posting this.