forked from rara64/GetTrustedInstaller
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
36 lines (33 loc) · 1.17 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System;
using System.Diagnostics;
using System.ServiceProcess;
namespace GetTrustedInstaller
{
class Program
{
static int Main(string[] args)
{
// I use TrustedInstaller process that is in the background only when the TrustedInstaller service is running to pass its ID to py7hagoras code
ServiceController sc = new ServiceController
{
ServiceName = "TrustedInstaller",
};
if (sc.Status != ServiceControllerStatus.Running)
sc.Start();
Process[] proc = Process.GetProcessesByName("TrustedInstaller");
string commandLine = string.Empty;
for (int i = 0; i < args.Length; i++)
{
if (i != 0) commandLine += " ";
commandLine += args[i];
}
Console.WriteLine($"Línea de comandos: {commandLine}");
Console.WriteLine(string.Empty);
if (commandLine != string.Empty) {
return IamYourDaddy.Run(proc[0].Id, commandLine, false);
} else {
return 3;
}
}
}
}