#define EXENAME "winlogon.exe"
#define DLLNAME "C:\\NoShutDLL.dll"
//作者Flyue qq: 406088125 转载时请注明
#include <windows.h>
#include <stdio.h>
#include <TLHELP32.H>
DWORD ProcessNameToPId(LPCTSTR lpszProcess);
BOOL UpPrivilege(HANDLE hprocess, LPCTSTR lpname);
BOOL UpPrivilege(HANDLE hprocess, LPCTSTR lpname) //提升进程权限 debug
{
HANDLE hToken;
TOKEN_PRIVILEGES Privileges;
LUID luid;
OpenProcessToken(hprocess, TOKEN_ADJUST_PRIVILEGES, &hToken);
Privileges.PrivilegeCount = 1;
LookupPrivilegeValue(NULL, lpname, &luid);
Privileges.Privileges[0].Luid = luid;
Privileges.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
if(AdjustTokenPrivileges(hToken, FALSE, &Privileges, NULL, NULL, NULL)!=0)
return TRUE;
return FALSE;
}
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
CopyFile("NoShut.dll", DLLNAME, FALSE);
char privilege[] = SE_DEBUG_NAME;
HANDLE hprocess;
hprocess = GetCurrentProcess();
if(!UpPrivilege(hprocess, privilege)) //开始提权
{
MessageBox(0, "UpPrivilege Error!", 0, MB_OK | MB_ICONERROR);
return 1;
}
char File_Name[MAX_PATH] = {0};
sprintf(File_Name, "%s", EXENAME);
DWORD ProcessPid = ProcessNameToPId(File_Name); //从进程名字获取 进程PID
if(ProcessPid == 0)
{
MessageBox(0, "Not Find This File", 0, MB_OK | MB_ICONERROR);
return 1;
}
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, ProcessPid);
DWORD dwSize;
char DllName[MAX_PATH];
sprintf(DllName, "%s", DLLNAME);
dwSize = strlen(DllName);
LPVOID lpBuf = VirtualAllocEx(hProcess, NULL, dwSize, MEM_COMMIT, PAGE_READWRITE);
if(lpBuf == NULL)
{
MessageBox(0, "VirtualAllocEx Error", 0, MB_OK | MB_ICONERROR);
CloseHandle(hProcess);
return 1;
}
if(!WriteProcessMemory(hProcess, lpBuf, DllName, dwSize, NULL))
{
MessageBox(0, "WriteProcessMemory Error", 0, MB_OK | MB_ICONERROR);
CloseHandle(hProcess);
return 1;
}
LPVOID pFunc = LoadLibraryA;
HANDLE hThread = CreateRemoteThread(hProcess,
NULL,
0,
(LPTHREAD_START_ROUTINE)pFunc,
lpBuf,
0,
NULL);
MessageBox(0, "Success!", "OK", MB_OK | MB_ICONINFORMATION);
return 0;
}
DWORD ProcessNameToPId(LPCTSTR lpszProcess)
{
HANDLE tlhelp = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
PROCESSENTRY32 pe32;
pe32.dwSize = sizeof(PROCESSENTRY32);
if(!Process32First(tlhelp, &pe32))
return 0;
while(Process32Next(tlhelp, &pe32))
{
if(!strcmp(pe32.szExeFile, lpszProcess))
{
return pe32.th32ProcessID;
break;
}
}
return 0;
}
w100
- 粉丝: 2
- 资源: 4
最新资源
- DLT 1265-2013 电力行业焊工培训机构基本能力要求.pdf
- DLT 5070-1997 水轮机金属蜗壳安装焊接工艺导则.pdf
- DLT 1317-2014 火力发电厂焊接接头超声衍射时差检测技术规程.pdf
- DR马口铁在焊接制罐中出现的问题及处理.pdf
- DY30焊剂在船舶制造高效焊接技术中的应用 - .pdf
- EPR核电机组蒸发器异种钢焊接工艺研究 - .pdf
- EH36钢的焊接工艺.pdf
- EPR蒸汽发生器上部水平支承焊接.pdf
- EPR核电站安全壳内部换料水池天花板的焊接 - .pdf
- FW-420T/H型循环流化床锅炉焊接技术.pdf
- FZ 92065-2006 不锈钢焊接式烘筒.pdf
- 布匹检测装置(坏点检测)sw17全套技术开发资料100%好用.zip
- 玻璃检测机sw17可编辑全套技术开发资料100%好用.zip
- 基于 SVM 和 TF-IDF 算法的中文文本分类和情感分析系统详细文档+全部资料+优秀项目.zip
- 基于Chinese-CLIP的图文检索系统视、觉课程设计详细文档+全部资料+优秀项目.zip
- 基于Fasttext的自然语言识别子系统详细文档+全部资料+优秀项目.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
- 1
- 2
- 3
- 4
前往页