Last active
July 19, 2020 18:55
-
-
Save GXTX/ab863470e883fc7c7cce7d20a5ab5175 to your computer and use it in GitHub Desktop.
This file contains 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
/* You are required to have killed xbdm.dll "somehow". */ | |
void main(void) | |
{ | |
HANDLE ret; | |
IO_STATUS_BLOCK ioStatusBlock; | |
OBJECT_ATTRIBUTES ObjectAttributes; | |
FILE_BASIC_INFORMATION fileBasicInfo; | |
FILE_NETWORK_OPEN_INFORMATION fileQueryInfo; | |
ANSI_STRING fileName; | |
NTSTATUS status; | |
switch(pb_init()) | |
{ | |
case 0: break; | |
default: | |
XSleep(2000); | |
XReboot(); | |
} | |
pb_show_debug_screen(); | |
debugPrint("Hello NXDK!\n"); | |
RtlInitAnsiString(&fileName, "\\Device\\Harddisk0\\Partition1\\DEVKIT\\xbdm.ini"); | |
InitializeObjectAttributes(&ObjectAttributes, &fileName, OBJ_OPENIF, NULL, NULL); | |
status = NtOpenFile(&ret, FILE_ALL_ACCESS, &ObjectAttributes, &ioStatusBlock, 0, 0); | |
if(!NT_SUCCESS(status)){ | |
debugPrint("Open file fail 0x%08X\n", status); | |
XSleep(10000); | |
pb_kill(); | |
XReboot(); | |
} | |
status = NtQueryInformationFile((void*)ret, &ioStatusBlock, &fileQueryInfo, sizeof(fileQueryInfo), FileNetworkOpenInformation); | |
if(!NT_SUCCESS(status)){ | |
debugPrint("Query file fail 0x%08X\n", status); | |
XSleep(10000); | |
pb_kill(); | |
XReboot(); | |
} | |
fileBasicInfo.CreationTime = fileQueryInfo.CreationTime; | |
fileBasicInfo.LastAccessTime = fileQueryInfo.LastAccessTime; | |
fileBasicInfo.LastWriteTime = fileQueryInfo.LastWriteTime; | |
fileBasicInfo.ChangeTime = fileQueryInfo.ChangeTime; | |
fileBasicInfo.FileAttributes = FILE_ATTRIBUTE_NORMAL; | |
status = NtSetInformationFile((void*)ret, &ioStatusBlock, &fileBasicInfo, sizeof(fileBasicInfo), FileBasicInformation); | |
if(!NT_SUCCESS(status)){ | |
debugPrint("Set file fail 0x%08X\n", status); | |
XSleep(10000); | |
pb_kill(); | |
XReboot(); | |
} | |
debugPrint("Successfully changed attributes!\n"); | |
XSleep(10000); | |
pb_kill(); | |
XReboot(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment