I_Jemin

Initiating

Showing 308 changed files with 4763 additions and 251 deletions
1 -## Ignore Visual Studio temporary files, build results, and 1 +## Ignore Mac Temp file
2 -## files generated by popular Visual Studio add-ons. 2 +*.DS_Store
3 +*.icloud
3 4
4 -# User-specific files 5 +## Ignore Previous SVN records
5 -*.suo 6 +*.svn
6 -*.user
7 -*.userosscache
8 -*.sln.docstates
9 -
10 -# User-specific files (MonoDevelop/Xamarin Studio)
11 -*.userprefs
12 -
13 -# Build results
14 -[Dd]ebug/
15 -[Dd]ebugPublic/
16 -[Rr]elease/
17 -[Rr]eleases/
18 -x64/
19 -x86/
20 -bld/
21 -[Bb]in/
22 -[Oo]bj/
23 -[Ll]og/
24 -
25 -# Visual Studio 2015 cache/options directory
26 -.vs/
27 -# Uncomment if you have tasks that create the project's static files in wwwroot
28 -#wwwroot/
29 -
30 -# MSTest test Results
31 -[Tt]est[Rr]esult*/
32 -[Bb]uild[Ll]og.*
33 -
34 -# NUNIT
35 -*.VisualState.xml
36 -TestResult.xml
37 -
38 -# Build Results of an ATL Project
39 -[Dd]ebugPS/
40 -[Rr]eleasePS/
41 -dlldata.c
42 -
43 -# DNX
44 -project.lock.json
45 -artifacts/
46 -
47 -*_i.c
48 -*_p.c
49 -*_i.h
50 -*.ilk
51 -*.meta
52 -*.obj
53 -*.pch
54 -*.pdb
55 -*.pgc
56 -*.pgd
57 -*.rsp
58 -*.sbr
59 -*.tlb
60 -*.tli
61 -*.tlh
62 -*.tmp
63 -*.tmp_proj
64 -*.log
65 -*.vspscc
66 -*.vssscc
67 -.builds
68 -*.pidb
69 -*.svclog
70 -*.scc
71 -
72 -# Chutzpah Test files
73 -_Chutzpah*
74 -
75 -# Visual C++ cache files
76 -ipch/
77 -*.aps
78 -*.ncb
79 -*.opendb
80 -*.opensdf
81 -*.sdf
82 -*.cachefile
83 -*.VC.db
84 -*.VC.VC.opendb
85 -
86 -# Visual Studio profiler
87 -*.psess
88 -*.vsp
89 -*.vspx
90 -*.sap
91 -
92 -# TFS 2012 Local Workspace
93 -$tf/
94 -
95 -# Guidance Automation Toolkit
96 -*.gpState
97 -
98 -# ReSharper is a .NET coding add-in
99 -_ReSharper*/
100 -*.[Rr]e[Ss]harper
101 -*.DotSettings.user
102 -
103 -# JustCode is a .NET coding add-in
104 -.JustCode
105 -
106 -# TeamCity is a build add-in
107 -_TeamCity*
108 -
109 -# DotCover is a Code Coverage Tool
110 -*.dotCover
111 -
112 -# NCrunch
113 -_NCrunch_*
114 -.*crunch*.local.xml
115 -nCrunchTemp_*
116 -
117 -# MightyMoose
118 -*.mm.*
119 -AutoTest.Net/
120 -
121 -# Web workbench (sass)
122 -.sass-cache/
123 -
124 -# Installshield output folder
125 -[Ee]xpress/
126 -
127 -# DocProject is a documentation generator add-in
128 -DocProject/buildhelp/
129 -DocProject/Help/*.HxT
130 -DocProject/Help/*.HxC
131 -DocProject/Help/*.hhc
132 -DocProject/Help/*.hhk
133 -DocProject/Help/*.hhp
134 -DocProject/Help/Html2
135 -DocProject/Help/html
136 -
137 -# Click-Once directory
138 -publish/
139 -
140 -# Publish Web Output
141 -*.[Pp]ublish.xml
142 -*.azurePubxml
143 -# TODO: Comment the next line if you want to checkin your web deploy settings
144 -# but database connection strings (with potential passwords) will be unencrypted
145 -*.pubxml
146 -*.publishproj
147 -
148 -# Microsoft Azure Web App publish settings. Comment the next line if you want to
149 -# checkin your Azure Web App publish settings, but sensitive information contained
150 -# in these scripts will be unencrypted
151 -PublishScripts/
152 -
153 -# NuGet Packages
154 -*.nupkg
155 -# The packages folder can be ignored because of Package Restore
156 -**/packages/*
157 -# except build/, which is used as an MSBuild target.
158 -!**/packages/build/
159 -# Uncomment if necessary however generally it will be regenerated when needed
160 -#!**/packages/repositories.config
161 -# NuGet v3's project.json files produces more ignoreable files
162 -*.nuget.props
163 -*.nuget.targets
164 -
165 -# Microsoft Azure Build Output
166 -csx/
167 -*.build.csdef
168 -
169 -# Microsoft Azure Emulator
170 -ecf/
171 -rcf/
172 -
173 -# Windows Store app package directories and files
174 -AppPackages/
175 -BundleArtifacts/
176 -Package.StoreAssociation.xml
177 -_pkginfo.txt
178 -
179 -# Visual Studio cache files
180 -# files ending in .cache can be ignored
181 -*.[Cc]ache
182 -# but keep track of directories ending in .cache
183 -!*.[Cc]ache/
184 -
185 -# Others
186 -ClientBin/
187 -~$*
188 -*~
189 -*.dbmdl
190 -*.dbproj.schemaview
191 -*.pfx
192 -*.publishsettings
193 -node_modules/
194 -orleans.codegen.cs
195 -
196 -# Since there are multiple workflows, uncomment next line to ignore bower_components
197 -# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
198 -#bower_components/
199 -
200 -# RIA/Silverlight projects
201 -Generated_Code/
202 -
203 -# Backup & report files from converting an old project file
204 -# to a newer Visual Studio version. Backup files are not needed,
205 -# because we have git ;-)
206 -_UpgradeReport_Files/
207 -Backup*/
208 -UpgradeLog*.XML
209 -UpgradeLog*.htm
210 -
211 -# SQL Server files
212 -*.mdf
213 -*.ldf
214 -
215 -# Business Intelligence projects
216 -*.rdl.data
217 -*.bim.layout
218 -*.bim_*.settings
219 -
220 -# Microsoft Fakes
221 -FakesAssemblies/
222 -
223 -# GhostDoc plugin setting file
224 -*.GhostDoc.xml
225 -
226 -# Node.js Tools for Visual Studio
227 -.ntvs_analysis.dat
228 -
229 -# Visual Studio 6 build log
230 -*.plg
231 -
232 -# Visual Studio 6 workspace options file
233 -*.opt
234 -
235 -# Visual Studio LightSwitch build output
236 -**/*.HTMLClient/GeneratedArtifacts
237 -**/*.DesktopClient/GeneratedArtifacts
238 -**/*.DesktopClient/ModelManifest.xml
239 -**/*.Server/GeneratedArtifacts
240 -**/*.Server/ModelManifest.xml
241 -_Pvt_Extensions
242 -
243 -# Paket dependency manager
244 -.paket/paket.exe
245 -paket-files/
246 -
247 -# FAKE - F# Make
248 -.fake/
249 -
250 -# JetBrains Rider
251 -.idea/
252 -*.sln.iml
...\ No newline at end of file ...\ No newline at end of file
......
1 +
2 +Microsoft Visual Studio Solution File, Format Version 11.00
3 +# Visual Studio 2010
4 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HelloITH", "HelloITH\HelloITH.vcxproj", "{4DC93C7D-B6B3-46F8-BB98-2C01279C8075}"
5 +EndProject
6 +Global
7 + GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 + Debug|Win32 = Debug|Win32
9 + Release|Win32 = Release|Win32
10 + EndGlobalSection
11 + GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 + {4DC93C7D-B6B3-46F8-BB98-2C01279C8075}.Debug|Win32.ActiveCfg = Debug|Win32
13 + {4DC93C7D-B6B3-46F8-BB98-2C01279C8075}.Debug|Win32.Build.0 = Debug|Win32
14 + {4DC93C7D-B6B3-46F8-BB98-2C01279C8075}.Release|Win32.ActiveCfg = Release|Win32
15 + {4DC93C7D-B6B3-46F8-BB98-2C01279C8075}.Release|Win32.Build.0 = Release|Win32
16 + EndGlobalSection
17 + GlobalSection(SolutionProperties) = preSolution
18 + HideSolutionNode = FALSE
19 + EndGlobalSection
20 +EndGlobal
No preview for this file type
No preview for this file type
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 + <ItemGroup Label="ProjectConfigurations">
4 + <ProjectConfiguration Include="Debug|Win32">
5 + <Configuration>Debug</Configuration>
6 + <Platform>Win32</Platform>
7 + </ProjectConfiguration>
8 + <ProjectConfiguration Include="Release|Win32">
9 + <Configuration>Release</Configuration>
10 + <Platform>Win32</Platform>
11 + </ProjectConfiguration>
12 + </ItemGroup>
13 + <PropertyGroup Label="Globals">
14 + <ProjectGuid>{4DC93C7D-B6B3-46F8-BB98-2C01279C8075}</ProjectGuid>
15 + <Keyword>Win32Proj</Keyword>
16 + <RootNamespace>HelloITH</RootNamespace>
17 + </PropertyGroup>
18 + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
19 + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
20 + <ConfigurationType>Application</ConfigurationType>
21 + <UseDebugLibraries>true</UseDebugLibraries>
22 + <CharacterSet>Unicode</CharacterSet>
23 + </PropertyGroup>
24 + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
25 + <ConfigurationType>Application</ConfigurationType>
26 + <UseDebugLibraries>false</UseDebugLibraries>
27 + <WholeProgramOptimization>true</WholeProgramOptimization>
28 + <CharacterSet>Unicode</CharacterSet>
29 + </PropertyGroup>
30 + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
31 + <ImportGroup Label="ExtensionSettings">
32 + </ImportGroup>
33 + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
34 + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
35 + </ImportGroup>
36 + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
37 + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
38 + </ImportGroup>
39 + <PropertyGroup Label="UserMacros" />
40 + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
41 + <LinkIncremental>true</LinkIncremental>
42 + <IncludePath>$(SolutionDir)include;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;</IncludePath>
43 + <LibraryPath>$(SolutionDir)libs;$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSdkDir)lib;$(FrameworkSDKDir)\lib</LibraryPath>
44 + </PropertyGroup>
45 + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
46 + <LinkIncremental>false</LinkIncremental>
47 + <IncludePath>$(SolutionDir)include;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;</IncludePath>
48 + <LibraryPath>$(SolutionDir)libs;$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSdkDir)lib;$(FrameworkSDKDir)\lib</LibraryPath>
49 + </PropertyGroup>
50 + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
51 + <ClCompile>
52 + <PrecompiledHeader>
53 + </PrecompiledHeader>
54 + <WarningLevel>Level3</WarningLevel>
55 + <Optimization>Disabled</Optimization>
56 + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
57 + </ClCompile>
58 + <Link>
59 + <SubSystem>Console</SubSystem>
60 + <GenerateDebugInformation>true</GenerateDebugInformation>
61 + <AdditionalDependencies>IHF.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
62 + </Link>
63 + </ItemDefinitionGroup>
64 + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
65 + <ClCompile>
66 + <WarningLevel>Level3</WarningLevel>
67 + <PrecompiledHeader>
68 + </PrecompiledHeader>
69 + <Optimization>MaxSpeed</Optimization>
70 + <FunctionLevelLinking>true</FunctionLevelLinking>
71 + <IntrinsicFunctions>true</IntrinsicFunctions>
72 + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
73 + </ClCompile>
74 + <Link>
75 + <SubSystem>Console</SubSystem>
76 + <GenerateDebugInformation>true</GenerateDebugInformation>
77 + <EnableCOMDATFolding>true</EnableCOMDATFolding>
78 + <OptimizeReferences>true</OptimizeReferences>
79 + <AdditionalDependencies>ihf.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
80 + </Link>
81 + </ItemDefinitionGroup>
82 + <ItemGroup>
83 + <ClCompile Include="main.cpp" />
84 + </ItemGroup>
85 + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
86 + <ImportGroup Label="ExtensionTargets">
87 + </ImportGroup>
88 +</Project>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 + <ItemGroup>
4 + <Filter Include="Source Files">
5 + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
6 + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
7 + </Filter>
8 + <Filter Include="Header Files">
9 + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
10 + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
11 + </Filter>
12 + <Filter Include="Resource Files">
13 + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
14 + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
15 + </Filter>
16 + </ItemGroup>
17 + <ItemGroup>
18 + <ClCompile Include="main.cpp">
19 + <Filter>Source Files</Filter>
20 + </ClCompile>
21 + </ItemGroup>
22 +</Project>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 +</Project>
...\ No newline at end of file ...\ No newline at end of file
1 +//Prevent ITH overide operator new.
2 +#define DEFAULT_MM
3 +
4 +#include <ITH\IHF.h>
5 +#include <stdio.h>
6 +static HookManager* man;
7 +DWORD ProcessAttach(DWORD pid)
8 +{
9 + printf("Process %d attached.\n",pid);
10 + return 0;
11 +}
12 +DWORD ProcessDetach(DWORD pid)
13 +{
14 + printf("Process %d detached.\n",pid);
15 + return 0;
16 +}
17 +DWORD ProcessNewHook(DWORD pid)
18 +{
19 + printf("Process %d has new hook inserted.\n",pid);
20 + return 0;
21 +}
22 +DWORD ThreadOutput(TextThread* t, BYTE* data,DWORD len, DWORD new_line, PVOID user_data)
23 +{
24 + printf("Thread %.4X output. len = %d, new_line = %d, user_data = %.8X\n",
25 + t->Number(),len,new_line,user_data);
26 + if (len <= 2)
27 + {
28 + //Single character.
29 + printf("Data: %.2X",data[0]);
30 + if (len == 2) printf(" %.2X",data[1]);
31 + printf("\n");
32 + }
33 + else
34 + {
35 + printf("Data:\n");
36 + for (DWORD i = 0; i < len; i++)
37 + {
38 + printf("%.2X ",data[i]);
39 + if ((i & 0xF) == 0xF) printf("\n");
40 + }
41 + }
42 + return len;
43 +}
44 +DWORD ThreadCreate(TextThread* t)
45 +{
46 + printf("New thread created.\n");
47 + ThreadParameter* tp = t->GetThreadParameter();
48 + printf("%.4x:%.4x:%.8X:%.8X:%.8X\n",t->Number(),tp->pid,tp->hook,tp->retn,tp->spl);
49 + //Set output callback. This function is called when some text is dispatched to thread 't'.
50 + //It's possible to set different callback for different thread.
51 + t->RegisterOutputCallBack(ThreadOutput,0);
52 + return 0;
53 +}
54 +int main(int argc, char** argv)
55 +{
56 + //__debugbreak();
57 + HANDLE running = OpenMutex(MUTEX_ALL_ACCESS, FALSE, L"ITH_MAIN_RUNNING");
58 + if (running != 0 || GetLastError() != ERROR_FILE_NOT_FOUND)
59 + {
60 + //There's another instance of ITH running in the system.
61 + CloseHandle(running);
62 + return 1;
63 + }
64 + if (IHF_Init())
65 + {
66 + IHF_GetHookManager(&man);
67 + if (man)
68 + {
69 + man->RegisterProcessAttachCallback(ProcessAttach);
70 + man->RegisterProcessDetachCallback(ProcessDetach);
71 + man->RegisterProcessNewHookCallback(ProcessNewHook);
72 + man->RegisterThreadCreateCallback(ThreadCreate);
73 + IHF_Start();//IHF started functioning.
74 + DWORD inject_pid;
75 + printf("Enter pid to inject:\n");
76 + scanf("%d",&inject_pid);
77 + getchar(); //Get the last linebreak.
78 + IHF_InjectByPID(inject_pid, 0); //Use default engine.
79 + getchar(); //Wait till any key.
80 + IHF_ActiveDetachProcess(inject_pid);
81 + }
82 + IHF_Cleanup();
83 + }
84 + else
85 + {
86 + //There's another program using IHF running in the system.
87 + return 1;
88 + }
89 + //Sometimes the system create extra threads. Simply return from here doesn't shutdown the process.
90 + //Even ExitProcess may fail. TerminateProcess is considered to be safer.
91 + return 0;
92 +}
...\ No newline at end of file ...\ No newline at end of file
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
This diff is collapsed. Click to expand it.
1 +/* Copyright (C) 2010-2012 kaosu (qiupf2000@gmail.com)
2 + * This file is part of the Interactive Text Hooker.
3 +
4 + * Interactive Text Hooker is free software: you can redistribute it and/or
5 + * modify it under the terms of the GNU General Public License as published
6 + * by the Free Software Foundation, either version 3 of the License, or
7 + * (at your option) any later version.
8 +
9 + * This program is distributed in the hope that it will be useful,
10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 + * GNU General Public License for more details.
13 +
14 + * You should have received a copy of the GNU General Public License
15 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 + */
17 +
18 +#pragma once
19 +class BitMap
20 +{
21 +public:
22 + BitMap();
23 + BitMap(unsigned long init_size);
24 + ~BitMap();
25 + bool Check(unsigned long number);
26 + void Set(unsigned long number);
27 + void Reset();
28 + void Clear(unsigned long number);
29 +protected:
30 + unsigned char* map;
31 + unsigned long size;
32 +};
...\ No newline at end of file ...\ No newline at end of file
1 +/* Copyright (C) 2010-2012 kaosu (qiupf2000@gmail.com)
2 + * This file is part of the Interactive Text Hooker.
3 +
4 + * Interactive Text Hooker is free software: you can redistribute it and/or
5 + * modify it under the terms of the GNU General Public License as published
6 + * by the Free Software Foundation, either version 3 of the License, or
7 + * (at your option) any later version.
8 +
9 + * This program is distributed in the hope that it will be useful,
10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 + * GNU General Public License for more details.
13 +
14 + * You should have received a copy of the GNU General Public License
15 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 + */
17 +
18 +#pragma once
19 +#include <windows.h>
20 +#include <ITH\BitMap.h>
21 +typedef void (*CustomFilterCallBack) (WORD, PVOID);
22 +
23 +class CustomFilterUnicode : public BitMap
24 +{
25 +public:
26 + CustomFilterUnicode();
27 + ~CustomFilterUnicode();
28 + bool Check(WORD number);
29 + void Set(WORD number);
30 + void Clear(WORD number);
31 + void Traverse(CustomFilterCallBack callback, PVOID param);
32 +
33 +};
34 +
35 +class CustomFilterMultiByte : public BitMap
36 +{
37 +public:
38 + CustomFilterMultiByte();
39 + ~CustomFilterMultiByte();
40 + bool Check(WORD number);
41 + void Set(WORD number);
42 + void Clear(WORD number);
43 + void Reset();
44 + void Traverse(CustomFilterCallBack callback, PVOID param);
45 +private:
46 + BYTE ascii_map[0x20];
47 +};
...\ No newline at end of file ...\ No newline at end of file
1 +/* Copyright (C) 2010-2012 kaosu (qiupf2000@gmail.com)
2 + * This file is part of the Interactive Text Hooker.
3 +
4 + * Interactive Text Hooker is free software: you can redistribute it and/or
5 + * modify it under the terms of the GNU General Public License as published
6 + * by the Free Software Foundation, either version 3 of the License, or
7 + * (at your option) any later version.
8 +
9 + * This program is distributed in the hope that it will be useful,
10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 + * GNU General Public License for more details.
13 +
14 + * You should have received a copy of the GNU General Public License
15 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 + */
17 +
18 +#pragma once
19 +#include <memory.h>
20 +#include <intrin.h>
21 +
22 +#define HASH_SIZE_MD5 0x10
23 +#define HASH_BLOCK_MD5 0x40
24 +struct MD5_Context
25 +{
26 + union{
27 + unsigned __int64 len;
28 + struct {
29 + unsigned int len_low,len_high;
30 + };
31 + };
32 + unsigned int h0,h1,h2,h3;
33 + unsigned int remain_len;
34 + unsigned char remain[0x40];
35 +}; //0x5C
36 +
37 +void HashMD5Block(void* block, MD5_Context* ctx);
38 +void HashMD5(void* msg, unsigned int len, void* hash);
39 +void HashMD5Init(MD5_Context* ctx);
40 +void HashMD5Update(MD5_Context* ctx, void* msg, int len);
41 +void HashMD5Final(MD5_Context* ctx, void* hash);
42 +
43 +#define HASH_SIZE_SHA1 0x14
44 +#define HASH_BLOCK_SHA1 0x40
45 +struct SHA1_Context
46 +{
47 + union{
48 + unsigned __int64 len;
49 + struct {
50 + unsigned int len_low,len_high;
51 + };
52 + };
53 + unsigned int h0,h1,h2,h3,h4;
54 + unsigned int remain_len;
55 + unsigned char remain[0x40];
56 +}; //0x60
57 +
58 +void HashSHA1Block(void* block, SHA1_Context* ctx);
59 +void HashSHA1(void* msg, unsigned int len, void* hash);
60 +void HashSHA1Init(SHA1_Context* ctx);
61 +void HashSHA1Update(SHA1_Context* ctx, void* msg, int len);
62 +void HashSHA1Final(SHA1_Context* ctx, void* hash);
63 +
64 +#define HASH_SIZE_SHA256 32
65 +#define HASH_BLOCK_SHA256 0x40
66 +struct SHA256_Context
67 +{
68 + union{
69 + unsigned __int64 len;
70 + struct {
71 + unsigned int len_low,len_high;
72 + };
73 + };
74 + unsigned int h0,h1,h2,h3,h4,h5,h6,h7;
75 + unsigned int remain_len;
76 + unsigned char remain[0x40];
77 +}; //0x6C
78 +
79 +void HashSHA256Block(void* block, SHA256_Context* ctx);
80 +void HashSHA256(void* msg, unsigned int len, void* hash);
81 +void HashSHA256Init(SHA256_Context* ctx);
82 +void HashSHA256Update(SHA256_Context* ctx, void* msg, int len);
83 +void HashSHA256Final(SHA256_Context* ctx, void* hash);
84 +
85 +#ifndef ITH_TLS_HASH_CALC
86 +#define ITH_TLS_HASH_CALC
87 +class HashCalculator
88 +{
89 +public:
90 + HashCalculator() {}
91 + virtual ~HashCalculator() {}
92 + virtual void HashInit() {}
93 + virtual void HashUpdate(void* msg, int len) {}
94 + virtual void HashFinal(void* hash) {}
95 + virtual int HashValueSize() const {return 0;}
96 + virtual int HashBlockSize() const {return 0;}
97 +};
98 +
99 +enum HashType
100 +{
101 + HashTypeMD5 = 0,
102 + HashTypeSHA1,
103 + HashTypeSHA256
104 +};
105 +#endif
106 +
107 +class MD5Calc : public HashCalculator
108 +{
109 +public:
110 + MD5Calc();
111 + virtual ~MD5Calc();
112 + virtual void HashInit();
113 + virtual void HashUpdate(void* msg, int len);
114 + virtual void HashFinal(void* hash);
115 + virtual int HashValueSize() const;
116 + virtual int HashBlockSize() const;
117 +private:
118 + MD5_Context ctx;
119 +};
120 +
121 +class SHA1Calc : public HashCalculator
122 +{
123 +public:
124 + SHA1Calc();
125 + virtual ~SHA1Calc();
126 + virtual void HashInit();
127 + virtual void HashUpdate(void* msg, int len);
128 + virtual void HashFinal(void* hash);
129 + virtual int HashValueSize() const;
130 + virtual int HashBlockSize() const;
131 +private:
132 + SHA1_Context ctx;
133 +};
134 +
135 +class SHA256Calc : public HashCalculator
136 +{
137 +public:
138 + SHA256Calc();
139 + virtual ~SHA256Calc();
140 + virtual void HashInit();
141 + virtual void HashUpdate(void* msg, int len);
142 + virtual void HashFinal(void* hash);
143 + virtual int HashValueSize() const;
144 + virtual int HashBlockSize() const;
145 +private:
146 + SHA256_Context ctx;
147 +};
1 +/* Copyright (C) 2010-2012 kaosu (qiupf2000@gmail.com)
2 + * This file is part of the Interactive Text Hooker.
3 +
4 + * Interactive Text Hooker is free software: you can redistribute it and/or
5 + * modify it under the terms of the GNU General Public License as published
6 + * by the Free Software Foundation, either version 3 of the License, or
7 + * (at your option) any later version.
8 +
9 + * This program is distributed in the hope that it will be useful,
10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 + * GNU General Public License for more details.
13 +
14 + * You should have received a copy of the GNU General Public License
15 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 + */
17 +
18 +#pragma once
19 +#include <ITH\TextThread.h>
20 +#include <ITH\AVL.h>
21 +
22 +#define MAX_REGISTER 0xF
23 +#define MAX_PREV_REPEAT_LENGTH 0x20
24 +struct ProcessRecord {
25 + DWORD pid_register;
26 + DWORD hookman_register;
27 + DWORD module_register;
28 + DWORD engine_register;
29 + HANDLE process_handle;
30 + HANDLE hookman_mutex;
31 + HANDLE hookman_section;
32 + LPVOID hookman_map;
33 +};
34 +
35 +class ThreadTable : public MyVector<TextThread*,0x40>
36 +{
37 +public:
38 + virtual void SetThread(DWORD number, TextThread* ptr);
39 + virtual TextThread* FindThread(DWORD number);
40 +};
41 +class TCmp
42 +{
43 +public:
44 + char operator()(const ThreadParameter* t1,const ThreadParameter* t2);
45 +};
46 +class TCpy
47 +{
48 +public:
49 + void operator()(ThreadParameter* t1,const ThreadParameter* t2);
50 +};
51 +class TLen
52 +{
53 +public:
54 + int operator()(const ThreadParameter* t);
55 +};
56 +typedef DWORD (*ProcessEventCallback)(DWORD pid);
57 +class HookManager : public AVLTree<ThreadParameter,DWORD,TCmp,TCpy,TLen>
58 +{
59 +public:
60 + HookManager();
61 + ~HookManager();
62 + virtual TextThread* FindSingle(DWORD pid, DWORD hook, DWORD retn, DWORD split);
63 + virtual TextThread* FindSingle(DWORD number);
64 + virtual ProcessRecord* GetProcessRecord(DWORD pid);
65 + virtual DWORD GetProcessIDByPath(LPWSTR str);
66 + virtual void RemoveSingleThread(DWORD number);
67 + virtual void LockHookman();
68 + virtual void UnlockHookman();
69 + virtual void ResetRepeatStatus();
70 + virtual void ClearCurrent();
71 + virtual void AddLink(WORD from, WORD to);
72 + virtual void UnLink(WORD from);
73 + virtual void UnLinkAll(WORD from);
74 + virtual void SelectCurrent(DWORD num);
75 + virtual void DetachProcess(DWORD pid);
76 + virtual void SetCurrent(TextThread* it);
77 + virtual void AddConsoleOutput(LPCWSTR text);
78 +
79 + void DispatchText(DWORD pid, BYTE* text, DWORD hook, DWORD retn, DWORD split, int len);
80 + void ClearText(DWORD pid, DWORD hook, DWORD retn, DWORD split);
81 + void RemoveProcessContext(DWORD pid);
82 + void RemoveSingleHook(DWORD pid, DWORD addr);
83 + void RegisterThread(TextThread*, DWORD);
84 + void RegisterPipe(HANDLE text, HANDLE cmd, HANDLE thread);
85 + void RegisterProcess(DWORD pid, DWORD hookman, DWORD module, DWORD engine);
86 + void UnRegisterProcess(DWORD pid);
87 + void SetName(DWORD);
88 +
89 + DWORD GetCurrentPID();
90 + HANDLE GetCmdHandleByPID(DWORD pid);
91 +
92 + inline ThreadEventCallback RegisterThreadCreateCallback(ThreadEventCallback cf)
93 + {
94 + return (ThreadEventCallback)_InterlockedExchange((long*)&create,(long)cf);
95 + }
96 + inline ThreadEventCallback RegisterThreadRemoveCallback(ThreadEventCallback cf)
97 + {
98 + return (ThreadEventCallback)_InterlockedExchange((long*)&remove,(long)cf);
99 + }
100 + inline ThreadEventCallback RegisterThreadResetCallback(ThreadEventCallback cf)
101 + {
102 + return (ThreadEventCallback)_InterlockedExchange((long*)&reset,(long)cf);
103 + }
104 + inline ProcessEventCallback RegisterProcessAttachCallback(ProcessEventCallback cf)
105 + {
106 + return (ProcessEventCallback)_InterlockedExchange((long*)&attach,(long)cf);
107 + }
108 + inline ProcessEventCallback RegisterProcessDetachCallback(ProcessEventCallback cf)
109 + {
110 + return (ProcessEventCallback)_InterlockedExchange((long*)&detach,(long)cf);
111 + }
112 + inline ProcessEventCallback RegisterProcessNewHookCallback(ProcessEventCallback cf)
113 + {
114 + return (ProcessEventCallback)_InterlockedExchange((long*)&hook,(long)cf);
115 + }
116 + inline ProcessEventCallback ProcessNewHook() {return hook;}
117 + inline TextThread* GetCurrentThread() {return current;}
118 + inline ProcessRecord* Records() {return record;}
119 + inline ThreadTable* Table() {return thread_table;}
120 + /*inline DWORD& SplitTime() {return split_time;}
121 + inline DWORD& RepeatCount() {return repeat_count;}
122 + inline DWORD& CyclicRemove() {return cyclic_remove;}
123 + inline DWORD& GlobalFilter() {return global_filter;}*/
124 +private:
125 +
126 + CRITICAL_SECTION hmcs;
127 + TextThread *current;
128 + ThreadEventCallback create,remove,reset;
129 + ProcessEventCallback attach,detach,hook;
130 + DWORD current_pid;
131 + ThreadTable *thread_table;
132 + HANDLE destroy_event;
133 + ProcessRecord record[MAX_REGISTER+1];
134 + HANDLE text_pipes[MAX_REGISTER+1];
135 + HANDLE cmd_pipes[MAX_REGISTER+1];
136 + HANDLE recv_threads[MAX_REGISTER+1];
137 + WORD register_count, new_thread_number;
138 +};
139 +
1 +/* Copyright (C) 2010-2012 kaosu (qiupf2000@gmail.com)
2 + * This file is part of the Interactive Text Hooker.
3 +
4 + * Interactive Text Hooker is free software: you can redistribute it and/or
5 + * modify it under the terms of the GNU General Public License as published
6 + * by the Free Software Foundation, either version 3 of the License, or
7 + * (at your option) any later version.
8 +
9 + * This program is distributed in the hope that it will be useful,
10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 + * GNU General Public License for more details.
13 +
14 + * You should have received a copy of the GNU General Public License
15 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 + */
17 +
18 +#pragma once
19 +#include <ITH\HookManager.h>
20 +#define IHFAPI __stdcall
21 +#ifdef IHF
22 + #define IHFSERVICE __declspec(dllexport)
23 +#else
24 + #define IHFSERVICE __declspec(dllimport)
25 +#endif
26 +#define ITH_DEFAULT_ENGINE 0
27 +
28 +extern "C" {
29 + IHFSERVICE DWORD IHFAPI IHF_Init();
30 + IHFSERVICE DWORD IHFAPI IHF_Start();
31 + IHFSERVICE DWORD IHFAPI IHF_Cleanup();
32 + IHFSERVICE DWORD IHFAPI IHF_GetPIDByName(LPWSTR pwcTarget);
33 + IHFSERVICE DWORD IHFAPI IHF_InjectByPID(DWORD pid, LPWSTR engine);
34 + IHFSERVICE DWORD IHFAPI IHF_ActiveDetachProcess(DWORD pid);
35 + IHFSERVICE DWORD IHFAPI IHF_GetHookManager(HookManager** hookman);
36 + IHFSERVICE DWORD IHFAPI IHF_GetSettingManager(SettingManager** set_man);
37 + IHFSERVICE DWORD IHFAPI IHF_InsertHook(DWORD pid, HookParam* hp, LPWSTR name = 0);
38 + IHFSERVICE DWORD IHFAPI IHF_ModifyHook(DWORD pid, HookParam* hp);
39 + IHFSERVICE DWORD IHFAPI IHF_RemoveHook(DWORD pid, DWORD addr);
40 + IHFSERVICE DWORD IHFAPI IHF_IsAdmin();
41 + //IHFSERVICE DWORD IHFAPI IHF_GetFilters(PVOID* mb_filter, PVOID* uni_filter);
42 + IHFSERVICE DWORD IHFAPI IHF_AddLink(DWORD from, DWORD to);
43 + IHFSERVICE DWORD IHFAPI IHF_UnLink(DWORD from);
44 + IHFSERVICE DWORD IHFAPI IHF_UnLinkAll(DWORD from);
45 +}
...\ No newline at end of file ...\ No newline at end of file
1 +/* Copyright (C) 2010-2012 kaosu (qiupf2000@gmail.com)
2 + * This file is part of the Interactive Text Hooker.
3 +
4 + * Interactive Text Hooker is free software: you can redistribute it and/or
5 + * modify it under the terms of the GNU General Public License as published
6 + * by the Free Software Foundation, either version 3 of the License, or
7 + * (at your option) any later version.
8 +
9 + * This program is distributed in the hope that it will be useful,
10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 + * GNU General Public License for more details.
13 +
14 + * You should have received a copy of the GNU General Public License
15 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 + */
17 +
18 +#pragma once
19 +#include <ITH\common.h>
20 +#ifdef IHF
21 +#define IHFAPI __declspec(dllexport) __stdcall
22 +#else
23 +#define IHFAPI __declspec(dllimport) __stdcall
24 +#endif
25 +extern "C" {
26 + DWORD IHFAPI OutputConsole(LPWSTR str);
27 + DWORD IHFAPI OutputDWORD(DWORD d);
28 + DWORD IHFAPI OutputRegister(DWORD *base);
29 + DWORD IHFAPI NotifyHookInsert(DWORD addr);
30 + DWORD IHFAPI NewHook(const HookParam& hp, LPWSTR name=0, DWORD flag=HOOK_ENGINE);
31 + DWORD IHFAPI RemoveHook(DWORD addr);
32 + DWORD IHFAPI RegisterEngineModule(DWORD base, DWORD idEngine, DWORD dnHook);
33 + DWORD IHFAPI SwitchTrigger(DWORD on);
34 + DWORD IHFAPI GetFunctionAddr(char* name, DWORD* addr, DWORD *base, DWORD* size, LPWSTR* base_name);
35 +}
...\ No newline at end of file ...\ No newline at end of file
1 +/* Copyright (C) 2010-2012 kaosu (qiupf2000@gmail.com)
2 + * This file is part of the Interactive Text Hooker.
3 +
4 + * Interactive Text Hooker is free software: you can redistribute it and/or
5 + * modify it under the terms of the GNU General Public License as published
6 + * by the Free Software Foundation, either version 3 of the License, or
7 + * (at your option) any later version.
8 +
9 + * This program is distributed in the hope that it will be useful,
10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 + * GNU General Public License for more details.
13 +
14 + * You should have received a copy of the GNU General Public License
15 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 + */
17 +
18 +#pragma once
19 +#include <ITH\ntdll.h>
20 +extern "C" {
21 +extern WORD* NlsAnsiCodePage;
22 +int disasm(BYTE* opcode0);
23 +int FillRange(LPWSTR name,DWORD* lower, DWORD* upper);
24 +int MB_WC(char* mb, wchar_t* wc);
25 +int MB_WC_count(char* mb, int mb_length);
26 +int WC_MB(wchar_t *wc, char* mb);
27 +DWORD SearchPattern(DWORD base, DWORD base_length, LPVOID search, DWORD search_length); //KMP
28 +BOOL IthInitSystemService();
29 +void IthCloseSystemService();
30 +DWORD IthGetMemoryRange(LPVOID mem, DWORD* base, DWORD* size);
31 +BOOL IthCheckFile(LPWSTR file);
32 +BOOL IthFindFile(LPWSTR file);
33 +BOOL IthGetFileInfo(LPWSTR file, LPVOID info, DWORD size = 0x1000);
34 +BOOL IthCheckFileFullPath(LPWSTR file);
35 +HANDLE IthCreateFile(LPWSTR name, DWORD option, DWORD share, DWORD disposition);
36 +HANDLE IthCreateFileInDirectory(LPWSTR name, HANDLE dir, DWORD option, DWORD share, DWORD disposition);
37 +HANDLE IthCreateDirectory(LPWSTR name);
38 +HANDLE IthCreateFileFullPath(LPWSTR full_path, DWORD option, DWORD share, DWORD disposition);
39 +HANDLE IthPromptCreateFile(DWORD option, DWORD share, DWORD disposition);
40 +HANDLE IthCreateSection(LPWSTR name, DWORD size, DWORD right);
41 +HANDLE IthCreateEvent(LPWSTR name, DWORD auto_reset=0, DWORD init_state=0);
42 +HANDLE IthOpenEvent(LPWSTR name);
43 +void IthSetEvent(HANDLE hEvent);
44 +void IthResetEvent(HANDLE hEvent);
45 +HANDLE IthCreateMutex(LPWSTR name, BOOL InitialOwner, DWORD* exist=0);
46 +HANDLE IthOpenMutex(LPWSTR name);
47 +BOOL IthReleaseMutex(HANDLE hMutex);
48 +//DWORD IthWaitForSingleObject(HANDLE hObject, DWORD dwTime);
49 +HANDLE IthCreateThread(LPVOID start_addr, DWORD param, HANDLE hProc=(HANDLE)-1);
50 +DWORD GetExportAddress(DWORD hModule,DWORD hash);
51 +void IthSleep(int time);
52 +void IthSystemTimeToLocalTime(LARGE_INTEGER* ptime);
53 +void FreeThreadStart(HANDLE hProc);
54 +void CheckThreadStart();
55 +}
56 +extern HANDLE hHeap;
57 +extern DWORD current_process_id,debug;
58 +extern BYTE LeadByteTable[];
59 +extern LPVOID page;
60 +extern BYTE launch_time[];
61 +inline DWORD GetHash(LPSTR str)
62 +{
63 + DWORD hash=0;
64 + for (;*str;str++)
65 + {
66 + hash=((hash>>7)|(hash<<25))+(*str);
67 + }
68 + return hash;
69 +}
70 +inline DWORD GetHash(LPWSTR str)
71 +{
72 + DWORD hash=0;
73 + for (;*str;str++)
74 + {
75 + hash=((hash>>7)|(hash<<25))+(*str);
76 + }
77 + return hash;
78 +}
79 +inline void IthBreak()
80 +{
81 + if (debug) __debugbreak();
82 +}
83 +inline LPWSTR GetMainModulePath()
84 +{
85 + __asm
86 + {
87 + mov eax, fs:[0x30]
88 + mov eax, [eax + 0xC]
89 + mov eax, [eax + 0xC]
90 + mov eax, [eax + 0x28]
91 + }
92 +}
...\ No newline at end of file ...\ No newline at end of file
1 +/* Copyright (C) 2010-2012 kaosu (qiupf2000@gmail.com)
2 + * This file is part of the Interactive Text Hooker.
3 +
4 + * Interactive Text Hooker is free software: you can redistribute it and/or
5 + * modify it under the terms of the GNU General Public License as published
6 + * by the Free Software Foundation, either version 3 of the License, or
7 + * (at your option) any later version.
8 +
9 + * This program is distributed in the hope that it will be useful,
10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 + * GNU General Public License for more details.
13 +
14 + * You should have received a copy of the GNU General Public License
15 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 + */
17 +
18 +#pragma once
19 +#include <ITH\Hash.h>
20 +#ifdef ITH_TLS
21 +#define ITH_TLS_SERVICE __declspec(dllexport)
22 +#else
23 +#define ITH_TLS_SERVICE __declspec(dllimport)
24 +#endif
25 +#define ITH_TLS_API __stdcall
26 +
27 +#ifndef ITH_TLS_SOCKET
28 +#define ITH_TLS_SOCKET
29 +class TransportSocket
30 +{
31 +public:
32 + TransportSocket() : sock(0), type(0), error_code(0), status(0) {}
33 + virtual ~TransportSocket();
34 + virtual int socket();
35 + virtual int connect(char* server, int port = 0); //pass 0 to make use of default port number.
36 + //This number is 80 for plain socket and 443 for secure socket.
37 + virtual int close();
38 + virtual int send(void* data, int len);
39 + virtual int recv(void* data, int len);
40 + inline int Type() {return type;}
41 +protected:
42 + int sock, type, error_code, status;
43 +};
44 +#endif
45 +extern "C" {
46 + ITH_TLS_SERVICE DWORD ITH_TLS_API ITH_TLS_Init();
47 + ITH_TLS_SERVICE DWORD ITH_TLS_API ITH_TLS_Cleanup();
48 + ITH_TLS_SERVICE HashCalculator* ITH_TLS_API ITH_TLS_NewHashCalculator(HashType type);
49 + ITH_TLS_SERVICE DWORD ITH_TLS_API ITH_TLS_DestroyHashCalculator(HashCalculator* hash);
50 + ITH_TLS_SERVICE TransportSocket* ITH_TLS_API ITH_TLS_NewSocket(DWORD secure);
51 + ITH_TLS_SERVICE DWORD ITH_TLS_API ITH_TLS_DestroySocket(TransportSocket* socket);
52 + ITH_TLS_SERVICE DWORD ITH_TLS_API ITH_TLS_RSAEncrypt(void* key, void* data, void* out, DWORD len_in_bytes);
53 +};
1 +/* Copyright (C) 2010-2012 kaosu (qiupf2000@gmail.com)
2 + * This file is part of the Interactive Text Hooker.
3 +
4 + * Interactive Text Hooker is free software: you can redistribute it and/or
5 + * modify it under the terms of the GNU General Public License as published
6 + * by the Free Software Foundation, either version 3 of the License, or
7 + * (at your option) any later version.
8 +
9 + * This program is distributed in the hope that it will be useful,
10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 + * GNU General Public License for more details.
13 +
14 + * You should have received a copy of the GNU General Public License
15 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 + */
17 +
18 +#pragma once
19 +#include <intrin.h>
20 +#define SETTING_SPLIT_TIME 0
21 +#define SETTING_CYCLIC_REMOVE 1
22 +#define SETTING_REPEAT_COUNT 2
23 +#define SETTING_CLIPFLAG 3
24 +#define SETTING_MAX_INDEX 4
25 +class SettingManager
26 +{
27 +public:
28 + SettingManager() {memset(settting_int,0,sizeof(settting_int));}
29 + ~SettingManager(){}
30 + unsigned int SetValue(unsigned int index, unsigned int value)
31 + {
32 + if (index < SETTING_MAX_INDEX)
33 + return (unsigned int)_InterlockedExchange((long*)settting_int+index,(long)value);
34 + else return 0;
35 + }
36 + unsigned int GetValue(unsigned int index)
37 + {
38 + if (index < SETTING_MAX_INDEX)
39 + return settting_int[index];
40 + else return 0;
41 + }
42 +private:
43 + unsigned int settting_int[SETTING_MAX_INDEX];
44 +
45 +};
...\ No newline at end of file ...\ No newline at end of file
1 +/* Copyright (C) 2010-2012 kaosu (qiupf2000@gmail.com)
2 + * This file is part of the Interactive Text Hooker.
3 +
4 + * Interactive Text Hooker is free software: you can redistribute it and/or
5 + * modify it under the terms of the GNU General Public License as published
6 + * by the Free Software Foundation, either version 3 of the License, or
7 + * (at your option) any later version.
8 +
9 + * This program is distributed in the hope that it will be useful,
10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 + * GNU General Public License for more details.
13 +
14 + * You should have received a copy of the GNU General Public License
15 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 + */
17 +
18 +#pragma once
19 +#include <ITH\main_template.h>
20 +#include <ITH\common.h>
21 +#include <ITH\SettingManager.h>
22 +
23 +struct RepeatCountNode
24 +{
25 + short repeat;
26 + short count;
27 + RepeatCountNode* next;
28 +};
29 +struct ThreadParameter
30 +{
31 + DWORD pid;
32 + DWORD hook;
33 + DWORD retn;
34 + DWORD spl;
35 +};
36 +#define CURRENT_SELECT 0x1000
37 +#define REPEAT_NUMBER_DECIDED 0x2000
38 +#define BUFF_NEWLINE 0x4000
39 +#define CYCLIC_REPEAT 0x8000
40 +#define COUNT_PER_FOWARD 0x200
41 +#define REPEAT_DETECT 0x10000
42 +#define REPEAT_SUPPRESS 0x20000
43 +#define REPEAT_NEWLINE 0x40000
44 +class TextThread;
45 +typedef DWORD (*ThreadOutputFilterCallback) (TextThread*, BYTE*,DWORD,DWORD,PVOID);
46 +typedef DWORD (*ThreadEventCallback) (TextThread*);
47 +
48 +//extern DWORD split_time,repeat_count,global_filter,cyclic_remove;
49 +
50 +class TextThread : public MyVector<BYTE, 0x200>
51 +{
52 +public:
53 + TextThread(DWORD pid, DWORD hook, DWORD retn, DWORD spl, WORD num);
54 + virtual ~TextThread();
55 + virtual void CopyLastSentence(LPWSTR str);
56 + virtual void SetComment(LPWSTR);
57 + virtual void ExportTextToFile(LPWSTR filename);
58 +
59 + virtual bool CheckCycle(TextThread* start);
60 + virtual DWORD GetThreadString(LPWSTR str, DWORD max);
61 + virtual DWORD GetEntryString(LPWSTR str, DWORD max = 0x200);
62 +
63 + void Reset();
64 + void AddText(BYTE* con,int len, bool new_line=false, bool console=false);
65 + void AddTextDirect(BYTE* con, int len);
66 + void RemoveSingleRepeatAuto(BYTE* con, int &len);
67 + void RemoveSingleRepeatForce(BYTE* con, int &len);
68 + void RemoveCyclicRepeat(BYTE* &con, int &len);
69 + void ResetRepeatStatus();
70 + void AddLineBreak();
71 + void ResetEditText();
72 + void ComboSelectCurrent();
73 + void UnLinkAll();
74 + void CopyLastToClipboard();
75 +
76 + //void AdjustPrevRepeat(DWORD len);
77 + //void PrevRepeatLength(DWORD &len);
78 +
79 + //bool AddToCombo();
80 + bool RemoveFromCombo();
81 +
82 + void SetNewLineFlag();
83 + void SetNewLineTimer();
84 + BYTE* GetStore(DWORD* len) {if (len) *len = used; return storage;}
85 + inline DWORD LastSentenceLen() {return used - last_sentence;}
86 + inline DWORD PID() const {return tp.pid;}
87 + inline DWORD Addr() const {return tp.hook;}
88 + inline DWORD& Status() {return status;}
89 + inline WORD Number() const {return thread_number;}
90 + inline WORD& Last() {return last;}
91 + inline WORD& LinkNumber() {return link_number;}
92 + inline UINT_PTR& Timer() {return timer;}
93 + inline ThreadParameter* GetThreadParameter() {return &tp;}
94 + inline TextThread*& Link() {return link;}
95 + inline ThreadOutputFilterCallback RegisterOutputCallBack(ThreadOutputFilterCallback cb, PVOID data)
96 + {
97 + app_data = data;
98 + return (ThreadOutputFilterCallback)_InterlockedExchange((long*)&output,(long)cb);
99 + }
100 + inline ThreadOutputFilterCallback RegisterFilterCallBack(ThreadOutputFilterCallback cb, PVOID data)
101 + {
102 + app_data = data;
103 + return (ThreadOutputFilterCallback)_InterlockedExchange((long*)&filter,(long)cb);
104 + }
105 + inline void SetRepeatFlag() {status|=CYCLIC_REPEAT;}
106 + inline void ClearNewLineFlag() {status&=~BUFF_NEWLINE;}
107 + inline void ClearRepeatFlag() {status&=~CYCLIC_REPEAT;}
108 + inline LPCWSTR GetComment() {return comment;}
109 +private:
110 + ThreadParameter tp;
111 +
112 + WORD thread_number,link_number;
113 + WORD last,align_space;
114 + WORD repeat_single;
115 + WORD repeat_single_current;
116 + WORD repeat_single_count;
117 + WORD repeat_detect_count;
118 + RepeatCountNode* head;
119 +
120 + TextThread *link;
121 + ThreadOutputFilterCallback filter,output;
122 + PVOID app_data;
123 + LPWSTR comment,thread_string;
124 + UINT_PTR timer;
125 + DWORD status,repeat_detect_limit;
126 + DWORD last_sentence,prev_sentence,sentence_length,repeat_index,last_time;
127 +};
1 +/* Copyright (C) 2010-2012 kaosu (qiupf2000@gmail.com)
2 + * This file is part of the Interactive Text Hooker.
3 +
4 + * Interactive Text Hooker is free software: you can redistribute it and/or
5 + * modify it under the terms of the GNU General Public License as published
6 + * by the Free Software Foundation, either version 3 of the License, or
7 + * (at your option) any later version.
8 +
9 + * This program is distributed in the hope that it will be useful,
10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 + * GNU General Public License for more details.
13 +
14 + * You should have received a copy of the GNU General Public License
15 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 + */
17 +
18 +#pragma once
19 +#include <windows.h>
20 +#include <ITH\string.h>
21 +#include <ITH\mem.h>
22 +
23 +#define IHF_COMMAND -1
24 +#define IHF_COMMAND_NEW_HOOK 0
25 +#define IHF_COMMAND_REMOVE_HOOK 1
26 +#define IHF_COMMAND_MODIFY_HOOK 2
27 +#define IHF_COMMAND_DETACH 3
28 +#define IHF_NOTIFICATION -1
29 +#define IHF_NOTIFICATION_TEXT 0
30 +#define IHF_NOTIFICATION_NEWHOOK 1
31 +
32 +#define USING_STRING 0x1
33 +#define USING_UNICODE 0x2
34 +#define BIG_ENDIAN 0x4
35 +#define DATA_INDIRECT 0x8
36 +#define USING_SPLIT 0x10
37 +#define SPLIT_INDIRECT 0x20
38 +#define MODULE_OFFSET 0x40
39 +#define FUNCTION_OFFSET 0x80
40 +#define PRINT_DWORD 0x100
41 +#define STRING_LAST_CHAR 0x200
42 +#define NO_CONTEXT 0x400
43 +#define EXTERN_HOOK 0x800
44 +#define HOOK_AUXILIARY 0x2000
45 +#define HOOK_ENGINE 0x4000
46 +#define HOOK_ADDITIONAL 0x8000
47 +
48 +#define MAX_HOOK 32
49 +
50 +
51 +
52 +struct HookParam //0x24
53 +{
54 + typedef void (*DataFun)(DWORD, HookParam*, DWORD*, DWORD*, DWORD*);
55 +
56 + DWORD addr;
57 + DWORD off,ind,split,split_ind;
58 + DWORD module,function;
59 + DataFun extern_fun;
60 + DWORD type;
61 + WORD length_offset;
62 + BYTE hook_len,recover_len;
63 +};
64 +struct SendParam
65 +{
66 + DWORD type;
67 + HookParam hp;
68 +};
69 +class Hook //0x80
70 +{
71 +public:
72 + inline DWORD Address() const {return hp.addr;}
73 + inline DWORD Type() const {return hp.type;}
74 + inline WORD Length() const {return hp.hook_len;}
75 + inline LPWSTR Name() const {return hook_name;}
76 + inline int NameLength() const {return name_length;}
77 +//protected:
78 + HookParam hp;
79 + LPWSTR hook_name;
80 + int name_length;
81 + BYTE recover[0x68-sizeof(HookParam)];
82 + BYTE original[0x10];
83 +};
1 +/* Copyright (C) 2010-2012 kaosu (qiupf2000@gmail.com)
2 + * This file is part of the Interactive Text Hooker.
3 +
4 + * Interactive Text Hooker is free software: you can redistribute it and/or
5 + * modify it under the terms of the GNU General Public License as published
6 + * by the Free Software Foundation, either version 3 of the License, or
7 + * (at your option) any later version.
8 +
9 + * This program is distributed in the hope that it will be useful,
10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 + * GNU General Public License for more details.
13 +
14 + * You should have received a copy of the GNU General Public License
15 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 + */
17 +
18 +#pragma once
19 +#include <windows.h>
20 +template <typename T>
21 +void Release(const T& p) {delete p;}
22 +
23 +//Prevent memory release.
24 +//Used when T is basic types and will be automatically released (on stack).
25 +#define MK_BASIC_TYPE(T) \
26 +template<> \
27 + void Release<T>(const T& p) {}
28 +
29 +template<class T>
30 +class BinaryEqual
31 +{
32 +public:
33 + bool operator ()(const T& a, const T& b, DWORD) {return a==b;}
34 +};
35 +template<class T, int default_size, class fComp=BinaryEqual<T> >
36 +class MyVector
37 +{
38 +public:
39 + MyVector()
40 + {
41 + InitializeCriticalSection(&cs_store);
42 + size=default_size;
43 + used=0;
44 + storage=new T[size];
45 + }
46 + virtual ~MyVector()
47 + {
48 + if (storage) delete []storage;
49 + DeleteCriticalSection(&cs_store);
50 + storage=0;
51 + }
52 + void Reset()
53 + {
54 + EnterCriticalSection(&cs_store);
55 + for (int i=0;i<used;i++)
56 + {
57 + Release<T>(storage[i]);
58 + storage[i]=T();
59 + }
60 + used=0;
61 + LeaveCriticalSection(&cs_store);
62 + }
63 + void Remove(int index)
64 + {
65 + if (index>=used) return;
66 + Release<T>(storage[index]);
67 + for (int i=index;i<used;i++)
68 + storage[i]=storage[i+1];
69 + used--;
70 + }
71 + void ClearMemory(int offset, int clear_size)
72 + {
73 + if (clear_size<0) return;
74 + EnterCriticalSection(&cs_store);
75 + if (offset+clear_size<=size)
76 + {
77 +
78 + memset(storage+offset,0,clear_size*sizeof(T));
79 +
80 + }
81 + LeaveCriticalSection(&cs_store);
82 + //else __asm int 3
83 + }
84 + int AddToStore(T* con,int amount)
85 + {
86 + if (amount<=0||con==0) return 0;
87 + int status=0;
88 + EnterCriticalSection(&cs_store);
89 + if (amount+used+2>=size)
90 + {
91 + while (amount+used+2>=size) size<<=1;
92 + T* temp;
93 + if (size*sizeof(T)<0x1000000)
94 + {
95 + temp=new T[size];
96 + memcpy(temp,storage,used*sizeof(T));
97 + }
98 + else
99 + {
100 + size=default_size;
101 + temp=new T[size];
102 + used=0;
103 + status=1;
104 + }
105 + delete []storage;
106 + storage=temp;
107 + }
108 + memcpy(storage+used,con,amount*sizeof(T));
109 + used+=amount;
110 + LeaveCriticalSection(&cs_store);
111 + return status;
112 + }
113 + int Find(const T& item, int start=0, DWORD control=0)
114 + {
115 + int c=-1;
116 + for (int i=start;i<used;i++)
117 + if (fCmp(storage[i],item,control)) {c=i;break;}
118 + //if (storage[i]==item) {c=i;break;}
119 + return c;
120 + }
121 + inline int Used() const {return used;}
122 + inline T* Storage() const {return storage;}
123 + inline void LockVector() {EnterCriticalSection(&cs_store);}
124 + inline void UnlockVector() {LeaveCriticalSection(&cs_store);}
125 +protected:
126 + CRITICAL_SECTION cs_store;
127 + int size, used;
128 + T *storage;
129 + fComp fCmp;
130 +};
131 +
132 +#ifndef ITH_STACK
133 +#define ITH_STACK
134 +template<class T, int default_size>
135 +class MyStack
136 +{
137 +public:
138 + MyStack(): index(0) {}
139 + void push_back(const T& e)
140 + {
141 + if (index<default_size)
142 + s[index++]=e;
143 + }
144 + void pop_back()
145 + {
146 + index--;
147 + }
148 + T& back()
149 + {
150 + return s[index-1];
151 + }
152 + T& operator[](int i) {return s[i];}
153 + int size() {return index;}
154 +private:
155 + int index;
156 + T s[default_size];
157 +};
158 +#endif
...\ No newline at end of file ...\ No newline at end of file
1 +/* Copyright (C) 2010-2012 kaosu (qiupf2000@gmail.com)
2 + * This file is part of the Interactive Text Hooker.
3 +
4 + * Interactive Text Hooker is free software: you can redistribute it and/or
5 + * modify it under the terms of the GNU General Public License as published
6 + * by the Free Software Foundation, either version 3 of the License, or
7 + * (at your option) any later version.
8 +
9 + * This program is distributed in the hope that it will be useful,
10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 + * GNU General Public License for more details.
13 +
14 + * You should have received a copy of the GNU General Public License
15 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 + */
17 +
18 +#pragma once
19 +#ifndef DEFAULT_MM
20 +
21 +extern "C" {
22 + __declspec(dllimport) void* __stdcall RtlAllocateHeap(void* hHeap, unsigned long flags, unsigned long size);
23 + __declspec(dllimport) int __stdcall RtlFreeHeap(void*,unsigned long,void*);
24 +};
25 +
26 +extern void* hHeap;
27 +
28 +//HEAP_ZERO_MEMORY flag is critical. All new objects are assumed with zero initialized.
29 +inline void * __cdecl operator new(size_t lSize)
30 +{
31 + return RtlAllocateHeap(hHeap, 8, lSize);
32 +}
33 +inline void __cdecl operator delete(void *pBlock)
34 +{
35 + RtlFreeHeap(hHeap, 0, pBlock);
36 +}
37 +inline void __cdecl operator delete[](void* pBlock)
38 +{
39 + RtlFreeHeap(hHeap, 0, pBlock);
40 +}
41 +#endif
...\ No newline at end of file ...\ No newline at end of file
This diff could not be displayed because it is too large.
1 +/* Copyright (C) 2010-2012 kaosu (qiupf2000@gmail.com)
2 + * This file is part of the Interactive Text Hooker.
3 +
4 + * Interactive Text Hooker is free software: you can redistribute it and/or
5 + * modify it under the terms of the GNU General Public License as published
6 + * by the Free Software Foundation, either version 3 of the License, or
7 + * (at your option) any later version.
8 +
9 + * This program is distributed in the hope that it will be useful,
10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 + * GNU General Public License for more details.
13 +
14 + * You should have received a copy of the GNU General Public License
15 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 + */
17 +
18 +#pragma once
19 +#define _INC_SWPRINTF_INL_
20 +#define CRT_IMPORT __declspec(dllimport)
21 +extern "C" {
22 +CRT_IMPORT int swprintf(wchar_t * _String, const wchar_t * _Format, ...);
23 +CRT_IMPORT int sprintf(char * _String, const char * _Format, ...);
24 +CRT_IMPORT int swscanf(const wchar_t * _Src, const wchar_t * _Format, ...);
25 +CRT_IMPORT int sscanf(const char * _String, const char * _Format, ...);
26 +CRT_IMPORT int wprintf(const wchar_t* _Format, ...);
27 +CRT_IMPORT int printf(const char* _Format, ...);
28 +CRT_IMPORT int _wputs(const wchar_t* _String);
29 +CRT_IMPORT int puts(const char* _String);
30 +CRT_IMPORT int _stricmp(const char * _Str1, const char * _Str2);
31 +CRT_IMPORT int _wcsicmp(const wchar_t * _Str1, const wchar_t * _Str2);
32 +//CRT_IMPORT size_t strlen(const char *);
33 +//CRT_IMPORT size_t wcslen(const wchar_t *);
34 +//CRT_IMPORT char *strcpy(char *,const char *);
35 +//CRT_IMPORT wchar_t *wcscpy(wchar_t *,const wchar_t *);
36 +CRT_IMPORT void * memmove(void * _Dst, const void * _Src, size_t _Size);
37 +CRT_IMPORT const char * strchr(const char * _Str, int _Val);
38 +CRT_IMPORT int strncmp(const char * _Str1, const char * _Str2, size_t _MaxCount);
39 +}
1 +/*
2 +www.sourceforge.net/projects/tinyxml
3 +
4 +This software is provided 'as-is', without any express or implied
5 +warranty. In no event will the authors be held liable for any
6 +damages arising from the use of this software.
7 +
8 +Permission is granted to anyone to use this software for any
9 +purpose, including commercial applications, and to alter it and
10 +redistribute it freely, subject to the following restrictions:
11 +
12 +1. The origin of this software must not be misrepresented; you must
13 +not claim that you wrote the original software. If you use this
14 +software in a product, an acknowledgment in the product documentation
15 +would be appreciated but is not required.
16 +
17 +2. Altered source versions must be plainly marked as such, and
18 +must not be misrepresented as being the original software.
19 +
20 +3. This notice may not be removed or altered from any source
21 +distribution.
22 +
23 +************************************************************
24 +Modified by kaosu, remove the stdio header and added a customized
25 +string header. Added a memory header to reload new and delete operator
26 +to comply with ITH memory model.
27 +*/
28 +
29 +
30 +#ifndef TIXML_USE_STL
31 +
32 +#ifndef TIXML_STRING_INCLUDED
33 +#define TIXML_STRING_INCLUDED
34 +
35 +#include <assert.h>
36 +#include <intrin.h>
37 +#include <ITH\string.h>
38 +#include <ITH\mem.h>
39 +/* The support for explicit isn't that universal, and it isn't really
40 + required - it is used to check that the TiXmlString class isn't incorrectly
41 + used. Be nice to old compilers and macro it here:
42 +*/
43 +#if defined(_MSC_VER) && (_MSC_VER >= 1200 )
44 + // Microsoft visual studio, version 6 and higher.
45 + #define TIXML_EXPLICIT explicit
46 +#elif defined(__GNUC__) && (__GNUC__ >= 3 )
47 + // GCC version 3 and higher.s
48 + #define TIXML_EXPLICIT explicit
49 +#else
50 + #define TIXML_EXPLICIT
51 +#endif
52 +
53 +
54 +/*
55 + TiXmlString is an emulation of a subset of the std::string template.
56 + Its purpose is to allow compiling TinyXML on compilers with no or poor STL support.
57 + Only the member functions relevant to the TinyXML project have been implemented.
58 + The buffer allocation is made by a simplistic power of 2 like mechanism : if we increase
59 + a string and there's no more room, we allocate a buffer twice as big as we need.
60 +*/
61 +class TiXmlString
62 +{
63 + public :
64 + // The size type used
65 + typedef size_t size_type;
66 +
67 + // Error value for find primitive
68 + static const size_type npos; // = -1;
69 +
70 +
71 + // TiXmlString empty constructor
72 + TiXmlString () : rep_(&nullrep_)
73 + {
74 + }
75 +
76 + // TiXmlString copy constructor
77 + TiXmlString ( const TiXmlString & copy) : rep_(0)
78 + {
79 + init(copy.length());
80 + memcpy(start(), copy.data(), length());
81 + }
82 +
83 + // TiXmlString constructor, based on a string
84 + TIXML_EXPLICIT TiXmlString ( const char * copy) : rep_(0)
85 + {
86 + init( static_cast<size_type>( strlen(copy) ));
87 + memcpy(start(), copy, length());
88 + }
89 +
90 + // TiXmlString constructor, based on a string
91 + TIXML_EXPLICIT TiXmlString ( const char * str, size_type len) : rep_(0)
92 + {
93 + init(len);
94 + memcpy(start(), str, len);
95 + }
96 +
97 + // TiXmlString destructor
98 + ~TiXmlString ()
99 + {
100 + quit();
101 + }
102 +
103 + TiXmlString& operator = (const char * copy)
104 + {
105 + return assign( copy, (size_type)strlen(copy));
106 + }
107 +
108 + TiXmlString& operator = (const TiXmlString & copy)
109 + {
110 + return assign(copy.start(), copy.length());
111 + }
112 +
113 +
114 + // += operator. Maps to append
115 + TiXmlString& operator += (const char * suffix)
116 + {
117 + return append(suffix, static_cast<size_type>( strlen(suffix) ));
118 + }
119 +
120 + // += operator. Maps to append
121 + TiXmlString& operator += (char single)
122 + {
123 + return append(&single, 1);
124 + }
125 +
126 + // += operator. Maps to append
127 + TiXmlString& operator += (const TiXmlString & suffix)
128 + {
129 + return append(suffix.data(), suffix.length());
130 + }
131 +
132 +
133 + // Convert a TiXmlString into a null-terminated char *
134 + const char * c_str () const { return rep_->str; }
135 +
136 + // Convert a TiXmlString into a char * (need not be null terminated).
137 + const char * data () const { return rep_->str; }
138 +
139 + // Return the length of a TiXmlString
140 + size_type length () const { return rep_->size; }
141 +
142 + // Alias for length()
143 + size_type size () const { return rep_->size; }
144 +
145 + // Checks if a TiXmlString is empty
146 + bool empty () const { return rep_->size == 0; }
147 +
148 + // Return capacity of string
149 + size_type capacity () const { return rep_->capacity; }
150 +
151 +
152 + // single char extraction
153 + const char& at (size_type index) const
154 + {
155 + assert( index < length() );
156 + return rep_->str[ index ];
157 + }
158 +
159 + // [] operator
160 + char& operator [] (size_type index) const
161 + {
162 + assert( index < length() );
163 + return rep_->str[ index ];
164 + }
165 +
166 + // find a char in a string. Return TiXmlString::npos if not found
167 + size_type find (char lookup) const
168 + {
169 + return find(lookup, 0);
170 + }
171 +
172 + // find a char in a string from an offset. Return TiXmlString::npos if not found
173 + size_type find (char tofind, size_type offset) const
174 + {
175 + if (offset >= length()) return npos;
176 +
177 + for (const char* p = c_str() + offset; *p != '\0'; ++p)
178 + {
179 + if (*p == tofind) return static_cast< size_type >( p - c_str() );
180 + }
181 + return npos;
182 + }
183 +
184 + void clear ()
185 + {
186 + //Lee:
187 + //The original was just too strange, though correct:
188 + // TiXmlString().swap(*this);
189 + //Instead use the quit & re-init:
190 + quit();
191 + init(0,0);
192 + }
193 +
194 + /* Function to reserve a big amount of data when we know we'll need it. Be aware that this
195 + function DOES NOT clear the content of the TiXmlString if any exists.
196 + */
197 + void reserve (size_type cap);
198 +
199 + TiXmlString& assign (const char* str, size_type len);
200 +
201 + TiXmlString& append (const char* str, size_type len);
202 +
203 + void swap (TiXmlString& other)
204 + {
205 + Rep* r = rep_;
206 + rep_ = other.rep_;
207 + other.rep_ = r;
208 + }
209 +
210 + private:
211 +
212 + void init(size_type sz) { init(sz, sz); }
213 + void set_size(size_type sz) { rep_->str[ rep_->size = sz ] = '\0'; }
214 + char* start() const { return rep_->str; }
215 + char* finish() const { return rep_->str + rep_->size; }
216 +
217 + struct Rep
218 + {
219 + size_type size, capacity;
220 + char str[1];
221 + };
222 +
223 + void init(size_type sz, size_type cap)
224 + {
225 + if (cap)
226 + {
227 + // Lee: the original form:
228 + // rep_ = static_cast<Rep*>(operator new(sizeof(Rep) + cap));
229 + // doesn't work in some cases of new being overloaded. Switching
230 + // to the normal allocation, although use an 'int' for systems
231 + // that are overly picky about structure alignment.
232 + const size_type bytesNeeded = sizeof(Rep) + cap;
233 + const size_type intsNeeded = ( bytesNeeded + sizeof(int) - 1 ) / sizeof( int );
234 + rep_ = reinterpret_cast<Rep*>( new int[ intsNeeded ] );
235 +
236 + rep_->str[ rep_->size = sz ] = '\0';
237 + rep_->capacity = cap;
238 + }
239 + else
240 + {
241 + rep_ = &nullrep_;
242 + }
243 + }
244 +
245 + void quit()
246 + {
247 + if (rep_ != &nullrep_)
248 + {
249 + // The rep_ is really an array of ints. (see the allocator, above).
250 + // Cast it back before delete, so the compiler won't incorrectly call destructors.
251 + delete [] ( reinterpret_cast<int*>( rep_ ) );
252 + }
253 + }
254 +
255 + Rep * rep_;
256 + static Rep nullrep_;
257 +} ;
258 +
259 +
260 +inline bool operator == (const TiXmlString & a, const TiXmlString & b)
261 +{
262 + return ( a.length() == b.length() ) // optimization on some platforms
263 + && ( strcmp(a.c_str(), b.c_str()) == 0 ); // actual compare
264 +}
265 +inline bool operator < (const TiXmlString & a, const TiXmlString & b)
266 +{
267 + return strcmp(a.c_str(), b.c_str()) < 0;
268 +}
269 +
270 +inline bool operator != (const TiXmlString & a, const TiXmlString & b) { return !(a == b); }
271 +inline bool operator > (const TiXmlString & a, const TiXmlString & b) { return b < a; }
272 +inline bool operator <= (const TiXmlString & a, const TiXmlString & b) { return !(b < a); }
273 +inline bool operator >= (const TiXmlString & a, const TiXmlString & b) { return !(a < b); }
274 +
275 +inline bool operator == (const TiXmlString & a, const char* b) { return strcmp(a.c_str(), b) == 0; }
276 +inline bool operator == (const char* a, const TiXmlString & b) { return b == a; }
277 +inline bool operator != (const TiXmlString & a, const char* b) { return !(a == b); }
278 +inline bool operator != (const char* a, const TiXmlString & b) { return !(b == a); }
279 +
280 +TiXmlString operator + (const TiXmlString & a, const TiXmlString & b);
281 +TiXmlString operator + (const TiXmlString & a, const char* b);
282 +TiXmlString operator + (const char* a, const TiXmlString & b);
283 +
284 +
285 +/*
286 + TiXmlOutStream is an emulation of std::ostream. It is based on TiXmlString.
287 + Only the operators that we need for TinyXML have been developped.
288 +*/
289 +class TiXmlOutStream : public TiXmlString
290 +{
291 +public :
292 +
293 + // TiXmlOutStream << operator.
294 + TiXmlOutStream & operator << (const TiXmlString & in)
295 + {
296 + *this += in;
297 + return *this;
298 + }
299 +
300 + // TiXmlOutStream << operator.
301 + TiXmlOutStream & operator << (const char * in)
302 + {
303 + *this += in;
304 + return *this;
305 + }
306 +
307 +} ;
308 +
309 +#endif // TIXML_STRING_INCLUDED
310 +#endif // TIXML_USE_STL
This diff is collapsed. Click to expand it.
1 +const wchar_t* build_date=L"2012.05.05";
No preview for this file type
No preview for this file type
1 +
2 +Microsoft Visual Studio Solution File, Format Version 11.00
3 +# Visual Studio 2010
4 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HookMe1-FontCaching", "HookMe1-FontCaching\HookMe1-FontCaching.vcxproj", "{CC13BFB3-0098-4749-BDF7-1D0DB551CF9E}"
5 +EndProject
6 +Global
7 + GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 + Debug|Win32 = Debug|Win32
9 + Release|Win32 = Release|Win32
10 + EndGlobalSection
11 + GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 + {CC13BFB3-0098-4749-BDF7-1D0DB551CF9E}.Debug|Win32.ActiveCfg = Release|Win32
13 + {CC13BFB3-0098-4749-BDF7-1D0DB551CF9E}.Debug|Win32.Build.0 = Release|Win32
14 + {CC13BFB3-0098-4749-BDF7-1D0DB551CF9E}.Release|Win32.ActiveCfg = Release|Win32
15 + {CC13BFB3-0098-4749-BDF7-1D0DB551CF9E}.Release|Win32.Build.0 = Release|Win32
16 + EndGlobalSection
17 + GlobalSection(SolutionProperties) = preSolution
18 + HideSolutionNode = FALSE
19 + EndGlobalSection
20 +EndGlobal
No preview for this file type
This diff is collapsed. Click to expand it.
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 + <ItemGroup Label="ProjectConfigurations">
4 + <ProjectConfiguration Include="Debug|Win32">
5 + <Configuration>Debug</Configuration>
6 + <Platform>Win32</Platform>
7 + </ProjectConfiguration>
8 + <ProjectConfiguration Include="Release|Win32">
9 + <Configuration>Release</Configuration>
10 + <Platform>Win32</Platform>
11 + </ProjectConfiguration>
12 + </ItemGroup>
13 + <PropertyGroup Label="Globals">
14 + <ProjectGuid>{CC13BFB3-0098-4749-BDF7-1D0DB551CF9E}</ProjectGuid>
15 + <Keyword>Win32Proj</Keyword>
16 + <RootNamespace>HookMe1FontCaching</RootNamespace>
17 + </PropertyGroup>
18 + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
19 + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
20 + <ConfigurationType>Application</ConfigurationType>
21 + <UseDebugLibraries>true</UseDebugLibraries>
22 + <CharacterSet>Unicode</CharacterSet>
23 + </PropertyGroup>
24 + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
25 + <ConfigurationType>Application</ConfigurationType>
26 + <UseDebugLibraries>false</UseDebugLibraries>
27 + <WholeProgramOptimization>true</WholeProgramOptimization>
28 + <CharacterSet>Unicode</CharacterSet>
29 + </PropertyGroup>
30 + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
31 + <ImportGroup Label="ExtensionSettings">
32 + </ImportGroup>
33 + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
34 + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
35 + </ImportGroup>
36 + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
37 + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
38 + </ImportGroup>
39 + <PropertyGroup Label="UserMacros" />
40 + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
41 + <LinkIncremental>true</LinkIncremental>
42 + </PropertyGroup>
43 + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
44 + <LinkIncremental>false</LinkIncremental>
45 + </PropertyGroup>
46 + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
47 + <ClCompile>
48 + <PrecompiledHeader>
49 + </PrecompiledHeader>
50 + <WarningLevel>Level3</WarningLevel>
51 + <Optimization>Disabled</Optimization>
52 + <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
53 + </ClCompile>
54 + <Link>
55 + <SubSystem>Windows</SubSystem>
56 + <GenerateDebugInformation>true</GenerateDebugInformation>
57 + </Link>
58 + </ItemDefinitionGroup>
59 + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
60 + <ClCompile>
61 + <WarningLevel>Level3</WarningLevel>
62 + <PrecompiledHeader>
63 + </PrecompiledHeader>
64 + <Optimization>MaxSpeed</Optimization>
65 + <FunctionLevelLinking>true</FunctionLevelLinking>
66 + <IntrinsicFunctions>true</IntrinsicFunctions>
67 + <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
68 + </ClCompile>
69 + <Link>
70 + <SubSystem>Windows</SubSystem>
71 + <GenerateDebugInformation>true</GenerateDebugInformation>
72 + <EnableCOMDATFolding>true</EnableCOMDATFolding>
73 + <OptimizeReferences>true</OptimizeReferences>
74 + <AdditionalDependencies>..\msvcrt.lib;kernel32.lib;user32.lib;gdi32.lib;%(AdditionalDependencies)</AdditionalDependencies>
75 + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
76 + <EntryPointSymbol>main</EntryPointSymbol>
77 + <RandomizedBaseAddress>false</RandomizedBaseAddress>
78 + </Link>
79 + </ItemDefinitionGroup>
80 + <ItemGroup>
81 + <ClCompile Include="main.cpp" />
82 + </ItemGroup>
83 + <ItemGroup>
84 + <ResourceCompile Include="HookMe1.rc" />
85 + </ItemGroup>
86 + <ItemGroup>
87 + <ClInclude Include="AVL.h" />
88 + <ClInclude Include="resource.h" />
89 + </ItemGroup>
90 + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
91 + <ImportGroup Label="ExtensionTargets">
92 + </ImportGroup>
93 +</Project>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 + <ItemGroup>
4 + <Filter Include="Source Files">
5 + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
6 + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
7 + </Filter>
8 + <Filter Include="Header Files">
9 + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
10 + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
11 + </Filter>
12 + <Filter Include="Resource Files">
13 + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
14 + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
15 + </Filter>
16 + </ItemGroup>
17 + <ItemGroup>
18 + <ClCompile Include="main.cpp">
19 + <Filter>Source Files</Filter>
20 + </ClCompile>
21 + </ItemGroup>
22 + <ItemGroup>
23 + <ResourceCompile Include="HookMe1.rc">
24 + <Filter>Resource Files</Filter>
25 + </ResourceCompile>
26 + </ItemGroup>
27 + <ItemGroup>
28 + <ClInclude Include="AVL.h">
29 + <Filter>Header Files</Filter>
30 + </ClInclude>
31 + <ClInclude Include="resource.h">
32 + <Filter>Header Files</Filter>
33 + </ClInclude>
34 + </ItemGroup>
35 +</Project>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 +</Project>
...\ No newline at end of file ...\ No newline at end of file
No preview for this file type
No preview for this file type
This diff is collapsed. Click to expand it.
No preview for this file type
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 +<?xml version="1.0" encoding="shift_jis"?>
2 +<VisualStudioProject
3 + ProjectType="Visual C++"
4 + Version="9.00"
5 + Name="EnableSEH"
6 + ProjectGUID="{AA653F14-6DE6-4379-89D7-160E5D3B6BC8}"
7 + RootNamespace="EnableSEH"
8 + Keyword="Win32Proj"
9 + TargetFrameworkVersion="196613"
10 + >
11 + <Platforms>
12 + <Platform
13 + Name="Win32"
14 + />
15 + </Platforms>
16 + <ToolFiles>
17 + </ToolFiles>
18 + <Configurations>
19 + <Configuration
20 + Name="Debug|Win32"
21 + OutputDirectory="$(SolutionDir)$(ConfigurationName)"
22 + IntermediateDirectory="$(ConfigurationName)"
23 + ConfigurationType="1"
24 + CharacterSet="1"
25 + >
26 + <Tool
27 + Name="VCPreBuildEventTool"
28 + />
29 + <Tool
30 + Name="VCCustomBuildTool"
31 + />
32 + <Tool
33 + Name="VCXMLDataGeneratorTool"
34 + />
35 + <Tool
36 + Name="VCWebServiceProxyGeneratorTool"
37 + />
38 + <Tool
39 + Name="VCMIDLTool"
40 + />
41 + <Tool
42 + Name="VCCLCompilerTool"
43 + Optimization="0"
44 + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
45 + MinimalRebuild="true"
46 + BasicRuntimeChecks="3"
47 + RuntimeLibrary="3"
48 + UsePrecompiledHeader="0"
49 + WarningLevel="3"
50 + DebugInformationFormat="4"
51 + />
52 + <Tool
53 + Name="VCManagedResourceCompilerTool"
54 + />
55 + <Tool
56 + Name="VCResourceCompilerTool"
57 + />
58 + <Tool
59 + Name="VCPreLinkEventTool"
60 + />
61 + <Tool
62 + Name="VCLinkerTool"
63 + LinkIncremental="2"
64 + GenerateDebugInformation="true"
65 + SubSystem="1"
66 + TargetMachine="1"
67 + />
68 + <Tool
69 + Name="VCALinkTool"
70 + />
71 + <Tool
72 + Name="VCManifestTool"
73 + />
74 + <Tool
75 + Name="VCXDCMakeTool"
76 + />
77 + <Tool
78 + Name="VCBscMakeTool"
79 + />
80 + <Tool
81 + Name="VCFxCopTool"
82 + />
83 + <Tool
84 + Name="VCAppVerifierTool"
85 + />
86 + <Tool
87 + Name="VCPostBuildEventTool"
88 + />
89 + </Configuration>
90 + <Configuration
91 + Name="Release|Win32"
92 + OutputDirectory="$(SolutionDir)$(ConfigurationName)"
93 + IntermediateDirectory="$(ConfigurationName)"
94 + ConfigurationType="1"
95 + CharacterSet="1"
96 + WholeProgramOptimization="1"
97 + >
98 + <Tool
99 + Name="VCPreBuildEventTool"
100 + />
101 + <Tool
102 + Name="VCCustomBuildTool"
103 + />
104 + <Tool
105 + Name="VCXMLDataGeneratorTool"
106 + />
107 + <Tool
108 + Name="VCWebServiceProxyGeneratorTool"
109 + />
110 + <Tool
111 + Name="VCMIDLTool"
112 + />
113 + <Tool
114 + Name="VCCLCompilerTool"
115 + Optimization="0"
116 + EnableIntrinsicFunctions="true"
117 + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
118 + RuntimeLibrary="2"
119 + BufferSecurityCheck="false"
120 + EnableFunctionLevelLinking="true"
121 + UsePrecompiledHeader="0"
122 + WarningLevel="3"
123 + DebugInformationFormat="0"
124 + />
125 + <Tool
126 + Name="VCManagedResourceCompilerTool"
127 + />
128 + <Tool
129 + Name="VCResourceCompilerTool"
130 + />
131 + <Tool
132 + Name="VCPreLinkEventTool"
133 + />
134 + <Tool
135 + Name="VCLinkerTool"
136 + AdditionalDependencies="ntdllp.lib"
137 + LinkIncremental="1"
138 + GenerateManifest="false"
139 + IgnoreAllDefaultLibraries="true"
140 + GenerateDebugInformation="false"
141 + SubSystem="2"
142 + OptimizeReferences="2"
143 + EnableCOMDATFolding="2"
144 + EntryPointSymbol="main"
145 + RandomizedBaseAddress="1"
146 + DataExecutionPrevention="0"
147 + TargetMachine="1"
148 + />
149 + <Tool
150 + Name="VCALinkTool"
151 + />
152 + <Tool
153 + Name="VCManifestTool"
154 + />
155 + <Tool
156 + Name="VCXDCMakeTool"
157 + />
158 + <Tool
159 + Name="VCBscMakeTool"
160 + />
161 + <Tool
162 + Name="VCFxCopTool"
163 + />
164 + <Tool
165 + Name="VCAppVerifierTool"
166 + />
167 + <Tool
168 + Name="VCPostBuildEventTool"
169 + />
170 + </Configuration>
171 + </Configurations>
172 + <References>
173 + </References>
174 + <Files>
175 + <Filter
176 + Name="Source Files"
177 + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
178 + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
179 + >
180 + <File
181 + RelativePath=".\es.cpp"
182 + >
183 + </File>
184 + </Filter>
185 + <Filter
186 + Name="Header Files"
187 + Filter="h;hpp;hxx;hm;inl;inc;xsd"
188 + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
189 + >
190 + </Filter>
191 + <Filter
192 + Name="Resource Files"
193 + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
194 + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
195 + >
196 + </Filter>
197 + </Files>
198 + <Globals>
199 + </Globals>
200 +</VisualStudioProject>
This diff is collapsed. Click to expand it.
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 + <ItemGroup>
4 + <Filter Include="Source Files">
5 + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
6 + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
7 + </Filter>
8 + <Filter Include="Header Files">
9 + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
10 + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
11 + </Filter>
12 + <Filter Include="Resource Files">
13 + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
14 + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
15 + </Filter>
16 + </ItemGroup>
17 + <ItemGroup>
18 + <ClCompile Include="es.cpp">
19 + <Filter>Source Files</Filter>
20 + </ClCompile>
21 + </ItemGroup>
22 +</Project>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
4 + <LocalDebuggerCommandArguments>ith.exe</LocalDebuggerCommandArguments>
5 + <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
6 + </PropertyGroup>
7 +</Project>
...\ No newline at end of file ...\ No newline at end of file
1 +#include <windows.h>
2 +int main()
3 +{
4 + SetCurrentDirectory(L"..\\Release");
5 + HANDLE hFile=INVALID_HANDLE_VALUE;
6 + LPWSTR f=wcsrchr(GetCommandLine(),L' ')+1;
7 + if (f==0) return 1;
8 + for (int i=0;i<10;i++)
9 + {
10 + hFile=CreateFile(f,GENERIC_WRITE|GENERIC_READ,FILE_SHARE_READ,0,OPEN_EXISTING,0,0);
11 + if (hFile!=INVALID_HANDLE_VALUE) break;
12 + Sleep(100);
13 + }
14 + if (hFile==INVALID_HANDLE_VALUE) return 1;
15 + DWORD size=GetFileSize(hFile,0);
16 + DWORD d;
17 + char* file=(char*)HeapAlloc(GetProcessHeap(),0, size);
18 + ReadFile(hFile,file,size,&d,0);
19 + IMAGE_DOS_HEADER *DosHdr=(IMAGE_DOS_HEADER*)file;
20 + IMAGE_NT_HEADERS *NtHdr=(IMAGE_NT_HEADERS*)((DWORD)DosHdr+DosHdr->e_lfanew);
21 + NtHdr->OptionalHeader.DllCharacteristics&=0xFBFF;
22 + SetFilePointer(hFile,0,0,FILE_BEGIN);
23 + WriteFile(hFile,file,size,&d,0);
24 + HeapFree(GetProcessHeap(),0,file);
25 + CloseHandle(hFile);
26 + ExitProcess(0);
27 +}
...\ No newline at end of file ...\ No newline at end of file
1 +
2 +Microsoft Visual Studio Solution File, Format Version 11.00
3 +# Visual Studio 2010
4 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ITH", "ITH\ITH.vcxproj", "{DD6EF1C2-1ED6-4859-BEFB-5B24CAF9AE7A}"
5 +EndProject
6 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ITH_DLL", "ITH_DLL\ITH_DLL.vcxproj", "{AA147E63-3B9B-4C9F-B073-06681219A8FB}"
7 +EndProject
8 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EnableSEH", "EnableSEH\EnableSEH.vcxproj", "{AA653F14-6DE6-4379-89D7-160E5D3B6BC8}"
9 +EndProject
10 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ITH_engine", "ITH_engine\ITH_engine.vcxproj", "{C954BF29-65C7-4EEF-83A9-7507804B2235}"
11 +EndProject
12 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ITH_SYS", "ITH_SYS\ITH_SYS.vcxproj", "{EE4B5DD7-9DC2-4425-BB12-3B9E10981A00}"
13 +EndProject
14 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "version", "version\version.vcxproj", "{22F1F2CE-C54C-400E-A8CE-615A80C01589}"
15 +EndProject
16 +Global
17 + GlobalSection(SolutionConfigurationPlatforms) = preSolution
18 + Debug|Win32 = Debug|Win32
19 + Debug|x64 = Debug|x64
20 + Release|Win32 = Release|Win32
21 + Release|x64 = Release|x64
22 + EndGlobalSection
23 + GlobalSection(ProjectConfigurationPlatforms) = postSolution
24 + {DD6EF1C2-1ED6-4859-BEFB-5B24CAF9AE7A}.Debug|Win32.ActiveCfg = Debug|Win32
25 + {DD6EF1C2-1ED6-4859-BEFB-5B24CAF9AE7A}.Debug|Win32.Build.0 = Debug|Win32
26 + {DD6EF1C2-1ED6-4859-BEFB-5B24CAF9AE7A}.Debug|x64.ActiveCfg = Debug|x64
27 + {DD6EF1C2-1ED6-4859-BEFB-5B24CAF9AE7A}.Debug|x64.Build.0 = Debug|x64
28 + {DD6EF1C2-1ED6-4859-BEFB-5B24CAF9AE7A}.Release|Win32.ActiveCfg = Release|Win32
29 + {DD6EF1C2-1ED6-4859-BEFB-5B24CAF9AE7A}.Release|Win32.Build.0 = Release|Win32
30 + {DD6EF1C2-1ED6-4859-BEFB-5B24CAF9AE7A}.Release|x64.ActiveCfg = Release|x64
31 + {DD6EF1C2-1ED6-4859-BEFB-5B24CAF9AE7A}.Release|x64.Build.0 = Release|x64
32 + {AA147E63-3B9B-4C9F-B073-06681219A8FB}.Debug|Win32.ActiveCfg = Debug|Win32
33 + {AA147E63-3B9B-4C9F-B073-06681219A8FB}.Debug|Win32.Build.0 = Debug|Win32
34 + {AA147E63-3B9B-4C9F-B073-06681219A8FB}.Debug|x64.ActiveCfg = Debug|x64
35 + {AA147E63-3B9B-4C9F-B073-06681219A8FB}.Debug|x64.Build.0 = Debug|x64
36 + {AA147E63-3B9B-4C9F-B073-06681219A8FB}.Release|Win32.ActiveCfg = Release|Win32
37 + {AA147E63-3B9B-4C9F-B073-06681219A8FB}.Release|Win32.Build.0 = Release|Win32
38 + {AA147E63-3B9B-4C9F-B073-06681219A8FB}.Release|x64.ActiveCfg = Release|x64
39 + {AA147E63-3B9B-4C9F-B073-06681219A8FB}.Release|x64.Build.0 = Release|x64
40 + {AA653F14-6DE6-4379-89D7-160E5D3B6BC8}.Debug|Win32.ActiveCfg = Debug|Win32
41 + {AA653F14-6DE6-4379-89D7-160E5D3B6BC8}.Debug|Win32.Build.0 = Debug|Win32
42 + {AA653F14-6DE6-4379-89D7-160E5D3B6BC8}.Debug|x64.ActiveCfg = Debug|x64
43 + {AA653F14-6DE6-4379-89D7-160E5D3B6BC8}.Debug|x64.Build.0 = Debug|x64
44 + {AA653F14-6DE6-4379-89D7-160E5D3B6BC8}.Release|Win32.ActiveCfg = Release|Win32
45 + {AA653F14-6DE6-4379-89D7-160E5D3B6BC8}.Release|Win32.Build.0 = Release|Win32
46 + {AA653F14-6DE6-4379-89D7-160E5D3B6BC8}.Release|x64.ActiveCfg = Release|x64
47 + {AA653F14-6DE6-4379-89D7-160E5D3B6BC8}.Release|x64.Build.0 = Release|x64
48 + {C954BF29-65C7-4EEF-83A9-7507804B2235}.Debug|Win32.ActiveCfg = Debug|Win32
49 + {C954BF29-65C7-4EEF-83A9-7507804B2235}.Debug|Win32.Build.0 = Debug|Win32
50 + {C954BF29-65C7-4EEF-83A9-7507804B2235}.Debug|x64.ActiveCfg = Debug|Win32
51 + {C954BF29-65C7-4EEF-83A9-7507804B2235}.Release|Win32.ActiveCfg = Release|Win32
52 + {C954BF29-65C7-4EEF-83A9-7507804B2235}.Release|Win32.Build.0 = Release|Win32
53 + {C954BF29-65C7-4EEF-83A9-7507804B2235}.Release|x64.ActiveCfg = Release|Win32
54 + {EE4B5DD7-9DC2-4425-BB12-3B9E10981A00}.Debug|Win32.ActiveCfg = Debug|Win32
55 + {EE4B5DD7-9DC2-4425-BB12-3B9E10981A00}.Debug|Win32.Build.0 = Debug|Win32
56 + {EE4B5DD7-9DC2-4425-BB12-3B9E10981A00}.Debug|x64.ActiveCfg = Debug|Win32
57 + {EE4B5DD7-9DC2-4425-BB12-3B9E10981A00}.Release|Win32.ActiveCfg = Release|Win32
58 + {EE4B5DD7-9DC2-4425-BB12-3B9E10981A00}.Release|Win32.Build.0 = Release|Win32
59 + {EE4B5DD7-9DC2-4425-BB12-3B9E10981A00}.Release|x64.ActiveCfg = Release|Win32
60 + {22F1F2CE-C54C-400E-A8CE-615A80C01589}.Debug|Win32.ActiveCfg = Debug|Win32
61 + {22F1F2CE-C54C-400E-A8CE-615A80C01589}.Debug|Win32.Build.0 = Debug|Win32
62 + {22F1F2CE-C54C-400E-A8CE-615A80C01589}.Debug|x64.ActiveCfg = Debug|Win32
63 + {22F1F2CE-C54C-400E-A8CE-615A80C01589}.Release|Win32.ActiveCfg = Release|Win32
64 + {22F1F2CE-C54C-400E-A8CE-615A80C01589}.Release|Win32.Build.0 = Release|Win32
65 + {22F1F2CE-C54C-400E-A8CE-615A80C01589}.Release|x64.ActiveCfg = Release|Win32
66 + EndGlobalSection
67 + GlobalSection(SolutionProperties) = preSolution
68 + HideSolutionNode = FALSE
69 + EndGlobalSection
70 +EndGlobal
No preview for this file type
No preview for this file type
1 +<?xml version="1.0" encoding="shift_jis"?>
2 +<VisualStudioProject
3 + ProjectType="Visual C++"
4 + Version="9.00"
5 + Name="ITH"
6 + ProjectGUID="{DD6EF1C2-1ED6-4859-BEFB-5B24CAF9AE7A}"
7 + RootNamespace="ITH"
8 + Keyword="Win32Proj"
9 + TargetFrameworkVersion="196613"
10 + >
11 + <Platforms>
12 + <Platform
13 + Name="Win32"
14 + />
15 + </Platforms>
16 + <ToolFiles>
17 + </ToolFiles>
18 + <Configurations>
19 + <Configuration
20 + Name="Debug|Win32"
21 + OutputDirectory="$(SolutionDir)$(ConfigurationName)"
22 + IntermediateDirectory="$(ConfigurationName)"
23 + ConfigurationType="1"
24 + CharacterSet="1"
25 + >
26 + <Tool
27 + Name="VCPreBuildEventTool"
28 + />
29 + <Tool
30 + Name="VCCustomBuildTool"
31 + />
32 + <Tool
33 + Name="VCXMLDataGeneratorTool"
34 + />
35 + <Tool
36 + Name="VCWebServiceProxyGeneratorTool"
37 + />
38 + <Tool
39 + Name="VCMIDLTool"
40 + />
41 + <Tool
42 + Name="VCCLCompilerTool"
43 + Optimization="0"
44 + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
45 + MinimalRebuild="true"
46 + BasicRuntimeChecks="3"
47 + RuntimeLibrary="3"
48 + RuntimeTypeInfo="false"
49 + UsePrecompiledHeader="0"
50 + WarningLevel="3"
51 + DebugInformationFormat="4"
52 + DisableSpecificWarnings="4996"
53 + />
54 + <Tool
55 + Name="VCManagedResourceCompilerTool"
56 + />
57 + <Tool
58 + Name="VCResourceCompilerTool"
59 + />
60 + <Tool
61 + Name="VCPreLinkEventTool"
62 + />
63 + <Tool
64 + Name="VCLinkerTool"
65 + LinkIncremental="2"
66 + IgnoreAllDefaultLibraries="false"
67 + GenerateDebugInformation="true"
68 + SubSystem="2"
69 + EntryPointSymbol="main"
70 + RandomizedBaseAddress="1"
71 + DataExecutionPrevention="0"
72 + TargetMachine="1"
73 + />
74 + <Tool
75 + Name="VCALinkTool"
76 + />
77 + <Tool
78 + Name="VCManifestTool"
79 + />
80 + <Tool
81 + Name="VCXDCMakeTool"
82 + />
83 + <Tool
84 + Name="VCBscMakeTool"
85 + />
86 + <Tool
87 + Name="VCFxCopTool"
88 + />
89 + <Tool
90 + Name="VCAppVerifierTool"
91 + />
92 + <Tool
93 + Name="VCPostBuildEventTool"
94 + />
95 + </Configuration>
96 + <Configuration
97 + Name="Release|Win32"
98 + OutputDirectory="$(SolutionDir)$(ConfigurationName)"
99 + IntermediateDirectory="$(ConfigurationName)"
100 + ConfigurationType="1"
101 + CharacterSet="1"
102 + WholeProgramOptimization="1"
103 + >
104 + <Tool
105 + Name="VCPreBuildEventTool"
106 + />
107 + <Tool
108 + Name="VCCustomBuildTool"
109 + />
110 + <Tool
111 + Name="VCXMLDataGeneratorTool"
112 + />
113 + <Tool
114 + Name="VCWebServiceProxyGeneratorTool"
115 + />
116 + <Tool
117 + Name="VCMIDLTool"
118 + />
119 + <Tool
120 + Name="VCCLCompilerTool"
121 + Optimization="2"
122 + InlineFunctionExpansion="2"
123 + EnableIntrinsicFunctions="true"
124 + EnableFiberSafeOptimizations="true"
125 + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
126 + ExceptionHandling="0"
127 + RuntimeLibrary="2"
128 + BufferSecurityCheck="false"
129 + EnableFunctionLevelLinking="true"
130 + RuntimeTypeInfo="false"
131 + UsePrecompiledHeader="0"
132 + WarningLevel="3"
133 + DebugInformationFormat="3"
134 + DisableSpecificWarnings="4996"
135 + />
136 + <Tool
137 + Name="VCManagedResourceCompilerTool"
138 + />
139 + <Tool
140 + Name="VCResourceCompilerTool"
141 + />
142 + <Tool
143 + Name="VCPreLinkEventTool"
144 + />
145 + <Tool
146 + Name="VCLinkerTool"
147 + AdditionalDependencies="ntdllp.lib"
148 + LinkIncremental="1"
149 + GenerateManifest="false"
150 + IgnoreAllDefaultLibraries="true"
151 + GenerateDebugInformation="true"
152 + SubSystem="2"
153 + OptimizeReferences="2"
154 + EnableCOMDATFolding="2"
155 + EntryPointSymbol="main"
156 + RandomizedBaseAddress="1"
157 + DataExecutionPrevention="0"
158 + TargetMachine="1"
159 + />
160 + <Tool
161 + Name="VCALinkTool"
162 + />
163 + <Tool
164 + Name="VCManifestTool"
165 + />
166 + <Tool
167 + Name="VCXDCMakeTool"
168 + />
169 + <Tool
170 + Name="VCBscMakeTool"
171 + />
172 + <Tool
173 + Name="VCFxCopTool"
174 + />
175 + <Tool
176 + Name="VCAppVerifierTool"
177 + />
178 + <Tool
179 + Name="VCPostBuildEventTool"
180 + CommandLine=""
181 + />
182 + </Configuration>
183 + </Configurations>
184 + <References>
185 + </References>
186 + <Files>
187 + <Filter
188 + Name="Source Files"
189 + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
190 + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
191 + >
192 + <File
193 + RelativePath=".\command.cpp"
194 + >
195 + </File>
196 + <File
197 + RelativePath=".\inject.cpp"
198 + >
199 + </File>
200 + <File
201 + RelativePath=".\main.cpp"
202 + >
203 + </File>
204 + <File
205 + RelativePath=".\pipe.cpp"
206 + >
207 + </File>
208 + <File
209 + RelativePath=".\utility.cpp"
210 + >
211 + </File>
212 + <File
213 + RelativePath=".\window.cpp"
214 + >
215 + </File>
216 + </Filter>
217 + <Filter
218 + Name="Header Files"
219 + Filter="h;hpp;hxx;hm;inl;inc;xsd"
220 + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
221 + >
222 + <File
223 + RelativePath=".\main.h"
224 + >
225 + </File>
226 + <File
227 + RelativePath=".\resource.h"
228 + >
229 + </File>
230 + </Filter>
231 + <Filter
232 + Name="Resource Files"
233 + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
234 + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
235 + >
236 + <File
237 + RelativePath=".\ITH.rc"
238 + >
239 + </File>
240 + </Filter>
241 + </Files>
242 + <Globals>
243 + </Globals>
244 +</VisualStudioProject>
This diff is collapsed. Click to expand it.
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 + <ItemGroup>
4 + <Filter Include="Source Files">
5 + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
6 + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
7 + </Filter>
8 + <Filter Include="Header Files">
9 + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
10 + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
11 + </Filter>
12 + <Filter Include="Resource Files">
13 + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
14 + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
15 + </Filter>
16 + </ItemGroup>
17 + <ItemGroup>
18 + <ClCompile Include="command.cpp">
19 + <Filter>Source Files</Filter>
20 + </ClCompile>
21 + <ClCompile Include="inject.cpp">
22 + <Filter>Source Files</Filter>
23 + </ClCompile>
24 + <ClCompile Include="main.cpp">
25 + <Filter>Source Files</Filter>
26 + </ClCompile>
27 + <ClCompile Include="pipe.cpp">
28 + <Filter>Source Files</Filter>
29 + </ClCompile>
30 + <ClCompile Include="utility.cpp">
31 + <Filter>Source Files</Filter>
32 + </ClCompile>
33 + <ClCompile Include="window.cpp">
34 + <Filter>Source Files</Filter>
35 + </ClCompile>
36 + <ClCompile Include="profile.cpp">
37 + <Filter>Source Files</Filter>
38 + </ClCompile>
39 + <ClCompile Include="language.cpp">
40 + <Filter>Source Files</Filter>
41 + </ClCompile>
42 + </ItemGroup>
43 + <ItemGroup>
44 + <ClInclude Include="main.h">
45 + <Filter>Header Files</Filter>
46 + </ClInclude>
47 + <ClInclude Include="resource.h">
48 + <Filter>Header Files</Filter>
49 + </ClInclude>
50 + <ClInclude Include="window.h">
51 + <Filter>Header Files</Filter>
52 + </ClInclude>
53 + <ClInclude Include="main_template.h">
54 + <Filter>Header Files</Filter>
55 + </ClInclude>
56 + <ClInclude Include="text.h">
57 + <Filter>Header Files</Filter>
58 + </ClInclude>
59 + <ClInclude Include="hookman.h">
60 + <Filter>Header Files</Filter>
61 + </ClInclude>
62 + <ClInclude Include="cmdq.h">
63 + <Filter>Header Files</Filter>
64 + </ClInclude>
65 + <ClInclude Include="profile.h">
66 + <Filter>Header Files</Filter>
67 + </ClInclude>
68 + <ClInclude Include="language.h">
69 + <Filter>Header Files</Filter>
70 + </ClInclude>
71 + </ItemGroup>
72 + <ItemGroup>
73 + <ResourceCompile Include="ITH.rc">
74 + <Filter>Resource Files</Filter>
75 + </ResourceCompile>
76 + </ItemGroup>
77 + <ItemGroup>
78 + <None Include="icon1.ico">
79 + <Filter>Resource Files</Filter>
80 + </None>
81 + </ItemGroup>
82 +</Project>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
4 + <LocalDebuggerWorkingDirectory>..\release</LocalDebuggerWorkingDirectory>
5 + <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
6 + </PropertyGroup>
7 + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
8 + <LocalDebuggerWorkingDirectory>..\release</LocalDebuggerWorkingDirectory>
9 + <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
10 + </PropertyGroup>
11 + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
12 + <LocalDebuggerWorkingDirectory>..\release\</LocalDebuggerWorkingDirectory>
13 + <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
14 + </PropertyGroup>
15 +</Project>
...\ No newline at end of file ...\ No newline at end of file
1 +/* Copyright (C) 2010-2011 kaosu (qiupf2000@gmail.com)
2 + * This file is part of the Interactive Text Hooker.
3 +
4 + * Interactive Text Hooker is free software: you can redistribute it and/or
5 + * modify it under the terms of the GNU General Public License as published
6 + * by the Free Software Foundation, either version 3 of the License, or
7 + * (at your option) any later version.
8 +
9 + * This program is distributed in the hope that it will be useful,
10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 + * GNU General Public License for more details.
13 +
14 + * You should have received a copy of the GNU General Public License
15 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 + */
17 +
18 +#pragma once
19 +#include "main.h"
20 +enum ThreadOperation
21 +{
22 + Suspend,
23 + Resume,
24 + Terminate,
25 + OutputInformation
26 +};
27 +struct PipeRecord
28 +{
29 + HANDLE hTextPipe, hCmdPipe, hThread;
30 +};
31 +void CreateNewPipe();
32 +#define QUEUE_MAX 16 //QUEUE_MAX need to be a exponent of 2;
33 +#define QUEUE_BUFF_SIZE 0x40
34 +#define CMD_SIZE 0x200
35 +
36 +class CommandQueue
37 +{
38 +public:
39 + CommandQueue();
40 + ~CommandQueue();
41 + void AddRequest(const SendParam& sp,DWORD pid=0);
42 + void SendCommand();
43 + bool Empty();
44 + void Register(DWORD pid, DWORD hookman, DWORD module, DWORD engine);
45 + DWORD ProcessCommand(LPWSTR cmd, DWORD pid);
46 +private:
47 + CRITICAL_SECTION rw;
48 + DWORD current;
49 + DWORD used;
50 + HANDLE hSemaphore,hThread;
51 + SendParam queue[QUEUE_MAX];
52 + DWORD pid_associate[QUEUE_MAX];
53 +};
This diff is collapsed. Click to expand it.
1 +/* Copyright (C) 2010-2011 kaosu (qiupf2000@gmail.com)
2 + * This file is part of the Interactive Text Hooker.
3 +
4 + * Interactive Text Hooker is free software: you can redistribute it and/or
5 + * modify it under the terms of the GNU General Public License as published
6 + * by the Free Software Foundation, either version 3 of the License, or
7 + * (at your option) any later version.
8 +
9 + * This program is distributed in the hope that it will be useful,
10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 + * GNU General Public License for more details.
13 +
14 + * You should have received a copy of the GNU General Public License
15 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 + */
17 +
18 +#pragma once
19 +#include <windows.h>
20 +#include "text.h"
21 +#include "..\AVL.h"
22 +class BitMap
23 +{
24 +public:
25 + BitMap();
26 + BitMap(DWORD init_size);
27 + ~BitMap();
28 + bool Check(DWORD number);
29 + void Set(DWORD number);
30 + void Reset();
31 + void Clear(DWORD number);
32 +protected:
33 + BYTE* map;
34 + DWORD size;
35 +};
36 +typedef void (*CustomFilterCallBack) (WORD);
37 +
38 +class CustomFilterUnicode : public BitMap
39 +{
40 +public:
41 + CustomFilterUnicode();
42 + ~CustomFilterUnicode();
43 + bool Check(WORD number);
44 + void Set(WORD number);
45 + void Clear(WORD number);
46 + void Traverse(CustomFilterCallBack callback);
47 +
48 +};
49 +
50 +class CustomFilterMultiByte : public BitMap
51 +{
52 +public:
53 + CustomFilterMultiByte();
54 + ~CustomFilterMultiByte();
55 + bool Check(WORD number);
56 + void Set(WORD number);
57 + void Clear(WORD number);
58 + void Reset();
59 + void Traverse(CustomFilterCallBack callback);
60 +private:
61 + BYTE ascii_map[0x20];
62 +};
63 +
64 +#define MAX_REGISTER 0xF
65 +#define MAX_PREV_REPEAT_LENGTH 0x20
66 +struct ProcessRecord {
67 + DWORD pid_register;
68 + DWORD hookman_register;
69 + DWORD module_register;
70 + DWORD engine_register;
71 + HANDLE process_handle;
72 + HANDLE hookman_mutex;
73 + HANDLE hookman_section;
74 + LPVOID hookman_map;
75 +};
76 +
77 +class ThreadTable : public MyVector<TextThread*,0x40>
78 +{
79 +public:
80 + void SetThread(DWORD number, TextThread* ptr);
81 + TextThread* FindThread(DWORD number);
82 +};
83 +class TCmp
84 +{
85 +public:
86 + char operator()(const ThreadParameter* t1,const ThreadParameter* t2);
87 +};
88 +class TCpy
89 +{
90 +public:
91 + void operator()(ThreadParameter* t1, ThreadParameter* t2);
92 +};
93 +class TLen
94 +{
95 +public:
96 + int operator()(ThreadParameter* t);
97 +};
98 +
99 +class HookManager : public AVLTree<ThreadParameter,DWORD,TCmp,TCpy,TLen>
100 +{
101 +public:
102 + HookManager();
103 + ~HookManager();
104 + TextThread* FindSingle(DWORD pid, DWORD hook, DWORD retn, DWORD split);
105 + TextThread* FindSingle(DWORD number);
106 + TextThread* GetCurrentThread();
107 + void SetCurrent(TextThread* it);
108 + void SelectCurrent(LPWSTR str);
109 + void DispatchText(DWORD pid, BYTE* text, DWORD hook, DWORD retn, DWORD split, int len);
110 + void AddConsoleOutput(LPCWSTR text);
111 + void AddLink(WORD from, WORD to);
112 + void ClearText(DWORD pid, DWORD hook, DWORD retn, DWORD split);
113 + void ClearCurrent();
114 + void ResetRepeatStatus();
115 + void LockHookman();
116 + void UnlockHookman();
117 + void LockProcessHookman(DWORD pid);
118 + void UnlockProcessHookman(DWORD pid);
119 + void RemoveProcessContext(DWORD pid);
120 + void RemoveSingleHook(DWORD pid, DWORD addr);
121 + void RemoveSingleThread(DWORD number);
122 + void RegisterThread(TextThread*, DWORD);
123 + void RegisterPipe(HANDLE text, HANDLE cmd, HANDLE thread);
124 + void RegisterProcess(DWORD pid, DWORD hookman, DWORD module, DWORD engine);
125 + void UnRegisterProcess(DWORD pid);
126 + void WaitForAllRecvThreads();
127 + void SetName(DWORD);
128 + void SetProcessEngineType(DWORD pid, DWORD type);
129 + bool GetProcessPath(DWORD pid, LPWSTR path);
130 + bool GetProcessName(DWORD pid, LPWSTR str);
131 + LPVOID RemoteHook(DWORD pid);
132 + ProcessRecord* Records() {return record;}
133 + ThreadTable* Table() {return thread_table;}
134 + DWORD GetCurrentPID();
135 + DWORD GetPIDByHandle(HANDLE h);
136 + DWORD GetHookManByPID(DWORD pid);
137 + DWORD GetModuleByPID(DWORD pid);
138 + DWORD GetEngineByPID(DWORD pid);
139 + DWORD GetProcessIDByPath(LPWSTR str);
140 + HANDLE GetTextHandleByPID(DWORD pid);
141 + HANDLE GetCmdHandleByPID(DWORD pid);
142 + HANDLE GetMutexByPID(DWORD pid);
143 + HANDLE GetProcessByPID(DWORD pid);
144 +private:
145 + //void AddConsoleOutputNewLine();
146 + //IthCriticalSection hmcs;
147 + CRITICAL_SECTION hmcs; //0x18
148 + TextThread *current;
149 + ThreadTable *thread_table;
150 + HANDLE destroy_event;
151 + ProcessRecord record[MAX_REGISTER+1];
152 + HANDLE text_pipes[MAX_REGISTER+1];
153 + HANDLE cmd_pipes[MAX_REGISTER+1];
154 + HANDLE recv_threads[MAX_REGISTER+1];
155 + WORD register_count, new_thread_number;
156 +};
157 +
No preview for this file type
1 +/* Copyright (C) 2010-2011 kaosu (qiupf2000@gmail.com)
2 + * This file is part of the Interactive Text Hooker.
3 +
4 + * Interactive Text Hooker is free software: you can redistribute it and/or
5 + * modify it under the terms of the GNU General Public License as published
6 + * by the Free Software Foundation, either version 3 of the License, or
7 + * (at your option) any later version.
8 +
9 + * This program is distributed in the hope that it will be useful,
10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 + * GNU General Public License for more details.
13 +
14 + * You should have received a copy of the GNU General Public License
15 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 + */
17 +
18 +#include "main.h"
19 +static WCHAR EngineName[]=L"ITH_engine.dll";
20 +static WCHAR DllName[]=L"ITH.dll";
21 +extern WCHAR file_path[];
22 +extern LPWSTR current_dir;
23 +DWORD Inject(HANDLE hProc)
24 +{
25 + LPVOID lpvAllocAddr = 0;
26 + DWORD dwWrite = 0x1000;
27 + HANDLE hTH;
28 + if (!IthCheckFile(EngineName)) return -1;
29 + if (!IthCheckFile(DllName)) return -1;
30 +
31 + NtAllocateVirtualMemory(hProc, &lpvAllocAddr, 0, &dwWrite, MEM_COMMIT, PAGE_READWRITE);
32 + if (lpvAllocAddr == 0) return -1;
33 + wcscpy(current_dir, DllName);
34 + CheckThreadStart();
35 + NtWriteVirtualMemory(hProc, lpvAllocAddr, file_path + 4, 2 * MAX_PATH, &dwWrite);
36 + hTH=IthCreateThread(LoadLibrary, (DWORD)lpvAllocAddr, hProc);
37 + if (hTH==0||hTH == INVALID_HANDLE_VALUE)
38 + {
39 + ConsoleOutput(ErrorRemoteThread);
40 + return -1;
41 + }
42 + NtWaitForSingleObject(hTH, 0, 0);
43 + THREAD_BASIC_INFORMATION info;
44 + NtQueryInformationThread(hTH, ThreadBasicInformation, &info, sizeof(info), &dwWrite);
45 + NtClose(hTH);
46 + wcscpy(current_dir, EngineName);
47 + NtWriteVirtualMemory(hProc, lpvAllocAddr, file_path + 4, 2 * MAX_PATH, &dwWrite);
48 + hTH = IthCreateThread(LoadLibrary, (DWORD)lpvAllocAddr, hProc);
49 + if (hTH == 0 ||
50 + hTH == INVALID_HANDLE_VALUE)
51 + {
52 + ConsoleOutput(ErrorRemoteThread);
53 + return -1;
54 + }
55 + NtWaitForSingleObject(hTH, 0, 0);
56 + NtClose(hTH);
57 + dwWrite = 0;
58 + NtFreeVirtualMemory(hProc, &lpvAllocAddr, &dwWrite, MEM_RELEASE);
59 + return info.ExitStatus;
60 +}
61 +DWORD PIDByName(LPWSTR pwcTarget)
62 +{
63 + DWORD dwSize = 0x20000;
64 + BYTE *pbBuffer;
65 + SYSTEM_PROCESS_INFORMATION *spiProcessInfo;
66 + DWORD dwPid = 0;
67 + DWORD dwStatus;
68 + while (1)
69 + {
70 + pbBuffer = new BYTE[dwSize];
71 + dwStatus = NtQuerySystemInformation(SystemProcessInformation, pbBuffer, dwSize, 0);
72 + if (dwStatus == 0) break;
73 + delete pbBuffer;
74 + if (dwStatus != STATUS_INFO_LENGTH_MISMATCH) return 0;
75 + dwSize <<= 1;
76 + }
77 +
78 + for (spiProcessInfo = (SYSTEM_PROCESS_INFORMATION*)pbBuffer; spiProcessInfo->dNext;)
79 + {
80 + spiProcessInfo = (SYSTEM_PROCESS_INFORMATION*)
81 + ((DWORD)spiProcessInfo + spiProcessInfo->dNext);
82 + if (_wcsicmp(pwcTarget, spiProcessInfo->usName.Buffer) == 0)
83 + {
84 + dwPid = spiProcessInfo->dUniqueProcessId;
85 + break;
86 + }
87 + }
88 + if (dwPid == 0)
89 + ConsoleOutput(ErrorNoProcess);
90 + delete pbBuffer;
91 + return dwPid;
92 +}
93 +DWORD InjectByPID(DWORD pid)
94 +{
95 + WCHAR str[0x80];
96 + DWORD s;
97 + if (pid == current_process_id)
98 + {
99 + ConsoleOutput(SelfAttach);
100 + return -1;
101 + }
102 + if (GetModuleByPID(pid))
103 + {
104 + ConsoleOutput(AlreadyAttach);
105 + return -1;
106 + }
107 + swprintf(str, L"ITH_HOOKMAN_%.4d", pid);
108 + NtClose(IthCreateMutex(str, 0, &s));
109 + if (s) return -1;
110 + CLIENT_ID id;
111 + OBJECT_ATTRIBUTES oa = {};
112 + HANDLE hProc;
113 + id.UniqueProcess = pid;
114 + id.UniqueThread = 0;
115 + oa.uLength=sizeof(oa);
116 + if (!NT_SUCCESS(NtOpenProcess(&hProc,
117 + PROCESS_QUERY_INFORMATION|
118 + PROCESS_CREATE_THREAD|
119 + PROCESS_VM_OPERATION|
120 + PROCESS_VM_READ|
121 + PROCESS_VM_WRITE,
122 + &oa, &id)))
123 + {
124 + ConsoleOutput(ErrorOpenProcess);
125 + return -1;
126 + }
127 + DWORD module = Inject(hProc);
128 +
129 + NtClose(hProc);
130 + if (module == -1) return -1;
131 +
132 + swprintf(str, FormatInject, pid, module);
133 + ConsoleOutput(str);
134 + return module;
135 +}
1 +/* Copyright (C) 2010-2011 kaosu (qiupf2000@gmail.com)
2 + * This file is part of the Interactive Text Hooker.
3 +
4 + * Interactive Text Hooker is free software: you can redistribute it and/or
5 + * modify it under the terms of the GNU General Public License as published
6 + * by the Free Software Foundation, either version 3 of the License, or
7 + * (at your option) any later version.
8 +
9 + * This program is distributed in the hope that it will be useful,
10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 + * GNU General Public License for more details.
13 +
14 + * You should have received a copy of the GNU General Public License
15 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 + */
17 +const wchar_t* Warning=L"Warning!";
18 +//command.cpp
19 +const wchar_t* ErrorSyntax=L"Syntax error";
20 +//inject.cpp
21 +const wchar_t* ErrorRemoteThread=L"Can't create remote thread.";
22 +const wchar_t* ErrorOpenProcess=L"Can't open process.";
23 +const wchar_t* ErrorNoProcess=L"Process not found";
24 +const wchar_t* SelfAttach=L"Please do not attach to ITH.exe";
25 +const wchar_t* AlreadyAttach=L"Process already attached.";
26 +const wchar_t* FormatInject=L"Inject process %d. Module base %.8X";
27 +//main.cpp
28 +const wchar_t* NotAdmin=L"Can't enable SeDebugPrevilege. ITH might malfunction.\r\n\
29 +Please run ITH as administrator or turn off UAC.";
30 +//pipe.cpp
31 +const wchar_t* ErrorCreatePipe=L"Can't create text pipe or too many instance.";
32 +const wchar_t* FormatDetach=L"Process %d detached.";
33 +const wchar_t* ErrorCmdQueueFull=L"Command queue full.";
34 +const wchar_t* ErrorNoAttach=L"No process attached.";
35 +
36 +//profile.cpp
37 +const wchar_t* ErrorMonitor=L"Can't monitor process.";
38 +//utility.cpp
39 +const wchar_t* InitMessage=L"Copyright (C) 2010-2011 kaosu (qiupf2000@gmail.com)\r\n\
40 +Source code <http://code.google.com/p/interactive-text-hooker/>\r\n\
41 +General discussion <http://www.hongfire.com/forum/showthread.php?t=208860>\r\n";
42 +const wchar_t* BackgroundMsg=L"If you feel tired about the pure white background,\r\n\
43 +put your favorite picture in ITH folder and name it 'background.bmp'\r\n";
44 +const wchar_t* ErrorLinkExist=L"Link exist.";
45 +const wchar_t* ErrorCylicLink=L"Link failed. No cyclic link allowed.";
46 +const wchar_t* FormatLink=L"Link from thread%.4x to thread%.4x.";
47 +const wchar_t* ErrorLink=L"Link failed. Source or/and destination thread not found.";
48 +const wchar_t* ErrorDeleteCombo=L"Error delete from combo.";
49 +
50 +//window.cpp
51 +const wchar_t* ClassName=L"ITH";
52 +const wchar_t* ClassNameAdmin=L"ITH (Administrator)";
53 +const wchar_t* ErrorNotSplit=L"Need to enable split first!";
54 +const wchar_t* ErrorNotModule=L"Need to enable module first!";
55 +//Main window buttons
56 +const wchar_t* ButtonTitleProcess=L"Process";
57 +const wchar_t* ButtonTitleThread=L"Thread";
58 +const wchar_t* ButtonTitleHook=L"Hook";
59 +const wchar_t* ButtonTitleProfile=L"Profile";
60 +const wchar_t* ButtonTitleOption=L"Option";
61 +const wchar_t* ButtonTitleClear=L"Clear";
62 +const wchar_t* ButtonTitleSave=L"Save";
63 +const wchar_t* ButtonTitleTop=L"Top";
64 +//Hook window
65 +const wchar_t* SpecialHook=L"Special hook, no AGTH equivalent.";
66 +//Process window
67 +const wchar_t* TabTitlePID=L"PID";
68 +const wchar_t* TabTitleMemory=L"Memory";
69 +const wchar_t* TabTitleName=L"Name";
70 +const wchar_t* TabTitleTID=L"TID";
71 +const wchar_t* TabTitleStart=L"Start";
72 +const wchar_t* TabTitleModule=L"Module";
73 +const wchar_t* TabTitleState=L"State";
74 +const wchar_t* SuccessAttach=L"Attach ITH to process successfully.";
75 +const wchar_t* FailAttach=L"Failed to attach ITH to process.";
76 +const wchar_t* SuccessDetach=L"ITH detach from process.";
77 +const wchar_t* FailDetach=L"Detach failed.";
78 +//Profile window
79 +const wchar_t* ProfileExist=L"Profile already exists.";
80 +const wchar_t* SuccessAddProfile=L"Profile added.";
81 +const wchar_t* FailAddProfile=L"Fail to add profile";
82 +const wchar_t* TabTitleNumber=L"No.";
83 +const wchar_t* NoFile=L"Can't find file.";
84 +const wchar_t* PathDismatch=L"Process name dismatch, continue?";
85 +const wchar_t* SuccessImportProfile=L"Import profile success";
86 +//const wchar_t* SuccessAddProfile=L"Profile added.";
...\ No newline at end of file ...\ No newline at end of file
1 +/* Copyright (C) 2010-2011 kaosu (qiupf2000@gmail.com)
2 + * This file is part of the Interactive Text Hooker.
3 +
4 + * Interactive Text Hooker is free software: you can redistribute it and/or
5 + * modify it under the terms of the GNU General Public License as published
6 + * by the Free Software Foundation, either version 3 of the License, or
7 + * (at your option) any later version.
8 +
9 + * This program is distributed in the hope that it will be useful,
10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 + * GNU General Public License for more details.
13 +
14 + * You should have received a copy of the GNU General Public License
15 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 + */
17 +#pragma once
18 +
19 +extern const wchar_t* Warning;
20 +//command.cpp
21 +extern const wchar_t* ErrorSyntax;
22 +//inject.cpp
23 +extern const wchar_t* ErrorRemoteThread;
24 +extern const wchar_t* ErrorOpenProcess;
25 +extern const wchar_t* ErrorNoProcess;
26 +extern const wchar_t* SelfAttach;
27 +extern const wchar_t* AlreadyAttach;
28 +extern const wchar_t* FormatInject;
29 +//main.cpp
30 +extern const wchar_t* NotAdmin;
31 +//pipe.cpp
32 +extern const wchar_t* ErrorCreatePipe;
33 +extern const wchar_t* FormatDetach;
34 +extern const wchar_t* ErrorCmdQueueFull;
35 +extern const wchar_t* ErrorNoAttach;
36 +
37 +//profile.cpp
38 +extern const wchar_t* ErrorMonitor;
39 +
40 +//utility.cpp
41 +extern const wchar_t* InitMessage;
42 +extern const wchar_t* BackgroundMsg;
43 +extern const wchar_t* ErrorLinkExist;
44 +extern const wchar_t* ErrorCylicLink;
45 +extern const wchar_t* FormatLink;
46 +extern const wchar_t* ErrorLink;
47 +extern const wchar_t* ErrorDeleteCombo;
48 +
49 +//window.cpp
50 +extern const wchar_t* ClassName;
51 +extern const wchar_t* ClassNameAdmin;
52 +extern const wchar_t* ErrorNotSplit;
53 +extern const wchar_t* ErrorNotModule;
54 +//Main window buttons
55 +extern const wchar_t* ButtonTitleProcess;
56 +extern const wchar_t* ButtonTitleThread;
57 +extern const wchar_t* ButtonTitleHook;
58 +extern const wchar_t* ButtonTitleProfile;
59 +extern const wchar_t* ButtonTitleOption;
60 +extern const wchar_t* ButtonTitleClear;
61 +extern const wchar_t* ButtonTitleSave;
62 +extern const wchar_t* ButtonTitleTop;
63 +//Hook window
64 +extern const wchar_t* SpecialHook;
65 +//Process window
66 +extern const wchar_t* TabTitlePID;
67 +extern const wchar_t* TabTitleMemory;
68 +extern const wchar_t* TabTitleName;
69 +extern const wchar_t* TabTitleTID;
70 +extern const wchar_t* TabTitleStart;
71 +extern const wchar_t* TabTitleModule;
72 +extern const wchar_t* TabTitleState;
73 +extern const wchar_t* SuccessAttach;
74 +extern const wchar_t* FailAttach;
75 +extern const wchar_t* SuccessDetach;
76 +extern const wchar_t* FailDetach;
77 +//Profile window
78 +extern const wchar_t* ProfileExist;
79 +extern const wchar_t* SuccessAddProfile;
80 +extern const wchar_t* FailAddProfile;
81 +extern const wchar_t* TabTitleNumber;
82 +extern const wchar_t* NoFile;
83 +extern const wchar_t* PathDismatch;
84 +extern const wchar_t* SuccessImportProfile;
...\ No newline at end of file ...\ No newline at end of file
This diff is collapsed. Click to expand it.
1 +/* Copyright (C) 2010-2011 kaosu (qiupf2000@gmail.com)
2 + * This file is part of the Interactive Text Hooker.
3 +
4 + * Interactive Text Hooker is free software: you can redistribute it and/or
5 + * modify it under the terms of the GNU General Public License as published
6 + * by the Free Software Foundation, either version 3 of the License, or
7 + * (at your option) any later version.
8 +
9 + * This program is distributed in the hope that it will be useful,
10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 + * GNU General Public License for more details.
13 +
14 + * You should have received a copy of the GNU General Public License
15 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 + */
17 +
18 +#pragma once
19 +#include "..\common.h"
20 +#include "..\ntdll.h"
21 +#include "..\sys.h"
22 +#include "language.h"
23 +#pragma comment(linker,"/manifestdependency:\"type='win32' "\
24 + "name='Microsoft.Windows.Common-Controls' version='6.0.0.0' "\
25 + "processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
26 +
27 +#define GLOBAL extern
28 +#define SHIFT_JIS 0x3A4
29 +class TextBuffer;
30 +class HookManager;
31 +class CommandQueue;
32 +class TextHook;
33 +class BitMap;
34 +class CustomFilterMultiByte;
35 +class CustomFilterUnicode;
36 +class ProfileManager;
37 +#define TextHook Hook
38 +GLOBAL bool running;
39 +
40 +GLOBAL HINSTANCE hIns;
41 +GLOBAL BitMap *pid_map;
42 +GLOBAL CustomFilterMultiByte *mb_filter;
43 +GLOBAL CustomFilterUnicode *uni_filter;
44 +GLOBAL TextBuffer *texts;
45 +GLOBAL HookManager *man;
46 +GLOBAL ProfileManager *pfman;
47 +GLOBAL CommandQueue *cmdq;
48 +GLOBAL HWND hwndCombo,hwndProc,hwndEdit,hMainWnd;
49 +GLOBAL WCHAR pipe[];
50 +GLOBAL WCHAR command[];
51 +GLOBAL HANDLE hPipeExist;
52 +GLOBAL DWORD split_time, process_time, inject_delay, insert_delay;
53 +GLOBAL DWORD auto_inject, auto_insert;
54 +GLOBAL DWORD cyclic_remove,clipboard_flag,global_filter;
55 +GLOBAL CRITICAL_SECTION detach_cs;
56 +DWORD WINAPI RecvThread(LPVOID lpThreadParameter);
57 +DWORD WINAPI CmdThread(LPVOID lpThreadParameter);
58 +
59 +void CopyToClipboard(void* str,bool unicode, int len);
60 +void ConsoleOutput(LPCWSTR text);
61 +DWORD GetCurrentPID();
62 +DWORD GetPIDByHandle(HANDLE h);
63 +DWORD GetHookManByPID(DWORD pid);
64 +DWORD GetModuleByPID(DWORD pid);
65 +DWORD GetEngineByPID(DWORD pid);
66 +DWORD GetProcessIDByPath(LPWSTR str);
67 +HANDLE GetTextHandleByPID(DWORD pid);
68 +HANDLE GetCmdHandleByPID(DWORD pid);
69 +HANDLE GetMutexByPID(DWORD pid);
70 +HANDLE GetProcessByPID(DWORD pid);
71 +DWORD Inject(HANDLE hProc);
72 +DWORD InjectByPID(DWORD pid);
73 +DWORD PIDByName(LPWSTR target);
74 +DWORD Hash(LPWSTR module, int length=-1);
75 +BOOL ActiveDetachProcess(DWORD pid);
76 +BOOL CheckFile(LPWSTR file);
77 +bool GetProcessPath(HANDLE hProc, LPWSTR path);
78 +bool GetProcessPath(DWORD pid, LPWSTR path);
1 +/* Copyright (C) 2010-2011 kaosu (qiupf2000@gmail.com)
2 + * This file is part of the Interactive Text Hooker.
3 +
4 + * Interactive Text Hooker is free software: you can redistribute it and/or
5 + * modify it under the terms of the GNU General Public License as published
6 + * by the Free Software Foundation, either version 3 of the License, or
7 + * (at your option) any later version.
8 +
9 + * This program is distributed in the hope that it will be useful,
10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 + * GNU General Public License for more details.
13 +
14 + * You should have received a copy of the GNU General Public License
15 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 + */
17 +
18 +#pragma once
19 +#include <windows.h>
20 +template <typename T>
21 +void Release(const T& p) {delete p;}
22 +#define MK_FUNDA_TYPE(T) \
23 +template<> \
24 + void Release<T>(const T& p) {}
25 +template<class T>
26 +class BinaryEqual
27 +{
28 +public:
29 + bool operator ()(const T& a, const T& b, DWORD) {return a==b;}
30 +};
31 +template<class T, int default_size, class fComp=BinaryEqual<T> >
32 +class MyVector
33 +{
34 +public:
35 + MyVector()
36 + {
37 + InitializeCriticalSection(&cs_store);
38 + size=default_size;
39 + used=0;
40 + storage=new T[size];
41 + }
42 + virtual ~MyVector()
43 + {
44 + if (storage) delete []storage;
45 + DeleteCriticalSection(&cs_store);
46 + storage=0;
47 + }
48 + void Reset()
49 + {
50 + EnterCriticalSection(&cs_store);
51 + for (int i=0;i<used;i++)
52 + {
53 + Release<T>(storage[i]);
54 + storage[i]=T();
55 + }
56 + used=0;
57 + LeaveCriticalSection(&cs_store);
58 + }
59 + void Remove(int index)
60 + {
61 + if (index>=used) return;
62 + Release<T>(storage[index]);
63 + for (int i=index;i<used;i++)
64 + storage[i]=storage[i+1];
65 + used--;
66 + }
67 + void ClearMemory(int offset, int clear_size)
68 + {
69 + if (clear_size<0) return;
70 + EnterCriticalSection(&cs_store);
71 + if (offset+clear_size<=size)
72 + {
73 +
74 + memset(storage+offset,0,clear_size*sizeof(T));
75 +
76 + }
77 + LeaveCriticalSection(&cs_store);
78 + //else __asm int 3
79 + }
80 + int AddToStore(T* con,int amount)
81 + {
82 + if (amount<=0||con==0) return 0;
83 + int status=0;
84 + EnterCriticalSection(&cs_store);
85 + if (amount+used+2>=size)
86 + {
87 + while (amount+used+2>=size) size<<=1;
88 + T* temp;
89 + if (size*sizeof(T)<0x1000000)
90 + {
91 + temp=new T[size];
92 + memcpy(temp,storage,used*sizeof(T));
93 + }
94 + else
95 + {
96 + size=default_size;
97 + temp=new T[size];
98 + used=0;
99 + status=1;
100 + }
101 + delete []storage;
102 + storage=temp;
103 + }
104 + memcpy(storage+used,con,amount*sizeof(T));
105 + used+=amount;
106 + LeaveCriticalSection(&cs_store);
107 + return status;
108 + }
109 + int Find(const T& item, int start=0, DWORD control=0)
110 + {
111 + int c=-1;
112 + for (int i=start;i<used;i++)
113 + if (fCmp(storage[i],item,control)) {c=i;break;}
114 + //if (storage[i]==item) {c=i;break;}
115 + return c;
116 + }
117 + inline int Used() const {return used;}
118 + inline T* Storage() const {return storage;}
119 +protected:
120 + CRITICAL_SECTION cs_store;
121 + int size, used;
122 + T *storage;
123 + fComp fCmp;
124 +};
125 +
126 +#ifndef ITH_STACK
127 +#define ITH_STACK
128 +template<class T, int default_size>
129 +class MyStack
130 +{
131 +public:
132 + MyStack(): index(0) {}
133 + void push_back(const T& e)
134 + {
135 + if (index<default_size)
136 + s[index++]=e;
137 + }
138 + void pop_back()
139 + {
140 + index--;
141 + }
142 + T& back()
143 + {
144 + return s[index-1];
145 + }
146 + T& operator[](int i) {return s[i];}
147 + int size() {return index;}
148 +private:
149 + int index;
150 + T s[default_size];
151 +};
152 +#endif
...\ No newline at end of file ...\ No newline at end of file
1 +/* Copyright (C) 2010-2011 kaosu (qiupf2000@gmail.com)
2 + * This file is part of the Interactive Text Hooker.
3 +
4 + * Interactive Text Hooker is free software: you can redistribute it and/or
5 + * modify it under the terms of the GNU General Public License as published
6 + * by the Free Software Foundation, either version 3 of the License, or
7 + * (at your option) any later version.
8 +
9 + * This program is distributed in the hope that it will be useful,
10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 + * GNU General Public License for more details.
13 +
14 + * You should have received a copy of the GNU General Public License
15 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 + */
17 +
18 +#include "main.h"
19 +#include "hookman.h"
20 +#include "cmdq.h"
21 +#include "profile.h"
22 +#define NAMED_PIPE_DISCONNECT 1
23 +#define NAMED_PIPE_CONNECT 2
24 +static WCHAR pipe[]=L"\\??\\pipe\\ITH_PIPE";
25 +static WCHAR command[]=L"\\??\\pipe\\ITH_COMMAND";
26 +static bool newline=false;
27 +static bool detach=false;
28 +CRITICAL_SECTION detach_cs;
29 +HANDLE hDetachEvent;
30 +extern HANDLE hPipeExist;
31 +
32 +BYTE* Filter(BYTE *str, int len)
33 +{
34 + WORD s;
35 + while (1)
36 + {
37 + s=*(WORD*)str;
38 + if (len>=2)
39 + {
40 + if (s==0x4081||s==0x3000||s<=0x20) {str+=2;len-=2;}
41 + else break;
42 + }
43 + else if (str[0]<=0x20) {str++;len--;}
44 + else break;
45 + }
46 + return str;
47 +}
48 +void CreateNewPipe()
49 +{
50 + DWORD acl[7]={0x1C0002,1,0x140000,GENERIC_READ|GENERIC_WRITE|SYNCHRONIZE,0x101,0x1000000,0};
51 + SECURITY_DESCRIPTOR sd={1,0,4,0,0,0,(PACL)acl};
52 + HANDLE hTextPipe,hCmdPipe,hThread;
53 + IO_STATUS_BLOCK ios;
54 + UNICODE_STRING us;
55 + RtlInitUnicodeString(&us,pipe);
56 + OBJECT_ATTRIBUTES oa={sizeof(oa),0,&us,OBJ_CASE_INSENSITIVE,&sd,0};
57 + LARGE_INTEGER time={-500000,-1};
58 + if (!NT_SUCCESS(NtCreateNamedPipeFile(&hTextPipe,GENERIC_READ|SYNCHRONIZE,&oa,&ios,
59 + FILE_SHARE_WRITE,FILE_OPEN_IF,FILE_SYNCHRONOUS_IO_NONALERT,1,1,0,-1,0x1000,0x1000,&time)))
60 + {ConsoleOutput(ErrorCreatePipe);return;}
61 + RtlInitUnicodeString(&us,command);
62 + if (!NT_SUCCESS(NtCreateNamedPipeFile(&hCmdPipe,GENERIC_WRITE|SYNCHRONIZE,&oa,&ios,
63 + FILE_SHARE_READ,FILE_OPEN_IF,FILE_SYNCHRONOUS_IO_NONALERT,1,1,0,-1,0x1000,0x1000,&time)))
64 + {ConsoleOutput(ErrorCreatePipe);return;}
65 + hThread=IthCreateThread(RecvThread,(DWORD)hTextPipe);
66 + man->RegisterPipe(hTextPipe,hCmdPipe,hThread);
67 +}
68 +
69 +void DetachFromProcess(DWORD pid)
70 +{
71 + DWORD flag=0;
72 + HANDLE hMutex,hEvent;
73 + IO_STATUS_BLOCK ios;
74 + //module=man->GetModuleByPID(pid);
75 + hEvent=IthCreateEvent(0);
76 + if (STATUS_PENDING==NtFsControlFile(man->GetCmdHandleByPID(pid),hEvent,0,0,&ios,
77 + CTL_CODE(FILE_DEVICE_NAMED_PIPE,NAMED_PIPE_DISCONNECT,0,0),0,0,0,0))
78 + NtWaitForSingleObject(hEvent,0,0);
79 + NtClose(hEvent);
80 + WCHAR mt[0x20];
81 + swprintf(mt,L"ITH_DETACH_%d",pid);
82 +
83 + hMutex=IthOpenMutex(mt);
84 + if (hMutex!=INVALID_HANDLE_VALUE)
85 + {
86 + NtWaitForSingleObject(hMutex,0,0);
87 + NtReleaseMutant(hMutex,0);
88 + NtClose(hMutex);
89 + }
90 + NtSetEvent(hDetachEvent,0);
91 + NtSetEvent(hPipeExist,0);
92 +}
93 +DWORD WINAPI UpdateWindows(LPVOID lpThreadParameter);
94 +void OutputDWORD(DWORD d)
95 +{
96 + WCHAR str[0x20];
97 + swprintf(str,L"%.8X",d);
98 + ConsoleOutput(str);
99 +}
100 +DWORD WINAPI RecvThread(LPVOID lpThreadParameter)
101 +{
102 + HANDLE hTextPipe=(HANDLE)lpThreadParameter, hDisconnect;
103 + IO_STATUS_BLOCK ios; NTSTATUS status;
104 + NtFsControlFile(hTextPipe,0,0,0,&ios,CTL_CODE(FILE_DEVICE_NAMED_PIPE,NAMED_PIPE_CONNECT,0,0),0,0,0,0);
105 + if (!running||texts==0) return 0;
106 + DWORD pid,hookman,p,module,engine;
107 + BYTE *buff=new BYTE[0x1000],*it;
108 + NtReadFile(hTextPipe,0,0,0,&ios,buff,16,0,0);
109 + pid=*(DWORD*)buff;
110 + hookman=*(DWORD*)(buff+0x4);
111 + module=*(DWORD*)(buff+0x8);
112 + engine=*(DWORD*)(buff+0xC);
113 + man->RegisterProcess(pid,hookman,module,engine);
114 + CreateNewPipe();
115 + DWORD RecvLen;
116 + NtClose(IthCreateThread(UpdateWindows,0));
117 + while (running)
118 + {
119 + status=NtReadFile(hTextPipe,0,0,0,&ios,buff,0x1000,0,0);
120 + if (!NT_SUCCESS(status)) break;
121 + RecvLen=ios.uInformation;
122 + if (RecvLen<0xC) break;
123 + p=pid;
124 + DWORD hook=*(DWORD*)buff;
125 + union{DWORD retn; DWORD cmd_type;};
126 + union{DWORD split; DWORD new_engine_addr;};
127 + retn=*((DWORD*)buff+1);
128 + split=*((DWORD*)buff+2);
129 + buff[RecvLen]=0;
130 + buff[RecvLen+1]=0;
131 + it=Filter(buff+0xC,RecvLen-0xC);
132 + RecvLen=RecvLen-(it-buff);
133 + if (RecvLen>>31) RecvLen=0;
134 + if (hook+1==0)
135 + {
136 + switch (cmd_type)
137 + {
138 + case 2:
139 + man->GetProcessPath(pid,(LPWSTR)(buff+0xC));
140 + man->SetProcessEngineType(pid,*(DWORD*)(buff+0x8));
141 + pfman->SetProfileEngine((LPWSTR)(buff+0xC),*(DWORD*)(buff+8));
142 + break;
143 + case 1:
144 + man->GetProcessPath(pid,(LPWSTR)buff);
145 + pfman->RefreshProfileAddr(pid,(LPWSTR)buff);
146 + break;
147 + case 0:
148 + //entry_table->RegisterNewHook(new_engine_addr,(LPWSTR)(buff+0xC),pid);
149 + break;
150 + case -1:
151 + swprintf((LPWSTR)buff,L"%.4d:",pid);
152 + buff[0xA]=0x20;
153 + ConsoleOutput((LPWSTR)buff);
154 + break;
155 + }
156 + }
157 + else
158 + man->DispatchText(p, it,hook,retn,split,RecvLen);
159 + }
160 + EnterCriticalSection(&detach_cs);
161 + hDisconnect=IthCreateEvent(0);
162 + if (STATUS_PENDING==NtFsControlFile(hTextPipe,hDisconnect,0,0,&ios,
163 + CTL_CODE(FILE_DEVICE_NAMED_PIPE,NAMED_PIPE_DISCONNECT,0,0),0,0,0,0))
164 + NtWaitForSingleObject(hDisconnect,0,0);
165 + NtClose(hDisconnect);
166 + DetachFromProcess(pid);
167 + man->UnRegisterProcess(pid);
168 + NtClearEvent(hDetachEvent);
169 + LeaveCriticalSection(&detach_cs);
170 + if (running)
171 + {
172 + swprintf((LPWSTR)buff,FormatDetach,pid);
173 + ConsoleOutput((LPWSTR)buff);
174 + NtClose(IthCreateThread(UpdateWindows,0));
175 + }
176 + delete buff;
177 + return 0;
178 +}
179 +DWORD WINAPI CmdThread(LPVOID lpThreadParameter)
180 +{
181 + CommandQueue* q=(CommandQueue*)lpThreadParameter;
182 + while (running) q->SendCommand();
183 + return 0;
184 +}
185 +
186 +CommandQueue::CommandQueue():used(0),current(1)
187 +{
188 + InitializeCriticalSection(&rw);
189 + NtCreateSemaphore(&hSemaphore,SEMAPHORE_ALL_ACCESS,0,0,QUEUE_MAX);
190 + hThread=IthCreateThread(CmdThread,(DWORD)this);
191 +}
192 +CommandQueue::~CommandQueue()
193 +{
194 + NtReleaseSemaphore(hSemaphore,1,0);
195 + NtWaitForSingleObject(hThread,0,0);
196 + NtClose(hSemaphore);
197 + NtClose(hThread);
198 + DeleteCriticalSection(&rw);
199 +}
200 +void CommandQueue::AddRequest(const SendParam& sp, DWORD pid)
201 +{
202 + if (current==used) ConsoleOutput(ErrorCmdQueueFull);
203 + EnterCriticalSection(&rw);
204 + queue[current]=sp;
205 + if (pid) pid_associate[current++]=pid;
206 + else
207 + {
208 + pid=man->GetCurrentPID();
209 + if (pid) pid_associate[current++]=pid;
210 + else
211 + {
212 + ConsoleOutput(ErrorNoAttach);
213 + goto _request_exit;
214 + }
215 + }
216 + current&=(QUEUE_MAX-1);
217 + NtReleaseSemaphore(hSemaphore,1,0);
218 +_request_exit:
219 + LeaveCriticalSection(&rw);
220 +}
221 +void CommandQueue::SendCommand()
222 +{
223 + NtWaitForSingleObject(hSemaphore,0,0);
224 + if (!running) return;
225 + EnterCriticalSection(&rw);
226 + SendParam sp;
227 + DWORD pid;
228 + HANDLE pipe;
229 + used=(used+1)&(QUEUE_MAX-1);
230 + sp=queue[used];
231 + pid=pid_associate[used];
232 + pipe=man->GetCmdHandleByPID(pid);
233 + if (pipe)
234 + {
235 + IO_STATUS_BLOCK ios;
236 + NtWriteFile(pipe,0,0,0,&ios,&sp,sizeof(SendParam),0,0);
237 + }
238 + LeaveCriticalSection(&rw);
239 +}
240 +bool CommandQueue::Empty()
241 +{
242 + return ((used+1)&(QUEUE_MAX-1))==current;
243 +}
244 +void CommandQueue::Register(DWORD pid, DWORD hookman, DWORD module, DWORD engine)
245 +{
246 + man->RegisterProcess(pid,hookman,module,engine);
247 +}
This diff is collapsed. Click to expand it.
1 +/* Copyright (C) 2010-2011 kaosu (qiupf2000@gmail.com)
2 + * This file is part of the Interactive Text Hooker.
3 +
4 + * Interactive Text Hooker is free software: you can redistribute it and/or
5 + * modify it under the terms of the GNU General Public License as published
6 + * by the Free Software Foundation, either version 3 of the License, or
7 + * (at your option) any later version.
8 +
9 + * This program is distributed in the hope that it will be useful,
10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 + * GNU General Public License for more details.
13 +
14 + * You should have received a copy of the GNU General Public License
15 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 + */
17 +
18 +#pragma once
19 +#include "main.h"
20 +#include "..\AVL.h"
21 +#define THREAD_MASK_RETN 1
22 +#define THREAD_MASK_SPLIT 2
23 +struct ThreadParam
24 +{
25 + WORD hook_index,status;
26 + DWORD hook_addr;
27 + DWORD retn;
28 + DWORD split;
29 + WORD hm_index,reserve;
30 +};
31 +struct LinkParam
32 +{
33 + WORD from_index,to_index;
34 +};
35 +struct CommentParam
36 +{
37 + WORD thread_index,status;
38 + LPWSTR comment;
39 +};
40 +class Profile
41 +{
42 +public:
43 + Profile();
44 + Profile(const Profile& p);
45 + ~Profile();
46 + void Release();
47 + void AddHook(const HookParam& hp);
48 + void RemoveThread(int index);
49 + void RemoveLink(int index);
50 + void RemoveComment(int index);
51 + void ClearHooks();
52 + int AddThread(ThreadParam *tp);
53 + int AddLink(LinkParam* lp);
54 + int AddComment(LPWSTR comment, WORD index);
55 + Profile& operator = (Profile& pf);
56 + HookParam hps[4];
57 + WORD hook_count,thread_count,link_count,comment_count,select_index;
58 + WORD engine_type,thread_allocate,link_allocate,comment_allocate,flag;
59 + ThreadParam* threads;
60 + LinkParam* links;
61 + CommentParam *comments;
62 +};
63 +typedef TreeNode<LPWSTR,Profile> ProfileNode;
64 +class ProfileManager
65 +{
66 +public:
67 + ProfileManager();
68 + ~ProfileManager();
69 + void AddProfile(LPWSTR path, const Profile& p);
70 + void ClearProfile();
71 + void LoadProfile();
72 + void SaveProfile();
73 + void DeleteProfile(int index);
74 + void DeleteProfile(LPWSTR path);
75 + void RefreshProfileAddr(DWORD pid,LPWSTR path);
76 + void SetProfileEngine(LPWSTR path, DWORD type);
77 + bool IsPathProfile(LPWSTR path);
78 + ProfileNode* GetProfile(LPWSTR path);
79 + ProfileNode* GetProfile(int index);
80 + ProfileNode* BeginProfile();
81 + ProfileNode* EndProfile();
82 +private:
83 + AVLTree<WCHAR,Profile,WCMP,WCPY,WLEN> pftree;
84 + HANDLE hMonitorThread;
85 +};
86 +void GetCode(const HookParam& hp, LPWSTR buffer, DWORD pid=0);
87 +void GetThreadString(ThreadParam* tp, LPWSTR str);
...\ No newline at end of file ...\ No newline at end of file
No preview for this file type
1 +/* Copyright (C) 2010-2011 kaosu (qiupf2000@gmail.com)
2 + * This file is part of the Interactive Text Hooker.
3 +
4 + * Interactive Text Hooker is free software: you can redistribute it and/or
5 + * modify it under the terms of the GNU General Public License as published
6 + * by the Free Software Foundation, either version 3 of the License, or
7 + * (at your option) any later version.
8 +
9 + * This program is distributed in the hope that it will be useful,
10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 + * GNU General Public License for more details.
13 +
14 + * You should have received a copy of the GNU General Public License
15 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 + */
17 +
18 +#pragma once
19 +#include "main.h"
20 +#include "main_template.h"
21 +class TextBuffer : public MyVector<BYTE, 0x800>
22 +{
23 +public:
24 + TextBuffer();
25 + virtual ~TextBuffer();
26 + void AddText(BYTE* text,int len,bool);
27 + void AddNewLIne();
28 + void ReplaceSentence(BYTE* text, int len);
29 + void Flush();
30 + void ClearBuffer();
31 + void SetUnicode(bool mode);
32 + void SetLine();
33 +private:
34 + bool line;
35 + bool unicode;
36 +};
37 +struct RepeatCountNode
38 +{
39 + short repeat;
40 + short count;
41 + RepeatCountNode* next;
42 +};
43 +struct ThreadParameter
44 +{
45 + DWORD pid;
46 + DWORD hook;
47 + DWORD retn;
48 + DWORD spl;
49 + /*DWORD spl;
50 + DWORD retn;
51 + DWORD hook;
52 + DWORD pid;*/
53 +};
54 +#define COUNT_PER_FOWARD 0x200
55 +#define REPEAT_DETECT 0x10000
56 +#define REPEAT_SUPPRESS 0x20000
57 +#define REPEAT_NEWLINE 0x40000
58 +class TextThread : public MyVector<BYTE, 0x200>
59 +{
60 +public:
61 + TextThread(DWORD pid, DWORD hook, DWORD retn, DWORD spl, WORD num);
62 + virtual ~TextThread();
63 + void Reset();
64 + void AddToStore(BYTE* con,int len, bool new_line=false, bool console=false);
65 + void RemoveSingleRepeatAuto(BYTE* con, int &len);
66 + void RemoveSingleRepeatForce(BYTE* con, int &len);
67 + void RemoveCyclicRepeat(BYTE* &con, int &len);
68 + void ResetRepeatStatus();
69 + void AddLineBreak();
70 + void ResetEditText();
71 + void ComboSelectCurrent();
72 + void GetEntryString(LPWSTR str);
73 + void CopyLastSentence(LPWSTR str);
74 + void CopyLastToClipboard();
75 + void ExportTextToFile(LPWSTR filename);
76 + void AdjustPrevRepeat(DWORD len);
77 + void PrevRepeatLength(DWORD &len);
78 + void SetComment(LPWSTR);
79 + bool AddToCombo();
80 + bool RemoveFromCombo();
81 + bool CheckCycle(TextThread* start);
82 + void SetNewLineFlag();
83 + void SetNewLineTimer();
84 + inline DWORD PID() const {return tp.pid;}
85 + inline DWORD Addr() const {return tp.hook;}
86 + inline DWORD& Status() {return status;}
87 + inline WORD Number() const {return number;}
88 + inline WORD& Last() {return last;}
89 + inline WORD& LinkNumber() {return link_number;}
90 + inline UINT_PTR& Timer() {return timer;}
91 + inline ThreadParameter* GetThreadParameter() {return &tp;}
92 + inline TextThread*& Link() {return link;}
93 +
94 + inline void SetRepeatFlag();
95 + inline void ClearNewLineFlag();
96 + inline void ClearRepeatFlag();
97 + inline LPWSTR GetComment() {return comment;}
98 +private:
99 + ThreadParameter tp;
100 +
101 + WORD number,link_number;
102 + WORD last,align_space;
103 + WORD repeat_single;
104 + WORD repeat_single_current;
105 + WORD repeat_single_count;
106 + WORD repeat_detect_count;
107 + RepeatCountNode* head;
108 +
109 + TextThread *link;
110 + LPWSTR comment,thread_string;
111 + UINT_PTR timer;
112 + DWORD status,repeat_detect_limit;
113 + DWORD last_sentence,prev_sentence,sentence_length,repeat_index,last_time;
114 +};
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 +/* Copyright (C) 2010-2011 kaosu (qiupf2000@gmail.com)
2 + * This file is part of the Interactive Text Hooker.
3 +
4 + * Interactive Text Hooker is free software: you can redistribute it and/or
5 + * modify it under the terms of the GNU General Public License as published
6 + * by the Free Software Foundation, either version 3 of the License, or
7 + * (at your option) any later version.
8 +
9 + * This program is distributed in the hope that it will be useful,
10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 + * GNU General Public License for more details.
13 +
14 + * You should have received a copy of the GNU General Public License
15 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 + */
17 +
18 +#pragma once
19 +#include "main.h"
20 +#include "hookman.h"
21 +#include "cmdq.h"
22 +#include "profile.h"
23 +BYTE* GetSystemInformation();
24 +int GetProcessMemory(HANDLE hProc, DWORD& mem_size, DWORD& ws);
25 +int GetHookString(LPWSTR str, DWORD pid, DWORD hook_addr, DWORD status);
26 +SYSTEM_PROCESS_INFORMATION* GetBaseByPid(BYTE* pbBuffer,DWORD dwPid);
27 +LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
28 +LPWSTR StateString[StateUnknown+1]={
29 + L"Initialized",L"Ready",L"Running",L"Standby",
30 + L"Terminated",L"Wait",L"Transition",L"Unknown"
31 +};
32 +LPWSTR WaitReasonString[MaximumWaitReason]={
33 + L"Executive",L"FreePage",L"PageIn",L"PoolAllocation",
34 + L"DelayExecution",L"Suspended",L"UserRequest",L"Executive",
35 + L"FreePage",L"PageIn",L"PoolAllocation",L"DelayExecution",
36 + L"Suspended",L"UserRequest",L"EventPair",L"Queue",
37 + L"LpcReceive",L"LpcReply",L"VirtualMemory",L"PageOut",
38 + L"Rendezvous",L"Spare2",L"Spare3",L"Spare4",
39 + L"Spare5",L"Spare6",L"Kernel"
40 +};
41 +#define IDC_CHECK_BIGENDIAN IDC_CHECK1
42 +#define IDC_CHECK_UNICODE IDC_CHECK2
43 +#define IDC_CHECK_STRING IDC_CHECK3
44 +#define IDC_CHECK_DATA_IND IDC_CHECK4
45 +#define IDC_CHECK_SPLIT IDC_CHECK5
46 +#define IDC_CHECK_SPLIT_IND IDC_CHECK6
47 +#define IDC_CHECK_MODULE IDC_CHECK7
48 +#define IDC_CHECK_FUNCTION IDC_CHECK8
49 +#define IDC_CHECK_HEX IDC_CHECK9
50 +#define IDC_CHECK_LASTCHAR IDC_CHECK10
51 +#define IDC_CHECK_NOCONTEXT IDC_CHECK11
52 +
53 +class ProcessWindow
54 +{
55 +public:
56 + ProcessWindow(HWND hDialog);
57 + void InitProcessDlg();
58 + void RefreshProcess();
59 + void AttachProcess();
60 + void DetachProcess();
61 + void OperateThread();
62 + void AddCurrentToProfile();
63 + void RefreshThread(int index);
64 + void RefreshThreadColumns(DWORD pid);
65 + bool PerformThread(DWORD pid, DWORD tid, ThreadOperation op=OutputInformation, DWORD addr=0);
66 + DWORD GetSelectPID();
67 +private:
68 + HWND hDlg;
69 + HWND hlProcess,hlThread;
70 + HWND hbRefresh,hbAttach,hbDetach,hbExecute,hbAddProfile;
71 + HWND heAddr,heOutput;
72 + HWND hrSuspend,hrResume,hrTerminate;
73 +};
74 +
75 +class ThreadWindow
76 +{
77 +public:
78 + ThreadWindow(HWND hDialog);
79 + void InitWindow();
80 + void InitThread(int index);
81 + void SetThreadInfo(int index);
82 + void RemoveLink(int index);
83 + void SetThread();
84 + void SetLastSentence(DWORD select);
85 + void ExportAllThreadText();
86 + void ExportSingleThreadText();
87 +private:
88 + HWND hDlg;
89 + HWND hcCurrentThread,hcLinkThread;
90 + HWND hlFromThread;
91 + HWND heInfo,heSentence,heComment;
92 +};
93 +
94 +class HookWindow
95 +{
96 +public:
97 + HookWindow(HWND hDialog);
98 + inline bool IsBigEndian();
99 + inline bool IsUnicode();
100 + inline bool IsString();
101 + inline bool IsDataInd();
102 + inline bool IsSplit();
103 + inline bool IsSplitInd();
104 + inline bool IsModule();
105 + inline bool IsFunction();
106 + inline bool IsHex();
107 + inline bool IsLastChar();
108 + inline bool IsNoContext();
109 + void GenerateCode();
110 + void GenerateHash(int ID);
111 + void RemoveHook();
112 + void ModifyHook();
113 + void ResetDialog(const HookParam& hp);
114 + void ResetDialog(int index);
115 + void GetHookParam(HookParam& hp);
116 + void InitDlg();
117 + void ResetDlgHooks(DWORD pid, HookParam& hp);
118 +
119 +private:
120 + void PrintSignDWORD(LPWSTR str, DWORD d);
121 + HWND hDlg,hCombo,hText;
122 + HWND hcBigEndian, hcUnicode, hcString, hcDataInd,
123 + hcSplit, hcSplitInd, hcModule, hcFunction,
124 + hcHex, hcLastChar, hcNoContext;
125 + HWND heAddr, heData, heDataInd, heSplit,
126 + heSplitInd, heModule, heFunction, heHash;
127 + HWND hbModify, hbRemove, hbModule, hbFunction, hbCode;
128 +};
129 +
130 +class ProfileWindow
131 +{
132 +public:
133 + ProfileWindow(HWND hDialog);
134 + void RefreshProfileList();
135 + void StartProfileProcess();
136 + void ResetProfile(int index);
137 + void ResetProfileWindow(int index=-1);
138 + void SetCurrentProfile(Profile* pf);
139 + void SaveCurrentProfile();
140 + void DeleteCurrentProfile();
141 + void ExportCurrentProfile();
142 + void ExportAllProfile();
143 + void ImportCurrentProfile();
144 + void DeleteItem(int last_select);
145 + void CheckHook(int index, bool check);
146 + bool IsHook(int index);
147 + Profile* GetCurrentProfile();
148 + DWORD GetCurrentSelect();
149 + HWND hDlg,hlProfileList,hlThread,hlComment,hlLink;
150 + HWND hePath,heHook1,heHook2,heHook3,heHook4;
151 + HWND hcHook1,hcHook2,hcHook3,hcHook4;
152 + HWND hbStart, hbDelete, hbSave;
153 + HWND hcbSelect;
154 +};
155 +
156 +void ExportSingleProfile(ProfileNode* pfn, MyVector<WCHAR,0x1000,WCMP> &export_text);
157 +
158 +class FilterWindow
159 +{
160 +public:
161 + FilterWindow(HWND hDialog);
162 + ~FilterWindow();
163 + void Init();
164 + void SetCurrentChar();
165 + void SelectCurrentChar(DWORD index);
166 + void InitWithChar(WCHAR);
167 + void DeleteCurrentChar();
168 + void AddNewChar();
169 + void DrawGlyph(WCHAR);
170 + void ClearGlyphArea();
171 + void SetUniChar(WCHAR);
172 + void SetMBChar(WORD);
173 + void SetCommitFlag();
174 + UINT IsSJISCheck();
175 + UINT IsUnicodeCheck();
176 +private:
177 + TEXTMETRIC tm;
178 + RECT rc;
179 + HWND hDlg;
180 + HWND hList;
181 + HWND hGlyph;
182 + HDC hGlyphDC;
183 + HBRUSH white;
184 + HFONT hGlyphFont;
185 + HWND hSJIS,hUnicode,hChar;
186 + DWORD init_x,init_y;
187 + BYTE modify,remove,commit;
188 +};
...\ No newline at end of file ...\ No newline at end of file
1 +/* Copyright (C) 2010-2011 kaosu (qiupf2000@gmail.com)
2 + * This file is part of the Interactive Text Hooker.
3 +
4 + * Interactive Text Hooker is free software: you can redistribute it and/or
5 + * modify it under the terms of the GNU General Public License as published
6 + * by the Free Software Foundation, either version 3 of the License, or
7 + * (at your option) any later version.
8 +
9 + * This program is distributed in the hope that it will be useful,
10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 + * GNU General Public License for more details.
13 +
14 + * You should have received a copy of the GNU General Public License
15 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 + */
17 +
18 +#pragma once
19 +#include "common.h"
20 +#ifdef ITHMAIN
21 +#define ITHAPI __declspec(dllexport) __stdcall
22 +#else
23 +#define ITHAPI __declspec(dllimport) __stdcall
24 +#endif
25 +extern "C" {
26 +void ITHAPI OutputConsole(LPWSTR str);
27 +void ITHAPI OutputDWORD(DWORD d);
28 +void ITHAPI OutputRegister(DWORD *base);
29 +void ITHAPI NewHook(const HookParam& hp, LPWSTR name=0, DWORD flag=HOOK_ENGINE);
30 +void ITHAPI RemoveHook(DWORD addr);
31 +void ITHAPI RegisterEngineType(DWORD type);
32 +void ITHAPI RegisterHookName(LPWSTR str, DWORD addr);
33 +void ITHAPI SwitchTrigger(bool on=true);
34 +DWORD ITHAPI GetFunctionAddr(char* name, DWORD* addr, DWORD *base, DWORD* size, LPWSTR* base_name);
35 +}
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="shift_jis"?>
2 +<VisualStudioProject
3 + ProjectType="Visual C++"
4 + Version="9.00"
5 + Name="ITH_DLL"
6 + ProjectGUID="{AA147E63-3B9B-4C9F-B073-06681219A8FB}"
7 + RootNamespace="ITH_DLL"
8 + Keyword="Win32Proj"
9 + TargetFrameworkVersion="196613"
10 + >
11 + <Platforms>
12 + <Platform
13 + Name="Win32"
14 + />
15 + </Platforms>
16 + <ToolFiles>
17 + </ToolFiles>
18 + <Configurations>
19 + <Configuration
20 + Name="Debug|Win32"
21 + OutputDirectory="$(SolutionDir)$(ConfigurationName)"
22 + IntermediateDirectory="$(ConfigurationName)"
23 + ConfigurationType="2"
24 + CharacterSet="1"
25 + >
26 + <Tool
27 + Name="VCPreBuildEventTool"
28 + />
29 + <Tool
30 + Name="VCCustomBuildTool"
31 + />
32 + <Tool
33 + Name="VCXMLDataGeneratorTool"
34 + />
35 + <Tool
36 + Name="VCWebServiceProxyGeneratorTool"
37 + />
38 + <Tool
39 + Name="VCMIDLTool"
40 + />
41 + <Tool
42 + Name="VCCLCompilerTool"
43 + Optimization="0"
44 + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;ITH_DLL_EXPORTS"
45 + MinimalRebuild="true"
46 + BasicRuntimeChecks="3"
47 + RuntimeLibrary="3"
48 + UsePrecompiledHeader="0"
49 + WarningLevel="3"
50 + DebugInformationFormat="4"
51 + />
52 + <Tool
53 + Name="VCManagedResourceCompilerTool"
54 + />
55 + <Tool
56 + Name="VCResourceCompilerTool"
57 + />
58 + <Tool
59 + Name="VCPreLinkEventTool"
60 + />
61 + <Tool
62 + Name="VCLinkerTool"
63 + LinkIncremental="2"
64 + GenerateDebugInformation="true"
65 + SubSystem="2"
66 + TargetMachine="1"
67 + />
68 + <Tool
69 + Name="VCALinkTool"
70 + />
71 + <Tool
72 + Name="VCManifestTool"
73 + />
74 + <Tool
75 + Name="VCXDCMakeTool"
76 + />
77 + <Tool
78 + Name="VCBscMakeTool"
79 + />
80 + <Tool
81 + Name="VCFxCopTool"
82 + />
83 + <Tool
84 + Name="VCAppVerifierTool"
85 + />
86 + <Tool
87 + Name="VCPostBuildEventTool"
88 + />
89 + </Configuration>
90 + <Configuration
91 + Name="Release|Win32"
92 + OutputDirectory="$(SolutionDir)$(ConfigurationName)"
93 + IntermediateDirectory="$(ConfigurationName)"
94 + ConfigurationType="2"
95 + CharacterSet="1"
96 + WholeProgramOptimization="1"
97 + >
98 + <Tool
99 + Name="VCPreBuildEventTool"
100 + />
101 + <Tool
102 + Name="VCCustomBuildTool"
103 + />
104 + <Tool
105 + Name="VCXMLDataGeneratorTool"
106 + />
107 + <Tool
108 + Name="VCWebServiceProxyGeneratorTool"
109 + />
110 + <Tool
111 + Name="VCMIDLTool"
112 + />
113 + <Tool
114 + Name="VCCLCompilerTool"
115 + Optimization="2"
116 + InlineFunctionExpansion="2"
117 + EnableIntrinsicFunctions="true"
118 + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;ITH_DLL_EXPORTS"
119 + ExceptionHandling="0"
120 + RuntimeLibrary="2"
121 + BufferSecurityCheck="false"
122 + EnableFunctionLevelLinking="true"
123 + RuntimeTypeInfo="false"
124 + UsePrecompiledHeader="0"
125 + WarningLevel="3"
126 + DebugInformationFormat="0"
127 + DisableSpecificWarnings="4996;4733"
128 + />
129 + <Tool
130 + Name="VCManagedResourceCompilerTool"
131 + />
132 + <Tool
133 + Name="VCResourceCompilerTool"
134 + />
135 + <Tool
136 + Name="VCPreLinkEventTool"
137 + />
138 + <Tool
139 + Name="VCLinkerTool"
140 + AdditionalDependencies="ntdllp.lib"
141 + OutputFile="$(OutDir)\ITH.dll"
142 + LinkIncremental="1"
143 + GenerateManifest="false"
144 + IgnoreAllDefaultLibraries="true"
145 + GenerateDebugInformation="false"
146 + SubSystem="2"
147 + TerminalServerAware="0"
148 + OptimizeReferences="2"
149 + EnableCOMDATFolding="2"
150 + EntryPointSymbol="DllMain"
151 + BaseAddress=""
152 + RandomizedBaseAddress="1"
153 + DataExecutionPrevention="0"
154 + TargetMachine="1"
155 + />
156 + <Tool
157 + Name="VCALinkTool"
158 + />
159 + <Tool
160 + Name="VCManifestTool"
161 + />
162 + <Tool
163 + Name="VCXDCMakeTool"
164 + />
165 + <Tool
166 + Name="VCBscMakeTool"
167 + />
168 + <Tool
169 + Name="VCFxCopTool"
170 + />
171 + <Tool
172 + Name="VCAppVerifierTool"
173 + />
174 + <Tool
175 + Name="VCPostBuildEventTool"
176 + CommandLine="..\release\EnableSEH"
177 + />
178 + </Configuration>
179 + </Configurations>
180 + <References>
181 + </References>
182 + <Files>
183 + <Filter
184 + Name="Source Files"
185 + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
186 + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
187 + >
188 + <File
189 + RelativePath=".\disasm.cpp"
190 + >
191 + </File>
192 + <File
193 + RelativePath=".\main.cpp"
194 + >
195 + </File>
196 + <File
197 + RelativePath=".\range.cpp"
198 + >
199 + </File>
200 + <File
201 + RelativePath=".\texthook.cpp"
202 + >
203 + </File>
204 + <File
205 + RelativePath=".\utility.cpp"
206 + >
207 + </File>
208 + </Filter>
209 + <Filter
210 + Name="Header Files"
211 + Filter="h;hpp;hxx;hm;inl;inc;xsd"
212 + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
213 + >
214 + <File
215 + RelativePath=".\utility.h"
216 + >
217 + </File>
218 + </Filter>
219 + <Filter
220 + Name="Resource Files"
221 + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
222 + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
223 + >
224 + </Filter>
225 + </Files>
226 + <Globals>
227 + </Globals>
228 +</VisualStudioProject>
This diff is collapsed. Click to expand it.
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 + <ItemGroup>
4 + <Filter Include="Source Files">
5 + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
6 + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
7 + </Filter>
8 + <Filter Include="Header Files">
9 + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
10 + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
11 + </Filter>
12 + <Filter Include="Resource Files">
13 + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
14 + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
15 + </Filter>
16 + </ItemGroup>
17 + <ItemGroup>
18 + <ClCompile Include="main.cpp">
19 + <Filter>Source Files</Filter>
20 + </ClCompile>
21 + <ClCompile Include="texthook.cpp">
22 + <Filter>Source Files</Filter>
23 + </ClCompile>
24 + <ClCompile Include="pipe.cpp">
25 + <Filter>Source Files</Filter>
26 + </ClCompile>
27 + </ItemGroup>
28 + <ItemGroup>
29 + <ClInclude Include="utility.h">
30 + <Filter>Header Files</Filter>
31 + </ClInclude>
32 + </ItemGroup>
33 +</Project>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 +</Project>
...\ No newline at end of file ...\ No newline at end of file
1 +/* Copyright (C) 2010-2011 kaosu (qiupf2000@gmail.com)
2 + * This file is part of the Interactive Text Hooker.
3 +
4 + * Interactive Text Hooker is free software: you can redistribute it and/or
5 + * modify it under the terms of the GNU General Public License as published
6 + * by the Free Software Foundation, either version 3 of the License, or
7 + * (at your option) any later version.
8 +
9 + * This program is distributed in the hope that it will be useful,
10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 + * GNU General Public License for more details.
13 +
14 + * You should have received a copy of the GNU General Public License
15 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 + */
17 +
18 +#include <intrin.h>
19 +#include "utility.h"
20 +//#include "md5.h"
21 +#include "..\AVL.h"
22 +
23 +#define HOOK_BUFFER_SIZE (MAX_HOOK*sizeof(TextHook))
24 +//#define MAX_HOOK (HOOK_BUFFER_SIZE/sizeof(TextHook))
25 +WCHAR dll_mutex[0x100];
26 +WCHAR dll_name[0x100];
27 +WCHAR hm_mutex[0x100];
28 +WCHAR hm_section[0x100];
29 +HINSTANCE hDLL;
30 +HANDLE hSection;
31 +bool running,live=false;
32 +int current_hook=0,user_hook_count=0,trigger=0;
33 +HANDLE hSendThread,hCmdThread,hFile,hMutex,hmMutex;
34 +DWORD hook_buff_len=HOOK_BUFFER_SIZE;
35 +//DWORD current_process_id;
36 +extern DWORD enter_count;
37 +extern LPWSTR current_dir;
38 +extern DWORD engine_type;
39 +AVLTree<char, FunctionInfo, SCMP, SCPY, SLEN> *tree;
40 +void AddModule(DWORD hModule, DWORD size, LPWSTR name)
41 +{
42 + IMAGE_DOS_HEADER *DosHdr;
43 + IMAGE_NT_HEADERS *NtHdr;
44 + IMAGE_EXPORT_DIRECTORY *ExtDir;
45 + UINT uj;
46 + FunctionInfo info={0,hModule,size,name};
47 + char* pcFuncPtr,*pcBuffer;
48 + DWORD dwReadAddr,dwFuncName,dwExportAddr;
49 + WORD wOrd;
50 + DosHdr=(IMAGE_DOS_HEADER*)hModule;
51 + if (IMAGE_DOS_SIGNATURE==DosHdr->e_magic)
52 + {
53 + dwReadAddr=hModule+DosHdr->e_lfanew;
54 + NtHdr=(IMAGE_NT_HEADERS*)dwReadAddr;
55 + if (IMAGE_NT_SIGNATURE==NtHdr->Signature)
56 + {
57 + dwExportAddr=NtHdr->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress;
58 + if (dwExportAddr==0) return;
59 + dwExportAddr+=hModule;
60 + ExtDir=(IMAGE_EXPORT_DIRECTORY*)dwExportAddr;
61 + dwExportAddr=hModule+ExtDir->AddressOfNames;
62 + for (uj=0;uj<ExtDir->NumberOfNames;uj++)
63 + {
64 + dwFuncName=*(DWORD*)dwExportAddr;
65 + pcBuffer=(char*)(hModule+dwFuncName);
66 + pcFuncPtr=(char*)(hModule+(DWORD)ExtDir->AddressOfNameOrdinals+(uj*sizeof(WORD)));
67 + wOrd=*(WORD*)pcFuncPtr;
68 + pcFuncPtr=(char*)(hModule+(DWORD)ExtDir->AddressOfFunctions+(wOrd*sizeof(DWORD)));
69 + info.addr=hModule+*(DWORD*)pcFuncPtr;
70 + tree->Insert(pcBuffer,info);
71 + dwExportAddr+=sizeof(DWORD);
72 + }
73 + }
74 + }
75 +}
76 +void GetFunctionNames()
77 +{
78 + tree=new AVLTree<char, FunctionInfo, SCMP,SCPY,SLEN>;
79 + PPEB ppeb;
80 + __asm
81 + {
82 + mov eax,fs:[0x30]
83 + mov ppeb,eax
84 + }
85 + DWORD temp=*(DWORD*)(&ppeb->Ldr->InLoadOrderModuleList);
86 + PLDR_DATA_TABLE_ENTRY it=(PLDR_DATA_TABLE_ENTRY) temp;
87 + while (it->SizeOfImage)
88 + {
89 + AddModule((DWORD)it->DllBase,it->SizeOfImage,it->BaseDllName.Buffer);
90 + it=(PLDR_DATA_TABLE_ENTRY)it->InLoadOrderModuleList.Flink;
91 + if (*(DWORD*)it==temp) break;
92 + }
93 +}
94 +DWORD ITHAPI GetFunctionAddr(char* name, DWORD* addr, DWORD* base, DWORD* size, LPWSTR* base_name)
95 +{
96 + TreeNode<char*,FunctionInfo>* node=tree->Search(name);
97 + if (node)
98 + {
99 + if (addr) *addr=node->data.addr;
100 + if (base) *base=node->data.module;
101 + if (size) *size=node->data.size;
102 + if (base_name) *base_name=node->data.name;
103 + return 1;
104 + }
105 + else return 0;
106 +}
107 +void RequestRefreshProfile()
108 +{
109 + if (live)
110 + {
111 + BYTE buffer[0x80];
112 + *(DWORD*)buffer=-1;
113 + *(DWORD*)(buffer+4)=1;
114 + *(DWORD*)(buffer+8)=0;
115 + IO_STATUS_BLOCK ios;
116 + NtWriteFile(hPipe,0,0,0,&ios,buffer,HEADER_SIZE,0,0);
117 + }
118 +}
119 +BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
120 +{
121 + switch (fdwReason)
122 + {
123 + case DLL_PROCESS_ATTACH:
124 + {
125 + LdrDisableThreadCalloutsForDll(hinstDLL);
126 + IthInitSystemService();
127 + DWORD s;
128 + swprintf(hm_section,L"ITH_SECTION_%d",current_process_id);
129 + hSection=IthCreateSection(hm_section,0x2000,PAGE_EXECUTE_READWRITE);
130 + NtMapViewOfSection(hSection,NtCurrentProcess(),(PVOID*)&hookman,0,
131 + hook_buff_len,0,&hook_buff_len,ViewUnmap,0,PAGE_EXECUTE_READWRITE);
132 + wcscpy(dll_name,current_dir);
133 + //swprintf(dll_mutex,L"ITH_%.4d_%s",current_process_id,current_dir);
134 + swprintf(dll_mutex,L"ITH_%d",current_process_id);
135 + swprintf(hm_mutex,L"ITH_HOOKMAN_%.4d",current_process_id);
136 + hmMutex=IthCreateMutex(hm_mutex,0);
137 + hMutex=IthCreateMutex(dll_mutex,1,&s);
138 + if (s) return FALSE;
139 + hDLL=hinstDLL; running=true;
140 + current_available=hookman;
141 + GetFunctionNames();
142 + InitFilterTable();
143 + InitDefaultHook();
144 +
145 + hSendThread=IthCreateThread(WaitForPipe,0);
146 + hCmdThread=IthCreateThread(CommandPipe,0);
147 + }
148 + break;
149 + case DLL_PROCESS_DETACH:
150 + {
151 + running=false;
152 + live=false;
153 + NtWaitForSingleObject(hSendThread,0,0);
154 + NtWaitForSingleObject(hCmdThread,0,0);
155 + NtClose(hCmdThread);
156 + NtClose(hSendThread);
157 + for (TextHook* man=hookman;man->RemoveHook();man++);
158 + LARGE_INTEGER lint={-10000,-1};
159 + while (enter_count) NtDelayExecution(0,&lint);
160 + for (TextHook* man=hookman;man<hookman+MAX_HOOK;man++) man->ClearHook();
161 + NtUnmapViewOfSection(NtCurrentProcess(),hookman);
162 + NtClose(hSection);
163 + NtClose(hMutex);
164 + delete tree;
165 + IthCloseSystemService();
166 + NtClose(hmMutex);
167 + break;
168 + }
169 + default:
170 + break;
171 + }
172 + return TRUE;
173 +}
174 +
175 +extern "C" {
176 +void ITHAPI RegisterEngineType(DWORD type)
177 +{
178 + if (live)
179 + {
180 + engine_type=type;
181 + BYTE buffer[0x80];
182 + *(DWORD*)buffer=-1;
183 + *(DWORD*)(buffer+4)=2;
184 + *(DWORD*)(buffer+8)=type;
185 + IO_STATUS_BLOCK ios;
186 + NtWriteFile(hPipe,0,0,0,&ios,buffer,HEADER_SIZE,0,0);
187 + }
188 +}
189 +void ITHAPI RegisterHookName(LPWSTR str, DWORD addr)
190 +{
191 + if (live)
192 + if (str)
193 + {
194 + int len=(wcslen(str))<<1;
195 + BYTE buffer[0x80];
196 + BYTE *buff=buffer;
197 + if (len+HEADER_SIZE>=0x80)
198 + buff=new BYTE[len+HEADER_SIZE];
199 + *(DWORD*)buffer=-1;
200 + *(DWORD*)(buffer+4)=0;
201 + *(DWORD*)(buffer+8)=addr;
202 + wcscpy(LPWSTR(buff+HEADER_SIZE),str);
203 + IO_STATUS_BLOCK ios;
204 + NtWriteFile(hPipe,0,0,0,&ios,buff,len+HEADER_SIZE,0,0);
205 + if (buff!=buffer) delete buff;
206 + }
207 +}
208 +void ITHAPI NewHook(const HookParam& hp, LPWSTR name, DWORD flag)
209 +{
210 + int current; WCHAR str[0x80];
211 +
212 + current=current_available-hookman;
213 + if (current>=MAX_HOOK) OutputConsole(L"Too many hooks.");
214 + else {
215 + if (name==0)
216 + {
217 + name=str;
218 + swprintf(name,L"UserHook%d",user_hook_count++);
219 + }
220 + hookman[current].InitHook(hp,name,HOOK_ADDITIONAL|(flag&0xFFFF));
221 + if (hookman[current].InsertHook()==0)
222 + {
223 + OutputConsole(L"Additional hook inserted.");
224 + swprintf(str,L"Insert address 0x%.8X.",hookman[current].Address());
225 + OutputConsole(str);
226 + RequestRefreshProfile();
227 + }
228 + else OutputConsole(L"Unable to insert hook.");
229 + }
230 +}
231 +void ITHAPI RemoveHook(DWORD addr)
232 +{
233 + for (int i=0;i<MAX_HOOK;i++)
234 + {
235 + if (hookman[i].Address()==addr)
236 + {
237 + hookman[i].ClearHook();
238 + return;
239 + }
240 + }
241 +}
242 +void ITHAPI SwitchTrigger(bool t) {trigger=t;}
243 +}
244 +
245 +static int filter_count;
246 +static DWORD recv_esp, recv_addr;
247 +static CONTEXT recover_context;
248 +static __declspec(naked) void MySEH()
249 +{
250 + __asm{
251 + mov eax, [esp+0xC]
252 + mov edi,eax
253 + mov ecx,0xB3
254 + mov esi, offset recover_context
255 + rep movs
256 + mov ecx, [recv_esp]
257 + mov [eax+0xC4],ecx
258 + mov edx, [recv_addr]
259 + mov [eax+0xB8],edx
260 + xor eax,eax
261 + retn
262 + }
263 +}
264 +EXCEPTION_DISPOSITION ExceptHandler(
265 + EXCEPTION_RECORD *ExceptionRecord,
266 + void * EstablisherFrame,
267 + CONTEXT *ContextRecord,
268 + void * DispatcherContext )
269 +{
270 + ContextRecord->Esp=recv_esp;
271 + ContextRecord->Eip=recv_addr;
272 + return ExceptionContinueExecution;
273 +}
274 +int GuardRange(LPWSTR module, DWORD* a, DWORD* b)
275 +{
276 + int flag=0;
277 + __asm
278 + {
279 + mov eax,seh_recover
280 + mov recv_addr,eax
281 + push ExceptHandler
282 + push fs:[0]
283 + mov recv_esp,esp
284 + mov fs:[0],esp
285 + }
286 + flag=FillRange(module,a,b);
287 + __asm
288 + {
289 +seh_recover:
290 + mov eax,[esp]
291 + mov fs:[0],eax
292 + add esp,8
293 + }
294 + return flag;
295 +}
296 +void AddRange(LPWSTR dll)
297 +{
298 + if (GuardRange(dll,&filter[filter_count].lower,&filter[filter_count].upper))
299 + filter_count++;
300 +}
301 +void InitFilterTable()
302 +{
303 + filter_count=0;
304 + AddRange(L"uxtheme.dll");
305 + AddRange(L"usp10.dll");
306 + AddRange(L"msctf.dll");
307 + AddRange(L"gdiplus.dll");
308 + AddRange(L"lpk.dll");
309 + AddRange(L"psapi.dll");
310 + AddRange(L"user32.dll");
311 +}
...\ No newline at end of file ...\ No newline at end of file
1 +/* Copyright (C) 2010-2011 kaosu (qiupf2000@gmail.com)
2 + * This file is part of the Interactive Text Hooker.
3 +
4 + * Interactive Text Hooker is free software: you can redistribute it and/or
5 + * modify it under the terms of the GNU General Public License as published
6 + * by the Free Software Foundation, either version 3 of the License, or
7 + * (at your option) any later version.
8 +
9 + * This program is distributed in the hope that it will be useful,
10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 + * GNU General Public License for more details.
13 +
14 + * You should have received a copy of the GNU General Public License
15 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 + */
17 +
18 +#include "utility.h"
19 +#include "..\AVL.h"
20 +WCHAR mutex[]=L"ITH_GRANT_PIPE";
21 +WCHAR exist[]=L"ITH_PIPE_EXIST";
22 +WCHAR lose_event[0x20];
23 +WCHAR detach_mutex[0x20];
24 +WCHAR write_event[0x20];
25 +WCHAR engine_event[0x20];
26 +WCHAR pipe[]=L"\\??\\pipe\\ITH_PIPE";
27 +WCHAR command[]=L"\\??\\pipe\\ITH_COMMAND";
28 +
29 +LARGE_INTEGER wait_time={-100*10000,-1};
30 +LARGE_INTEGER sleep_time={-20*10000,-1};
31 +
32 +DWORD engine_type;
33 +HANDLE hPipe,hCommand,hDetach,hLose;
34 +IdentifyEngineFun IdentifyEngine;
35 +InsertDynamicHookFun InsertDynamicHook;
36 +static DWORD base;
37 +bool hook_inserted=0;
38 +inline DWORD GetModuleBase(LPWSTR name)
39 +{
40 + __asm
41 + {
42 + mov eax,fs:[0x30]
43 + mov eax,[eax+0xC]
44 + mov esi,[eax+0x14]
45 + mov edi,_wcsicmp
46 +_listfind:
47 + mov edx,[esi+0x28]
48 + test edx,edx
49 + jz _notfound
50 + push edx
51 + push name
52 + call edi
53 + pop edx
54 + pop edx
55 + test eax,eax
56 + jz _found
57 + mov esi,[esi]
58 + jmp _listfind
59 +_notfound:
60 + xor eax,eax
61 + jmp _termin
62 +_found:
63 + mov eax,[esi+0x10]
64 +_termin:
65 + }
66 +}
67 +
68 +
69 +HANDLE IthOpenPipe(LPWSTR name, ACCESS_MASK direction)
70 +{
71 + UNICODE_STRING us;
72 + RtlInitUnicodeString(&us,name);
73 + SECURITY_DESCRIPTOR sd={1};
74 + OBJECT_ATTRIBUTES oa={sizeof(oa),0,&us,OBJ_CASE_INSENSITIVE,&sd,0};
75 + HANDLE hFile;
76 + IO_STATUS_BLOCK isb;
77 + if (NT_SUCCESS(NtCreateFile(&hFile,direction,&oa,&isb,0,0,FILE_SHARE_READ,FILE_OPEN,0,0,0)))
78 + return hFile;
79 + else return INVALID_HANDLE_VALUE;
80 +}
81 +BOOL LoadEngine()
82 +{
83 + base=GetModuleBase(L"ITH_engine.dll");
84 + IdentifyEngine=(IdentifyEngineFun)GetExportAddress(base,GetHash("IdentifyEngine"));
85 + InsertDynamicHook=(InsertDynamicHookFun)GetExportAddress(base,GetHash("InsertDynamicHook"));
86 + if (IdentifyEngine==0) return FALSE;
87 +}
88 +DWORD WINAPI WaitForPipe(LPVOID lpThreadParameter) //Dynamic detect ITH main module status.
89 +{
90 + int i;
91 + TextHook *man;
92 + struct
93 + {
94 + DWORD pid;
95 + TextHook *man;
96 + DWORD module;
97 + DWORD engine;
98 + } u;
99 + HANDLE hMutex,hPipeExist,hEngine;
100 + swprintf(engine_event,L"ITH_ENGINE_%d",current_process_id);
101 + swprintf(detach_mutex,L"ITH_DETACH_%d",current_process_id);
102 + swprintf(lose_event,L"ITH_LOSEPIPE_%d",current_process_id);
103 + hEngine=IthCreateEvent(engine_event);
104 + NtWaitForSingleObject(hEngine,0,0);
105 + NtClose(hEngine);
106 + LoadEngine();
107 + u.module=GetModuleBase(L"ITH.dll");
108 + u.pid=current_process_id;
109 + u.man=hookman;
110 + u.engine=base;
111 + hPipeExist=IthOpenEvent(exist);
112 + IO_STATUS_BLOCK ios;
113 + hLose=IthCreateEvent(lose_event,0,0);
114 + if (hPipeExist!=INVALID_HANDLE_VALUE)
115 + while (running)
116 + {
117 + hPipe=INVALID_HANDLE_VALUE;
118 + hCommand=INVALID_HANDLE_VALUE;
119 + while (NtWaitForSingleObject(hPipeExist,0,&wait_time)==WAIT_TIMEOUT)
120 + if (!running) goto _release;
121 + hMutex=IthCreateMutex(mutex,0);
122 + NtWaitForSingleObject(hMutex,0,0);
123 + while (hPipe==INVALID_HANDLE_VALUE||
124 + hCommand==INVALID_HANDLE_VALUE) {
125 + NtDelayExecution(0,&sleep_time);
126 + if (hPipe==INVALID_HANDLE_VALUE)
127 + hPipe=IthOpenPipe(pipe,GENERIC_WRITE);
128 + if (hCommand==INVALID_HANDLE_VALUE)
129 + hCommand=IthOpenPipe(command,GENERIC_READ);
130 + }
131 + NtClearEvent(hLose);
132 + NtWriteFile(hPipe,0,0,0,&ios,&u,16,0,0);
133 + live=true;
134 + for (man=hookman,i=0;i<current_hook;man++)
135 + if (man->RecoverHook()) i++;
136 + OutputConsole(dll_name);
137 + OutputConsole(L"Pipe connected.");
138 + OutputDWORD(tree->Count());
139 + NtReleaseMutant(hMutex,0);
140 + NtClose(hMutex);
141 + if (!hook_inserted) {hook_inserted=true;IdentifyEngine();}
142 + hDetach=IthCreateMutex(detach_mutex,1);
143 + while (running&&NtWaitForSingleObject(hPipeExist,0,&sleep_time)==WAIT_OBJECT_0)
144 + NtDelayExecution(0,&sleep_time);
145 + live=false;
146 + for (man=hookman,i=0;i<current_hook;man++)
147 + if (man->RemoveHook()) i++;
148 + if (!running)
149 + {
150 + NtWriteFile(hPipe,0,0,0,&ios,man,4,0,0);
151 + IthReleaseMutex(hDetach);
152 + }
153 + NtClose(hDetach);
154 + NtClose(hPipe);
155 + }
156 +_release:
157 + NtClose(hLose);
158 + NtClose(hPipeExist);
159 + return 0;
160 +}
161 +void OutputModuleInformation()
162 +{
163 + WCHAR str[0x100];
164 + PPEB ppeb;
165 + __asm
166 + {
167 + mov eax,fs:[0x30]
168 + mov ppeb,eax
169 + }
170 + DWORD temp=*(DWORD*)(&ppeb->Ldr->InLoadOrderModuleList);
171 + PLDR_DATA_TABLE_ENTRY it=(PLDR_DATA_TABLE_ENTRY) temp;
172 + while (*(DWORD*)it!=temp)
173 + {
174 + swprintf(str,L"0x%08X 0x%08X %s",it->DllBase,it->SizeOfImage,it->BaseDllName.Buffer);
175 + OutputConsole(str);
176 + it=(PLDR_DATA_TABLE_ENTRY)it->InLoadOrderModuleList.Flink;
177 + }
178 +}
179 +
180 +DWORD WINAPI CommandPipe(LPVOID lpThreadParameter)
181 +{
182 + DWORD command;
183 + BYTE buff[0x200]={0};
184 + HANDLE hPipeExist;
185 + hPipeExist=IthOpenEvent(exist);
186 + IO_STATUS_BLOCK ios={0};
187 + NTSTATUS status;
188 + if (hPipeExist!=INVALID_HANDLE_VALUE)
189 + while (running)
190 + {
191 + while (!live)
192 + {
193 + if (!running) goto _detach;
194 + NtDelayExecution(0,&sleep_time);
195 + }
196 + status=NtReadFile(hCommand,0,0,0,&ios,buff,0x200,0,0);
197 + if (status==STATUS_PIPE_BROKEN||
198 + status==STATUS_PIPE_DISCONNECTED)
199 + {
200 + NtClearEvent(hPipeExist);
201 + continue;
202 + }
203 + if (status==STATUS_PENDING)
204 + {
205 + NtWaitForSingleObject(hCommand,0,0);
206 + switch (ios.Status)
207 + {
208 + case 0:
209 + break;
210 + case STATUS_PIPE_BROKEN:
211 + case STATUS_PIPE_DISCONNECTED:
212 + NtClearEvent(hPipeExist);
213 + continue;
214 + break;
215 + default:
216 + if (NtWaitForSingleObject(hDetach,0,&wait_time)==WAIT_OBJECT_0)
217 + goto _detach;
218 + }
219 + }
220 + if (ios.uInformation)
221 + if (live)
222 + {
223 + command=*(DWORD*)buff;
224 + switch(command)
225 + {
226 + case 0:
227 + NewHook(*(HookParam*)(buff+4),0,0);
228 + break;
229 + case 1:
230 + OutputModuleInformation();
231 + break;
232 + case 2:
233 + {
234 + DWORD rm_addr=*(DWORD*)(buff+4);
235 + HANDLE hRemoved=IthOpenEvent(L"ITH_REMOVE_HOOK");
236 +
237 + TextHook* in=hookman;
238 + int i;
239 + for (i=0;i<current_hook;in++)
240 + {
241 + if (in->Address()) i++;
242 + if (in->Address()==rm_addr) break;
243 + }
244 + if (in->Address())
245 + in->ClearHook();
246 + IthSetEvent(hRemoved);
247 + NtClose(hRemoved);
248 + break;
249 + }
250 + case 3:
251 + {
252 + DWORD rm_addr=*(DWORD*)(buff+4);
253 + HANDLE hModify=IthOpenEvent(L"ITH_MODIFY_HOOK");
254 + TextHook* in=hookman;
255 + int i;
256 + for (i=0;i<current_hook;in++)
257 + {
258 + if (in->Address()) i++;
259 + if (in->Address()==rm_addr) break;
260 + }
261 + if (in->Address())
262 + in->ModifyHook(*(HookParam*)(buff+4));
263 + IthSetEvent(hModify);
264 + NtClose(hModify);
265 + break;
266 +
267 + }
268 + break;
269 + case 4:
270 + running=false;
271 + live=false;
272 + goto _detach;
273 + case 5:
274 +
275 + break;
276 + default:
277 + break;
278 + }
279 + }
280 + }
281 +_detach:
282 + NtClose(hPipeExist);
283 + NtClose(hCommand);
284 + return 0;
285 +}
286 +extern "C" {
287 +void ITHAPI OutputConsole(LPWSTR str)
288 +{
289 + if (live)
290 + if (str)
291 + {
292 + int len=(wcslen(str)+1)<<1;
293 + BYTE buffer[0x80];
294 + BYTE *buff=buffer;
295 + if (len+HEADER_SIZE>=0x80)
296 + buff=new BYTE[len+HEADER_SIZE];
297 + memset(buff,0xFF,HEADER_SIZE);
298 + wcscpy(LPWSTR(buff+HEADER_SIZE),str);
299 + IO_STATUS_BLOCK ios;
300 + NtWriteFile(hPipe,0,0,0,&ios,buff,len+HEADER_SIZE,0,0);
301 + if (buff!=buffer) delete buff;
302 + }
303 +}
304 +void ITHAPI OutputDWORD(DWORD d)
305 +{
306 + WCHAR str[0x10];
307 + swprintf(str,L"%.8X",d);
308 + OutputConsole(str);
309 +}
310 +void ITHAPI OutputRegister(DWORD *base)
311 +{
312 + WCHAR str[0x40];
313 + swprintf(str,L"EAX:%.8X",base[0]);
314 + OutputConsole(str);
315 + swprintf(str,L"ECX:%.8X",base[-1]);
316 + OutputConsole(str);
317 + swprintf(str,L"EDX:%.8X",base[-2]);
318 + OutputConsole(str);
319 + swprintf(str,L"EBX:%.8X",base[-3]);
320 + OutputConsole(str);
321 + swprintf(str,L"ESP:%.8X",base[-4]);
322 + OutputConsole(str);
323 + swprintf(str,L"EBP:%.8X",base[-5]);
324 + OutputConsole(str);
325 + swprintf(str,L"ESI:%.8X",base[-6]);
326 + OutputConsole(str);
327 + swprintf(str,L"EDI:%.8X",base[-7]);
328 + OutputConsole(str);
329 +}
330 +}
...\ No newline at end of file ...\ No newline at end of file
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
No preview for this file type
No preview for this file type
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
No preview for this file type
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
No preview for this file type
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
No preview for this file type
No preview for this file type
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
No preview for this file type
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
No preview for this file type
This diff is collapsed. Click to expand it.
No preview for this file type
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
No preview for this file type
No preview for this file type
No preview for this file type
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
No preview for this file type
This diff is collapsed. Click to expand it.
No preview for this file type
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
No preview for this file type
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
No preview for this file type
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
No preview for this file type
No preview for this file type
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
No preview for this file type
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.