diff options
| author | Javier <dev.git@javispedro.com> | 2026-11-29 19:49:37 +0100 |
|---|---|---|
| committer | Javier <dev.git@javispedro.com> | 2026-11-29 20:18:59 +0100 |
| commit | 2e2b81cdfc694c88a052b13e133172cc8d4e6d19 (patch) | |
| tree | b3c42c6143ee0a9b5d72ebde2eb827dc810f23c6 | |
| parent | 5898f13480921e1c1ab362852f88794ea955ffce (diff) | |
| download | vbados-2e2b81cdfc694c88a052b13e133172cc8d4e6d19.tar.gz vbados-2e2b81cdfc694c88a052b13e133172cc8d4e6d19.zip | |
vbsf: fix regression where files appear multiple times on dir
| -rw-r--r-- | lfn.h | 4 | ||||
| -rw-r--r-- | sftsr.c | 18 |
2 files changed, 12 insertions, 10 deletions
@@ -269,6 +269,8 @@ static inline char *find_real_name( SHFLROOT root = data->drives[drive].root; uint8_t hash_chars = data->drives[drive].opt.hash_chars; SHFLSTRING *shflstr = &lfndirinfo.dirinfo.name; // reuse the lfndirinfo string buffer + // we can reuse it since we only need shflstr as input to the first call, + // before lfndirinfo is used vboxerr err; dprintf("find_real_name path=%Fs filename=%Fs\n", path, filename); @@ -301,8 +303,6 @@ static inline char *find_real_name( SHFL_LIST_RETURN_ONE, &size, shflstr, &lfndirinfo.dirinfo, &resume, &count); - // shflstr not needed anymore, and besides it is now used as lfndirinfo - shflstr = NULL; // Reset the size of the buffer (see find_next_from_vbox) lfndirinfo.dirinfo.name.u16Size = sizeof(lfndirinfo.buf); @@ -682,7 +682,6 @@ static void handle_write(union INTPACK __far *r) // Special case: If size is 0, truncate to current file position if (!bytes) { - err = vbox_shfl_set_file_size(&data.vb, data.hgcm_client_id, data.files[openfile].root, data.files[openfile].handle, sft->f_pos); @@ -695,7 +694,7 @@ static void handle_write(union INTPACK __far *r) return; } - + err = vbox_shfl_write(&data.vb, data.hgcm_client_id, data.files[openfile].root, data.files[openfile].handle, offset, &bytes, buffer); @@ -1011,7 +1010,8 @@ static vboxerr find_volume_label(SHFLROOT root) return 0; } -/** Gets and fills in the next directory entry from VirtualBox. */ +/** Gets and fills in the next directory entry from VirtualBox. + * @param path DOS path to search in + wildcards (only necessary in first call) */ static vboxerr find_next_from_vbox(unsigned openfile, char __far *path) { DOSSDB __far *sdb = &data.dossda->sdb; @@ -1040,8 +1040,10 @@ static vboxerr find_next_from_vbox(unsigned openfile, char __far *path) } } else { drive = sdb->drive & DOS_SDB_DRIVE_MASK; - // For find next calls, it's not really important what we pass here. - shflstring_clear(&shflstr.shflstr); + // For find next calls, it's not really important what we pass here, + // as long as we pass _something_. + // (otherwise, if empty, VirtualBox falls back to unfiltered search) + shflstring_strcpy(&shflstr.shflstr, " "); } @@ -1099,8 +1101,8 @@ static vboxerr find_next_from_vbox(unsigned openfile, char __far *path) if (data.drives[drive].opt.use_host_sfn && shfldirinfo.dirinfo.cucShortName != 0) { // Use shortname provided by host OS - valid = utf16_to_local( &data, &shfldirinfo.dirinfo.name.ach, &shfldirinfo.dirinfo.uszShortName, shfldirinfo.dirinfo.cucShortName); - + valid = utf16_to_local(&data, &shfldirinfo.dirinfo.name.ach, &shfldirinfo.dirinfo.uszShortName, shfldirinfo.dirinfo.cucShortName); + if (!valid) { // Should not happen as Windows short names are pure ascii dputs("hiding file with illegal character(s)"); @@ -1194,7 +1196,7 @@ static void handle_find_first(union INTPACK __far *r) dputs("search volid OK"); clear_dos_err(r); return; - } + } // First, open the desired directory for searching openfile = find_free_openfile(); |
