go my file uploader

This commit is contained in:
AirDog46
2025-05-13 19:45:22 +03:00
commit c5fab8aa94
708 changed files with 343216 additions and 0 deletions

View File

@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GenerateZw", "GenerateZw\GenerateZw.csproj", "{10589240-84D9-4935-9868-7FFADB6545F9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{10589240-84D9-4935-9868-7FFADB6545F9}.Debug|x86.ActiveCfg = Debug|x86
{10589240-84D9-4935-9868-7FFADB6545F9}.Debug|x86.Build.0 = Debug|x86
{10589240-84D9-4935-9868-7FFADB6545F9}.Release|x86.ActiveCfg = Release|x86
{10589240-84D9-4935-9868-7FFADB6545F9}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{10589240-84D9-4935-9868-7FFADB6545F9}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>GenerateZw</RootNamespace>
<AssemblyName>GenerateZw</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</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|x86' ">
<PlatformTarget>x86</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.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ZwGen.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace GenerateZw
{
class Program
{
static void Main(string[] args)
{
ZwGen gen = new ZwGen();
string configFile = args.Length > 0 ? args[0] : "options.txt";
try
{
gen.LoadConfig(configFile);
gen.Execute();
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
}
}
}

View File

@@ -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("GenerateZw")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GenerateZw")]
[assembly: AssemblyCopyright("Copyright © 2010")]
[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("db557e10-0bf4-4a74-b8b4-ade1faa91177")]
// 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")]

View File

@@ -0,0 +1,123 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Text.RegularExpressions;
namespace GenerateZw
{
class ServiceDefinition
{
public string Name;
public string Text;
public int NameIndex;
}
class ServiceDefinitionComparer : IEqualityComparer<ServiceDefinition>
{
public bool Equals(ServiceDefinition x, ServiceDefinition y)
{
return string.Equals(x.Name, y.Name);
}
public int GetHashCode(ServiceDefinition obj)
{
return obj.Name.GetHashCode();
}
}
class ZwGen
{
private string _baseDirectory;
private string[] _files;
private string _outputFile;
private string _header = "";
private string _footer = "";
private List<ServiceDefinition> _defs;
private string UnEscape(string text)
{
return text.Replace("\\r", "\r").Replace("\\n", "\n").Replace("\\\\", "\\");
}
public void LoadConfig(string fileName)
{
string[] lines = File.ReadAllLines(fileName);
foreach (string line in lines)
{
string[] split = line.Split(new char[] { '=' }, 2);
switch (split[0])
{
case "base":
_baseDirectory = split[1];
break;
case "in":
_files = split[1].Split(';');
break;
case "out":
_outputFile = split[1];
break;
case "header":
_header = UnEscape(split[1]);
break;
case "footer":
_footer = UnEscape(split[1]);
break;
}
}
}
private void Parse(string text)
{
Regex regex = new Regex(@"NTSYSCALLAPI[\w\s_]*NTAPI\s*(Nt(\w)*)\(.*?\);", RegexOptions.Compiled | RegexOptions.Singleline);
MatchCollection matches;
matches = regex.Matches(text);
foreach (Match match in matches)
{
_defs.Add(new ServiceDefinition() { Name = match.Groups[1].Value, Text = match.Value, NameIndex = match.Groups[1].Index - match.Index });
}
}
public void Execute()
{
// Build up a list of definitions.
_defs = new List<ServiceDefinition>();
foreach (string fileName in _files)
Parse(File.ReadAllText(_baseDirectory + "\\" + fileName));
StreamWriter sw = new StreamWriter(_baseDirectory + "\\" + _outputFile);
// Remove duplicates and sort.
_defs = new List<ServiceDefinition>(_defs.Distinct(new ServiceDefinitionComparer()));
_defs.Sort((x, y) => string.CompareOrdinal(x.Name, y.Name));
// Header
sw.Write(_header);
// Definitions
foreach (var d in _defs)
{
Console.WriteLine("System service: " + d.Name);
// Write the original definition, replacing "Nt" with "Zw".
sw.Write(d.Text.Substring(0, d.NameIndex) + "Zw" + d.Text.Substring(d.NameIndex + 2) + "\r\n\r\n");
}
// Footer
sw.Write(_footer);
sw.Close();
}
}
}

Binary file not shown.