5 ms·
My interpretation is this: DOS uses a System File Table (SFT) track open files (file handles are just a pointer into the SFT). Despite the size of each entry
by enragedcacti 7y ago
My interpretation is this:
DOS uses a System File Table (SFT) track open files (file handles are just a pointer into the SFT).
Despite the size of each entry of the SFT being the same for all versions of DOS up to 5.0, Windows attempts to determine the size by observation.
Because DOS itself opens three handles to the CON device, it can determine the size of an SFT entry by finding three evenly spaced occurrences of the string 'CON ' in memory.
This usually works but if a utility program (not sure what that refers to) moves that portion of the SFT into upper memory (640K-1MB) then Windows won't be able to find it.
The magazine has the solution in the form of a .BAT file that will place three properly spaced instances of 'CON ' in conventional memory so that Windows can find it.
- jandrese 7y agoWelp, this win the award for the ugliest hack of the week, and I'm not sure which part of the post to award it to. Windows scanning memory for strings, or the part where you make a batch file just to make that check pass.
- userbinator 7y agoEven something like loading a file into a text editor containing the appropriate pattern would be sufficient; but what's more interesting to consider, is what happens if you happen to have that pattern in memory before starting Windows, but it's the incorrect size of SFT for the version of DOS --- I could imagine some pretty odd things happening... as well as KB article getting published if some important customer ran into it: "Windows becomes unstable when started after you work with files containing 3 or more occurrences of 'CON' spaced between 16 and 256 bytes apart."
- firethief 7y agoCON would be mentioned a lot in the KB article. They'd have to write it carefully.
- ncmncm 7y agoBack in the day, this was not even considered odd, in the Microsoft ecosystem. People collected lore like this because you had to know a great deal of it to get anything to work. Writing the code to do the actual work was 10% of the job. Compensating for stuff like this was the rest.
- fapjacks 7y agoRight! This sort of "ugly hack lore" more generally is why it's extremely difficult for third-party word processing applications to handle old Microsoft Word .doc files, and in fact is why Microsoft put so much effort into backward compatibility for modern versions of Windows: Microsoft Office actually contains the document-rendering engines of old versions of Microsoft Word, in order to handle documents which are in the old formats.
- exikyut 7y agoAnd I understand that a significant proportion of Azure is running VMs with headless copies of Word hooked up to Office 365 so that those same old documents can straightforwardly be opened online, too. Apologies I can't find the reference (of course I read this on here). I'm very curious if a) the VM stays open the whole time, b) your document gets exported to some kind of perfect serialization format that can then be re-saved when you're done, c) if Word is using something like operational transformations to store keystrokes and edits and then ticker-taping that into a save routine, or d) something else.
- darepublic 7y agoDefinitely windows scanning memory for strings is uglier imo
- tinus_hn 7y agoIs this perhaps one of the tricks Microsoft used to ‘accidentally’ make DR-DOS incompatible with Windows?
- NikkiA 7y agoThe AARD code specifically references SFT manipulation and testing, so I'm going to go with 'yes, this is probably exactly the anti-DR-DOS code'