175 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
24 lines
919 B
C
24 lines
919 B
C
#include "wine_preopen_hook.private.h"
|
|
|
|
int gw_wire_preopen_admit(struct GwWirePreOpenHook *hook, void *owner,
|
|
DWORD thread, HMODULE callback_module) {
|
|
LONG error = 0;
|
|
int callback_result;
|
|
if (!hook || hook->abi != 1 || hook->size != sizeof(*hook)) return 0;
|
|
if (InterlockedCompareExchange(&hook->ready, 1, 1) != 1) error = 1;
|
|
else if (!owner || hook->owner != owner) error = 2;
|
|
else if (!thread || hook->primary_thread != thread) error = 3;
|
|
else if (!callback_module || hook->bridge_module != callback_module) error = 4;
|
|
else if (!hook->callback) error = 5;
|
|
else {
|
|
callback_result = hook->callback(owner);
|
|
if (callback_result == 2) return 2; /* exact transient page, retry */
|
|
if (!callback_result) error = 5;
|
|
}
|
|
if (error) {
|
|
InterlockedCompareExchange(&hook->error, error, 0);
|
|
return 0;
|
|
}
|
|
return 1;
|
|
}
|