# @photostructure/windows-registry

[![npm version](https://img.shields.io/npm/v/@photostructure/windows-registry.svg)](https://www.npmjs.com/package/@photostructure/windows-registry)
[![Build](https://github.com/photostructure/vscode-windows-registry/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/photostructure/vscode-windows-registry/actions/workflows/build.yml)

> **Fork of [@vscode/windows-registry](https://github.com/microsoft/vscode-windows-registry) with prebuilt binaries.**
>
> The upstream package requires a C++ build toolchain at install time. This fork
> ships prebuilt NAPI binaries for `win32-x64` and `win32-arm64`, so no build
> tools are needed on the target machine.

Native node module to access the Windows Registry.

## Cross-platform support

This package installs cleanly on all platforms and architectures — no need for
`optionalDependencies`. On non-Windows platforms, all functions return
`undefined` (the same as when a registry key doesn't exist on Windows), so
calling code doesn't need platform checks.

## Installing

```sh
npm install @photostructure/windows-registry
```

## Using

```javascript
const { GetStringRegKey } = require('@photostructure/windows-registry');
console.log(GetStringRegKey('HKEY_LOCAL_MACHINE', 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion', 'ProgramFilesPath'));
```

## Development

Development requires npm 11.10 or later and a Node.js version accepted by
node-gyp 13: `^22.22.2 || ^24.15.0 || >=26.0.0`. CI builds on Node 24.19.0.

```sh
npm ci                 # install the committed dependency versions
npm run build:native   # rebuild the prebuilt binary
npm run analyze:native # rebuild with gated MSVC static analysis
npm run sanitize:native # rebuild win32-x64 with AddressSanitizer
npm run test:sanitize  # prove ASan catches a defect, then run the tests under ASan
npm test               # build, verify hardening, compile, and test
```

## License
[MIT](https://github.com/photostructure/vscode-windows-registry/blob/main/License.txt)

Upstream copyright Microsoft Corporation.
