Skip to content

Run Windows games on Apple Silicon — free, open source, with an open compatibility database that tells you what actually works.

engine r11: CrossOver Wine 11 with patches 0010 (MF video frames shared through the video processor's allocator) and 0011 (%gs:0x68 kept in step with LastErrorValue on macOS); The Last Flame starts a run and plays its first fight on it (#99); lasterr, d3d9 and WMV probes

Gauthier Piarretteb2f135e196ae
diff --git a/spike/d3d9probe/probe.c b/spike/d3d9probe/probe.c
new file mode 100644
index 0000000..92825a2
--- /dev/null
+++ b/spike/d3d9probe/probe.c
@@ -0,0 +1,43 @@
+// d3d9probe: create a Direct3D 9 device on a hidden window, clear and present a few frames,
+// print what happened. Exit 0 when the device came up and presented, 1 otherwise. Built for
+// both halves with mingw so a d3d9 layer can be judged without a game or a screen.
+#include <windows.h>
+#include <d3d9.h>
+#include <stdio.h>
+
+int main(int argc, char **argv) {
+ int frames = argc > 1 ? atoi(argv[1]) : 30;
+ HWND hwnd = CreateWindowExA(0, "STATIC", "d3d9probe", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, NULL, NULL, GetModuleHandle(NULL), NULL);
+ if (!hwnd) { printf("no window\n"); return 1; }
+ IDirect3D9 *d3d = Direct3DCreate9(D3D_SDK_VERSION);
+ if (!d3d) { printf("Direct3DCreate9 failed\n"); return 1; }
+ UINT n = IDirect3D9_GetAdapterCount(d3d);
+ printf("adapters: %u\n", n);
+ for (UINT i = 0; i < n; i++) {
+ D3DADAPTER_IDENTIFIER9 id;
+ if (SUCCEEDED(IDirect3D9_GetAdapterIdentifier(d3d, i, 0, &id)))
+ printf("adapter %u: %s (%s) vendor %04x device %04x\n", i, id.Description, id.Driver, id.VendorId, id.DeviceId);
+ }
+ D3DCAPS9 caps;
+ if (SUCCEEDED(IDirect3D9_GetDeviceCaps(d3d, 0, D3DDEVTYPE_HAL, &caps)))
+ printf("caps: vs %x ps %x maxtex %ux%u\n", (unsigned)caps.VertexShaderVersion, (unsigned)caps.PixelShaderVersion, (unsigned)caps.MaxTextureWidth, (unsigned)caps.MaxTextureHeight);
+ D3DPRESENT_PARAMETERS pp = {0};
+ pp.Windowed = TRUE; pp.SwapEffect = D3DSWAPEFFECT_DISCARD; pp.hDeviceWindow = hwnd;
+ pp.BackBufferFormat = D3DFMT_UNKNOWN; pp.EnableAutoDepthStencil = TRUE; pp.AutoDepthStencilFormat = D3DFMT_D24S8;
+ IDirect3DDevice9 *dev = NULL;
+ HRESULT hr = IDirect3D9_CreateDevice(d3d, 0, D3DDEVTYPE_HAL, hwnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &pp, &dev);
+ if (FAILED(hr) || !dev) { printf("CreateDevice failed: 0x%08lx\n", hr); return 1; }
+ printf("device created\n");
+ int ok = 0;
+ for (int f = 0; f < frames; f++) {
+ MSG msg; while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessageA(&msg); }
+ IDirect3DDevice9_Clear(dev, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(f * 8 & 255, 64, 128), 1.0f, 0);
+ IDirect3DDevice9_BeginScene(dev); IDirect3DDevice9_EndScene(dev);
+ hr = IDirect3DDevice9_Present(dev, NULL, NULL, NULL, NULL);
+ if (FAILED(hr)) { printf("Present failed at frame %d: 0x%08lx\n", f, hr); break; }
+ ok++;
+ }
+ printf("presented %d/%d frames\n", ok, frames);
+ IDirect3DDevice9_Release(dev); IDirect3D9_Release(d3d);
+ return ok == frames ? 0 : 1;
+}
diff --git a/spike/engines/x64-crossover26.3-r11.json b/spike/engines/x64-crossover26.3-r11.json
new file mode 100644
index 0000000..e60450e
--- /dev/null
+++ b/spike/engines/x64-crossover26.3-r11.json
@@ -0,0 +1,139 @@
+{
+ "$schema": "https://highball.app/schemas/engine-manifest/v0",
+ "arch": "x86_64",
+ "baseEnv": {
+ "DYLD_FALLBACK_FRAMEWORK_PATH": "${frameworks}",
+ "DYLD_FALLBACK_LIBRARY_PATH": "${frameworks}:${frameworks}/GStreamer.framework/Versions/1.0/lib",
+ "GST_PLUGIN_PATH": "${frameworks}/GStreamer.framework/Versions/1.0/lib/gstreamer-1.0",
+ "WINEDEBUG": "fixme-all",
+ "DXMT_ALLOW_CROSS_PROCESS_SWAPCHAIN": "1"
+ },
+ "components": {
+ "d3dmetal-tsshim": {
+ "extract": {
+ "into": "renderers/d3dmetal-tsshim/wine",
+ "subpath": "renderers/d3dmetal-tsshim/wine"
+ },
+ "kind": "renderer",
+ "layout": [
+ "x86_64-windows/d3d12.dll"
+ ],
+ "license": "MIT",
+ "note": "A d3d12.dll in front of D3DMetal's that serves DirectX 12 timestamp queries (D3DMetal 3.0 resolves them to zero at a reported 60 Hz). Exports carry Microsoft's d3d12 ordinals (D3D12CreateDevice at 101), which D3DMetal mirrors, so games that bind d3d12 imports by ordinal load through it. Kill switch HB_D3D12_TSSHIM=0 idles the patches; the DLL stays in front. Source: spike/tsshim, Scripts/build-tsshim.sh.",
+ "order": 1,
+ "sha256": "453f33ef1442ec8d24e9a44d901d35d4d07431c05ae8318c30567facc78d9ef3",
+ "size": 46116,
+ "url": "https://github.com/gauthierpiarrette/highball-engine/releases/download/d3dmetal-tsshim-20260915/d3dmetal-tsshim-20260915.tar.xz",
+ "version": "20260915"
+ },
+ "dxmt": {
+ "extract": {
+ "into": "renderers/dxmt/wine",
+ "subpath": "highball"
+ },
+ "kind": "renderer",
+ "license": "MIT (Highball branch of DXMT: SwapDeviceContextState, cross-process opt-in)",
+ "sha256": "0b86f0c793e99ae88bb4ff5f8575403ad138598a44a90248c71d6bc3ec18923b",
+ "size": 18922634,
+ "url": "https://github.com/gauthierpiarrette/highball-engine/releases/download/dxmt-highball-20260904T194518Z-7421db2/dxmt-highball-20260904T194518Z-7421db2.tar.gz"
+ },
+ "moltenvk": {
+ "extract": {
+ "into": "frameworks/libMoltenVK.dylib",
+ "subpath": "libMoltenVK.dylib"
+ },
+ "kind": "runtime",
+ "license": "Apache-2.0",
+ "note": "MoltenVK 1.4.2 rebuilt with two Highball patches (spike/patches/moltenvk-shadow-import.patch and moltenvk-linear-fallback.patch, Scripts/build-moltenvk.sh). Shadow import is off unless a launch sets MVK_SHADOW_IMPORT=1 (32-bit native-Vulkan games such as The Sims Legacy Collection). Linear fallback is always on: a linear-tiled image that Metal cannot back with linear memory (3D, mipmapped or array images) is created with optimal tiling instead of failing vkCreateImage, which is what takes Red Dead Redemption 2 from an exit at 98 per cent to the main menu and the story.",
+ "order": 1,
+ "sha256": "d54eda91b65a8aa72a5242a87181394495b5cc88ea3d58ef1a5ce8240a2bc447",
+ "size": 1728530,
+ "url": "https://github.com/gauthierpiarrette/highball/releases/download/engine-components/moltenvk-1.4.2-shadow-import-1-linear-fallback-1-x86_64.tar.gz",
+ "version": "1.4.2+shadow-import-1+linear-fallback-1"
+ },
+ "runtime": {
+ "extract": {
+ "into": "frameworks",
+ "subpath": "Template-1.0.11.app/Contents/Frameworks"
+ },
+ "kind": "frameworks",
+ "license": "mixed (LGPL-2.1 GStreamer, Apache-2.0 MoltenVK, LGPL gnutls, ...)",
+ "sha256": "9fa15479e7ff6abd99c1d07be285fb95f41fc6991586502427152b1f7d6ccb8a",
+ "size": 84533420,
+ "url": "https://github.com/Sikarugir-App/Wrapper/releases/download/v1.0/Template-1.0.11.tar.xz"
+ },
+ "wine": {
+ "extract": {
+ "into": "engine",
+ "subpath": "engine"
+ },
+ "kind": "engine",
+ "license": "LGPL-2.1+",
+ "note": "Built from CodeWeavers' crossover-sources-26.3.0.tar.gz (sha pinned in highball-engine/inputs.json) by highball-engine's build workflow with patches 0001, 0002, 0003, 0005, 0006, 0007, 0008 and 0009. 0009 swaps %gs:0x20 between Tib.FiberData (what PE code reads as GetCurrentFiber()) and the pthread QoS class (what macOS's libdispatch and pthread read) at every crossing between PE and unix code, so a fiber-based game no longer corrupts the scheduling slot: with 0008 alone Metaphor: ReFantazio opened a black window and hung in libdispatch. Stripped; Wine Mono 10.4.1 and Gecko 2.47.4 included.",
+ "sha256": "d62688047adfa6294ef2dab826b80049c8a2f73b321bd015da4a18678c536e40",
+ "size": 334863285,
+ "url": "https://github.com/gauthierpiarrette/highball-engine/releases/download/engine-wine-11.0-20260920T024505Z-0011b-lasterror-inline/engine-wine-11.0-20260920T024505Z-0011b-lasterror-inline.tar.gz",
+ "version": "wine-11.0 (CrossOver 26.3 tree) Highball build 2026-09-12, fiber and QoS slot swap + Highball patches 0001-0011 (0010: mfreadwrite relies on the video processor's sample allocator; 0011: %gs:0x68 kept in step with LastErrorValue on macOS)"
+ },
+ "winetricks": {
+ "kind": "tool",
+ "license": "LGPL-2.1",
+ "note": "Pinned to upstream commit 5a59ea07 (20260125+dev, 2026-08-07) — the exact bytes 0.7.x verified with dotnet48. The old branch URL drifted and broke every fresh engine install (issues #27/#28); URLs here must be immutable.",
+ "sha256": "f35c29737ca08a583569e6a3752d52fbe23333c5acfad5f16c4177d25eaf3f4b",
+ "url": "https://raw.githubusercontent.com/Winetricks/winetricks/5a59ea07513b24093bd90fad943ecf9543cf05bc/src/winetricks"
+ },
+ "nvapi-stub": {
+ "extract": {
+ "into": "engine/lib/wine/i386-windows/nvapi.dll",
+ "subpath": "nvapi.dll"
+ },
+ "kind": "runtime",
+ "license": "MIT (Highball)",
+ "order": 1,
+ "note": "A 32-bit nvapi.dll stub (spike/nvapi-stub, 40 lines of C) placed in the engine's i386 DLL directory with Wine's builtin marker. Games that see an NVIDIA adapter insist on NVIDIA's driver library and load it from the system directory only, so a stub beside the game does nothing; this one answers NvAPI_Initialize with OK and everything else with 'not implemented'. It only matters for a bottle or application given an NVIDIA identity (Highball's default is AMD), which is what lets legacy CS:GO pass its shadow-map check on wined3d.",
+ "sha256": "cbda8aeee87e84ecf98c06759d2123b073dc99a7aa1c639480fade33383d18a2",
+ "size": 1759,
+ "url": "https://github.com/gauthierpiarrette/highball/releases/download/engine-components/nvapi-stub-2-i386.tar.gz",
+ "version": "2",
+ "refreshesPrefix": true
+ }
+ },
+ "displayName": "Wine 11.0 (CrossOver 26.3) r11",
+ "id": "x64-crossover26.3-r11",
+ "licenses": {
+ "apple-gptk-license-2023-08-17": {
+ "applies": [
+ "renderers/d3dmetal (bundled in the Sikarugir Template: D3DMetal.framework sha1 1405e5c6… identical to GPTK 3.0-3)"
+ ],
+ "summary": "Apple Game Porting Toolkit license: non-commercial use/distribution only; no modification; use scoped to developing, testing or evaluating games on Apple hardware.",
+ "text": "spike/d3dmetal-license.txt"
+ }
+ },
+ "minMacOS": "14.0",
+ "notes": [
+ "r11 (2026-09-20): r10 with patches 0010 and 0011. 0010 (Proton 164af86d): the Media Foundation source reader lets the video processor's allocator create sample textures, so a game's media player gets a real shared handle from DXMT instead of null (The Last Flame's menu video now plays, highball#99; 3Shain/dxmt#135). 0011: on macOS %gs:0x68, where MSVC-built code such as Unity's Mono reads GetLastError() directly, is kept in step with TEB->LastErrorValue, so a Unity game's error paths no longer see garbage (The Last Flame's Start threw IOException Unknown error on a missing save). DXMT_ALLOW_CROSS_PROCESS_SWAPCHAIN=1 is in the base environment: CEF launcher windows paint on Wine 11 with it. Known: winedmo.so still links a Homebrew FFmpeg 9 the engine does not ship, so Wine's MF sources fall back to GStreamer; unchanged from r10.",
+ "r10 (2026-09-15): r9 with MoltenVK 1.4.2 (July 2026) in place of 1.4.1, same two Highball patches. 1.4.2 fixes heap placement checks, imported texture residency, cached texture invalidation and an occlusion query crash, all candidates for Red Dead Redemption 2's trees popping in and out on Apple Silicon (highball#93). A candidate engine, not the default: pick it under Advanced. Everything else is byte-identical to r9.",
+ "r9 (2026-09-15): r8 with the d3dmetal-tsshim component rebuilt so its exports carry Microsoft's d3d12 ordinals (D3D12CreateDevice at 101), which D3DMetal mirrors. The earlier shim numbered them from 1, so a game that binds d3d12 imports by ordinal (Path of Exile 2 delay-loads D3D12CreateDevice as ordinal 101) died at startup with 'ordinal 101 out of range' and Wine's exception 0xc06d007f (highball-db#53). The Wine build and every other component are byte-identical to r8, so existing downloads are reused; only the 46 KB shim tarball is new.",
+ "r8 (2026-09-12): r7 plus patch 0009, the fiber and QoS slot swap. On r5 to r7 a game whose job threads switch fibers and also drive the window could hang black at full CPU, because the fiber pointer the 0008 mirror keeps in the thread slot is what macOS reads there as the thread's QoS class (Metaphor: ReFantazio, highball#80, measured with its free demo). r8 gives the slot to whichever side is running. Nothing else changed from r7.",
+ "r7 (2026-09-11): r6 plus a 32-bit NVAPI stub in the engine. With it, legacy CS:GO plays on macOS 26 through wined3d with an NVIDIA identity scoped to csgo.exe (the csgo-legacy recipe), the route CrossOver users take: DXVK's D3D9 on this Mac either loses the device on Source's HDR pass or stalls after the map load, and wined3d needs the NVIDIA shadow-map path, which needs NVAPI to answer. Nothing else changed from r6.",
+ "r6 (2026-09-11): r5 plus the MoltenVK linear-fallback patch. Red Dead Redemption 2 loads, reaches its main menu and starts the story on this engine (M1 Pro, macOS 26.6.2, 1280x720 windowed, about 60 fps in menus); every earlier engine exits at 98 per cent of the first load because MoltenVK refuses the game's linear 3D, mipmapped and array images. Nothing else changed from r5.",
+ "r5 (2026-09-09): r4 plus patch 0008, the fiber mirror. Marvel's Guardians of the Galaxy reaches gameplay on this engine and crashes on Play Game on every earlier one, verified twice from a clean start on an M1 Pro, macOS 26.6.2, at 27.5 fps in the opening scene. A reproducer that needs no game (private/notes/fibertest4.c) faults identically to the game on r4 and runs clean here.",
+ "Cost of 0008, measured: offset 0x20 holds the thread's pthread QoS class on macOS, so a thread that uses fibers loses that scheduling hint. Windows and macOS both fix that offset, so a correct GetCurrentFiber() and an intact QoS cache cannot coexist. Confined to threads that call the fiber APIs, and a stress run of 8 threads and 6.4M switches showed TLS and thread creation unaffected (320000 wrong fiber values on r4, 0 here).",
+ "Optional engine (2026-09-07): Highball's own build of the CrossOver 26.3 Wine tree (Wine 11.0) with the same DXMT, D3DMetal, MoltenVK and Template runtime as the default engine. Not the default: a bottle moves to it from its Advanced settings, or Highball offers it when a launcher's recipe names it (the EA app). Verified here: EA app install and sign-in, The Sims 4 through it (DXMT, 128 fps on an M1 Pro), Steam with GTA V install, Rockstar launcher sign-in window, Ubisoft Connect window.",
+ "Games were not re-verified on this engine (CS:GO's cascaded shadow maps are known to differ), which is why it is offered for the launchers that need it, one environment at a time, and never becomes the default on its own. Steam's own client renders here (CEF), as do the Rockstar and Ubisoft sign-in windows; their account services were the wall in testing, not the engine.",
+ "Why it exists: Wine 10 (the default engine) cannot start the EA app's vital background service or run its .NET setup steps, and its winemac lacks the cross-process remote-layer route that the Rockstar and Ubisoft launchers' browsers need (highball#15, #56, #60). This tree carries Highball's patches for both.",
+ "Three patches make the tree behave like the default engine: the Windows user follows the macOS user (CrossOver hack 12735 reverted), WINEDLLPATH_PREPEND is honoured so the renderer overlays apply, and wined3d's automatic renderer is OpenGL first as upstream. winemac.so exports macdrv_functions, so the DXMT and D3DMetal bridges work. This engine ships no winemetal.dll of its own; the DXMT overlay carries it. Wine Mono and Gecko are included.",
+ "DXMT here is Highball's branch (cross-process swapchains, DXMT_ALLOW_CROSS_PROCESS_SWAPCHAIN=1), needed by the EA client. D3DMetal is the Template's 3.0 with the timestamp shim in front, as on the default engine. Accepted licences carry over when a bottle moves.",
+ "Moving a bottle here re-runs the Windows setup (different Wine build); moving back is the same step. Nothing installed in the bottle is removed either way.",
+ "r11, the base environment (2026-09-18): DXMT_ALLOW_CROSS_PROCESS_SWAPCHAIN=1 for every process. On the Wine 11 tree, browser UIs whose GPU process draws into another process's window need it or DXMT refuses the swapchain: Rockstar's sign-in then paints (verified 2026-09-05 and 2026-09-18), Battle.net's client stops crashing but its window stays black, and Steam's window comes into being where two cold starts without the flag created none, but it too stays black (measured on r10, 2026-09-18). So the flag is necessary on Wine 11 and not sufficient for Steam or Battle.net; the black browser is a separate Wine 11 problem still open."
+ ],
+ "requires": [
+ "rosetta2"
+ ],
+ "verified": {
+ "date": "2026-09-20",
+ "macos": "27.0",
+ "chip": "Apple M1 Pro",
+ "result": "The Last Flame Prologue (Unity 2021.3, Steam 2517810): menu video plays under DXMT (0 null-handle lines), Embark starts a run, the board is playable, quit through the menu is clean and the run's save is written, all with 0 IOException lines; on r10 the same click threw IOException Unknown error on the missing save and never started. 86 fps on DXMT at 1728x1117 on the board; DXVK also reaches the board but at 20 fps (45 ms GPU) and without the menu video. The lasterr probes (spike/lasterr) read GetLastError, the TEB and %gs:0x68 in step (2/2/2 and 7/7/7); on r10 %gs:0x68 held a heap pointer."
+ }
+}
diff --git a/spike/lasterr/lasterr.c b/spike/lasterr/lasterr.c
new file mode 100644
index 0000000..d08f67a
--- /dev/null
+++ b/spike/lasterr/lasterr.c
@@ -0,0 +1,17 @@
+// Does GetLastError() hold ERROR_FILE_NOT_FOUND after DeleteFileW on a missing file, or garbage?
+// Unity's Mono threw IOException "Unknown error (0xd6305a70)" from File.Delete on Wine/macOS
+// (The Last Flame, 2026-09-20). Reads the value three ways: the API, the TEB via NtCurrentTeb(),
+// and %gs:0x68 directly (what code compiled against the Windows layout may do).
+#include <windows.h>
+#include <stdio.h>
+int main(void) {
+ SetLastError(0);
+ BOOL ok = DeleteFileW(L"C:\\users\\public\\does-not-exist-12345.tmp");
+ DWORD api = GetLastError();
+ DWORD teb = *(DWORD *)((char *)NtCurrentTeb() + 0x68);
+ DWORD gs = __readgsdword(0x68);
+ printf("DeleteFileW ok=%d GetLastError=%lu (0x%lx) TEB->LastErrorValue=%lu %%gs:0x68=%lu (0x%lx)\n", ok, api, api, teb, gs, gs);
+ SetLastError(1234);
+ printf("after SetLastError(1234): GetLastError=%lu %%gs:0x68=%lu (0x%lx) TEB self=%p\n", GetLastError(), __readgsdword(0x68), __readgsdword(0x68), (void*)NtCurrentTeb());
+ return 0;
+}
diff --git a/spike/lasterr/lasterr2.c b/spike/lasterr/lasterr2.c
new file mode 100644
index 0000000..864d623
--- /dev/null
+++ b/spike/lasterr/lasterr2.c
@@ -0,0 +1,17 @@
+// Walk the last-error slot across crossings: set, syscall, read, then a failing API.
+#include <windows.h>
+#include <stdio.h>
+static void show(const char *tag) {
+ DWORD api = GetLastError(); DWORD teb = *(DWORD *)((char *)NtCurrentTeb() + 0x68); DWORD gs = __readgsdword(0x68);
+ printf("%-34s GetLastError=%lu TEB=%lu gs:0x68=%lu (0x%lx)\n", tag, api, teb, gs, gs);
+}
+int main(void) {
+ SetLastError(7); show("after SetLastError(7)");
+ Sleep(0); show("after Sleep(0) [syscall]");
+ HANDLE h = CreateFileW(L"C:\\windows\\system32\\kernel32.dll", GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
+ show("after CreateFileW ok");
+ CloseHandle(h); show("after CloseHandle");
+ SetLastError(0); DeleteFileW(L"C:\\users\\public\\nope-12345.tmp"); show("after DeleteFileW missing");
+ SetLastError(0); GetFileAttributesW(L"C:\\users\\public\\nope-12345.tmp"); show("after GetFileAttributesW missing");
+ return 0;
+}
diff --git a/spike/wmvprobe/probe.c b/spike/wmvprobe/probe.c
new file mode 100644
index 0000000..9e444cf
--- /dev/null
+++ b/spike/wmvprobe/probe.c
@@ -0,0 +1,37 @@
+// CoCreateInstance the WMVideo Decoder (CLSID_CWMVDecMediaObject) as a DMO and as an MFT, and
+// enumerate MFTs for WMV3 input, the three ways a prerequisite checker might ask "is the
+// WMV decoder installed". Prints HRESULTs.
+#define COBJMACROS
+#include <windows.h>
+#include <objbase.h>
+#include <mfapi.h>
+#include <mftransform.h>
+#include <dmo.h>
+#include <stdio.h>
+static const CLSID CLSID_WMV = {0x82d353df,0x90bd,0x4382,{0x8b,0xc2,0x3f,0x61,0x92,0xb7,0x6e,0x34}};
+int main(void){
+ HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
+ printf("CoInitializeEx: 0x%08lx\n", hr);
+ IUnknown *u = NULL;
+ hr = CoCreateInstance(&CLSID_WMV, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)&u);
+ printf("CoCreateInstance(WMV decoder, IUnknown): 0x%08lx\n", hr); if (u) IUnknown_Release(u);
+ IMediaObject *dmo = NULL;
+ hr = CoCreateInstance(&CLSID_WMV, NULL, CLSCTX_INPROC_SERVER, &IID_IMediaObject, (void**)&dmo);
+ printf("CoCreateInstance(WMV decoder, IMediaObject): 0x%08lx\n", hr); if (dmo) IMediaObject_Release(dmo);
+ IMFTransform *mft = NULL;
+ hr = CoCreateInstance(&CLSID_WMV, NULL, CLSCTX_INPROC_SERVER, &IID_IMFTransform, (void**)&mft);
+ printf("CoCreateInstance(WMV decoder, IMFTransform): 0x%08lx\n", hr); if (mft) IMFTransform_Release(mft);
+ hr = MFStartup(MF_VERSION, MFSTARTUP_FULL);
+ printf("MFStartup: 0x%08lx\n", hr);
+ MFT_REGISTER_TYPE_INFO in = { MFMediaType_Video, {0x33564d57,0x0000,0x0010,{0x80,0x00,0x00,0xaa,0x00,0x38,0x9b,0x71}} }; /* WMV3 */
+ IMFActivate **acts = NULL; UINT32 n = 0;
+ hr = MFTEnumEx(MFT_CATEGORY_VIDEO_DECODER, MFT_ENUM_FLAG_SYNCMFT | MFT_ENUM_FLAG_ASYNCMFT | MFT_ENUM_FLAG_HARDWARE | MFT_ENUM_FLAG_SORTANDFILTER, &in, NULL, &acts, &n);
+ printf("MFTEnumEx(video decoder, WMV3 in): 0x%08lx count=%u\n", hr, n);
+ for (UINT32 i = 0; i < n; i++) { WCHAR *name = NULL; UINT32 len = 0; if (SUCCEEDED(IMFActivate_GetAllocatedString(acts[i], &MFT_FRIENDLY_NAME_Attribute, &name, &len))) { printf(" mft: %ls\n", name); CoTaskMemFree(name); } IMFActivate_Release(acts[i]); }
+ CoTaskMemFree(acts);
+ /* DMO enumeration by category, the DirectShow-era way */
+ IEnumDMO *e = NULL; hr = DMOEnum(&DMOCATEGORY_VIDEO_DECODER, 0, 0, NULL, 0, NULL, &e);
+ printf("DMOEnum(video decoder): 0x%08lx\n", hr);
+ if (e) { CLSID c; WCHAR *nm; ULONG got; while (IEnumDMO_Next(e, 1, &c, &nm, &got) == S_OK && got) { printf(" dmo: %ls\n", nm); CoTaskMemFree(nm); } IEnumDMO_Release(e); }
+ MFShutdown(); CoUninitialize(); return 0;
+}