diff options
author | Eduardo Casino <mail@eduardocasino.es> | 2022-05-27 22:42:46 +0200 |
---|---|---|
committer | Javier <dev.git@javispedro.com> | 2022-06-12 17:13:03 +0200 |
commit | 09af091384c09aa036b50d912596a95fb07c5c4c (patch) | |
tree | 1fb4c69d92a998648b594fccaa85794614212dab | |
parent | 4f5b72cf50855f4c75c8cc8a5ed34f53a11bfa7d (diff) | |
download | vbados-09af091384c09aa036b50d912596a95fb07c5c4c.tar.gz vbados-09af091384c09aa036b50d912596a95fb07c5c4c.zip |
Fix hash short names when host file system is case sensitive
-rw-r--r-- | sfmain.c | 2 | ||||
-rw-r--r-- | sftsr.c | 13 | ||||
-rw-r--r-- | sftsr.h | 2 |
3 files changed, 12 insertions, 5 deletions
@@ -167,7 +167,7 @@ static int mount_shfl(LPTSRDATA data, int drive, const char *folder) } // This is not a bug! VirtualBox sets SHFL_MIF_HOST_ICASE if host file system is case sensitive - data->drives[drive].case_insensitive = ~(flags & SHFL_MIF_HOST_ICASE); + data->drives[drive].case_insensitive = !(flags & SHFL_MIF_HOST_ICASE); return 0; } @@ -1015,13 +1015,13 @@ static vboxerr find_volume_label(SHFLROOT root) /** Gets and fills in the next directory entry from VirtualBox. */ static vboxerr find_next_from_vbox(unsigned openfile, char __far *path) { - int drive = drive_letter_to_index(path[0]); - SHFLROOT root = data.drives[drive].root; DOSSDB __far *sdb = &data.dossda->sdb; DOSDIR __far *found_file = &data.dossda->found_file; uint16_t search_mask; vboxerr err; uint32_t hash; + int drive; + bool case_insensitive; // Always accept files with these attributes, even if mask says otherwise search_mask = ~(sdb->search_attr | _A_ARCH | _A_RDONLY); @@ -1030,6 +1030,10 @@ static vboxerr find_next_from_vbox(unsigned openfile, char __far *path) // a correct absolute mask with the correct wildcards; // this is what VirtualBox will use in future calls. if (path) { + SHFLROOT root; + drive = drive_letter_to_index(path[0]); + root = data.drives[drive].root; + copy_drive_relative_filename(root, &shflstr.shflstr, path); fix_wildcards(&shflstr.shflstr); @@ -1040,11 +1044,14 @@ static vboxerr find_next_from_vbox(unsigned openfile, char __far *path) return VERR_NO_MORE_FILES; } } else { + drive = sdb->drive & DOS_SDB_DRIVE_MASK; // For find next calls, it's not really important what we pass here, // as long as it's not empty. shflstring_strcpy(&shflstr.shflstr, " "); } + case_insensitive = data.drives[drive].case_insensitive; + while (1) { // Loop until we have a valid file (or an error) unsigned size = sizeof(shfldirinfo), resume = 0, count = 0; bool valid; @@ -1103,7 +1110,7 @@ static vboxerr find_next_from_vbox(unsigned openfile, char __far *path) dprintf(" Host short filename: '%s'\n", shfldirinfo.dirinfo.name.ach); } else { - valid = translate_filename_from_host(&shfldirinfo.dirinfo.name, data.drives[drive].case_insensitive, true); + valid = translate_filename_from_host(&shfldirinfo.dirinfo.name, case_insensitive, true); } if (valid) { @@ -56,7 +56,7 @@ typedef struct { // but we still waste a full uint64_t to store a value that is always < 4K. // Similarly, at most 64 roots are supported, but we waste a uint32_t. -typedef _Packed struct { +typedef struct { // TSR installation data /** Previous int2f ISR, storing it for uninstall. */ void (__interrupt __far *prev_int2f_handler)(); |