Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

Call for testers: UPXINFO version 04-AUG-2008 (Miscellaneous)

posted by marcov, 05.08.2008, 15:43

> Yes, and I'm already doing this for some parts of the source code.
> What's a safe way to detect, if LFNs are available?

FPC's way (system unit)

function CheckLFN:boolean;
var
regs : TRealRegs;
RootName : pchar;
begin
{ Check LFN API on drive c:\ }
RootName:='C:\';
syscopytodos(longint(RootName),strlen(RootName)+1);
{ Call 'Get Volume Information' ($71A0) }
regs.realeax:=$71a0;
regs.reales:=tb_segment; //seg(rootname)
regs.realedi:=tb_offset; // ofs(rootname);
regs.realecx:=32;
regs.realds:=tb_segment; //seg(rootname)
regs.realedx:=tb_offset; //ofs(rootname)
regs.realflags:=carryflag;
sysrealintr($21,regs);
{ If carryflag=0 and LFN API bit in ebx is set then use Long file names }
CheckLFN:=(regs.realflags and carryflag=0) and (regs.realebx and $4000=$4000);
end;

Note that there are 32-bitisms( copytodos, sysrealintr instead of dos() and real(e) prefixes of registers), but that should be easy to remedy.

Maybe this should be combined with a drive check first (in case C:\ is not valid? like iirc an IDE zipdisk and a shell command to another drive can have this?)

 

Complete thread:

Back to the forum
Board view  Mix view
22049 Postings in 2034 Threads, 396 registered users, 274 users online (0 registered, 274 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum