start cleaning up headers

This commit is contained in:
Akash Mozumdar 2018-08-22 12:24:55 -04:00
parent af1512b7bf
commit 2a222c4446
16 changed files with 44 additions and 42 deletions

View File

@ -22,6 +22,8 @@ add_definitions(
/DITH_HAS_CRT
)
include_directories(include)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Build)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Build)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Build)

View File

@ -1,6 +1,5 @@
#include "extensions.h"
#include <shared_mutex>
#include <map>
#include <QDir>
std::shared_mutex extenMutex;

View File

@ -1,12 +1,8 @@
#ifndef EXTENSIONS_H
#define EXTENSIONS_H
#include <Windows.h>
#include <string>
#include "qtcommon.h"
#include <map>
#include <unordered_map>
#include <vector>
#include <QComboBox>
std::map<int, QString> LoadExtensions();
std::wstring DispatchSentenceToExtensions(std::wstring sentence, std::unordered_map<std::string, int> miscInfo);

View File

@ -1,12 +1,20 @@
#include "mainwindow.h"
#include "../host/host.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
_CrtMemState memStates[100] = {};
_CrtMemCheckpoint(memStates);
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
a.exec();
}
_CrtMemCheckpoint(memStates + 1);
if (_CrtMemDifference(memStates + 2, memStates + 0, memStates + 1))
_CrtMemDumpStatistics(memStates + 2);
return 0;
}

View File

@ -1,13 +1,10 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include "qtcommon.h"
#include <QMainWindow>
#include <Windows.h>
#include <QVector>
#include <QPlainTextEdit>
#include <QComboBox>
#include <unordered_map>
#include <string>
#include "../host/host.h"
namespace Ui

View File

@ -1,9 +1,7 @@
#ifndef MISC_H
#define MISC_H
#include <QString>
#include <unordered_map>
#include <Windows.h>
#include "qtcommon.h"
#include "../host/host.h"
QString GetFullModuleName(DWORD processId, HMODULE module = NULL);

6
GUI/qtcommon.h Normal file
View File

@ -0,0 +1,6 @@
#pragma once
#include "common.h"
#include <QString>
#include <QStringList>
#include <QVector>

View File

@ -1,3 +1,5 @@
#pragma once
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <string>

View File

@ -5,13 +5,9 @@
#include "host.h"
#include "pipe.h"
#include "winmutex.h"
#include <mutex>
#include <thread>
#include <atlbase.h>
#include "../vnrhook/include/const.h"
#include "../vnrhook/include/defs.h"
#include "../vnrhook/include/types.h"
#include <unordered_map>
std::unordered_map<ThreadParameter, TextThread*, ThreadParameterHasher> textThreadsByParams;
std::unordered_map<DWORD, ProcessRecord> processRecordsByIds;

View File

@ -4,14 +4,12 @@
// 8/23/2013 jichi
// Branch: ITH/IHF.h, rev 105
#define DLLEXPORT __declspec(dllexport)
#include <Windows.h>
#include "common.h"
#include "textthread.h"
#include <string>
#include <functional>
#include "../vnrhook/include/types.h"
#define DLLEXPORT __declspec(dllexport)
struct ProcessRecord
{
HANDLE process_handle;

View File

@ -6,7 +6,6 @@
#include "host.h"
#include "../vnrhook/include/defs.h"
#include "../vnrhook/include/const.h"
#include <atlbase.h>
void CreateNewPipe()
{

View File

@ -3,7 +3,7 @@
// pipe.h
// 7/19/2018 Artikash
#include <Windows.h>
#include "common.h"
void CreateNewPipe();

View File

@ -6,9 +6,7 @@
#endif // _MSC_VER
#include "textthread.h"
#include <mutex>
#include "../vnrhook/include/const.h"
#include "winmutex.h"
#define TT_LOCK std::lock_guard<std::recursive_mutex> ttLocker(ttMutex) // Synchronized scope for accessing private data

View File

@ -4,12 +4,7 @@
// 8/23/2013 jichi
// Branch: ITH/TextThread.h, rev 120
#include <Windows.h>
#include <string>
#include <vector>
#include <functional>
#include <mutex>
#include <thread>
#include "common.h"
struct ThreadParameter
{

View File

@ -3,10 +3,7 @@
// 12/11/2011 jichi
#include <windows.h>
#ifdef _MSC_VER
# pragma warning(disable:4800) // C4800: forcing value to bool
#endif // _MSC_VER
#include "common.h"
// Artikash 7/20/2018: similar to std::lock guard but use Winapi objects for cross process comms
@ -14,7 +11,7 @@ class MutexLocker
{
HANDLE mutex;
public:
explicit MutexLocker(HANDLE mutex) : mutex(mutex) { WaitForSingleObject(mutex, 0); }
MutexLocker(HANDLE mutex) : mutex(mutex) { WaitForSingleObject(mutex, 0); }
~MutexLocker() { if (mutex != INVALID_HANDLE_VALUE && mutex != nullptr) ReleaseMutex(mutex); }
};

11
include/common.h Normal file
View File

@ -0,0 +1,11 @@
#pragma once
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <atlbase.h> // A2W
#include <string>
#include <vector>
#include <unordered_map>
#include <functional>
#include <thread>
#include <mutex>