diff --git a/SafeExecute-v1.0.zip b/SafeExecute-v1.0.zip new file mode 100644 index 0000000..34312ca Binary files /dev/null and b/SafeExecute-v1.0.zip differ diff --git a/SafeExecute/dllmain.cpp b/SafeExecute/dllmain.cpp index ae49806..205bbb1 100644 --- a/SafeExecute/dllmain.cpp +++ b/SafeExecute/dllmain.cpp @@ -4,13 +4,12 @@ #include "readmode.h" char processPath[MAX_PATH]; -char processDir[MAX_PATH]; +char localDir[MAX_PATH]; DWORD WINAPI ThreadMain(LPVOID params) { GetModuleFileNameA(NULL, processPath, MAX_PATH); - strcpy_s(processDir, processPath); - PathRemoveFileSpecA(processDir); - strcat_s(processDir, "\\"); + ExpandEnvironmentStringsA("%LOCALAPPDATA%", localDir, MAX_PATH); + strcat_s(localDir, "\\安全実行侍~俺を信じろ~"); ReadMode(); ReadCheckList(); diff --git a/SafeExecute/hook.cpp b/SafeExecute/hook.cpp index 2a28a10..d7090e6 100644 --- a/SafeExecute/hook.cpp +++ b/SafeExecute/hook.cpp @@ -27,7 +27,7 @@ bool IsSafeExecuteFilesA(LPSTR lpFileName) { GetFullPathNameA(lpFileName, MAX_PATH, fullPath, NULL); string strFullPath(fullPath); - string safeExecutePath(processDir); + string safeExecutePath(localDir); transform(strFullPath.begin(), strFullPath.end(), strFullPath.begin(), ::toupper); transform(safeExecutePath.begin(), safeExecutePath.end(), safeExecutePath.begin(), ::toupper); @@ -41,7 +41,7 @@ bool IsSafeExecuteFilesW(LPWSTR lpFileName) { GetFullPathNameA(WStringToString(lpFileName).c_str(), MAX_PATH, fullPath, NULL); string strFullPath(fullPath); - string safeExecutePath(processDir); + string safeExecutePath(localDir); transform(strFullPath.begin(), strFullPath.end(), strFullPath.begin(), ::toupper); transform(safeExecutePath.begin(), safeExecutePath.end(), safeExecutePath.begin(), ::toupper); @@ -201,15 +201,16 @@ bool WINAPI CreateProcessA_Hook( if (res == IDNO) ExitProcess(1); } - + BOOL suspended = ((dwCreationFlags & CREATE_SUSPENDED) != 0); dwCreationFlags |= CREATE_SUSPENDED; BOOL res2 = orig_CreateProcessA(lpApplicationName, lpCommandLine, lpProcessAttributes, lpThreadAttributes, bInheritHandles, dwCreationFlags, lpEnvironment, lpCurrentDirectory, lpStartupInfo, lpProcessInformation); + // inject SafeExecute.dll to child process FARPROC lib = GetProcAddress(GetModuleHandleA("kernel32.dll"), "LoadLibraryA"); char dllpath[MAX_PATH]; - GetModuleFileNameA(GetModuleHandleA("SafeExecute.dll"), dllpath, MAX_PATH); + GetModuleFileNameA(GetModuleHandleA("SafeExecute.dll"), dllpath, MAX_PATH); size_t dllpathSize = strlen(dllpath); LPVOID allocMem = VirtualAllocEx(lpProcessInformation->hProcess, NULL, dllpathSize, MEM_COMMIT, PAGE_READWRITE); WriteProcessMemory(lpProcessInformation->hProcess, allocMem, dllpath, dllpathSize, NULL); @@ -380,28 +381,25 @@ HANDLE WINAPI CreateFileA_Hook( strFileName = PathToFileName((LPSTR)lpFileName); char path[MAX_PATH]; - GetCurrentDirectoryA(MAX_PATH, path); - strcat_s(path, "\\backups\\"); + strcpy_s(path, localDir); + strcat_s(path, "backups\\"); - if (PathFileExistsA(path)) { - char buf[50]; - memset(buf, 0, 50); + if (!PathFileExistsA(path)) + CreateDirectoryA(path, NULL); + + char buf[50]; + memset(buf, 0, 50); - string strProcPath; - strProcPath = PathToFileName(processPath); + string strProcPath; + strProcPath = PathToFileName(processPath); - strcat_s(path, strProcPath.c_str()); + strcat_s(path, strProcPath.c_str()); - CreateDirectoryA(path, NULL); + CreateDirectoryA(path, NULL); - strcat_s(path, "\\"); - strcat_s(path, strFileName.c_str()); - CopyFileA(lpFileName, path, FALSE); - } - else { - MessageBoxA(NULL, "Something went wrong in path calculation.\n'backups/' folder missing?", "File Backup Error", MB_OK | MB_ICONERROR); - ExitProcess(1); - } + strcat_s(path, "\\"); + strcat_s(path, strFileName.c_str()); + CopyFileA(lpFileName, path, FALSE); } return orig_CreateFileA(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile); @@ -427,28 +425,25 @@ HANDLE WINAPI CreateFileW_Hook( strFileName = PathToFileName((LPSTR)WStringToString(lpFileName).c_str()); char path[MAX_PATH]; - GetCurrentDirectoryA(MAX_PATH, path); - strcat_s(path, "\\backups\\"); + strcpy_s(path, localDir); + strcat_s(path, "backups\\"); - if (PathFileExistsA(path)) { - char buf[50]; - memset(buf, 0, 50); + if (!PathFileExistsA(path)) + CreateDirectoryA(path, NULL); - string strProcPath; - strProcPath = PathToFileName(processPath); + char buf[50]; + memset(buf, 0, 50); - strcat_s(path, strProcPath.c_str()); + string strProcPath; + strProcPath = PathToFileName(processPath); - CreateDirectoryA(path, NULL); + strcat_s(path, strProcPath.c_str()); - strcat_s(path, "\\"); - strcat_s(path, strFileName.c_str()); - CopyFileA(WStringToString(lpFileName).c_str(), path, FALSE); - } - else { - MessageBoxA(NULL, "Something went wrong in path calculation.\n'backups/' folder missing?", "File Backup Error", MB_OK | MB_ICONERROR); - ExitProcess(1); - } + CreateDirectoryA(path, NULL); + + strcat_s(path, "\\"); + strcat_s(path, strFileName.c_str()); + CopyFileA(WStringToString(lpFileName).c_str(), path, FALSE); } return orig_CreateFileW(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile); diff --git a/SafeExecute/hook.h b/SafeExecute/hook.h index 17096bc..243bc0a 100644 --- a/SafeExecute/hook.h +++ b/SafeExecute/hook.h @@ -16,7 +16,7 @@ #define MsgBox(X) MessageBoxA(NULL, X, "SafeExecute", MB_YESNO) extern char processPath[MAX_PATH]; -extern char processDir[MAX_PATH]; +extern char localDir[MAX_PATH]; extern bool CreateProcessChecked; typedef struct HookFunc { diff --git a/SafeExecute/prehook.cpp b/SafeExecute/prehook.cpp index 2f20243..93c6cbd 100644 --- a/SafeExecute/prehook.cpp +++ b/SafeExecute/prehook.cpp @@ -3,48 +3,45 @@ void LogHookedApi(int argc, VCHAR argv) { char path[MAX_PATH]; - GetCurrentDirectoryA(MAX_PATH, path); - strcat_s(path, "\\logs"); + ExpandEnvironmentStringsA("%LOCALAPPDATA%", path, MAX_PATH); + strcat_s(path, "\\Ss`M`\\logs"); - if (PathFileExistsA(path)) { - strcat_s(path, "\\log.csv"); + if (!PathFileExistsA(path)) + CreateDirectoryA(path, NULL); - HANDLE hFile; - DWORD writesize; - if (PathFileExistsA(path)) { - hFile = CreateFileA(path, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - } - else { - hFile = CreateFileA(path, GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); - char header[] = "timestamp,executable path,hooked windows api,args\n"; - WriteFile(hFile, header, strlen(header), &writesize, NULL); - } + strcat_s(path, "\\log.csv"); - SetFilePointer(hFile, 0, NULL, FILE_END); + HANDLE hFile; + DWORD writesize; + if (PathFileExistsA(path)) { + hFile = CreateFileA(path, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + } + else { + hFile = CreateFileA(path, GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); + char header[] = "timestamp,executable path,hooked windows api,args\n"; + WriteFile(hFile, header, strlen(header), &writesize, NULL); + } - SYSTEMTIME time; - GetLocalTime(&time); + SetFilePointer(hFile, 0, NULL, FILE_END); - char buf[1000]; - memset(buf, 0, 1000); - snprintf(buf, 1000, "%04d/%02d/%02d_%02d:%02d:%02d.%d,%s,%s", - time.wYear, time.wMonth, time.wDay, - time.wHour, time.wMinute, time.wSecond, time.wMilliseconds, - processPath, argv[0]); - for (int i = 1; i < argc; i++) { - strcat_s(buf, ","); - strcat_s(buf, argv[i]); - } - strcat_s(buf, "\n"); + SYSTEMTIME time; + GetLocalTime(&time); - WriteFile(hFile, buf, strlen(buf), &writesize, NULL); - CloseHandle(hFile); - return; - } - else { - MessageBoxA(NULL, "Please execute SafeExecutor from project home directory", "PreHook Error", MB_OK | MB_ICONERROR); - ExitProcess(1); + char buf[1000]; + memset(buf, 0, 1000); + snprintf(buf, 1000, "%04d/%02d/%02d_%02d:%02d:%02d.%d,%s,%s", + time.wYear, time.wMonth, time.wDay, + time.wHour, time.wMinute, time.wSecond, time.wMilliseconds, + processPath, argv[0]); + for (int i = 1; i < argc; i++) { + strcat_s(buf, ","); + strcat_s(buf, argv[i]); } + strcat_s(buf, "\n"); + + WriteFile(hFile, buf, strlen(buf), &writesize, NULL); + CloseHandle(hFile); + return; } void PreHook(int argc, ...) { diff --git a/SafeExecute/readchecklist.cpp b/SafeExecute/readchecklist.cpp index c2a815a..025b087 100644 --- a/SafeExecute/readchecklist.cpp +++ b/SafeExecute/readchecklist.cpp @@ -9,7 +9,7 @@ bool IsNumber(const string& s) { void ReadCheckList() { char path[MAX_PATH]; - GetCurrentDirectoryA(MAX_PATH, path); + strcpy_s(path, localDir); strcat_s(path, "\\rules"); if (PathFileExistsA(path)) { diff --git a/SafeExecute/readmode.cpp b/SafeExecute/readmode.cpp index a9fc4d1..00598dd 100644 --- a/SafeExecute/readmode.cpp +++ b/SafeExecute/readmode.cpp @@ -5,8 +5,8 @@ DWORD MODE = MODE_NORMAL; void ReadMode() { char path[MAX_PATH]; - GetCurrentDirectoryA(MAX_PATH, path); - strcat_s(path, "\\rules"); + ExpandEnvironmentStringsA("%LOCALAPPDATA%", path, MAX_PATH); + strcat_s(path, "\\Ss`M`\\rules"); if (PathFileExistsA(path)) { strcat_s(path, "\\mode.txt"); diff --git a/SafeExecutePackage/Images/BadgeLogo.scale-100.png b/SafeExecutePackage/Images/BadgeLogo.scale-100.png new file mode 100644 index 0000000..7e39e7f Binary files /dev/null and b/SafeExecutePackage/Images/BadgeLogo.scale-100.png differ diff --git a/SafeExecutePackage/Images/BadgeLogo.scale-125.png b/SafeExecutePackage/Images/BadgeLogo.scale-125.png new file mode 100644 index 0000000..24095c3 Binary files /dev/null and b/SafeExecutePackage/Images/BadgeLogo.scale-125.png differ diff --git a/SafeExecutePackage/Images/BadgeLogo.scale-150.png b/SafeExecutePackage/Images/BadgeLogo.scale-150.png new file mode 100644 index 0000000..ad28a89 Binary files /dev/null and b/SafeExecutePackage/Images/BadgeLogo.scale-150.png differ diff --git a/SafeExecutePackage/Images/BadgeLogo.scale-200.png b/SafeExecutePackage/Images/BadgeLogo.scale-200.png new file mode 100644 index 0000000..1bce325 Binary files /dev/null and b/SafeExecutePackage/Images/BadgeLogo.scale-200.png differ diff --git a/SafeExecutePackage/Images/BadgeLogo.scale-400.png b/SafeExecutePackage/Images/BadgeLogo.scale-400.png new file mode 100644 index 0000000..9a71f4a Binary files /dev/null and b/SafeExecutePackage/Images/BadgeLogo.scale-400.png differ diff --git a/SafeExecutePackage/Images/LargeTile.scale-100.png b/SafeExecutePackage/Images/LargeTile.scale-100.png new file mode 100644 index 0000000..d5b8954 Binary files /dev/null and b/SafeExecutePackage/Images/LargeTile.scale-100.png differ diff --git a/SafeExecutePackage/Images/LargeTile.scale-125.png b/SafeExecutePackage/Images/LargeTile.scale-125.png new file mode 100644 index 0000000..d9fa26e Binary files /dev/null and b/SafeExecutePackage/Images/LargeTile.scale-125.png differ diff --git a/SafeExecutePackage/Images/LargeTile.scale-150.png b/SafeExecutePackage/Images/LargeTile.scale-150.png new file mode 100644 index 0000000..f44f081 Binary files /dev/null and b/SafeExecutePackage/Images/LargeTile.scale-150.png differ diff --git a/SafeExecutePackage/Images/LargeTile.scale-200.png b/SafeExecutePackage/Images/LargeTile.scale-200.png new file mode 100644 index 0000000..43bd967 Binary files /dev/null and b/SafeExecutePackage/Images/LargeTile.scale-200.png differ diff --git a/SafeExecutePackage/Images/LargeTile.scale-400.png b/SafeExecutePackage/Images/LargeTile.scale-400.png new file mode 100644 index 0000000..5236178 Binary files /dev/null and b/SafeExecutePackage/Images/LargeTile.scale-400.png differ diff --git a/SafeExecutePackage/Images/LockScreenLogo.scale-200.png b/SafeExecutePackage/Images/LockScreenLogo.scale-200.png new file mode 100644 index 0000000..735f57a Binary files /dev/null and b/SafeExecutePackage/Images/LockScreenLogo.scale-200.png differ diff --git a/SafeExecutePackage/Images/SmallTile.scale-100.png b/SafeExecutePackage/Images/SmallTile.scale-100.png new file mode 100644 index 0000000..25fa021 Binary files /dev/null and b/SafeExecutePackage/Images/SmallTile.scale-100.png differ diff --git a/SafeExecutePackage/Images/SmallTile.scale-125.png b/SafeExecutePackage/Images/SmallTile.scale-125.png new file mode 100644 index 0000000..8cee42e Binary files /dev/null and b/SafeExecutePackage/Images/SmallTile.scale-125.png differ diff --git a/SafeExecutePackage/Images/SmallTile.scale-150.png b/SafeExecutePackage/Images/SmallTile.scale-150.png new file mode 100644 index 0000000..e5b5f3d Binary files /dev/null and b/SafeExecutePackage/Images/SmallTile.scale-150.png differ diff --git a/SafeExecutePackage/Images/SmallTile.scale-200.png b/SafeExecutePackage/Images/SmallTile.scale-200.png new file mode 100644 index 0000000..1e7a648 Binary files /dev/null and b/SafeExecutePackage/Images/SmallTile.scale-200.png differ diff --git a/SafeExecutePackage/Images/SmallTile.scale-400.png b/SafeExecutePackage/Images/SmallTile.scale-400.png new file mode 100644 index 0000000..1281214 Binary files /dev/null and b/SafeExecutePackage/Images/SmallTile.scale-400.png differ diff --git a/SafeExecutePackage/Images/SplashScreen.scale-100.png b/SafeExecutePackage/Images/SplashScreen.scale-100.png new file mode 100644 index 0000000..c3ee44d Binary files /dev/null and b/SafeExecutePackage/Images/SplashScreen.scale-100.png differ diff --git a/SafeExecutePackage/Images/SplashScreen.scale-125.png b/SafeExecutePackage/Images/SplashScreen.scale-125.png new file mode 100644 index 0000000..794f33b Binary files /dev/null and b/SafeExecutePackage/Images/SplashScreen.scale-125.png differ diff --git a/SafeExecutePackage/Images/SplashScreen.scale-150.png b/SafeExecutePackage/Images/SplashScreen.scale-150.png new file mode 100644 index 0000000..202f599 Binary files /dev/null and b/SafeExecutePackage/Images/SplashScreen.scale-150.png differ diff --git a/SafeExecutePackage/Images/SplashScreen.scale-200.png b/SafeExecutePackage/Images/SplashScreen.scale-200.png new file mode 100644 index 0000000..597e269 Binary files /dev/null and b/SafeExecutePackage/Images/SplashScreen.scale-200.png differ diff --git a/SafeExecutePackage/Images/SplashScreen.scale-400.png b/SafeExecutePackage/Images/SplashScreen.scale-400.png new file mode 100644 index 0000000..40fb634 Binary files /dev/null and b/SafeExecutePackage/Images/SplashScreen.scale-400.png differ diff --git a/SafeExecutePackage/Images/Square150x150Logo.scale-100.png b/SafeExecutePackage/Images/Square150x150Logo.scale-100.png new file mode 100644 index 0000000..7a6a1d6 Binary files /dev/null and b/SafeExecutePackage/Images/Square150x150Logo.scale-100.png differ diff --git a/SafeExecutePackage/Images/Square150x150Logo.scale-125.png b/SafeExecutePackage/Images/Square150x150Logo.scale-125.png new file mode 100644 index 0000000..b1ec3ae Binary files /dev/null and b/SafeExecutePackage/Images/Square150x150Logo.scale-125.png differ diff --git a/SafeExecutePackage/Images/Square150x150Logo.scale-150.png b/SafeExecutePackage/Images/Square150x150Logo.scale-150.png new file mode 100644 index 0000000..fc0aed3 Binary files /dev/null and b/SafeExecutePackage/Images/Square150x150Logo.scale-150.png differ diff --git a/SafeExecutePackage/Images/Square150x150Logo.scale-200.png b/SafeExecutePackage/Images/Square150x150Logo.scale-200.png new file mode 100644 index 0000000..392056e Binary files /dev/null and b/SafeExecutePackage/Images/Square150x150Logo.scale-200.png differ diff --git a/SafeExecutePackage/Images/Square150x150Logo.scale-400.png b/SafeExecutePackage/Images/Square150x150Logo.scale-400.png new file mode 100644 index 0000000..ca7ccf1 Binary files /dev/null and b/SafeExecutePackage/Images/Square150x150Logo.scale-400.png differ diff --git a/SafeExecutePackage/Images/Square44x44Logo.altform-lightunplated_targetsize-16.png b/SafeExecutePackage/Images/Square44x44Logo.altform-lightunplated_targetsize-16.png new file mode 100644 index 0000000..3ed829b Binary files /dev/null and b/SafeExecutePackage/Images/Square44x44Logo.altform-lightunplated_targetsize-16.png differ diff --git a/SafeExecutePackage/Images/Square44x44Logo.altform-lightunplated_targetsize-24.png b/SafeExecutePackage/Images/Square44x44Logo.altform-lightunplated_targetsize-24.png new file mode 100644 index 0000000..29956fb Binary files /dev/null and b/SafeExecutePackage/Images/Square44x44Logo.altform-lightunplated_targetsize-24.png differ diff --git a/SafeExecutePackage/Images/Square44x44Logo.altform-lightunplated_targetsize-256.png b/SafeExecutePackage/Images/Square44x44Logo.altform-lightunplated_targetsize-256.png new file mode 100644 index 0000000..292fbb8 Binary files /dev/null and b/SafeExecutePackage/Images/Square44x44Logo.altform-lightunplated_targetsize-256.png differ diff --git a/SafeExecutePackage/Images/Square44x44Logo.altform-lightunplated_targetsize-32.png b/SafeExecutePackage/Images/Square44x44Logo.altform-lightunplated_targetsize-32.png new file mode 100644 index 0000000..531f954 Binary files /dev/null and b/SafeExecutePackage/Images/Square44x44Logo.altform-lightunplated_targetsize-32.png differ diff --git a/SafeExecutePackage/Images/Square44x44Logo.altform-lightunplated_targetsize-48.png b/SafeExecutePackage/Images/Square44x44Logo.altform-lightunplated_targetsize-48.png new file mode 100644 index 0000000..d815c8d Binary files /dev/null and b/SafeExecutePackage/Images/Square44x44Logo.altform-lightunplated_targetsize-48.png differ diff --git a/SafeExecutePackage/Images/Square44x44Logo.altform-unplated_targetsize-16.png b/SafeExecutePackage/Images/Square44x44Logo.altform-unplated_targetsize-16.png new file mode 100644 index 0000000..3ed829b Binary files /dev/null and b/SafeExecutePackage/Images/Square44x44Logo.altform-unplated_targetsize-16.png differ diff --git a/SafeExecutePackage/Images/Square44x44Logo.altform-unplated_targetsize-256.png b/SafeExecutePackage/Images/Square44x44Logo.altform-unplated_targetsize-256.png new file mode 100644 index 0000000..292fbb8 Binary files /dev/null and b/SafeExecutePackage/Images/Square44x44Logo.altform-unplated_targetsize-256.png differ diff --git a/SafeExecutePackage/Images/Square44x44Logo.altform-unplated_targetsize-32.png b/SafeExecutePackage/Images/Square44x44Logo.altform-unplated_targetsize-32.png new file mode 100644 index 0000000..531f954 Binary files /dev/null and b/SafeExecutePackage/Images/Square44x44Logo.altform-unplated_targetsize-32.png differ diff --git a/SafeExecutePackage/Images/Square44x44Logo.altform-unplated_targetsize-48.png b/SafeExecutePackage/Images/Square44x44Logo.altform-unplated_targetsize-48.png new file mode 100644 index 0000000..d815c8d Binary files /dev/null and b/SafeExecutePackage/Images/Square44x44Logo.altform-unplated_targetsize-48.png differ diff --git a/SafeExecutePackage/Images/Square44x44Logo.scale-100.png b/SafeExecutePackage/Images/Square44x44Logo.scale-100.png new file mode 100644 index 0000000..dc76024 Binary files /dev/null and b/SafeExecutePackage/Images/Square44x44Logo.scale-100.png differ diff --git a/SafeExecutePackage/Images/Square44x44Logo.scale-125.png b/SafeExecutePackage/Images/Square44x44Logo.scale-125.png new file mode 100644 index 0000000..93b9fcc Binary files /dev/null and b/SafeExecutePackage/Images/Square44x44Logo.scale-125.png differ diff --git a/SafeExecutePackage/Images/Square44x44Logo.scale-150.png b/SafeExecutePackage/Images/Square44x44Logo.scale-150.png new file mode 100644 index 0000000..ef67679 Binary files /dev/null and b/SafeExecutePackage/Images/Square44x44Logo.scale-150.png differ diff --git a/SafeExecutePackage/Images/Square44x44Logo.scale-200.png b/SafeExecutePackage/Images/Square44x44Logo.scale-200.png new file mode 100644 index 0000000..65ab1bc Binary files /dev/null and b/SafeExecutePackage/Images/Square44x44Logo.scale-200.png differ diff --git a/SafeExecutePackage/Images/Square44x44Logo.scale-400.png b/SafeExecutePackage/Images/Square44x44Logo.scale-400.png new file mode 100644 index 0000000..1c59ddb Binary files /dev/null and b/SafeExecutePackage/Images/Square44x44Logo.scale-400.png differ diff --git a/SafeExecutePackage/Images/Square44x44Logo.targetsize-16.png b/SafeExecutePackage/Images/Square44x44Logo.targetsize-16.png new file mode 100644 index 0000000..6127945 Binary files /dev/null and b/SafeExecutePackage/Images/Square44x44Logo.targetsize-16.png differ diff --git a/SafeExecutePackage/Images/Square44x44Logo.targetsize-24.png b/SafeExecutePackage/Images/Square44x44Logo.targetsize-24.png new file mode 100644 index 0000000..d6c1ffa Binary files /dev/null and b/SafeExecutePackage/Images/Square44x44Logo.targetsize-24.png differ diff --git a/SafeExecutePackage/Images/Square44x44Logo.targetsize-24_altform-unplated.png b/SafeExecutePackage/Images/Square44x44Logo.targetsize-24_altform-unplated.png new file mode 100644 index 0000000..4145bfc Binary files /dev/null and b/SafeExecutePackage/Images/Square44x44Logo.targetsize-24_altform-unplated.png differ diff --git a/SafeExecutePackage/Images/Square44x44Logo.targetsize-256.png b/SafeExecutePackage/Images/Square44x44Logo.targetsize-256.png new file mode 100644 index 0000000..50d1d16 Binary files /dev/null and b/SafeExecutePackage/Images/Square44x44Logo.targetsize-256.png differ diff --git a/SafeExecutePackage/Images/Square44x44Logo.targetsize-32.png b/SafeExecutePackage/Images/Square44x44Logo.targetsize-32.png new file mode 100644 index 0000000..3583157 Binary files /dev/null and b/SafeExecutePackage/Images/Square44x44Logo.targetsize-32.png differ diff --git a/SafeExecutePackage/Images/Square44x44Logo.targetsize-48.png b/SafeExecutePackage/Images/Square44x44Logo.targetsize-48.png new file mode 100644 index 0000000..1ed3326 Binary files /dev/null and b/SafeExecutePackage/Images/Square44x44Logo.targetsize-48.png differ diff --git a/SafeExecutePackage/Images/StoreLogo.backup.png b/SafeExecutePackage/Images/StoreLogo.backup.png new file mode 100644 index 0000000..7385b56 Binary files /dev/null and b/SafeExecutePackage/Images/StoreLogo.backup.png differ diff --git a/SafeExecutePackage/Images/StoreLogo.scale-100.png b/SafeExecutePackage/Images/StoreLogo.scale-100.png new file mode 100644 index 0000000..94b1d5b Binary files /dev/null and b/SafeExecutePackage/Images/StoreLogo.scale-100.png differ diff --git a/SafeExecutePackage/Images/StoreLogo.scale-125.png b/SafeExecutePackage/Images/StoreLogo.scale-125.png new file mode 100644 index 0000000..56ba942 Binary files /dev/null and b/SafeExecutePackage/Images/StoreLogo.scale-125.png differ diff --git a/SafeExecutePackage/Images/StoreLogo.scale-150.png b/SafeExecutePackage/Images/StoreLogo.scale-150.png new file mode 100644 index 0000000..2e5c132 Binary files /dev/null and b/SafeExecutePackage/Images/StoreLogo.scale-150.png differ diff --git a/SafeExecutePackage/Images/StoreLogo.scale-200.png b/SafeExecutePackage/Images/StoreLogo.scale-200.png new file mode 100644 index 0000000..7eb5beb Binary files /dev/null and b/SafeExecutePackage/Images/StoreLogo.scale-200.png differ diff --git a/SafeExecutePackage/Images/StoreLogo.scale-400.png b/SafeExecutePackage/Images/StoreLogo.scale-400.png new file mode 100644 index 0000000..2f05102 Binary files /dev/null and b/SafeExecutePackage/Images/StoreLogo.scale-400.png differ diff --git a/SafeExecutePackage/Images/Wide310x150Logo.scale-100.png b/SafeExecutePackage/Images/Wide310x150Logo.scale-100.png new file mode 100644 index 0000000..f276558 Binary files /dev/null and b/SafeExecutePackage/Images/Wide310x150Logo.scale-100.png differ diff --git a/SafeExecutePackage/Images/Wide310x150Logo.scale-125.png b/SafeExecutePackage/Images/Wide310x150Logo.scale-125.png new file mode 100644 index 0000000..8eb4e35 Binary files /dev/null and b/SafeExecutePackage/Images/Wide310x150Logo.scale-125.png differ diff --git a/SafeExecutePackage/Images/Wide310x150Logo.scale-150.png b/SafeExecutePackage/Images/Wide310x150Logo.scale-150.png new file mode 100644 index 0000000..d1269bc Binary files /dev/null and b/SafeExecutePackage/Images/Wide310x150Logo.scale-150.png differ diff --git a/SafeExecutePackage/Images/Wide310x150Logo.scale-200.png b/SafeExecutePackage/Images/Wide310x150Logo.scale-200.png new file mode 100644 index 0000000..c3ee44d Binary files /dev/null and b/SafeExecutePackage/Images/Wide310x150Logo.scale-200.png differ diff --git a/SafeExecutePackage/Images/Wide310x150Logo.scale-400.png b/SafeExecutePackage/Images/Wide310x150Logo.scale-400.png new file mode 100644 index 0000000..597e269 Binary files /dev/null and b/SafeExecutePackage/Images/Wide310x150Logo.scale-400.png differ diff --git a/SafeExecutePackage/Package.appxmanifest b/SafeExecutePackage/Package.appxmanifest new file mode 100644 index 0000000..fb344cb --- /dev/null +++ b/SafeExecutePackage/Package.appxmanifest @@ -0,0 +1,56 @@ + + + + + + + + SafeExecutePackage + MachineHunter + Images\StoreLogo.png + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SafeExecutePackage/SafeExecutePackage.wapproj b/SafeExecutePackage/SafeExecutePackage.wapproj new file mode 100644 index 0000000..0a0c198 --- /dev/null +++ b/SafeExecutePackage/SafeExecutePackage.wapproj @@ -0,0 +1,168 @@ + + + + 15.0 + + + + Debug + x86 + + + Release + x86 + + + Debug + x64 + + + Release + x64 + + + Debug + ARM + + + Release + ARM + + + Debug + ARM64 + + + Release + ARM64 + + + Debug + AnyCPU + + + Release + AnyCPU + + + + $(MSBuildExtensionsPath)\Microsoft\DesktopBridge\ + + + + 783f2007-ef21-49da-9700-ef5a398a4c84 + 10.0.22000.0 + 10.0.17134.0 + ja-JP + True + ..\SafeExecutorGUI\SafeExecutorGUI.vcxproj + 5C4C9D5BC70A40CE7BE114596A39E024B3F8F8F8 + False + SHA256 + False + True + x64 + 0 + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + + Designer + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/SafeExecuteSetup/SafeExecute-v1.0-Release/SafeExecute.dll b/SafeExecuteSetup/SafeExecute-v1.0-Release/SafeExecute.dll new file mode 100644 index 0000000..073bf0c Binary files /dev/null and b/SafeExecuteSetup/SafeExecute-v1.0-Release/SafeExecute.dll differ diff --git a/SafeExecuteSetup/SafeExecute-v1.0-Release/SafeExecutor.exe b/SafeExecuteSetup/SafeExecute-v1.0-Release/SafeExecutor.exe new file mode 100644 index 0000000..925b07c Binary files /dev/null and b/SafeExecuteSetup/SafeExecute-v1.0-Release/SafeExecutor.exe differ diff --git a/SafeExecuteSetup/SafeExecute-v1.0-Release/SafeExecutorGUI.exe b/SafeExecuteSetup/SafeExecute-v1.0-Release/SafeExecutorGUI.exe new file mode 100644 index 0000000..8c61411 Binary files /dev/null and b/SafeExecuteSetup/SafeExecute-v1.0-Release/SafeExecutorGUI.exe differ diff --git a/SafeExecuteSetup/SafeExecute-v1.0-Release/msvcp140.dll b/SafeExecuteSetup/SafeExecute-v1.0-Release/msvcp140.dll new file mode 100644 index 0000000..464f03c Binary files /dev/null and b/SafeExecuteSetup/SafeExecute-v1.0-Release/msvcp140.dll differ diff --git a/SafeExecuteSetup/SafeExecute-v1.0-Release/samurai.ico b/SafeExecuteSetup/SafeExecute-v1.0-Release/samurai.ico new file mode 100644 index 0000000..9b3db15 Binary files /dev/null and b/SafeExecuteSetup/SafeExecute-v1.0-Release/samurai.ico differ diff --git a/SafeExecuteSetup/SafeExecute-v1.0-Release/ucrtbase.dll b/SafeExecuteSetup/SafeExecute-v1.0-Release/ucrtbase.dll new file mode 100644 index 0000000..6129e68 Binary files /dev/null and b/SafeExecuteSetup/SafeExecute-v1.0-Release/ucrtbase.dll differ diff --git a/SafeExecuteSetup/SafeExecute-v1.0-Release/vcruntime140.dll b/SafeExecuteSetup/SafeExecute-v1.0-Release/vcruntime140.dll new file mode 100644 index 0000000..dee1372 Binary files /dev/null and b/SafeExecuteSetup/SafeExecute-v1.0-Release/vcruntime140.dll differ diff --git a/SafeExecuteSetup/SafeExecute-v1.0-Release/vcruntime140_1.dll b/SafeExecuteSetup/SafeExecute-v1.0-Release/vcruntime140_1.dll new file mode 100644 index 0000000..c9f5125 Binary files /dev/null and b/SafeExecuteSetup/SafeExecute-v1.0-Release/vcruntime140_1.dll differ diff --git a/SafeExecuteSetup/SafeExecute-v1.0/SafeExecute.dll b/SafeExecuteSetup/SafeExecute-v1.0/SafeExecute.dll new file mode 100644 index 0000000..073bf0c Binary files /dev/null and b/SafeExecuteSetup/SafeExecute-v1.0/SafeExecute.dll differ diff --git a/SafeExecuteSetup/SafeExecute-v1.0/SafeExecutor.exe b/SafeExecuteSetup/SafeExecute-v1.0/SafeExecutor.exe new file mode 100644 index 0000000..925b07c Binary files /dev/null and b/SafeExecuteSetup/SafeExecute-v1.0/SafeExecutor.exe differ diff --git a/SafeExecuteSetup/SafeExecute-v1.0/SafeExecutorGUI.exe b/SafeExecuteSetup/SafeExecute-v1.0/SafeExecutorGUI.exe new file mode 100644 index 0000000..f349f6a Binary files /dev/null and b/SafeExecuteSetup/SafeExecute-v1.0/SafeExecutorGUI.exe differ diff --git a/SafeExecuteSetup/SafeExecute-v1.0/msvcp140d.dll b/SafeExecuteSetup/SafeExecute-v1.0/msvcp140d.dll new file mode 100644 index 0000000..f6de9d1 Binary files /dev/null and b/SafeExecuteSetup/SafeExecute-v1.0/msvcp140d.dll differ diff --git a/SafeExecuteSetup/SafeExecute-v1.0/samurai.ico b/SafeExecuteSetup/SafeExecute-v1.0/samurai.ico new file mode 100644 index 0000000..9b3db15 Binary files /dev/null and b/SafeExecuteSetup/SafeExecute-v1.0/samurai.ico differ diff --git a/SafeExecuteSetup/SafeExecute-v1.0/ucrtbased.dll b/SafeExecuteSetup/SafeExecute-v1.0/ucrtbased.dll new file mode 100644 index 0000000..ad3e875 Binary files /dev/null and b/SafeExecuteSetup/SafeExecute-v1.0/ucrtbased.dll differ diff --git a/SafeExecuteSetup/SafeExecute-v1.0/vcruntime140_1d.dll b/SafeExecuteSetup/SafeExecute-v1.0/vcruntime140_1d.dll new file mode 100644 index 0000000..75eb35e Binary files /dev/null and b/SafeExecuteSetup/SafeExecute-v1.0/vcruntime140_1d.dll differ diff --git a/SafeExecuteSetup/SafeExecute-v1.0/vcruntime140d.dll b/SafeExecuteSetup/SafeExecute-v1.0/vcruntime140d.dll new file mode 100644 index 0000000..8f461fe Binary files /dev/null and b/SafeExecuteSetup/SafeExecute-v1.0/vcruntime140d.dll differ diff --git a/SafeExecuteSetup/SafeExecuteSetup.vdproj b/SafeExecuteSetup/SafeExecuteSetup.vdproj new file mode 100644 index 0000000..f419cc4 --- /dev/null +++ b/SafeExecuteSetup/SafeExecuteSetup.vdproj @@ -0,0 +1,840 @@ +"DeployProject" +{ +"VSVersion" = "3:800" +"ProjectType" = "8:{978C614F-708E-4E1A-B201-565925725DBA}" +"IsWebType" = "8:FALSE" +"ProjectName" = "8:SafeExecuteSetup" +"LanguageId" = "3:1041" +"CodePage" = "3:932" +"UILanguageId" = "3:1041" +"SccProjectName" = "8:" +"SccLocalPath" = "8:" +"SccAuxPath" = "8:" +"SccProvider" = "8:" + "Hierarchy" + { + "Entry" + { + "MsmKey" = "8:_682383C06FB3416081D3D700F7060FD3" + "OwnerKey" = "8:_UNDEFINED" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_6E2E5EC0DC2C4E75A9DF5041A14A5C59" + "OwnerKey" = "8:_UNDEFINED" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_C20AE60422F34603890397D80A92096C" + "OwnerKey" = "8:_UNDEFINED" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_CA2B84E9F5A044E4B31A6130B3B2AAFD" + "OwnerKey" = "8:_UNDEFINED" + "MsmSig" = "8:_UNDEFINED" + } + } + "Configurations" + { + "Debug" + { + "DisplayName" = "8:Debug" + "IsDebugOnly" = "11:TRUE" + "IsReleaseOnly" = "11:FALSE" + "OutputFilename" = "8:Debug\\SafeExecuteSetup.msi" + "PackageFilesAs" = "3:2" + "PackageFileSize" = "3:-2147483648" + "CabType" = "3:1" + "Compression" = "3:2" + "SignOutput" = "11:FALSE" + "CertificateFile" = "8:" + "PrivateKeyFile" = "8:" + "TimeStampServer" = "8:" + "InstallerBootstrapper" = "3:2" + "BootstrapperCfg:{63ACBE69-63AA-4F98-B2B6-99F9E24495F2}" + { + "Enabled" = "11:TRUE" + "PromptEnabled" = "11:TRUE" + "PrerequisitesLocation" = "2:1" + "Url" = "8:" + "ComponentsUrl" = "8:" + "Items" + { + "{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:.NETFramework,Version=v4.7.2" + { + "Name" = "8:Microsoft .NET Framework 4.7.2 (x86 and x64)" + "ProductCode" = "8:.NETFramework,Version=v4.7.2" + } + } + } + } + "Release" + { + "DisplayName" = "8:Release" + "IsDebugOnly" = "11:FALSE" + "IsReleaseOnly" = "11:TRUE" + "OutputFilename" = "8:Release\\SafeExecuteSetup.msi" + "PackageFilesAs" = "3:2" + "PackageFileSize" = "3:-2147483648" + "CabType" = "3:1" + "Compression" = "3:2" + "SignOutput" = "11:FALSE" + "CertificateFile" = "8:" + "PrivateKeyFile" = "8:" + "TimeStampServer" = "8:" + "InstallerBootstrapper" = "3:2" + "BootstrapperCfg:{63ACBE69-63AA-4F98-B2B6-99F9E24495F2}" + { + "Enabled" = "11:TRUE" + "PromptEnabled" = "11:TRUE" + "PrerequisitesLocation" = "2:1" + "Url" = "8:" + "ComponentsUrl" = "8:" + "Items" + { + "{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:.NETFramework,Version=v4.7.2" + { + "Name" = "8:Microsoft .NET Framework 4.7.2 (x86 および x64)" + "ProductCode" = "8:.NETFramework,Version=v4.7.2" + } + } + } + } + } + "Deployable" + { + "CustomAction" + { + } + "DefaultFeature" + { + "Name" = "8:DefaultFeature" + "Title" = "8:" + "Description" = "8:" + } + "ExternalPersistence" + { + "LaunchCondition" + { + "{A06ECF26-33A3-4562-8140-9B0E340D4F24}:_E3DCF3EC6063482C9A3D515A7DB8039B" + { + "Name" = "8:.NET Framework" + "Message" = "8:[VSDNETMSG]" + "FrameworkVersion" = "8:.NETFramework,Version=v4.7.2" + "AllowLaterVersions" = "11:FALSE" + "InstallUrl" = "8:http://go.microsoft.com/fwlink/?LinkId=863262" + } + } + } + "File" + { + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_682383C06FB3416081D3D700F7060FD3" + { + "SourcePath" = "8:..\\release\\SafeExecute.dll" + "TargetName" = "8:SafeExecute.dll" + "Tag" = "8:" + "Folder" = "8:_B9C78E6C373844C8A453176166B90D22" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:FALSE" + "IsolateTo" = "8:" + } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_6E2E5EC0DC2C4E75A9DF5041A14A5C59" + { + "SourcePath" = "8:..\\SafeExecutorGUI\\rsrc\\samurai.ico" + "TargetName" = "8:samurai.ico" + "Tag" = "8:" + "Folder" = "8:_B9C78E6C373844C8A453176166B90D22" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:FALSE" + "IsolateTo" = "8:" + } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_CA2B84E9F5A044E4B31A6130B3B2AAFD" + { + "SourcePath" = "8:..\\release\\SafeExecutor.exe" + "TargetName" = "8:SafeExecutor.exe" + "Tag" = "8:" + "Folder" = "8:_B9C78E6C373844C8A453176166B90D22" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:FALSE" + "IsolateTo" = "8:" + } + } + "FileType" + { + } + "Folder" + { + "{3C67513D-01DD-4637-8A68-80971EB9504F}:_B9C78E6C373844C8A453176166B90D22" + { + "DefaultLocation" = "8:[ProgramFiles64Folder][Manufacturer]\\[ProductName]" + "Name" = "8:#1925" + "AlwaysCreate" = "11:TRUE" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Property" = "8:TARGETDIR" + "Folders" + { + } + } + "{1525181F-901A-416C-8A58-119130FE478E}:_E6138FCB29894112B2FA3EA5A0775CDC" + { + "Name" = "8:#1916" + "AlwaysCreate" = "11:FALSE" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Property" = "8:DesktopFolder" + "Folders" + { + } + } + "{1525181F-901A-416C-8A58-119130FE478E}:_F9CC6DC5C16D4ABD9D924E05BFF016A5" + { + "Name" = "8:#1919" + "AlwaysCreate" = "11:FALSE" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Property" = "8:ProgramMenuFolder" + "Folders" + { + "{9EF0B969-E518-4E46-987F-47570745A589}:_4609B1E8747C49D982263B38C295DDD6" + { + "Name" = "8:SafeExecute" + "AlwaysCreate" = "11:TRUE" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Property" = "8:_A7E8FD4279FF4949AF0B8255B0E008D0" + "Folders" + { + } + } + } + } + } + "LaunchCondition" + { + } + "Locator" + { + } + "MsiBootstrapper" + { + "LangId" = "3:1041" + "RequiresElevation" = "11:FALSE" + } + "Product" + { + "Name" = "8:Microsoft Visual Studio" + "ProductName" = "8:SafeExecute" + "ProductCode" = "8:{B5508B68-D84B-4901-ADE4-3AFD410B2E50}" + "PackageCode" = "8:{F0D42C7F-E87D-4D44-ABC9-BE709CA3DC27}" + "UpgradeCode" = "8:{AC69715E-BF88-43E0-9626-FDC739D94EE7}" + "AspNetVersion" = "8:4.0.30319.0" + "RestartWWWService" = "11:FALSE" + "RemovePreviousVersions" = "11:FALSE" + "DetectNewerInstalledVersion" = "11:TRUE" + "InstallAllUsers" = "11:FALSE" + "ProductVersion" = "8:1.0.0" + "Manufacturer" = "8:MachineHunter" + "ARPHELPTELEPHONE" = "8:" + "ARPHELPLINK" = "8:" + "Title" = "8:SafeExecute" + "Subject" = "8:" + "ARPCONTACT" = "8:MachineHunter" + "Keywords" = "8:" + "ARPCOMMENTS" = "8:実行ファイルの実行を制御及び可視化するツールです。Visual Studio 2019 でビルド。(MWS Cup 2022用)" + "ARPURLINFOABOUT" = "8:" + "ARPPRODUCTICON" = "8:" + "ARPIconIndex" = "3:0" + "SearchPath" = "8:" + "UseSystemSearchPath" = "11:TRUE" + "TargetPlatform" = "3:1" + "PreBuildEvent" = "8:" + "PostBuildEvent" = "8:" + "RunPostBuildEvent" = "3:0" + } + "Registry" + { + "HKLM" + { + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_AEB44B06AA5C4C0DBB1AFC1DFA8F9880" + { + "Name" = "8:Software" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_5409776F3C09448DB5CE5EBAD5994EA6" + { + "Name" = "8:[Manufacturer]" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + } + "Values" + { + } + } + } + "Values" + { + } + } + } + } + "HKCU" + { + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_EA2EB1F019724C55BB4A8CE484336BE2" + { + "Name" = "8:Software" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_9C7E0F95C1934546BB6399F4573D262C" + { + "Name" = "8:[Manufacturer]" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + } + "Values" + { + } + } + } + "Values" + { + } + } + } + } + "HKCR" + { + "Keys" + { + } + } + "HKU" + { + "Keys" + { + } + } + "HKPU" + { + "Keys" + { + } + } + } + "Sequences" + { + } + "Shortcut" + { + "{970C0BB2-C7D0-45D7-ABFA-7EC378858BC0}:_5B9175DC98054F8DB2DCE961E2093EA9" + { + "Name" = "8:安全実行侍~俺を信じろ~" + "Arguments" = "8:" + "Description" = "8:" + "ShowCmd" = "3:1" + "IconIndex" = "3:0" + "Transitive" = "11:FALSE" + "Target" = "8:_C20AE60422F34603890397D80A92096C" + "Folder" = "8:_E6138FCB29894112B2FA3EA5A0775CDC" + "WorkingFolder" = "8:_B9C78E6C373844C8A453176166B90D22" + "Icon" = "8:_6E2E5EC0DC2C4E75A9DF5041A14A5C59" + "Feature" = "8:" + } + "{970C0BB2-C7D0-45D7-ABFA-7EC378858BC0}:_E31BB5D5E8CF4CEA85B8D43CA2CB2295" + { + "Name" = "8:安全実行侍~俺を信じろ~" + "Arguments" = "8:" + "Description" = "8:" + "ShowCmd" = "3:1" + "IconIndex" = "3:0" + "Transitive" = "11:FALSE" + "Target" = "8:_C20AE60422F34603890397D80A92096C" + "Folder" = "8:_4609B1E8747C49D982263B38C295DDD6" + "WorkingFolder" = "8:_B9C78E6C373844C8A453176166B90D22" + "Icon" = "8:_6E2E5EC0DC2C4E75A9DF5041A14A5C59" + "Feature" = "8:" + } + } + "UserInterface" + { + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_041A0DC3F69F457FB074C5BBD4D1577F" + { + "Name" = "8:#1901" + "Sequence" = "3:1" + "Attributes" = "3:2" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_7ED66588F26E492C8CDA14FE56FBD3D4" + { + "Sequence" = "3:100" + "DisplayName" = "8:進行状況" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdProgressDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + "ShowProgress" + { + "Name" = "8:ShowProgress" + "DisplayName" = "8:#1009" + "Description" = "8:#1109" + "Type" = "3:5" + "ContextData" = "8:1;True=1;False=0" + "Attributes" = "3:0" + "Setting" = "3:0" + "Value" = "3:1" + "DefaultValue" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_59CB6BA013864D5D9F43D9013EB4AE11" + { + "Name" = "8:#1900" + "Sequence" = "3:1" + "Attributes" = "3:1" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_5AC0D1FE6D004629894075704A822DED" + { + "Sequence" = "3:300" + "DisplayName" = "8:インストールの確認" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdConfirmDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_631989AE8FBB40D59F0BD0E8FA6957BA" + { + "Sequence" = "3:100" + "DisplayName" = "8:ようこそ" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdWelcomeDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + "CopyrightWarning" + { + "Name" = "8:CopyrightWarning" + "DisplayName" = "8:#1002" + "Description" = "8:#1102" + "Type" = "3:3" + "ContextData" = "8:" + "Attributes" = "3:0" + "Setting" = "3:1" + "Value" = "8:#1202" + "DefaultValue" = "8:#1202" + "UsePlugInResources" = "11:TRUE" + } + "Welcome" + { + "Name" = "8:Welcome" + "DisplayName" = "8:#1003" + "Description" = "8:#1103" + "Type" = "3:3" + "ContextData" = "8:" + "Attributes" = "3:0" + "Setting" = "3:1" + "Value" = "8:#1203" + "DefaultValue" = "8:#1203" + "UsePlugInResources" = "11:TRUE" + } + } + } + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_8ECDF6BC910C45289B41D07DC2478A9F" + { + "Sequence" = "3:200" + "DisplayName" = "8:インストール フォルダー" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdFolderDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + "InstallAllUsersVisible" + { + "Name" = "8:InstallAllUsersVisible" + "DisplayName" = "8:#1059" + "Description" = "8:#1159" + "Type" = "3:5" + "ContextData" = "8:1;True=1;False=0" + "Attributes" = "3:0" + "Setting" = "3:0" + "Value" = "3:1" + "DefaultValue" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + "{2479F3F5-0309-486D-8047-8187E2CE5BA0}:_5ABF416CD1B8467E86011F9EAED5D667" + { + "UseDynamicProperties" = "11:FALSE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdBasicDialogs.wim" + } + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_818EFFA33A0E4B70B9E84E175D71D9E3" + { + "Name" = "8:#1901" + "Sequence" = "3:2" + "Attributes" = "3:2" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_A9C696B1E2824760BDBDCEC8B5E54AFC" + { + "Sequence" = "3:100" + "DisplayName" = "8:進行状況" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdAdminProgressDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + "ShowProgress" + { + "Name" = "8:ShowProgress" + "DisplayName" = "8:#1009" + "Description" = "8:#1109" + "Type" = "3:5" + "ContextData" = "8:1;True=1;False=0" + "Attributes" = "3:0" + "Setting" = "3:0" + "Value" = "3:1" + "DefaultValue" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_AF8BDC5E803C42C99B5831ECD1DF15E8" + { + "Name" = "8:#1900" + "Sequence" = "3:2" + "Attributes" = "3:1" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_B04C0C002172408F9D5BB52955396881" + { + "Sequence" = "3:300" + "DisplayName" = "8:インストールの確認" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdAdminConfirmDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_DE905EB10B7B459FB46192E9F203D1CC" + { + "Sequence" = "3:100" + "DisplayName" = "8:ようこそ" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdAdminWelcomeDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + "CopyrightWarning" + { + "Name" = "8:CopyrightWarning" + "DisplayName" = "8:#1002" + "Description" = "8:#1102" + "Type" = "3:3" + "ContextData" = "8:" + "Attributes" = "3:0" + "Setting" = "3:1" + "Value" = "8:#1202" + "DefaultValue" = "8:#1202" + "UsePlugInResources" = "11:TRUE" + } + "Welcome" + { + "Name" = "8:Welcome" + "DisplayName" = "8:#1003" + "Description" = "8:#1103" + "Type" = "3:3" + "ContextData" = "8:" + "Attributes" = "3:0" + "Setting" = "3:1" + "Value" = "8:#1203" + "DefaultValue" = "8:#1203" + "UsePlugInResources" = "11:TRUE" + } + } + } + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_E5C6697CBB7C49C9B7E2E94720336735" + { + "Sequence" = "3:200" + "DisplayName" = "8:インストール フォルダー" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdAdminFolderDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + "{2479F3F5-0309-486D-8047-8187E2CE5BA0}:_CC8F3C9F06C5420EB1C195AC5B88B854" + { + "UseDynamicProperties" = "11:FALSE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdUserInterface.wim" + } + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_EED9B8C19AC44DB8AC5C380626150A67" + { + "Name" = "8:#1902" + "Sequence" = "3:2" + "Attributes" = "3:3" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_1A10874EBE154CBDBE8958743512C722" + { + "Sequence" = "3:100" + "DisplayName" = "8:完了" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdAdminFinishedDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_F412D57E92CF42819498B41ECFF6472A" + { + "Name" = "8:#1902" + "Sequence" = "3:1" + "Attributes" = "3:3" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_774CD9FCB12749FF8EF6106585237869" + { + "Sequence" = "3:100" + "DisplayName" = "8:完了" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdFinishedDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + "UpdateText" + { + "Name" = "8:UpdateText" + "DisplayName" = "8:#1058" + "Description" = "8:#1158" + "Type" = "3:15" + "ContextData" = "8:" + "Attributes" = "3:0" + "Setting" = "3:1" + "Value" = "8:#1258" + "DefaultValue" = "8:#1258" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + } + "MergeModule" + { + } + "ProjectOutput" + { + "{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_C20AE60422F34603890397D80A92096C" + { + "SourcePath" = "8:..\\SafeExecutorGUI\\x64\\Release\\SafeExecutorGUI.exe" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_B9C78E6C373844C8A453176166B90D22" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:FALSE" + "IsolateTo" = "8:" + "ProjectOutputGroupRegister" = "3:1" + "OutputConfiguration" = "8:" + "OutputGroupCanonicalName" = "8:Built" + "OutputProjectGuid" = "8:{BC6FD0CB-6D6A-472C-8305-EC55913CE8CB}" + "ShowKeyOutput" = "11:TRUE" + "ExcludeFilters" + { + } + } + } + } +} diff --git a/SafeExecutor/SafeExecutor.cpp b/SafeExecutor/SafeExecutor.cpp index 1788f9b..83711d1 100644 --- a/SafeExecutor/SafeExecutor.cpp +++ b/SafeExecutor/SafeExecutor.cpp @@ -5,13 +5,22 @@ using namespace std; +void unquote(char* s) { + if (s[0] == '\'' || s[0] == '\"') { + s = s + 1; + s[strlen(s) - 1] = '\0'; + } +} + int main(int argc, char* argv[]) { BOOL res; if (argc > 2) { - char* dllpath = argv[1]; + char* dllpath = argv[1]; char* filename = argv[2]; - + unquote(dllpath); + unquote(filename); + if (PathFileExistsA(filename)) { if (PathFileExistsA(dllpath)) { STARTUPINFOA si; @@ -22,21 +31,19 @@ int main(int argc, char* argv[]) { char cmd[MAX_PATH * 6]; memset(cmd, 0, sizeof(cmd)); - strcat_s(cmd, filename); for (int i = 3; i < argc; i++) { - strcat_s(cmd, " "); + if(i!=3) strcat_s(cmd, " "); strcat_s(cmd, argv[i]); } - - res = CreateProcessA(NULL, cmd, NULL, NULL, 0, CREATE_SUSPENDED, NULL, NULL, &si, &pi); - if (!res) cout << "Error: failed to execute executable" << endl; + + res = CreateProcessA(filename, cmd, NULL, NULL, 0, CREATE_SUSPENDED, NULL, NULL, &si, &pi); + if (!res) cout << "SafeExecutor Error: failed to execute executable" << endl; // dll injection FARPROC lib = GetProcAddress(GetModuleHandleA("kernel32.dll"), "LoadLibraryA"); size_t dllpathSize = strlen(dllpath) * sizeof(char); LPVOID allocMem = VirtualAllocEx(pi.hProcess, NULL, dllpathSize, MEM_COMMIT, PAGE_READWRITE); WriteProcessMemory(pi.hProcess, allocMem, dllpath, dllpathSize, NULL); - CreateRemoteThread(pi.hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)lib, allocMem, 0, NULL); Sleep(200); // フックの処理が終るまで待つ(意味があるのかは不明) @@ -44,7 +51,7 @@ int main(int argc, char* argv[]) { } } else - cout << "Error: Invalid executable path" << endl; + cout << "SafeExecutor Error: Invalid executable path" << endl; } else cout << "Usage:" << endl << "SafeExecutor.exe " << endl; diff --git a/SafeExecutorGUI/MainWindow.h b/SafeExecutorGUI/MainWindow.h index b6ad4e4..8b54764 100644 --- a/SafeExecutorGUI/MainWindow.h +++ b/SafeExecutorGUI/MainWindow.h @@ -23,6 +23,9 @@ namespace SafeExecutorGUI { typedef System::Collections::Generic::Queue NodeQueue; typedef System::Collections::Generic::List StrList; + char appDir[MAX_PATH]; + char localDir[MAX_PATH]; + /// /// MainWindow ̊Tv /// @@ -33,6 +36,16 @@ namespace SafeExecutorGUI { { InitializeComponent(); + // appDir: GUI̎st@CfBNgւ̃pX + GetModuleFileNameA(NULL, appDir, MAX_PATH); + PathRemoveFileSpecA(appDir); + + // localPath: C:\Users\[U[\Appdata\Local\Ss`M` + ExpandEnvironmentStringsA("%LOCALAPPDATA%", localDir, MAX_PATH); + strcat_s(localDir, "\\Ss`M`"); + if (!PathFileExistsA(localDir)) + CreateDirectoryA(localDir, NULL); + array^ nodChildFiles = { gcnew TreeNode("t@CύX"), gcnew TreeNode("t@C폜"), @@ -525,101 +538,101 @@ namespace SafeExecutorGUI { private: System::Void ExecBtn_Click(System::Object^ sender, System::EventArgs^ e) { // s{^Ƃ̏Lq - // TODO: char path[MAX_PATH]; - GetModuleFileNameA(NULL, path, MAX_PATH); - for (int i = 0; i < 4; i++) PathRemoveFileSpecA(path); - strcat_s(path, "\\rules"); //܂ł"path"\\rulesłD - + memset(path, 0, MAX_PATH); + strcat_s(path, localDir); + strcat_s(path, "\\rules"); // path = localDir/rules/ + if (!PathFileExistsA(path)) + CreateDirectoryA(path, NULL); + char rulesPath[MAX_PATH]; char modePath[MAX_PATH]; strcpy_s(rulesPath, path); strcpy_s(modePath, path); - - if (PathFileExistsA(rulesPath)) { - strcat_s(rulesPath, "\\rules.csv"); //rulesPathcsvt@C̃pXw - strcat_s(modePath, "\\mode.txt"); //modePathtxtt@C̃pXw - - HANDLE hFileRule; - HANDLE hFileMode; - DWORD writesize; - ApiDict^ ad = gcnew ApiDict(); - - // rules.csv܂mode.txtt@C݂Ȃx - if (PathFileExistsA(rulesPath) || PathFileExistsA(modePath)) { - DeleteFileA(rulesPath); - DeleteFileA(modePath); - } - - // mode.txtփ[h̏Ԃ0,1,2ŏ - hFileMode = CreateFileA(modePath, GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); - char mode[2]; - memset(mode, 0, 2); - char modelIndex = '0' + comboBoxModeSelection->SelectedIndex; - strcat(mode, &modelIndex); - strcat(mode, "\n"); - DWORD writesizeMode; - WriteFile(hFileMode, mode, strlen(mode), &writesize, NULL); - CloseHandle(hFileMode); - - // rules.csvWinAPIƃ`FbNԂ̑gcsvɏޑ - hFileRule = CreateFileA(rulesPath, GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); + strcat_s(rulesPath, "\\rules.csv"); // rulesPath = localDir/rules/rules.csv + strcat_s(modePath, "\\mode.txt"); // modePath = localDir/rules/mode.txt + + HANDLE hFileRule; + HANDLE hFileMode; + DWORD writesize; + ApiDict^ ad = gcnew ApiDict(); + + // rules.csv܂mode.txtt@C݂Ȃx + if (PathFileExistsA(rulesPath)) + DeleteFileA(rulesPath); + if (PathFileExistsA(modePath)) + DeleteFileA(modePath); + + // mode.txtփ[h̏Ԃ0,1,2ŏ + hFileMode = CreateFileA(modePath, GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); + char mode[2]; + memset(mode, 0, 2); + char modelIndex = '0' + comboBoxModeSelection->SelectedIndex; + strcat(mode, &modelIndex); + strcat(mode, "\n"); + DWORD writesizeMode; + WriteFile(hFileMode, mode, strlen(mode), &writesize, NULL); + CloseHandle(hFileMode); + + // rules.csvWinAPIƃ`FbNԂ̑gcsvɏޑ + hFileRule = CreateFileA(rulesPath, GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); - for each(TreeNode ^n in treeView->Nodes) + for each(TreeNode ^n in treeView->Nodes) + { + if (n!= nullptr) { - if (n!= nullptr) + //Using a queue to store and process each node in the TreeView + NodeQueue ^staging = gcnew NodeQueue(); + staging->Enqueue(n); + while (staging->Count > 0) { - //Using a queue to store and process each node in the TreeView - NodeQueue ^staging = gcnew NodeQueue(); - staging->Enqueue(n); - while (staging->Count > 0) - { - n = staging->Dequeue(); + n = staging->Dequeue(); - if (n->Parent) { - for each (String ^ s in ad->apiDict[n->Text]) { - char buf[100]; - memset(buf, 0, 100); - marshal_context^ context = gcnew marshal_context(); - const char* apiName = context->marshal_as(s); - strcat(buf, apiName); - strcat(buf, ","); - char c = n->Checked + '0'; - strcat(buf, &c); - strcat(buf, "\n"); - DWORD writesize; - WriteFile(hFileRule, buf, strlen(buf), &writesize, NULL); - SetFilePointer(hFileRule, 0, NULL, FILE_END); - } + if (n->Parent) { + for each (String ^ s in ad->apiDict[n->Text]) { + char buf[100]; + memset(buf, 0, 100); + marshal_context^ context = gcnew marshal_context(); + const char* apiName = context->marshal_as(s); + strcat(buf, apiName); + strcat(buf, ","); + char c = n->Checked + '0'; + strcat(buf, &c); + strcat(buf, "\n"); + DWORD writesize; + WriteFile(hFileRule, buf, strlen(buf), &writesize, NULL); + SetFilePointer(hFileRule, 0, NULL, FILE_END); } + } - for each(TreeNode ^node in n->Nodes) - { - staging->Enqueue(node); - } + for each(TreeNode ^node in n->Nodes) + { + staging->Enqueue(node); } } } - CloseHandle(hFileRule); } - - + CloseHandle(hFileRule); + msclr::interop::marshal_context context; - LPCSTR exePath = context.marshal_as(FileSelectTextBox->Text); + LPCSTR exePath = context.marshal_as("\"" + FileSelectTextBox->Text + "\""); char processPath[MAX_PATH]; - GetModuleFileNameA(NULL, path, MAX_PATH); - - if (PathFileExistsA(exePath)) { - // TODO: ̃pX̌vZ‚‹ϐƂŐ - // ) [System.Environment]::SetEnvironmentVariable("SafeExecuteInstallDir", $PSScriptRoot, "Machine") - for(int i=0; i<4; i++) PathRemoveFileSpecA(path); - SetCurrentDirectoryA(path); + + char exePathForCheck[MAX_PATH]; + strcpy_s(exePathForCheck, exePath+1); + exePathForCheck[strlen(exePathForCheck)-1] = '\0'; + + if (PathFileExistsA(exePathForCheck)) { char executorPath[MAX_PATH]; - snprintf(executorPath, MAX_PATH, "%s\\%s", path, "SafeExecutor\\x64\\Debug\\SafeExecutor.exe"); + snprintf(executorPath, MAX_PATH, "%s\\%s", appDir, "SafeExecutor.exe"); char dllPath[MAX_PATH]; - snprintf(dllPath, MAX_PATH, "%s\\%s", path, "SafeExecute\\x64\\Debug\\SafeExecute.dll"); - - if (PathFileExistsA(executorPath) && PathFileExistsA(dllPath)) { + snprintf(dllPath, MAX_PATH, "\"%s\\%s\"", appDir, "SafeExecute.dll"); + + char dllPathForCheck[MAX_PATH]; + strcpy_s(dllPathForCheck, dllPath + 1); + dllPathForCheck[strlen(dllPathForCheck) - 1] = '\0'; + + if (PathFileExistsA(executorPath) && PathFileExistsA(dllPathForCheck)) { char arg[MAX_PATH * 10]; memset(arg, 0, sizeof(arg)); strcat_s(arg, dllPath); @@ -641,7 +654,7 @@ private: System::Void ExecBtn_Click(System::Object^ sender, System::EventArgs^ e pProc->StartInfo->RedirectStandardError = true; // pProc->StartInfo->RedirectStandardInput = true; pProc->Start(); - + String^ stdOut = ""; String^ stdErr = ""; while (!pProc->HasExited) { diff --git a/SafeExecutorGUI/RCa80348 b/SafeExecutorGUI/RCa80348 new file mode 100644 index 0000000..ff5ba18 Binary files /dev/null and b/SafeExecutorGUI/RCa80348 differ diff --git a/SafeExecutorGUI/RCb80348 b/SafeExecutorGUI/RCb80348 new file mode 100644 index 0000000..ff5ba18 Binary files /dev/null and b/SafeExecutorGUI/RCb80348 differ diff --git a/SafeExecutorGUI/RCc80348 b/SafeExecutorGUI/RCc80348 new file mode 100644 index 0000000..ff5ba18 Binary files /dev/null and b/SafeExecutorGUI/RCc80348 differ diff --git a/SafeExecutorGUI/SafeExecutorGUI.rc b/SafeExecutorGUI/SafeExecutorGUI.rc new file mode 100644 index 0000000..3e8d0a3 --- /dev/null +++ b/SafeExecutorGUI/SafeExecutorGUI.rc @@ -0,0 +1,69 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource1.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// { ({) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) +LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT +#pragma code_page(932) + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource1.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// PNG +// + +IDB_PNG1 PNG "C:\\Users\\kazu3\\Desktop\\samurai_icon.png" + +#endif // { ({) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/SafeExecutorGUI/SafeExecutorGUI.sln b/SafeExecutorGUI/SafeExecutorGUI.sln index 93841e5..e3313c7 100644 --- a/SafeExecutorGUI/SafeExecutorGUI.sln +++ b/SafeExecutorGUI/SafeExecutorGUI.sln @@ -5,22 +5,46 @@ VisualStudioVersion = 16.0.32802.440 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SafeExecutorGUI", "SafeExecutorGUI.vcxproj", "{BC6FD0CB-6D6A-472C-8305-EC55913CE8CB}" EndProject +Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "SafeExecuteSetup", "..\SafeExecuteSetup\SafeExecuteSetup.vdproj", "{DC4A9BFA-E55C-4EC4-AF82-106B09EF23D9}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|ARM = Debug|ARM + Debug|ARM64 = Debug|ARM64 Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|ARM = Release|ARM + Release|ARM64 = Release|ARM64 Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {BC6FD0CB-6D6A-472C-8305-EC55913CE8CB}.Debug|x64.ActiveCfg = Debug|x64 - {BC6FD0CB-6D6A-472C-8305-EC55913CE8CB}.Debug|x64.Build.0 = Debug|x64 + {BC6FD0CB-6D6A-472C-8305-EC55913CE8CB}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {BC6FD0CB-6D6A-472C-8305-EC55913CE8CB}.Debug|ARM.ActiveCfg = Debug|Win32 + {BC6FD0CB-6D6A-472C-8305-EC55913CE8CB}.Debug|ARM64.ActiveCfg = Debug|Win32 + {BC6FD0CB-6D6A-472C-8305-EC55913CE8CB}.Debug|x64.ActiveCfg = Release|x64 + {BC6FD0CB-6D6A-472C-8305-EC55913CE8CB}.Debug|x64.Build.0 = Release|x64 {BC6FD0CB-6D6A-472C-8305-EC55913CE8CB}.Debug|x86.ActiveCfg = Debug|Win32 {BC6FD0CB-6D6A-472C-8305-EC55913CE8CB}.Debug|x86.Build.0 = Debug|Win32 - {BC6FD0CB-6D6A-472C-8305-EC55913CE8CB}.Release|x64.ActiveCfg = Release|x64 - {BC6FD0CB-6D6A-472C-8305-EC55913CE8CB}.Release|x64.Build.0 = Release|x64 + {BC6FD0CB-6D6A-472C-8305-EC55913CE8CB}.Release|Any CPU.ActiveCfg = Release|Win32 + {BC6FD0CB-6D6A-472C-8305-EC55913CE8CB}.Release|ARM.ActiveCfg = Release|Win32 + {BC6FD0CB-6D6A-472C-8305-EC55913CE8CB}.Release|ARM64.ActiveCfg = Release|Win32 + {BC6FD0CB-6D6A-472C-8305-EC55913CE8CB}.Release|x64.ActiveCfg = Debug|x64 + {BC6FD0CB-6D6A-472C-8305-EC55913CE8CB}.Release|x64.Build.0 = Debug|x64 {BC6FD0CB-6D6A-472C-8305-EC55913CE8CB}.Release|x86.ActiveCfg = Release|Win32 {BC6FD0CB-6D6A-472C-8305-EC55913CE8CB}.Release|x86.Build.0 = Release|Win32 + {DC4A9BFA-E55C-4EC4-AF82-106B09EF23D9}.Debug|Any CPU.ActiveCfg = Debug + {DC4A9BFA-E55C-4EC4-AF82-106B09EF23D9}.Debug|ARM.ActiveCfg = Debug + {DC4A9BFA-E55C-4EC4-AF82-106B09EF23D9}.Debug|ARM64.ActiveCfg = Debug + {DC4A9BFA-E55C-4EC4-AF82-106B09EF23D9}.Debug|x64.ActiveCfg = Release + {DC4A9BFA-E55C-4EC4-AF82-106B09EF23D9}.Debug|x86.ActiveCfg = Debug + {DC4A9BFA-E55C-4EC4-AF82-106B09EF23D9}.Release|Any CPU.ActiveCfg = Release + {DC4A9BFA-E55C-4EC4-AF82-106B09EF23D9}.Release|ARM.ActiveCfg = Release + {DC4A9BFA-E55C-4EC4-AF82-106B09EF23D9}.Release|ARM64.ActiveCfg = Release + {DC4A9BFA-E55C-4EC4-AF82-106B09EF23D9}.Release|x64.ActiveCfg = Debug + {DC4A9BFA-E55C-4EC4-AF82-106B09EF23D9}.Release|x86.ActiveCfg = Release EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/SafeExecutorGUI/SafeExecutorGUI.vcxproj b/SafeExecutorGUI/SafeExecutorGUI.vcxproj index 9fb2168..4bd6c29 100644 --- a/SafeExecutorGUI/SafeExecutorGUI.vcxproj +++ b/SafeExecutorGUI/SafeExecutorGUI.vcxproj @@ -83,6 +83,7 @@ Windows main + RequireAdministrator @@ -129,12 +130,19 @@ CppForm + MainWindow.h + + + + + + diff --git a/SafeExecutorGUI/SafeExecutorGUI.vcxproj.filters b/SafeExecutorGUI/SafeExecutorGUI.vcxproj.filters index 147c7d2..b58dbfb 100644 --- a/SafeExecutorGUI/SafeExecutorGUI.vcxproj.filters +++ b/SafeExecutorGUI/SafeExecutorGUI.vcxproj.filters @@ -26,5 +26,18 @@ ヘッダー ファイル + + ヘッダー ファイル + + + + + リソース ファイル + + + + + リソース ファイル + \ No newline at end of file diff --git a/SafeExecutorGUI/SafeExecutorGUI1.rc b/SafeExecutorGUI/SafeExecutorGUI1.rc new file mode 100644 index 0000000..b4dabe6 --- /dev/null +++ b/SafeExecutorGUI/SafeExecutorGUI1.rc @@ -0,0 +1,71 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// { ({) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) +LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT +#pragma code_page(932) + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_ICON1 ICON "C:\\Users\\kazu3\\Downloads\\samurai_icon.ico" + +#endif // { ({) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/SafeExecutorGUI/SafeExecutorGUI2.rc b/SafeExecutorGUI/SafeExecutorGUI2.rc new file mode 100644 index 0000000..8310e5e --- /dev/null +++ b/SafeExecutorGUI/SafeExecutorGUI2.rc @@ -0,0 +1,71 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// { ({) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) +LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT +#pragma code_page(932) + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_ICON1 ICON "rsrc\\samurai.ico" + +#endif // { ({) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/SafeExecutorGUI/resource.h b/SafeExecutorGUI/resource.h new file mode 100644 index 0000000..d52e695 --- /dev/null +++ b/SafeExecutorGUI/resource.h @@ -0,0 +1,16 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ ŐꂽCN[h t@CB +// SafeExecutorGUI2.rc Ŏgp +// +#define IDI_ICON1 101 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 102 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/SafeExecutorGUI/rsrc/gui-icon.ico b/SafeExecutorGUI/rsrc/gui-icon.ico deleted file mode 100644 index 8c3873f..0000000 Binary files a/SafeExecutorGUI/rsrc/gui-icon.ico and /dev/null differ diff --git a/SafeExecutorGUI/rsrc/samurai-icon.jpg b/SafeExecutorGUI/rsrc/samurai-icon.jpg new file mode 100644 index 0000000..1547ec2 Binary files /dev/null and b/SafeExecutorGUI/rsrc/samurai-icon.jpg differ diff --git a/SafeExecutorGUI/rsrc/samurai.ico b/SafeExecutorGUI/rsrc/samurai.ico new file mode 100644 index 0000000..9b3db15 Binary files /dev/null and b/SafeExecutorGUI/rsrc/samurai.ico differ diff --git a/TestExecutables/OpenProc.cpp b/TestExecutables/OpenProc.cpp index cae6179..099e4ef 100644 --- a/TestExecutables/OpenProc.cpp +++ b/TestExecutables/OpenProc.cpp @@ -7,8 +7,8 @@ int main(void) { memset(&pi, 0, sizeof(pi)); si.cb = sizeof(si); - CreateProcessA(NULL, ".\\TestExecutables\\IsDebuggerPresent.exe", NULL, NULL, 0, 0, NULL, NULL, &si, &pi); - CreateProcessA(NULL, ".\\TestExecutables\\CSP.exe", NULL, NULL, 0, 0, NULL, NULL, &si, &pi); + CreateProcessA(NULL, "..\\TestExecutables\\IsDebuggerPresent.exe", NULL, NULL, 0, 0, NULL, NULL, &si, &pi); + CreateProcessA(NULL, "..\\TestExecutables\\CSP.exe", NULL, NULL, 0, 0, NULL, NULL, &si, &pi); if(IsDebuggerPresent()) return 1; diff --git a/TestExecutables/OpenProc.exe b/TestExecutables/OpenProc.exe index d02be83..5739ab2 100644 Binary files a/TestExecutables/OpenProc.exe and b/TestExecutables/OpenProc.exe differ