Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

std.os.windows.advapi32: Add RegGetValueW, RegLoadAppKeyW, and RegEnumKeyExW #15560

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions lib/std/os/windows/advapi32.zig
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ const DWORD = windows.DWORD;
const HKEY = windows.HKEY;
const BYTE = windows.BYTE;
const LPCWSTR = windows.LPCWSTR;
const LPWSTR = windows.LPWSTR;
const LSTATUS = windows.LSTATUS;
const REGSAM = windows.REGSAM;
const ULONG = windows.ULONG;
const WINAPI = windows.WINAPI;
const FILETIME = windows.FILETIME;

pub extern "advapi32" fn RegOpenKeyExW(
hKey: HKEY,
Expand All @@ -33,3 +35,52 @@ pub extern "advapi32" fn RegCloseKey(hKey: HKEY) callconv(WINAPI) LSTATUS;
// http://msdn.microsoft.com/en-us/library/windows/desktop/aa387694.aspx */
pub extern "advapi32" fn SystemFunction036(output: [*]u8, length: ULONG) callconv(WINAPI) BOOL;
pub const RtlGenRandom = SystemFunction036;

pub const RRF = struct {
pub const RT_ANY: DWORD = 0x0000ffff;

pub const RT_DWORD: DWORD = 0x00000018;
pub const RT_QWORD: DWORD = 0x00000048;

pub const RT_REG_BINARY: DWORD = 0x00000008;
pub const RT_REG_DWORD: DWORD = 0x00000010;
pub const RT_REG_EXPAND_SZ: DWORD = 0x00000004;
pub const RT_REG_MULTI_SZ: DWORD = 0x00000020;
pub const RT_REG_NONE: DWORD = 0x00000001;
pub const RT_REG_QWORD: DWORD = 0x00000040;
pub const RT_REG_SZ: DWORD = 0x00000002;

pub const NOEXPAND: DWORD = 0x10000000;
pub const ZEROONFAILURE: DWORD = 0x20000000;
pub const SUBKEY_WOW6464KEY: DWORD = 0x00010000;
pub const SUBKEY_WOW6432KEY: DWORD = 0x00020000;
};

pub extern "advapi32" fn RegGetValueW(
hkey: HKEY,
lpSubKey: LPCWSTR,
lpValue: LPCWSTR,
dwFlags: DWORD,
pdwType: ?*DWORD,
pvData: ?*anyopaque,
pcbData: ?*DWORD,
) callconv(WINAPI) LSTATUS;

pub extern "advapi32" fn RegLoadAppKeyW(
lpFile: LPCWSTR,
phkResult: *HKEY,
samDesired: REGSAM,
dwOptions: DWORD,
reserved: DWORD,
) callconv(WINAPI) LSTATUS;

pub extern "advapi32" fn RegEnumKeyExW(
hKey: HKEY,
dwIndex: DWORD,
lpName: LPWSTR,
lpcchName: *DWORD,
lpReserved: ?*DWORD,
lpClass: ?LPWSTR,
lpcchClass: ?*DWORD,
lpftLastWriteTime: ?*FILETIME,
) callconv(WINAPI) LSTATUS;