-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainwindow.cpp
97 lines (77 loc) · 2.17 KB
/
mainwindow.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#include "mainwindow.h"
#include "./ui_mainwindow.h"
#include <QMessageBox>
#include <iostream>
#include <fstream>
#include "PEFILE.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
this->setFixedSize(1337, 741);
// Set icon
QIcon icon;
icon.addFile(":/images/imgs/PEHint-ico.ico");
this->setWindowIcon(icon);
// Prepare arguments for Main function
char path[] = "C:\\Users\\DEV\\Desktop\\Codes\\buffer.exe";
char* argv[] = { path }; // Argument array
int a = MainWindow::Main(2, argv); // Call Main function
}
int MainWindow::Main(int argc, char* argv[])
{
if (argc != 2) {
printf("Usage: %s [path to executable]\n", argv[0]);
return 1;
}
FILE * PpeFile;
::fopen_s(&PpeFile, argv[0], "rb");
if (PpeFile == NULL) {
printf("Can't open file.\n");
return 1;
}
if (INITPARSE(PpeFile) == 1) {
exit(1);
}
else if (INITPARSE(PpeFile) == 32) {
PE32FILE PeFile_1(argv[0], PpeFile);
PeFile_1.PrintInfo();
::fclose(PpeFile);
::exit(0);
}
else if (INITPARSE(PpeFile) == 64) {
PE64FILE PeFile_1(argv[0], PpeFile);
PeFile_1.PrintInfo();
::fclose(PpeFile);
::exit(0);
}
return 0;
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_action_PEHint_triggered()
{
QPixmap pehintIcon(":/images/imgs/PEHint-ico.ico");
QString msg = "<b>PEHint - Portable Executable Hint</b>";
msg += "<br/>";
msg += "Author : <a href='https://moval0x1.github.io/'>moval0x1</a><br/>";
msg += "<br/>";
msg += "\nThis software that was created for study purposes.<br/>Feel free to use it and help improve. ;)";
msg += "<br/>";
QMessageBox msgBox(this);
msgBox.setProperty("hasUrl", true);
msgBox.setWindowTitle(tr("About PEHint"));
msgBox.setTextFormat(Qt::RichText);
msgBox.setText(msg);
msgBox.setAutoFillBackground(true);
msgBox.setIconPixmap(pehintIcon);
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.exec();
}
void MainWindow::on_action_Exit_triggered()
{
QApplication::quit();
}