Downgraded external lib to VS 2010
This commit is contained in:
parent
dfd5d51a06
commit
a0ccd3ffa8
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
@ -11,7 +11,8 @@
|
|||||||
<AssemblyName>IW4MAdmin</AssemblyName>
|
<AssemblyName>IW4MAdmin</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<TargetFrameworkProfile />
|
<TargetFrameworkProfile>
|
||||||
|
</TargetFrameworkProfile>
|
||||||
<IsWebBootstrapper>true</IsWebBootstrapper>
|
<IsWebBootstrapper>true</IsWebBootstrapper>
|
||||||
<PublishUrl>ftp://raidmax.org/</PublishUrl>
|
<PublishUrl>ftp://raidmax.org/</PublishUrl>
|
||||||
<Install>true</Install>
|
<Install>true</Install>
|
||||||
@ -44,6 +45,7 @@
|
|||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<PlatformTarget>x86</PlatformTarget>
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
@ -55,6 +57,7 @@
|
|||||||
<WarningLevel>0</WarningLevel>
|
<WarningLevel>0</WarningLevel>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<GenerateSerializationAssemblies>On</GenerateSerializationAssemblies>
|
<GenerateSerializationAssemblies>On</GenerateSerializationAssemblies>
|
||||||
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetZone>LocalIntranet</TargetZone>
|
<TargetZone>LocalIntranet</TargetZone>
|
||||||
@ -106,6 +109,11 @@
|
|||||||
<Compile Include="Manager.cs" />
|
<Compile Include="Manager.cs" />
|
||||||
<Compile Include="Maps.cs" />
|
<Compile Include="Maps.cs" />
|
||||||
<Compile Include="Player.cs" />
|
<Compile Include="Player.cs" />
|
||||||
|
<Compile Include="Properties\Settings.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="RCON.cs" />
|
<Compile Include="RCON.cs" />
|
||||||
<Compile Include="Report.cs" />
|
<Compile Include="Report.cs" />
|
||||||
<Compile Include="Server.cs" />
|
<Compile Include="Server.cs" />
|
||||||
@ -166,6 +174,7 @@
|
|||||||
<Content Include="config\servers.cfg">
|
<Content Include="config\servers.cfg">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<None Include="app.config" />
|
||||||
<None Include="IW4MAdmin.exe.config">
|
<None Include="IW4MAdmin.exe.config">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
@ -24,7 +24,7 @@ namespace IW4MAdmin
|
|||||||
else
|
else
|
||||||
Console.WriteLine(" Version " + Version + " (unable to retrieve latest)");
|
Console.WriteLine(" Version " + Version + " (unable to retrieve latest)");
|
||||||
Console.WriteLine("=====================================================");
|
Console.WriteLine("=====================================================");
|
||||||
#if DEBUG
|
#if DEBUG2
|
||||||
if (viableServers.Count < 1)
|
if (viableServers.Count < 1)
|
||||||
viableServers = checkConfig(); // fall back to config
|
viableServers = checkConfig(); // fall back to config
|
||||||
Servers = viableServers;
|
Servers = viableServers;
|
||||||
@ -56,7 +56,7 @@ namespace IW4MAdmin
|
|||||||
frontEnd.Init();
|
frontEnd.Init();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if DEBUG
|
#if DEBUG2
|
||||||
static void setupConfig()
|
static void setupConfig()
|
||||||
{
|
{
|
||||||
bool validPort = false;
|
bool validPort = false;
|
||||||
@ -91,7 +91,7 @@ namespace IW4MAdmin
|
|||||||
return serverManager.getServers().ToArray();
|
return serverManager.getServers().ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG2
|
||||||
static List<Server> checkConfig()
|
static List<Server> checkConfig()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -26,15 +26,13 @@ namespace IW4MAdmin
|
|||||||
|
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
activePIDs = getCurrentIW4MProcesses();
|
while (getCurrentIW4MProcesses().Count == 0)
|
||||||
|
|
||||||
if (activePIDs.Count == 0)
|
|
||||||
{
|
{
|
||||||
mainLog.Write("No viable IW4M instances detected.", Log.Level.All);
|
mainLog.Write("No viable IW4M instances detected.", Log.Level.All);
|
||||||
Utilities.Wait(5);
|
Utilities.Wait(10);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
activePIDs = getCurrentIW4MProcesses();
|
||||||
Servers = loadServers();
|
Servers = loadServers();
|
||||||
|
|
||||||
foreach (Server S in Servers)
|
foreach (Server S in Servers)
|
||||||
@ -108,7 +106,7 @@ namespace IW4MAdmin
|
|||||||
Servers.Add(S);
|
Servers.Add(S);
|
||||||
Thread IW4MServerThread = new Thread(S.Monitor);
|
Thread IW4MServerThread = new Thread(S.Monitor);
|
||||||
ThreadList.Add(pID, IW4MServerThread);
|
ThreadList.Add(pID, IW4MServerThread);
|
||||||
mainLog.Write("New server dectected on port " + S.getPort(), Log.Level.All);
|
mainLog.Write("New server detected on port " + S.getPort(), Log.Level.All);
|
||||||
IW4MServerThread.Start();
|
IW4MServerThread.Start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
26
Admin/Properties/Settings.Designer.cs
generated
Normal file
26
Admin/Properties/Settings.Designer.cs
generated
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Runtime Version:4.0.30319.18408
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace IW4MAdmin.Properties {
|
||||||
|
|
||||||
|
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
|
||||||
|
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||||
|
|
||||||
|
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||||
|
|
||||||
|
public static Settings Default {
|
||||||
|
get {
|
||||||
|
return defaultInstance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -804,18 +804,34 @@ namespace IW4MAdmin
|
|||||||
Log.Write("Could not load IW4MAdmin interface!", IW4MAdmin.Log.Level.Debug);
|
Log.Write("Could not load IW4MAdmin interface!", IW4MAdmin.Log.Level.Debug);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// basic info dvars
|
// basic info dvars
|
||||||
hostname = Utilities.stripColors(getDvar("sv_hostname").current);
|
hostname = Utilities.stripColors(getDvar("sv_hostname").current);
|
||||||
mapname = getDvar("mapname").current;
|
mapname = getDvar("mapname").current;
|
||||||
IW_Ver = getDvar("shortversion").current;
|
IW_Ver = getDvar("shortversion").current;
|
||||||
maxClients = Convert.ToInt32(getDvar("party_maxplayers").current);
|
maxClients = -1;
|
||||||
|
Int32.TryParse(getDvar("party_maxplayers").current, out maxClients);
|
||||||
|
|
||||||
|
if (maxClients == -1)
|
||||||
|
{
|
||||||
|
Log.Write("Could not get iw4m_onelog value", IW4MAdmin.Log.Level.Debug);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Gametype = getDvar("g_gametype").current;
|
Gametype = getDvar("g_gametype").current;
|
||||||
|
|
||||||
// important log variables
|
// important log variables
|
||||||
Basepath = getDvar("fs_basepath").current;
|
Basepath = getDvar("fs_basepath").current;
|
||||||
Mod = getDvar("fs_game").current;
|
Mod = getDvar("fs_game").current;
|
||||||
logPath = getDvar("g_log").current;
|
logPath = getDvar("g_log").current;
|
||||||
int oneLog = Convert.ToInt32(getDvar("iw4m_onelog").current);
|
int oneLog = -1;
|
||||||
|
Int32.TryParse(getDvar("iw4m_onelog").current, out oneLog);
|
||||||
|
|
||||||
|
if (oneLog == -1)
|
||||||
|
{
|
||||||
|
Log.Write("Could not get iw4m_onelog value", IW4MAdmin.Log.Level.Debug);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// our settings
|
// our settings
|
||||||
setDvar("sv_kickBanTime", "3600"); // 1 hour
|
setDvar("sv_kickBanTime", "3600"); // 1 hour
|
||||||
|
@ -316,6 +316,12 @@ namespace IW4MAdmin
|
|||||||
return "a very long time";
|
return "a very long time";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const int PROCESS_CREATE_THREAD = 0x0002;
|
||||||
|
const int PROCESS_QUERY_INFORMATION = 0x0400;
|
||||||
|
const int PROCESS_VM_OPERATION = 0x0008;
|
||||||
|
const int PROCESS_VM_WRITE = 0x0020;
|
||||||
|
const int PROCESS_VM_READ = 0x0010;
|
||||||
|
|
||||||
[Flags]
|
[Flags]
|
||||||
public enum ProcessAccessFlags : uint
|
public enum ProcessAccessFlags : uint
|
||||||
{
|
{
|
||||||
@ -364,6 +370,9 @@ namespace IW4MAdmin
|
|||||||
[DllImport("kernel32.dll")]
|
[DllImport("kernel32.dll")]
|
||||||
public static extern IntPtr OpenProcess(ProcessAccessFlags dwDesiredAccess, bool bInheritHandle, int dwProcessId);
|
public static extern IntPtr OpenProcess(ProcessAccessFlags dwDesiredAccess, bool bInheritHandle, int dwProcessId);
|
||||||
|
|
||||||
|
[DllImport("kernel32.dll")]
|
||||||
|
public static extern IntPtr OpenProcess(int dwDesiredAccess, bool bInheritHandle, int dwProcessId);
|
||||||
|
|
||||||
[DllImport("kernel32.dll")]
|
[DllImport("kernel32.dll")]
|
||||||
public static extern bool ReadProcessMemory(int hProcess, int lpBaseAddress, byte[] lpBuffer, int dwSize, ref int lpNumberOfBytesRead);
|
public static extern bool ReadProcessMemory(int hProcess, int lpBaseAddress, byte[] lpBuffer, int dwSize, ref int lpNumberOfBytesRead);
|
||||||
|
|
||||||
@ -376,7 +385,7 @@ namespace IW4MAdmin
|
|||||||
[DllImport("kernel32.dll")]
|
[DllImport("kernel32.dll")]
|
||||||
public static extern IntPtr VirtualAllocEx(IntPtr hProcess, IntPtr lpAddress, uint dwSize, AllocationType flAllocationType, MemoryProtection flProtect);
|
public static extern IntPtr VirtualAllocEx(IntPtr hProcess, IntPtr lpAddress, uint dwSize, AllocationType flAllocationType, MemoryProtection flProtect);
|
||||||
|
|
||||||
[DllImport("kernel32.dll")]
|
[DllImport("kernel32.dll", SetLastError = true)]
|
||||||
public static extern IntPtr CreateRemoteThread(IntPtr hProcess, IntPtr lpThreadAttributes, uint dwStackSize, IntPtr lpStartAddress, IntPtr lpParameter, uint dwCreationFlags, out uint lpThreadId);
|
public static extern IntPtr CreateRemoteThread(IntPtr hProcess, IntPtr lpThreadAttributes, uint dwStackSize, IntPtr lpStartAddress, IntPtr lpParameter, uint dwCreationFlags, out uint lpThreadId);
|
||||||
|
|
||||||
[DllImport("kernel32.dll", SetLastError = true, ExactSpelling = true)]
|
[DllImport("kernel32.dll", SetLastError = true, ExactSpelling = true)]
|
||||||
@ -385,15 +394,45 @@ namespace IW4MAdmin
|
|||||||
[DllImport("kernel32.dll", SetLastError = true)]
|
[DllImport("kernel32.dll", SetLastError = true)]
|
||||||
static extern UInt32 WaitForSingleObject(IntPtr hHandle, UInt32 dwMilliseconds);
|
static extern UInt32 WaitForSingleObject(IntPtr hHandle, UInt32 dwMilliseconds);
|
||||||
|
|
||||||
[DllImport("kernel32.dll", SetLastError = true)]
|
[DllImport("kernel32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
|
||||||
static extern IntPtr GetProcAddress(IntPtr hModule, string lpProcName);
|
static extern IntPtr GetProcAddress(IntPtr hModule, string lpProcName);
|
||||||
|
|
||||||
[DllImport("kernel32.dll", SetLastError = true)]
|
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
|
||||||
static extern IntPtr GetModuleHandle(string lpModuleName);
|
static extern IntPtr GetModuleHandle(string lpModuleName);
|
||||||
|
|
||||||
[DllImport("kernel32.dll", SetLastError = true)]
|
[DllImport("kernel32.dll", SetLastError = true)]
|
||||||
static extern int CloseHandle(IntPtr hObject);
|
static extern int CloseHandle(IntPtr hObject);
|
||||||
|
|
||||||
|
[DllImport("ntdll.dll")]
|
||||||
|
public static extern uint RtlCreateUserThread(
|
||||||
|
[In] IntPtr Process,
|
||||||
|
[In] IntPtr ThreadSecurityDescriptor,
|
||||||
|
[In] bool CreateSuspended,
|
||||||
|
[In] int StackZeroBits,
|
||||||
|
uint MaximumStackSize,
|
||||||
|
[In] [Optional] IntPtr InitialStackSize,
|
||||||
|
[In] IntPtr StartAddress,
|
||||||
|
[In] IntPtr Parameter,
|
||||||
|
[Out] out IntPtr Thread,
|
||||||
|
[Out] out ClientId ClientId
|
||||||
|
);
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
public struct ClientId
|
||||||
|
{
|
||||||
|
public ClientId(int processId, int threadId)
|
||||||
|
{
|
||||||
|
this.UniqueProcess = new IntPtr(processId);
|
||||||
|
this.UniqueThread = new IntPtr(threadId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IntPtr UniqueProcess;
|
||||||
|
public IntPtr UniqueThread;
|
||||||
|
|
||||||
|
public int ProcessId { get { return this.UniqueProcess.ToInt32(); } }
|
||||||
|
public int ThreadId { get { return this.UniqueThread.ToInt32(); } }
|
||||||
|
}
|
||||||
|
|
||||||
public static dvar getDvar(int Location, IntPtr Handle)
|
public static dvar getDvar(int Location, IntPtr Handle)
|
||||||
{
|
{
|
||||||
int numberRead = 0;
|
int numberRead = 0;
|
||||||
@ -550,8 +589,10 @@ namespace IW4MAdmin
|
|||||||
|
|
||||||
setDvarCurrentPtr(0x2098D9C, memoryForDvarName, ProcessHandle);
|
setDvarCurrentPtr(0x2098D9C, memoryForDvarName, ProcessHandle);
|
||||||
|
|
||||||
// if (!VirtualFreeEx(ProcessHandle, memoryForDvarName, 0, AllocationType.Release))
|
Utilities.Wait(.3);
|
||||||
// Console.WriteLine("Virtual Free Failed -- Error #" + Marshal.GetLastWin32Error());
|
|
||||||
|
if (!VirtualFreeEx(ProcessHandle, memoryForDvarName, 0, AllocationType.Release))
|
||||||
|
Console.WriteLine("Virtual Free Failed -- Error #" + Marshal.GetLastWin32Error());
|
||||||
|
|
||||||
CloseHandle(ProcessHandle);
|
CloseHandle(ProcessHandle);
|
||||||
|
|
||||||
@ -590,57 +631,88 @@ namespace IW4MAdmin
|
|||||||
String Path = AppDomain.CurrentDomain.BaseDirectory + "lib\\AdminInterface.dll";
|
String Path = AppDomain.CurrentDomain.BaseDirectory + "lib\\AdminInterface.dll";
|
||||||
|
|
||||||
if (!File.Exists(Path))
|
if (!File.Exists(Path))
|
||||||
|
{
|
||||||
|
Console.WriteLine("AdminInterface DLL does not exist!");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
UIntPtr bytesWritten;
|
UIntPtr bytesWritten;
|
||||||
uint threadID;
|
IntPtr threadID;
|
||||||
|
|
||||||
IntPtr ProcessHandle = OpenProcess(ProcessAccessFlags.All, false, pID);
|
IntPtr ProcessHandle = OpenProcess(ProcessAccessFlags.All, false, pID);
|
||||||
|
#if DEBUG
|
||||||
|
Console.WriteLine("Process handle is: " + ProcessHandle);
|
||||||
|
#endif
|
||||||
if (ProcessHandle == IntPtr.Zero)
|
if (ProcessHandle == IntPtr.Zero)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Unable to open target process");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
IntPtr lpLLAddress = GetProcAddress(GetModuleHandle("kernel32.dll"), "LoadLibraryA");
|
IntPtr lpLLAddress = GetProcAddress(GetModuleHandle("kernel32.dll"), "LoadLibraryA");
|
||||||
|
|
||||||
if (lpLLAddress == IntPtr.Zero)
|
if (lpLLAddress == IntPtr.Zero)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Could not obtain address of function address");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
Console.WriteLine("LoadLibraryA location is 0x" + lpLLAddress.ToString("X8"));
|
||||||
|
#endif
|
||||||
|
|
||||||
IntPtr pathAllocation = VirtualAllocEx(ProcessHandle, IntPtr.Zero, (uint)Path.Length + 1, AllocationType.Commit, MemoryProtection.ExecuteReadWrite);
|
IntPtr pathAllocation = VirtualAllocEx(ProcessHandle, IntPtr.Zero, (uint)Path.Length + 1, AllocationType.Commit, MemoryProtection.ExecuteReadWrite);
|
||||||
|
|
||||||
if (pathAllocation == IntPtr.Zero)
|
if (pathAllocation == IntPtr.Zero)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Could not allocate memory for path location");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
#if DEBUG
|
||||||
|
Console.WriteLine("Allocated DLL path address is 0x" + pathAllocation.ToString("X8"));
|
||||||
|
#endif
|
||||||
|
|
||||||
byte[] pathBytes = Encoding.ASCII.GetBytes(Path);
|
byte[] pathBytes = Encoding.ASCII.GetBytes(Path);
|
||||||
|
|
||||||
if (!WriteProcessMemory(ProcessHandle, pathAllocation, pathBytes, (uint)pathBytes.Length, out bytesWritten))
|
if (!WriteProcessMemory(ProcessHandle, pathAllocation, pathBytes, (uint)pathBytes.Length, out bytesWritten))
|
||||||
|
{
|
||||||
|
Console.WriteLine("Could not write process memory");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ClientId clientid = new ClientId();
|
||||||
|
threadID = new IntPtr();
|
||||||
|
RtlCreateUserThread(ProcessHandle, IntPtr.Zero, false, 0, (uint)0, IntPtr.Zero, lpLLAddress, pathAllocation, out threadID, out clientid);
|
||||||
|
|
||||||
if (CreateRemoteThread(ProcessHandle, IntPtr.Zero, 0, lpLLAddress, pathAllocation, 0, out threadID) == IntPtr.Zero)
|
if (threadID == IntPtr.Zero)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Could not create remote thread");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
#if DEBUG
|
||||||
|
//Console.WriteLine("Thread Status is " + threadStatus);
|
||||||
|
Console.WriteLine("Thread ID is " + threadID);
|
||||||
|
#endif
|
||||||
|
uint responseCode = WaitForSingleObject (threadID, 3000);
|
||||||
|
|
||||||
|
if (responseCode != 0x00000000L)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Thread did not finish in a timely manner!");
|
||||||
|
Console.WriteLine("Last error is: " + Marshal.GetLastWin32Error());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!VirtualFreeEx(ProcessHandle, pathAllocation, 0, AllocationType.Decommit))
|
||||||
|
Console.WriteLine("Could not free memory allocated for DLL name");
|
||||||
|
|
||||||
CloseHandle(ProcessHandle);
|
CloseHandle(ProcessHandle);
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
Console.WriteLine("Initialization finished -- last error : " + Marshal.GetLastWin32Error());
|
||||||
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setDvar(int pID, String Name, String Value)
|
|
||||||
{
|
|
||||||
/* IntPtr ProcessHandle = OpenProcess(ProcessAccessFlags.All, false, pID);
|
|
||||||
IntPtr memoryForDvarName = allocateAndWrite(Encoding.ASCII.GetBytes(Name + " " + Value + "\0"), ProcessHandle);
|
|
||||||
|
|
||||||
if (memoryForDvarName == IntPtr.Zero)
|
|
||||||
{
|
|
||||||
Console.WriteLine("UNABLE TO ALLOCATE MEMORY FOR DVAR NAME");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
setDvarCurrentPtr(0x2098D9C, memoryForDvarName, ProcessHandle);
|
|
||||||
|
|
||||||
if (!VirtualFreeEx(ProcessHandle, memoryForDvarName, 0, AllocationType.Release))
|
|
||||||
Console.WriteLine("Virtual Free Failed -- Error #" + Marshal.GetLastWin32Error());
|
|
||||||
|
|
||||||
CloseHandle(ProcessHandle);*/
|
|
||||||
}
|
|
||||||
|
|
||||||
public static dvar getDvar(int pID, String DVAR)
|
public static dvar getDvar(int pID, String DVAR)
|
||||||
{
|
{
|
||||||
dvar requestedDvar = new dvar();
|
dvar requestedDvar = new dvar();
|
||||||
|
3
Admin/app.config
Normal file
3
Admin/app.config
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
Binary file not shown.
@ -11,8 +11,8 @@ Global
|
|||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Debug|Any CPU.ActiveCfg = Release|Any CPU
|
{DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Debug|Any CPU.Build.0 = Release|Any CPU
|
{DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release|Any CPU.Build.0 = Release|Any CPU
|
{DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
|
Loading…
Reference in New Issue
Block a user