View difference between Paste ID: abpWpbY3 and sQPhhsvV
SHOW: | | - or go back to the newest paste.
1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Runtime.InteropServices;
5
using System.Text;
6
using System.Threading.Tasks;
7
8
9
//REMEMBER: GO DOWN TO THE WS_LOCATION VALUE NEAR THE BOTTOM AND CHANGE IT AS I SAID TO IN THE VIDEO
10
//REMEMBER: GO DOWN TO THE WS_LOCATION VALUE NEAR THE BOTTOM AND CHANGE IT AS I SAID TO IN THE VIDEO
11
//REMEMBER: GO DOWN TO THE WS_LOCATION VALUE NEAR THE BOTTOM AND CHANGE IT AS I SAID TO IN THE VIDEO
12
13
namespace RunWS {
14
15
	public struct PROCESS_INFORMATION {
16
		public IntPtr hProcess;
17
		public IntPtr hThread;
18
		public uint dwProcessId;
19
		public uint dwThreadId;
20
	}
21
22
	public struct STARTUPINFO {
23
		public uint cb;
24
		public string lpReserved;
25
		public string lpDesktop;
26
		public string lpTitle;
27
		public uint dwX;
28
		public uint dwY;
29
		public uint dwXSize;
30
		public uint dwYSize;
31
		public uint dwXCountChars;
32
		public uint dwYCountChars;
33
		public uint dwFillAttribute;
34
		public uint dwFlags;
35
		public short wShowWindow;
36
		public short cbReserved2;
37
		public IntPtr lpReserved2;
38
		public IntPtr hStdInput;
39
		public IntPtr hStdOutput;
40
		public IntPtr hStdError;
41
	}
42
43
	public struct SECURITY_ATTRIBUTES {
44
		public int length;
45
		public IntPtr lpSecurityDescriptor;
46
		public bool bInheritHandle;
47
	}
48
49
	class Program {
50
		[DllImport("kernel32.dll")]
51
		static extern bool CreateProcess(
52
			string lpApplicationName,
53
			string lpCommandLine,
54
			IntPtr lpProcessAttributes,
55
			IntPtr lpThreadAttributes,
56
			bool bInheritHandles,
57
			uint dwCreationFlags,
58
			IntPtr lpEnvironment,
59
			string lpCurrentDirectory,
60
			ref STARTUPINFO lpStartupInfo,
61
			out PROCESS_INFORMATION lpProcessInformation
62
		);
63
64
		[DllImport("kernel32.dll")]
65
		static extern uint GetLastError();
66
67
		public static string WS_LOCATION = "F:/Program Files (x86)/Steam/steamapps/common/Wildstar/Client64/Wildstar64.exe";
68
		public static string SERVER_LOCATION = "localhost";
69
70
		static void Main(string[] args) {
71
			STARTUPINFO si = new STARTUPINFO();
72
			PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
73
74
			if (!CreateProcess(
75
				WS_LOCATION,
76
				"/auth " + SERVER_LOCATION + " /authNc " + SERVER_LOCATION + " /lang en /patcher " + SERVER_LOCATION + " /SettingsKey WildStar /realmDataCenterId 9",
77
			IntPtr.Zero, IntPtr.Zero, false, 0, IntPtr.Zero, null, ref si, out pi)) {
78
79
				Console.Beep();
80
				Console.WriteLine("Failure!");
81
				uint code = GetLastError();
82
				if (code == 3) {
83
					Console.WriteLine("Error code 3 (The System Cannot Find The Path Specified)");
84
				} else {
85
					Console.WriteLine("Error code " + code);
86
					Console.WriteLine("Google \"Windows system error codes\" to find the meaning of this code.");
87
				}
88
				Console.Write("Press enter to quit.");
89
				Console.ReadLine();
90
			}
91
92
93
		}
94
	}
95
}