mirror of
https://github.com/valinet/ExplorerPatcher.git
synced 2024-11-23 23:21:08 +01:00
Split twinui.pcshell.dll patches into their own file
This commit is contained in:
parent
ea5881f177
commit
23b44a2f23
@ -4,6 +4,10 @@
|
||||
#include <Windows.h>
|
||||
#include <Shlobj_core.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define OPEN_NAME L"&Open archive"
|
||||
#define EXTRACT_NAME L"&Extract to \"%s\\\""
|
||||
#define OPEN_CMD L"\"C:\\Program Files\\7-Zip\\7zFM.exe\" %s"
|
||||
@ -51,4 +55,8 @@ LRESULT CALLBACK ArchiveMenuWndProc(
|
||||
void(*ImmersiveContextMenuHelper_RemoveOwnerDrawFromMenuFunc)(HMENU hMenu, HWND hWnd)
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -179,42 +179,6 @@ interface IImmersiveLauncher10RS
|
||||
CONST_VTBL struct IImmersiveLauncher10RSVtbl* lpVtbl;
|
||||
};
|
||||
|
||||
DEFINE_GUID(IID_ILauncherTipContextMenu,
|
||||
0xb8c1db5f,
|
||||
0xcbb3, 0x48bc, 0xaf, 0xd9,
|
||||
0xce, 0x6b, 0x88, 0x0c, 0x79, 0xed
|
||||
);
|
||||
|
||||
typedef interface ILauncherTipContextMenu ILauncherTipContextMenu;
|
||||
|
||||
typedef struct ILauncherTipContextMenuVtbl
|
||||
{
|
||||
BEGIN_INTERFACE
|
||||
|
||||
HRESULT(STDMETHODCALLTYPE* QueryInterface)(
|
||||
ILauncherTipContextMenu* This,
|
||||
/* [in] */ REFIID riid,
|
||||
/* [annotation][iid_is][out] */
|
||||
_COM_Outptr_ void** ppvObject);
|
||||
|
||||
ULONG(STDMETHODCALLTYPE* AddRef)(
|
||||
ILauncherTipContextMenu* This);
|
||||
|
||||
ULONG(STDMETHODCALLTYPE* Release)(
|
||||
ILauncherTipContextMenu* This);
|
||||
|
||||
HRESULT(STDMETHODCALLTYPE* ShowLauncherTipContextMenu)(
|
||||
ILauncherTipContextMenu* This,
|
||||
/* [in] */ POINT* pt);
|
||||
|
||||
END_INTERFACE
|
||||
} ILauncherTipContextMenuVtbl;
|
||||
|
||||
interface ILauncherTipContextMenu
|
||||
{
|
||||
CONST_VTBL struct ILauncherTipContextMenuVtbl* lpVtbl;
|
||||
};
|
||||
|
||||
void OpenStartOnMonitor(HMONITOR monitor);
|
||||
|
||||
// Slightly tweaked version of function available in Open Shell
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -275,7 +275,7 @@ BOOL IsUpdateAvailableHelper(
|
||||
jsonStr.c_str(),
|
||||
-1,
|
||||
pszJsonStr,
|
||||
jsonStr.size() + 1
|
||||
(int)(jsonStr.size() + 1)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -406,7 +406,7 @@ inline RM_UNIQUE_PROCESS GetExplorerApplication()
|
||||
DWORD pid = 0;
|
||||
GetWindowThreadProcessId(hwnd, &pid);
|
||||
|
||||
RM_UNIQUE_PROCESS out = { 0, { -1, -1 } };
|
||||
RM_UNIQUE_PROCESS out = { 0, { (DWORD)-1, (DWORD)-1 } };
|
||||
DWORD bytesReturned;
|
||||
WCHAR imageName[MAX_PATH]; // process image name buffer
|
||||
DWORD processIds[2048]; // max 2048 processes (more than enough)
|
||||
@ -604,6 +604,27 @@ inline BOOL IncrementDLLReferenceCount(HINSTANCE hinst)
|
||||
|
||||
PVOID FindPattern(PVOID pBase, SIZE_T dwSize, LPCSTR lpPattern, LPCSTR lpMask);
|
||||
|
||||
#if _M_X64
|
||||
inline BOOL FollowJnz(PBYTE pJnz, PBYTE* pTarget, DWORD* pJnzSize)
|
||||
{
|
||||
// Check big jnz
|
||||
if (pJnz[0] == 0x0F && pJnz[1] == 0x85)
|
||||
{
|
||||
*pTarget = pJnz + 6 + *(int*)(pJnz + 2);
|
||||
*pJnzSize = 6;
|
||||
return TRUE;
|
||||
}
|
||||
// Check small jnz
|
||||
if (pJnz[0] == 0x75)
|
||||
{
|
||||
*pTarget = pJnz + 2 + *(char*)(pJnz + 1);
|
||||
*pJnzSize = 2;
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if _M_ARM64
|
||||
// https://github.com/CAS-Atlantic/AArch64-Encoding
|
||||
|
||||
@ -700,7 +721,7 @@ __forceinline DWORD ARM64_DecodeLDRBIMM(DWORD insnLDRBIMM)
|
||||
inline UINT_PTR ARM64_DecodeADRL(UINT_PTR offset, DWORD insnADRP, DWORD insnADD)
|
||||
{
|
||||
if (!ARM64_IsADRP(insnADRP))
|
||||
return NULL;
|
||||
return 0;
|
||||
|
||||
UINT_PTR page = ARM64_Align(offset, 0x1000);
|
||||
|
||||
@ -857,6 +878,32 @@ inline PVOID FindPattern(PVOID pBase, SIZE_T dwSize, LPCSTR lpPattern, LPCSTR lp
|
||||
return FindPatternHelper(pBase, dwSize, lpPattern, lpMask);
|
||||
}
|
||||
|
||||
inline UINT_PTR FileOffsetToRVA(PBYTE pBase, UINT_PTR offset)
|
||||
{
|
||||
PIMAGE_DOS_HEADER pDosHeader = (PIMAGE_DOS_HEADER)pBase;
|
||||
PIMAGE_NT_HEADERS pNtHeaders = (PIMAGE_NT_HEADERS)(pBase + pDosHeader->e_lfanew);
|
||||
PIMAGE_SECTION_HEADER pSection = IMAGE_FIRST_SECTION(pNtHeaders);
|
||||
for (int i = 0; i < pNtHeaders->FileHeader.NumberOfSections; i++, pSection++)
|
||||
{
|
||||
if (offset >= pSection->PointerToRawData && offset < pSection->PointerToRawData + pSection->SizeOfRawData)
|
||||
return offset - pSection->PointerToRawData + pSection->VirtualAddress;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline UINT_PTR RVAToFileOffset(PBYTE pBase, UINT_PTR rva)
|
||||
{
|
||||
PIMAGE_DOS_HEADER pDosHeader = (PIMAGE_DOS_HEADER)pBase;
|
||||
PIMAGE_NT_HEADERS pNtHeaders = (PIMAGE_NT_HEADERS)(pBase + pDosHeader->e_lfanew);
|
||||
PIMAGE_SECTION_HEADER pSection = IMAGE_FIRST_SECTION(pNtHeaders);
|
||||
for (int i = 0; i < pNtHeaders->FileHeader.NumberOfSections; i++, pSection++)
|
||||
{
|
||||
if (rva >= pSection->VirtualAddress && rva < pSection->VirtualAddress + pSection->Misc.VirtualSize)
|
||||
return rva - pSection->VirtualAddress + pSection->PointerToRawData;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline HMODULE LoadGuiModule()
|
||||
{
|
||||
wchar_t epGuiPath[MAX_PATH];
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 126a8d6d8f0d5dd49f873999a81db5a49d19aae9
|
||||
Subproject commit 6a8b474fa96bfd2a7db40dc37fcae9b80105028c
|
Loading…
Reference in New Issue
Block a user