mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-16 00:15:08 +01:00
*Fixed crash on NTFS (wrong memory free functions were used)
*Added proper deinitialize of usb before starting game / exiting app. This is supposed to fix Blackops multiplayer mode (Did not test it. I don't have that game.) *Added Wii message board update (Playlog) (thanks to dkosmari for a starting point). This feature can be enabled/disabled in the global settings. Default is ON. *Removed unused sources.
This commit is contained in:
parent
0f17471b27
commit
93ac37f27c
@ -674,14 +674,14 @@ bool ntfsSetVolumeName (const char *name, const char *volumeName)
|
|||||||
|
|
||||||
// It does, resize it to match the length of the new volume name
|
// It does, resize it to match the length of the new volume name
|
||||||
if (ntfs_attr_truncate(na, ulabel_len)) {
|
if (ntfs_attr_truncate(na, ulabel_len)) {
|
||||||
ntfs_free(ulabel);
|
free(ulabel);
|
||||||
ntfsUnlock(vd);
|
ntfsUnlock(vd);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write the new volume name
|
// Write the new volume name
|
||||||
if (ntfs_attr_pwrite(na, 0, ulabel_len, ulabel) != ulabel_len) {
|
if (ntfs_attr_pwrite(na, 0, ulabel_len, ulabel) != ulabel_len) {
|
||||||
ntfs_free(ulabel);
|
free(ulabel);
|
||||||
ntfsUnlock(vd);
|
ntfsUnlock(vd);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -690,7 +690,7 @@ bool ntfsSetVolumeName (const char *name, const char *volumeName)
|
|||||||
|
|
||||||
// It doesn't, create it now
|
// It doesn't, create it now
|
||||||
if (ntfs_attr_add(vd->vol->vol_ni, AT_VOLUME_NAME, NULL, 0, (u8*)ulabel, ulabel_len)) {
|
if (ntfs_attr_add(vd->vol->vol_ni, AT_VOLUME_NAME, NULL, 0, (u8*)ulabel, ulabel_len)) {
|
||||||
ntfs_free(ulabel);
|
free(ulabel);
|
||||||
ntfsUnlock(vd);
|
ntfsUnlock(vd);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -706,13 +706,13 @@ bool ntfsSetVolumeName (const char *name, const char *volumeName)
|
|||||||
|
|
||||||
// Sync the volume node
|
// Sync the volume node
|
||||||
if (ntfs_inode_sync(vd->vol->vol_ni)) {
|
if (ntfs_inode_sync(vd->vol->vol_ni)) {
|
||||||
ntfs_free(ulabel);
|
free(ulabel);
|
||||||
ntfsUnlock(vd);
|
ntfsUnlock(vd);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clean up
|
// Clean up
|
||||||
ntfs_free(ulabel);
|
free(ulabel);
|
||||||
|
|
||||||
// Unlock
|
// Unlock
|
||||||
ntfsUnlock(vd);
|
ntfsUnlock(vd);
|
||||||
|
@ -316,7 +316,8 @@ ntfs_inode *ntfsParseEntry (ntfs_vd *vd, const char *path, int reparseLevel)
|
|||||||
ni = ntfsParseEntry(vd, target, reparseLevel++);
|
ni = ntfsParseEntry(vd, target, reparseLevel++);
|
||||||
|
|
||||||
// Clean up
|
// Clean up
|
||||||
ntfs_free(target);
|
// use free because the value was not allocated with ntfs_alloc
|
||||||
|
free(target);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -459,11 +460,12 @@ cleanup:
|
|||||||
if(dir_ni)
|
if(dir_ni)
|
||||||
ntfsCloseEntry(vd, dir_ni);
|
ntfsCloseEntry(vd, dir_ni);
|
||||||
|
|
||||||
|
// use free because the value was not allocated with ntfs_alloc
|
||||||
if(utarget)
|
if(utarget)
|
||||||
ntfs_free(utarget);
|
free(utarget);
|
||||||
|
|
||||||
if(uname)
|
if(uname)
|
||||||
ntfs_free(uname);
|
free(uname);
|
||||||
|
|
||||||
if(dir)
|
if(dir)
|
||||||
ntfs_free(dir);
|
ntfs_free(dir);
|
||||||
@ -561,8 +563,9 @@ cleanup:
|
|||||||
if(ni)
|
if(ni)
|
||||||
ntfsCloseEntry(vd, ni);
|
ntfsCloseEntry(vd, ni);
|
||||||
|
|
||||||
|
// use free because the value was not allocated with ntfs_alloc
|
||||||
if(uname)
|
if(uname)
|
||||||
ntfs_free(uname);
|
free(uname);
|
||||||
|
|
||||||
if(dir)
|
if(dir)
|
||||||
ntfs_free(dir);
|
ntfs_free(dir);
|
||||||
@ -657,8 +660,9 @@ cleanup:
|
|||||||
if(ni)
|
if(ni)
|
||||||
ntfsCloseEntry(vd, ni);
|
ntfsCloseEntry(vd, ni);
|
||||||
|
|
||||||
|
// use free because the value was not allocated with ntfs_alloc
|
||||||
if(uname)
|
if(uname)
|
||||||
ntfs_free(uname);
|
free(uname);
|
||||||
|
|
||||||
if(dir)
|
if(dir)
|
||||||
ntfs_free(dir);
|
ntfs_free(dir);
|
||||||
@ -806,14 +810,33 @@ int ntfsUnicodeToLocal (const ntfschar *ins, const int ins_len, char **outs, int
|
|||||||
if (!ins || !ins_len || !outs)
|
if (!ins || !ins_len || !outs)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// Convert the unicode string to our current local
|
char * ucstombs_out = NULL;
|
||||||
len = ntfs_ucstombs(ins, ins_len, outs, outs_len);
|
|
||||||
if (len == -1 && errno == EILSEQ) {
|
|
||||||
|
|
||||||
|
// Convert the unicode string to our current local
|
||||||
|
len = ntfs_ucstombs(ins, ins_len, &ucstombs_out, outs_len);
|
||||||
|
|
||||||
|
if(ucstombs_out)
|
||||||
|
{
|
||||||
|
//use proper allocation
|
||||||
|
*outs = (char *) ntfs_alloc(strlen(ucstombs_out) + 1);
|
||||||
|
if(!*outs)
|
||||||
|
{
|
||||||
|
errno = ENOMEM;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
strcpy(*outs, ucstombs_out);
|
||||||
|
free(ucstombs_out);
|
||||||
|
ucstombs_out = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (len == -1 && errno == EILSEQ)
|
||||||
|
{
|
||||||
// The string could not be converted to the current local,
|
// The string could not be converted to the current local,
|
||||||
// do it manually by replacing non-ASCII characters with underscores
|
// do it manually by replacing non-ASCII characters with underscores
|
||||||
if (!*outs || outs_len >= ins_len) {
|
if (!*outs || outs_len >= ins_len)
|
||||||
if (!*outs) {
|
{
|
||||||
|
if (!*outs)
|
||||||
|
{
|
||||||
*outs = (char *) ntfs_alloc(ins_len + 1);
|
*outs = (char *) ntfs_alloc(ins_len + 1);
|
||||||
if (!*outs) {
|
if (!*outs) {
|
||||||
errno = ENOMEM;
|
errno = ENOMEM;
|
||||||
@ -829,7 +852,6 @@ int ntfsUnicodeToLocal (const ntfschar *ins, const int ins_len, char **outs, int
|
|||||||
*outs[ins_len] = (ntfschar)'\0';
|
*outs[ins_len] = (ntfschar)'\0';
|
||||||
len = ins_len;
|
len = ins_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
|
Loading…
Reference in New Issue
Block a user