1 Star 0 Fork 4

AlongsCode/eapi

forked from 精易科技/eapi 
加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
eapi_55_OpenSysWindow.cpp 4.07 KB
一键复制 编辑 原始数据 按行查看 历史
AlongsCode 提交于 2023-02-09 00:42 +08:00 . 部分重构
#include "..\include_eapi_header.h"
#include<shlwapi.h>
#pragma comment(lib,"shlwapi.lib")
inline void OpenSysInfoDlg()
{
HKEY hKey;
char pBuff[MAX_PATH] = { 0 };
DWORD pBuffSize = MAX_PATH;
if (!RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Shared Tools\\MSInfo", 0, KEY_EXECUTE, &hKey)) {
DWORD type = REG_NONE;
LSTATUS hLsta = RegQueryValueExA(hKey, "Path", 0, &type, (BYTE*)pBuff, &pBuffSize);
if (hKey)
{
RegCloseKey(hKey);
}
PathFileExistsA(pBuff);
ShellExecuteA(0, "open", pBuff, 0, 0, 1);
}
else if (!RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Shared Tools Location", 0, KEY_EXECUTE, &hKey))
{
DWORD type = REG_NONE;
RegQueryValueExA(hKey, "MSInfo", 0, &type, (BYTE*)pBuff, &pBuffSize);//可能会找不到文件
PathAppendA(pBuff, "MSInfo32.exe");
if (hKey)
{
RegCloseKey(hKey);
}
PathFileExistsA(pBuff);
ShellExecuteA(0, "open", pBuff, 0, 0, 1);
}
}
static void OpenSysWindow(int Type, int PageIndex) {
std::string TempCom;
char ComLine[100]{ 0 };
switch (Type)
{
case 0:
TempCom = "rundll32.exe shell32.dll,Control_RunDLL";
break;
case 1:
TempCom = "rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,," + std::to_string(PageIndex);
break;
case 2:
TempCom = "rundll32.exe shell32.dll,Control_RunDLL desk.cpl,," + std::to_string(PageIndex);
break;
case 3:
TempCom = "rundll32.exe shell32.dll,Control_RunDLL access.cpl,," + std::to_string(PageIndex);
break;
case 4:
TempCom = "rundll32.exe shell32.dll,SHHelpShortcuts_RunDLL AddPrinter";
break;
case 5:
TempCom = "rundll32.exe shell32.dll,Control_RunDLL appwiz.cpl,," + std::to_string(PageIndex);;
break;
case 6:
TempCom = "rundll32.exe shell32.dll,Control_RunDLL timedate.cpl,," + std::to_string(PageIndex);;
break;
case 7:
TempCom = "rundll32.exe shell32.dll,SHHelpShortcuts_RunDLL FontsFolder";
break;
case 8:
TempCom = "rundll32.exe shell32.dll,Control_RunDLL joy.cpl,," + std::to_string(PageIndex);;
break;
case 9:
TempCom = "rundll32.exe shell32.dll,Control_RunDLL main.cpl @0," + std::to_string(PageIndex);;
break;
case 10:
TempCom = "rundll32.exe shell32.dll,Control_RunDLL main.cpl @1," + std::to_string(PageIndex);;
break;
case 11:
TempCom = "rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl,," + std::to_string(PageIndex);;
break;
case 12:
TempCom = "rundll32.exe shell32.dll,Control_RunDLL odbccp32.cpl";
break;
case 13:
TempCom = "rundll32.exe shell32.dll,Control_RunDLL powercfg.cpl";
break;
case 14:
TempCom = "rundll32.exe shell32.dll,Control_RunDLL intl.cpl,," + std::to_string(PageIndex);;
break;
case 15:
TempCom = "rundll32.exe shell32.dll,Control_RunDLL Inetcpl.cpl,," + std::to_string(PageIndex);;
break;
case 16:
TempCom = "Rundll32 netplwiz.dll,UsersRunDll";
break;
case 17:
OpenSysInfoDlg();
break;
default:
break;
}
STARTUPINFOA si = { 0 };
PROCESS_INFORMATION pi;
si.cb = sizeof(si);
CreateProcessA(NULL, const_cast<char*>(TempCom.c_str()), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
}
// 调用格式: _SDT_NULL 打开特殊系统窗口, 命令说明: "打开特殊的系统窗口,如控制面板。"
// 参数<1>: 窗口类型 SDT_INT, 参数说明: "系统窗口类型,为以下常量值之一:0、#接口常量.控制面板;1、#接口常量.系统属性;2、#接口常量.显示属性;3、#接口常量.辅助功能选项;4、#接口常量.添加打印机向导;5、#接口常量.添加或删除程序;6、#接口常量.日期和时间属性;7、#接口常量.字体文件夹;8、#接口常量.游戏控制器;9、#接口常量.鼠标属性;10、#接口常量.键盘属性;11、#接口常量.声音和音频属性;12、#接口常量.ODBC数据源管理器;13、#接口常量.电源选项属性;14、#接口常量.区域和语言选项;15、#接口常量.互联网属性;16、#接口常量.用户帐号;17、#接口常量.系统信息对话框。"
// 参数<2>: [属性页序号 SDT_TEXT], 参数说明: "有多个属性页时,表示要打开属性页的序号(从0开始)。"
EAPI_EXTERN_C void eapi_OpenSysWindow_55_eapi(PMDATA_INF pRetData, INT nArgCount, PMDATA_INF pArgInf)
{
INT Index = 0, Type = 0;
if (pArgInf[0].m_int > 0 && pArgInf[0].m_int <= 17)
{
Type = pArgInf[0].m_int;
}
if (pArgInf[1].m_dtDataType && pArgInf[1].m_int > 0)
{
Index = pArgInf[1].m_int;
}
OpenSysWindow(Type, Index);
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/alongscode/eapi.git
git@gitee.com:alongscode/eapi.git
alongscode
eapi
eapi
master

搜索帮助