Update NEWS for 1.6.22
[pkg-k5-afs_openafs.git] / src / WINNT / afsapplib / al_admsvr.cpp
blob2a6ac67b64c6f56276f3d883b4362622c4f85f86
1 /*
2 * Copyright 2000, International Business Machines Corporation and others.
3 * All Rights Reserved.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
8 */
10 extern "C" {
11 #include <afs/param.h>
12 #include <afs/stds.h>
15 #include <WINNT/TaAfsAdmSvrClient.h>
16 #include <WINNT/AfsAppLib.h>
20 * VARIABLES __________________________________________________________________
24 static struct
26 BOOL fUseAdminServer;
27 UINT_PTR idAdminServerClient;
28 } l = {0, 0};
32 * PROTOTYPES _________________________________________________________________
38 * ROUTINES ___________________________________________________________________
42 BOOL AfsAppLib_OpenAdminServer (LPTSTR pszAddress, ULONG *pStatus)
44 AfsAppLib_CloseAdminServer();
46 ULONG status;
47 if (!asc_AdminServerOpen (pszAddress, &l.idAdminServerClient, &status))
49 if (pStatus)
50 *pStatus = status;
51 return FALSE;
54 l.fUseAdminServer = TRUE;
55 return TRUE;
59 void AfsAppLib_CloseAdminServer (void)
61 if (l.fUseAdminServer)
63 ULONG status;
64 asc_AdminServerClose (l.idAdminServerClient, &status);
65 l.idAdminServerClient = 0;
66 l.fUseAdminServer = FALSE;
71 UINT_PTR AfsAppLib_GetAdminServerClientID (void)
73 return (l.fUseAdminServer) ? l.idAdminServerClient : 0;
78 * WRAPPERS ___________________________________________________________________
80 * This really ugly hack allows other processes to call the asc_* routines
81 * in the context of the AfsAppLib library.
85 EXPORTED BOOL ADMINAPI AfsAppLib_asc_AsidListCreate (LPASIDLIST *ppList)
87 return asc_AsidListCreate (ppList);
90 EXPORTED BOOL ADMINAPI AfsAppLib_asc_AsidListCopy (LPASIDLIST *ppListTarget, LPASIDLIST *ppListSource)
92 return asc_AsidListCopy (ppListTarget, ppListSource);
95 EXPORTED BOOL ADMINAPI AfsAppLib_asc_AsidListAddEntry (LPASIDLIST *ppList, ASID idObject, LPARAM lp)
97 return asc_AsidListAddEntry (ppList, idObject, lp);
100 EXPORTED BOOL ADMINAPI AfsAppLib_asc_AsidListRemoveEntry (LPASIDLIST *ppList, ASID idObject)
102 return asc_AsidListRemoveEntry (ppList, idObject);
105 EXPORTED BOOL ADMINAPI AfsAppLib_asc_AsidListRemoveEntryByIndex (LPASIDLIST *ppList, size_t iIndex)
107 return asc_AsidListRemoveEntryByIndex (ppList, iIndex);
110 EXPORTED BOOL ADMINAPI AfsAppLib_asc_AsidListSetEntryParam (LPASIDLIST *ppList, ASID idObject, LPARAM lp)
112 return asc_AsidListSetEntryParam (ppList, idObject, lp);
115 EXPORTED BOOL ADMINAPI AfsAppLib_asc_AsidListSetEntryParamByIndex (LPASIDLIST *ppList, size_t iIndex, LPARAM lp)
117 return asc_AsidListSetEntryParamByIndex (ppList, iIndex, lp);
120 EXPORTED BOOL ADMINAPI AfsAppLib_asc_AsidListTest (LPASIDLIST *ppList, ASID idObject, LPARAM *pParam)
122 return asc_AsidListTest (ppList, idObject, pParam);
125 EXPORTED BOOL ADMINAPI AfsAppLib_asc_AsidListFree (LPASIDLIST *ppList)
127 return asc_AsidListFree (ppList);
131 EXPORTED BOOL ADMINAPI AfsAppLib_asc_ObjPropListCreate (LPASOBJPROPLIST *ppList)
133 return asc_ObjPropListCreate (ppList);
136 EXPORTED BOOL ADMINAPI AfsAppLib_asc_ObjPropListCopy (LPASOBJPROPLIST *ppListTarget, LPASOBJPROPLIST *ppListSource)
138 return asc_ObjPropListCopy (ppListTarget, ppListSource);
141 EXPORTED BOOL ADMINAPI AfsAppLib_asc_ObjPropListAddEntry (LPASOBJPROPLIST *ppList, LPASOBJPROP pProperties, LPARAM lp)
143 return asc_ObjPropListAddEntry (ppList, pProperties, lp);
146 EXPORTED BOOL ADMINAPI AfsAppLib_asc_ObjPropListRemoveEntry (LPASOBJPROPLIST *ppList, ASID idObject)
148 return asc_ObjPropListRemoveEntry (ppList, idObject);
151 EXPORTED BOOL ADMINAPI AfsAppLib_asc_ObjPropListTest (LPASOBJPROPLIST *ppList, ASID idObject, LPASOBJPROP pProperties, LPARAM *pParam)
153 return asc_ObjPropListTest (ppList, idObject, pProperties, pParam);
156 EXPORTED BOOL ADMINAPI AfsAppLib_asc_ObjPropListFree (LPASOBJPROPLIST *ppList)
158 return asc_ObjPropListFree (ppList);
162 EXPORTED BOOL ADMINAPI AfsAppLib_asc_ActionListCreate (LPASACTIONLIST *ppList)
164 return asc_ActionListCreate (ppList);
167 EXPORTED BOOL ADMINAPI AfsAppLib_asc_ActionListCopy (LPASACTIONLIST *ppListTarget, LPASACTIONLIST *ppListSource)
169 return asc_ActionListCopy (ppListTarget, ppListSource);
172 EXPORTED BOOL ADMINAPI AfsAppLib_asc_ActionListAddEntry (LPASACTIONLIST *ppList, LPASACTION pAction)
174 return asc_ActionListAddEntry (ppList, pAction);
177 EXPORTED BOOL ADMINAPI AfsAppLib_asc_ActionListRemoveEntry (LPASACTIONLIST *ppList, DWORD idAction)
179 return asc_ActionListRemoveEntry (ppList, idAction);
182 EXPORTED BOOL ADMINAPI AfsAppLib_asc_ActionListTest (LPASACTIONLIST *ppList, DWORD idAction, LPASACTION pAction)
184 return asc_ActionListTest (ppList, idAction, pAction);
187 EXPORTED BOOL ADMINAPI AfsAppLib_asc_ActionListFree (LPASACTIONLIST *ppList)
189 return asc_ActionListFree (ppList);
193 EXPORTED BOOL ADMINAPI AfsAppLib_asc_AdminServerOpen (LPCTSTR pszAddress, UINT_PTR *pidClient, ULONG *pStatus)
195 return asc_AdminServerOpen (pszAddress, pidClient, pStatus);
198 EXPORTED BOOL ADMINAPI AfsAppLib_asc_AdminServerClose (UINT_PTR idClient, ULONG *pStatus)
200 return asc_AdminServerClose (idClient, pStatus);
204 EXPORTED BOOL ADMINAPI AfsAppLib_asc_CredentialsCrack (UINT_PTR idClient, PVOID hCreds, LPTSTR pszCell, LPTSTR pszUser, SYSTEMTIME *pstExpiration, ULONG *pStatus)
206 return asc_CredentialsCrack (idClient, hCreds, pszCell, pszUser, pstExpiration, pStatus);
209 EXPORTED UINT_PTR ADMINAPI AfsAppLib_asc_CredentialsGet (UINT_PTR idClient, LPCTSTR pszCell, ULONG *pStatus)
211 return asc_CredentialsGet (idClient, pszCell, pStatus);
214 EXPORTED UINT_PTR ADMINAPI AfsAppLib_asc_CredentialsSet (UINT_PTR idClient, LPCTSTR pszCell, LPCTSTR pszUser, LPCTSTR pszPassword, ULONG *pStatus)
216 return asc_CredentialsSet (idClient, pszCell, pszUser, pszPassword, pStatus);
219 EXPORTED BOOL ADMINAPI AfsAppLib_asc_CredentialsPush (UINT_PTR idClient, PVOID hCreds, ASID idCell, ULONG *pStatus)
221 return asc_CredentialsPush (idClient, hCreds, idCell, pStatus);
225 EXPORTED BOOL ADMINAPI AfsAppLib_asc_LocalCellGet (UINT_PTR idClient, LPTSTR pszCell, ULONG *pStatus)
227 return asc_LocalCellGet (idClient, pszCell, pStatus);
230 EXPORTED BOOL ADMINAPI AfsAppLib_asc_ErrorCodeTranslate (UINT_PTR idClient, ULONG code, LANGID idLanguage, STRING pszErrorText, ULONG *pStatus)
232 return asc_ErrorCodeTranslate (idClient, code, idLanguage, pszErrorText, pStatus);
236 EXPORTED BOOL ADMINAPI AfsAppLib_asc_ActionGet (UINT_PTR idClient, DWORD idAction, LPASACTION pAction, ULONG *pStatus)
238 return asc_ActionGet (idClient, idAction, pAction, pStatus);
241 EXPORTED BOOL ADMINAPI AfsAppLib_asc_ActionGetMultiple (UINT_PTR idClient, UINT_PTR idClientSearch, ASID idCellSearch, LPASACTIONLIST *ppList, ULONG *pStatus)
243 return asc_ActionGetMultiple (idClient, idClientSearch, idCellSearch, ppList, pStatus);
246 EXPORTED BOOL ADMINAPI AfsAppLib_asc_ActionListen (UINT_PTR idClient, HWND hNotify, ULONG *pStatus)
248 return asc_ActionListen (idClient, hNotify, pStatus);
251 EXPORTED BOOL ADMINAPI AfsAppLib_asc_ActionListenClear (UINT_PTR idClient, HWND hNotify, ULONG *pStatus)
253 return asc_ActionListenClear (idClient, hNotify, pStatus);
257 EXPORTED BOOL ADMINAPI AfsAppLib_asc_CellOpen (UINT_PTR idClient, PVOID hCreds, LPCTSTR pszCell, DWORD dwScope, ASID *pidCell, ULONG *pStatus)
259 return asc_CellOpen (idClient, hCreds, pszCell, dwScope, pidCell, pStatus);
262 EXPORTED BOOL ADMINAPI AfsAppLib_asc_CellClose (UINT_PTR idClient, ASID idCell, ULONG *pStatus)
264 return asc_CellClose (idClient, idCell, pStatus);
267 EXPORTED BOOL ADMINAPI AfsAppLib_asc_CellChange (UINT_PTR idClient, ASID idCell, LPAFSADMSVR_CHANGECELL_PARAMS pChange, ULONG *pStatus)
269 return asc_CellChange (idClient, idCell, pChange, pStatus);
272 EXPORTED BOOL ADMINAPI AfsAppLib_asc_CellRefreshRateSet (UINT_PTR idClient, ASID idCell, LONG cminRefreshRate, ULONG *pStatus)
274 return asc_CellRefreshRateSet (idClient, idCell, cminRefreshRate, pStatus);
278 EXPORTED BOOL ADMINAPI AfsAppLib_asc_ObjectFind (UINT_PTR idClient, ASID idSearchScope, ASOBJTYPE ObjectType, LPCTSTR pszName, ASID *pidObject, ULONG *pStatus)
280 return asc_ObjectFind (idClient, idSearchScope, ObjectType, pszName, pidObject, pStatus);
283 EXPORTED BOOL ADMINAPI AfsAppLib_asc_ObjectFindMultiple (UINT_PTR idClient, ASID idSearchScope, ASOBJTYPE ObjectType, LPCTSTR pszPattern, LPAFSADMSVR_SEARCH_PARAMS pSearchParams, LPASIDLIST *ppList, ULONG *pStatus)
285 return asc_ObjectFindMultiple (idClient, idSearchScope, ObjectType, pszPattern, pSearchParams, ppList, pStatus);
288 EXPORTED BOOL ADMINAPI AfsAppLib_asc_ObjectPropertiesGet (UINT_PTR idClient, AFSADMSVR_GET_LEVEL GetLevel, ASID idCell, ASID idObject, LPASOBJPROP pProperties, ULONG *pStatus)
290 return asc_ObjectPropertiesGet (idClient, GetLevel, idCell, idObject, pProperties, pStatus);
293 EXPORTED BOOL ADMINAPI AfsAppLib_asc_ObjectPropertiesGetMultiple (UINT_PTR idClient, AFSADMSVR_GET_LEVEL GetLevel, ASID idCell, LPASIDLIST pAsidList, LPASOBJPROPLIST *ppPropertiesList, ULONG *pStatus)
295 return asc_ObjectPropertiesGetMultiple (idClient, GetLevel, idCell, pAsidList, ppPropertiesList, pStatus);
299 EXPORTED BOOL ADMINAPI AfsAppLib_asc_ObjectListen (UINT_PTR idClient, ASID idCell, ASID idObject, HWND hNotify, ULONG *pStatus)
301 return asc_ObjectListen (idClient, idCell, idObject, hNotify, pStatus);
304 EXPORTED BOOL ADMINAPI AfsAppLib_asc_ObjectListenClear (UINT_PTR idClient, HWND hNotify, ULONG *pStatus)
306 return asc_ObjectListenClear (idClient, hNotify, pStatus);
309 EXPORTED BOOL ADMINAPI AfsAppLib_asc_ObjectListenMultiple (UINT_PTR idClient, ASID idCell, LPASIDLIST pAsidList, HWND hNotify, ULONG *pStatus)
311 return asc_ObjectListenMultiple (idClient, idCell, pAsidList, hNotify, pStatus);
315 EXPORTED BOOL ADMINAPI AfsAppLib_asc_ObjectRefresh (UINT_PTR idClient, ASID idCell, ASID idObject, ULONG *pStatus)
317 return asc_ObjectRefresh (idClient, idCell, idObject, pStatus);
320 EXPORTED BOOL ADMINAPI AfsAppLib_asc_ObjectRefreshMultiple (UINT_PTR idClient, ASID idCell, LPASIDLIST pAsidList, ULONG *pStatus)
322 return asc_ObjectRefreshMultiple (idClient, idCell, pAsidList, pStatus);
325 EXPORTED BOOL ADMINAPI AfsAppLib_asc_RandomKeyGet (UINT_PTR idClient, ASID idCell, PBYTE pkey, ULONG *pStatus)
327 return asc_RandomKeyGet (idClient, idCell, pkey, pStatus);
330 EXPORTED BOOL ADMINAPI AfsAppLib_asc_CellNameGet_Fast (UINT_PTR idClient, ASID idCell, LPTSTR pszCell, ULONG *pStatus)
332 return asc_CellNameGet_Fast (idClient, idCell, pszCell, pStatus);
335 EXPORTED BOOL ADMINAPI AfsAppLib_asc_ObjectNameGet_Fast (UINT_PTR idClient, ASID idCell, ASID idObject, LPTSTR pszObject, ULONG *pStatus)
337 return asc_ObjectNameGet_Fast (idClient, idCell, idObject, pszObject, pStatus);
340 EXPORTED BOOL ADMINAPI AfsAppLib_asc_ObjectTypeGet_Fast (UINT_PTR idClient, ASID idCell, ASID idObject, ASOBJTYPE *pObjectType, ULONG *pStatus)
342 return asc_ObjectTypeGet_Fast (idClient, idCell, idObject, pObjectType, pStatus);
345 EXPORTED BOOL ADMINAPI AfsAppLib_asc_ObjectPropertiesGet_Fast (UINT_PTR idClient, ASID idCell, ASID idObject, LPASOBJPROP pProperties, ULONG *pStatus)
347 return asc_ObjectPropertiesGet_Fast (idClient, idCell, idObject, pProperties, pStatus);
351 EXPORTED void ADMINAPI AfsAppLib_asc_Enter (void)
353 asc_Enter();
356 EXPORTED void ADMINAPI AfsAppLib_asc_Leave (void)
358 asc_Leave();
361 EXPORTED LPCRITICAL_SECTION ADMINAPI AfsAppLib_asc_GetCriticalSection (void)
363 return asc_GetCriticalSection();
367 EXPORTED BOOL ADMINAPI AfsAppLib_asc_UserChange (UINT_PTR idClient, ASID idCell, ASID idUser, LPAFSADMSVR_CHANGEUSER_PARAMS pChange, ULONG *pStatus)
369 return asc_UserChange (idClient, idCell, idUser, pChange, pStatus);
372 EXPORTED BOOL ADMINAPI AfsAppLib_asc_UserPasswordSet (UINT_PTR idClient, ASID idCell, ASID idUser, int keyVersion, LPCTSTR pkeyString, PBYTE pkeyData, ULONG *pStatus)
374 return asc_UserPasswordSet (idClient, idCell, idUser, keyVersion, pkeyString, pkeyData, pStatus);
377 EXPORTED BOOL ADMINAPI AfsAppLib_asc_UserUnlock (UINT_PTR idClient, ASID idCell, ASID idUser, ULONG *pStatus)
379 return asc_UserUnlock (idClient, idCell, idUser, pStatus);
382 EXPORTED BOOL ADMINAPI AfsAppLib_asc_UserCreate (UINT_PTR idClient, ASID idCell, LPAFSADMSVR_CREATEUSER_PARAMS pCreate, ASID *pidUser, ULONG *pStatus)
384 return asc_UserCreate (idClient, idCell, pCreate, pidUser, pStatus);
387 EXPORTED BOOL ADMINAPI AfsAppLib_asc_UserDelete (UINT_PTR idClient, ASID idCell, ASID idUser, LPAFSADMSVR_DELETEUSER_PARAMS pDelete, ULONG *pStatus)
389 return asc_UserDelete (idClient, idCell, idUser, pDelete, pStatus);
392 EXPORTED BOOL ADMINAPI AfsAppLib_asc_GroupChange (UINT_PTR idClient, ASID idCell, ASID idGroup, LPAFSADMSVR_CHANGEGROUP_PARAMS pChange, ULONG *pStatus)
394 return asc_GroupChange (idClient, idCell, idGroup, pChange, pStatus);
397 EXPORTED BOOL ADMINAPI AfsAppLib_asc_GroupMembersGet (UINT_PTR idClient, ASID idCell, ASID idGroup, LPASIDLIST *ppAsidList, ULONG *pStatus)
399 return asc_GroupMembersGet (idClient, idCell, idGroup, ppAsidList, pStatus);
402 EXPORTED BOOL ADMINAPI AfsAppLib_asc_GroupMemberAdd (UINT_PTR idClient, ASID idCell, ASID idGroup, ASID idMember, ULONG *pStatus)
404 return asc_GroupMemberAdd (idClient, idCell, idGroup, idMember, pStatus);
407 EXPORTED BOOL ADMINAPI AfsAppLib_asc_GroupMemberRemove (UINT_PTR idClient, ASID idCell, ASID idGroup, ASID idMember, ULONG *pStatus)
409 return asc_GroupMemberRemove (idClient, idCell, idGroup, idMember, pStatus);
412 EXPORTED BOOL ADMINAPI AfsAppLib_asc_GroupRename (UINT_PTR idClient, ASID idCell, ASID idGroup, LPCTSTR pszNewName, ULONG *pStatus)
414 return asc_GroupRename (idClient, idCell, idGroup, pszNewName, pStatus);
417 EXPORTED BOOL ADMINAPI AfsAppLib_asc_GroupOwnershipGet (UINT_PTR idClient, ASID idCell, ASID idMember, LPASIDLIST *ppAsidList, ULONG *pStatus)
419 return asc_GroupOwnershipGet (idClient, idCell, idMember, ppAsidList, pStatus);
422 EXPORTED BOOL ADMINAPI AfsAppLib_asc_GroupMembershipGet (UINT_PTR idClient, ASID idCell, ASID idOwner, LPASIDLIST *ppAsidList, ULONG *pStatus)
424 return asc_GroupMembershipGet (idClient, idCell, idOwner, ppAsidList, pStatus);
427 EXPORTED BOOL ADMINAPI AfsAppLib_asc_GroupCreate (UINT_PTR idClient, ASID idCell, LPAFSADMSVR_CREATEGROUP_PARAMS pCreate, ASID *pidGroup, ULONG *pStatus)
429 return asc_GroupCreate (idClient, idCell, pCreate, pidGroup, pStatus);
432 EXPORTED BOOL ADMINAPI AfsAppLib_asc_GroupDelete (UINT_PTR idClient, ASID idCell, ASID idGroup, ULONG *pStatus)
434 return asc_GroupDelete (idClient, idCell, idGroup, pStatus);