-
Notifications
You must be signed in to change notification settings - Fork 45
/
regedit.d.ts
124 lines (101 loc) · 5.51 KB
/
regedit.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
export interface REG_SZ_Value {
value: string;
type: "REG_SZ";
}
export interface REG_EXPAND_SZ_Value {
value: string;
type: "REG_EXPAND_SZ";
}
export interface REG_DWORD_Value {
value: number;
type: "REG_DWORD";
}
export interface REG_QWORD_Value {
value: number;
type: "REG_QWORD";
}
export interface REG_MULTI_SZ_Value {
value: string[];
type: "REG_MULTI_SZ";
}
export interface REG_BINARY_Value {
value: number[];
type: "REG_SZ";
}
export interface REG_DEFAULT_Value {
value: string;
type: "REG_DEFAULT";
}
export type RegistryItemValue = REG_SZ_Value | REG_EXPAND_SZ_Value | REG_DWORD_Value | REG_QWORD_Value | REG_MULTI_SZ_Value | REG_BINARY_Value | REG_DEFAULT_Value;
export interface RegistryItem {
exists: boolean;
keys: string[];
values: {
[name: string]: RegistryItemValue;
};
}
export type RegistryItemCollection<T extends readonly string[], U = { [key in T[number]]: RegistryItem }> = U;
export interface RegistryPutItem {
[name: string]: RegistryItemValue;
}
export type RegistryItemPutCollection = {
[key: string]: RegistryPutItem;
};
export const OS_ARCH_AGNOSTIC = "A";
export const OS_ARCH_SPECIFIC = "S";
export const OS_ARCH_32BIT = "32";
export const OS_ARCH_64BIT = "64";
type Architecture = (typeof OS_ARCH_AGNOSTIC | typeof OS_ARCH_SPECIFIC | typeof OS_ARCH_32BIT | typeof OS_ARCH_64BIT);
type ErrResCallback<T extends readonly string[]> = (err: Error | undefined, res: RegistryItemCollection<T>) => void;
export function list<K extends string>(keys: readonly K[], callback: ErrResCallback<typeof keys>): void;
export function list<K extends string>(keys: readonly K[], architecture: Architecture, callback?: ErrResCallback<typeof keys>): void;
export function setExternalVBSLocation(newLocation: string): string;
interface ErrorWithCode extends Error {
code: number;
description: string;
}
type ErrCallback = (err: ErrorWithCode | undefined) => void;
export function createKey<K extends string>(keys: readonly K[], callback: ErrCallback): void;
export function createKey<K extends string>(keys: readonly K[], architecture: Architecture, callback?: ErrCallback): void;
export function deleteKey(keys: readonly string[], callback: ErrCallback): void;
export function deleteKey(keys: readonly string[], architecture: Architecture, callback?: ErrCallback): void;
export function putValue(map: RegistryItemPutCollection, callback: ErrCallback): void;
export function putValue(map: RegistryItemPutCollection, architecture: Architecture, callback?: ErrCallback): void;
export namespace arch {
export function list<K extends string>(keys: readonly K[], callback: ErrResCallback<typeof keys>): void;
export function list32<K extends string>(keys: readonly K[], callback: ErrResCallback<typeof keys>): void;
export function list64<K extends string>(keys: readonly K[], callback: ErrResCallback<typeof keys>): void;
export function createKey(keys: readonly string[], callback: ErrCallback): void;
export function createKey32(keys: readonly string[], callback: ErrCallback): void;
export function createKey64(keys: readonly string[], callback: ErrCallback): void;
export function deleteKey(keys: readonly string[], callback: ErrCallback): void;
export function deleteKey32(keys: readonly string[], callback: ErrCallback): void;
export function deleteKey64(keys: readonly string[], callback: ErrCallback): void;
export function putValue(map: RegistryItemPutCollection, callback: ErrCallback): void;
export function putValue32(map: RegistryItemPutCollection, callback: ErrCallback): void;
export function putValue64(map: RegistryItemPutCollection, callback: ErrCallback): void;
}
export namespace promisified {
export function list<K extends string>(keys: readonly K[]): Promise<RegistryItemCollection<typeof keys>>;
export function list<K extends string>(keys: readonly K[], architecture: Architecture): Promise<RegistryItemCollection<typeof keys>>;
export function createKey(keys: readonly string[]): Promise<void>;
export function createKey(keys: readonly string[], architecture: Architecture): Promise<void>;
export function deleteKey(keys: readonly string[]): Promise<void>;
export function deleteKey(keys: readonly string[], architecture: Architecture): Promise<void>;
export function putValue(map: RegistryItemPutCollection): Promise<void>;
export function putValue(map: RegistryItemPutCollection, architecture: Architecture): Promise<void>;
export namespace arch {
export function list<K extends string>(keys: readonly K[]): Promise<RegistryItemCollection<typeof keys>>;
export function list32<K extends string>(keys: readonly K[]): Promise<RegistryItemCollection<typeof keys>>;
export function list64<K extends string>(keys: readonly K[]): Promise<RegistryItemCollection<typeof keys>>;
export function createKey(keys: readonly string[]): Promise<void>;
export function createKey32(keys: readonly string[]): Promise<void>;
export function createKey64(keys: readonly string[]): Promise<void>;
export function deleteKey(keys: readonly string[]): Promise<void>;
export function deleteKey32(keys: readonly string[]): Promise<void>;
export function deleteKey64(keys: readonly string[]): Promise<void>;
export function putValue(map: RegistryItemPutCollection): Promise<void>;
export function putValue32(map: RegistryItemPutCollection): Promise<void>;
export function putValue64(map: RegistryItemPutCollection): Promise<void>;
}
}