From f9b91a292ecbc609d3a3f7da1a9db66c3f1d2b58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Fri, 3 May 2024 17:50:26 +0800 Subject: [PATCH] removes --- plugins/common.hpp | 38 +++ plugins/pch.h | 4 +- plugins/shareddllproxy/CMakeLists.txt | 2 +- plugins/shareddllproxy/aspatch.cpp | 12 - plugins/shareddllproxy/dreye.cpp | 28 +- plugins/shareddllproxy/jbj7.cpp | 5 +- plugins/shareddllproxy/kingsoft.cpp | 5 +- plugins/shareddllproxy/lossless.cpp | 273 ------------------- plugins/shareddllproxy/magpie.cpp | 3 +- plugins/shareddllproxy/neospeech.cpp | 5 +- plugins/shareddllproxy/ntleas.cpp | 2 +- plugins/shareddllproxy/shareddllproxy.cpp | 3 - plugins/shareddllproxy/voiceroid2/voice2.cpp | 5 +- plugins/winrtutils/winrtocr.cpp | 12 +- plugins/winsharedutils/hwnd.cpp | 17 -- 15 files changed, 52 insertions(+), 362 deletions(-) create mode 100644 plugins/common.hpp delete mode 100644 plugins/shareddllproxy/lossless.cpp diff --git a/plugins/common.hpp b/plugins/common.hpp new file mode 100644 index 00000000..18464c1a --- /dev/null +++ b/plugins/common.hpp @@ -0,0 +1,38 @@ +struct AutoHandle +{ + HANDLE _handle; + AutoHandle(HANDLE handle) : _handle(handle){}; + ~AutoHandle() + { + CloseHandle(_handle); + } + operator HANDLE() + { + return _handle; + } + operator bool() + { + return _handle == INVALID_HANDLE_VALUE; + } +}; +inline SECURITY_ATTRIBUTES allAccess = std::invoke([] // allows non-admin processes to access kernel objects made by admin processes +{ + static SECURITY_DESCRIPTOR sd = {}; + InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION); + SetSecurityDescriptorDacl(&sd, TRUE, NULL, FALSE); + return SECURITY_ATTRIBUTES{ sizeof(SECURITY_ATTRIBUTES), &sd, FALSE }; +}); + +inline std::wstring StringToWideString(const std::string &text, UINT encoding = CP_UTF8) +{ + std::vector buffer(text.size() + 1); + int length = MultiByteToWideChar(encoding, 0, text.c_str(), text.size() + 1, buffer.data(), buffer.size()); + return std::wstring(buffer.data(), length - 1); +} +inline std::string WideStringToString(const std::wstring &text, UINT cp = CP_UTF8) +{ + std::vector buffer((text.size() + 1) * 4); + + WideCharToMultiByte(cp, 0, text.c_str(), -1, buffer.data(), buffer.size(), nullptr, nullptr); + return buffer.data(); +} \ No newline at end of file diff --git a/plugins/pch.h b/plugins/pch.h index aaa50162..7fbd3f8a 100644 --- a/plugins/pch.h +++ b/plugins/pch.h @@ -74,4 +74,6 @@ #pragma comment(lib, "winmm.lib") #pragma comment(lib, "dwmapi.lib") #pragma comment(lib, "Psapi.lib") -#pragma comment(lib, "Version.lib") \ No newline at end of file +#pragma comment(lib, "Version.lib") + +#include"common.hpp" \ No newline at end of file diff --git a/plugins/shareddllproxy/CMakeLists.txt b/plugins/shareddllproxy/CMakeLists.txt index 613aac8d..81f2c8d5 100644 --- a/plugins/shareddllproxy/CMakeLists.txt +++ b/plugins/shareddllproxy/CMakeLists.txt @@ -15,7 +15,7 @@ generate_product_version( add_executable(shareddllproxy shareddllproxy.cpp dllinject.cpp ntleas.cpp aspatch.cpp ${versioninfo}) target_precompile_headers(shareddllproxy REUSE_FROM pch) if(${CMAKE_SIZEOF_VOID_P} EQUAL 8) - add_library(x64lib magpie.cpp lossless.cpp) + add_library(x64lib magpie.cpp) target_precompile_headers(x64lib REUSE_FROM pch) target_link_libraries(shareddllproxy x64lib ${Detours}) set_target_properties(shareddllproxy PROPERTIES OUTPUT_NAME "shareddllproxy64") diff --git a/plugins/shareddllproxy/aspatch.cpp b/plugins/shareddllproxy/aspatch.cpp index c57e4d40..dd8bb4e5 100644 --- a/plugins/shareddllproxy/aspatch.cpp +++ b/plugins/shareddllproxy/aspatch.cpp @@ -1,16 +1,4 @@ -static std::wstring StringToWideString(const std::string &text, UINT encoding = CP_UTF8) -{ - std::vector buffer(text.size() + 1); - int length = MultiByteToWideChar(encoding, 0, text.c_str(), text.size() + 1, buffer.data(), buffer.size()); - return std::wstring(buffer.data(), length - 1); -} -std::string WideStringToString(const std::wstring &text, UINT cp = CP_UTF8) -{ - std::vector buffer((text.size() + 1) * 4); - WideCharToMultiByte(cp, 0, text.c_str(), -1, buffer.data(), buffer.size(), nullptr, nullptr); - return buffer.data(); -} HANDLE runexe(const std::wstring &exe, const std::optional &startup_argument) { STARTUPINFOW si; diff --git a/plugins/shareddllproxy/dreye.cpp b/plugins/shareddllproxy/dreye.cpp index f38ae17e..8b56008d 100644 --- a/plugins/shareddllproxy/dreye.cpp +++ b/plugins/shareddllproxy/dreye.cpp @@ -3,28 +3,7 @@ extern "C" typedef int(__stdcall *MTInitCJ)(int); typedef int(__stdcall *TranTextFlowCJ)(char *src, char *dest, int, int); } -std::string WStrToStr(wchar_t *xx, UINT uCodePage) -{ - std::wstring wstrString = xx; - int lenStr = 0; - std::string result; - lenStr = WideCharToMultiByte(uCodePage, NULL, wstrString.c_str(), wstrString.size(), NULL, NULL, NULL, NULL); - char *buffer = new char[lenStr + 1]; - WideCharToMultiByte(uCodePage, NULL, wstrString.c_str(), wstrString.size(), buffer, lenStr, NULL, NULL); - buffer[lenStr] = '\0'; - - result.append(buffer); - delete[] buffer; - return result; -} -#include -std::wstring StringToWideString(const std::string &text, UINT encoding) -{ - std::vector buffer(text.size() + 1); - int length = MultiByteToWideChar(encoding, 0, text.c_str(), text.size() + 1, buffer.data(), buffer.size()); - return std::wstring(buffer.data(), length - 1); -} int dreyewmain(int argc, wchar_t *argv[]) { @@ -51,10 +30,7 @@ int dreyewmain(int argc, wchar_t *argv[]) _MTInitCJ(_wtoi(argv[3])); HANDLE hPipe = CreateNamedPipe(argv[4], PIPE_ACCESS_DUPLEX, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, PIPE_UNLIMITED_INSTANCES, 65535, 65535, NMPWAIT_WAIT_FOREVER, 0); - SECURITY_DESCRIPTOR sd = {}; - InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION); - SetSecurityDescriptorDacl(&sd, TRUE, NULL, FALSE); - SECURITY_ATTRIBUTES allAccess = SECURITY_ATTRIBUTES{sizeof(SECURITY_ATTRIBUTES), &sd, FALSE}; + SetEvent(CreateEvent(&allAccess, FALSE, FALSE, argv[5])); if (ConnectNamedPipe(hPipe, NULL) != NULL) { @@ -70,7 +46,7 @@ int dreyewmain(int argc, wchar_t *argv[]) _TranTextFlowCJ(src, buffer, 3000, _wtoi(argv[3])); // MessageBoxW(0, StringToWideString(src,932).c_str(),L"", 0); - StringToWideString(src, 932); //?????��ȫ�㲻��������仰ȥ����writefile��д����ȥ�ˡ����� + StringToWideString(src, 932); WriteFile(hPipe, buffer, strlen(buffer), &_, NULL); } } diff --git a/plugins/shareddllproxy/jbj7.cpp b/plugins/shareddllproxy/jbj7.cpp index 4fc1ff53..b9ebdd9f 100644 --- a/plugins/shareddllproxy/jbj7.cpp +++ b/plugins/shareddllproxy/jbj7.cpp @@ -53,10 +53,7 @@ int jbjwmain(int argc, wchar_t *argv[]) wchar_t *fr = new wchar_t[3000]; wchar_t *to = new wchar_t[3000]; wchar_t *buf = new wchar_t[3000]; - SECURITY_DESCRIPTOR sd = {}; - InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION); - SetSecurityDescriptorDacl(&sd, TRUE, NULL, FALSE); - SECURITY_ATTRIBUTES allAccess = SECURITY_ATTRIBUTES{sizeof(SECURITY_ATTRIBUTES), &sd, FALSE}; + SetEvent(CreateEvent(&allAccess, FALSE, FALSE, argv[3])); if (ConnectNamedPipe(hPipe, NULL) != NULL) { diff --git a/plugins/shareddllproxy/kingsoft.cpp b/plugins/shareddllproxy/kingsoft.cpp index 25041373..b5992a74 100644 --- a/plugins/shareddllproxy/kingsoft.cpp +++ b/plugins/shareddllproxy/kingsoft.cpp @@ -35,10 +35,7 @@ int kingsoftwmain(int argc, wchar_t *argv[]) ret = setBasicDictPathW(key, path); HANDLE hPipe = CreateNamedPipe(argv[3], PIPE_ACCESS_DUPLEX, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, PIPE_UNLIMITED_INSTANCES, 65535, 65535, NMPWAIT_WAIT_FOREVER, 0); - SECURITY_DESCRIPTOR sd = {}; - InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION); - SetSecurityDescriptorDacl(&sd, TRUE, NULL, FALSE); - SECURITY_ATTRIBUTES allAccess = SECURITY_ATTRIBUTES{sizeof(SECURITY_ATTRIBUTES), &sd, FALSE}; + SetEvent(CreateEvent(&allAccess, FALSE, FALSE, argv[4])); ConnectNamedPipe(hPipe, NULL); while (true) diff --git a/plugins/shareddllproxy/lossless.cpp b/plugins/shareddllproxy/lossless.cpp deleted file mode 100644 index 4c40b120..00000000 --- a/plugins/shareddllproxy/lossless.cpp +++ /dev/null @@ -1,273 +0,0 @@ - -typedef BSTR (*GetAdapterNames_t)(); -typedef BSTR (*GetDisplayNames_t)(); - -typedef bool (*SetDriverSettings_t)(); -typedef void (*StatusListenerDelegate_t)(int status, HWND hwnd, int inputWidth, int inputHeight, int outputWidth, int outputHeight, bool resized, float scaleFactor, int errorCode); -typedef bool (*Init_t)(StatusListenerDelegate_t callback); -typedef void (*UnInit_t)(); -typedef bool (*Activate_t)(HWND hwnd); -typedef void (*ApplySettings_t1)(int scalingMode, int scalingFitMode, int scalingType, int scalingSubtype, float scaleFactor, bool resizeBeforeScale, bool windowedMode, int sharpness, bool VRS, bool clipCursor, bool cursorSensitivity, bool hideCursor, bool scaleCursor, bool doubleBuffering, bool vrrSupport, bool hdrSupport, bool allowTearing, bool legacyCaptureApi, bool drawFps, int gpuId, int displayId, int captureOffsetLeft, int captureOffsetTop, int captureOffsetRight, int captureOffsetBottom, bool multiDisplayMode); -typedef void (*ApplySettings_t2)(int scalingMode, int scalingFitMode, int scalingType, int scalingSubtype, float scaleFactor, bool resizeBeforeScale, bool windowedMode, int sharpness, bool VRS, int frameGeneration, bool clipCursor, bool cursorSensitivity, bool hideCursor, bool scaleCursor, bool doubleBuffering, bool vrrSupport, bool hdrSupport, bool allowTearing, bool legacyCaptureApi, bool drawFps, int gpuId, int displayId, int captureOffsetLeft, int captureOffsetTop, int captureOffsetRight, int captureOffsetBottom, bool multiDisplayMode); -typedef void (*ApplySettings_t3)(int scalingMode, int scalingFitMode, int scalingType, int scalingSubtype, float scaleFactor, bool resizeBeforeScale, bool windowedMode, int sharpness, bool VRS, int frameGeneration, bool clipCursor, bool cursorSensitivity, bool hideCursor, bool scaleCursor, int syncInterval, bool doubleBuffering, bool vrrSupport, bool hdrSupport, bool allowTearing, bool legacyCaptureApi, bool drawFps, int gpuId, int displayId, int captureOffsetLeft, int captureOffsetTop, int captureOffsetRight, int captureOffsetBottom, bool multiDisplayMode); -enum ErrorCode -{ - NO_CODE, - RESIZE_FAILED, - LARGE_OFFSET, - FULLSCREEN_DETECTED -}; -void StatusListenerDelegate(int status, HWND hwnd, int inputWidth, int inputHeight, int outputWidth, int outputHeight, bool resized, float scaleFactor, int errorCode) -{ - wprintf(L"%d %d %d %d %d %d %d %f %d\n", status, hwnd, inputWidth, inputHeight, outputWidth, outputHeight, resized, scaleFactor, errorCode); -} -auto GetClassNameWs = GetClassNameW; -DWORD lunapid = 0; -int - WINAPI - GetClassNameWH( - _In_ HWND hWnd, - _Out_writes_to_(nMaxCount, return) LPWSTR lpClassName, - _In_ int nMaxCount) -{ - DWORD dwProcessId; - GetWindowThreadProcessId(hWnd, &dwProcessId); - if (lunapid == dwProcessId) - { - wcscpy(lpClassName, L"ApplicationManager_ImmersiveShellWindow"); - return TRUE; - } - else - return GetClassNameWs(hWnd, lpClassName, nMaxCount); -} -// bool sub_18000A880() //不知道为什么,在控制台里面,这个会返回false -// { -// ULONGLONG v0; // rax -// ULONGLONG v1; // rax -// DWORDLONG v2; // rax -// struct _OSVERSIONINFOEXW VersionInformation; // [rsp+20h] [rbp-138h] BYREF - -// VersionInformation.dwOSVersionInfoSize = 284; -// memset(&VersionInformation.dwBuildNumber, 0, 264); -// VersionInformation.wServicePackMinor = 0; -// *(_DWORD *)&VersionInformation.wSuiteMask = 0; -// v0 = VerSetConditionMask(0i64, 2u, 3u); -// v1 = VerSetConditionMask(v0, 1u, 3u); -// v2 = VerSetConditionMask(v1, 0x20u, 3u); -// *(_QWORD *)&VersionInformation.dwMajorVersion = 10i64; -// VersionInformation.wServicePackMajor = 0; -// return VerifyVersionInfoW(&VersionInformation, 0x23u, v2); -// } -BOOL - WINAPI - VerifyVersionInfoWH( - _Inout_ LPOSVERSIONINFOEXW lpVersionInformation, - _In_ DWORD dwTypeMask, - _In_ DWORDLONG dwlConditionMask) -{ - return TRUE; -} -int checkversion(uintptr_t ApplySettings_ptr) -{ - uintptr_t retptr = 0; - for (int i = 0; i < 0x200; i++) - { - if ((*(DWORD *)(i + ApplySettings_ptr)) == 0xCCCCCCC3) - { - retptr = i + ApplySettings_ptr; - break; - } - } - if (retptr == 0) - return 0; - // 2.5.1.0 - /* - .text:0000000180016E93 0F B6 84 24 E0 00 00 00 movzx eax, [rsp+arg_D8] - .text:0000000180016E9B 88 05 05 4D 01 00 mov cs:byte_18002BBA6, al - .text:0000000180016EA1 44 89 0D 1C 4D 01 00 mov cs:dword_18002BBC4, r9d - .text:0000000180016EA8 C3 retn - */ - // 2.5.0.1.b2 - /* .text:0000000180016DCE 0F B6 84 24 D8 00 00 00 movzx eax, [rsp + arg_D0] - .text:0000000180016DD6 88 05 CA 4D 01 00 mov cs : byte_18002BBA6, al - .text : 0000000180016DDC 44 89 0D DD 4D 01 00 mov cs : dword_18002BBC0, r9d - .text : 0000000180016DE3 C3 retn*/ - - // 2.2.6 - /*.text:00000001800145D1 0F B6 84 24 D0 00 00 00 movzx eax, [rsp + arg_C8] - .text:00000001800145D9 88 05 C3 55 01 00 mov cs : byte_180029BA2, al - .text : 00000001800145DF 44 89 0D DA 55 01 00 mov cs : dword_180029BC0, r9d - .text : 00000001800145E6 C3 retn*/ - retptr -= 7; - if ((*(WORD *)retptr) != 0x8944) - return 0; - retptr -= 6; - if ((*(WORD *)retptr) != 0x0588) - return 0; - retptr -= 8; - if ((*(WORD *)retptr) != 0xb60f) - return 0; - retptr += 4; - auto argnum = *(int *)retptr; - wprintf(L"%x\n", argnum); - if (argnum == 0xd0) - return 1; - else if (argnum == 0xd8) - return 2; - else if (argnum == 0xE0) - return 3; - return 0; -} -void enable_log(LPVOID Initptr) -{ - - __try - { - uintptr_t cmp = 0x180014690 - 0x1800145F0 + (uintptr_t)Initptr; // 这个基本是固定的 - // .text:0000000180014690 80 3D 82 55 01 00 00 cmp cs:byte_180029C19, 0 - // .text:0000000180014697 48 8D 05 42 BE 00 00 lea rax, aLogTxt ; "log.txt" - // .text:000000018001469E 48 8D 0D C3 BD 00 00 lea rcx, aInit_0 ; "Init\n" - // .text:00000001800146A5 48 0F 44 05 EB 54 01 00 cmovz rax, cs:FileName - // .text:00000001800146AD 48 89 05 E4 54 01 00 mov cs:FileName, rax - // .text:00000001800146B4 E8 87 E1 FF FF call sub_180012840 - if ((*(WORD *)cmp) != 0x3d80) - return; - cmp += 7; - if ((*(WORD *)cmp) != 0x8d48) - return; - cmp += 7; - if ((*(WORD *)cmp) != 0x8d48) - return; - cmp += 7; - if ((*(WORD *)cmp) != 0x0f48) - return; - cmp += 8; - if ((*(WORD *)cmp) != 0x8948) - return; - cmp -= 8; - DWORD _; - VirtualProtect((LPVOID)cmp, 8, PAGE_EXECUTE_READWRITE, &_); - memcpy((LPVOID)cmp, "\x90\x90\x90\x90\x90\x90\x90\x90", 8); - } - __except (EXCEPTION_EXECUTE_HANDLER) - { - wprintf(L"unknow version\n"); - } -} -int losslesswmain(int argc, wchar_t *wargv[]) -{ - SetProcessDPIAware(); - SetCurrentDirectoryW(wargv[1]); - SetDllDirectoryW(wargv[1]); - // for(int i=0;ihThread, &threadctx)) { // Wow64GetThreadContext - fprintf(stderr, "EIP at 0x%p to 0x%p\n", threadctx.RegIP, process->EntryPoint); + fprintf(stderr, "EIP at 0x%p to 0x%p\n", (void *)threadctx.RegIP, process->EntryPoint); threadctx.RegIP = (DWORD)(DWORD_PTR)process->EntryPoint; // X86 only ?? SetThreadContext(proinfo->hThread, &threadctx); } diff --git a/plugins/shareddllproxy/shareddllproxy.cpp b/plugins/shareddllproxy/shareddllproxy.cpp index 648756ee..08d80c2f 100644 --- a/plugins/shareddllproxy/shareddllproxy.cpp +++ b/plugins/shareddllproxy/shareddllproxy.cpp @@ -14,7 +14,6 @@ int neospeech(int argc, wchar_t *argv[]); int neospeechlist(int argc, wchar_t *argv[]); #else int magpiewmain(int argc, wchar_t *wargv[]); -int losslesswmain(int argc, wchar_t *wargv[]); #endif // !_WIN64 void listprocessmodule_1(std::ofstream &of, DWORD processPID) @@ -84,7 +83,5 @@ int wmain(int argc, wchar_t *argv[]) #else else if (argv0 == L"magpie") return magpiewmain(argc - 1, argv + 1); - else if (argv0 == L"lossless") - return losslesswmain(argc - 1, argv + 1); #endif // !_WIN64 } diff --git a/plugins/shareddllproxy/voiceroid2/voice2.cpp b/plugins/shareddllproxy/voiceroid2/voice2.cpp index 2ed14a05..25b3b1e5 100644 --- a/plugins/shareddllproxy/voiceroid2/voice2.cpp +++ b/plugins/shareddllproxy/voiceroid2/voice2.cpp @@ -31,10 +31,7 @@ int voiceroid2wmain(int argc, wchar_t *wargv[]) (const char *)argv[3], //"yukari_emo_44", 2, // �̶�������� atof((const char *)argv[5])); // 1); //0.1-2,0.5-4 - SECURITY_DESCRIPTOR sd = {}; - InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION); - SetSecurityDescriptorDacl(&sd, TRUE, NULL, FALSE); - SECURITY_ATTRIBUTES allAccess = SECURITY_ATTRIBUTES{sizeof(SECURITY_ATTRIBUTES), &sd, FALSE}; + SetEvent(CreateEventA(&allAccess, FALSE, FALSE, argv[8])); if (ConnectNamedPipe(hPipe, NULL) != NULL) { diff --git a/plugins/winrtutils/winrtocr.cpp b/plugins/winrtutils/winrtocr.cpp index 9aef5523..4e5d903a 100644 --- a/plugins/winrtutils/winrtocr.cpp +++ b/plugins/winrtutils/winrtocr.cpp @@ -48,9 +48,6 @@ wchar_t **getlanguagelist(int *num) int i = 0; for (auto &&language : languages) { - // std::wcout << language.LanguageTag().c_str() << L" " << language.DisplayName().c_str() << L" " << language.AbbreviatedName().c_str() << L'\n'; - // zh-Hans-CN ����(���壬�й�) ���� - // ja ���� auto lang = language.LanguageTag(); size_t len = lang.size() + 1; ret[i] = new wchar_t[len]; @@ -62,29 +59,22 @@ wchar_t **getlanguagelist(int *num) } ocrres OCR(wchar_t *fname, wchar_t *lang, wchar_t *space, int *num) { - // ָ��Ҫʶ���ͼ���ļ�·�� std::wstring imagePath = fname; - // ��ͼ���ļ� StorageFile imageFile = StorageFile::GetFileFromPathAsync(imagePath).get(); IRandomAccessStream imageStream = imageFile.OpenAsync(FileAccessMode::Read).get(); - // ���� BitmapDecoder �������ͼ�� BitmapDecoder decoder = BitmapDecoder::CreateAsync(imageStream).get(); - // �ӽ������л�ȡλͼ���� SoftwareBitmap softwareBitmap = decoder.GetSoftwareBitmapAsync().get(); std::wstring l = lang; Language language(l); - // ���� OcrEngine ���� OcrEngine ocrEngine = OcrEngine::TryCreateFromLanguage(language); - // ���� OcrResult ���󲢽���ʶ�� OcrResult ocrResult = ocrEngine.RecognizeAsync(softwareBitmap).get(); - // ���ʶ���� auto res = ocrResult.Lines(); std::vector rets; std::vector xs, ys, xs2, ys2; int i = 0; - std::wstring sspace = space; // Ĭ�ϼ�ʹ����Ҳ�пո� + std::wstring sspace = space; for (auto line : res) { diff --git a/plugins/winsharedutils/hwnd.cpp b/plugins/winsharedutils/hwnd.cpp index fae98b01..2e0a972b 100644 --- a/plugins/winsharedutils/hwnd.cpp +++ b/plugins/winsharedutils/hwnd.cpp @@ -48,23 +48,6 @@ DECLARE void recoverwindow(HWND hwnd, windowstatus status) ShowWindow(hwnd, SW_SHOWNORMAL); SetWindowPlacement(hwnd, &status.wpc); } -struct AutoHandle -{ - HANDLE _handle; - AutoHandle(HANDLE handle) : _handle(handle){}; - ~AutoHandle() - { - CloseHandle(_handle); - } - operator HANDLE() - { - return _handle; - } - operator bool() - { - return _handle == INVALID_HANDLE_VALUE; - } -}; DECLARE bool pid_running(DWORD pid) { DWORD code;