目录
思路:
使用SHELLEXECUTEINFO,然后生成root.exe可执行文件,然后将root.exe放到c:\\windows\\system32(或者环境变量PATH下的其他
代码,root.cpp,使用的vc 6++编译
#include <windows.h>
#include <stdio.h>
extern "C" WINBASEAPI HWND WINAPI GetConsoleWindow ();
VOID ManagerRun(LPCSTR exe);
void main(int argc,char *argv[])
{
ShowWindow(GetConsoleWindow(), SW_HIDE);
ManagerRun("C:\\windows\\system32\\cmd.exe");//cmd.exe所在路径
return ;
}
VOID ManagerRun(LPCSTR exe)
{
SHELLEXECUTEINFO ShExecInfo;
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS ;
ShExecInfo.hwnd = NULL;
ShExecInfo.lpVerb = "runas";
ShExecInfo.lpFile = exe;
ShExecInfo.lpParameters = NULL;
ShExecInfo.lpDirectory = NULL;
ShExecInfo.nShow = SW_SHOW;
ShExecInfo.hInstApp = NULL;
BOOL ret = ShellExecuteEx(&ShExecInfo);
CloseHandle(ShExecInfo.hProcess);
return;
}
效果展示(不好展示)
使用win+R 运行普通cmd
提取地址:https://pan.baidu.com/s/1mZLPhYEOb5YMxlkAT8mYuA
提取码:root
这是32位的,所以可以在32位或者64位上运行