Skip to content

Commit eec3333

Browse files
committed
Add more winreg constants
1 parent 2f617fe commit eec3333

1 file changed

Lines changed: 41 additions & 4 deletions

File tree

vm/src/stdlib/winreg.rs

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,22 +253,59 @@ pub fn make_module(vm: &VirtualMachine) -> PyObjectRef {
253253
"CloseKey" => ctx.new_function(winreg_CloseKey),
254254
});
255255

256-
macro_rules! add_hkey_constants {
257-
($($name:ident),*) => {
256+
macro_rules! add_constants {
257+
(hkey, $($name:ident),*$(,)?) => {
258258
extend_module!(vm, module, {
259259
$((stringify!($name)) => ctx.new_int(winreg::enums::$name as usize)),*
260260
})
261261
};
262+
(winnt, $($name:ident),*$(,)?) => {
263+
extend_module!(vm, module, {
264+
$((stringify!($name)) => ctx.new_int(winapi::um::winnt::$name)),*
265+
})
266+
};
262267
}
263268

264-
add_hkey_constants!(
269+
add_constants!(
270+
hkey,
265271
HKEY_CLASSES_ROOT,
266272
HKEY_CURRENT_USER,
267273
HKEY_LOCAL_MACHINE,
268274
HKEY_USERS,
269275
HKEY_PERFORMANCE_DATA,
270276
HKEY_CURRENT_CONFIG,
271-
HKEY_DYN_DATA
277+
HKEY_DYN_DATA,
278+
);
279+
add_constants!(
280+
winnt,
281+
// access rights
282+
KEY_ALL_ACCESS,
283+
KEY_WRITE,
284+
KEY_READ,
285+
KEY_EXECUTE,
286+
KEY_QUERY_VALUE,
287+
KEY_SET_VALUE,
288+
KEY_CREATE_SUB_KEY,
289+
KEY_ENUMERATE_SUB_KEYS,
290+
KEY_NOTIFY,
291+
KEY_CREATE_LINK,
292+
KEY_WOW64_64KEY,
293+
KEY_WOW64_32KEY,
294+
// value types
295+
REG_BINARY,
296+
REG_DWORD,
297+
REG_DWORD_LITTLE_ENDIAN,
298+
REG_DWORD_BIG_ENDIAN,
299+
REG_EXPAND_SZ,
300+
REG_LINK,
301+
REG_MULTI_SZ,
302+
REG_NONE,
303+
REG_QWORD,
304+
REG_QWORD_LITTLE_ENDIAN,
305+
REG_RESOURCE_LIST,
306+
REG_FULL_RESOURCE_DESCRIPTOR,
307+
REG_RESOURCE_REQUIREMENTS_LIST,
308+
REG_SZ,
272309
);
273310

274311
module

0 commit comments

Comments
 (0)