summaryrefslogtreecommitdiffstats
path: root/public/sdk/inc/dsapi.h
blob: c14b3dd32bf0ee9e64212261297bd1124f1c5b05 (plain) (blame)
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
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
//+-------------------------------------------------------------------------
//
//  Microsoft Windows
//  Copyright (C) Microsoft Corporation, 1992 - 1992.
//
//  File:       DSAPI.H
//
//  Contents:   DS API signatures and the like
//
//  History:     7-Jun-93 ArnoldM     Created
//               03-Aug-94 AlokS      Rewrote to adjust to new
//                                    calling convention/performance
//                                    enhancements
//               08-Aug-94 AlokS      Added DSConvertNameToPath() and
//                                    DSParseDsName() APIs
//--------------------------------------------------------------------------

#if !defined( __DSAPI_H__ )
#define __DSAPI_H__

#if !defined(_DSSYSTEM_)
# define DSEXPORT       DECLSPEC_IMPORT
#else
# define DSEXPORT
#endif

#include <dsstate.h>
//+----------------------------------------------------------------------------
//
//  Function:   DSGetMachineWeight
//
//  Synopsis:   Returns the weight of the machine.
//
//  Arguments:  [pdWeight] -- The weight is returned here
//
//  Returns:    DS_E_KEY_NOT_FOUND, on error
//      S_OK - if successful.
//
//-----------------------------------------------------------------------------
DSEXPORT STDAPI DSGetMachineWeight(PDWORD pdWeight);

//+----------------------------------------------------------------------------
//
//  Function:   DSetMachineWeight
//
//  Synopsis:   Sets the weight of the machine.
//
//  Arguments:  [dWeight] -- The weight
//
//  Returns:    DS_E_KEY_NOT_FOUND, on error
//              DS_E_INCORRECT_CONFIGURATION if invalid weight given
//      S_OK - if successful.
//
//-----------------------------------------------------------------------------
DSEXPORT STDAPI DSSetMachineWeight(DWORD dWeight);

//+----------------------------------------------------------------------------
//
//  Function:   DSGetDSState
//
//  Synopsis:   Returns the state of the machine as far as DSYS components
//              are concerned. E.g. 'standalone' or 'workstation'
//
//  Arguments:  [pState] -- The state is returned here
//
//  Returns:    DS_E_KEY_NOT_FOUND, on error
//      S_OK - if successful.
//
//-----------------------------------------------------------------------------
DSEXPORT STDAPI DSGetDSState(DS_MACHINE_STATE * pState);

//+----------------------------------------------------------------------------
//
//  Function:   DSGetDomainID
//
//  Synopsis:   Returns the domain ID of the domain in which this
//              workstation or DC belongs. For standalone machines,
//              the local machine ID is returned.
//
//  Arguments:  [pgGuid] -- The guid is returned here
//
//  Returns:    DS_E_KEY_NOT_FOUND,     when Domain ID is not present
//              DS_E_INVALID_PARAMETER, when passed parameters are incorrect
//      S_OK - if successful.
//
//-----------------------------------------------------------------------------
DSEXPORT STDAPI DSGetDomainID(GUID * pgGuid);


//+----------------------------------------------------------------------------
//
//  Function:   DSGetMachineID
//
//  Synopsis:   Returns the local machine ID
//
//  Arguments:  [pgGuid] -- The guid is returned here
//
//  Returns:    DS_E_KEY_NOT_FOUND, when machine ID is not set
//              DS_E_INVALID_PARAMETER, when passed parameters are incorrect
//      S_OK - if successful.
//
//-----------------------------------------------------------------------------
DSEXPORT STDAPI DSGetMachineID(GUID * pgGuid);

//+----------------------------------------------------------------------------
//
//  Function:   DSGetSiteID
//
//  Synopsis:   Returns the local site in which this workstation or DC
//              belongs. This call will return an error for standalone.
//
//  Arguments:  [pgGuid] -- The guid is returned here
//
//  Returns:    DS_E_KEY_NOT_FOUND, on error
//              DS_E_INVALID_PARAMETER, when passed parameters are incorrect
//      S_OK - if successful.
//
//-----------------------------------------------------------------------------
DSEXPORT STDAPI DSGetSiteID(GUID * pgGuid);


//+----------------------------------------------------------------------------
//
//  Function:   DSGetTimeSyncState
//
//  Synopsis:   Get the time sync state.
//
//  Each machine, including the DC, can be in one of the two
//  Time Sync States as shown below:
//     Time Sync Type             Time Sync State Value
//     ---------------            ----------------------
//       A. Machine is reliable      TRUE
//          source of time
//
//   B. Machine time is NOT      FALSE
//          reliable source of time
//
//
//  Arguments:  [pfState] -- TRUE/FALSE return in this
//
//  Returns:    DS_E_KEY_NOT_FOUND, on error
//              DS_E_INVALID_PARAMETER, when passed parameters are incorrect
//      S_OK - if successful.
//
//-----------------------------------------------------------------------------

DSEXPORT STDAPI DSGetTimeSyncState ( BOOL *pfState);

