From: "Wojciech Galazka" Newsgroups: comp.os.msdos.djgpp Subject: Re: fstat works incorrectly under Windows NT Date: Mon, 10 Apr 2000 09:43:58 +0200 Organization: http://news.icm.edu.pl/ Lines: 54 Message-ID: <8cs0qj$95m$1@sunsite.icm.edu.pl> References: NNTP-Posting-Host: plus273.polkomtel.com.pl Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-2 Content-Transfer-Encoding: 8bit X-Trace: sunsite.icm.edu.pl 955352723 9398 212.2.97.146 (10 Apr 2000 07:45:23 GMT) X-Complaints-To: abuse AT news DOT icm DOT edu DOT pl NNTP-Posting-Date: 10 Apr 2000 07:45:23 GMT X-Newsreader: Microsoft Outlook Express 4.72.3110.5 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Eli Zaretskii wrote... > >On Sat, 8 Apr 2000, Wojciech Galazka wrote: > >> The >> newest version of LFN I'm working on completely bypasses int 21h AX=6Ch >> call and creates/opens files using Win32 CreateFile() call. It turns out >> that DOS file handles returned by the LFN driver under some circumstances >> are not recognized by int 21h, AX=4400h used by get_dev_info() call. which >> returns 0 instead. > >Is bypassing the DOS calls a good idea? How do you get a handle from >CreateFile that can be used in various DOS calls, such as 214400? > >The handle you return must be a valid DOS handle, otherwise lots of >things will subtly break. > Bypassing the DOS calls is not a good idea but it works fast . Basically long filename is translated into short filename by the driver and then DOS creates/opens the file using the short filename. As you pointed out the handle returned by CreateFile() needs to be translated into a DOS file handle, this can be done using some undocumented calls to NTVDM. The good news is that it works faster than using int 21h, the bad news is that there are problemns with opening devices (like NUL) and some DOS calls don't work with that handles (as in the case with int 21h, ax=4400h) I put aside this promising but not yet working approach and reverted to handling create/open files using DOS. This way I don't need to worry about SFT , or the like. Perhaps I should wait until DoJ case against Microsoft ends up with Windows source code being released. :) >> I'm working on this right now and wonder if the SFT layout under Windows NT >> is anywhere documented .... > >What SFT do you have in mind? If that's the SFT for the DOS box, I'm >not even sure NTVDM creates it. According to Schulman's "Undocumented DOS" there is some rudimentary SFT structure but it is different from the one used by DOS 5. BTW Could you suggest any texts of how DPMI serwer works?. All I know is that for a DOS 32 bit DPMI program a LDT is created by DPMI server somewhere by NTVDM. It is probably possible to access that LDT from DPMI server side. But how to free a descriptor not used anymore by a program? The bugs in DPMI server make it very annoying to compile large DJGPP packages. Thanks