aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier <dev.git@javispedro.com>2022-04-30 18:18:09 +0200
committerJavier <dev.git@javispedro.com>2022-04-30 18:18:09 +0200
commit9595ebb6348544a2945470a5f271de7b58549bcd (patch)
tree994431752c4a64ff2da3b9068af71cbda8f8440e
parentff69feb4cacb191a278395c08490b3f97e280ad6 (diff)
downloadvbados-9595ebb6348544a2945470a5f271de7b58549bcd.tar.gz
vbados-9595ebb6348544a2945470a5f271de7b58549bcd.zip
another hack to avoid dir fd leaking
-rw-r--r--README.md14
-rw-r--r--sftsr.c9
2 files changed, 22 insertions, 1 deletions
diff --git a/README.md b/README.md
index cbf091b..f072dcd 100644
--- a/README.md
+++ b/README.md
@@ -520,7 +520,8 @@ It makes VKD set the mouse to "Intellimouse"/4-byte packet mode unconditionally
returns the wheel mouse device ID whenever asked, and removes all the packet segmentation code.
Meaning overflow conditions may not be handled gracefully, dropping bytes randomly,
so the DOS driver may need some synchronization code itself.
-However the code was [not that functional to begin with](http://www.os2museum.com/wp/jumpy-ps2-mouse-in-enhanced-mode-windows-3-x/),
+However the code was
+[not that functional to begin with](http://www.os2museum.com/wp/jumpy-ps2-mouse-in-enhanced-mode-windows-3-x/),
so not much of value is lost.
The 4-byte packets is what breaks most other drivers, but when using vbmouse.exe+vbmouse.drv,
this shouldn't be a problem either.
@@ -531,6 +532,17 @@ this shouldn't be a problem either.
was in the middle of sending a packet. A VM reboot fixes it.
We probably need to hook Ctrl+Alt+Del and turn off the mouse.
+* DOS has functions to start (FindFirst) and continue (FindNext) a directory
+ entry iteration, but no function to stop or cancel one (i.e., FindClose).
+ So we don't know when the program is done with the directory enumeration,
+ and thus we don't know when to close the directory handle (and file descriptor).
+ There are a number of heuristics, e.g. we close the directory when we iterate
+ over the last file. But it is not enough; for example, whenever a DOS client
+ calls FindFirst but doesn't enumerate the directory until the end, we'll leak
+ the file descriptor. Some programs do this in order to check if the directory
+ is not empty. Eventually you'll reach a "Too many open files" error.
+ Closing the DOS program should remove all leaked handles.
+
* VMware shared folders support is interesting, but there is very little
documentation that I can find, no sample code, and no open source implementation.
Also, unlike VBMOUSE, where most of the code is common to all virtualizers,
diff --git a/sftsr.c b/sftsr.c
index fb41431..4e47109 100644
--- a/sftsr.c
+++ b/sftsr.c
@@ -1043,6 +1043,15 @@ static vboxerr find_next_from_vbox(unsigned openfile, const char __far *path)
copy_drive_relative_filename(&shflstr.shflstr, path);
translate_filename_to_host(&shflstr.shflstr);
fix_wildcards(&shflstr.shflstr);
+
+ dlog_print("fixed path=");
+ dlog_print(shflstr.buf);
+ dlog_endline();
+
+ if (shflstr.shflstr.ach[shflstr.shflstr.u16Length-1] == '\\') {
+ // No wildcard?
+ return VERR_NO_MORE_FILES;
+ }
} else {
// For find next calls, it's not really important what we pass here,
// as long as it's not empty.