X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: Doug Kaufman Newsgroups: comp.os.msdos.djgpp Subject: Re: Problem with UNRAR Date: Wed, 5 Jan 2005 20:45:48 +0000 (UTC) Organization: a2i network Lines: 127 Message-ID: References: NNTP-Posting-Host: green.rahul.net X-Trace: blue.rahul.net 1104957948 31819 192.160.13.49 (5 Jan 2005 20:45:48 GMT) X-Complaints-To: support AT rahul DOT net NNTP-Posting-Date: Wed, 5 Jan 2005 20:45:48 +0000 (UTC) User-Agent: nn/6.6.4 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Dian Yin writes: >Recently, I downloaded source code of UNRAR for linux, and tried to >compile it under DOS using DJGPP. I extracted the package and run "make". >However, the UNRAR.EXE I got seems to be incorrect, as it cannot recognize >any RAR archive. Every time it says: xxxx.rar is not RAR archive. The last unrar that I compiled for DJGPP was unrarsrc-3.4.2 (latest is 3.4.3) from ftp://ftp.rarsoft.com/rar. This has not been extensively tested by me, but seems to work. There is no general makefile that comes with the archive, so I don't see how you just did "make". Here is the patch file that I used, which also generates a makefile. Don't be surprised if additional changes are needed, since this doesn't seem to be maintained for DJGPP and I have only used it a few times. Doug --- filefn.cpp.orig 2004-08-03 04:35:44.000000000 -0800 +++ filefn.cpp 2005-01-05 12:41:26.000000000 -0800 @@ -195,6 +195,20 @@ return(1457664); #elif defined(_EMX) int Drive=(!isalpha(Name[0]) || Name[1]!=':') ? 0:toupper(Name[0])-'A'+1; +#ifdef __DJGPP__ + { + __dpmi_regs regs; + memset(®s,0,sizeof(regs)); + regs.h.ah=0x36; + regs.h.dl=Drive; + __dpmi_int (0x21, ®s); + if (regs.x.ax==0xffff) + return(1457664); + Int64 FreeSize=regs.x.ax*regs.x.cx; + FreeSize=FreeSize*regs.x.bx; + return(FreeSize); + } +#else if (_osmode == OS2_MODE) { FSALLOCATE fsa; @@ -217,6 +231,7 @@ FreeSize=FreeSize*outregs.x.bx; return(FreeSize); } +#endif /* __DJGPP__ */ #else #define DISABLEAUTODETECT return(1457664); --- makefile.dj.orig 2005-01-05 12:13:02.000000000 -0800 +++ makefile.dj 2005-01-05 12:14:54.000000000 -0800 @@ -0,0 +1,45 @@ +# +# Makefile for DJGPP - unrar +# +# Note: you have to 'make clean' before you can build +# the sfx module +# + +# DJGPP using GCC +CXX=gpp +CXXFLAGS=-O2 -W -Wall +DEFINES= + + +########################## + +COMPILE=$(CXX) $(CXXFLAGS) $(DEFINES) +LINK=$(CXX) + +UNRAR_OBJ=filestr.o recvol.o rs.o scantree.o + +OBJECTS=rar.o strlist.o strfn.o pathfn.o int64.o savepos.o global.o file.o filefn.o filcreat.o \ + archive.o arcread.o unicode.o system.o isnt.o crypt.o crc.o rawread.o encname.o \ + resource.o match.o timefn.o rdwrfn.o consio.o options.o ulinks.o errhnd.o rarvm.o \ + rijndael.o getbits.o sha1.o extinfo.o extract.o volume.o list.o find.o unpack.o cmddata.o + +.cpp.o: + $(COMPILE) -D$(WHAT) -c $< + +all: unrar + +clean: + @rm -f *.o *.bak *~ + +unrar: WHAT=UNRAR +unrar: $(OBJECTS) $(UNRAR_OBJ) + @rm -f makeunrar + $(LINK) -o unrar $(LDFLAGS) $(OBJECTS) $(UNRAR_OBJ) $(LIBS) + @strip unrar + +sfx: WHAT=SFX_MODULE +sfx: $(OBJECTS) + @rm -f default.sfx + $(LINK) -o default.sfx $(LDFLAGS) $(OBJECTS) -DSFX_MODULE + strip default.sfx + --- os.hpp.orig 2004-08-03 04:35:46.000000000 -0800 +++ os.hpp 2005-01-05 12:01:26.000000000 -0800 @@ -69,6 +69,8 @@ #include #ifdef _DJGPP #include + #include + #include #else #include #include --- pathfn.cpp.orig 2004-08-03 04:35:46.000000000 -0800 +++ pathfn.cpp 2005-01-05 11:38:16.000000000 -0800 @@ -294,6 +294,7 @@ strcpy(RARFileName,Path); if (Number!=0) return(false); +#ifndef __DJGPP__ if (_osmode==OS2_MODE) { PTIB ptib; @@ -302,6 +303,7 @@ DosQueryModuleName(ppib->pib_hmte,NM,Path); } else +#endif /* __DJGPP__ */ strcpy(Path,RARFileName); RemoveNameFromPath(Path); return(true); -- Doug Kaufman Internet: dkaufman AT rahul DOT net