Add autonomous webhooks and dynamic WebView discovery
This commit is contained in:
1 parent
ab69f287b6
commit
97f874d183
29 files changed
+3044
-1489
No files matched your search
@@ -6,6 +6,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <wchar.h>
|
||||
#include "core_discovery.h"
|
||||
struct Packet { volatile LONG state; LONG hr; DWORD thread; DWORD reserved;
|
||||
wchar_t script[8192]; wchar_t result[32768]; };
|
||||
static const UINT Wake = WM_APP + 0x497;
|
||||
@@ -25,6 +26,8 @@ static void fail(HRESULT hr) { clearAsync();packet->hr=hr;InterlockedExchange(&p
|
||||
static HRESULT findCore() {
|
||||
auto module=(uintptr_t)GetModuleHandleW(L"Microsoft.Web.WebView2.Core.dll");
|
||||
if(!module)return HRESULT_FROM_WIN32(ERROR_MOD_NOT_FOUND);
|
||||
CoreLayout layout{};
|
||||
if(!discoverCoreLayout(module,layout))return HRESULT_FROM_WIN32(ERROR_REVISION_MISMATCH);
|
||||
MEMORY_BASIC_INFORMATION mbi;
|
||||
uintptr_t address=0,scanned=0;
|
||||
while(VirtualQuery((void*)address,&mbi,sizeof(mbi))) {
|
||||
@@ -36,11 +39,11 @@ static HRESULT findCore() {
|
||||
if(scanned+mbi.RegionSize>256*1024*1024)break;
|
||||
scanned+=mbi.RegionSize;
|
||||
for(uintptr_t p=(uintptr_t)mbi.BaseAddress;p+0x118<=end;p+=8) {
|
||||
if(*(uintptr_t*)p!=module+0xa6ef0 || *(uintptr_t*)(p+0x108)!=module+0xa6eb0)continue;
|
||||
if(table((void*)p)[0]!=(void*)(module+0x5ac50))continue;
|
||||
if(*(uintptr_t*)p!=layout.primary || *(uintptr_t*)(p+0x108)!=layout.secondary)continue;
|
||||
if(table((void*)p)[0]!=(void*)(layout.query))continue;
|
||||
auto hr=((IUnknown*)p)->QueryInterface(CoreIID,(void**)&core);
|
||||
if(FAILED(hr))continue;
|
||||
if(table(core)[49]!=(void*)(module+0x59060)) { core->Release();core=nullptr;continue; }
|
||||
if(!supportedExecute(table(core)[49])) { core->Release();core=nullptr;continue; }
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user