//+----------------------------------------------------------------------------
//
//  Function:   DSSetTimeSyncState
//
//  Synopsis:   Set the time sync state.
//
//  Each machine, including the DC, can be in one of the two
//  Time Sync States as shown below:
//     Time Sync Type             Time Sync State Value
//     ---------------            ----------------------
//       A. Machine is reliable      TRUE
//          source of time
//
//   B. Machine time is NOT      FALSE
//          reliable source of time
//
//
//  Arguments:  [fState] -- The state to be set.
//
//  Returns:    DS_E_KEY_NOT_FOUND, on error
//      S_OK - if successful.
//
//-----------------------------------------------------------------------------
DSEXPORT STDAPI DSSetTimeSyncState ( BOOL  fState);

//+----------------------------------------------------------------------------
//
//  Function:   DSGetLocalDsRoot
//
//  Synopsis:   Returns a drive based path to the local DS container
//
//  Arguments:  [pwszRoot]    -- A path is return here.
//              [lpdwBufSize] -- Size of the buffer pointed to by 'pwszRoot.
//                               If size is not large enough, correct size
//                               is returned via this parameter
//
//  Returns:    DS_E_BUFFER_TOO_SMALL, if supplied buffer is not large enough
//              DS_E_KEY_NOT_FOUND, on other errors
//              DS_E_INVALID_PARAMETER, when passed parameters are incorrect
//      S_OK - if successful.
//
//-----------------------------------------------------------------------------
DSEXPORT STDAPI
    DSGetLocalDsRoot(LPWSTR pwszRoot, LPDWORD lpdwBufSize);

//+----------------------------------------------------------------------------
//
//  Function:   DSGetDomainDsRoot
//
//  Synopsis:   Returns a drive based path to the domain DS container on DC.
//              Not valid on non-DC Cairo setup configurations
//
//  Arguments:  [pwszRoot]    -- A path is return here.
//              [lpdwBufSize] -- Size of the buffer pointed to by 'pwszRoot.
//                               If size is not large enough, correct size
//                               is returned via this parameter
//
//  Returns:    DS_E_BUFFER_TOO_SMALL, if supplied buffer is not large enough
//              DS_E_KEY_NOT_FOUND, on other errors
//              DS_E_INVALID_PARAMETER, when passed parameters are incorrect
//      S_OK - if successful.
//
//-----------------------------------------------------------------------------
DSEXPORT STDAPI
    DSGetDomainDsRoot    (LPWSTR pwszRoot, LPDWORD lpdwBufSize);

//+----------------------------------------------------------------------------
//
//  Function:   DSGetDomainName
//
//  Synopsis:   Returns the domain name in all configurations.
//              Thus, on workstation, it might return "\wpg\sys.." whereas
//              in standalone, it will return "<computer name>"
//
//  Arguments:  [pwszName]    -- The Domain Name is return here.
//              [lpdwBufSize] -- Size of the buffer pointed to by 'pwszName'.
//                               If size is not large enough, correct size
//                               is returned via this parameter
//
//  Returns:    DS_E_BUFFER_TOO_SMALL, if supplied buffer is not large enough
//              DS_E_KEY_NOT_FOUND, on other errors
//              DS_E_INVALID_PARAMETER, when passed parameters are incorrect
//      S_OK - if successful.
//
//-----------------------------------------------------------------------------
DSEXPORT STDAPI
    DSGetDomainName      (LPWSTR pwszName, LPDWORD lpdwBufSize);

//+----------------------------------------------------------------------------
//
//  Function:   DSGetDownlevelDomainName
//
//  Synopsis:   Returns the downlevel domain name in all configurations.
//              Thus, on workstation, it might return "redmond" whereas
//              in standalone, it will return the workgroup name
//
//  Arguments:  [pwszName]    -- The Domain Name is return here.
//              [lpdwBufSize] -- Size of the buffer pointed to by 'pwszName'.
//                               If size is not large enough, correct size
//                               is returned via this parameter
//
//  Returns:    DS_E_BUFFER_TOO_SMALL, if supplied buffer is not large enough
//              DS_E_KEY_NOT_FOUND, on other errors
//              DS_E_INVALID_PARAMETER, when passed parameters are incorrect
//      S_OK - if successful.
//
//-----------------------------------------------------------------------------
DSEXPORT STDAPI
    DSGetDownlevelDomainName      (LPWSTR pwszName, LPDWORD lpdwBufSize);

//+----------------------------------------------------------------------------
//
//  Function:   DSGetDownlevelDomainSid
//
//  Synopsis:   Returns the downlevel domain name in all configurations.
//              The sid is only valid on standalone installations, though.
//
//  Arguments:  [ppDomainSid]  -- The Domain Sid is return here, allocated
//                                with CoTaskMemAlloc
//
//  Returns:    E_OUTOFMEMORY - not enough memory to retrieve the SID
//              DS_E_KEY_NOT_FOUND, on other errors
//              DS_E_INVALID_PARAMETER, when passed parameters are incorrect
//      S_OK - if successful.
//
//-----------------------------------------------------------------------------
DSEXPORT STDAPI
    DSGetDownlevelDomainSid      (PSID * ppDomainSid);

