ACE boundary for the native Linux client
Mechanically translating the retained ACE library is preferable to rebuilding its C++ ABI with ad hoc adapters. The current constructor failure is small, but AO imports 133 distinct ACE exports across 11 modules, including virtual interfaces, message queues, task/thread management, sockets and reactor logic. Low-level Windows synchronization, socket and thread facilities should remain the facade boundary. A modern host ACE library cannot directly receive these 32-bit guest objects and vtables.
This report is static analysis, not a successful ACE/Linux runtime test. No game or vendor binary was modified. No runtime adapter was added here.
Identity and reproducible scope
Target: anarchy-runtime-14.9.1/ace.dll, x86 PE, 1,171,456 bytes,
preferred image base 0x10000000, entry RVA 0xa3760, SHA-256
a1a0d96a5ff605f6611b8584204dad855914b1cbeedc0389f3a68279e015c22d.
Import/export metadata comes from
local/client/game-14.9.1/inventory.json.
The image has 5,397 exports and 304 imports.
REA used Ghidra 12.1.4 in an ephemeral source-immutable session, then closed it.
Exported version functions establish major 5, minor 0, beta 14: this is the binary's reported ACE 5.0.14 version. Compiler version functions report 6.0.0. This identifies an upstream starting point, not proof that Funcom shipped an unmodified upstream build.
| Version entry | Result | REA assembly evidence |
|---|---|---|
ACE::major_version, 0x1000b180 |
5 | ev_d452e14e9619e8982d4592c572aace8e1dd764eb393dadacf2f0c217ee027b78 |
ACE::minor_version, 0x100913b0 |
0 | ev_f96d5ca95ecb4a7e5e66523b87ed137563ed04e033575c4bb5088ff7e0e2a545 |
ACE::beta_version, 0x1000b190 |
14 | ev_3d6725e1000e5998203c1a06a0d78b166f4b3ad48bc13a6cdf27115bad0b24ac |
ACE::compiler_major_version, 0x1000b1b0 |
6 | ev_9f7c452a6a811eb6541b5569418d097c089be9f879e6609092d605a35fa96cb5 |
The investigation used open_binary with the exact path, search_procedures
for ACE_Token::, ACE_Recursive_Thread_Mutex::, ACE_OS::cond_init,
ACE_OS::sema_wait, ACE_OS_Object_Manager::init, and focused
procedure_pseudo_code/procedure_assembly queries at the addresses below.
All addresses are the vendor preferred-base addresses, before any port relocation.
First observed AO call site
client/game/er.dll/lifted-0001.c, sub_2E004910, passes two null arguments
and ECX=0x2e01b1a0 to IAT slot 0x2e0121c0:
??0ACE_Token@@QAE@PBDPAX@Z
sub_2E004920 registers sub_2E004930 as exit cleanup. That cleanup calls
the token destructor through IAT 0x2e0121c8, guarded by a byte flag.
The source confirms the token occupies guest static storage, so a native
pointer-sized replacement object cannot be placed there.
Token layout and construction
Constructor 0x1008fa90 is x86 thiscall: ECX is this, stack arguments are
name and attributes, return value is this in EAX, and ret 8 pops arguments.
Observed fields cover 0x48 bytes. Field names below are inferred from access
patterns; offsets and values are observed in assembly.
| Offset | Width | Meaning and initial value |
|---|---|---|
0x00 |
4 | Vtable pointer 0x100afdc0 |
0x04, 0x08 |
4 each | Writer wait-queue head/tail, zero |
0x0c, 0x10 |
4 each | Reader wait-queue head/tail, zero |
0x14 |
24 | Embedded Win32 critical section |
0x2c |
4 | Recursive-mutex removed flag, zero |
0x30 |
4 | Owner thread ID, copied from ACE_OS::NULL_thread at 0x1010e900 |
0x34 |
4 | Ownership mode, zero; 1 reader / 2 writer on acquisition |
0x38 |
4 | Number of waiting threads, zero |
0x3c |
4 | Recursive acquisition depth beyond first ownership, zero |
0x40 |
4 | Broadcast/wakeup state, zero |
0x44 |
4 | Condition attribute, initialized to 1 |
The embedded recursive-mutex constructor 0x10087e50 sets its +0x18 removed
flag to zero and calls InitializeCriticalSection(this). In this Windows
build it ignores the name/attributes arguments. condattr_init at 0x10057a60
only writes the provided integer and returns zero. Thus the token constructor
itself needs only InitializeCriticalSection, in addition to supported guest
memory, dispatch, and exception registration. This does not cover ACE's own
module initialization.
Destructor 0x1008fb70 restores the vtable, calls condattr_destroy on +0x44,
then destroys the embedded recursive mutex. condattr_destroy is a genuine
zero-return function at 0x100913b0. Ghidra labels this shared address with an
unrelated alias (ACE_Token_Collection::clone); its export list and assembly
are authoritative. The recursive-mutex destructor marks removed=1 and calls
DeleteCriticalSection only once.
Evidence:
- Token constructor:
ev_140353e6eae1a5cee85bcf9335a8fe1d9da40e59f093036616fb1b5013222e82. - Recursive mutex constructor:
ev_a3c8f7a265a235fdd5a71058d1db402583343926a2a3353c7f18635b455315c7. - Condition attributes:
ev_0dc5f7c60b10c0031923e401bcec038a8952108080639fb03897cea6709ea843. - Token destructor:
ev_c985e8f7d386b0c8315dfd4d2887a901fea26459458b9427bc6f54b710822d92. - Recursive mutex destructor:
ev_520957aa76d637288d190b5edd1fa346412de17b50079692ed0a7289b0d55f69.
Acquisition, waiting and release
ACE_Token::acquire(time) at 0x1008ff80 calls shared_acquire with null
hook/argument and writer mode 2. shared_acquire at 0x1008fbd0 takes four
stack arguments and returns with ret 16.
- Enter the embedded critical section and read GetCurrentThreadId.
- If unowned, set mode/owner and return 0. If the same thread already owns it, increment recursion depth and return 0.
- If another owner holds it and the supplied time value is exactly zero, set guest errno to 121 and return -1.
- Otherwise construct a semaphore with count 0 and maximum
0x7fffffff, append a stack-resident waiter to the reader or writer queue, increment the waiter count, and invoke the supplied cdecl callback or virtual sleep_hook. The base sleep_hook is a genuine empty return, at0x10042970. - Leave the critical section while waiting. A null deadline waits forever; a supplied ACE_Time_Value is interpreted as an absolute deadline. Reenter the critical section, check ownership, and handle interrupted, timed-out or failed waits. Remove the waiter before leaving the function.
The waiter carries next pointer at +0, thread ID at +4, semaphore handle at +8, semaphore removed flag at +12 and runnable flag at +16. This structure is on the acquiring thread's guest stack. It must stay alive and remain addressable while that thread waits.
release at 0x10090300 decrements recursive depth when nonzero. Otherwise
it clears ownership and chooses a writer waiter before a reader waiter,
marks the selected waiter runnable, calls ReleaseSemaphore(handle,1,NULL),
and transfers owner ID. Empty queues reset broadcast state. All of this is
protected by the critical section. Wakeups and acquisition return values
are meaningful; treating synchronization as successful no-ops would break it.
The timed semaphore wait uses GetSystemTimeAsFileTime, converts to
ACE_Time_Value, subtracts current time from the absolute deadline, truncates remaining
microseconds to milliseconds, and calls WaitForSingleObject. WAIT_TIMEOUT
maps to guest errno 121. On success it updates the supplied time value to
the current time. Infinite waits use 0xffffffff. Failed waits obtain
GetLastError. Semaphore cleanup closes the handle.
Supplemental assembly check with the bundled llvm-objdump.exe -d --start-address=0x10086020 --stop-address=0x10086070 confirms the semaphore
destructor sets its removed flag and calls IAT 0x100ac198 (CloseHandle).
Failure stores GetLastError into guest errno. This corrects another shared
function alias: Ghidra's caller pseudocode names the same destructor ACE_Event.
Evidence:
- Acquire wrapper:
ev_255732010e47144940b8f4804931ce6011abd8c9ab6842969efe51ea876f29a1. - Shared acquire assembly:
ev_cf73f6dd6253897974d4995104030047c02e7c3c05ed7d150415886c6fca96b5. - Release:
ev_60c6f0462b8d504cac462203393975c8fef26a9fcae352a963c07df0a07644fd. - Queue insertion:
ev_c488306efa83882fc8cc178d7f81e0e49c2aa6fbce4a7306822875be11464e52. - Semaphore construction:
ev_673e2938e5c07b7edf2e7c48fff540f67f40559b61af3e7158947a6dbcf7979e. - Timed wait:
ev_0f37285f6b0269039e384d16e763a5152f5aa257da592785ed8de9ae206d7f27. - Infinite wait:
ev_f41825ce1485e5c7ddc5f33270988846b062df00533acd6817ddb3b9a02816b7. - Base sleep hook:
ev_e0ac1df7af3e6a17e235a57cc0095930953a718c9d45158b8da4a70a577e4a3b.
Ghidra's shared_acquire pseudocode conflates stack locals and some parameter names after complex control flow. Assembly confirms the behavior summarized above; that pseudocode is not suitable for direct handwritten transplantation. The full contention state machine has not been differentially executed here.
Additional early platform boundaries
ACE_OS::cond_init (0x10057c10, short-attribute overload) initializes a
0x28-byte condition object: waiter count at 0, critical section at 4,
semaphore handle at 0x1c, auto-reset event handle at 0x20, broadcast flag
at 0x24. It calls CreateSemaphoreA, InitializeCriticalSection and
CreateEventA(NULL,FALSE,FALSE,NULL). Failure paths translate GetLastError
into guest errno. Evidence:
ev_34610444d4a23c7503cf7fdb72e341a8539182dd67aa672fdd99edfa94a9ce78.
ACE_OS_Object_Manager::init (0x10058a70) allocates three 24-byte critical
sections for the singleton, initializes Winsock with WSAStartup(2,&data),
installs an exit hook, allocates a four-byte state cell, and obtains
GetVersionExA data with size 0x94. Evidence:
ev_b0d1a162623d9dd1545e039e3db6f714ca2d5b1e34c8a925e7167be1a62a97fd.
ACE_Object_Manager::init (0x10051fd0) initializes the OS manager,
allocates a signal adapter, a read/write mutex and many recursive mutexes,
registers service descriptors and initializes thread-local ACE logging.
Evidence: ev_7e4c722db38ddd148be5228a4f1d91acfe290c1daf42e25c3c3b6ecd503a3143.
This establishes likely early dependencies, not the exact complete DllMain
constructor execution order; that must be established by the translated run.
First practical facade requirements are therefore guest-aware recursive critical sections; semaphore/event/handle lifecycle and waits; thread IDs, thread-local errno and TLS; FILETIME clock conversion; WSAStartup and socket ABI; OS version data; allocation; exit callbacks; and real guest callback dispatch. A host mutex must live outside the fixed 24-byte guest storage, keyed by guest address. A 64-bit pthread mutex cannot simply be copied there. Each guest execution thread also needs independent registers, stack, FS/TIB and exception state before ACE task threads can safely run concurrently.
AO import breadth and recommendation
| Module | ACE imports |
|---|---|
| bbr.dll | 1 |
| Clientr.exe | 8 |
| ddr.dll | 24 |
| er.dll | 54 |
| ffr.dll | 70 |
| hhr.dll | 9 |
| kkr.dll | 3 |
| llr.dll | 8 |
| nr.dll | 7 |
| ppr.dll | 78 |
| sr.dll | 4 |
The 133 unique symbols include ACE_Token and condition methods, thread/task activation and wait, activation queues and method requests, message/data blocks with reference counts, ACE_Reactor, ACE_Event_Handler virtual methods, socket connection/send/receive/address helpers, allocator singleton, time values, object managers, logging and TLS helpers. Several imports are vtables or exported data, so function-name wrappers alone are incomplete.
The vendor imports KERNEL32, MSVCRT, MSVCP60, WS2_32, MSWSOCK, USER32 and ADVAPI32. The inventory includes IO completion ports, overlapped socket APIs, registry/service/process helpers and window-message waits. These are library capabilities, not proof AO uses every path. Implement and validate reached facades while leaving unsupported paths explicit; do not fabricate successful registry, service, networking or synchronization results.
Recommended next step: translate the exact ACE image, preserving guest object layout, data, vtables, initialization and exception metadata. Resolve its low-level imports through the same host facade used by the game and translated MSVCP60. Keep untranslated native ACE out of Linux execution. A future native ACE source rebuild would still need an explicit guest ABI bridge and evidence that the old semantics and potential vendor changes were preserved.
Suggested validation after lifting: compare constructor/dtor state with the real Windows DLL; test recursive acquire/release and zero-deadline failure; then use controlled two-thread tests for blocking, wakeup, timeout and cleanup. Normalize opaque handles and thread IDs when comparing, but inspect guest queue pointers, counters, errno and callback order. No such runtime checks were performed by this investigation.
Compact-switch data classification
The source generator found two bounded byte tables that speculative instruction discovery had also decoded. REA independently confirms they feed compact switches, rather than being executable paths:
0x10004510: subtract 3 from the error code, compare with0x4d, branch above the range, read DL from0x100045a4 + EAX, and jump through0x10004590 + EDX*4. The five case labels are0x10004553,0x10004561,0x1000456f,0x1000457d,0x10004585. Evidence:ev_65ee5277c2587a1235f17e387c92b20584acf799026809d042aef0d1d78aeb48.0x10004640: the same bound, byte lookup at0x100046fcinto CL and jump through0x100046e8 + ECX*4. Case labels are0x100046aa,0x100046b9,0x100046c8,0x100046d7,0x100046df. Evidence:ev_9d7fd9d1d0887e9e0e05d72b7bdfe511dfab57e5359f868357001e8d007bcaf7.
Both byte tables are 78 bytes containing indices 0 through 4. The extractor
verifies the bound, indexed jump, data-only jump table and case destinations
before accepting an incidental decode overlap. test_vendor_data.py checks
the original image and rejects a mutated case destination inside the byte table.