1
0
mirror of https://github.com/valinet/ExplorerPatcher.git synced 2024-11-23 23:21:08 +01:00

Build: Updated build scripts and tools to build the ARM64 setup

This commit is contained in:
Amrsatrio 2024-07-13 22:05:00 +07:00
parent 78788ec461
commit 4799b4bf25
4 changed files with 77 additions and 69 deletions

View File

@ -123,15 +123,15 @@ jobs:
(gc .\funchook-static.vcxproj) -replace '<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>', '<RuntimeLibrary>MultiThreaded</RuntimeLibrary>' | Out-File .\funchook-static.vcxproj
cmake --build . --config Release
# - name: Build funchook arm64
# shell: powershell
# run: |
# cd libs/funchook
# md build-arm64
# cd build-arm64
# cmake -G "Visual Studio 17 2022" -A ARM64 -DFUNCHOOK_CPU=arm64 -DFUNCHOOK_DISASM=capstone -DFUNCHOOK_BUILD_TESTS=OFF ..
# (gc .\funchook-static.vcxproj) -replace '<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>', '<RuntimeLibrary>MultiThreaded</RuntimeLibrary>' | Out-File .\funchook-static.vcxproj
# cmake --build . --config Release
- name: Build funchook arm64
shell: powershell
run: |
cd libs/funchook
md build-arm64
cd build-arm64
cmake -G "Visual Studio 17 2022" -A ARM64 -DFUNCHOOK_CPU=arm64 -DFUNCHOOK_DISASM=capstone -DFUNCHOOK_BUILD_TESTS=OFF ..
(gc .\funchook-static.vcxproj) -replace '<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>', '<RuntimeLibrary>MultiThreaded</RuntimeLibrary>' | Out-File .\funchook-static.vcxproj
cmake --build . --config Release
- name: Build EP IA-32
if: github.event.inputs.config == ''
@ -145,11 +145,11 @@ jobs:
run: |
msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=amd64 ${{env.SOLUTION_FILE_PATH}}
# - name: Build EP arm64
# if: github.event.inputs.config == ''
# working-directory: ${{env.GITHUB_WORKSPACE}}
# run: |
# msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=arm64 ${{env.SOLUTION_FILE_PATH}}
- name: Build EP arm64
if: github.event.inputs.config == ''
working-directory: ${{env.GITHUB_WORKSPACE}}
run: |
msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=arm64 /p:WithArm64XBinaries=true ${{env.SOLUTION_FILE_PATH}}
- name: Build EP custom
if: github.event.inputs.config != ''
@ -170,11 +170,20 @@ jobs:
if [[ -f "build/Release/x64/ExplorerPatcher.amd64.dll" ]]; then cp build/Release/x64/ExplorerPatcher.amd64.dll build/Release/x64/dxgi.dll; fi
if [[ -f "build/Release/ARM64/ExplorerPatcher.arm64.dll" ]]; then cp build/Release/ARM64/ExplorerPatcher.arm64.dll build/Release/ARM64/dxgi.dll; fi
- name: Patch setup
- name: Patch amd64 setup
shell: cmd
working-directory: build/Release/x64
run: |
ep_setup_patch.exe
if exist "build\Release\x64\ExplorerPatcher.amd64.dll" (
"build\Release\x64\ep_setup_patch.exe" "build\Release\x64\ExplorerPatcher.amd64.dll" "build\Release\x64\ep_setup.exe"
)
exit /b 0
- name: Patch arm64 setup
shell: cmd
run: |
if exist "build\Release\ARM64\ExplorerPatcher.arm64.dll" (
"build\Release\x64\ep_setup_patch.exe" "build\Release\ARM64\ExplorerPatcher.arm64.dll" "build\Release\ARM64\ep_setup.exe"
)
exit /b 0
- name: Upload artifacts
@ -184,6 +193,19 @@ jobs:
path: |
build/Release/
# build/Release/x64/ep_setup.exe -> build/Release/ep_setup.exe
# build/Release/ARM64/ep_setup.exe -> build/Release/ep_setup.arm64.exe
- name: Stage files for release
if: github.ref == 'refs/heads/master' && github.event.inputs.ref == ''
shell: bash
run: |
if [ -d "build/Release/x64" ] && ls build/Release/x64/ep_setup.exe 1> /dev/null 2>&1; then
cp build/Release/x64/ep_setup.exe build/Release/ep_setup.exe
fi
if [ -d "build/Release/ARM64" ] && ls build/Release/ARM64/ep_setup.exe 1> /dev/null 2>&1; then
cp build/Release/ARM64/ep_setup.exe build/Release/ep_setup.arm64.exe
fi
- name: Generate release name
shell: bash
working-directory: build/Release/x64
@ -213,7 +235,8 @@ jobs:
tag_name: ${{ steps.release_name.outputs.data }}_${{ steps.vars.outputs.sha_short }}
body: ${{ steps.release_description.outputs.data }}
files: |
build/Release/x64/ep_setup.exe
build/Release/ep_setup.exe
build/Release/ep_setup.arm64.exe
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
@ -228,6 +251,7 @@ jobs:
tag_name: ${{ steps.release_name.outputs.data }}_${{ steps.vars.outputs.sha_short }}
body: ${{ steps.release_description.outputs.data }}
files: |
build/Release/x64/ep_setup.exe
build/Release/ep_setup.exe
build/Release/ep_setup.arm64.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -12,7 +12,11 @@
#define EP_CLSID_LITE "D17F1E1A-5919-4427-8F89-A1A8503CA3EB"
#define EP_CLSID "{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}"
#define DOSMODE_OFFSET 78
#ifndef _M_ARM64
#define SETUP_UTILITY_NAME "ep_setup.exe"
#else
#define SETUP_UTILITY_NAME "ep_setup.arm64.exe"
#endif
#define TOAST_BUFSIZ 1024
#define SEH_REGPATH "Control Panel\\Quick Actions\\Control Center\\QuickActionsStateCapture\\ExplorerPatcher"
#define EP_SETUP_HELPER_SWITCH "/CreateExplorerShellUnelevatedAfterServicing"

