Created
January 16, 2020 17:13
-
-
Save thrimbor/0b7990d9d50ce8f5f9306d4cb1f53e8f to your computer and use it in GitHub Desktop.
nxdk winapi file attribute tests
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
#include <hal/debug.h> | |
#include <hal/video.h> | |
#include <windows.h> | |
#include <assert.h> | |
#include <nxdk/mount.h> | |
// WARNING: MODIFIES HDD CONTENT! | |
// Requires stock dash files for testing | |
int main(void) | |
{ | |
XVideoSetMode(640, 480, 32, REFRESH_DEFAULT); | |
nxMountDrive('C', "\\Device\\Harddisk0\\Partition2\\"); | |
assert(!(GetFileAttributesA("C:\\xboxdash.xbe") & FILE_ATTRIBUTE_DIRECTORY)); | |
assert(GetFileAttributesA("C:\\fonts") & FILE_ATTRIBUTE_DIRECTORY); | |
BOOL ret; | |
WIN32_FILE_ATTRIBUTE_DATA fileinfo; | |
ret = GetFileAttributesExA("C:\\xboxdash.xbe", GetFileExInfoStandard, &fileinfo); | |
assert(ret); | |
assert(!(fileinfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)); | |
ret = GetFileAttributesExA("C:\\fonts", GetFileExInfoStandard, &fileinfo); | |
assert(ret); | |
assert(fileinfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY); | |
assert(!(GetFileAttributesA("C:\\xboxdash.xbe") & FILE_ATTRIBUTE_HIDDEN)); | |
ret = SetFileAttributes("C:\\xboxdash.xbe", FILE_ATTRIBUTE_HIDDEN); | |
assert(ret); | |
assert(GetFileAttributesA("C:\\xboxdash.xbe") & FILE_ATTRIBUTE_HIDDEN); | |
ret = SetFileAttributes("C:\\xboxdash.xbe", FILE_ATTRIBUTE_NORMAL); | |
assert(ret); | |
assert(!(GetFileAttributesA("C:\\xboxdash.xbe") & FILE_ATTRIBUTE_HIDDEN)); | |
debugPrint("done\n"); | |
while(1) { | |
Sleep(2000); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment