Dynamic memory

This commit is contained in:
世元 李
2020-03-19 23:31:22 +08:00
parent ebb203fa84
commit 6ba09c63be
46 changed files with 315 additions and 184 deletions

BIN
cs2_chs/04.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -23,8 +23,50 @@ namespace cs2_chs
{ {
public bool enChanged = false; public bool enChanged = false;
static public Thread threadRestore; static public Thread threadRestore;
bool enFaileden = false; static bool enFaileden = false;
static public void TranSpleteProc(ref string itoc)
{
string pitoc = itoc;
if (enFaileden)
{
itoc = "";
char lob = '\0';
foreach (char t in pitoc)
{
if (t != lob)
{
itoc += t;
lob = t;
}
}
}
else
{
return;
}
}
static public void UnTranSpleteProc(ref string itoc)
{
string pitoc = itoc;
if (enFaileden)
{
itoc = "";
foreach (char t in pitoc)
{
itoc += t;
itoc += t;
}
}
else
{
return;
}
}
public Advance() public Advance()
{ {
InitializeComponent(); InitializeComponent();
@@ -39,7 +81,7 @@ namespace cs2_chs
this.Dispatcher.Invoke(DispatcherPriority.Normal, (ThreadStart)delegate () this.Dispatcher.Invoke(DispatcherPriority.Normal, (ThreadStart)delegate ()
{ {
if (MainWindow.nID != 0) if (MainWindow.nID != 0)
IDnPut.Text = Convert.ToString((*(uint*)MainWindow.nID) - 1, 10); IDnPut.Text = Convert.ToString(*(int*)MainWindow.nID, 10);
}); });
Thread.Sleep(100); Thread.Sleep(100);
} }
@@ -56,24 +98,9 @@ namespace cs2_chs
{ {
string loacl = new string((char*)MainWindow.ns_str); string loacl = new string((char*)MainWindow.ns_str);
string lobnob = ""; string lobnob = loacl;
if (enFaileden)
{ TranSpleteProc(ref lobnob);
char lob = '\0';
foreach (char t in loacl)
{
if (t != lob)
{
lobnob += t;
lob = t;
}
}
}
else
{
lobnob = loacl;
//MessageBox.Show("");
}
this.Dispatcher.Invoke(DispatcherPriority.Normal, (ThreadStart)delegate () this.Dispatcher.Invoke(DispatcherPriority.Normal, (ThreadStart)delegate ()
{ {
TRAN_OPT.Text = lobnob; TRAN_OPT.Text = lobnob;

View File

@@ -14,13 +14,7 @@
<Grid.Background> <Grid.Background>
<ImageBrush ImageSource="01.jpg"/> <ImageBrush ImageSource="01.jpg"/>
</Grid.Background> </Grid.Background>
<TextBox x:Name="TEXT_INPUT" HorizontalAlignment="Left" Height="100" Margin="10,115,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="573" AcceptsReturn="True" Grid.ColumnSpan="2" FontSize="18"> <TextBox x:Name="TEXT_INPUT" HorizontalAlignment="Left" Height="100" Margin="10,115,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="574" AcceptsReturn="True" Grid.ColumnSpan="2" FontSize="18" BorderBrush="Red">
<TextBox.BorderBrush>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFFFB700" Offset="0.027"/>
<GradientStop Color="#FFFF9A9A" Offset="1"/>
</LinearGradientBrush>
</TextBox.BorderBrush>
<TextBox.Background> <TextBox.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="Black" Offset="0"/> <GradientStop Color="Black" Offset="0"/>
@@ -29,16 +23,14 @@
</LinearGradientBrush> </LinearGradientBrush>
</TextBox.Background> </TextBox.Background>
</TextBox> </TextBox>
<Button x:Name="apply" Content="Apply" HorizontalAlignment="Left" Height="25" Margin="348,220,0,0" VerticalAlignment="Top" Width="88" Click="Button_Click" Grid.Column="1"> <Button x:Name="apply" Content="Apply" HorizontalAlignment="Left" Height="25" Margin="346,220,0,0" VerticalAlignment="Top" Width="90
" Click="Button_Click" Grid.Column="1">
<Button.Background> <Button.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> <ImageBrush ImageSource="04.jpg"/>
<GradientStop Color="Red" Offset="0"/>
<GradientStop Color="#7FFFBBBB" Offset="0.99"/>
</LinearGradientBrush>
</Button.Background> </Button.Background>
</Button> </Button>
<ProgressBar x:Name="PBS" HorizontalAlignment="Left" Height="25" Margin="103,220,0,0" Visibility="Collapsed" VerticalAlignment="Top" Width="388" Grid.ColumnSpan="2"/> <ProgressBar x:Name="PBS" HorizontalAlignment="Left" Height="25" Margin="103,220,0,0" Visibility="Collapsed" VerticalAlignment="Top" Width="388" Grid.ColumnSpan="2"/>
<Button Content="Show Japanese" HorizontalAlignment="Left" Margin="10,220,0,0" VerticalAlignment="Top" Width="88" Height="25" Click="Button_Click_1"> <Button Content="Pull" HorizontalAlignment="Left" Margin="10,220,0,0" VerticalAlignment="Top" Width="90" Height="25" Click="Button_Click_1">
<Button.Background> <Button.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFFFEE00" Offset="0"/> <GradientStop Color="#FFFFEE00" Offset="0"/>

View File

@@ -22,22 +22,11 @@ namespace cs2_chs
/// MainWindow.xaml 的交互逻辑 /// MainWindow.xaml 的交互逻辑
/// </summary> /// </summary>
/// ///
public static class StrMop
{
public static char CharAt(this string str, int index)
{
if (index > str.Length)
return ' ';
string res = str.Substring(index, 1);
return Convert.ToChar(res);
}
}
public partial class MainWindow : Window public partial class MainWindow : Window
{ {
//TestA //TestA
public static InitData initdata = new InitData(); public static InitData initdata = new InitData();//加载初始化信息
public Advance AdvanceSetting = new Advance();//ChangeGToT public Advance AdvanceSetting = new Advance();//加载高级设置窗口
public static MainWindow thisPfc; public static MainWindow thisPfc;
[DllImport("cs2_patch.dll", EntryPoint = "ChangeGToT")] [DllImport("cs2_patch.dll", EntryPoint = "ChangeGToT")]
@@ -76,6 +65,8 @@ namespace cs2_chs
public static uint ppMode; public static uint ppMode;
public static uint nID; public static uint nID;
public static uint pblockRestoreSrc; public static uint pblockRestoreSrc;
public static uint cn_str = 0;
public static uint IsSuccess = 0;
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{ {
if(this.Visibility != Visibility.Visible){ if(this.Visibility != Visibility.Visible){
@@ -178,6 +169,8 @@ namespace cs2_chs
ns_str = (uint)DllTools.GetProcAddress(hMod, "ns_str"); ns_str = (uint)DllTools.GetProcAddress(hMod, "ns_str");
ptPid = (uint)DllTools.GetProcAddress(hMod, "tPid"); ptPid = (uint)DllTools.GetProcAddress(hMod, "tPid");
nID= (uint)DllTools.GetProcAddress(hMod, "nID"); nID= (uint)DllTools.GetProcAddress(hMod, "nID");
cn_str = (uint)DllTools.GetProcAddress(hMod, "cn_str");
IsSuccess= (uint)DllTools.GetProcAddress(hMod, "IsSuccess");
Thread threadExit = new Thread(delegate () Thread threadExit = new Thread(delegate ()
{ {
@@ -203,11 +196,20 @@ namespace cs2_chs
//WaitOnAddress(pblockRestoreSrc, (uint)&aloc, sizeof(bool), 0xFFFFFFFF); //WaitOnAddress(pblockRestoreSrc, (uint)&aloc, sizeof(bool), 0xFFFFFFFF);
Thread.Sleep(10); Thread.Sleep(10);
} }
char* pms_str = (char*)ms_str; char* pms_str = (char*)ms_str;
string MsStr = new string(pms_str); string MsStr = new string(pms_str);
this.Dispatcher.Invoke(DispatcherPriority.Normal, (ThreadStart)delegate () this.Dispatcher.Invoke(DispatcherPriority.Normal, (ThreadStart)delegate ()
{ {
if (*(bool*)IsSuccess)
{
// MessageBox.Show("");
TEXT_INPUT.BorderBrush = new SolidColorBrush(Colors.Green);
}
else
{
TEXT_INPUT.BorderBrush = new SolidColorBrush(Colors.Red);
}
SRC_OUTPUT.Text = MsStr; SRC_OUTPUT.Text = MsStr;
}); });
} }
@@ -237,6 +239,10 @@ namespace cs2_chs
LocalS = TEXT_INPUT.Text; LocalS = TEXT_INPUT.Text;
LocalP = SRC_OUTPUT.Text; LocalP = SRC_OUTPUT.Text;
}); });
if (initdata.Envio)
{
Advance.UnTranSpleteProc(ref LocalP);
}
CreateData(LocalP, LocalS); CreateData(LocalP, LocalS);
}); });
@@ -274,8 +280,8 @@ namespace cs2_chs
{ {
unsafe unsafe
{ {
char* pms_str = (char*)ms_str; char* pcn_str = (char*)cn_str;
string MsStr = new string(pms_str); string MsStr = new string(pcn_str);
TEXT_INPUT.Text = MsStr; TEXT_INPUT.Text = MsStr;
} }
} }

View File

@@ -160,5 +160,8 @@
<ItemGroup> <ItemGroup>
<Resource Include="03.png" /> <Resource Include="03.png" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Resource Include="04.jpg" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>

View File

@@ -1,4 +1,4 @@
#pragma checksum "..\..\..\MainWindow.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "E730C4B41ACFA459AE58B693C6D867B376E7BBEDF7DBBB52809F64EFDB38EDA1" #pragma checksum "..\..\..\MainWindow.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "3762C2C4283F2E5D09EE19D57194D7F3C83E315990F5B1EC6CA5569998B7FBE4"
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// 此代码由工具生成。 // 此代码由工具生成。
@@ -49,7 +49,7 @@ namespace cs2_chs {
#line hidden #line hidden
#line 32 "..\..\..\MainWindow.xaml" #line 26 "..\..\..\MainWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.Button apply; internal System.Windows.Controls.Button apply;
@@ -57,7 +57,7 @@ namespace cs2_chs {
#line hidden #line hidden
#line 40 "..\..\..\MainWindow.xaml" #line 32 "..\..\..\MainWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.ProgressBar PBS; internal System.Windows.Controls.ProgressBar PBS;
@@ -65,7 +65,7 @@ namespace cs2_chs {
#line hidden #line hidden
#line 49 "..\..\..\MainWindow.xaml" #line 41 "..\..\..\MainWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.TextBox SRC_OUTPUT; internal System.Windows.Controls.TextBox SRC_OUTPUT;
@@ -134,7 +134,7 @@ namespace cs2_chs {
case 3: case 3:
this.apply = ((System.Windows.Controls.Button)(target)); this.apply = ((System.Windows.Controls.Button)(target));
#line 32 "..\..\..\MainWindow.xaml" #line 27 "..\..\..\MainWindow.xaml"
this.apply.Click += new System.Windows.RoutedEventHandler(this.Button_Click); this.apply.Click += new System.Windows.RoutedEventHandler(this.Button_Click);
#line default #line default
@@ -145,7 +145,7 @@ namespace cs2_chs {
return; return;
case 5: case 5:
#line 41 "..\..\..\MainWindow.xaml" #line 33 "..\..\..\MainWindow.xaml"
((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click_1); ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click_1);
#line default #line default
@@ -156,13 +156,13 @@ namespace cs2_chs {
return; return;
case 7: case 7:
#line 73 "..\..\..\MainWindow.xaml" #line 65 "..\..\..\MainWindow.xaml"
((System.Windows.Input.CommandBinding)(target)).CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.CommandBinding_ShowMainWindow_CanExecute); ((System.Windows.Input.CommandBinding)(target)).CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.CommandBinding_ShowMainWindow_CanExecute);
#line default #line default
#line hidden #line hidden
#line 74 "..\..\..\MainWindow.xaml" #line 66 "..\..\..\MainWindow.xaml"
((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.CommandBinding_ShowMainWindow_Executed); ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.CommandBinding_ShowMainWindow_Executed);
#line default #line default

View File

@@ -1,4 +1,4 @@
#pragma checksum "..\..\..\MainWindow.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "E730C4B41ACFA459AE58B693C6D867B376E7BBEDF7DBBB52809F64EFDB38EDA1" #pragma checksum "..\..\..\MainWindow.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "3762C2C4283F2E5D09EE19D57194D7F3C83E315990F5B1EC6CA5569998B7FBE4"
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// 此代码由工具生成。 // 此代码由工具生成。
@@ -49,7 +49,7 @@ namespace cs2_chs {
#line hidden #line hidden
#line 32 "..\..\..\MainWindow.xaml" #line 26 "..\..\..\MainWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.Button apply; internal System.Windows.Controls.Button apply;
@@ -57,7 +57,7 @@ namespace cs2_chs {
#line hidden #line hidden
#line 40 "..\..\..\MainWindow.xaml" #line 32 "..\..\..\MainWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.ProgressBar PBS; internal System.Windows.Controls.ProgressBar PBS;
@@ -65,7 +65,7 @@ namespace cs2_chs {
#line hidden #line hidden
#line 49 "..\..\..\MainWindow.xaml" #line 41 "..\..\..\MainWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.TextBox SRC_OUTPUT; internal System.Windows.Controls.TextBox SRC_OUTPUT;
@@ -134,7 +134,7 @@ namespace cs2_chs {
case 3: case 3:
this.apply = ((System.Windows.Controls.Button)(target)); this.apply = ((System.Windows.Controls.Button)(target));
#line 32 "..\..\..\MainWindow.xaml" #line 27 "..\..\..\MainWindow.xaml"
this.apply.Click += new System.Windows.RoutedEventHandler(this.Button_Click); this.apply.Click += new System.Windows.RoutedEventHandler(this.Button_Click);
#line default #line default
@@ -145,7 +145,7 @@ namespace cs2_chs {
return; return;
case 5: case 5:
#line 41 "..\..\..\MainWindow.xaml" #line 33 "..\..\..\MainWindow.xaml"
((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click_1); ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click_1);
#line default #line default
@@ -156,13 +156,13 @@ namespace cs2_chs {
return; return;
case 7: case 7:
#line 73 "..\..\..\MainWindow.xaml" #line 65 "..\..\..\MainWindow.xaml"
((System.Windows.Input.CommandBinding)(target)).CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.CommandBinding_ShowMainWindow_CanExecute); ((System.Windows.Input.CommandBinding)(target)).CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.CommandBinding_ShowMainWindow_CanExecute);
#line default #line default
#line hidden #line hidden
#line 74 "..\..\..\MainWindow.xaml" #line 66 "..\..\..\MainWindow.xaml"
((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.CommandBinding_ShowMainWindow_Executed); ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.CommandBinding_ShowMainWindow_Executed);
#line default #line default

Binary file not shown.

Binary file not shown.

View File

@@ -8,6 +8,6 @@
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
[assembly: System.Windows.Resources.AssemblyAssociatedContentFileAttribute("03.png")] [assembly: System.Windows.Resources.AssemblyAssociatedContentFileAttribute("04.jpg")]

View File

@@ -1,17 +1,22 @@
#include "pch.h" #include "pch.h"
#include "BuildIn.h" #include "BuildIn.h"
#include "Data.h" #include "Data.h"
#include "Replace.h"
/*********声明符号***********/
extern "C" extern DLLAPI wchar_t ns_str[6192]; extern "C" extern DLLAPI wchar_t ns_str[6192];
extern HMODULE hMod; extern HMODULE hMod;
extern "C" extern DLLAPI wchar_t ms_str[3096]; extern "C" extern DLLAPI wchar_t ms_str[3096];
extern "C" extern DLLAPI int nID; extern "C" extern DLLAPI int nID;
extern "C" extern DLLAPI DWORD tPid; extern "C" extern DLLAPI DWORD tPid;
extern MicroData* Index; extern MicroData* Index;
extern MicroBinary* Data; extern MicroBinary* Data;
extern "C" extern DLLAPI DWORD m_Addr; extern "C" extern DLLAPI DWORD m_Addr;
extern "C" extern DLLAPI DWORD VioMode; extern "C" extern DLLAPI DWORD VioMode;
extern "C" extern DLLAPI bool IsSuccess;
signed int (*Sur_Sub)() = (signed int(*)(void))m_Addr;//real function point signed int (*Sur_Sub)() = (signed int(*)(void))m_Addr;//real function point
HMODULE SelfHandle = NULL; HMODULE SelfHandle = NULL;
@@ -19,6 +24,11 @@ bool start_falg = false;
bool start_g_flag = false; bool start_g_flag = false;
bool start_t_flag = false; bool start_t_flag = false;
extern char IpfData[16];
#define PutInt(a) _itoa_s(a,IpfData,10);MessageBoxA(0,IpfData,"num",0);
TESTDATA* pNewDf = NULL;
PVOID GetProcAddressEx(HANDLE hProc, HMODULE hModule, LPCSTR lpProcName) PVOID GetProcAddressEx(HANDLE hProc, HMODULE hModule, LPCSTR lpProcName)
{ {
PVOID pAddress = NULL; PVOID pAddress = NULL;
@@ -97,9 +107,6 @@ BOOL InjectDLL(HANDLE hProcess, LPCWSTR dllFilePathName)
return TRUE; return TRUE;
} }
extern char IpfData[16];
#define PutInt(a) _itoa_s(a,IpfData,10);MessageBoxA(0,IpfData,"num",0);
DWORD(WINAPI* pGetGlyphOutlineW)( DWORD(WINAPI* pGetGlyphOutlineW)(
_In_ HDC hdc, _In_ HDC hdc,
_In_ UINT uChar, _In_ UINT uChar,
@@ -111,6 +118,8 @@ DWORD(WINAPI* pGetGlyphOutlineW)(
) = GetGlyphOutlineW; ) = GetGlyphOutlineW;
BOOL(WINAPI* pTextOutW)(_In_ HDC hdc, _In_ int x, _In_ int y, _In_reads_(c) LPCWSTR lpString, _In_ int c) = TextOutW; BOOL(WINAPI* pTextOutW)(_In_ HDC hdc, _In_ int x, _In_ int y, _In_reads_(c) LPCWSTR lpString, _In_ int c) = TextOutW;
/*****************************/
int(*TranSpt)(DWORD);
HANDLE InjectSelfTo(LPCSTR inptr) HANDLE InjectSelfTo(LPCSTR inptr)
{ {
// MessageBoxA(0, inptr,"",0); // MessageBoxA(0, inptr,"",0);
@@ -148,29 +157,22 @@ HANDLE InjectSelfTo(LPCSTR inptr)
delete info; delete info;
lstrcpyW(ms_str, L" "); lstrcpyW(ms_str, L" ");
ns_str[0] = L'\0'; ns_str[0] = L'\0';
return currentThread; return currentThread;
} }
DWORD lecx;
signed int Fake_Sub() signed int Fake_Sub()
{ {
DWORD leax, lebx, lecx, ledx, lesi, ledi;
__asm { __asm {
mov dword ptr[leax], eax
mov dword ptr[lebx], ebx
mov dword ptr[lecx], ecx mov dword ptr[lecx], ecx
mov dword ptr[ledx], edx
mov dword ptr[lesi], esi
mov dword ptr[ledi], edi
} }
// SetWindowTextW(m_hWnd, L"<22><><EFBFBD><EFBFBD>hook"); // SetWindowTextW(m_hWnd, L"<22><><EFBFBD><EFBFBD>hook");
((int(*)(DWORD))::GetProcAddress(SelfHandle, "TranSplete"))(lecx); // MessageBoxA(0,"","",0);
TranSpt(lecx);
// SetWindowTextW(m_hWnd, L"hook<6F><6B><EFBFBD><EFBFBD>"); // SetWindowTextW(m_hWnd, L"hook<6F><6B><EFBFBD><EFBFBD>");
__asm { __asm {
mov eax, dword ptr[leax]
mov ebx, dword ptr[lebx]
mov ecx, dword ptr[lecx] mov ecx, dword ptr[lecx]
mov edx, dword ptr[ledx]
mov esi, dword ptr[lesi]
mov edi, dword ptr[ledi]
} }
return Sur_Sub(); return Sur_Sub();
} }
@@ -204,6 +206,8 @@ BOOL WINAPI fTextOutW(_In_ HDC hdc, _In_ int x, _In_ int y, _In_reads_(c) LPCWS
{ {
return pTextOutW(hdc, x, y, L"\0", c); return pTextOutW(hdc, x, y, L"\0", c);
} }
void start() void start()
{ {
// MessageBoxA(0,"b","",0); // MessageBoxA(0,"b","",0);
@@ -251,7 +255,6 @@ void end()
DetourDetach(&(PVOID&)pGetGlyphOutlineW, fGetGlyphOutlineW); DetourDetach(&(PVOID&)pGetGlyphOutlineW, fGetGlyphOutlineW);
DetourTransactionCommit(); DetourTransactionCommit();
} }
void start_t() void start_t()
{ {
if (start_t_flag) if (start_t_flag)
@@ -311,7 +314,7 @@ void StartReplace()
CloseHandle(terp); CloseHandle(terp);
} }
void EndReplace() void EndReplace()
{ {
HANDLE terp = OpenProcess(PROCESS_ALL_ACCESS, FALSE, tPid); HANDLE terp = OpenProcess(PROCESS_ALL_ACCESS, FALSE, tPid);
HANDLE hHookStart = CreateRemoteThread(terp, NULL, 0, (LPTHREAD_START_ROUTINE) HANDLE hHookStart = CreateRemoteThread(terp, NULL, 0, (LPTHREAD_START_ROUTINE)
@@ -347,7 +350,7 @@ void StartReplace()
} }
CloseHandle(terp); CloseHandle(terp);
} }
void ChangeGToT() void ChangeGToT()
{ {
HANDLE terp = OpenProcess(PROCESS_ALL_ACCESS, FALSE, tPid); HANDLE terp = OpenProcess(PROCESS_ALL_ACCESS, FALSE, tPid);
HANDLE hgHookStart = CreateRemoteThread(terp, NULL, 0, (LPTHREAD_START_ROUTINE) HANDLE hgHookStart = CreateRemoteThread(terp, NULL, 0, (LPTHREAD_START_ROUTINE)
@@ -369,7 +372,7 @@ void StartReplace()
WaitForSingleObject(htHookStart, 0xFFFFFFFF); WaitForSingleObject(htHookStart, 0xFFFFFFFF);
CloseHandle(terp); CloseHandle(terp);
} }
void ChangeTToG() void ChangeTToG()
{ {
HANDLE terp = OpenProcess(PROCESS_ALL_ACCESS, FALSE, tPid); HANDLE terp = OpenProcess(PROCESS_ALL_ACCESS, FALSE, tPid);
HANDLE hgHookStart = CreateRemoteThread(terp, NULL, 0, (LPTHREAD_START_ROUTINE) HANDLE hgHookStart = CreateRemoteThread(terp, NULL, 0, (LPTHREAD_START_ROUTINE)
@@ -391,10 +394,12 @@ void StartReplace()
WaitForSingleObject(htHookStart, 0xFFFFFFFF); WaitForSingleObject(htHookStart, 0xFFFFFFFF);
CloseHandle(terp); CloseHandle(terp);
} }
void LoadExerte() void LoadExerte()
{ {
Index = new MicroData(L"Index.ax", sizeof(IndexData)); Index = new MicroData(L"Index.ax", sizeof(IndexData));
Data = new MicroBinary(L"Data.ax"); Data = new MicroBinary(L"Data.ax");
Index->Load(); Index->Load();
Data->Load(); Data->Load();
TranSpt = (int(*)(DWORD))::GetProcAddress(SelfHandle, "TranSplete");
} }

View File

@@ -4,7 +4,9 @@ extern MicroData* Index;
extern MicroBinary* Data; extern MicroBinary* Data;
extern "C" extern DLLAPI double saveProcess; extern "C" extern DLLAPI double saveProcess;
extern HMODULE hMod; extern HMODULE hMod;
extern "C" extern DLLAPI wchar_t ms_str[3096]; extern "C" extern DLLAPI wchar_t ms_str[3096];
extern "C" extern DLLAPI wchar_t cn_str[1024];
extern "C" extern DLLAPI int nID; extern "C" extern DLLAPI int nID;
extern "C" extern DLLAPI DWORD tPid; extern "C" extern DLLAPI DWORD tPid;
extern "C" extern DLLAPI bool blockRestoreSrc; extern "C" extern DLLAPI bool blockRestoreSrc;
@@ -18,23 +20,24 @@ DWORD CreateDataExportEx(LPVOID data)
ExportParam* bData = (ExportParam*)data; ExportParam* bData = (ExportParam*)data;
if (!blockRestoreSrc) { if (!blockRestoreSrc) {
// MessageBoxW(0, data,L"",0); // MessageBoxW(0, data,L"",0);
WCHAR sjp[3096]; WCHAR sjp[1024];
WCHAR scn[3096]; WCHAR scn[1024];
int lasger = GEtLargestID(); int lasger = GEtLargestID();
if (nID == 0) { if (nID == -1) {
MessageBox(0, L"the ID value seems not available,therefore this action has been refused", L"error", MB_ICONERROR); MessageBox(0, L"the ID value seems not available,therefore this action has been refused", L"error", MB_ICONERROR | MB_MODEMASK);
saveProcess = 1.0; saveProcess = 1.0;
return 1; return 1;
} }
if (nID - lasger > 2) { if (nID - lasger > 1) {
MessageBox(0, L"the ID value seems not available,therefore this action has been refused", L"error", MB_ICONERROR); MessageBox(0, L"the ID value seems not available,therefore this action has been refused", L"error", MB_ICONERROR | MB_MODEMASK);
saveProcess = 1.0; saveProcess = 1.0;
return 1; return 1;
} }
if (!GetDataByID(nID - 1, sjp, scn)) { if (!GetDataByID(nID, sjp, scn)) {
CreateDataByID(nID - 1, bData->src, 2 * (lstrlenW(bData->src) + 1), bData->data, 2 * (lstrlenW(bData->data) + 1));
CreateDataByID(nID, bData->src, 2 * (lstrlenW(bData->src) + 1), bData->data, 2 * (lstrlenW(bData->data) + 1));
WCHAR abv[16]; WCHAR abv[16];
_itow_s(nID - 1, abv, 10); _itow_s(nID, abv, 10);
wstring str; wstring str;
str += L"Apply ID:"; str += L"Apply ID:";
str += abv; str += abv;
@@ -42,20 +45,20 @@ DWORD CreateDataExportEx(LPVOID data)
str += bData->src; str += bData->src;
str += L"->"; str += L"->";
str += bData->data; str += bData->data;
MessageBoxW(NULL, str.c_str(), L"successed to add rule", MB_ICONINFORMATION); // MessageBoxW(NULL, str.c_str(), L"successed to add rule", MB_ICONINFORMATION | MB_MODEMASK);
saveProcess = 1.0; saveProcess = 1.0;
return 1; return 1;
} }
else { else {
wstring nString = L"This rule is already exist,do you want still to replace it?(according to your PC,it may take you a short time)\n"; wstring nString = L"This rule is already exist,do you want still to replace it?(according to your PC,it may take you a short time)\n";
WCHAR abv[16]; WCHAR abv[16];
_itow_s(nID - 1, abv, 10); _itow_s(nID, abv, 10);
nString += L"ID:"; nString += L"ID:";
nString += abv; nString += abv;
nString += L"\n"; nString += L"\n";
nString += sjp; nString += sjp;
saveProcess = 0.0; saveProcess = 0.0;
int result = MessageBoxW(NULL, nString.c_str(), L"information", MB_ICONINFORMATION | MB_OKCANCEL); int result = MessageBoxW(NULL, nString.c_str(), L"information", MB_ICONINFORMATION | MB_OKCANCEL | MB_MODEMASK);
if (result != IDOK) { if (result != IDOK) {
saveProcess = 1.0; saveProcess = 1.0;
return 1; return 1;
@@ -65,7 +68,7 @@ DWORD CreateDataExportEx(LPVOID data)
MicroBinary* _Data = new MicroBinary(L"~Data.ax"); MicroBinary* _Data = new MicroBinary(L"~Data.ax");
IndexData createData; IndexData createData;
while (GetDataByID(p, sjp, scn)) { while (GetDataByID(p, sjp, scn)) {
if (p == (nID - 1)) { if (p == nID) {
createData.Id = p; createData.Id = p;
createData.JpLength = 2 * (lstrlenW(sjp) + 1); createData.JpLength = 2 * (lstrlenW(sjp) + 1);
createData.CnLength = 2 * (lstrlenW(bData->data) + 1); createData.CnLength = 2 * (lstrlenW(bData->data) + 1);
@@ -128,7 +131,7 @@ DWORD CreateDataExportEx(LPVOID data)
str += bData->src; str += bData->src;
str += L"->"; str += L"->";
str += bData->data; str += bData->data;
MessageBoxW(NULL, str.c_str(), L"successed to add rule", MB_ICONINFORMATION); MessageBoxW(NULL, str.c_str(), L"successed to add rule", MB_ICONINFORMATION | MB_MODEMASK);
saveProcess = 1.0; saveProcess = 1.0;
return 1; return 1;
} }
@@ -141,7 +144,7 @@ DWORD CreateDataExportEx(LPVOID data)
nString += L"\n"; nString += L"\n";
nString += bData->src; nString += bData->src;
int result = MessageBoxW(NULL, nString.c_str(), L"information", MB_ICONINFORMATION | MB_OKCANCEL); int result = MessageBoxW(NULL, nString.c_str(), L"information", MB_ICONINFORMATION | MB_OKCANCEL | MB_MODEMASK);
if (result != IDOK) { if (result != IDOK) {
saveProcess = 1.0; saveProcess = 1.0;
return 1; return 1;
@@ -207,20 +210,28 @@ void CreateDataExport(WCHAR src[],WCHAR data[])
DWORD dwOld; DWORD dwOld;
HANDLE hTr = OpenProcess(PROCESS_ALL_ACCESS, FALSE, tPid); HANDLE hTr = OpenProcess(PROCESS_ALL_ACCESS, FALSE, tPid);
if (!hTr) {
MessageBoxA(0, "", "", 0);
return;
}
BYTE* PszLibFileRemote = (PBYTE)VirtualAllocEx(hTr, NULL, sizeof(ExportParam), MEM_COMMIT, PAGE_READWRITE); BYTE* PszLibFileRemote = (PBYTE)VirtualAllocEx(hTr, NULL, sizeof(ExportParam), MEM_COMMIT, PAGE_READWRITE);
if (!PszLibFileRemote) {
MessageBoxA(0, "", "", 0);
return;
}
WriteProcessMemory(hTr, PszLibFileRemote, &alc, sizeof(ExportParam), &dwOld); WriteProcessMemory(hTr, PszLibFileRemote, &alc, sizeof(ExportParam), &dwOld);
HANDLE hHookStart = CreateRemoteThread(hTr, NULL, 0, (LPTHREAD_START_ROUTINE) HANDLE hHookStart = CreateRemoteThread(hTr, NULL, 0, (LPTHREAD_START_ROUTINE)
::GetProcAddress(hMod, "CreateDataExportEx"), PszLibFileRemote, 0, NULL); ::GetProcAddress(hMod, "CreateDataExportEx"), PszLibFileRemote, 0, NULL);
if (!hHookStart) if (!hHookStart) {
MessageBoxA(0, "", "", 0); MessageBoxA(0, "", "", 0);
return;
}
WaitForSingleObject(hHookStart, INFINITE); WaitForSingleObject(hHookStart, INFINITE);
VirtualFreeEx(hTr, PszLibFileRemote, sizeof(ExportParam), MEM_RELEASE); VirtualFreeEx(hTr, PszLibFileRemote, 0, MEM_RELEASE);
CloseHandle(hTr); CloseHandle(hTr);
} }
BOOL CreateDataByID(int ID, LPCWSTR jpBuff, int ljp, LPCWSTR cnBuffer, int lcn) BOOL CreateDataByID(int ID, LPCWSTR jpBuff, int ljp, LPCWSTR cnBuffer, int lcn)
@@ -246,6 +257,8 @@ BOOL GetDataByJP(int* ID, LPCWSTR jpBuff, LPWSTR cnBuffer)
(*Index) = 0; (*Index) = 0;
do { do {
Index->Get(&index); Index->Get(&index);
if (index.CnLength > 1024 || index.JpLength > 1024)
MessageBox(0, L"error", L"", 0);
( *Data) = index.JpBass; ( *Data) = index.JpBass;
Data->Sub(njp, index.JpLength); Data->Sub(njp, index.JpLength);
(* Data) = index.CnBass; (* Data) = index.CnBass;
@@ -270,7 +283,9 @@ BOOL GetDataByJP(int* ID, LPCWSTR jpBuff, LPWSTR cnBuffer)
BOOL GetDataByID(int ID, LPWSTR jpBuff, LPWSTR cnBuffer) BOOL GetDataByID(int ID, LPWSTR jpBuff, LPWSTR cnBuffer)
{ {
// //
if (ID < 0)return 0; if (ID == -1) {
return 0;
}
IndexData index; IndexData index;
(*Index) = ID; (*Index) = ID;
Index->Get(&index); Index->Get(&index);
@@ -289,6 +304,10 @@ BOOL GetDataByID(int ID, LPWSTR jpBuff, LPWSTR cnBuffer)
} }
} while (1); } while (1);
} }
if (index.CnLength > 1024 || index.JpLength > 1024)
MessageBox(0,L"error",L"",0);
(*Data) = index.JpBass; (*Data) = index.JpBass;
Data->Sub(jpBuff, index.JpLength); Data->Sub(jpBuff, index.JpLength);
(*Data) = index.CnBass; (*Data) = index.CnBass;

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,9 +1,2 @@
 pch.cpp  BuildIn.cpp
BuildIn.cpp
Data.cpp
dllmain.cpp
Replace.cpp
D:\VSProject\cs2\cs2_united\cs2_patch\Replace.cpp(56,23): warning C4018: “<”: 有符号/无符号不匹配
正在生成代码...
正在创建库 D:\VSProject\cs2\cs2_united\Debug\cs2_patch.lib 和对象 D:\VSProject\cs2\cs2_united\Debug\cs2_patch.exp
cs2_patch.vcxproj -> D:\VSProject\cs2\cs2_united\Debug\cs2_patch.dll cs2_patch.vcxproj -> D:\VSProject\cs2\cs2_united\Debug\cs2_patch.dll

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,8 +1,9 @@
 BuildIn.cpp  Replace.cpp
D:\VSProject\cs2\cs2_united\cs2_patch\Replace.cpp(74,23): warning C4018: “<”: 有符号/无符号不匹配
正在创建库 D:\VSProject\cs2\cs2_united\Release\cs2_patch.lib 和对象 D:\VSProject\cs2\cs2_united\Release\cs2_patch.exp 正在创建库 D:\VSProject\cs2\cs2_united\Release\cs2_patch.lib 和对象 D:\VSProject\cs2\cs2_united\Release\cs2_patch.exp
正在生成代码 正在生成代码
1 of 129 functions ( 0.8%) were compiled, the rest were copied from previous compilation. 2 of 162 functions ( 1.2%) were compiled, the rest were copied from previous compilation.
0 functions were new in current compilation 0 functions were new in current compilation
2 functions had inline decision re-evaluated but remain unchanged 0 functions had inline decision re-evaluated but remain unchanged
已完成代码的生成 已完成代码的生成
cs2_patch.vcxproj -> D:\VSProject\cs2\cs2_united\Release\cs2_patch.dll cs2_patch.vcxproj -> D:\VSProject\cs2\cs2_united\Release\cs2_patch.dll

Binary file not shown.

Binary file not shown.

View File

@@ -1,17 +1,31 @@
#include "pch.h" #include "pch.h"
#include "Replace.h" #include "Replace.h"
int npID = 0;
#include<algorithm>
#include<iostream>
#include<set>
extern HMODULE hModL; extern HMODULE hModL;
extern "C" extern DLLAPI wchar_t ms_str[3096]; extern "C" extern DLLAPI wchar_t ms_str[3096];
extern "C" extern DLLAPI int nID; extern "C" extern DLLAPI int nID;
void BuildCV(TESTDATA* pcv, TESTDATA flt, DWORD posinCross, DWORD posInLine, DWORD m_count, WCHAR nchar) extern "C" extern DLLAPI wchar_t cn_str[1024];
extern "C" extern DLLAPI bool IsSuccess;
extern TESTDATA* pNewDf;
extern char IpfData[16];
#define PutInt(a) _itoa_s(a,IpfData,16);MessageBoxA(0,IpfData,"num",0);
multiset<DWORD> AddrList;
extern "C" DLLAPI void BuildCV(TESTDATA* pcv, TESTDATA flt, DWORD posinCross, DWORD posInLine, DWORD m_count, WCHAR nchar)
{ {
pcv->ForCast = flt.ForCast; pcv->ForCast = flt.ForCast;
pcv->nLine = posinCross; pcv->nLine = posinCross;
pcv->nChar = nchar; pcv->nChar = nchar;
pcv->nCross = posInLine; pcv->nCross = posInLine;
pcv->Flag1 = flt.Flag1; pcv->Flag1 = flt.Flag1;
pcv->Flag2 = flt.Flag2; pcv->Flag2 = 0xFFC8C8C8;
pcv->Flag3 = flt.Flag3; pcv->Flag3 = flt.Flag3;
pcv->Flag4 = flt.Flag4; pcv->Flag4 = flt.Flag4;
pcv->Flagn4 = flt.Flagn4; pcv->Flagn4 = flt.Flagn4;
@@ -30,59 +44,92 @@ void BuildCV(TESTDATA* pcv, TESTDATA flt, DWORD posinCross, DWORD posInLine, DWO
pcv->Over2 = flt.Over2; pcv->Over2 = flt.Over2;
return; return;
} }
void ApplyStringToCV(LPCWSTR ws, DWORD pDf, int id)
void ApplyStringToCV(LPCWSTR ws, DWORD pDf)
{ {
// return;
// SetWindowTextW(GetForegroundWindow(),ws);
TESTDATA loadFirst = *((TESTDATA*)(*(DWORD*)pDf));
//if (pNewDf)
// free(pNewDf);
pNewDf =(TESTDATA*) malloc(1024*96);
for (int i = 0; i < 1024; i++)
BuildCV(&pNewDf[i], loadFirst, 0XD, 0, 0, 0);
wstring localString = ws; wstring localString = ws;
if (!pDf)return; if (!pDf)return;
if (!ws)return; if (!ws)return;
DWORD Df = *(DWORD*)pDf;//Df <20><><EFBFBD>ݵ<EFBFBD>ָ<EFBFBD><D6B8>
if (!Df)return;//Ϊ<><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD>
TESTDATA* nCView = (TESTDATA*)Df;//ʹһ<CAB9><D2BB>TESTDATA*ָ<><D6B8>Df *(DWORD*)pDf = (DWORD)pNewDf;
DWORD pOld;
VirtualProtect(nCView, 10 + (localString.length() * 2), PAGE_READWRITE, &pOld);
TESTDATA loadFirst = *nCView;//<2F><><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int posInLine = 0;//<2F><><EFBFBD><EFBFBD>λ<EFBFBD><CEBB> int posInLine = 0;//<2F><><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
int posinCross = 0xD;//<2F><><EFBFBD><EFBFBD>λ<EFBFBD><CEBB> int posinCross = 0xD;//<2F><><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
// SetWindowTextW(m_hWnd, L"<22><><EFBFBD><EFBFBD>ѭ<EFBFBD><D1AD>"); // SetWindowTextW(m_hWnd, L"<22><><EFBFBD><EFBFBD>ѭ<EFBFBD><D1AD>");
int PJ = 0;
for (int i = 0; i < localString.length(); i++) for (int i = 0; i < localString.length(); i++)
{ {
if (localString[i] == L'\n') if (localString[i] == L'\n')
{ {
BuildCV(nCView, loadFirst, posinCross, posInLine, i * 2, 0); BuildCV(&pNewDf[PJ], loadFirst, posinCross, posInLine, i * 2, 0);
nCView++; PJ++;
BuildCV(nCView, loadFirst, posinCross, posInLine, i * 2, 0XFFFF); BuildCV(&pNewDf[PJ], loadFirst, posinCross, posInLine, i * 2, 0XFFFF);
nCView++; PJ++;
posinCross += 0x28; posinCross += 0x28;
posInLine = 0; posInLine = 0;
} }
else else
{ {
BuildCV(nCView, loadFirst, posinCross, posInLine, i * 2, localString[i]); BuildCV(&pNewDf[PJ], loadFirst, posinCross, posInLine, i * 2, localString[i]);
nCView++; PJ++;
posInLine += 0X1A; posInLine += 0X1A;
} }
} }
PJ++;
// SetWindowTextW(m_hWnd, L"<22><><EFBFBD><EFBFBD>ѭ<EFBFBD><D1AD>"); // SetWindowTextW(m_hWnd, L"<22><><EFBFBD><EFBFBD>ѭ<EFBFBD><D1AD>");
*(DWORD*)(pDf + 4) = (DWORD)nCView; *(DWORD*)(pDf + 4) = (DWORD)&pNewDf[PJ];
VirtualProtect(nCView, 10 + (localString.length() * 2), pOld, NULL);
int sized = *(DWORD*)(pDf + 4) - *(DWORD*)pDf;
// PutInt(sized);
lstrcpyW(cn_str, ws);
} }
static bool InitOnce = true;
int TranSplete(DWORD lp) int TranSplete(DWORD lp)
{ {
// MessageBox(0,L"Transplete start",L"",0); // MessageBoxA(0,"","",0);
if (!lp)return -1; //定义缓冲区
WCHAR sjp[1024];
WCHAR scn[1024];
wstring nStr;
/*第一部分 排除无效的调用*/
if (!lp)return 1;
DWORD ppDf = *(DWORD*)(lp + 0x2B0); DWORD ppDf = *(DWORD*)(lp + 0x2B0);
if (!ppDf)return -1; if (!ppDf)return 1;
DWORD pDf = *(DWORD*)(ppDf + 8); DWORD pDf = *(DWORD*)(ppDf + 8);
if (!pDf)return -1; if (!pDf)return 1;
DWORD Df = *(DWORD*)pDf; DWORD Df = *(DWORD*)pDf;
if (!Df)return -1; if (!Df)return 1;
DWORD pEnd = *(DWORD*)(pDf + 4); DWORD pEnd = *(DWORD*)(pDf + 4);
if (!pEnd)return -1; if (!pEnd)return 1;
WCHAR sjp[1024]; /*************************/
WCHAR scn[1024];
DWORD Num = (pEnd - Df) / 96; TESTDATA* nCView = (TESTDATA*)Df;//定义指向当前数据的指针
wstring nStr; DWORD Num = (pEnd - Df) / 96;//定义长度
TESTDATA* nCView = (TESTDATA*)Df;
if (Num == 0) {
return 1;
}
/*先扫描一次数据内存把字符逐一加入nStr*/
for (DWORD i = 0; i < Num; i++) { for (DWORD i = 0; i < Num; i++) {
if (nCView->nChar == 0xFFFF) { if (nCView->nChar == 0xFFFF) {
} }
@@ -94,55 +141,80 @@ void ApplyStringToCV(LPCWSTR ws, DWORD pDf, int id)
} }
nCView++; nCView++;
} }
npID++; /***************************************/
// MessageBoxW(0,L"0",L"",0);
WCHAR csjp[1024]; if (lstrcmpW(nStr.c_str(), cn_str) == 0) {//如果和上一句的中文相同,则直接返回。
WCHAR cscn[1024];
int ppId = 0;
if (!GetDataByID(nID - 1, csjp, cscn)) {
if (nID != 0)
if (!GetDataByJP(&ppId, nStr.c_str(), cscn))
return -1;
}
// MessageBoxW(0, L"1", L"", 0);
if (lstrcmpW(nStr.c_str(), cscn) == 0) {
// MessageBoxW(0, nStr.c_str(), L"", 0);
return -1; return -1;
} }
// MessageBoxW(0, L"2", L"", 0); // PutInt(*(DWORD*)pDf);
if (wcsstr(nStr.c_str(), L"………")) { // PutInt(Num);
// MessageBoxW(0, nStr.c_str(), L"", 0);
/******排除较短的语气词******/
if (wcsstr(nStr.c_str(), L"………") && lstrlenW(nStr.c_str()) < 8)
return -1; return -1;
} if (wcsstr(nStr.c_str(), L"…ああ")&&lstrlenW(nStr.c_str())<8)
if (wcsstr(nStr.c_str(), L"…ああ"))
return -1; return -1;
if (wcsstr(nStr.c_str(), L"ふふふっ")) if (wcsstr(nStr.c_str(), L"ふふふっ") && lstrlenW(nStr.c_str()) < 8)
return -1; return -1;
/****************************/
//应用当前句到msstr
lstrcpyW(ms_str, nStr.c_str()); lstrcpyW(ms_str, nStr.c_str());
if (!GetDataByID(nID, sjp, scn)) {
// MessageBoxA(0,"","",0);
int ppdid = nID + 1;
if (!GetDataByID(ppdid, sjp, scn)) {//尝试获取当前ID的数据
//如果失败
int pID = 0; int pID = 0;
if (GetDataByJP(&pID, nStr.c_str(), scn)) { if (GetDataByJP(&pID, nStr.c_str(), scn)) {//尝试从原文获取翻译
nID = pID + 1; //成功
ApplyStringToCV(scn, pDf, pID); nID = pID;
return 0; // MessageBoxW(0,scn,L"",0);
ApplyStringToCV(scn, pDf);
// MessageBoxA(0,"0","",0);
return 0;//直接返回
}
else {
//失败
if (GetDataByID(nID, sjp, scn))
nID = GEtLargestID() + 1;
// MessageBoxA(0, "1", "", 0);
return -1;
} }
} }
else else
{ {
if (lstrcmpW(sjp, nStr.c_str()) == 0) { //如果成功
ApplyStringToCV(scn, pDf, nID); if (lstrcmpW(sjp, nStr.c_str()) == 0) {//检查是否是正确的翻译
//如果是则直接应用
// MessageBoxW(0, scn, L"", 0);
ApplyStringToCV(scn, pDf);
nID = ppdid;
// MessageBoxA(0, "2", "", 0);
return 0;
} }
else else
{ {
//如果不是则
int pID = 0; int pID = 0;
if (GetDataByJP(&pID, nStr.c_str(), scn)) { if (GetDataByJP(&pID, nStr.c_str(), scn)) {//再次尝试用原文获取数据
nID = pID + 1; //如果成功
ApplyStringToCV(scn, pDf, pID); // MessageBoxW(0, scn, L"", 0);
return 0; ApplyStringToCV(scn, pDf);
}
else
nID = pID; nID = pID;
// MessageBoxA(0, "3", "", 0);
return 0;//直接返回
}
else {
//如果不是
nID = GEtLargestID()+1;
// MessageBoxA(0, "4", "", 0);
return -1;
}
} }
} }
nID++;
return 0; return -1;
} }

View File

@@ -27,6 +27,6 @@ struct TESTDATA {
DWORD Over1; DWORD Over1;
QWORD Over2; QWORD Over2;
}; };
void BuildCV(TESTDATA* pcv, TESTDATA flt, DWORD posinCross, DWORD posInLine, DWORD m_count, WCHAR nchar); extern "C" DLLAPI void BuildCV(TESTDATA* pcv, TESTDATA flt, DWORD posinCross, DWORD posInLine, DWORD m_count, WCHAR nchar);
void ApplyStringToCV(LPCWSTR ws, DWORD pDf, int id); void ApplyStringToCV(LPCWSTR ws, DWORD pDf);
extern "C" DLLAPI int TranSplete(DWORD lp); extern "C" DLLAPI int TranSplete(DWORD lp);

View File

@@ -4,19 +4,32 @@
#include "BuildIn.h" #include "BuildIn.h"
#pragma data_seg("PublicData") // 声明共享数据段,并命名该数据段 #pragma data_seg("PublicData") // 声明共享数据段,并命名该数据段
//代表储存数据的进度
extern "C" DLLAPI double saveProcess = 0.0; extern "C" DLLAPI double saveProcess = 0.0;
//共享模块句柄
HMODULE hMod = NULL; HMODULE hMod = NULL;
//储存原文字符串
extern "C" DLLAPI wchar_t ms_str[3096] = { 0 }; extern "C" DLLAPI wchar_t ms_str[3096] = { 0 };
//储存GetGlyphoutLine的输出记录
extern "C" DLLAPI wchar_t ns_str[6192] = { 0 }; extern "C" DLLAPI wchar_t ns_str[6192] = { 0 };
extern "C" DLLAPI int nID = 0; //储存译文字符串
extern "C" DLLAPI wchar_t cn_str[1024] = { 0 };
//当前的ID
extern "C" DLLAPI int nID = -1;
//目标进程PID
extern "C" DLLAPI DWORD tPid = 0; extern "C" DLLAPI DWORD tPid = 0;
//函数地址
extern "C" DLLAPI DWORD m_Addr = 0xFFFFFFFF; extern "C" DLLAPI DWORD m_Addr = 0xFFFFFFFF;
//暴力提取的模式
extern "C" DLLAPI DWORD VioMode = 0; extern "C" DLLAPI DWORD VioMode = 0;
//是否成功获取到译文
extern "C" DLLAPI bool IsSuccess = false;
//框架备用
extern "C" DLLAPI bool blockRestoreSrc = false; extern "C" DLLAPI bool blockRestoreSrc = false;
#pragma data_seg() #pragma data_seg()
#pragma comment(linker, "/section:PublicData,rws") #pragma comment(linker, "/section:PublicData,rws")
MicroData* Index = NULL; MicroData* Index = NULL;
MicroBinary* Data = NULL; MicroBinary* Data = NULL;
char IpfData[16]; char IpfData[16];