Skip to content

[bug] EnsureCEALibraryLoaded mutates the whole Excel process's DLL search path via SetDllDirectoryW #195

Description

@djkees

Summary
EnsureCEALibraryLoaded (source/bind/excel/vba/modCEADeclare.bas) calls the Win32 SetDllDirectoryW API when resolving cea_excel.dll's folder. This call changes the DLL search order for the entire Excel process, not just this workbook, and is never reset afterward.

Reproduction

  • Interface: Excel/VBA
  • Open two macro-enabled workbooks in the same Excel session, one using the CEA Excel wrapper; inspect DLL search behavior for the other workbook's add-ins afterward.

Expected behavior
DLL directory scoping should be workbook-local (e.g. via LOAD_LIBRARY_SEARCH_* flags on LoadLibraryExW, or restoring the previous SetDllDirectoryW value after loading) rather than a persistent process-wide side effect.

Actual behavior
Loading the CEA wrapper in one workbook can affect DLL resolution for unrelated add-ins/workbooks open in the same Excel session.

Environment

  • OS: 64-bit Windows Excel
  • CEA version/commit: main as of 2026-09-02

Additional context
source/bind/excel/vba/modCEADeclare.bas, EnsureCEALibraryLoaded, around the SetDllDirectoryW call.

Drafted with Claude's assistance

  • Confirmed by reading EnsureCEALibraryLoaded in full and noting no corresponding reset/restore call exists anywhere in the module.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority: lowCosmetic, nice-to-have, or open-ended with no clear action yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions