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:
parent
78788ec461
commit
4799b4bf25
62
.github/workflows/build.yml
vendored
62
.github/workflows/build.yml
vendored
@ -123,15 +123,15 @@ jobs:
|
|||||||
(gc .\funchook-static.vcxproj) -replace '<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>', '<RuntimeLibrary>MultiThreaded</RuntimeLibrary>' | Out-File .\funchook-static.vcxproj
|
(gc .\funchook-static.vcxproj) -replace '<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>', '<RuntimeLibrary>MultiThreaded</RuntimeLibrary>' | Out-File .\funchook-static.vcxproj
|
||||||
cmake --build . --config Release
|
cmake --build . --config Release
|
||||||
|
|
||||||
# - name: Build funchook arm64
|
- name: Build funchook arm64
|
||||||
# shell: powershell
|
shell: powershell
|
||||||
# run: |
|
run: |
|
||||||
# cd libs/funchook
|
cd libs/funchook
|
||||||
# md build-arm64
|
md build-arm64
|
||||||
# cd build-arm64
|
cd build-arm64
|
||||||
# cmake -G "Visual Studio 17 2022" -A ARM64 -DFUNCHOOK_CPU=arm64 -DFUNCHOOK_DISASM=capstone -DFUNCHOOK_BUILD_TESTS=OFF ..
|
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
|
(gc .\funchook-static.vcxproj) -replace '<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>', '<RuntimeLibrary>MultiThreaded</RuntimeLibrary>' | Out-File .\funchook-static.vcxproj
|
||||||
# cmake --build . --config Release
|
cmake --build . --config Release
|
||||||
|
|
||||||
- name: Build EP IA-32
|
- name: Build EP IA-32
|
||||||
if: github.event.inputs.config == ''
|
if: github.event.inputs.config == ''
|
||||||
@ -145,11 +145,11 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=amd64 ${{env.SOLUTION_FILE_PATH}}
|
msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=amd64 ${{env.SOLUTION_FILE_PATH}}
|
||||||
|
|
||||||
# - name: Build EP arm64
|
- name: Build EP arm64
|
||||||
# if: github.event.inputs.config == ''
|
if: github.event.inputs.config == ''
|
||||||
# working-directory: ${{env.GITHUB_WORKSPACE}}
|
working-directory: ${{env.GITHUB_WORKSPACE}}
|
||||||
# run: |
|
run: |
|
||||||
# msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=arm64 ${{env.SOLUTION_FILE_PATH}}
|
msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=arm64 /p:WithArm64XBinaries=true ${{env.SOLUTION_FILE_PATH}}
|
||||||
|
|
||||||
- name: Build EP custom
|
- name: Build EP custom
|
||||||
if: github.event.inputs.config != ''
|
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/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
|
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
|
shell: cmd
|
||||||
working-directory: build/Release/x64
|
|
||||||
run: |
|
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
|
exit /b 0
|
||||||
|
|
||||||
- name: Upload artifacts
|
- name: Upload artifacts
|
||||||
@ -184,6 +193,19 @@ jobs:
|
|||||||
path: |
|
path: |
|
||||||
build/Release/
|
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
|
- name: Generate release name
|
||||||
shell: bash
|
shell: bash
|
||||||
working-directory: build/Release/x64
|
working-directory: build/Release/x64
|
||||||
@ -213,7 +235,8 @@ jobs:
|
|||||||
tag_name: ${{ steps.release_name.outputs.data }}_${{ steps.vars.outputs.sha_short }}
|
tag_name: ${{ steps.release_name.outputs.data }}_${{ steps.vars.outputs.sha_short }}
|
||||||
body: ${{ steps.release_description.outputs.data }}
|
body: ${{ steps.release_description.outputs.data }}
|
||||||
files: |
|
files: |
|
||||||
build/Release/x64/ep_setup.exe
|
build/Release/ep_setup.exe
|
||||||
|
build/Release/ep_setup.arm64.exe
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.PAT }}
|
GITHUB_TOKEN: ${{ secrets.PAT }}
|
||||||
|
|
||||||
@ -228,6 +251,7 @@ jobs:
|
|||||||
tag_name: ${{ steps.release_name.outputs.data }}_${{ steps.vars.outputs.sha_short }}
|
tag_name: ${{ steps.release_name.outputs.data }}_${{ steps.vars.outputs.sha_short }}
|
||||||
body: ${{ steps.release_description.outputs.data }}
|
body: ${{ steps.release_description.outputs.data }}
|
||||||
files: |
|
files: |
|
||||||
build/Release/x64/ep_setup.exe
|
build/Release/ep_setup.exe
|
||||||
|
build/Release/ep_setup.arm64.exe
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
@ -12,7 +12,11 @@
|
|||||||
#define EP_CLSID_LITE "D17F1E1A-5919-4427-8F89-A1A8503CA3EB"
|
#define EP_CLSID_LITE "D17F1E1A-5919-4427-8F89-A1A8503CA3EB"
|
||||||
#define EP_CLSID "{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}"
|
#define EP_CLSID "{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}"
|
||||||
#define DOSMODE_OFFSET 78
|
#define DOSMODE_OFFSET 78
|
||||||
|
#ifndef _M_ARM64
|
||||||
#define SETUP_UTILITY_NAME "ep_setup.exe"
|
#define SETUP_UTILITY_NAME "ep_setup.exe"
|
||||||
|
#else
|
||||||
|
#define SETUP_UTILITY_NAME "ep_setup.arm64.exe"
|
||||||
|
#endif
|
||||||
#define TOAST_BUFSIZ 1024
|
#define TOAST_BUFSIZ 1024
|
||||||
#define SEH_REGPATH "Control Panel\\Quick Actions\\Control Center\\QuickActionsStateCapture\\ExplorerPatcher"
|
#define SEH_REGPATH "Control Panel\\Quick Actions\\Control Center\\QuickActionsStateCapture\\ExplorerPatcher"
|
||||||
#define EP_SETUP_HELPER_SWITCH "/CreateExplorerShellUnelevatedAfterServicing"
|
#define EP_SETUP_HELPER_SWITCH "/CreateExplorerShellUnelevatedAfterServicing"
|
||||||
|
@ -22,13 +22,17 @@ int main(int argc, char** argv)
|
|||||||
sprintf_s(szEndPattern, MAX_PATH, "## ");
|
sprintf_s(szEndPattern, MAX_PATH, "## ");
|
||||||
|
|
||||||
FILE* f = NULL;
|
FILE* f = NULL;
|
||||||
fopen_s(&f, "..\\..\\" FILE_NAME, "r");
|
fopen_s(&f, "..\\..\\..\\" FILE_NAME, "r");
|
||||||
if (!f)
|
if (!f)
|
||||||
{
|
{
|
||||||
fopen_s(&f, "..\\" FILE_NAME, "r");
|
fopen_s(&f, "..\\..\\" FILE_NAME, "r");
|
||||||
if (!f)
|
if (!f)
|
||||||
{
|
{
|
||||||
fopen_s(&f, "" FILE_NAME, "r");
|
fopen_s(&f, "..\\" FILE_NAME, "r");
|
||||||
|
if (!f)
|
||||||
|
{
|
||||||
|
fopen_s(&f, "" FILE_NAME, "r");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (f)
|
if (f)
|
||||||
|
@ -10,49 +10,47 @@ int WINAPI wWinMain(
|
|||||||
_In_ int nShowCmd
|
_In_ int nShowCmd
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
WCHAR wszPath[MAX_PATH];
|
if (__argc < 3)
|
||||||
GetModuleFileNameW(GetModuleHandle(NULL), wszPath, MAX_PATH);
|
{
|
||||||
PathRemoveFileSpecW(wszPath);
|
return __LINE__;
|
||||||
wcscat_s(wszPath, MAX_PATH, L"\\" _T(PRODUCT_NAME) L".amd64.dll");
|
}
|
||||||
HMODULE hModule = LoadLibraryExW(wszPath, NULL, LOAD_LIBRARY_AS_DATAFILE);
|
|
||||||
|
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];
|
CHAR hash[100];
|
||||||
ZeroMemory(hash, 100);
|
ZeroMemory(hash, 100);
|
||||||
if (__argc > 1)
|
ComputeFileHash2(hModule, wszMainModulePath, hash, 100);
|
||||||
{
|
|
||||||
for (size_t i = 0; i < MIN(wcslen(__wargv[1]), 32); ++i)
|
|
||||||
{
|
|
||||||
hash[i] = __wargv[1][i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ComputeFileHash2(hModule, wszPath, hash, 100);
|
|
||||||
FreeLibrary(hModule);
|
|
||||||
}
|
|
||||||
|
|
||||||
PathRemoveFileSpecW(wszPath);
|
FreeLibrary(hModule);
|
||||||
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)
|
if (hFile == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
return 1;
|
return __LINE__;
|
||||||
}
|
}
|
||||||
|
|
||||||
HANDLE hFileMapping = CreateFileMappingW(hFile, NULL, PAGE_READWRITE, 0, 0, NULL);
|
HANDLE hFileMapping = CreateFileMappingW(hFile, NULL, PAGE_READWRITE, 0, 0, NULL);
|
||||||
if (hFileMapping == 0)
|
if (!hFileMapping)
|
||||||
{
|
{
|
||||||
CloseHandle(hFile);
|
CloseHandle(hFile);
|
||||||
return 2;
|
return __LINE__;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* lpFileBase = MapViewOfFile(hFileMapping, FILE_MAP_ALL_ACCESS, 0, 0, 0);
|
char* lpFileBase = MapViewOfFile(hFileMapping, FILE_MAP_ALL_ACCESS, 0, 0, 0);
|
||||||
if (lpFileBase == 0)
|
if (!lpFileBase)
|
||||||
{
|
{
|
||||||
CloseHandle(hFileMapping);
|
CloseHandle(hFileMapping);
|
||||||
CloseHandle(hFile);
|
CloseHandle(hFile);
|
||||||
return 3;
|
return __LINE__;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(lpFileBase + DOSMODE_OFFSET, hash, strlen(hash));
|
memcpy(lpFileBase + DOSMODE_OFFSET, hash, strlen(hash));
|
||||||
@ -61,27 +59,5 @@ int WINAPI wWinMain(
|
|||||||
CloseHandle(hFileMapping);
|
CloseHandle(hFileMapping);
|
||||||
CloseHandle(hFile);
|
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;
|
return 0;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user