Skip to content

REF-040 - Harden External UnRAR DLL Loading

Summary

CRARFile now treats RARLAB UnRAR as an external user-installed dependency instead of a bundled component. The loader no longer calls LoadLibrary with a bare DLL name and no longer searches the process DLL path.

Decision

  • Do not switch RAR extraction to 7z.dll for Beta 0.7.3.
  • Do not bundle UnRAR64.dll in eMule BB release packages.
  • Use the RARLAB UnRAR DLL installer layout:
  • x64: %ProgramFiles(x86)%\UnrarDLL\x64\UnRAR64.dll
  • Win32 fallback: %ProgramFiles(x86)%\UnrarDLL\UnRAR.dll
  • Use the installed RARLAB header as the API reference: %ProgramFiles(x86)%\UnrarDLL\unrar.h.

Outcome

  • CRARFile loads only an absolute installed UnRAR DLL candidate.
  • Runtime loading uses LoadLibraryEx with safe DLL search flags.
  • The local UnRAR declarations were refreshed to the current API version 9 structure layout.
  • RARGetDllVersion is used when exported to reject DLLs below API version 9.
  • Required extraction exports remain: RAROpenArchiveEx, RARCloseArchive, RARReadHeaderEx, and RARProcessFileW.

Acceptance

  • [x] RAR support remains optional and user-installed.
  • [x] Bare-name LoadLibrary(UNRAR_DLL_NAME) is removed from active main.
  • [x] Missing DLL diagnostics point users at the RARLAB install layout.
  • [x] Native seam tests cover DLL naming, installed path construction, version policy, and required exports.