Skip to content

Commit

Permalink
智绘教20240619a
Browse files Browse the repository at this point in the history
智绘教20240619a
+ 在系统保护的目录下运行程序会提示用户
= 更新后软件文件名称将添加版本号
- 修复了 ppt 控件点击和长按异常的问题
- 去除了没有太大用处的 智绘教CrashedHandlerClose 子程序
  • Loading branch information
Alan-CRL authored Jun 19, 2024
2 parents 8400e26 + 815676f commit 1d63b4b
Show file tree
Hide file tree
Showing 444 changed files with 511 additions and 84,450 deletions.
10 changes: 0 additions & 10 deletions 智绘教.sln
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PptCOM", "PptCOM\PptCOM.csp
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "智绘教CrashedHandler", "智绘教CrashedHandler\智绘教CrashedHandler.vcxproj", "{9A062020-3F2D-4753-99F0-64AC4DC1600A}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "智绘教CrashedHandlerClose", "智绘教CrashedHandlerClose\智绘教CrashedHandlerClose.vcxproj", "{AED1D291-8241-486B-9D16-E53862F74103}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "智绘教StartupItemSettings", "智绘教StartupItemSettings\智绘教StartupItemSettings.vcxproj", "{38189408-F6E5-478E-B94D-A9F998DA6BDA}"
EndProject
Global
Expand Down Expand Up @@ -48,14 +46,6 @@ Global
{9A062020-3F2D-4753-99F0-64AC4DC1600A}.Release|Win32.Build.0 = Release|Win32
{9A062020-3F2D-4753-99F0-64AC4DC1600A}.Release|x64.ActiveCfg = Release|x64
{9A062020-3F2D-4753-99F0-64AC4DC1600A}.Release|x64.Build.0 = Release|x64
{AED1D291-8241-486B-9D16-E53862F74103}.Debug|Win32.ActiveCfg = Debug|Win32
{AED1D291-8241-486B-9D16-E53862F74103}.Debug|Win32.Build.0 = Debug|Win32
{AED1D291-8241-486B-9D16-E53862F74103}.Debug|x64.ActiveCfg = Debug|x64
{AED1D291-8241-486B-9D16-E53862F74103}.Debug|x64.Build.0 = Debug|x64
{AED1D291-8241-486B-9D16-E53862F74103}.Release|Win32.ActiveCfg = Release|Win32
{AED1D291-8241-486B-9D16-E53862F74103}.Release|Win32.Build.0 = Release|Win32
{AED1D291-8241-486B-9D16-E53862F74103}.Release|x64.ActiveCfg = Release|x64
{AED1D291-8241-486B-9D16-E53862F74103}.Release|x64.Build.0 = Release|x64
{38189408-F6E5-478E-B94D-A9F998DA6BDA}.Debug|Win32.ActiveCfg = Debug|Win32
{38189408-F6E5-478E-B94D-A9F998DA6BDA}.Debug|Win32.Build.0 = Debug|Win32
{38189408-F6E5-478E-B94D-A9F998DA6BDA}.Debug|x64.ActiveCfg = Debug|x64
Expand Down
11 changes: 5 additions & 6 deletions 智绘教/IdtDrawpad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,9 @@ LRESULT CALLBACK DrawpadHookCallback(int nCode, WPARAM wParam, LPARAM lParam)
ExMessage msgKey = {};
msgKey.message = wParam;
msgKey.vkcode = (BYTE)pKeyInfo->vkCode;
msgKey.scancode = (BYTE)pKeyInfo->scanCode;
msgKey.extended = bool(pKeyInfo->flags & LLKHF_EXTENDED);
msgKey.prevdown = bool((HIWORD(pKeyInfo->flags) & KF_REPEAT) == KF_REPEAT);

msgKey.ctrl = (KeyBoradDown[VK_CONTROL] || KeyBoradDown[VK_LCONTROL] || KeyBoradDown[VK_RCONTROL]);
// 借用结构:是否按下 ctrl
msgKey.prevdown = (KeyBoradDown[VK_CONTROL] || KeyBoradDown[VK_LCONTROL] || KeyBoradDown[VK_RCONTROL]);

