Some updates

This commit is contained in:
binarymaster 2014-12-10 01:00:20 +03:00
parent 4054ef493b
commit 31cce7a873
5 changed files with 171 additions and 151 deletions

View File

@ -39,7 +39,7 @@ INI_FILE::INI_FILE(wchar_t *FilePath)
} }
FileRaw = new char[FileSize]; FileRaw = new char[FileSize];
Status = (bool)ReadFile(hFile, FileRaw, FileSize, &NumberOfBytesRead, NULL); Status = ReadFile(hFile, FileRaw, FileSize, &NumberOfBytesRead, NULL);
if (!Status) if (!Status)
{ {
return; return;
@ -371,6 +371,7 @@ bool INI_FILE::GetVariableInSection(char *SectionName, char *VariableName, INI_V
DWORD ValueLen = strlen(Variable.VariableValue); DWORD ValueLen = strlen(Variable.VariableValue);
if ((ValueLen % 2) != 0) return false; if ((ValueLen % 2) != 0) return false;
// for security reasons not more than 16 bytes // for security reasons not more than 16 bytes
if (ValueLen > 32) ValueLen = 32; // 32 hex digits if (ValueLen > 32) ValueLen = 32; // 32 hex digits

View File

@ -87,6 +87,7 @@ public:
INI_FILE(wchar_t*); INI_FILE(wchar_t*);
~INI_FILE(); ~INI_FILE();
// char block
bool SectionExists(char *SectionName); bool SectionExists(char *SectionName);
bool VariableExists(char *SectionName, char *VariableName); bool VariableExists(char *SectionName, char *VariableName);
bool GetVariableInSection(char *SectionName, char *VariableName, INI_VAR_STRING *Variable); bool GetVariableInSection(char *SectionName, char *VariableName, INI_VAR_STRING *Variable);
@ -95,6 +96,15 @@ public:
bool GetVariableInSection(char *SectionName, char *VariableName, INI_VAR_BYTEARRAY *Variable); bool GetVariableInSection(char *SectionName, char *VariableName, INI_VAR_BYTEARRAY *Variable);
bool GetSectionVariablesList(char *SectionName, INI_SECTION_VARLIST *VariablesList); bool GetSectionVariablesList(char *SectionName, INI_SECTION_VARLIST *VariablesList);
// wchar_t tramps
bool SectionExists(wchar_t *SectionName);
bool VariableExists(wchar_t *SectionName, wchar_t *VariableName);
bool GetVariableInSection(wchar_t *SectionName, wchar_t *VariableName, INI_VAR_STRING *Variable);
bool GetVariableInSection(wchar_t *SectionName, wchar_t *VariableName, INI_VAR_DWORD *Variable);
bool GetVariableInSection(wchar_t *SectionName, wchar_t *VariableName, bool *Variable);
bool GetVariableInSection(wchar_t *SectionName, wchar_t *VariableName, INI_VAR_BYTEARRAY *Variable);
bool GetSectionVariablesList(wchar_t *SectionName, INI_SECTION_VARLIST *VariablesList);
private: private:
DWORD FileSize; // Ini file size DWORD FileSize; // Ini file size
char *FileRaw; // Ini file raw dump char *FileRaw; // Ini file raw dump

View File

@ -56,7 +56,7 @@ FARJMP Old_SLGetWindowsInformationDWORD, Stub_SLGetWindowsInformationDWORD;
SLGETWINDOWSINFORMATIONDWORD _SLGetWindowsInformationDWORD; SLGETWINDOWSINFORMATIONDWORD _SLGetWindowsInformationDWORD;
INI_FILE *IniFile; INI_FILE *IniFile;
wchar_t LogFile[256] = {0x00}; wchar_t LogFile[256] = L"\\rdpwrap.txt";
HMODULE hTermSrv; HMODULE hTermSrv;
HMODULE hSLC; HMODULE hSLC;
PLATFORM_DWORD TermSrvBase; PLATFORM_DWORD TermSrvBase;
@ -519,7 +519,7 @@ void Hook()
return; return;
} }
INI_VAR_STRING LogFileVar; /*INI_VAR_STRING LogFileVar;
if(!(IniFile->GetVariableInSection("Main", "LogFile", &LogFileVar))) if(!(IniFile->GetVariableInSection("Main", "LogFile", &LogFileVar)))
{ {
@ -533,7 +533,7 @@ void Hook()
} }
} }
} }
else memcpy((void*)LogFile, LogFileVar.Value, strlen(LogFileVar.Value)); else memcpy((void*)LogFile, LogFileVar.Value, strlen(LogFileVar.Value));*/
char *Log; char *Log;
SIZE_T bw; SIZE_T bw;
@ -680,6 +680,7 @@ void Hook()
INI_VAR_STRING PatchName; INI_VAR_STRING PatchName;
INI_VAR_BYTEARRAY Patch; INI_VAR_BYTEARRAY Patch;
Sect = new char[1024]; Sect = new char[1024];
memset(Sect, 0x00, 1024);
wsprintfA(Sect, "%d.%d.%d.%d", FV.wVersion.Major, FV.wVersion.Minor, FV.Release, FV.Build); wsprintfA(Sect, "%d.%d.%d.%d", FV.wVersion.Major, FV.wVersion.Minor, FV.Release, FV.Build);
if (IniFile->SectionExists(Sect)) if (IniFile->SectionExists(Sect))

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations"> <ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32"> <ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration> <Configuration>Debug</Configuration>
@ -27,26 +27,26 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset> <PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset> <PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset> <PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset> <PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
@ -160,6 +160,7 @@
<Text Include="ReadMe.txt" /> <Text Include="ReadMe.txt" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="IniFile.h" />
<ClInclude Include="stdafx.h" /> <ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" /> <ClInclude Include="targetver.h" />
</ItemGroup> </ItemGroup>
@ -178,6 +179,7 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader> </PrecompiledHeader>
</ClCompile> </ClCompile>
<ClCompile Include="IniFile.cpp" />
<ClCompile Include="RDPWrap.cpp" /> <ClCompile Include="RDPWrap.cpp" />
<ClCompile Include="stdafx.cpp"> <ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>

View File

@ -24,6 +24,9 @@
<ClInclude Include="targetver.h"> <ClInclude Include="targetver.h">
<Filter>Заголовочные файлы</Filter> <Filter>Заголовочные файлы</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="IniFile.h">
<Filter>Заголовочные файлы</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="stdafx.cpp"> <ClCompile Include="stdafx.cpp">
@ -35,6 +38,9 @@
<ClCompile Include="dllmain.cpp"> <ClCompile Include="dllmain.cpp">
<Filter>Файлы исходного кода</Filter> <Filter>Файлы исходного кода</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="IniFile.cpp">
<Filter>Файлы исходного кода</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="Export.def"> <None Include="Export.def">