{"_id":"@bun-win32/shcore","_rev":"4-458309d555bfd674d7fbe50714fdacfd","name":"@bun-win32/shcore","dist-tags":{"latest":"2.0.1"},"versions":{"1.0.0":{"name":"@bun-win32/shcore","version":"1.0.0","keywords":["bun","ffi","win32","windows","shcore","bindings","typescript","dll"],"author":"Stev Peifer <stev@bell.net>","license":"MIT","_id":"@bun-win32/shcore@1.0.0","maintainers":[{"name":"obscuritysrl","email":"stev@bell.net"}],"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dist":{"shasum":"62fa63f0459c3423f6ba60627990e7d4bd304e99","tarball":"https://registry.npmjs.org/@bun-win32/shcore/-/shcore-1.0.0.tgz","fileCount":6,"integrity":"sha512-W2sCIEC/TYGftC0tUsIWCQdvGGB3sBvANfKw+oEbn5Nkl3VGHztmYCFJzjuLyDagtXoqy++4idTyfH8Ywpu8UQ==","signatures":[{"sig":"MEQCIGYVIbp3b9MO05cAfqRxEezZBgICGMqqrTe4PkvIs3QIAiAs+n4WBg8Ci1F9r7K0NhGFaOrCf1B+yVpMxIUZHJQ0qw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":42089},"main":"./index.ts","type":"module","module":"index.ts","shasum":"62fa63f0459c3423f6ba60627990e7d4bd304e99","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:shcore":"bun ./example/shcore.ts","example:dpi-telescope":"bun ./example/dpi-telescope.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev@bell.net"},"_integrity":"sha512-W2sCIEC/TYGftC0tUsIWCQdvGGB3sBvANfKw+oEbn5Nkl3VGHztmYCFJzjuLyDagtXoqy++4idTyfH8Ywpu8UQ==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/shcore"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 SHCORE bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"24.3.0","dependencies":{"@bun-win32/core":"1.1.2"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/shcore_1.0.0_1776867986032_0.10602897611964757","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@bun-win32/shcore","version":"1.0.1","keywords":["bun","ffi","win32","windows","shcore","bindings","typescript","dll"],"author":"Stev Peifer <stev.p@outlook.com>","license":"MIT","_id":"@bun-win32/shcore@1.0.1","maintainers":[{"name":"obscuritysrl","email":"stev@bell.net"}],"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dist":{"shasum":"851f33f2ba0654137069ad459f9cdfe3083da098","tarball":"https://registry.npmjs.org/@bun-win32/shcore/-/shcore-1.0.1.tgz","fileCount":6,"integrity":"sha512-XrsSwMnwpmyccHBRnkk7WERbQp0CddexZdvi2BFZjkBNCpoPWQxJGf7Z/X5YhdwzQPLhymGhSR2G/PHHzyXDZA==","signatures":[{"sig":"MEUCIEl4aP7iccjWL394GkZixBQu6sw3F+6HJcRiWMuP3If1AiEA0YK7EYBQqCJgbwzJu+219iUnbEczXd9SrX41Ud6HOCE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":42094},"main":"./index.ts","type":"module","module":"index.ts","shasum":"851f33f2ba0654137069ad459f9cdfe3083da098","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:shcore":"bun ./example/shcore.ts","example:dpi-telescope":"bun ./example/dpi-telescope.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev@bell.net"},"_integrity":"sha512-XrsSwMnwpmyccHBRnkk7WERbQp0CddexZdvi2BFZjkBNCpoPWQxJGf7Z/X5YhdwzQPLhymGhSR2G/PHHzyXDZA==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/shcore"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 SHCORE bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"24.3.0","dependencies":{"@bun-win32/core":"1.1.4"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/shcore_1.0.1_1781629722674_0.8434557088004659","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"name":"@bun-win32/shcore","version":"2.0.0","keywords":["bun","ffi","win32","windows","shcore","bindings","typescript","dll"],"author":"Stev Peifer <stev.p@outlook.com>","license":"MIT","_id":"@bun-win32/shcore@2.0.0","maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dist":{"shasum":"8aba67d468e9749bbaa7cbaec1cf2fbebd8f8cac","tarball":"https://registry.npmjs.org/@bun-win32/shcore/-/shcore-2.0.0.tgz","fileCount":6,"integrity":"sha512-B9e4Dgo/60PaneYwQiUkyVcEblgD2k5oVdH+JaNaWrL8SVxFM/LNqv7H5PFzyxzJ8r8DYXY26uARDKDIlkXPUQ==","signatures":[{"sig":"MEQCIBQvJzueThsYteJyfQFywbUHDxQgD+q7MzQG/ZdprrdgAiBXLKvjBVjTSHhiljK25nBzYk2VKjNvQ/1Slzv1rLNCVA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":44417},"main":"./index.ts","type":"module","module":"index.ts","shasum":"8aba67d468e9749bbaa7cbaec1cf2fbebd8f8cac","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:shcore":"bun ./example/shcore.ts","example:dpi-telescope":"bun ./example/dpi-telescope.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev.p@outlook.com"},"_integrity":"sha512-B9e4Dgo/60PaneYwQiUkyVcEblgD2k5oVdH+JaNaWrL8SVxFM/LNqv7H5PFzyxzJ8r8DYXY26uARDKDIlkXPUQ==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/shcore"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 SHCORE bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"26.3.0","dependencies":{"@bun-win32/core":"2.0.0"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/shcore_2.0.0_1782435506520_0.32024846248188266","host":"s3://npm-registry-packages-npm-production"}},"2.0.1":{"author":"Stev Peifer <stev.p@outlook.com>","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dependencies":{"@bun-win32/core":"2.0.1"},"description":"Zero-dependency, zero-overhead Win32 SHCORE bindings for Bun (FFI) on Windows.","devDependencies":{"@types/bun":"latest"},"exports":{".":"./index.ts"},"license":"MIT","module":"index.ts","name":"@bun-win32/shcore","peerDependencies":{"typescript":"^5"},"private":false,"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","repository":{"type":"git","url":"git://github.com/ObscuritySRL/bun-win32.git","directory":"packages/shcore"},"type":"module","version":"2.0.1","main":"./index.ts","keywords":["bun","ffi","win32","windows","shcore","bindings","typescript","dll"],"sideEffects":false,"engines":{"bun":">=1.1.0"},"scripts":{"example:dpi-telescope":"bun ./example/dpi-telescope.ts","example:shcore":"bun ./example/shcore.ts"},"_id":"@bun-win32/shcore@2.0.1","_integrity":"sha512-Vz9oZ0NylWfmJ8cE+2e+l91CahBR+Esfxs8g8IdjdbqbcjctuvPYl3Rz57BZXSnh6JIG4Ax8/rsMzga4lctblg==","_nodeVersion":"26.3.0","_npmVersion":"10.8.3","shasum":"17cf3790399ad3ff3939d6fb932b7e352e60865f","dist":{"integrity":"sha512-Vz9oZ0NylWfmJ8cE+2e+l91CahBR+Esfxs8g8IdjdbqbcjctuvPYl3Rz57BZXSnh6JIG4Ax8/rsMzga4lctblg==","shasum":"17cf3790399ad3ff3939d6fb932b7e352e60865f","tarball":"https://registry.npmjs.org/@bun-win32/shcore/-/shcore-2.0.1.tgz","fileCount":6,"unpackedSize":44417,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDi5zWaUm9tueLYHamWaLFeehZDcSUaMSrW7Q11RYp2UQIgDuoZxEWvnh1vOQIXGL5kkmiG5fE76L4OgqFDznTRaSU="}]},"_npmUser":{"name":"obscuritysrl","email":"stev.p@outlook.com"},"directories":{},"maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/shcore_2.0.1_1782438166919_0.32021295254101667"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-22T14:26:25.880Z","modified":"2026-06-26T01:42:47.176Z","1.0.0":"2026-04-22T14:26:26.163Z","1.0.1":"2026-06-16T17:08:42.807Z","2.0.0":"2026-06-26T00:58:26.671Z","2.0.1":"2026-06-26T01:42:47.045Z"},"bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"author":"Stev Peifer <stev.p@outlook.com>","license":"MIT","homepage":"https://github.com/ObscuritySRL/bun-win32#readme","keywords":["bun","ffi","win32","windows","shcore","bindings","typescript","dll"],"repository":{"type":"git","url":"git://github.com/ObscuritySRL/bun-win32.git","directory":"packages/shcore"},"description":"Zero-dependency, zero-overhead Win32 SHCORE bindings for Bun (FFI) on Windows.","maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"readme":"# @bun-win32/shcore\n\nZero-dependency, zero-overhead Win32 SHCORE bindings for [Bun](https://bun.sh) on Windows.\n\n## Overview\n\n`@bun-win32/shcore` exposes the `shcore.dll` exports using [Bun](https://bun.sh)'s FFI. It provides a single class, `Shcore`, which lazily binds native symbols on first use. You can optionally preload a subset or all symbols up-front via `Preload()`.\n\nThe bindings are strongly typed for a smooth DX in TypeScript.\n\n## Features\n\n- [Bun](https://bun.sh)-first ergonomics on Windows 10/11.\n- Direct FFI to `shcore.dll` (DPI awareness, scale factors, AppUserModelID, random access streams, registry helpers, and more).\n- In-source docs in `structs/Shcore.ts` with links to Microsoft Docs.\n- Lazy binding on first call; optional eager preload (`Shcore.Preload()`).\n- No wrapper overhead; calls map 1:1 to native APIs.\n- Strongly-typed Win32 aliases (see `types/Shcore.ts`).\n\n## Requirements\n\n- [Bun](https://bun.sh) runtime\n- Windows 10 or later\n\n## Installation\n\n```sh\nbun add @bun-win32/shcore\n```\n\n## Quick Start\n\n```ts\nimport Shcore, { ProcessDpiAwareness } from '@bun-win32/shcore';\n\n// Optionally bind a subset up-front\nShcore.Preload(['SetProcessDpiAwareness', 'GetScaleFactorForDevice']);\n\n// Opt in to per-monitor DPI awareness (0 on success)\nconst hr = Shcore.SetProcessDpiAwareness(ProcessDpiAwareness.PROCESS_PER_MONITOR_DPI_AWARE);\nconsole.log('SetProcessDpiAwareness hr: 0x%s', (hr >>> 0).toString(16));\n\n// Read the preferred scale factor for the primary display (DEVICE_PRIMARY = 0)\nconst scale = Shcore.GetScaleFactorForDevice(0);\nconsole.log('Primary display scale: %d%%', scale);\n```\n\n> [!NOTE]\n> AI agents: see `AI.md` for the package binding contract and source-navigation guidance. It explains how to use the package without scanning the entire implementation.\n\n## Examples\n\nRun the included examples:\n\n```sh\nbun run example:dpi-scope     # Visualize DPI, scale, and shell UI sizing\nbun run example:shcore        # Process DPI awareness + AppUserModelID roundtrip\n```\n\n## Notes\n\n- Either rely on lazy binding or call `Shcore.Preload()`.\n- Windows only. Bun runtime required.\n- **SAL types & naming:** nullability is in the **type** — `Optional<T>` (formally optional, SAL `_*opt_`) and `Nullable<T>` (plain `[in]`/`[out]` the docs say can be NULL), the null sentinel derived from `T` (`null` for pointers `LP*`/`P*`, `0n` for handles/by-value addresses); direction is in the **parameter name** — `_out` (`_Out_`), `_in_out` (`_Inout_`), `_In_` bare. See `AI.md` and the repo `AGENTS.md`.\n","readmeFilename":"README.md"}