-
Notifications
You must be signed in to change notification settings - Fork 29
/
Functions.h
325 lines (280 loc) · 4.64 KB
/
Functions.h
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
#pragma once
//
// XML.cpp
//
PVOID
XmlReadConfigFile(
_In_z_ LPTSTR szConfigPath,
_In_ PGLOBAL_CONFIG pGlobalConfig
);
PVOID
XmlReadSchemaFile(
_In_opt_z_ LPTSTR szConfigPath,
_In_ PGLOBAL_CONFIG pGlobalConfig,
_In_ PVOID pXMLDocConfig
);
//
// Engine.cpp
//
BOOL
Process(
_In_ PGLOBAL_CONFIG pGlobalConfig
);
//
// LDAP.cpp
//
BOOL
LdapGetRootDse(
_In_ PGLOBAL_CONFIG pGlobalConfig,
_In_ DWORD dwServerEntry,
_In_z_ LPWSTR szServerName,
_In_ ULONG ulLdapPort,
_Out_ PROOTDSE_CONFIG pRootDse
);
BOOL
LdapProcessRequest(
_In_ PGLOBAL_CONFIG pGlobalConfig,
_In_ DWORD dwServerEntry,
_In_opt_z_ LPWSTR szServer,
_In_ ULONG ulLdapPort,
_In_ BOOL bIsLocalAdmin,
_In_z_ LPWSTR szRootDns,
_In_z_ LPCWSTR szPath1,
_In_opt_z_ LPCWSTR szPath2,
_In_opt_z_ LPWSTR szLdapBase,
_In_opt_ PREQUEST_CONFIG pRequest,
_In_ BOOL bRequestLdap,
_In_ BOOL bWriteTableInfo,
_In_ BOOL bIsRootDSE
);
//
// Sysvol.cpp
//
BOOL
ProcessSysvol(
_In_ PGLOBAL_CONFIG pGlobalConfig,
_In_ DWORD dwServerEntry,
_In_z_ LPWSTR szRootDns,
_In_z_ LPCWSTR szPath1,
_In_z_ LPCWSTR szPath2,
_In_opt_z_ LPWSTR szServer
);
VOID
SysvolWriteTableInfo(
_In_ PBUFFER_OUTPUT pTableFile,
_In_z_ LPWSTR szDomainDns
);
//
// Util.cpp
//
VOID
Log(
_In_z_ LPCSTR szFile,
_In_z_ LPCSTR szFunction,
_In_ DWORD dwLine,
_In_ DWORD dwLevel,
_In_z_ _Printf_format_string_ LPCSTR szFormat,
...
);
VOID
DuplicateString(
_In_z_ LPWSTR szInput,
_Out_ LPWSTR *szOutput
);
LPWSTR
ConvertDnToDns(
_In_z_ LPWSTR szString
);
VOID
RemoveSpecialChars(
_In_z_ LPWSTR szString
);
BOOL
WriteTextFile(
_In_ PBUFFER_OUTPUT pOutput,
_In_z_ LPCSTR szFormat,
...
);
LPSTR
LPWSTRtoUTF8(
_In_opt_z_ LPCWSTR szToConvert
);
_Success_(return)
BOOL
GetFileVersion(
_Out_ wchar_t* szVersion,
_In_ size_t BufferCount
);
BOOL
MetadataWriteFile(
_In_ PGLOBAL_CONFIG pGlobalConfig,
_In_z_ LPCWSTR szKey,
_In_z_ LPWSTR szValue
);
BOOL
MetadataCreateFile(
_In_ PGLOBAL_CONFIG pGlobalConfig
);
BOOL
cmdOptionExists(
_In_ wchar_t *argv[],
_In_ int argc,
_In_z_ const wchar_t *szOption
);
_Success_(return)
BOOL
GetCmdOption(
_In_ wchar_t *argv[],
_In_ int argc,
_In_z_ const wchar_t *szOption,
_In_ TYPE_CONFIG ElementType,
_Out_ PVOID pvElementValue
);
StartStatus
GetBuildDateStatus(
);
BOOL
CheckAndCreateDirectory(
_In_z_ LPCWSTR szDirectoryPath
);
BOOL
FormatNameAndCreateDirectory(
_Out_writes_z_(dwPathSize) LPWSTR szOutputPath,
_In_ DWORD dwPathSize,
_In_z_ LPCWSTR szFormat,
...
);
//
// Util_Db.cpp
//
BOOL
DbAddKey(
_Inout_ PDB_ENTRY *pBase,
_In_opt_z_ LPWSTR szKeyName,
_In_ DWORD dwKeyValue,
_In_ DbCompareMode CompareMode
);
PDB_ENTRY
DbLookupKey(
_Inout_ PDB_ENTRY pBase,
_In_opt_z_ LPWSTR szKeyName
);
BOOL
DbFree(
_Inout_ PDB_ENTRY *pBase
);
//
// Buffer.cpp
//
BOOL
BufferInitialize(
_Out_ PBUFFER_DATA pBuffer,
_In_z_ LPCWSTR szFilename,
_In_ BOOL bWriteBomHeader,
_In_ BOOL bSysvolOutput
);
BOOL
BufferClose(
_Inout_ PBUFFER_DATA pBuffer
);
DWORD
BufferWrite(
_In_ PBUFFER_DATA pBuffer,
_In_opt_z_ LPWSTR szString
);
DWORD
BufferWriteStringWithLimit(
_In_ PBUFFER_DATA pBuffer,
_In_opt_z_ LPWSTR szString,
_In_ DWORD dwLimit
);
DWORD
BufferWrite(
_In_ PBUFFER_DATA pBuffer,
_In_ const FILETIME *fileTime
);
DWORD
BufferWrite(
_In_ PBUFFER_DATA pBuffer,
_In_ DWORD dwValue
);
DWORD
BufferWrite(
_In_ PBUFFER_DATA pBuffer,
_In_ LONGLONG dwValue
);
DWORD
BufferWrite(
_In_ PBUFFER_DATA pBuffer,
_In_ unsigned long long dwValue
);
DWORD
BufferWriteFromFile(
_In_ PBUFFER_DATA pBuffer,
_In_ HANDLE hFile
);
DWORD
BufferWriteHex(
_Inout_ PBUFFER_DATA pBuffer,
_In_reads_(dwDataSize) PBYTE pbData,
_In_ DWORD dwDataSize
);
DWORD
BufferWriteLine(
_In_ PBUFFER_DATA pBuffer
);
DWORD
BufferWriteTab(
_In_ PBUFFER_DATA pBuffer
);
DWORD
BufferWriteSemicolon(
_In_ PBUFFER_DATA pBuffer
);
BOOL
BufferSave(
_In_ PBUFFER_DATA pBuffer
);
//
// MLA.cpp
//
BOOL
MlaInit(
_In_z_ LPCWSTR szMlaFilePath
);
BOOL
MlaAddFile(
_In_z_ LPCWSTR szFilePath,
_Out_ MLAArchiveFileHandle *phMlaFile
);
BOOL
MlaAddFileFromFile(
_In_z_ LPCWSTR szFilePathToAdd,
_In_z_ LPCWSTR szMLAFilePath
);
BOOL
MlaCloseFile(
_Inout_ MLAArchiveFileHandle *phMlaFile
);
BOOL
MlaBufferWrite(
_In_ MLAArchiveFileHandle hMlaFile,
_In_reads_(BufferSize) PBYTE pbBuffer,
_In_ uint64_t BufferSize
);
BOOL
MlaClose(
);
//
// Filters.cpp
//
BOOL
GetFilter(
_Inout_ PATTRIBUTE_CONFIG pAttributes,
_In_z_ LPCWSTR szFilter
);
LPWSTR
ApplyFilter(
_In_ PATTRIBUTE_CONFIG pAttributes,
_In_z_ PVOID pvData
);