{"_id":"@bun-win32/userenv","_rev":"3-1c42e5e7fd51221982f3a1b7e81f3afa","name":"@bun-win32/userenv","dist-tags":{"latest":"2.0.1"},"versions":{"1.0.0":{"name":"@bun-win32/userenv","version":"1.0.0","keywords":["bun","ffi","win32","windows","userenv","bindings","typescript","dll"],"author":"Stev Peifer <stev@bell.net>","license":"MIT","_id":"@bun-win32/userenv@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":"8bab84da30388887973731ca6b93c6c02c7650e9","tarball":"https://registry.npmjs.org/@bun-win32/userenv/-/userenv-1.0.0.tgz","fileCount":6,"integrity":"sha512-zDmxFdcW87XGS9flhORo8HFlgAnoBdYcJyHdkL8LZP8rZhsRws2iBrdI3Lil5gtUFfkbtfdeM2I9npTzA2QvzA==","signatures":[{"sig":"MEUCID2fu0gjncntUS+8eWKc/XBwbVhspNxKuy4EKWjraOcNAiEAntDwX9lESWJY/3PyPXYu11TyMycEFg0HBEP23oiNXKk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":27338},"main":"./index.ts","type":"module","module":"index.ts","shasum":"8bab84da30388887973731ca6b93c6c02c7650e9","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:profile-panorama":"bun ./example/profile-panorama.ts","example:env-block-inspector":"bun ./example/env-block-inspector.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev@bell.net"},"_integrity":"sha512-zDmxFdcW87XGS9flhORo8HFlgAnoBdYcJyHdkL8LZP8rZhsRws2iBrdI3Lil5gtUFfkbtfdeM2I9npTzA2QvzA==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/userenv"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 USERENV 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","@bun-win32/kernel32":"1.0.21"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/userenv_1.0.0_1775846103412_0.6035045234072731","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"name":"@bun-win32/userenv","version":"2.0.0","keywords":["bun","ffi","win32","windows","userenv","bindings","typescript","dll"],"author":"Stev Peifer <stev.p@outlook.com>","license":"MIT","_id":"@bun-win32/userenv@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":"d15985d63d82f774367869abe4e83ef081467881","tarball":"https://registry.npmjs.org/@bun-win32/userenv/-/userenv-2.0.0.tgz","fileCount":6,"integrity":"sha512-wUilVVPES9mfHHhwaWcKmlxRtqdE9wDHwx/rqUClzIR0z4EGxx0rz0IMyOPEEiW/6J2YEhT966ITUIZ79GbU3A==","signatures":[{"sig":"MEYCIQDKwqsI6O+4IHe7NdYZLwU60NqAQtgKTG4htOXHnrKxBAIhAMePgOCTo0coDcFCaMWV9EKh1v/ThHN2UDNsJ2Jmc3Q/","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":29166},"main":"./index.ts","type":"module","module":"index.ts","shasum":"d15985d63d82f774367869abe4e83ef081467881","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:profile-panorama":"bun ./example/profile-panorama.ts","example:env-block-inspector":"bun ./example/env-block-inspector.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev.p@outlook.com"},"_integrity":"sha512-wUilVVPES9mfHHhwaWcKmlxRtqdE9wDHwx/rqUClzIR0z4EGxx0rz0IMyOPEEiW/6J2YEhT966ITUIZ79GbU3A==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/userenv"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 USERENV 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","@bun-win32/kernel32":"2.0.0"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/userenv_2.0.0_1782435974753_0.5596501970765582","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 USERENV bindings for Bun (FFI) on Windows.","devDependencies":{"@bun-win32/kernel32":"2.0.1","@types/bun":"latest"},"exports":{".":"./index.ts"},"license":"MIT","module":"index.ts","name":"@bun-win32/userenv","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/userenv"},"type":"module","version":"2.0.1","main":"./index.ts","keywords":["bun","ffi","win32","windows","userenv","bindings","typescript","dll"],"sideEffects":false,"engines":{"bun":">=1.1.0"},"scripts":{"example:env-block-inspector":"bun ./example/env-block-inspector.ts","example:profile-panorama":"bun ./example/profile-panorama.ts"},"_id":"@bun-win32/userenv@2.0.1","_integrity":"sha512-nUtVlDVe53teqz8vpamrXpyKXtKG+wbAKzdQUdaab1v2+wAauyqDoOg5bEeKiuIKTXzYGaz192qA/AX7C6Sn6g==","_nodeVersion":"26.3.0","_npmVersion":"10.8.3","shasum":"149124183fa37d9abf951017226b9c601d5a85db","dist":{"integrity":"sha512-nUtVlDVe53teqz8vpamrXpyKXtKG+wbAKzdQUdaab1v2+wAauyqDoOg5bEeKiuIKTXzYGaz192qA/AX7C6Sn6g==","shasum":"149124183fa37d9abf951017226b9c601d5a85db","tarball":"https://registry.npmjs.org/@bun-win32/userenv/-/userenv-2.0.1.tgz","fileCount":6,"unpackedSize":29166,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIDkRD0R8nGHua/aMrBr5cPzIqv/PU6Jq96GhC0K0+gPoAiEA7xg5oIxU28elRxUvKMKLUpw3+Vn4UdELe5wURIbsebs="}]},"_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/userenv_2.0.1_1782438201084_0.705685143550361"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-10T18:35:03.343Z","modified":"2026-06-26T01:43:21.371Z","1.0.0":"2026-04-10T18:35:03.569Z","2.0.0":"2026-06-26T01:06:14.910Z","2.0.1":"2026-06-26T01:43:21.227Z"},"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","userenv","bindings","typescript","dll"],"repository":{"type":"git","url":"git://github.com/ObscuritySRL/bun-win32.git","directory":"packages/userenv"},"description":"Zero-dependency, zero-overhead Win32 USERENV bindings for Bun (FFI) on Windows.","maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"readme":"# @bun-win32/userenv\r\n\r\nZero-dependency, zero-overhead Win32 Userenv bindings for [Bun](https://bun.sh) on Windows.\r\n\r\n## Overview\r\n\r\n`@bun-win32/userenv` exposes the `userenv.dll` exports using [Bun](https://bun.sh)'s FFI. It provides a single class, `Userenv`, which lazily binds native symbols on first use. You can optionally preload a subset or all symbols up-front via `Preload()`.\r\n\r\nThe bindings are strongly typed for a smooth DX in TypeScript.\r\n\r\n## Features\r\n\r\n- [Bun](https://bun.sh)-first ergonomics on Windows 10/11.\r\n- Direct FFI to `userenv.dll` (user profiles, environment blocks, and Group Policy).\r\n- In-source docs in `structs/Userenv.ts` with links to Microsoft Docs.\r\n- Lazy binding on first call; optional eager preload (`Userenv.Preload()`).\r\n- No wrapper overhead; calls map 1:1 to native APIs.\r\n- Strongly-typed Win32 aliases (see `types/Userenv.ts`).\r\n\r\n## Requirements\r\n\r\n- [Bun](https://bun.sh) runtime\r\n- Windows 10 or later\r\n\r\n## Installation\r\n\r\n```sh\r\nbun add @bun-win32/userenv\r\n```\r\n\r\n## Quick Start\r\n\r\n```ts\r\nimport Userenv from '@bun-win32/userenv';\r\n\r\n// Get the profiles root directory (e.g. C:\\Users)\r\nconst sizeBuf = Buffer.alloc(4);\r\nsizeBuf.writeUInt32LE(0, 0);\r\nUserenv.GetProfilesDirectoryW(null, sizeBuf.ptr);\r\n\r\nconst charCount = sizeBuf.readUInt32LE(0);\r\nconst pathBuf = Buffer.alloc(charCount * 2);\r\nsizeBuf.writeUInt32LE(charCount, 0);\r\nUserenv.GetProfilesDirectoryW(pathBuf.ptr, sizeBuf.ptr);\r\n\r\nconst profilesDir = pathBuf.toString('utf16le').replace(/\\0.*$/, '');\r\nconsole.log('Profiles directory:', profilesDir);\r\n```\r\n\r\n> [!NOTE]\r\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.\r\n\r\n## Examples\r\n\r\nRun the included examples:\r\n\r\n```sh\r\nbun run example:profile-panorama\r\nbun run example:env-block-inspector\r\n```\r\n\r\n## Notes\r\n\r\n- Either rely on lazy binding or call `Userenv.Preload()`.\r\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"}