parent
239cd5fe3f
commit
939a884f20
|
@ -24,7 +24,7 @@ INI_FILE::INI_FILE(wchar_t *FilePath)
|
||||||
DWORD Status = 0;
|
DWORD Status = 0;
|
||||||
DWORD NumberOfBytesRead = 0;
|
DWORD NumberOfBytesRead = 0;
|
||||||
|
|
||||||
HANDLE hFile = CreateFile(FilePath, GENERIC_ALL, FILE_SHARE_READ | FILE_SHARE_WRITE,
|
HANDLE hFile = CreateFile(FilePath, GENERIC_READ, FILE_SHARE_WRITE|FILE_SHARE_READ,
|
||||||
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||||
|
|
||||||
if (hFile == INVALID_HANDLE_VALUE)
|
if (hFile == INVALID_HANDLE_VALUE)
|
||||||
|
@ -376,7 +376,7 @@ bool INI_FILE::GetVariableInSection(char *SectionName, char *VariableName, INI_V
|
||||||
if (ValueLen > 32) ValueLen = 32; // 32 hex digits
|
if (ValueLen > 32) ValueLen = 32; // 32 hex digits
|
||||||
|
|
||||||
memset(RetVariable, 0x00, sizeof(*RetVariable));
|
memset(RetVariable, 0x00, sizeof(*RetVariable));
|
||||||
memcpy(RetVariable->Name, Variable.VariableName, ValueLen);
|
memcpy(RetVariable->Name, Variable.VariableName, strlen(Variable.VariableName));
|
||||||
|
|
||||||
for (DWORD i = 0; i <= ValueLen; i++)
|
for (DWORD i = 0; i <= ValueLen; i++)
|
||||||
{
|
{
|
||||||
|
@ -545,4 +545,4 @@ bool INI_FILE::GetSectionVariablesList(wchar_t *SectionName, INI_SECTION_VARLIST
|
||||||
wcstombs(cSectionName, SectionName, MAX_STRING_LEN);
|
wcstombs(cSectionName, SectionName, MAX_STRING_LEN);
|
||||||
|
|
||||||
return GetSectionVariablesList(cSectionName, VariablesList);
|
return GetSectionVariablesList(cSectionName, VariablesList);
|
||||||
}
|
}
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "IniFile.h"
|
#include "IniFile.h"
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -499,16 +500,16 @@ void Hook()
|
||||||
AlreadyHooked = true;
|
AlreadyHooked = true;
|
||||||
char *Log;
|
char *Log;
|
||||||
|
|
||||||
wchar_t ConfigFile[256] = {0x00};
|
wchar_t ConfigFile[256] = { 0x00 };
|
||||||
WriteToLog("Loading configuration...\r\n");
|
WriteToLog("Loading configuration...\r\n");
|
||||||
|
|
||||||
GetModuleFileName(GetCurrentModule(), ConfigFile, 255);
|
GetModuleFileName(GetCurrentModule(), ConfigFile, 255);
|
||||||
for(DWORD i = wcslen(ConfigFile); i > 0; i--)
|
for (DWORD i = wcslen(ConfigFile); i > 0; i--)
|
||||||
{
|
{
|
||||||
if(ConfigFile[i] == '\\')
|
if (ConfigFile[i] == '\\')
|
||||||
{
|
{
|
||||||
memset(&ConfigFile[i+1], 0x00, ((256-(i+1)))*2);
|
memset(&ConfigFile[i + 1], 0x00, ((256 - (i + 1))) * 2);
|
||||||
memcpy(&ConfigFile[i+1], L"rdpwrap.ini", strlen("rdpwrap.ini")*2);
|
memcpy(&ConfigFile[i + 1], L"rdpwrap.ini", strlen("rdpwrap.ini") * 2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -520,6 +521,7 @@ void Hook()
|
||||||
|
|
||||||
IniFile = new INI_FILE(ConfigFile);
|
IniFile = new INI_FILE(ConfigFile);
|
||||||
|
|
||||||
|
// TODO: implement this
|
||||||
if (IniFile == NULL)
|
if (IniFile == NULL)
|
||||||
{
|
{
|
||||||
WriteToLog("Error: Failed to load configuration\r\n");
|
WriteToLog("Error: Failed to load configuration\r\n");
|
||||||
|
@ -541,12 +543,14 @@ void Hook()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else memcpy((void*)LogFile, LogFileVar.Value, strlen(LogFileVar.Value));
|
else
|
||||||
|
{
|
||||||
Log = new char[1024];
|
// TODO: Change it before add UNICODE in IniFile
|
||||||
wsprintfA(Log, "Log file: %S\r\n", LogFile);
|
wchar_t wcLogFile[256];
|
||||||
WriteToLog(Log);
|
memset(wcLogFile, 0x00, 256);
|
||||||
delete[] Log;
|
mbstowcs(wcLogFile, LogFileVar.Value, 255);
|
||||||
|
wcscpy(LogFile, wcLogFile);
|
||||||
|
}
|
||||||
|
|
||||||
SIZE_T bw;
|
SIZE_T bw;
|
||||||
WORD Ver = 0;
|
WORD Ver = 0;
|
||||||
|
@ -603,10 +607,10 @@ void Hook()
|
||||||
WriteToLog("freeze\r\n");
|
WriteToLog("freeze\r\n");
|
||||||
SetThreadsState(false);
|
SetThreadsState(false);
|
||||||
|
|
||||||
bool bSLHook;
|
bool Bool;
|
||||||
if (!(IniFile->GetVariableInSection("Main", "SLPolicyHookNT60", &bSLHook))) bSLHook = true;
|
if (!(IniFile->GetVariableInSection("Main", "SLPolicyHookNT60", &Bool))) Bool = true;
|
||||||
|
|
||||||
if ((Ver == 0x0600) && bSLHook)
|
if ((Ver == 0x0600) && Bool)
|
||||||
{
|
{
|
||||||
// Windows Vista
|
// Windows Vista
|
||||||
// uses SL Policy API (slc.dll)
|
// uses SL Policy API (slc.dll)
|
||||||
|
@ -636,9 +640,9 @@ void Hook()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(IniFile->GetVariableInSection("Main", "SLPolicyHookNT61", &bSLHook))) bSLHook = true;
|
if (!(IniFile->GetVariableInSection("Main", "SLPolicyHookNT61", &Bool))) Bool = true;
|
||||||
|
|
||||||
if ((Ver == 0x0601) && bSLHook)
|
if ((Ver == 0x0601) && Bool)
|
||||||
{
|
{
|
||||||
// Windows 7
|
// Windows 7
|
||||||
// uses SL Policy API (slc.dll)
|
// uses SL Policy API (slc.dll)
|
||||||
|
@ -699,7 +703,6 @@ void Hook()
|
||||||
{
|
{
|
||||||
if (GetModuleCodeSectionInfo(hTermSrv, &TermSrvBase, &TermSrvSize))
|
if (GetModuleCodeSectionInfo(hTermSrv, &TermSrvBase, &TermSrvSize))
|
||||||
{
|
{
|
||||||
bool Bool;
|
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
if (!(IniFile->GetVariableInSection(Sect, "LocalOnlyPatch.x64", &Bool))) Bool = false;
|
if (!(IniFile->GetVariableInSection(Sect, "LocalOnlyPatch.x64", &Bool))) Bool = false;
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in New Issue