Last active
April 15, 2025 12:33
-
-
Save R0rt1z2/18527278b9bd41711d3b77af20135828 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int fastboot_oem_unlock(char *arg, void *data, uint sz) | |
{ | |
bool bVar1; | |
int ret; | |
char *error; | |
char *str; | |
uint unlock_allowed; | |
char acStack_90[127]; | |
undefined local_11; | |
str = acStack_90; | |
FUN_4c43ba90(str, 0, 0x80); | |
unlock_allowed = 0; | |
show_unlock_warning(); | |
ret = is_secure(); | |
if (ret == 0) { | |
fastboot_info("Start unlock flow\n"); | |
ret = fastboot_get_unlock_perm(&unlock_allowed); | |
if (ret != 0) { | |
ret = | |
sprintf(str, (char *)0x80, | |
"\nFailed to get unlock permission - Err:0x%x\n", ret); | |
if (ret < 0) { | |
error = "Unknown error\n"; | |
} else { | |
local_11 = 0; | |
error = str; | |
} | |
video_printf("Unlock failed...return to fastboot in 3s\n"); | |
mdelay(3000); | |
fastboot_boot_menu(); | |
fastboot_fail(error); | |
} | |
dprintf("unlock_allowed = 0x%x\n", unlock_allowed); | |
if (unlock_allowed == 0) { | |
ret = sprintf(str, (char *)0x80, | |
"\nUnlock operation is not allowed\n"); | |
if (ret < 0) { | |
error = "Unknown error\n"; | |
} else { | |
local_11 = 0; | |
error = str; | |
} | |
video_printf("Unlock failed...return to fastboot in 3s\n"); | |
mdelay(3000); | |
fastboot_boot_menu(); | |
fastboot_fail(error); | |
} | |
ret = fastboot_oem_unlock_chk(); | |
if (ret == 0) { | |
LAB_4c4378a8: | |
video_printf("Unlock Pass...return to fastboot in 3s\n"); | |
mdelay(3000); | |
fastboot_boot_menu(); | |
ret = fastboot_okay(""); | |
return ret; | |
} | |
ret = sprintf(str, (char *)0x80, "\nUnlock failed - Err:0x%x\n", ret); | |
if (ret < 0) { | |
str = "Unknown error\n"; | |
} else { | |
local_11 = 0; | |
} | |
} else { | |
while (bVar1 = mtk_detect_key(_DAT_4c5a7e30), !bVar1) { | |
bVar1 = mtk_detect_key(_DAT_4c5a7e34); | |
if (bVar1) { | |
video_printf("return to fastboot in 3s\n"); | |
mdelay(3000); | |
fastboot_boot_menu(); | |
ret = fastboot_okay(""); | |
return ret; | |
} | |
} | |
fastboot_info("Start unlock flow\n"); | |
ret = is_secure(); | |
if (ret == 1) { | |
ret = process_unlock_key(); | |
if (ret != 0) { | |
ret = fastboot_info("fastboot unlcok fail"); | |
return ret; | |
} | |
fastboot_info("fastboot unlock success"); | |
} | |
ret = fastboot_get_unlock_perm(&unlock_allowed); | |
if (ret == 0) { | |
dprintf("unlock_allowed = 0x%x\n", unlock_allowed); | |
if (unlock_allowed == 0) { | |
ret = sprintf(str, (char *)0x80, | |
"\nUnlock operation is not allowed\n"); | |
if (ret < 0) { | |
str = "Unknown error\n"; | |
} else { | |
local_11 = 0; | |
} | |
} else { | |
ret = fastboot_oem_unlock_chk(); | |
if (ret == 0) | |
goto LAB_4c4378a8; | |
ret = sprintf(str, (char *)0x80, "\nUnlock failed - Err:0x%x\n", | |
ret); | |
if (ret < 0) { | |
str = "Unknown error\n"; | |
} else { | |
local_11 = 0; | |
} | |
} | |
} else { | |
ret = | |
sprintf(str, (char *)0x80, | |
"\nFailed to get unlock permission - Err:0x%x\n", ret); | |
if (ret < 0) { | |
str = "Unknown error\n"; | |
} else { | |
local_11 = 0; | |
} | |
} | |
} | |
video_printf("Unlock failed...return to fastboot in 3s\n"); | |
mdelay(3000); | |
fastboot_boot_menu(); | |
ret = fastboot_fail(str); | |
return ret; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment