UnRAR Wrapper for PureBasic Programming Language.
- Windows 7 above (recommend)
- PureBasic 5.0 above (recommend)
- UnRAR
Building requires PureBasic Compiler and test under Windows 10.
Module features require PureBasic 5.20 and above.
Extract the RAR file
EnableExplicit
IncludeFile "../../Core/Enums.pbi"
IncludeFile "../../Core/UnRARWrapper.pbi"
UseModule UnRARWrapper
Global lpszLibUnRARDll.s = "UnRAR.dll"
Global lpszSampleFilePath.s = "TestFile/example.rar"
If DllOpen(lpszLibUnRARDll)
OpenConsole()
Define HeaderData.RARHeaderDataEx
Define ArchiveData.RAROpenArchiveDataEx
Define ArchiveDataCmt.s = Space(16383) + Chr(0)
ArchiveData\ArcNameW = @lpszSampleFilePath
ArchiveData\OpenMode = #RAR_OM_EXTRACT
ArchiveData\CmtBuf = @ArchiveDataCmt
ArchiveData\CmtBufSize = SizeOf(ArchiveDataCmt)
Define hRARArchiveHandle.l = UnRARArchive::OpenArchiveEx(@ArchiveData)
If ArchiveData\OpenResult = 0
PrintN("Source: " + lpszSampleFilePath)
While UnRARArchive::ReadHeaderEx(hRARArchiveHandle, @HeaderData) = 0
Define extractFile.s = PeekS(@HeaderData\FileNameW)
Define hUnRARProcCode.l = UnRARArchive::ProcessFileW(hRARArchiveHandle, #RAR_TEST, "", "")
PrintN("Test File: " + extractFile)
Wend
EndIf
Input()
CloseConsole()
DllClose()
EndIf
Copyright (c) 2017-2024 Ji-Feng Tsai.
Code released under the MIT license.
- More examples
If this application help you reduce time to coding, you can give me a cup of coffee :)