mirror of
https://github.com/Maschell/WiiUPluginLoader.git
synced 2024-11-05 16:05:09 +01:00
40 lines
1.2 KiB
C++
40 lines
1.2 KiB
C++
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
#include <string.h>
|
||
|
#include <utils/logger.h>
|
||
|
#include "libntfs.h"
|
||
|
#include <iosuhax.h>
|
||
|
#include <ntfs.h>
|
||
|
#include "common/retain_vars.h"
|
||
|
|
||
|
int32_t mountAllNTFS() {
|
||
|
int32_t i;
|
||
|
// Mount all NTFS volumes on all inserted block devices
|
||
|
ntfs_mount_count = ntfsMountAll((ntfs_md **) &ntfs_mounts, NTFS_DEFAULT | NTFS_RECOVER);
|
||
|
if (ntfs_mount_count == -1) {
|
||
|
DEBUG_FUNCTION_LINE("Error whilst mounting devices.\n");
|
||
|
} else if (ntfs_mount_count == 0) {
|
||
|
DEBUG_FUNCTION_LINE("No NTFS volumes were found and/or mounted.\n");
|
||
|
} else {
|
||
|
DEBUG_FUNCTION_LINE("%i NTFS volumes(s) mounted!\n", ntfs_mount_count);
|
||
|
}
|
||
|
// List all mounted NTFS volumes
|
||
|
for (i = 0; i < ntfs_mount_count; i++) {
|
||
|
DEBUG_FUNCTION_LINE("%i - %s:/ (%s)\n", i + 1, ((ntfs_md *)ntfs_mounts)[i].name, ntfsGetVolumeName(((ntfs_md *)ntfs_mounts)[i].name));
|
||
|
}
|
||
|
return ntfs_mount_count;
|
||
|
}
|
||
|
|
||
|
int32_t unmountAllNTFS(void) {
|
||
|
if (ntfs_mounts) {
|
||
|
int32_t i = 0;
|
||
|
for (i = 0; i < ntfs_mount_count; i++) {
|
||
|
ntfsUnmount(((ntfs_md *)ntfs_mounts)[i].name, true);
|
||
|
}
|
||
|
free(ntfs_mounts);
|
||
|
ntfs_mounts = NULL;
|
||
|
ntfs_mount_count = 0;
|
||
|
}
|
||
|
return 0;
|
||
|
}
|