X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f Date: Sat, 29 May 2004 13:29:07 +0200 From: "Eli Zaretskii" Sender: halo1 AT zahav DOT net DOT il To: djgpp AT delorie DOT com Message-Id: <7137-Sat29May2004132907+0300-eliz@gnu.org> X-Mailer: emacs 21.3.50 (via feedmail 8 I) and Blat ver 1.8.9 In-reply-to: <20040528202157.60621.qmail@web60702.mail.yahoo.com> (message from William OConnell on Fri, 28 May 2004 13:21:57 -0700 (PDT)) Subject: Re: Fwd: Re: Long filenames References: <20040528202157 DOT 60621 DOT qmail AT web60702 DOT mail DOT yahoo DOT com> Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > Date: Fri, 28 May 2004 13:21:57 -0700 (PDT) > From: William OConnell > > I have DJGPP C++ compiler running on Windows 98. I am > trying to create a system class that will handle > folders genericly. Upon so doing, I have encountered > a problem. The path given by the function, "getcwd", > reports the short filename. I need the long filename > that goes with the given short filename. Where is it? > Is there a function that will produce this? That function is `getcwd'. However, it issues a system call, and returns what that system call returns. The system call issued by `getcwd' supports long file names, but evidently, the OS reported a short version of the current directory's name in your case. The only situation I know of where such problems happen is when you use a 16-bit real-mode DOS program to chdir to the directory. For some weird reason, Windows changes its own notion of the current directory to the short name of that directory, and thereafter continues to report that short name to DJGPP programs. One work-around for that problem is to run the string returned by `getcwd' through subfunction 2 of function 7160h of Int 21h, which is documented in the Interrupt List as below (the way to call Int 21h functions is explained in the DJGPP FAQ list): --------D-217160CL02------------------------- INT 21 - Windows95 - LONG FILENAME - GET CANONICAL LONG FILENAME OR PATH AX = 7160h CL = 02h CH = SUBST expansion flag 00h return a path containing true path for a SUBSTed drive letter 80h return a path containing the SUBSTed drive letter DS:SI -> ASCIZ short filename or path ES:DI -> 261-byte buffer for canonicalized long name Return: CF set on error AX = error code 02h invalid component in directory path or drive letter only 03h malformed path or invalid drive letter ES:DI buffer unchanged CF clear if successful ES:DI buffer filled with qualified long name (can contain lowercase letters) Desc: determine the canonical name of the specified filename or path, corresponding to the undocumented TRUENAME command in COMMAND.COM BUGS: even though the maximum length of a complete long pathname is 260 characters, Windows95 returns CF set/AX=0003h even if the file exists whenever the full pathname is more than 255 characters Windows95 incorrectly treats filenames where the first two characters after the drive letter and colon are both slashes (either forward or backward) as a UNC (network name) and requires several seconds to attempt to resolve the name before returning an unchanged string SeeAlso: AH=60h,AX=7160h/CL=00h,AX=7160h/CL=01h