Skip to content

REF-038 - Harden Optional MediaInfo DLL Loading And Metadata Extraction Seams

Summary

Harden the existing optional MediaInfo.dll metadata path without changing the release dependency posture. MediaInfo.dll remains an external optional runtime DLL, built-in RIFF/RM/WM probes remain fallback paths, and id3lib remains the explicit MPEG-audio fallback.

This is release hardening, not a feature expansion and not a dependency replacement.

Current State

  • srchybrid/MediaInfo_DLL.cpp owns the runtime loader for the optional MediaInfo.dll.
  • srchybrid/FileInfoDialog.cpp uses the MediaInfo path for the File Info dialog, with InspectAllFileTypes broadening inspection beyond audio/video.
  • srchybrid/KnownFile.cpp uses the MediaInfo path for shared-file metadata tags when ExtractMetaData is enabled and the file is audio/video.
  • Hidden profile keys still control the legacy fallback switches: MediaInfo_RIFF, MediaInfo_RM, MediaInfo_WM, MediaInfo_MediaDet, MediaInfo_ID3LIB, and MediaInfo_MediaInfoDllPath.

Intended Scope

  • Serialize first-use DLL initialization so background File Info inspection and shared-file metadata extraction cannot race the global loader.
  • Load accepted DLL candidates with an explicit path and safe DLL search flags.
  • Treat a MediaInfo_Open result of 0 as an open failure and release the created MediaInfo handle immediately.
  • Keep one-close ownership around MediaInfo handles through local RAII.
  • Add testable seams for the minimum loader rules: no-load marker, version gate, candidate de-duplication, app-relative configured paths, and open-result handling.
  • Document the hidden profile-only MediaInfo keys in the preference matrix.

Out Of Scope

  • Embedding or statically linking MediaInfoLib.
  • Removing or replacing id3lib.
  • Changing BUG-028 from Wont-Fix.
  • Implementing the Windows Property Store work tracked separately by FEAT-007.
  • Broad CGetMediaInfoThread messaging or cancellation rewrites.

Acceptance

  • [x] Loader initialization is guarded by a synchronization primitive.
  • [x] Loader uses explicit-path LoadLibraryEx with safe DLL search flags.
  • [x] MediaInfo_Open == 0 produces no metadata result and does not leak the created handle.
  • [x] Existing metadata precedence is unchanged.
  • [x] Native seam tests cover the loader policy helpers.
  • [x] Workspace validation and the relevant native test target pass through python -m emule_workspace.