# std.os.windows: Change HKEY to \*opaque \{\} · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/8bb2e96ac3b61a8aa393f250144fb9e1195ca60a)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 8bb2e96ac3b61a8aa393f250144fb9e1195ca60a

Requested commit: 8bb2e96ac3b61a8aa393f250144fb9e1195ca60a

Commit: 8bb2e96ac3b61a8aa393f250144fb9e1195ca60a

Tree: cf37940f5d9711cbacb6ae2d6618e9c62b1b05bb

Author: Ryan Liptak

Committer: Andrew Kelley

## Message

```
std.os.windows: Change HKEY to *opaque {}

The definition of HKEY__ as a struct with an unused int field is only the case in the Windows headers when `STRICT` is defined. From https://learn.microsoft.com/en-us/windows/win32/winprog/enabling-strict:

> When STRICT is defined, data type definitions change as follows:
>
> -  Specific handle types are defined to be mutually exclusive; for example, you will not be able to pass an HWND where an HDC type argument is required. Without STRICT, all handles are defined as HANDLE, so the compiler does not prevent you from using one type of handle where another type is expected.

Zig's `opaque {}` already gives this benefit to us, so the usage of a struct with an unused field is unnecessary, and it was causing HKEY to have an alignment of 4, which is a problem because there are HKEY constants like HKEY_LOCAL_MACHINE (0x80000002) that are not 4-byte aligned. Without this change, the compiler would not allow something like HKEY_LOCAL_MACHINE to be defined since it enforces pointer alignment.

```

## Parents

- [e4e1c21e1fa599c1f243cad9236c88676023f6a8](https://git.cafe/gitcafe/zig/commit/e4e1c21e1fa599c1f243cad9236c88676023f6a8?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/8bb2e96ac3b61a8aa393f250144fb9e1195ca60a?format=markdown)
