50 lines
1.5 KiB
Python
50 lines
1.5 KiB
Python
"""Exact-build layouts. New layouts stay read-only until real send/receipt validation."""
|
||
from dataclasses import dataclass
|
||
|
||
|
||
@dataclass(frozen=True)
|
||
class NativeBuild:
|
||
version: str
|
||
sha256: str
|
||
service_root: int
|
||
message_vtable: int
|
||
login_vtable: int
|
||
factory: int
|
||
send: int
|
||
release: int
|
||
send_stub: str
|
||
send_argument_bytes: int
|
||
verified: bool
|
||
adapter_revision: str = "original-text-v1"
|
||
|
||
@property
|
||
def adapter_id(self):
|
||
return f"wxwork-{self.version}-x86"
|
||
|
||
|
||
# Addresses use the PE preferred base 0x400000; runtime rebasing happens in NativeClient.
|
||
BUILDS = (
|
||
NativeBuild("5.0.10.6023", "47b5dfafc8def0b41a648610f1ba08bbf15f710c6f81c08d36c485bd82ce2842",
|
||
0xf7fb57c, 0xb936800, 0xb92c530, 0x818e560, 0x966c1f0, 0x656340,
|
||
"send", 12, True),
|
||
NativeBuild("5.0.11.6018", "ca7280999c0ae011bf2fac296c24f796595f3558df784edc50dd3f9a6edac5d9",
|
||
0xfe3c444, 0xbe21a84, 0xbe1730c, 0x8545200, 0x9a5f400, 0x66c5a0,
|
||
"send_with_options", 16, False),
|
||
)
|
||
|
||
|
||
def build_for_hash(digest):
|
||
return next((build for build in BUILDS if build.sha256 == digest), None)
|
||
|
||
|
||
def build_for_version(version):
|
||
return next((build for build in BUILDS if build.version == version), None)
|
||
|
||
|
||
def verified_adapter(adapter_id):
|
||
return any(build.adapter_id == adapter_id and build.verified for build in BUILDS)
|
||
|
||
|
||
def client_support_text():
|
||
return ";".join(f"{build.version} x86({'已实测' if build.verified else '首次发送验证后启用'})" for build in BUILDS)
|