Add files via upload
This commit is contained in:
parent
9463c79e9f
commit
61b98ae58d
|
@ -0,0 +1,25 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.28010.2003
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GetPermissionToExec", "GetPermissionToExec\GetPermissionToExec.csproj", "{B56A27A6-563B-4EE9-B179-FC10DA68BE16}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{B56A27A6-563B-4EE9-B179-FC10DA68BE16}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B56A27A6-563B-4EE9-B179-FC10DA68BE16}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B56A27A6-563B-4EE9-B179-FC10DA68BE16}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B56A27A6-563B-4EE9-B179-FC10DA68BE16}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {DEC00797-CA19-4283-B51C-33E953FE439D}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
|
||||
</startup>
|
||||
</configuration>
|
|
@ -0,0 +1,54 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{B56A27A6-563B-4EE9-B179-FC10DA68BE16}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>GetPermissionToExec</RootNamespace>
|
||||
<AssemblyName>FreeGMAssetCompiler</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="MethodInvoker.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
|
@ -0,0 +1,14 @@
|
|||
using System;
|
||||
|
||||
namespace GetPermissionToExec
|
||||
{
|
||||
internal class MethodInvoker
|
||||
{
|
||||
private Func<object> p;
|
||||
|
||||
public MethodInvoker(Func<object> p)
|
||||
{
|
||||
this.p = p;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,116 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace GetPermissionToExec
|
||||
{
|
||||
class Program
|
||||
{
|
||||
|
||||
public enum FileMapProtection : uint
|
||||
{
|
||||
PageReadonly = 0x02,
|
||||
PageReadWrite = 0x04,
|
||||
PageWriteCopy = 0x08,
|
||||
PageExecuteRead = 0x20,
|
||||
PageExecuteReadWrite = 0x40,
|
||||
SectionCommit = 0x8000000,
|
||||
SectionImage = 0x1000000,
|
||||
SectionNoCache = 0x10000000,
|
||||
SectionReserve = 0x4000000,
|
||||
}
|
||||
|
||||
public enum FileMapAccess : uint
|
||||
{
|
||||
FileMapCopy = 0x0001,
|
||||
FileMapWrite = 0x0002,
|
||||
FileMapRead = 0x0004,
|
||||
FileMapReadWrite = 0x0006,
|
||||
FileMapAllAccess = 0x001f,
|
||||
FileMapExecute = 0x0020,
|
||||
}
|
||||
|
||||
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
|
||||
public static extern IntPtr CreateFileMapping(
|
||||
IntPtr hFile,
|
||||
IntPtr lpFileMappingAttributes,
|
||||
FileMapProtection flProtect,
|
||||
uint dwMaximumSizeHigh,
|
||||
uint dwMaximumSizeLow,
|
||||
string lpName
|
||||
);
|
||||
|
||||
[DllImport("kernel32", SetLastError = true)]
|
||||
public static extern IntPtr MapViewOfFile(IntPtr intptr_0, FileMapAccess dwDesiredAccess, int int_5, int int_6, IntPtr intptr_1);
|
||||
|
||||
[DllImport("kernel32", CharSet = CharSet.Auto, SetLastError = true)]
|
||||
public static extern IntPtr OpenFileMapping(
|
||||
FileMapAccess dwDesiredAccess,
|
||||
bool bInheritHandle,
|
||||
string lpName
|
||||
);
|
||||
|
||||
[DllImport("kernel32", SetLastError = true)]
|
||||
public static extern bool CloseHandle(IntPtr intptr_0);
|
||||
|
||||
private static void Main(string[] args)
|
||||
{
|
||||
|
||||
Console.Write("$ GMAssetCompiler ");
|
||||
String Args;
|
||||
if(args.Length == 0)
|
||||
{
|
||||
Stream inputStream = Console.OpenStandardInput(8024);
|
||||
Console.SetIn(new StreamReader(inputStream));
|
||||
Args = Console.ReadLine();
|
||||
}
|
||||
else
|
||||
{
|
||||
Args = String.Join(" ",args);
|
||||
}
|
||||
|
||||
|
||||
|
||||
IntPtr Create = CreateFileMapping(new IntPtr(-1), IntPtr.Zero, FileMapProtection.PageReadWrite, 0x0, 0x1000, "YYMappingFileTestYY");
|
||||
IntPtr DaFile = OpenFileMapping(FileMapAccess.FileMapWrite, false, "YYMappingFileTestYY");
|
||||
IntPtr MapView = MapViewOfFile(DaFile, FileMapAccess.FileMapWrite, 0, 0, new IntPtr(4));
|
||||
|
||||
Marshal.WriteInt32(MapView, (int)(DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds);
|
||||
|
||||
CloseHandle(DaFile);
|
||||
|
||||
Process GMAC = new Process();
|
||||
String AppData = Environment.GetEnvironmentVariable("appdata");
|
||||
GMAC.StartInfo.FileName = AppData+"\\GameMaker-Studio\\GMAssetCompiler.exe";
|
||||
GMAC.StartInfo.UseShellExecute = false;
|
||||
GMAC.StartInfo.RedirectStandardOutput = true;
|
||||
GMAC.StartInfo.RedirectStandardError = true;
|
||||
GMAC.OutputDataReceived += new DataReceivedEventHandler(gmacWrite);
|
||||
GMAC.ErrorDataReceived += new DataReceivedEventHandler(gmacError);
|
||||
GMAC.StartInfo.Arguments = Args;
|
||||
GMAC.Start();
|
||||
GMAC.BeginOutputReadLine();
|
||||
GMAC.BeginErrorReadLine();
|
||||
GMAC.WaitForExit();
|
||||
if(args.Length == 0)
|
||||
{
|
||||
Main(new String[0]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void gmacError(object sender, DataReceivedEventArgs e)
|
||||
{
|
||||
String StdErr = e.Data;
|
||||
Console.WriteLine(StdErr);
|
||||
}
|
||||
|
||||
private static void gmacWrite(object sender, DataReceivedEventArgs e)
|
||||
{
|
||||
String StdOut = e.Data;
|
||||
Console.WriteLine(StdOut);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("GetPermissionToExec")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("GetPermissionToExec")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2018")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("b56a27a6-563b-4ee9-b179-fc10da68be16")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
Loading…
Reference in New Issue