Application Flow
Phase 0 — the launcher (src/MovieMaker/main.cpp)
// src/MovieMaker/main.cpp (reconstructed shape)
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) {
// 1. Resolve this executable's directory.
// 2. LoadLibraryExW("WLXPhotoBase.dll") — optional bootstrap of the base DLL,
// guarded by its own __try/__except.
// 3. LoadLibraryExW("MovieMakerCore.dll") from the exe dir (with a
// LOAD_LIBRARY_AS_DATAFILE fallback).
// 4. GetProcAddress("MovieMakerMain").
// 5. Register the Vectored Exception Handler for MSVC C++ exception codes
// (0xe06d7363 magic + subcodes 0x19930520/21/22 and the
// undocumented 0x01994000). [Quirk #1] — installed only at this point,
// so DLL loading above happens without the VEH active.
// 6. Call MovieMakerMain(argc, argv) (__cdecl) inside
// __except(EXCEPTION_EXECUTE_HANDLER); remove the VEH afterwards.
}
The launcher does not use COM activation for the engine — MovieMakerCore.dll's CLSID
is literally all zeros (Quirk #3),
so the only way in is LoadLibrary + GetProcAddress.
Phase 1 — engine bootstrap (src/MovieMakerCore/dllmain.cpp)
MovieMakerMain initializes the engine before any UI exists:
- COM apartment setup and the
WMMR::CoInitializerguard. - D3D11 device creation — hardware with WARP fallback, deliberately using the single-threaded flag (Quirk #9).
- WIC imaging factory (
windowscodecs) for thumbnail/decode paths. - Media Foundation startup (
MFStartup). - The single-instance mutex
Global\WindowsLiveMovieMaker_Sundance_SingleInstance, created inMovieMakerMainbefore subsystem init (Quirk #2);SundanceAppMain::AcquireSingleInstanceMutexlater takes a second mutex,Global\WindowsLiveMovieMaker_SundanceApp, during initialization. - Delay-load hooks for the optional legacy DLLs (
WLXPhotoSqm,DmxBici,wlidcli,uxcore) so their absence cannot crash startup (Quirk #11).
Phase 2 — SundanceApp (SundanceApp/SundanceAppMain.cpp)
CSundanceApp builds the application skeleton:
- ProjectManager — creates the in-memory
MovieProject, wires dirty-state tracking and auto-save (via AutoSaveManager). - ImportController / ExportController — media import and export/publish pipelines.
- MediaBrowser + ThumbnailCache — media browsing surface with background thumbnail generation.
- UndoManager — transaction-based undo/redo stack with clipboard integration (ClipboardManager owns both the system clipboard chain and the internal clipboard).
- CommandLineParser — startup switches (project files, safemode).
- PlaybackController / TimelineController — hook the storyboard model to the preview.
The main window is a DirectUI host: SundanceNativeHwndHost bridges native HWNDs into the
DirectUI element tree, and SundanceAppDataContext (IDispatch) feeds data-bound UI.
Phase 3 — the Ribbon (UI/Ribbon/)
The Windows Ribbon Framework (uiribbon.h) is initialized with 67 command handlers
and a full UpdateState / ComputeCommandEnabled pass. The MRU (most-recently-used)
project list is backed by a site registry with its own registry "Count" query semantics.
Ribbon markup ships as UIFILE resources in MovieMakerLang.dll
(RT_UIFILE_RIBBON = 10000).
Phase 4 — storyboard model (StoryboardManager/)
A MovieProject is created (empty or from a .wlmp file via the
Serialization reader). The model is:
MovieProject→TimelineTracks (0 = video, higher = audio etc.)- Each track holds
MovieExtents (clips) with Extents arithmetic for layout/overlap. - Templates define the 23 effects / 7 themes; Theme applies visual themes by patching project XML.
- Transport (
StoryboardManager/Transport/) drives playback:TransportBaseplus a CommandBin of transport commands.
Phase 5 — rendering loop (HMREngine/ + Preview/)
PreviewPresenter(Preview/PreviewPresenter.cpp) owns the D3D11 preview surface.HMREngine::Engineruns the render loop: scene-graph traversal (RenderingList, depth-capped at 512), text rendering via DirectWrite, mesh/texture resources throughDXResources.- Media frames reach textures through HMRAVSource::TextureInterop (MF ↔ DX11 sharing),
with
VideoProchandling DXVA2/XVideoProc conversion (via thedxva2stubs.cppcompatibility layer). - Pattern meshes (
HMREngine/PatternMesh/) render the video transitions; the 92 transition/effect animation classes live inWLXPipetran(Quirk #18).
Phase 6 — publishing (Publishing/)
PublishJob runs the background encode/upload pipeline. In the current reconstruction the
render/encode stage produces verified test frames, not real video — a documented stub
category (see Stub Design). WLXTranscode.exe
and WLXCodecHost.exe participate out-of-process where the original used them.
Message flow after startup
Every user-visible action follows the same shape: UI behavior → controller → model mutation (inside an undo transaction) → transport/render invalidation.