Some fixes and comments

The final is near, it already compiles :)
This commit is contained in:
binarymaster 2014-12-09 00:59:47 +03:00
parent 87887259b2
commit a449d04619
2 changed files with 41 additions and 53 deletions

View File

@ -400,7 +400,7 @@ bool INI_FILE::GetVariableInSection(char *SectionName, char *VariableName, INI_V
switch(Variable.VariableValue[i+1])
{
case '0': break;
case '0': break;
case '1': RetVariable->Value[(i/2)] += 1; break;
case '2': RetVariable->Value[(i/2)] += 2; break;
case '3': RetVariable->Value[(i/2)] += 3; break;

View File

@ -89,20 +89,10 @@ void INIReadString(INI_FILE *IniFile, char *Sect, char *VariableName, char *Defa
strcpy_s(Ret, RetSize, Variable.Value);
}
int SListFind(INI_SECTION_VARLIST List, char *Name)
{
for (DWORD i = 0; i < List.EntriesCount; i++)
{
if(strcmp(List.NamesEntries[i].String, Name) == 0) return i;
}
return -1;
}
void WriteToLog(LPSTR Text)
{
DWORD dwBytesOfWritten;
// Correct this - LogFile
HANDLE hFile = CreateFile(LogFile, GENERIC_WRITE, FILE_SHARE_WRITE | FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE) return;
@ -114,19 +104,10 @@ void WriteToLog(LPSTR Text)
HMODULE GetCurrentModule()
{
HMODULE hModule = NULL;
// Check this
GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (LPCWSTR)GetCurrentModule, &hModule);
return hModule;
}
// Correct this
LPCWSTR GetBinaryPath()
{
wchar_t Filename[256];
GetModuleFileName(GetCurrentModule(), &Filename[0], 256);
return &Filename[0];
}
/*PLATFORM_DWORD SearchAddressBySignature(char *StartPosition, PLATFORM_DWORD Size, char *Signature, int SignatureSize)
{
PLATFORM_DWORD AddressReturn = -1;
@ -432,7 +413,7 @@ HRESULT WINAPI New_CSLQuery_Initialize()
if (bServerSku)
{
*bServerSku = INIReadDWordHex(IniFile, "SLInit", "bServerSku", 0);
*bServerSku = INIReadDWordHex(IniFile, "SLInit", "bServerSku", 1);
Log = new char[1024];
wsprintfA(Log, "[0x%p] bServerSku = %d\r\n", bServerSku, *bServerSku);
@ -441,7 +422,7 @@ HRESULT WINAPI New_CSLQuery_Initialize()
}
if (bRemoteConnAllowed)
{
*bRemoteConnAllowed = INIReadDWordHex(IniFile, "SLInit", "bRemoteConnAllowed", 0);
*bRemoteConnAllowed = INIReadDWordHex(IniFile, "SLInit", "bRemoteConnAllowed", 1);
Log = new char[1024];
wsprintfA(Log, "[0x%p] bRemoteConnAllowed = %d\r\n", bRemoteConnAllowed, *bRemoteConnAllowed);
@ -450,7 +431,7 @@ HRESULT WINAPI New_CSLQuery_Initialize()
}
if (bFUSEnabled)
{
*bFUSEnabled = INIReadDWordHex(IniFile, "SLInit", "bFUSEnabled", 0);
*bFUSEnabled = INIReadDWordHex(IniFile, "SLInit", "bFUSEnabled", 1);
Log = new char[1024];
wsprintfA(Log, "[0x%p] bFUSEnabled = %d\r\n", bFUSEnabled, *bFUSEnabled);
@ -459,7 +440,7 @@ HRESULT WINAPI New_CSLQuery_Initialize()
}
if (bAppServerAllowed)
{
*bAppServerAllowed = INIReadDWordHex(IniFile, "SLInit", "bAppServerAllowed", 0);
*bAppServerAllowed = INIReadDWordHex(IniFile, "SLInit", "bAppServerAllowed", 1);
Log = new char[1024];
wsprintfA(Log, "[0x%p] bAppServerAllowed = %d\r\n", bAppServerAllowed, *bAppServerAllowed);
@ -468,7 +449,7 @@ HRESULT WINAPI New_CSLQuery_Initialize()
}
if (bMultimonAllowed)
{
*bMultimonAllowed = INIReadDWordHex(IniFile, "SLInit", "bMultimonAllowed", 0);
*bMultimonAllowed = INIReadDWordHex(IniFile, "SLInit", "bMultimonAllowed", 1);
Log = new char[1024];
wsprintfA(Log, "[0x%p] bMultimonAllowed = %d\r\n", bMultimonAllowed, *bMultimonAllowed);
@ -495,7 +476,7 @@ HRESULT WINAPI New_CSLQuery_Initialize()
}
if (bInitialized)
{
*bInitialized = INIReadDWordHex(IniFile, "SLInit", "bInitialized", 0);
*bInitialized = INIReadDWordHex(IniFile, "SLInit", "bInitialized", 1);
Log = new char[1024];
wsprintfA(Log, "[0x%p] bInitialized = %d\r\n", bInitialized, *bInitialized);
@ -520,7 +501,6 @@ void Hook()
wchar_t ConfigFile[256] = {0x00};
WriteToLog("Loading configuration...\r\n");
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>
GetModuleFileName(GetCurrentModule(), ConfigFile, 255);
for(DWORD i = wcslen(ConfigFile); i > 0; i--)
{
@ -554,6 +534,8 @@ void Hook()
}
}
}
// else...
// LogFileVar => LogFile
char *Log;
SIZE_T bw;
@ -739,7 +721,9 @@ void Hook()
SignPtr = (PLATFORM_DWORD)(TermSrvBase + INIReadDWordHex(IniFile, Sect, "LocalOnlyOffset.x86", 0));
IniFile->GetVariableInSection(Sect, "LocalOnlyCode.x86", &Patch);
#endif
// Patch.Value is char
// WriteProcessMemory uses LPCVOID lpBuffer, so...
// maybe &Patch.Value ?
if (i >= 0) WriteProcessMemory(GetCurrentProcess(), (LPVOID)SignPtr, Patch.Value, Patch.ArraySize, &bw);
}
#ifdef _WIN64
@ -758,7 +742,9 @@ void Hook()
SignPtr = (PLATFORM_DWORD)(TermSrvBase + INIReadDWordHex(IniFile, Sect, "SingleUserOffset.x86", 0));
IniFile->GetVariableInSection(Sect, "SingleUserCode.x86", &Patch);
#endif
// Patch.Value is char
// WriteProcessMemory uses LPCVOID lpBuffer, so...
// maybe &Patch.Value ?
if (i >= 0) WriteProcessMemory(GetCurrentProcess(), (LPVOID)SignPtr, Patch.Value, Patch.ArraySize, &bw);
}
#ifdef _WIN64
@ -777,7 +763,9 @@ void Hook()
SignPtr = (PLATFORM_DWORD)(TermSrvBase + INIReadDWordHex(IniFile, Sect, "DefPolicyOffset.x86", 0));
IniFile->GetVariableInSection(Sect, "DefPolicyCode.x86", &Patch);
#endif
// Patch.Value is char
// WriteProcessMemory uses LPCVOID lpBuffer, so...
// maybe &Patch.Value ?
if (i >= 0) WriteProcessMemory(GetCurrentProcess(), (LPVOID)SignPtr, Patch.Value, Patch.ArraySize, &bw);
}
#ifdef _WIN64