Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/stascorp/rdpwrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbinarymaster <x86corez@gmail.com>2014-12-10 19:11:36 +0300
committerbinarymaster <x86corez@gmail.com>2014-12-10 19:11:36 +0300
commit939a884f2038d488865f13100a8c6b76c377e607 (patch)
treee83fc592da6fd55f40c927666e3d5881c56a54ae /src-x86-x64-Fusix
parent239cd5fe3fe4886546ce61f868542b0ad48e5a2c (diff)
That epic commit
Seems to work well :+1:
Diffstat (limited to 'src-x86-x64-Fusix')
-rw-r--r--src-x86-x64-Fusix/IniFile.cpp6
-rw-r--r--src-x86-x64-Fusix/RDPWrap.cpp37
2 files changed, 23 insertions, 20 deletions
diff --git a/src-x86-x64-Fusix/IniFile.cpp b/src-x86-x64-Fusix/IniFile.cpp
index 2c5f1ef..8364cca 100644
--- a/src-x86-x64-Fusix/IniFile.cpp
+++ b/src-x86-x64-Fusix/IniFile.cpp
@@ -24,7 +24,7 @@ INI_FILE::INI_FILE(wchar_t *FilePath)
DWORD Status = 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);
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
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++)
{
@@ -545,4 +545,4 @@ bool INI_FILE::GetSectionVariablesList(wchar_t *SectionName, INI_SECTION_VARLIST
wcstombs(cSectionName, SectionName, MAX_STRING_LEN);
return GetSectionVariablesList(cSectionName, VariablesList);
-}
+} \ No newline at end of file
diff --git a/src-x86-x64-Fusix/RDPWrap.cpp b/src-x86-x64-Fusix/RDPWrap.cpp
index 7b0b8cd..bf99675 100644
--- a/src-x86-x64-Fusix/RDPWrap.cpp
+++ b/src-x86-x64-Fusix/RDPWrap.cpp
@@ -16,6 +16,7 @@
#include "stdafx.h"
#include "IniFile.h"
+#include <stdlib.h>
typedef struct
{
@@ -499,16 +500,16 @@ void Hook()
AlreadyHooked = true;
char *Log;
- wchar_t ConfigFile[256] = {0x00};
+ wchar_t ConfigFile[256] = { 0x00 };
WriteToLog("Loading configuration...\r\n");
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);
- memcpy(&ConfigFile[i+1], L"rdpwrap.ini", strlen("rdpwrap.ini")*2);
+ memset(&ConfigFile[i + 1], 0x00, ((256 - (i + 1))) * 2);
+ memcpy(&ConfigFile[i + 1], L"rdpwrap.ini", strlen("rdpwrap.ini") * 2);
break;
}
}
@@ -520,6 +521,7 @@ void Hook()
IniFile = new INI_FILE(ConfigFile);
+ // TODO: implement this
if (IniFile == NULL)
{
WriteToLog("Error: Failed to load configuration\r\n");
@@ -541,12 +543,14 @@ void Hook()
}
}
}
- else memcpy((void*)LogFile, LogFileVar.Value, strlen(LogFileVar.Value));
-
- Log = new char[1024];
- wsprintfA(Log, "Log file: %S\r\n", LogFile);
- WriteToLog(Log);
- delete[] Log;
+ else
+ {
+ // TODO: Change it before add UNICODE in IniFile
+ wchar_t wcLogFile[256];
+ memset(wcLogFile, 0x00, 256);
+ mbstowcs(wcLogFile, LogFileVar.Value, 255);
+ wcscpy(LogFile, wcLogFile);
+ }
SIZE_T bw;
WORD Ver = 0;
@@ -603,10 +607,10 @@ void Hook()
WriteToLog("freeze\r\n");
SetThreadsState(false);
- bool bSLHook;
- if (!(IniFile->GetVariableInSection("Main", "SLPolicyHookNT60", &bSLHook))) bSLHook = true;
+ bool Bool;
+ if (!(IniFile->GetVariableInSection("Main", "SLPolicyHookNT60", &Bool))) Bool = true;
- if ((Ver == 0x0600) && bSLHook)
+ if ((Ver == 0x0600) && Bool)
{
// Windows Vista
// 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
// uses SL Policy API (slc.dll)
@@ -699,7 +703,6 @@ void Hook()
{
if (GetModuleCodeSectionInfo(hTermSrv, &TermSrvBase, &TermSrvSize))
{
- bool Bool;
#ifdef _WIN64
if (!(IniFile->GetVariableInSection(Sect, "LocalOnlyPatch.x64", &Bool))) Bool = false;
#else