Zero-dependency, zero-overhead Win32 FFI bindings for Bun on Windows.
git clone https://github.com/ObscuritySRL/bun-win32Tools overview
# bun-win32
Zero-dependency Win32 FFI bindings for [Bun](https://bun.sh) on Windows. Each system DLL is a standalone `@bun-win32/*` package with full type definitions.
## Install
```sh
# Per-DLL packages:
bun add @bun-win32/kernel32 @bun-win32/user32 # etc...
# Or pull the entire surface in one install:
bun add @bun-win32/all # scoped meta-package
bun add bun-win32 # unscoped alias for the same surface
```
Requires Bun >= 1.1.0 and Windows 10+.
## Usage
After the first call resolves the symbol via `dlopen`/`dlsym`, the native function pointer is cached directly on the class. Every subsequent call is a straight pointer invocation through Bun's FFI - no marshaling layer, no runtime type checks, no wrapper overhead. It's the same codepath as calling the C function yourself.
For hot paths, `Preload()` resolves symbols eagerly so even the first call pays zero binding cost:
```ts
import Kernel32 from '@bun-win32/kernel32';
const pid = Kernel32.GetCurrentProcessId();
const ticks = Kernel32.GetTickCount64();
```
```ts
import User32 from '@bun-win32/user32';
User32.Preload(['GetForegroundWindow', 'SetWindowPos']);
const { GetForegroundWindow, SetWindowPos } = User32;
SetWindowPos(hWnd, 0n, x, y, width, height, flags);
```
> [!IMPORTANT]
> If you destructure before binding, you capture the lazy wrapper instead of the native function.
## Packages
All type definitions are provided by [`@bun-win32/core`](./packages/core).
Published packages are AI-friendly. Alongside the `README.md`, each package includes an `AI.md` file that documents the binding contract, type surface, and source layout so coding agents can use the package correctly.
#### Graphics & Windowing
- [`comctl32`](./packages/comctl32) - common controls, image lists, property sheets, DPA/DSA dynamic arrays, flat scroll bars, window subclassing
- [`comdlg32`](./packages/comdlg32) - common dialogs: Open / Save File, Choose Color, Choose Font, Print, Page Setup, Find / Replace, and `CommDlgExtendedError`
- [`d2d1`](./packages/d2d1) - Direct2D: GPU-accelerated 2D — `ID2D1Factory` / device-context creation plus Direct2D's native affine-matrix, color-space (sRGB / scRGB), gradient-mesh (Coons-patch), and trig / vector math (`D2D1CreateFactory`, `D2D1MakeRotateMatrix`, `D2D1ConvertColorSpace`, …)
- [`d3d11`](./packages/d3d11) - Direct3D 11 device / swap-chain creation, D3D11-on-12 interop, WinRT `IDirect3DDevice` / `IDirect3DSurface` bridges
- [`d3d12`](./packages/d3d12) - Direct3D 12 device creation, debug-layer / global-interface access, and root-signature serialize/deserialize (`D3D12CreateDevice`, `D3D12GetDebugInterface`, `D3D12GetInterface`, `D3D12SerializeVersionedRootSignature`, …) — modern GPU/compute/ML path
- [`d3dcompiler_47`](./packages/d3dcompiler_47) - HLSL → DXBC shader compilation, preprocessing, disassembly, reflection, blob part extraction, shader stripping, function linking graph
- [`dcomp`](./packages/dcomp) - DirectComposition device/surface creation (`DCompositionCreateDevice`/`2`/`3`, `DCompositionCreateSurfaceHandle`) and the Windows-11 compositor-clock frame/statistics surface (`DCompositionGetFrameId`, `DCompositionGetStatistics`, `DCompositionWaitForCompositorClock`, `DCompositionBoostCompositorClock`) — live compositor heartbeat proven pure-FFI
- [`dwmapi`](./packages/dwmapi) - DWM composition, blur, thumbnails
- [`dwrite`](./packages/dwrite) - DirectWrite factory entry point (`DWriteCreateFactory`): system font enumeration, text layout, glyph metrics, and pure-FFI ClearType/grayscale glyph rasterization over the `IDWriteFactory` COM vtable
- [`dxcore`](./packages/dxcore) - DXCore adapter-factory entry point (`DXCoreCreateAdapterFactory`): DXGI-independent GPU & compute-only MCDM adapter enumeration, hardware IDs, memory pools, and capability/attribute queries over the `IDXCoreAdapterFactory`/`List`/`Adapter` COM vtable
- [`dxgi`](./packages/dxgi) - DXGI adapter enumeration, factory creation, debug interface (`CreateDXGIFactory*`, `DXGIGetDebugInterface1`)
- [`dxva2`](./packages/dxva2) - DDC/CI monitor configuration (brightness, contrast, RGB drive/gain, colour temperature, VCP), physical monitor enumeration, DXVA2 / DXVA-HD video acceleration, OPM video output
- [`gdi32`](./packages/gdi32) - graphics device interface
- [`gdiplus`](./packages/gdiplus) - GDI+ flat C API: image load/save (PNG, JPEG, BMP, GIF, TIFF, ICO), antialiased 2D drawing, paths, regions, gradients, brushes, fonts, color matrix effects, metafile recording
- [`glu32`](./packages/glu32) - OpenGL utility functions
- [`magnification`](./packages/magnification) - Magnification API: recolor the entire desktop via a 5x5 color matrix (grayscale, photo-negative, sepia, color-blindness simulation), full-screen zoom/pan transforms, magnifier-control window filtering, and pen/touch input remapping
- [`mscms`](./packages/mscms) - Image Color Management (ICM): ICC profiles, color transforms, sRGB / Adobe RGB / CMYK conversion via Win32 CMM, display calibration, and the Windows Color System (WCS) profile management API
- [`opengl32`](./packages/opengl32) - OpenGL rendering context
- [`user32`](./packages/user32) - windows, messages, input, UI
- [`uxtheme`](./packages/uxtheme) - visual styles, themed controls, buffered painting
- [`windowscodecs`](./packages/windowscodecs) - Windows Imaging Component (WIC): zero-build image decode/encode (JPEG, PNG, GIF, TIFF, BMP, HEIF), scaling, flip/rotate, pixel-format conversion, palettes, color contexts, and metadata — the full proxy-function surface
#### Multimedia
- [`avifil32`](./packages/avifil32) - Video for Windows AVIFile API: open/create `.avi` files, enumerate streams, read/write video, audio, MIDI, and text streams, decode frames to DIBs (`AVIStreamGetFrame`), mux files from streams, editable-stream cut/copy/paste
- [`avrt`](./packages/avrt) - MMCSS multimedia thread scheduling: join system-profile tasks ("Pro Audio", "Games", …), raise AVRT priority, query the system-responsiveness reservation, and coordinate thread-ordering groups (`AvSetMmThreadCharacteristicsW`, `AvSetMmThreadPriority`, `AvQuerySystemResponsiveness`, `AvRtCreateThreadOrderingGroup`) — the low-latency audio/capture scheduling primitives
- [`dinput8`](./packages/dinput8) - DirectInput 8: every non-Xbox controller — racing wheels, flight sticks / HOTAS, generic gamepads (`DirectInput8Create`, `GetdfDIJoystick`); device enumeration, capabilities, acquisition, and polling over the `IDirectInput8` COM vtable
- [`directml`](./packages/directml) - Vendor-neutral, Direct3D 12-backed machine-learning device creation (`DMLCreateDevice`, `DMLCreateDevice1`); creates a real `IDMLDevice` over an `ID3D12Device` and decodes its true max feature level over the `IDMLDevice` COM vtable — DirectML shipped, proven pure-FFI, audit 0 mismatches
- [`dsound`](./packages/dsound) - DirectSound: playback / capture device creation & enumeration, full-duplex, and default-device GUID resolution (`DirectSoundCreate8`, `DirectSoundEnumerateW`, `GetDeviceID`, …) — synthesize and play PCM end-to-end over the `IDirectSound8` / `IDirectSoundBuffer` COM vtable
- [`gameinput`](./packages/gameinput) - GameInput, the modern unified input model — `GameInputCreate` Nano-COM factory + `Dll*` COM-server entries; gamepad / keyboard / mouse / flight & arcade stick / racing wheel / sensor readings over the `IGameInput` COM vtable
- [`mf`](./packages/mf) - Media Foundation pipeline: source resolver, ASF authoring graph (profile / multiplexer / indexer / splitter / stream selector), container media sinks (MP3 / AC-3 / ADTS / MPEG-4 / fragmented-MP4 / 3GP), streaming sinks, video renderer, network credential / proxy, and the protected-environment / signed-library surface (`MFCreateSourceResolver`, `MFCreateASFProfile`, `MFCreateMPEG4MediaSink`, `MFGetSupportedSchemes`, …)
- [`mfplat`](./packages/mfplat) - Media Foundation platform: lifecycle, work queues, MFT registry, media type / sample / byte stream factories (`MFStartup`, `MFTEnumEx`, `MFCreateAttributes`, `MFCreateSample`)
- [`mfreadwrite`](./packages/mfreadwrite) - Media Foundation source reader / sink writer factories (`MFCreateSourceReader*`, `MFCreateSinkWriter*`)
- [`mmdevapi`](./packages/mmdevapi) - MMDevice / Core Audio class factory, WASAPI async activation (`DllGetClassObject`, `ActivateAudioInterfaceAsync`)
- [`quartz`](./packages/quartz) - DirectShow runtime: HRESULT → text (`AMGetErrorTextA`/`W`) and the Filter Graph Manager `Dll*` COM server (`CLSID_FilterGraph` → `IGraphBuilder`); reaches legacy webcams / capture cards / codecs Media Foundation misses
- [`winmm`](./packages/winmm) - multimedia audio, MIDI, mixers, timers, joysticks, MCI
- [`xaudio2_9`](./packages/xaudio2_9) - XAudio2 2.9: low-latency audio engine + voice graph, X3DAudio positional math (matrix / Doppler / LPF solve), and every built-in XAPO — volume meter, reverb, FXEQ / FXMasteringLimiter / FXReverb / FXEcho (`XAudio2Create`, `X3DAudioInitialize`, `X3DAudioCalculate`, `CreateAudioVolumeMeter`, `CreateFX`); synthesize and play PCM end-to-end over the `IXAudio2` / `IXAudio2SourceVoice` COM vtable
- [`xinput1_4`](./packages/xinput1_4) - XInput 1.4: Xbox controller state, vibration, battery, audio, keystroke
- [`xinput9_1_0`](./packages/xinput9_1_0) - XInput 9.1.0: legacy Xbox controller state, vibration, DirectSound GUIDs
#### Networking
- [`bluetoothapis`](./packages/bluetoothapis) - Bluetooth Classic radio/device discovery, BLE GATT, SDP, authentication
- [`dnsapi`](./packages/dnsapi) - DNS resolution across every record type (A, AAAA, MX, NS, SOA, TXT, SRV, CAA, etc.), name validation, configured server discovery, DNS-SD, mDNS, async queries
- [`firewallapi`](./packages/firewallapi) - Windows Firewall policy via the FirewallAPI.dll COM server (`INetFwPolicy2` profile state through `DllGetClassObject`) plus the 9 documented network-isolation / AppContainer functions (enumerate, free, config, change subscriptions, connect-failure diagnostics) — What people ask about bun-win32
What is ObscuritySRL/bun-win32?
+
ObscuritySRL/bun-win32 is tools for the Claude AI ecosystem. Zero-dependency, zero-overhead Win32 FFI bindings for Bun on Windows. It has 14 GitHub stars and was last updated today.
How do I install bun-win32?
+
You can install bun-win32 by cloning the repository (https://github.com/ObscuritySRL/bun-win32) or following the README instructions on GitHub. ClaudeWave also provides quick install blocks on this page.
Is ObscuritySRL/bun-win32 safe to use?
+
ObscuritySRL/bun-win32 has not been audited yet by our security agent. Review the original repository on GitHub before using it in production.
Who maintains ObscuritySRL/bun-win32?
+
ObscuritySRL/bun-win32 is maintained by ObscuritySRL. The last recorded GitHub activity is from today, with 0 open issues.
Are there alternatives to bun-win32?
+
Yes. On ClaudeWave you can browse similar tools at /categories/tools, sorted by popularity or recent activity.
Deploy bun-win32 to your cloud
Ship this repo to production in minutes. Each platform spins up its own environment with editable env vars.
Maintain this repo? Add a badge to your README
Drop the badge into your GitHub README to show it's tracked on ClaudeWave. Each badge links back to this page and reflects the live Trust Score.
[](https://claudewave.com/repo/obscuritysrl-bun-win32)<a href="https://claudewave.com/repo/obscuritysrl-bun-win32"><img src="https://claudewave.com/api/badge/obscuritysrl-bun-win32" alt="Featured on ClaudeWave: ObscuritySRL/bun-win32" width="320" height="64" /></a>More Tools
A single CLAUDE.md file to improve Claude Code behavior, derived from Andrej Karpathy's observations on LLM coding pitfalls.
An AI SKILL that provide design intelligence for building professional UI/UX multiple platforms
🪨 why use many token when few token do trick — Claude Code skill that cuts 65% of tokens by talking like caveman
AI coding assistant skill (Claude Code, Codex, OpenCode, Cursor, Gemini CLI, and more). Turn any folder of code, SQL schemas, R scripts, shell scripts, docs, papers, images, or videos into a queryable knowledge graph. App code + database schema + infrastructure in one graph.
A light-weight and powerful meta-prompting, context engineering and spec-driven development system for Claude Code by TÂCHES.
CLI proxy that reduces LLM token consumption by 60-90% on common dev commands. Single Rust binary, zero dependencies