{"_id":"@bun-win32/srclient","_rev":"3-cfdaebcd2e470f336316a58f69f0feb1","name":"@bun-win32/srclient","dist-tags":{"latest":"2.0.1"},"versions":{"1.0.0":{"name":"@bun-win32/srclient","version":"1.0.0","keywords":["bun","ffi","win32","windows","srclient","bindings","typescript","dll"],"author":"Stev Peifer <stev@bell.net>","license":"MIT","_id":"@bun-win32/srclient@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":"04708d2f7fb7f19c6484f4d836c826e44a686cdb","tarball":"https://registry.npmjs.org/@bun-win32/srclient/-/srclient-1.0.0.tgz","fileCount":6,"integrity":"sha512-bOkD4st9sKA0L1IJ8Wk+9eRFMp223o6QnpCgs59tZJkyALtvCqv7L5EXV35O3Rlu2NPmDEewUhDNc9onAC1cOg==","signatures":[{"sig":"MEUCID4xuH2GVMF1E04PIShDDxUv7qEGrWASKZ9ebMCNhkg/AiEA1ahuLRHO5x2jGkp+Z/KIyV82F+MEvqf+Ezt9Q6oLk3g=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":10300},"main":"./index.ts","type":"module","module":"index.ts","shasum":"04708d2f7fb7f19c6484f4d836c826e44a686cdb","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:restore-diagnostic":"bun ./example/restore-diagnostic.ts","example:restore-point-observatory":"bun ./example/restore-point-observatory.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev@bell.net"},"_integrity":"sha512-bOkD4st9sKA0L1IJ8Wk+9eRFMp223o6QnpCgs59tZJkyALtvCqv7L5EXV35O3Rlu2NPmDEewUhDNc9onAC1cOg==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/srclient"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 SRCLIENT 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/advapi32":"1.0.11","@bun-win32/kernel32":"1.0.21"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/srclient_1.0.0_1779222178616_0.2887705481757017","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"name":"@bun-win32/srclient","version":"2.0.0","keywords":["bun","ffi","win32","windows","srclient","bindings","typescript","dll"],"author":"Stev Peifer <stev.p@outlook.com>","license":"MIT","_id":"@bun-win32/srclient@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":"e2ab5e6c45f62baa166f889de2d750dc87b69843","tarball":"https://registry.npmjs.org/@bun-win32/srclient/-/srclient-2.0.0.tgz","fileCount":6,"integrity":"sha512-mrBH6hqriQnXNARXsyi2J7y1QEP99hXttYDZxfwBIgjUNsGzWMQ1NTfurzL4Uc0t4z10tD1IM90bU1YcC1cdkQ==","signatures":[{"sig":"MEUCIQD0J/LbyozPnj4RAB3uw4fl4kCDsH6E5sqsHmwnjseb1AIgArRaYUWkpiKylQdxMzpXBXLR3qmFuiSwKdrg/V6o7Cs=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":11559},"main":"./index.ts","type":"module","module":"index.ts","shasum":"e2ab5e6c45f62baa166f889de2d750dc87b69843","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:restore-diagnostic":"bun ./example/restore-diagnostic.ts","example:restore-point-observatory":"bun ./example/restore-point-observatory.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev.p@outlook.com"},"_integrity":"sha512-mrBH6hqriQnXNARXsyi2J7y1QEP99hXttYDZxfwBIgjUNsGzWMQ1NTfurzL4Uc0t4z10tD1IM90bU1YcC1cdkQ==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/srclient"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 SRCLIENT 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/advapi32":"2.0.0","@bun-win32/kernel32":"2.0.0"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/srclient_2.0.0_1782435964302_0.9076748304097895","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 SRCLIENT bindings for Bun (FFI) on Windows.","devDependencies":{"@bun-win32/advapi32":"2.0.1","@bun-win32/kernel32":"2.0.1","@types/bun":"latest"},"exports":{".":"./index.ts"},"license":"MIT","module":"index.ts","name":"@bun-win32/srclient","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/srclient"},"type":"module","version":"2.0.1","main":"./index.ts","keywords":["bun","ffi","win32","windows","srclient","bindings","typescript","dll"],"sideEffects":false,"engines":{"bun":">=1.1.0"},"scripts":{"example:restore-diagnostic":"bun ./example/restore-diagnostic.ts","example:restore-point-observatory":"bun ./example/restore-point-observatory.ts"},"_id":"@bun-win32/srclient@2.0.1","_integrity":"sha512-LWzMV3PUpBgrPh6PTUsEvwxliFv7yZDH8lYdC219vPF8r74Wlx/Z8PGetC1j+PPsjqC5LpMDDqCJbtcXSmPKXA==","_nodeVersion":"26.3.0","_npmVersion":"10.8.3","shasum":"dee3a752c0e94369e64297e70c30c07f586be395","dist":{"integrity":"sha512-LWzMV3PUpBgrPh6PTUsEvwxliFv7yZDH8lYdC219vPF8r74Wlx/Z8PGetC1j+PPsjqC5LpMDDqCJbtcXSmPKXA==","shasum":"dee3a752c0e94369e64297e70c30c07f586be395","tarball":"https://registry.npmjs.org/@bun-win32/srclient/-/srclient-2.0.1.tgz","fileCount":6,"unpackedSize":11559,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCh0kvBxFid9JXeLln/TG4DIREXLyo2bzQMtDEvJDSxwwIhAJhCltePsJdS9Oe6kQR6c25QwV7nE/t9bCCnHtDT32KE"}]},"_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/srclient_2.0.1_1782438170859_0.010796809154740572"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-19T20:22:58.510Z","modified":"2026-06-26T01:42:51.088Z","1.0.0":"2026-05-19T20:22:58.755Z","2.0.0":"2026-06-26T01:06:04.437Z","2.0.1":"2026-06-26T01:42:50.989Z"},"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","srclient","bindings","typescript","dll"],"repository":{"type":"git","url":"git://github.com/ObscuritySRL/bun-win32.git","directory":"packages/srclient"},"description":"Zero-dependency, zero-overhead Win32 SRCLIENT bindings for Bun (FFI) on Windows.","maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"readme":"# @bun-win32/srclient\n\nZero-dependency, zero-overhead Win32 SRCLIENT bindings for [Bun](https://bun.sh) on Windows.\n\n## Overview\n\n`@bun-win32/srclient` exposes the `srclient.dll` exports using [Bun](https://bun.sh)'s FFI. It provides a single class, `Srclient`, 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 `srclient.dll` (System Restore: create restore points, remove restore points).\n- In-source docs in `structs/Srclient.ts` with links to Microsoft Docs.\n- Lazy binding on first call; optional eager preload (`Srclient.Preload()`).\n- No wrapper overhead; calls map 1:1 to native APIs.\n- Strongly-typed Win32 aliases (see `types/Srclient.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/srclient\n```\n\n## Quick Start\n\n```ts\nimport Srclient, { MAX_DESC_W, RestorePointEventType, RestorePointType } from '@bun-win32/srclient';\n\n// RESTOREPOINTINFOW: DWORD dwEventType; DWORD dwRestorePtType; INT64 llSequenceNumber; WCHAR szDescription[256]\n// Struct is #pragma pack(1) — 4 + 4 + 8 + (256 * 2) = 528 bytes, no padding.\nconst restorePtSpec = Buffer.alloc(4 + 4 + 8 + MAX_DESC_W * 2);\nrestorePtSpec.writeUInt32LE(RestorePointEventType.BEGIN_SYSTEM_CHANGE, 0);\nrestorePtSpec.writeUInt32LE(RestorePointType.MODIFY_SETTINGS, 4);\nrestorePtSpec.writeBigInt64LE(0n, 8); // llSequenceNumber = 0 to begin\nBuffer.from('My checkpoint\\0', 'utf16le').copy(restorePtSpec, 16);\n\n// STATEMGRSTATUS: DWORD nStatus; INT64 llSequenceNumber  (pack(1) → 4 + 8 = 12 bytes)\nconst smgrStatus = Buffer.alloc(12);\n\nconst ok = Srclient.SRSetRestorePointW(restorePtSpec.ptr, smgrStatus.ptr);\nconst nStatus = smgrStatus.readUInt32LE(0);\nconst sequenceNumber = smgrStatus.readBigInt64LE(4);\nconsole.log('SRSetRestorePointW -> %d, nStatus=%d, seq=%d', ok, nStatus, sequenceNumber);\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:restore-point-observatory   # Live System Restore status dashboard\nbun run example:restore-diagnostic          # Full System Restore configuration audit\n```\n\n> Both examples are read-only: they query System Restore state and decode return codes\n> without creating or deleting restore points. They degrade gracefully when System\n> Restore is disabled or access is denied.\n\n## Notes\n\n- Either rely on lazy binding or call `Srclient.Preload()`.\n- `SRSetRestorePoint*` requires COM security initialization and an elevated context; it\n  fails (returning `FALSE` with `nStatus` set) in safe mode or when System Restore is\n  disabled. Applications must load `srclient.dll` dynamically (never load-time linking) —\n  Bun's FFI `dlopen` already satisfies this.\n- `RESTOREPOINTINFOA/W` and `STATEMGRSTATUS` are `#pragma pack(1)` — pack fields with no\n  alignment padding.\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"}