WinRar Free UnPack DLL and EXE

Just starting out? Need help? Post your questions and find answers here.
User_Russian
Addict
Addict
Posts: 1519
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Post by User_Russian »

Code: Select all

#UCM_PROCESSDATA=1

Procedure RAR_CB(msg, UserData, P1, P2)
 If msg=#UCM_PROCESSDATA
  Debug "Unpacked - "+Str(P2)+" byte"
 EndIf
ProcedureReturn 0
;ProcedureReturn 1 ; Break Unpacked
EndProcedure



memText.s {270}

RarFile$=OpenFileRequester("","","WinRar (*.rar)|*.rar|*.*|*.*",0) 
If RarFile$<>""
 H_RAR=RAR_OpenArchive(RarFile$) ; Открываем архив и получаем его идентификатор
 If H_RAR
  RAR_SetCallback(H_RAR, @RAR_CB(), 0) 
  While RAR_ReadHeader(H_RAR,  @memText)=0 ; Узнаём какие файлы есть в архиве
   File.s=memText
   Debug File
   RAR_SetPassword(h_RAR,"") ; Пароля нет
   res=RAR_ProcessFile(h_RAR,#RAR_EXTRACT,"","d:\testrar\"+File) ; Распаковываем файл в "d:\testrar\" 
  Wend
   RAR_CloseArchive(H_RAR) ; Закрываем архив
 EndIf 
EndIf
codeman
User
User
Posts: 27
Joined: Thu Feb 19, 2009 7:12 am

Post by codeman »

Thank you!
Peyman
Enthusiast
Enthusiast
Posts: 203
Joined: Mon Dec 24, 2007 4:15 pm
Location: Iran

Post by Peyman »

thanks, nobody know how convert time in RARHeaderData\FileTime to pb time.

Code: Select all

FileTime
  Output parameter - contains date and time in standard MS DOS format
codeman
User
User
Posts: 27
Joined: Thu Feb 19, 2009 7:12 am

Post by codeman »

Sorry that I ask so much but how I can make the output into a ProgressGadger?
Yours codeman
User_Russian
Addict
Addict
Posts: 1519
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Post by User_Russian »

In function RAR_ReadHeader is found bug, sorry
New version of the library http://purik.nextmail.ru/PureBasic/en/U ... 1.2_EN.rar
nobody know how convert time in RARHeaderData\FileTime to pb time.

Code: Select all

Infa.RAR_HeaderData

memText.s {270} 

RarFile$=OpenFileRequester("","","WinRar (*.rar)|*.rar|*.*|*.*",0) 
If RarFile$<>"" 
 H_RAR=RAR_OpenArchive(RarFile$) ; Открываем архив и получаем его идентификатор 
 If H_RAR 
  While RAR_ReadHeader(H_RAR,  @memText,@Infa)=0 ; Узнаём какие файлы есть в архиве 
   File.s=memText 
   Debug File +"           Create time - "+FormatDate("%dd/%mm/%yy   %hh:%ii:%ss",Infa\FileTime)
   RAR_SetPassword(h_RAR,"") ; Пароля нет 
   res=RAR_ProcessFile(h_RAR,#RAR_EXTRACT,"","d:\testrar\"+File) ; Распаковываем файл в "d:\testrar\" 
  Wend 
   RAR_CloseArchive(H_RAR) ; Закрываем архив 
 EndIf 
EndIf
codeman
User
User
Posts: 27
Joined: Thu Feb 19, 2009 7:12 am

Post by codeman »

Can anybody make an example were you can see the status of unpacking in a ProgressBarGadget?
Yours codeman
Peyman
Enthusiast
Enthusiast
Posts: 203
Joined: Mon Dec 24, 2007 4:15 pm
Location: Iran

Post by Peyman »

User_Russian wrote:
nobody know how convert time in RARHeaderData\FileTime to pb time.

Code: Select all

Infa.RAR_HeaderData

memText.s {270} 

RarFile$=OpenFileRequester("","","WinRar (*.rar)|*.rar|*.*|*.*",0) 
If RarFile$<>"" 
 H_RAR=RAR_OpenArchive(RarFile$) ; Открываем архив и получаем его идентификатор 
 If H_RAR 
  While RAR_ReadHeader(H_RAR,  @memText,@Infa)=0 ; Узнаём какие файлы есть в архиве 
   File.s=memText 
   Debug File +"           Create time - "+FormatDate("%dd/%mm/%yy   %hh:%ii:%ss",Infa\FileTime)
   RAR_SetPassword(h_RAR,"") ; Пароля нет 
   res=RAR_ProcessFile(h_RAR,#RAR_EXTRACT,"","d:\testrar"+File) ; Распаковываем файл в "d:\testrar" 
  Wend 
   RAR_CloseArchive(H_RAR) ; Закрываем архив 
 EndIf 
EndIf
no this is not true because i create a file and compress it on rar then use your code and this is return :

Code: Select all

New Text Document.txt           Create time - 19/01/2001   16:53:42
i think RARHeaderData\FileTime differ with pb time, what means when rar say :

Code: Select all

FileTime
  Output parameter - contains date and time in standard MS DOS format
User_Russian
Addict
Addict
Posts: 1519
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Post by User_Russian »

no this is not true because i create a file and compress it on rar then use your code and this is return :


Here is structure

Code: Select all

Structure RAR_HeaderData 
  ArcName.c[260] 
  FileName.c[260] 
  Flags.l 
  PackSize.l 
  UnpSize.l 
  HostOS.l 
  FileCRC.l 
  FileTime.l  ; <----
  UnpVer.l 
  Method.l 
  FileAttr.l 
  *CmtBuf.l 
  CmtBufSize.l 
  CmtSize.l 
  CmtState.l 
EndStructure 
User_Russian
Addict
Addict
Posts: 1519
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Post by User_Russian »

Can anybody make an example were you can see the status of unpacking in a ProgressBarGadget?

Code: Select all

Infa.RAR_HeaderData

OpenWindow(0,100,80,300,50,"",#PB_Window_SystemMenu)
CreateGadgetList(WindowID(0))
ProgressBarGadget(0,10,10,280,20,0,1)


memText.s {270} 

RarFile$=OpenFileRequester("","","WinRar (*.rar)|*.rar|*.*|*.*",0) 
If RarFile$<>"" 

SetGadgetAttribute(0,#PB_ProgressBar_Maximum,FileSize(RarFile$))

 H_RAR=RAR_OpenArchive(RarFile$) ; Открываем архив и получаем его идентификатор 
 If H_RAR 
 
 
 
  While RAR_ReadHeader(H_RAR,  @memText,@Infa)=0 ; Узнаём какие файлы есть в архиве 
   File.s=memText 
   X=X+Infa\PackSize
   SetGadgetState(0,x)
   Debug X
   Debug File +"       "+Str(Infa\UnpSize-Infa\PackSize)
   RAR_SetPassword(h_RAR,"") ; Пароля нет 
   res=RAR_ProcessFile(h_RAR,#RAR_EXTRACT,"","d:\testrar\"+File) ; Распаковываем файл в "d:\testrar\" 
  Wend 
   RAR_CloseArchive(H_RAR) ; Закрываем архив 
 EndIf 
EndIf


Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
codeman
User
User
Posts: 27
Joined: Thu Feb 19, 2009 7:12 am

Post by codeman »

Thank you for this example!
Peyman
Enthusiast
Enthusiast
Posts: 203
Joined: Mon Dec 24, 2007 4:15 pm
Location: Iran

Post by Peyman »

User_Russian wrote:
no this is not true because i create a file and compress it on rar then use your code and this is return :


Here is structure

Code: Select all

Structure RAR_HeaderData 
  ArcName.c[260] 
  FileName.c[260] 
  Flags.l 
  PackSize.l 
  UnpSize.l 
  HostOS.l 
  FileCRC.l 
  FileTime.l  ; <----
  UnpVer.l 
  Method.l 
  FileAttr.l 
  *CmtBuf.l 
  CmtBufSize.l 
  CmtSize.l 
  CmtState.l 
EndStructure 
Yea i know it but your example for FileTime never debug true created time, i create my file in 2009 but your code debug :

Code: Select all

New Text Document.txt           Create time - 19/01/2001   16:53:42 
Post Reply