int index = hiex::GetWindowIndex(drawpad_window, false);
unique_lock lg_vecWindows_vecMessage_sm(hiex::g_vecWindows_vecMessage_sm[index]);
Expand Down Expand Up @@ -299,6 +297,7 @@ void KeyboardInteraction()
if (m.message == WM_KEYDOWN && (m.vkcode == VK_DOWN || m.vkcode == VK_RIGHT || m.vkcode == VK_NEXT || m.vkcode == VK_SPACE || m.vkcode == VK_UP || m.vkcode == VK_LEFT || m.vkcode == VK_PRIOR))
{
auto vkcode = m.vkcode;
cout << "pk " << (int)vkcode << endl;

if (vkcode == VK_UP || vkcode == VK_LEFT || vkcode == VK_PRIOR)
{
Expand Down Expand Up @@ -395,7 +394,7 @@ void KeyboardInteraction()
}

// 定格 Q
if (m.vkcode == (BYTE)0x51 && m.ctrl && m.message == WM_KEYDOWN)
if (m.vkcode == (BYTE)0x51 && m.prevdown && m.message == WM_KEYDOWN)
{
while (1)
{
Expand All @@ -421,7 +420,7 @@ void KeyboardInteraction()
}
}
// 穿透 E
if (m.vkcode == (BYTE)0x45 && m.ctrl && m.message == WM_KEYDOWN)
if (m.vkcode == (BYTE)0x45 && m.prevdown && m.message == WM_KEYDOWN)
{
while (1)
{
Expand Down
10 changes: 4 additions & 6 deletions 智绘教/IdtHash.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#include "IdtHash.h"

string CrashedHandlerMd5 = "db7673b0a8a850e03779d56f9451ad8b";
string CrashedHandlerSHA256 = "9b89c241fc0b6daec50916a9395a0667d1bbc7a39febab0c0999ad967fed6f12";
string CrashedHandlerCloseMd5 = "f8d52985bacae3d88ccde751066bc705";
string CrashedHandlerCloseSHA256 = "99dff6b7262e0a4d308a6ceacdc1024d84dfcac38c15d58f75de06b90e8c5019";
string StartupItemSettingsMd5 = "8560de414e8e031793768e79ca98cfcf";
string StartupItemSettingsSHA256 = "25e48f2f9b3dca02c93c849a6bd92980f919318f289da86a763a7d564f5f764c";
string CrashedHandlerMd5 = "2ad99c977bbde844de033a00932232da";
string CrashedHandlerSHA256 = "151ca4534f768a2fea78a46d8472a211d5bfc9990e397006f3edff5b15ef66b8";
string StartupItemSettingsMd5 = "36f04440e42f20522c8c52438246107f";
string StartupItemSettingsSHA256 = "24e668308837d4f4eda9ca29673b99fb927b1aaa188eb67dbb63cda0cc4684ee";
2 changes: 0 additions & 2 deletions 智绘教/IdtHash.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,5 @@ using namespace std;

extern string CrashedHandlerMd5;
extern string CrashedHandlerSHA256;
extern string CrashedHandlerCloseMd5;
extern string CrashedHandlerCloseSHA256;
extern string StartupItemSettingsMd5;
extern string StartupItemSettingsSHA256;
52 changes: 44 additions & 8 deletions 智绘教/IdtMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ int SettingMain();
void FreezeFrameWindow();

wstring buildTime = __DATE__ L" " __TIME__; //构建时间
string editionDate = "20240604c"; //程序发布日期
string editionDate = "20240619a"; //程序发布日期
string editionChannel = "LTS"; //程序发布通道
string editionCode = "24H2"; //程序版本 (BetaH3)
string editionCode = "24H2(fix)"; //程序版本 (BetaH3)

wstring userId; //用户ID(主板序列号)
string globalPath; //程序当前路径
Expand All @@ -61,11 +61,44 @@ int WINAPI wWinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, LPWSTR
{
globalPath = WstringToString(GetCurrentExeDirectory() + L"\\");

if (!HasReadWriteAccess(StringToWstring(globalPath)))
{
if (IsUserAnAdmin()) MessageBox(NULL, L"当前目录权限受限无法正常运行,请将程序转移至其他目录后再运行", L"智绘教提示", MB_SYSTEMMODAL | MB_OK);
else ShellExecute(NULL, L"runas", GetCurrentExePath().c_str(), NULL, NULL, SW_SHOWNORMAL);
return 0;
int typeRoot = 0;

if (globalPath.find("C:\\Program Files\\") != globalPath.npos || globalPath.find("C:\\Program Files (x86)\\") != globalPath.npos || globalPath.find("C:\\Windows\\") != globalPath.npos) typeRoot = 2;
else
{
wstring time = getTimestamp();
wstring path = StringToWstring(globalPath) + L"IdtRootCheck" + time;

error_code ec;
try {
// 创建空白文件
wofstream ofs(path);
if (!ofs) typeRoot = 1;
ofs.close();
if (_waccess(path.c_str(), 0) == -1) typeRoot = 1;

// 删除文件
filesystem::remove(path, ec);
if (ec) typeRoot = 1;
if (_waccess(path.c_str(), 0) == 0) typeRoot = 1;
}
catch (const filesystem::filesystem_error)
{
typeRoot = 1;
}
}

if (typeRoot == 1)
{
MessageBox(NULL, L"当前目录权限受限无法正常运行,请将程序转移至其他目录后再运行", L"智绘教提示", MB_SYSTEMMODAL | MB_OK);
return 0;
}
else if (typeRoot == 2)
{
MessageBox(NULL, L"当前目录权限受限(文件操作被重定向到虚拟存储目录)无法正常运行,请将程序转移至其他目录后再运行", L"智绘教提示", MB_SYSTEMMODAL | MB_OK);
return 0;
}
}
}
#ifdef IDT_RELEASE
Expand Down Expand Up @@ -252,9 +285,11 @@ int WINAPI wWinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, LPWSTR
error_code ec;
if (!old_name.empty()) filesystem::remove(StringToWstring(main_path) + L"\\" + old_name, ec);
else filesystem::remove(StringToWstring(main_path) + L"\\智绘教.exe", ec);
filesystem::copy_file(StringToWstring(globalPath) + representation, StringToWstring(main_path) + L"\\智绘教.exe", std::filesystem::copy_options::overwrite_existing, ec);

ShellExecute(NULL, NULL, (StringToWstring(main_path) + L"\\智绘教.exe").c_str(), NULL, NULL, SW_SHOWNORMAL);
wstring target = StringToWstring(main_path) + L"\\智绘教" + StringToWstring(editionDate) + L".exe";
filesystem::copy_file(StringToWstring(globalPath) + representation, target, filesystem::copy_options::overwrite_existing, ec);

ShellExecute(NULL, NULL, target.c_str(), NULL, NULL, SW_SHOWNORMAL);

return 0;
}
Expand All @@ -265,6 +300,7 @@ int WINAPI wWinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, LPWSTR

filesystem::path directory(globalPath);
string main_path = directory.parent_path().parent_path().string();

if (!old_name.empty()) ShellExecute(NULL, NULL, (StringToWstring(main_path) + L"\\" + old_name).c_str(), NULL, NULL, SW_SHOWNORMAL);
else ShellExecute(NULL, NULL, (StringToWstring(main_path) + L"\\智绘教.exe").c_str(), NULL, NULL, SW_SHOWNORMAL);

Expand Down
12 changes: 0 additions & 12 deletions 智绘教/IdtOther.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,16 +306,4 @@ int ProcessRunningCnt(const std::wstring& processPath)

CloseHandle(snapshot);
return ret;
}

// 路径权限检测
bool HasReadWriteAccess(const std::wstring& directoryPath)
{
DWORD attributes = GetFileAttributesW(directoryPath.c_str());
if (attributes == INVALID_FILE_ATTRIBUTES) return false;
if (!(attributes & FILE_ATTRIBUTE_DIRECTORY)) return false;
if (attributes & FILE_ATTRIBUTE_READONLY) return false;
if (attributes & FILE_ATTRIBUTE_READONLY) return false;

return true;
}
5 changes: 1 addition & 4 deletions 智绘教/IdtOther.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,4 @@ void SetShortcut();
// 程序进程状态获取
bool isProcessRunning(const std::wstring& processPath);
// 进程程序路径查询
int ProcessRunningCnt(const std::wstring& processPath);

// 路径权限检测
bool HasReadWriteAccess(const std::wstring& directoryPath);
int ProcessRunningCnt(const std::wstring& processPath);
Loading

0 comments on commit 1d63b4b

Please sign in to comment.