//+----------------------------------------------------------------------------
//
//  Function:   DSSetDownlevelDomainSid
//
//  Synopsis:   Sets the downlevel domain sid in all configurations.
//              This sid will only be valid on standalone installations,
//              in which case it indicates that the machine is a member
//              of an NT domain.
//
//  Arguments:  [pDomainSid]  -- The Domain Sid is return here. If this is
//                               NULL the API deletes the downlevel domain
//                               SID value.
//
//  Returns:    DS_E_BUFFER_TOO_SMALL, if supplied buffer is not large enough
//              DS_E_KEY_NOT_FOUND, on other errors
//              DS_E_INVALID_PARAMETER, when passed parameters are incorrect
//      S_OK - if successful.
//
//-----------------------------------------------------------------------------
DSEXPORT STDAPI
    DSSetDownlevelDomainSid      (PSID pDomainSid);

//+----------------------------------------------------------------------------
//
//  Function:   DSGetMachineName
//
//  Synopsis:   Returns the Distinguished Name(DN) of the machine.
//              Thus, on workstation, it might return
//              "\wpg\sys..\aloksdev" whereas on standalone,
//              it will return "<computer name>"
//
//  Arguments:  [pwszName]    -- The Machine Name is return here.
//              [lpdwBufSize] -- Size of the buffer pointed to by 'pwszName'.
//                               If size is not large enough, correct size
//                               is returned via this parameter
//
//  Returns:    DS_E_BUFFER_TOO_SMALL, if supplied buffer is not large enough
//              DS_E_INVALID_PARAMETER, when passed parameters are incorrect
//              DS_E_KEY_NOT_FOUND, when the machine name is not present
//      S_OK - if successful.
//
//-----------------------------------------------------------------------------
DSEXPORT STDAPI
    DSGetMachineName     (LPWSTR pwszName, LPDWORD lpdwBufSize);

//+----------------------------------------------------------------------------
//
//  Function:   DSConvertNameToPath
//
//  Synopsis:   Converts a DS name to a path so that any WIN32 API
//              can be used on it.
//
//  Arguments:  [pwszName]    -- A principal name e.g. \wpg\sys\cairo or
//                               aloksdev\aloks
//              [pwszPath]    -- A WIN32 path will returned here which
//                               can of form <drive letter>:<path> or
//                               <UNC name>\<path>
//              [lpdwBufSize] -- Size of the buffer pointed to by 'pwszPath'.
//                               If size is not large enough, correct size
//                               is returned via this parameter
//
//  Returns:    DS_E_BUFFER_TOO_SMALL, if supplied buffer is not large enough
//              DS_E_INVALID_PARAMETER, when passed parameters are incorrect
//              DS_E_NOT_LOCAL_NAME,    when the name can't be parsed based on local DS
//                                      information
//      S_OK - if successful.
//
//  Note:       The API will need to be fixed when NT/Cairo inter-op
//              works and we can potentially be given a string of form
//              "Redmond\aloks".
//
//-----------------------------------------------------------------------------
DSEXPORT STDAPI DSConvertNameToPath ( IN     LPCWSTR pwszName,
                                      OUT    LPWSTR  pwszPath,
                                      IN OUT LPDWORD lpdwBufSize
                                    );

//+----------------------------------------------------------------------------
//
//  Function:   DSParseDsName
//
//  Synopsis:   Cracks a DS name into a Domain and domain-relative
//              name.
//
//  Arguments:  [pwszName]     -- A principal name
//                                e.g. \wpg\sys\cairo\dev\aloks or
//                                     aloksdev\aloks
//              [lpdwDomNameLen]-- This contains the length of the domain
//                                name.
//                                (a)  a count of characters not bytes is returned, and
//                                (b) excludes the backslash which separates the
//                                    domain part from the domain-relative path.
//
//  Returns:    DS_E_INVALID_PARAMETER, when passed parameters are incorrect,
//              DS_E_NOT_LOCAL_NAME,    when the name can't be parsed based on local DS
//                                      information
//      S_OK - if successful.
//
//-----------------------------------------------------------------------------
DSEXPORT STDAPI DSParseDsName ( IN     LPCWSTR pwszName,
                                IN OUT LPDWORD lpdwDomNameLen
                              );

//+----------------------------------------------------------------------------
//
//  Function:   DSReconcileUser, private
//
//  Synopsis:   Reconcile the local replica's of user object(s) with
//              those on the DC. This is not valid for standalone.
//              Note: Only primary users have local replica's on a given
//                    workstation. For non-primary user's the function
//                    call is a noop and returns S_OK.
//
//  Arguments:  [pwszDomainName] -- The full domain name (including OU name)
//                                  of the user. e.g. '\wpg\sys\cairo\dev'
//              [pwszUserName]   -- The user name relative to the OU
//                                  e.g. 'aloks'
//
//  Returns:
//              S_OK - if successful.
//
//  Note:       Nobody should need to call this except for WinLogon
//-----------------------------------------------------------------------------
DSEXPORT STDAPI
    DSReconcileUser      (LPCWSTR pwszDomainName,LPCWSTR pwszUserName);
#endif // __DSAPI_H__