View File

@ -22,6 +22,9 @@ int main(int argc, char** argv)
sprintf_s(szEndPattern, MAX_PATH, "## ");
FILE* f = NULL;
fopen_s(&f, "..\\..\\..\\" FILE_NAME, "r");
if (!f)
{
fopen_s(&f, "..\\..\\" FILE_NAME, "r");
if (!f)
{
@ -31,6 +34,7 @@ int main(int argc, char** argv)
fopen_s(&f, "" FILE_NAME, "r");
}
}
}
if (f)
{
int state = 0;

View File

@ -10,49 +10,47 @@ int WINAPI wWinMain(
_In_ int nShowCmd
)
{
WCHAR wszPath[MAX_PATH];
GetModuleFileNameW(GetModuleHandle(NULL), wszPath, MAX_PATH);
PathRemoveFileSpecW(wszPath);
wcscat_s(wszPath, MAX_PATH, L"\\" _T(PRODUCT_NAME) L".amd64.dll");
HMODULE hModule = LoadLibraryExW(wszPath, NULL, LOAD_LIBRARY_AS_DATAFILE);
if (__argc < 3)
{
return __LINE__;
}
WCHAR wszMainModulePath[MAX_PATH];
WCHAR wszSetupPath[MAX_PATH];
wcscpy_s(wszMainModulePath, MAX_PATH, __wargv[1]);
wcscpy_s(wszSetupPath, MAX_PATH, __wargv[2]);
HMODULE hModule = LoadLibraryExW(wszMainModulePath, NULL, LOAD_LIBRARY_AS_DATAFILE);
if (hModule == NULL)
{
return __LINE__;
}
CHAR hash[100];
ZeroMemory(hash, 100);
if (__argc > 1)
{
for (size_t i = 0; i < MIN(wcslen(__wargv[1]), 32); ++i)
{
hash[i] = __wargv[1][i];
}
}
else
{
ComputeFileHash2(hModule, wszPath, hash, 100);
ComputeFileHash2(hModule, wszMainModulePath, hash, 100);
FreeLibrary(hModule);
}
PathRemoveFileSpecW(wszPath);
wcscat_s(wszPath, MAX_PATH, L"\\" _T(SETUP_UTILITY_NAME));
HANDLE hFile = CreateFileW(wszPath, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
HANDLE hFile = CreateFileW(wszSetupPath, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
if (hFile == INVALID_HANDLE_VALUE)
{
return 1;
return __LINE__;
}
HANDLE hFileMapping = CreateFileMappingW(hFile, NULL, PAGE_READWRITE, 0, 0, NULL);
if (hFileMapping == 0)
if (!hFileMapping)
{
CloseHandle(hFile);
return 2;
return __LINE__;
}
char* lpFileBase = MapViewOfFile(hFileMapping, FILE_MAP_ALL_ACCESS, 0, 0, 0);
if (lpFileBase == 0)
if (!lpFileBase)
{
CloseHandle(hFileMapping);
CloseHandle(hFile);
return 3;
return __LINE__;
}
memcpy(lpFileBase + DOSMODE_OFFSET, hash, strlen(hash));
@ -61,27 +59,5 @@ int WINAPI wWinMain(
CloseHandle(hFileMapping);
CloseHandle(hFile);
if (__argc > 1)
{
SHELLEXECUTEINFO ShExecInfo = { 0 };
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
ShExecInfo.hwnd = NULL;
ShExecInfo.lpVerb = L"runas";
ShExecInfo.lpFile = wszPath;
ShExecInfo.lpParameters = NULL;
ShExecInfo.lpDirectory = NULL;
ShExecInfo.nShow = SW_SHOW;
ShExecInfo.hInstApp = NULL;
if (ShellExecuteExW(&ShExecInfo) && ShExecInfo.hProcess)
{
WaitForSingleObject(ShExecInfo.hProcess, INFINITE);
DWORD dwExitCode = 0;
GetExitCodeProcess(ShExecInfo.hProcess, &dwExitCode);
CloseHandle(ShExecInfo.hProcess);
return dwExitCode;
}
}
return 0;
}