amactivator stub

This commit is contained in:
2025-03-30 04:29:56 -04:00
parent 8799fc8c22
commit 66ed98f44f
2 changed files with 106 additions and 42 deletions

View File

@ -12,40 +12,40 @@
HANDLE amactivator_handle; HANDLE amactivator_handle;
static HANDLE my_AMActivator_Create(); static HANDLE my_AMActivator_Create();
static uint64_t my_AMActivator_SetUSBSerialID(HANDLE amactivator, char* serial); static uint64_t my_AMActivator_SetUSBSerialID(HANDLE amactivator, char* serial, size_t len);
static uint64_t my_AMActivator_SetUSBProductID(HANDLE amactivator, char* product_id); static uint64_t my_AMActivator_SetUSBProductID(HANDLE amactivator, char* product_id, size_t len);
static uint64_t my_AMActivator_SetUSBVendorID(HANDLE amactivator, char* vendor_id); static uint64_t my_AMActivator_SetUSBVendorID(HANDLE amactivator, char* vendor_id, size_t len);
static uint64_t my_AMActivator_SetUSBBitLockerPassword(HANDLE amactivator, char* password); static uint64_t my_AMActivator_SetUSBBitLockerPassword(HANDLE amactivator, char* password, size_t len);
/*static uint64_t my_AMActivator_SetDevelopmentMode(); static void my_AMActivator_SetDevelopmentMode(HANDLE amactivator);
static uint64_t my_AMActivator_BitLockerUnlock(); static bool my_AMActivator_BitLockerUnlock(HANDLE amactivator);
static uint64_t my_AMActivator_RequestSignature(); static bool my_AMActivator_RequestSignature(HANDLE amactivator);
static uint64_t my_AMActivator_Update(); static void my_AMActivator_Update(HANDLE amactivator);
static uint64_t my_AMActivator_IsBusy(); static bool my_AMActivator_IsBusy(HANDLE amactivator);
static uint64_t my_AMActivator_RequestOneTimeKey(); static bool my_AMActivator_RequestOneTimeKey(HANDLE amactivator);
static uint64_t my_AMActivator_Restore(); static bool my_AMActivator_Restore(HANDLE amactivator);
static uint64_t my_AMActivator_GetSignatureGeneration(); static int my_AMActivator_GetSignatureGeneration(HANDLE amactivator);
static uint64_t my_AMActivator_GetSignatureLastStatus(); static int my_AMActivator_GetSignatureLastStatus(HANDLE amactivator);
static uint64_t my_AMActivator_GetOneTimeKey(); static int my_AMActivator_GetOneTimeKey(HANDLE amactivator);
static uint64_t my_AMActivator_GetOneTimeKeyExpiration(); static int my_AMActivator_GetOneTimeKeyExpiration(HANDLE amactivator);
static uint64_t my_AMActivator_GetOneTimeKeyLastStatus();*/ static int my_AMActivator_GetOneTimeKeyLastStatus(HANDLE amactivator);
static HANDLE (*next_AMActivator_Create)(); static HANDLE (*next_AMActivator_Create)();
static uint64_t (*next_AMActivator_SetUSBSerialID)(HANDLE amactivator, char* serial); static uint64_t (*next_AMActivator_SetUSBSerialID)(HANDLE amactivator, char* serial, size_t len);
static uint64_t (*next_AMActivator_SetUSBProductID)(HANDLE amactivator, char* product_id); static uint64_t (*next_AMActivator_SetUSBProductID)(HANDLE amactivator, char* product_id, size_t len);
static uint64_t (*next_AMActivator_SetUSBVendorID)(HANDLE amactivator, char* vendor_id); static uint64_t (*next_AMActivator_SetUSBVendorID)(HANDLE amactivator, char* vendor_id, size_t len);
static uint64_t (*next_AMActivator_SetUSBBitLockerPassword)(HANDLE amactivator, char* password); static uint64_t (*next_AMActivator_SetUSBBitLockerPassword)(HANDLE amactivator, char* password, size_t len);
/*static uint64_t (*next_AMActivator_SetDevelopmentMode)(); static void (*next_AMActivator_SetDevelopmentMode)(HANDLE amactivator);
static uint64_t (*next_AMActivator_BitLockerUnlock)(); static bool (*next_AMActivator_BitLockerUnlock)(HANDLE amactivator);
static uint64_t (*next_AMActivator_RequestSignature)(); static bool (*next_AMActivator_RequestSignature)(HANDLE amactivator);
static uint64_t (*next_AMActivator_Update)(); static void (*next_AMActivator_Update)(HANDLE amactivator);
static uint64_t (*next_AMActivator_IsBusy)(); static bool (*next_AMActivator_IsBusy)(HANDLE amactivator);
static uint64_t (*next_AMActivator_RequestOneTimeKey)(); static bool (*next_AMActivator_RequestOneTimeKey)(HANDLE amactivator);
static uint64_t (*next_AMActivator_Restore)(); static bool (*next_AMActivator_Restore)(HANDLE amactivator);
static uint64_t (*next_AMActivator_GetSignatureGeneration)(); static int (*next_AMActivator_GetSignatureGeneration)(HANDLE amactivator);
static uint64_t (*next_AMActivator_GetSignatureLastStatus)(); static int (*next_AMActivator_GetSignatureLastStatus)(HANDLE amactivator);
static uint64_t (*next_AMActivator_GetOneTimeKey)(); static int (*next_AMActivator_GetOneTimeKey)(HANDLE amactivator);
static uint64_t (*next_AMActivator_GetOneTimeKeyExpiration)(); static int (*next_AMActivator_GetOneTimeKeyExpiration)(HANDLE amactivator);
static uint64_t (*next_AMActivator_GetOneTimeKeyLastStatus)();*/ static int (*next_AMActivator_GetOneTimeKeyLastStatus)(HANDLE amactivator);
static const struct hook_symbol activator_syms[] = { static const struct hook_symbol activator_syms[] = {
{ {
@ -72,7 +72,7 @@ static const struct hook_symbol activator_syms[] = {
.name = "AMActivator_SetUSBBitLockerPassword", .name = "AMActivator_SetUSBBitLockerPassword",
.patch = my_AMActivator_SetUSBBitLockerPassword, .patch = my_AMActivator_SetUSBBitLockerPassword,
.link = (void **) &next_AMActivator_SetUSBBitLockerPassword, .link = (void **) &next_AMActivator_SetUSBBitLockerPassword,
}/*, },
{ {
.name = "AMActivator_SetDevelopmentMode", .name = "AMActivator_SetDevelopmentMode",
.patch = my_AMActivator_SetDevelopmentMode, .patch = my_AMActivator_SetDevelopmentMode,
@ -132,7 +132,7 @@ static const struct hook_symbol activator_syms[] = {
.name = "AMActivator_GetOneTimeKeyLastStatus", .name = "AMActivator_GetOneTimeKeyLastStatus",
.patch = my_AMActivator_GetOneTimeKeyLastStatus, .patch = my_AMActivator_GetOneTimeKeyLastStatus,
.link = (void **) &next_AMActivator_GetOneTimeKeyLastStatus, .link = (void **) &next_AMActivator_GetOneTimeKeyLastStatus,
}*/ }
}; };
HRESULT amactivator_hook_init(const struct amactivator_config* cfg, const struct es3sec_config* dong_cfg) { HRESULT amactivator_hook_init(const struct amactivator_config* cfg, const struct es3sec_config* dong_cfg) {
@ -153,27 +153,90 @@ HRESULT amactivator_hook_init(const struct amactivator_config* cfg, const struct
static HANDLE my_AMActivator_Create() { static HANDLE my_AMActivator_Create() {
dprintf("AMActivator: Create\n"); dprintf("AMActivator: Create\n");
amactivator_handle = next_AMActivator_Create(); amactivator_handle = (HANDLE)malloc(0x3E8);
return amactivator_handle; return amactivator_handle;
} }
static uint64_t my_AMActivator_SetUSBSerialID(HANDLE amactivator, char* serial) { static uint64_t my_AMActivator_SetUSBSerialID(HANDLE amactivator, char* serial, size_t len) {
dprintf("AMActivator: SetUSBSerialID %s\n", serial); dprintf("AMActivator: SetUSBSerialID %s\n", serial);
//return next_AMActivator_SetUSBSerialID(amactivator, serial); //return next_AMActivator_SetUSBSerialID(amactivator, serial);
return 0; return 0;
} }
static uint64_t my_AMActivator_SetUSBProductID(HANDLE amactivator, char* product_id) { static uint64_t my_AMActivator_SetUSBProductID(HANDLE amactivator, char* product_id, size_t len) {
dprintf("AMActivator: SetUSBProductID %s\n", product_id); dprintf("AMActivator: SetUSBProductID %s\n", product_id);
return next_AMActivator_SetUSBProductID(amactivator, product_id); //return next_AMActivator_SetUSBProductID(amactivator, product_id);
return 0;
} }
static uint64_t my_AMActivator_SetUSBVendorID(HANDLE amactivator, char* vendor_id) { static uint64_t my_AMActivator_SetUSBVendorID(HANDLE amactivator, char* vendor_id, size_t len) {
dprintf("AMActivator: SetUSBVendorID %s\n", vendor_id); dprintf("AMActivator: SetUSBVendorID %s\n", vendor_id);
return next_AMActivator_SetUSBVendorID(amactivator, vendor_id); //return next_AMActivator_SetUSBVendorID(amactivator, vendor_id);
return 0;
} }
static uint64_t my_AMActivator_SetUSBBitLockerPassword(HANDLE amactivator, char* password) { static uint64_t my_AMActivator_SetUSBBitLockerPassword(HANDLE amactivator, char* password, size_t len) {
dprintf("AMActivator: SetUSBBitLockerPassword %s\n", password); dprintf("AMActivator: SetUSBBitLockerPassword %s\n", password);
return next_AMActivator_SetUSBBitLockerPassword(amactivator, password); //return next_AMActivator_SetUSBBitLockerPassword(amactivator, password);
return 0;
}
static void my_AMActivator_SetDevelopmentMode(HANDLE amactivator)
{
dprintf("AMActivator: Enable Dev mode\n");
}
static bool my_AMActivator_BitLockerUnlock(HANDLE amactivator)
{
return true;
}
static bool my_AMActivator_RequestSignature(HANDLE amactivator)
{
return true;
}
static void my_AMActivator_Update(HANDLE amactivator)
{
return;
}
static bool my_AMActivator_IsBusy(HANDLE amactivator)
{
return false;
}
static bool my_AMActivator_RequestOneTimeKey(HANDLE amactivator)
{
return true;
}
static bool my_AMActivator_Restore(HANDLE amactivator)
{
return true;
}
static int my_AMActivator_GetSignatureGeneration(HANDLE amactivator)
{
return 1;
}
static int my_AMActivator_GetSignatureLastStatus(HANDLE amactivator)
{
return 3;
}
static int my_AMActivator_GetOneTimeKey(HANDLE amactivator)
{
return 99999999;
}
static int my_AMActivator_GetOneTimeKeyExpiration(HANDLE amactivator)
{
return 4294967295;
}
static int my_AMActivator_GetOneTimeKeyLastStatus(HANDLE amactivator)
{
return 3;
} }

View File

@ -7,6 +7,7 @@
struct amactivator_config { struct amactivator_config {
bool enable; bool enable;
const char auth_file[MAX_PATH];
}; };
HRESULT amactivator_hook_init(const struct amactivator_config* cfg, const struct es3sec_config* dong_cfg); HRESULT amactivator_hook_init(const struct amactivator_config* cfg, const struct es3sec_config* dong_cfg);