-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
67 lines (43 loc) · 1.88 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#define _CRT_SECURE_NO_WARNINGS // for use of C functions, if you want use the safe versions of the functions.
#include <iostream>
#include <thread>
#include <Windows.h>
#include <intrin.h>
#include "threadlib/threadlib.hpp"
#include "simplified_fn/simplified_fn.hpp"
#include "logs/logs.hpp"
#include "menu.hpp"
// securing the program is the next step, I will add the heartbeat fn somewhere..
// debuggers check also should be present with maybe some sort of obfuscation
using namespace std;
int main()
{
thread_info thread_information = thread_lib::initialize_info();
thread* threads = new thread[thread_information.amount];
thread_lib::print_info(thread_information);
// example fn pointer for sleep_sec
void (*sleep_s)(int) = &smpl::sleep_sec;
// a way to resize the console, nothing fancy and might wrap it in a function
HWND console = GetConsoleWindow();
RECT console_rect;
GetWindowRect(console, &console_rect);
MoveWindow(console, console_rect.left, console_rect.top, 545, 600, TRUE);
#ifdef _DEBUG
thread_lib::run_workload(thread_information, threads, true);
(*sleep_s)(5); // added for testing since there is almost 0 load and operations execute quickly
MessageBox(0, "Finished.", "Multithreading operation finished", MB_OK);
return 0;
#endif
char log_test[32];
strcpy(log_test, "Testing popup log.");
char log_f_test[32] = "Testing file log.";
thread_lib::run_workload(thread_information, threads, false);
(*sleep_s)(5); // added for testing since there is almost 0 load and operations execute quickly
MessageBox(0, "Finished.", "Multithreading operation finished", MB_OK);
logs::popup(log_test, DEFAULT_LOG); // strings are more useful in C++, this is a C example.
logs::lsavef(log_f_test, DEFAULT_LOG); // logs by date
while (true) {
menu::run_menu();
}
return 0;
}