diff --git a/platform/amactivator.c b/platform/amactivator.c index 20216f6..f9ebfdb 100644 --- a/platform/amactivator.c +++ b/platform/amactivator.c @@ -12,40 +12,40 @@ HANDLE amactivator_handle; static HANDLE my_AMActivator_Create(); -static uint64_t my_AMActivator_SetUSBSerialID(HANDLE amactivator, char* serial); -static uint64_t my_AMActivator_SetUSBProductID(HANDLE amactivator, char* product_id); -static uint64_t my_AMActivator_SetUSBVendorID(HANDLE amactivator, char* vendor_id); -static uint64_t my_AMActivator_SetUSBBitLockerPassword(HANDLE amactivator, char* password); -/*static uint64_t my_AMActivator_SetDevelopmentMode(); -static uint64_t my_AMActivator_BitLockerUnlock(); -static uint64_t my_AMActivator_RequestSignature(); -static uint64_t my_AMActivator_Update(); -static uint64_t my_AMActivator_IsBusy(); -static uint64_t my_AMActivator_RequestOneTimeKey(); -static uint64_t my_AMActivator_Restore(); -static uint64_t my_AMActivator_GetSignatureGeneration(); -static uint64_t my_AMActivator_GetSignatureLastStatus(); -static uint64_t my_AMActivator_GetOneTimeKey(); -static uint64_t my_AMActivator_GetOneTimeKeyExpiration(); -static uint64_t my_AMActivator_GetOneTimeKeyLastStatus();*/ +static uint64_t my_AMActivator_SetUSBSerialID(HANDLE amactivator, char* serial, size_t len); +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, size_t len); +static uint64_t my_AMActivator_SetUSBBitLockerPassword(HANDLE amactivator, char* password, size_t len); +static void my_AMActivator_SetDevelopmentMode(HANDLE amactivator); +static bool my_AMActivator_BitLockerUnlock(HANDLE amactivator); +static bool my_AMActivator_RequestSignature(HANDLE amactivator); +static void my_AMActivator_Update(HANDLE amactivator); +static bool my_AMActivator_IsBusy(HANDLE amactivator); +static bool my_AMActivator_RequestOneTimeKey(HANDLE amactivator); +static bool my_AMActivator_Restore(HANDLE amactivator); +static int my_AMActivator_GetSignatureGeneration(HANDLE amactivator); +static int my_AMActivator_GetSignatureLastStatus(HANDLE amactivator); +static int my_AMActivator_GetOneTimeKey(HANDLE amactivator); +static int my_AMActivator_GetOneTimeKeyExpiration(HANDLE amactivator); +static int my_AMActivator_GetOneTimeKeyLastStatus(HANDLE amactivator); static HANDLE (*next_AMActivator_Create)(); -static uint64_t (*next_AMActivator_SetUSBSerialID)(HANDLE amactivator, char* serial); -static uint64_t (*next_AMActivator_SetUSBProductID)(HANDLE amactivator, char* product_id); -static uint64_t (*next_AMActivator_SetUSBVendorID)(HANDLE amactivator, char* vendor_id); -static uint64_t (*next_AMActivator_SetUSBBitLockerPassword)(HANDLE amactivator, char* password); -/*static uint64_t (*next_AMActivator_SetDevelopmentMode)(); -static uint64_t (*next_AMActivator_BitLockerUnlock)(); -static uint64_t (*next_AMActivator_RequestSignature)(); -static uint64_t (*next_AMActivator_Update)(); -static uint64_t (*next_AMActivator_IsBusy)(); -static uint64_t (*next_AMActivator_RequestOneTimeKey)(); -static uint64_t (*next_AMActivator_Restore)(); -static uint64_t (*next_AMActivator_GetSignatureGeneration)(); -static uint64_t (*next_AMActivator_GetSignatureLastStatus)(); -static uint64_t (*next_AMActivator_GetOneTimeKey)(); -static uint64_t (*next_AMActivator_GetOneTimeKeyExpiration)(); -static uint64_t (*next_AMActivator_GetOneTimeKeyLastStatus)();*/ +static uint64_t (*next_AMActivator_SetUSBSerialID)(HANDLE amactivator, char* serial, size_t len); +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, size_t len); +static uint64_t (*next_AMActivator_SetUSBBitLockerPassword)(HANDLE amactivator, char* password, size_t len); +static void (*next_AMActivator_SetDevelopmentMode)(HANDLE amactivator); +static bool (*next_AMActivator_BitLockerUnlock)(HANDLE amactivator); +static bool (*next_AMActivator_RequestSignature)(HANDLE amactivator); +static void (*next_AMActivator_Update)(HANDLE amactivator); +static bool (*next_AMActivator_IsBusy)(HANDLE amactivator); +static bool (*next_AMActivator_RequestOneTimeKey)(HANDLE amactivator); +static bool (*next_AMActivator_Restore)(HANDLE amactivator); +static int (*next_AMActivator_GetSignatureGeneration)(HANDLE amactivator); +static int (*next_AMActivator_GetSignatureLastStatus)(HANDLE amactivator); +static int (*next_AMActivator_GetOneTimeKey)(HANDLE amactivator); +static int (*next_AMActivator_GetOneTimeKeyExpiration)(HANDLE amactivator); +static int (*next_AMActivator_GetOneTimeKeyLastStatus)(HANDLE amactivator); static const struct hook_symbol activator_syms[] = { { @@ -72,7 +72,7 @@ static const struct hook_symbol activator_syms[] = { .name = "AMActivator_SetUSBBitLockerPassword", .patch = my_AMActivator_SetUSBBitLockerPassword, .link = (void **) &next_AMActivator_SetUSBBitLockerPassword, - }/*, + }, { .name = "AMActivator_SetDevelopmentMode", .patch = my_AMActivator_SetDevelopmentMode, @@ -132,7 +132,7 @@ static const struct hook_symbol activator_syms[] = { .name = "AMActivator_GetOneTimeKeyLastStatus", .patch = my_AMActivator_GetOneTimeKeyLastStatus, .link = (void **) &next_AMActivator_GetOneTimeKeyLastStatus, - }*/ + } }; 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() { dprintf("AMActivator: Create\n"); - amactivator_handle = next_AMActivator_Create(); + amactivator_handle = (HANDLE)malloc(0x3E8); 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); //return next_AMActivator_SetUSBSerialID(amactivator, serial); 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); - 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); - 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); - 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; } diff --git a/platform/amactivator.h b/platform/amactivator.h index f7f84da..b1c5876 100644 --- a/platform/amactivator.h +++ b/platform/amactivator.h @@ -7,6 +7,7 @@ struct amactivator_config { bool enable; + const char auth_file[MAX_PATH]; }; HRESULT amactivator_hook_init(const struct amactivator_config* cfg, const struct es3sec_config* dong_cfg);