-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
115 lines (85 loc) · 2.62 KB
/
main.cpp
File metadata and controls
115 lines (85 loc) · 2.62 KB
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#include <iostream>
#include <Windows.h>
#include <ctime>
#include <ShlObj.h>
#include <lmcons.h>
const char* path = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Icons";
const char* valueName = "29";
const char* data = "%windir%\\System32\\shell32.dll,-51";
std::string GetUser() {
char username[UNLEN + 1];
DWORD username_len = UNLEN + 1;
if (GetUserNameA(username, &username_len)) {
return username;
}
return "user"
}
void explorer() {
std::cout << "CLOSING EXPLORER..."<< std::endl;
system("taskkill /f /im explorer.exe");
std::cout << "RESATRTING EXPLORER..."<< std::endl;
system("start explorer.exe");
std::cout << "explorer.exe is running now...\n";
}
void RSI() {
HKEY hkey;
LONG result = RegCreateKeyExA(HKEY_LOCAL_MACHINE, path, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE | KEY_WOW64_64KEY, NULL, &hkey, NULL);
if (result == ERROR_SUCCESS) {
result = RegSetValueExA(hkey, valueName, 0, REG_SZ, (const BYTE*)data, strlen(data) + 1);
if (result == ERROR_SUCCESS) {
std::cout << "[+] Shortcut icon successfuly removed" << std::endl;
explorer();
system("pause");
}
else
{
std::cout << "[!] ERROR : coulden't remove the shortcut icon" << std::endl;
}
RegCloseKey(hkey);
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL);
}
else {
if (result == ERROR_ACCESS_DENIED) {
std::cout << "[!] ERROR: Access Denied. Please run as Administrator!" << std::endl;
}
else
{
std::cout << "[!] ERROR: Could not open key. Error code: " << result << std::endl;
}
}
}
void Restore() {
HKEY hkey;
LONG result = RegOpenKeyExA(HKEY_LOCAL_MACHINE, path, 0, KEY_SET_VALUE | KEY_WOW64_64KEY, &hkey);
if (result == ERROR_SUCCESS) {
result = RegDeleteValueA(hkey, valueName);
if (result == ERROR_SUCCESS) {
std::cout << "[+] Shortcut icon successfully restored!" << std::endl;
explorer();
system("pause");
}
else {
std::cout << "[!] ERROR: Value not found or already restored." << std::endl;
}
RegCloseKey(hkey);
}
else {
std::cout << "[!] ERROR: Access Denied or Key not found." << std::endl;
}
}
int main() {
std::string user = GetUser();
std::cout << "\n\n\n\n\n\t\t\tShurtcut icon remover\n\n\n\n\n";
Sleep(3000);
int command;
std::cout << "\tOPTIONS:\n";
std::cout << "1. Remove Shortcut icon\n2. Restore shortcut con\n3. EXIT\n";
std::cout << user << "/>";
std::cin >> command;
switch (command) {
case 1: RSI(); break;
case 2: Restore(); break;
case 3: return 0;
default:std::cout << "Invalid Option ";
}
}