-
Notifications
You must be signed in to change notification settings - Fork 1
/
registry.go
347 lines (285 loc) · 7.76 KB
/
registry.go
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
//----------------------------------------
// The code is automatically generated by the GenlibLcl tool.
// Copyright © ying32. All Rights Reserved.
//
// Licensed under Apache License 2.0
//
//----------------------------------------
package lcl
import (
. "github.com/energye/golcl/lcl/api"
. "github.com/energye/golcl/lcl/types"
"time"
"unsafe"
)
type TRegistry struct {
IObject
instance unsafe.Pointer
}
// NewRegistry
//
// 创建一个新的对象。
//
// Create a new object.
func NewRegistry(aAccess uint32) *TRegistry {
r := new(TRegistry)
r.instance = unsafe.Pointer(Registry_Create(uintptr(aAccess)))
setFinalizer(r, (*TRegistry).Free)
return r
}
// AsRegistry
//
// 动态转换一个已存在的对象实例。
//
// Dynamically convert an existing object instance.
func AsRegistry(obj interface{}) *TRegistry {
instance := getInstance(obj)
if instance == nullptr {
return nil
}
return &TRegistry{instance: instance}
}
// Free
//
// 释放对象。
//
// Free object.
func (r *TRegistry) Free() {
if r.instance != nullptr {
Registry_Free(r._instance())
r.instance = nullptr
}
}
func (r *TRegistry) _instance() uintptr {
return uintptr(r.instance)
}
// Instance
//
// 返回对象实例指针。
//
// Return object instance pointer.
func (r *TRegistry) Instance() uintptr {
return r._instance()
}
// UnsafeAddr
//
// 获取一个不安全的地址。
//
// Get an unsafe address.
func (r *TRegistry) UnsafeAddr() unsafe.Pointer {
return r.instance
}
// IsValid
//
// 检测地址是否为空。
//
// Check if the address is empty.
func (r *TRegistry) IsValid() bool {
return r.instance != nullptr
}
// Is
//
// 检测当前对象是否继承自目标对象。
//
// Checks whether the current object is inherited from the target object.
func (r *TRegistry) Is() TIs {
return TIs(r._instance())
}
// As
//
// 动态转换当前对象为目标对象。
//
// Dynamically convert the current object to the target object.
//func (r *TRegistry) As() TAs {
// return TAs(r._instance())
//}
// TRegistryClass
//
// 获取类信息指针。
//
// Get class information pointer.
func TRegistryClass() TClass {
return Registry_StaticClassType()
}
func (r *TRegistry) CloseKey() {
Registry_CloseKey(r._instance())
}
func (r *TRegistry) CreateKey(Key string) bool {
return Registry_CreateKey(r._instance(), Key)
}
func (r *TRegistry) DeleteKey(Key string) bool {
return Registry_DeleteKey(r._instance(), Key)
}
func (r *TRegistry) DeleteValue(Name string) bool {
return Registry_DeleteValue(r._instance(), Name)
}
func (r *TRegistry) HasSubKeys() bool {
return Registry_HasSubKeys(r._instance())
}
func (r *TRegistry) KeyExists(Key string) bool {
return Registry_KeyExists(r._instance(), Key)
}
func (r *TRegistry) LoadKey(Key string, FileName string) bool {
return Registry_LoadKey(r._instance(), Key, FileName)
}
func (r *TRegistry) MoveKey(OldName string, NewName string, Delete bool) {
Registry_MoveKey(r._instance(), OldName, NewName, Delete)
}
func (r *TRegistry) OpenKey(Key string, CanCreate bool) bool {
return Registry_OpenKey(r._instance(), Key, CanCreate)
}
func (r *TRegistry) OpenKeyReadOnly(Key string) bool {
return Registry_OpenKeyReadOnly(r._instance(), Key)
}
func (r *TRegistry) ReadBool(Name string) bool {
return Registry_ReadBool(r._instance(), Name)
}
func (r *TRegistry) ReadDate(Name string) time.Time {
return Registry_ReadDate(r._instance(), Name)
}
func (r *TRegistry) ReadDateTime(Name string) time.Time {
return Registry_ReadDateTime(r._instance(), Name)
}
func (r *TRegistry) ReadFloat(Name string) float64 {
return Registry_ReadFloat(r._instance(), Name)
}
func (r *TRegistry) ReadInteger(Name string) int32 {
return Registry_ReadInteger(r._instance(), Name)
}
func (r *TRegistry) ReadString(Name string) string {
return Registry_ReadString(r._instance(), Name)
}
func (r *TRegistry) ReadTime(Name string) time.Time {
return Registry_ReadTime(r._instance(), Name)
}
func (r *TRegistry) RegistryConnect(UNCName string) bool {
return Registry_RegistryConnect(r._instance(), UNCName)
}
func (r *TRegistry) RenameValue(OldName string, NewName string) {
Registry_RenameValue(r._instance(), OldName, NewName)
}
func (r *TRegistry) ReplaceKey(Key string, FileName string, BackUpFileName string) bool {
return Registry_ReplaceKey(r._instance(), Key, FileName, BackUpFileName)
}
func (r *TRegistry) RestoreKey(Key string, FileName string) bool {
return Registry_RestoreKey(r._instance(), Key, FileName)
}
func (r *TRegistry) SaveKey(Key string, FileName string) bool {
return Registry_SaveKey(r._instance(), Key, FileName)
}
func (r *TRegistry) UnLoadKey(Key string) bool {
return Registry_UnLoadKey(r._instance(), Key)
}
func (r *TRegistry) ValueExists(Name string) bool {
return Registry_ValueExists(r._instance(), Name)
}
func (r *TRegistry) WriteBool(Name string, Value bool) {
Registry_WriteBool(r._instance(), Name, Value)
}
func (r *TRegistry) WriteDate(Name string, Value time.Time) {
Registry_WriteDate(r._instance(), Name, Value)
}
func (r *TRegistry) WriteDateTime(Name string, Value time.Time) {
Registry_WriteDateTime(r._instance(), Name, Value)
}
func (r *TRegistry) WriteFloat(Name string, Value float64) {
Registry_WriteFloat(r._instance(), Name, Value)
}
func (r *TRegistry) WriteInteger(Name string, Value int32) {
Registry_WriteInteger(r._instance(), Name, Value)
}
func (r *TRegistry) WriteString(Name string, Value string) {
Registry_WriteString(r._instance(), Name, Value)
}
func (r *TRegistry) WriteExpandString(Name string, Value string) {
Registry_WriteExpandString(r._instance(), Name, Value)
}
func (r *TRegistry) WriteTime(Name string, Value time.Time) {
Registry_WriteTime(r._instance(), Name, Value)
}
// ClassType
//
// 获取类的类型信息。
//
// Get class type information.
func (r *TRegistry) ClassType() TClass {
return Registry_ClassType(r._instance())
}
// ClassName
//
// 获取当前对象类名称。
//
// Get the current object class name.
func (r *TRegistry) ClassName() string {
return Registry_ClassName(r._instance())
}
// InstanceSize
//
// 获取当前对象实例大小。
//
// Get the current object instance size.
func (r *TRegistry) InstanceSize() int32 {
return Registry_InstanceSize(r._instance())
}
// InheritsFrom
//
// 判断当前类是否继承自指定类。
//
// Determine whether the current class inherits from the specified class.
func (r *TRegistry) InheritsFrom(AClass TClass) bool {
return Registry_InheritsFrom(r._instance(), AClass)
}
// Equals
//
// 与一个对象进行比较。
//
// Compare with an object.
func (r *TRegistry) Equals(Obj IObject) bool {
return Registry_Equals(r._instance(), CheckPtr(Obj))
}
// GetHashCode
//
// 获取类的哈希值。
//
// Get the hash value of the class.
func (r *TRegistry) GetHashCode() int32 {
return Registry_GetHashCode(r._instance())
}
// ToString
//
// 文本类信息。
//
// Text information.
func (r *TRegistry) ToString() string {
return Registry_ToString(r._instance())
}
func (r *TRegistry) CurrentKey() HKEY {
return Registry_GetCurrentKey(r._instance())
}
func (r *TRegistry) CurrentPath() string {
return Registry_GetCurrentPath(r._instance())
}
func (r *TRegistry) LazyWrite() bool {
return Registry_GetLazyWrite(r._instance())
}
func (r *TRegistry) SetLazyWrite(value bool) {
Registry_SetLazyWrite(r._instance(), value)
}
func (r *TRegistry) LastError() int32 {
return Registry_GetLastError(r._instance())
}
func (r *TRegistry) LastErrorMsg() string {
return Registry_GetLastErrorMsg(r._instance())
}
func (r *TRegistry) RootKey() HKEY {
return Registry_GetRootKey(r._instance())
}
func (r *TRegistry) SetRootKey(value HKEY) {
Registry_SetRootKey(r._instance(), value)
}
func (r *TRegistry) Access() uint32 {
return Registry_GetAccess(r._instance())
}
func (r *TRegistry) SetAccess(value uint32) {
Registry_SetAccess(r._instance(), value)
}