Update NEWS for 1.6.22
[pkg-k5-afs_openafs.git] / src / WINNT / afsadmsvr / TaAfsAdmSvrClient.cpp
blobb4a479abef51647af43ebe48c58f23d7f3986c1c
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 #include <winsock2.h>
11 #include <ws2tcpip.h>
13 extern "C" {
14 #include <afs/param.h>
15 #include <afs/stds.h>
18 #include "TaAfsAdmSvrClientInternal.h"
22 * VARIABLES __________________________________________________________________
26 static struct
28 BOOL fInitializedSockets;
29 size_t cReqForAdminServer;
30 } l;
34 * ROUTINES ___________________________________________________________________
38 extern "C" void __RPC_FAR * __RPC_USER MIDL_user_allocate (size_t cbAllocate)
40 return (void __RPC_FAR *)Allocate (cbAllocate);
43 extern "C" void __RPC_USER MIDL_user_free (void __RPC_FAR *pData)
45 Free (pData);
50 * DATA STRUCTURES ____________________________________________________________
54 BOOL ADMINAPI asc_AsidListCreate (LPASIDLIST *ppList)
56 return ((*ppList = AfsAdmSvr_CreateAsidList()) != NULL);
59 BOOL ADMINAPI asc_AsidListCopy (LPASIDLIST *ppListTarget, LPASIDLIST *ppListSource)
61 return ((*ppListTarget = AfsAdmSvr_CopyAsidList (*ppListSource)) != NULL);
64 BOOL ADMINAPI asc_AsidListAddEntry (LPASIDLIST *ppList, ASID idObject, LPARAM lp)
66 return AfsAdmSvr_AddToAsidList (ppList, idObject, lp);
69 BOOL ADMINAPI asc_AsidListRemoveEntry (LPASIDLIST *ppList, ASID idObject)
71 return AfsAdmSvr_RemoveFromAsidList (ppList, idObject);
74 BOOL ADMINAPI asc_AsidListRemoveEntryByIndex (LPASIDLIST *ppList, size_t iIndex)
76 return AfsAdmSvr_RemoveFromAsidListByIndex (ppList, iIndex);
79 BOOL ADMINAPI asc_AsidListSetEntryParam (LPASIDLIST *ppList, ASID idObject, LPARAM lp)
81 return AfsAdmSvr_SetAsidListParam (ppList, idObject, lp);
84 BOOL ADMINAPI asc_AsidListSetEntryParamByIndex (LPASIDLIST *ppList, size_t iIndex, LPARAM lp)
86 return AfsAdmSvr_SetAsidListParamByIndex (ppList, iIndex, lp);
89 BOOL ADMINAPI asc_AsidListTest (LPASIDLIST *ppList, ASID idObject, LPARAM *pParam)
91 return AfsAdmSvr_IsInAsidList (ppList, idObject, pParam);
94 BOOL ADMINAPI asc_AsidListFree (LPASIDLIST *ppList)
96 AfsAdmSvr_FreeAsidList (ppList);
97 return TRUE;
101 BOOL ADMINAPI asc_ObjPropListCreate (LPASOBJPROPLIST *ppList)
103 return ((*ppList = AfsAdmSvr_CreateObjPropList()) != NULL);
106 BOOL ADMINAPI asc_ObjPropListCopy (LPASOBJPROPLIST *ppListTarget, LPASOBJPROPLIST *ppListSource)
108 return ((*ppListTarget = AfsAdmSvr_CopyObjPropList (*ppListSource)) != NULL);
111 BOOL ADMINAPI asc_ObjPropListAddEntry (LPASOBJPROPLIST *ppList, LPASOBJPROP pProperties, LPARAM lp)
113 return AfsAdmSvr_AddToObjPropList (ppList, pProperties, lp);
116 BOOL ADMINAPI asc_ObjPropListRemoveEntry (LPASOBJPROPLIST *ppList, ASID idObject)
118 return AfsAdmSvr_RemoveFromObjPropList (ppList, idObject);
121 BOOL ADMINAPI asc_ObjPropListTest (LPASOBJPROPLIST *ppList, ASID idObject, LPASOBJPROP pProperties, LPARAM *pParam)
123 return AfsAdmSvr_IsInObjPropList (ppList, idObject, pProperties, pParam);
126 BOOL ADMINAPI asc_ObjPropListFree (LPASOBJPROPLIST *ppList)
128 AfsAdmSvr_FreeObjPropList (ppList);
129 return TRUE;
133 BOOL ADMINAPI asc_ActionListCreate (LPASACTIONLIST *ppList)
135 return ((*ppList = AfsAdmSvr_CreateActionList()) != NULL);
138 BOOL ADMINAPI asc_ActionListCopy (LPASACTIONLIST *ppListTarget, LPASACTIONLIST *ppListSource)
140 return ((*ppListTarget = AfsAdmSvr_CopyActionList (*ppListSource)) != NULL);
143 BOOL ADMINAPI asc_ActionListAddEntry (LPASACTIONLIST *ppList, LPASACTION pAction)
145 return AfsAdmSvr_AddToActionList (ppList, pAction);
148 BOOL ADMINAPI asc_ActionListRemoveEntry (LPASACTIONLIST *ppList, DWORD idAction)
150 return AfsAdmSvr_RemoveFromActionList (ppList, idAction);
153 BOOL ADMINAPI asc_ActionListTest (LPASACTIONLIST *ppList, DWORD idAction, LPASACTION pAction)
155 return AfsAdmSvr_IsInActionList (ppList, idAction, pAction);
158 BOOL ADMINAPI asc_ActionListFree (LPASACTIONLIST *ppList)
160 AfsAdmSvr_FreeActionList (ppList);
161 return TRUE;
166 * ROUTINES ___________________________________________________________________
170 BOOL ADMINAPI asc_AdminServerOpen (LPCTSTR pszAddress, UINT_PTR *pidClient, ULONG *pStatus)
172 BOOL rc = TRUE;
173 ULONG status = 0;
175 if (!l.fInitializedSockets)
177 WSADATA Data;
178 WSAStartup (0x0101, &Data);
179 l.fInitializedSockets = TRUE;
182 if ((++l.cReqForAdminServer) == 1)
184 LPCTSTR pszResolvedAddress = ResolveAddress (pszAddress);
185 if (!BindToAdminServer (pszResolvedAddress, FALSE, pidClient, &status))
187 if (status != RPC_S_CALL_FAILED_DNE) // server rejected us?
188 rc = FALSE;
189 else if (pszResolvedAddress || !ForkNewAdminServer (&status))
190 rc = FALSE;
191 else
192 rc = BindToAdminServer (pszResolvedAddress, TRUE, pidClient, &status);
196 if (rc)
197 StartPingThread (*pidClient);
198 if (rc)
199 StartCallbackThread();
200 if (!rc && pStatus)
201 *pStatus = status;
202 return rc;
206 BOOL ADMINAPI asc_AdminServerClose (UINT_PTR idClient, ULONG *pStatus)
208 BOOL rc = TRUE;
209 ULONG status = 0;
211 StopCallbackThread();
212 StopPingThread (idClient);
214 if (l.cReqForAdminServer && ((--l.cReqForAdminServer) == 0))
216 UnbindFromAdminServer (idClient, &status);
219 if (!rc && pStatus)
220 *pStatus = status;
221 return rc;
226 BOOL ADMINAPI asc_CredentialsCrack (UINT_PTR idClient, PVOID hCreds, LPTSTR pszCell, LPTSTR pszUser, SYSTEMTIME *pstExpiration, ULONG *pStatus)
228 BOOL rc = FALSE;
229 ULONG status = 0;
231 RpcTryExcept
233 STRING szCell = TEXT("");
234 STRING szUser = TEXT("");
236 if ((rc = AfsAdmSvr_CrackCredentials (idClient, (UINT_PTR)hCreds, szCell, szUser, pstExpiration, &status)) != FALSE)
238 lstrcpy (pszCell, szCell);
239 lstrcpy (pszUser, szUser);
242 RpcExcept(1)
244 rc = FALSE;
245 status = RPC_S_CALL_FAILED_DNE;
247 RpcEndExcept
249 if (!rc && pStatus)
250 *pStatus = status;
251 return rc;
255 UINT_PTR ADMINAPI asc_CredentialsGet (UINT_PTR idClient, LPCTSTR pszCell, ULONG *pStatus)
257 UINT_PTR rc = 0;
258 ULONG status = 0;
260 RpcTryExcept
262 if (pszCell)
264 STRING szCell;
265 lstrcpy (szCell, pszCell);
267 rc = AfsAdmSvr_GetCredentials (idClient, szCell, &status);
270 RpcExcept(1)
272 rc = FALSE;
273 status = RPC_S_CALL_FAILED_DNE;
275 RpcEndExcept
277 if (!rc && pStatus)
278 *pStatus = status;
279 return rc;
283 UINT_PTR ADMINAPI asc_CredentialsSet (UINT_PTR idClient, LPCTSTR pszCell, LPCTSTR pszUser, LPCTSTR pszPassword, ULONG *pStatus)
285 UINT_PTR rc = 0;
286 ULONG status = 0;
288 RpcTryExcept
290 STRING szCell;
291 lstrcpy (szCell, pszCell);
293 STRING szUser;
294 lstrcpy (szUser, pszUser);
296 STRING szPassword;
297 lstrcpy (szPassword, pszPassword);
299 // TODO: Ensure we do some encryption here, or using an
300 // encrypted socket, or something... can't just be pushing
301 // the user's unencrypted password across the wire.
303 rc = AfsAdmSvr_SetCredentials (idClient, szCell, szUser, szPassword, &status);
305 RpcExcept(1)
307 rc = FALSE;
308 status = RPC_S_CALL_FAILED_DNE;
310 RpcEndExcept
312 if (!rc && pStatus)
313 *pStatus = status;
314 return rc;
318 BOOL ADMINAPI asc_CredentialsPush (UINT_PTR idClient, PVOID hCreds, ASID idCell, ULONG *pStatus)
320 BOOL rc = TRUE;
321 ULONG status = 0;
323 RpcTryExcept
325 rc = (AfsAdmSvr_PushCredentials (idClient, PtrToUlong(hCreds), idCell, &status)?TRUE:FALSE);
327 RpcExcept(1)
329 rc = FALSE;
330 status = RPC_S_CALL_FAILED_DNE;
332 RpcEndExcept
334 if (!rc && pStatus)
335 *pStatus = status;
336 return rc;
340 BOOL ADMINAPI asc_LocalCellGet (UINT_PTR idClient, LPTSTR pszCell, ULONG *pStatus)
342 BOOL rc = TRUE;
343 ULONG status = 0;
345 RpcTryExcept
347 STRING szCell;
348 if ((rc = AfsAdmSvr_GetLocalCell (idClient, szCell, &status)) != FALSE)
350 lstrcpy (pszCell, szCell);
353 RpcExcept(1)
355 rc = FALSE;
356 status = RPC_S_CALL_FAILED_DNE;
358 RpcEndExcept
360 if (!rc && pStatus)
361 *pStatus = status;
362 return rc;
366 BOOL ADMINAPI asc_ErrorCodeTranslate (UINT_PTR idClient, ULONG code, LANGID idLanguage, STRING pszErrorText, ULONG *pStatus)
368 BOOL rc = TRUE;
369 ULONG status = 0;
371 RpcTryExcept
373 STRING szText;
374 if ((rc = AfsAdmSvr_ErrorCodeTranslate (idClient, code, idLanguage, szText, &status)) != FALSE)
376 lstrcpy (pszErrorText, szText);
379 RpcExcept(1)
381 rc = FALSE;
382 status = RPC_S_CALL_FAILED_DNE;
384 RpcEndExcept
386 if (!rc && pStatus)
387 *pStatus = status;
388 return rc;
392 BOOL ADMINAPI asc_CellOpen (UINT_PTR idClient, PVOID hCreds, LPCTSTR pszCell, DWORD dwScope, ASID *pidCell, ULONG *pStatus)
394 BOOL rc = TRUE;
395 ULONG status = 0;
397 RpcTryExcept
399 STRING szCell;
400 lstrcpy (szCell, pszCell);
402 if ((rc = (AfsAdmSvr_OpenCell (idClient, PtrToUlong(hCreds), szCell, dwScope, pidCell, &status)?TRUE:FALSE)) != FALSE)
404 if (!CreateCellCache (*pidCell))
406 (void)AfsAdmSvr_CloseCell (idClient, *pidCell, &status);
407 rc = FALSE;
408 status = ERROR_NOT_ENOUGH_MEMORY;
410 else // get rudimentary properties about the cell
412 rc = RefreshCachedProperties (idClient, *pidCell, *pidCell, GET_RUDIMENTARY_DATA, &status);
416 RpcExcept(1)
418 rc = FALSE;
419 status = RPC_S_CALL_FAILED_DNE;
421 RpcEndExcept
423 if (!rc && pStatus)
424 *pStatus = status;
425 return rc;
429 BOOL ADMINAPI asc_CellClose (UINT_PTR idClient, ASID idCell, ULONG *pStatus)
431 BOOL rc = TRUE;
432 ULONG status = 0;
434 RpcTryExcept
436 rc = AfsAdmSvr_CloseCell (idClient, idCell, &status);
437 DestroyCellCache (idCell);
439 RpcExcept(1)
441 rc = FALSE;
442 status = RPC_S_CALL_FAILED_DNE;
444 RpcEndExcept
446 if (!rc && pStatus)
447 *pStatus = status;
448 return rc;
452 BOOL ADMINAPI asc_ObjectFind (UINT_PTR idClient, ASID idSearchScope, ASOBJTYPE ObjectType, LPCTSTR pszName, ASID *pidObject, ULONG *pStatus)
454 BOOL rc = TRUE;
455 ULONG status = 0;
457 RpcTryExcept
459 STRING szName = TEXT("");
460 if (pszName)
461 lstrcpy (szName, pszName);
462 rc = AfsAdmSvr_FindObject (idClient, idSearchScope, ObjectType, SEARCH_ALL_OBJECTS, szName, pidObject, &status);
464 RpcExcept(1)
466 rc = FALSE;
467 status = RPC_S_CALL_FAILED_DNE;
469 RpcEndExcept
471 if (!rc && pStatus)
472 *pStatus = status;
473 return rc;
477 BOOL ADMINAPI asc_ObjectFindMultiple (UINT_PTR idClient, ASID idSearchScope, ASOBJTYPE ObjectType, LPCTSTR pszPattern, LPAFSADMSVR_SEARCH_PARAMS pSearchParams, LPASIDLIST *ppList, ULONG *pStatus)
479 BOOL rc = TRUE;
480 ULONG status = 0;
482 RpcTryExcept
484 *ppList = NULL;
486 STRING szPattern = TEXT("");
487 if (pszPattern)
488 lstrcpy (szPattern, pszPattern);
490 AFSADMSVR_SEARCH_PARAMS SearchParams;
491 if (pSearchParams)
492 memcpy (&SearchParams, pSearchParams, sizeof(AFSADMSVR_SEARCH_PARAMS));
493 else
495 memset (&SearchParams, 0x00, sizeof(AFSADMSVR_SEARCH_PARAMS));
496 SearchParams.SearchType = SEARCH_NO_LIMITATIONS;
499 rc = AfsAdmSvr_FindObjects (idClient, idSearchScope, ObjectType, SEARCH_ALL_OBJECTS, szPattern, &SearchParams, ppList, &status);
501 RpcExcept(1)
503 rc = FALSE;
504 status = RPC_S_CALL_FAILED_DNE;
506 RpcEndExcept
508 if (!rc && pStatus)
509 *pStatus = status;
510 return rc;
514 BOOL ADMINAPI asc_ObjectPropertiesGet (UINT_PTR idClient, AFSADMSVR_GET_LEVEL GetLevel, ASID idCell, ASID idObject, LPASOBJPROP pProperties, ULONG *pStatus)
516 BOOL rc = TRUE;
517 ULONG status = 0;
519 if (!RefreshCachedProperties (idClient, idCell, idObject, GetLevel, &status))
521 rc = FALSE;
523 else
525 LPASOBJPROP pFound;
526 if ((pFound = GetCachedProperties (idCell, idObject)) == NULL)
528 status = ERROR_NOT_ENOUGH_MEMORY;
529 rc = FALSE;
531 else
533 memcpy (pProperties, pFound, sizeof(ASOBJPROP));
537 if (!rc && pStatus)
538 *pStatus = status;
539 return rc;
543 BOOL ADMINAPI asc_ObjectPropertiesGetMultiple (UINT_PTR idClient, AFSADMSVR_GET_LEVEL GetLevel, ASID idCell, LPASIDLIST pAsidList, LPASOBJPROPLIST *ppPropertiesList, ULONG *pStatus)
545 BOOL rc = TRUE;
546 ULONG status = 0;
548 if (!RefreshCachedProperties (idClient, idCell, pAsidList, GetLevel, &status))
550 rc = FALSE;
552 else
554 *ppPropertiesList = NULL;
555 for (size_t iAsidList = 0; iAsidList < pAsidList->cEntries; ++iAsidList)
557 LPASOBJPROP pFound;
558 if ((pFound = GetCachedProperties (idCell, pAsidList->aEntries[ iAsidList ].idObject)) != NULL)
560 if (!*ppPropertiesList)
561 asc_ObjPropListCreate(ppPropertiesList);
562 if (*ppPropertiesList)
563 AfsAdmSvr_AddToObjPropList (ppPropertiesList, pFound, pAsidList->aEntries[ iAsidList ].lParam);
568 if (!rc && *ppPropertiesList)
569 AfsAdmSvr_FreeObjPropList (ppPropertiesList);
570 if (!rc && pStatus)
571 *pStatus = status;
572 return rc;
576 BOOL ADMINAPI asc_ObjectListen (UINT_PTR idClient, ASID idCell, ASID idObject, HWND hNotify, ULONG *pStatus)
578 if (!idObject)
580 if (*pStatus)
581 *pStatus = ERROR_INVALID_PARAMETER;
582 return FALSE;
585 if (!AddObjectNotification (hNotify, idCell, idObject))
587 if (*pStatus)
588 *pStatus = ERROR_NOT_ENOUGH_MEMORY;
589 return FALSE;
592 TestForNotifications (idClient, idCell, idObject);
593 return TRUE;
597 BOOL ADMINAPI asc_ObjectListenClear (UINT_PTR idClient, HWND hNotify, ULONG *pStatus)
599 ClearObjectNotifications (hNotify);
600 return TRUE;
604 BOOL ADMINAPI asc_ObjectListenMultiple (UINT_PTR idClient, ASID idCell, LPASIDLIST pAsidList, HWND hNotify, ULONG *pStatus)
606 if (!pAsidList)
608 if (*pStatus)
609 *pStatus = ERROR_INVALID_PARAMETER;
610 return FALSE;
613 for (size_t ii = 0; ii < pAsidList->cEntriesAllocated; ++ii)
615 if (!pAsidList->aEntries[ ii ].idObject)
616 continue;
618 if (!AddObjectNotification (hNotify, idCell, pAsidList->aEntries[ ii ].idObject))
620 if (*pStatus)
621 *pStatus = ERROR_NOT_ENOUGH_MEMORY;
622 return FALSE;
625 TestForNotifications (idClient, idCell, pAsidList->aEntries[ ii ].idObject);
628 return TRUE;
632 BOOL ADMINAPI asc_ObjectRefresh (UINT_PTR idClient, ASID idCell, ASID idObject, ULONG *pStatus)
634 BOOL rc = TRUE;
635 ULONG status = 0;
637 // First have the server invalidate its cache of information; regardless
638 // of the name, this is actually just an Invalidate call, not a Refresh call
640 RpcTryExcept
642 rc = AfsAdmSvr_RefreshObject (idClient, idObject, &status);
644 RpcExcept(1)
646 rc = FALSE;
647 status = RPC_S_CALL_FAILED_DNE;
649 RpcEndExcept
651 // If that suceeded, see if there is anyone listening for changes
652 // in this object or any of its children. If so, this call
653 // will requery the server for the latest properties for all
654 // listened-for objects, which will make us post notifications if
655 // we get new data back.
657 if (rc)
659 TestForNotifications (idClient, idCell);
662 if (!rc && pStatus)
663 *pStatus = status;
664 return rc;
668 BOOL ADMINAPI asc_ObjectRefreshMultiple (UINT_PTR idClient, ASID idCell, LPASIDLIST pAsidList, ULONG *pStatus)
670 BOOL rc = TRUE;
671 ULONG status = 0;
673 // First have the server invalidate its cache of information; regardless
674 // of the name, this is actually just an Invalidate call, not a Refresh call
676 RpcTryExcept
678 rc = AfsAdmSvr_RefreshObjects (idClient, pAsidList, &status);
680 RpcExcept(1)
682 rc = FALSE;
683 status = RPC_S_CALL_FAILED_DNE;
685 RpcEndExcept
687 // If that suceeded, see if there is anyone listening for changes
688 // in any of these objects or their children. If so, this call
689 // will requery the server for the latest properties for all
690 // listened-for objects, which will make us post notifications if
691 // we get new data back.
693 if (rc)
695 TestForNotifications (idClient, idCell);
698 if (!rc && pStatus)
699 *pStatus = status;
700 return rc;
704 BOOL ADMINAPI asc_RandomKeyGet (UINT_PTR idClient, ASID idCell, PBYTE key, ULONG *pStatus)
706 BOOL rc = TRUE;
707 ULONG status = 0;
709 RpcTryExcept
711 memset (key, 0x00, sizeof(BYTE) * ENCRYPTIONKEYLENGTH);
712 rc = AfsAdmSvr_GetRandomKey (idClient, idCell, key, &status);
714 RpcExcept(1)
716 rc = FALSE;
717 status = RPC_S_CALL_FAILED_DNE;
719 RpcEndExcept
721 if (!rc && pStatus)
722 *pStatus = status;
723 return rc;
727 BOOL ADMINAPI asc_CellNameGet_Fast (UINT_PTR idClient, ASID idCell, LPTSTR pszCell, ULONG *pStatus)
729 return asc_ObjectNameGet_Fast (idClient, idCell, idCell, pszCell, pStatus);
733 BOOL ADMINAPI asc_ObjectNameGet_Fast (UINT_PTR idClient, ASID idCell, ASID idObject, LPTSTR pszObject, ULONG *pStatus)
735 BOOL rc = TRUE;
736 ULONG status = 0;
738 LPASOBJPROP pProperties;
739 if ((pProperties = GetCachedProperties (idCell, idObject)) == NULL)
741 rc = FALSE;
742 status = ERROR_NO_DATA;
744 else if (pProperties->verProperties == verPROP_NO_OBJECT)
746 rc = FALSE;
747 status = ERROR_NO_DATA;
749 else
751 lstrcpy (pszObject, pProperties->szName);
754 if (!rc && pStatus)
755 *pStatus = status;
756 return rc;
760 BOOL ADMINAPI asc_ObjectTypeGet_Fast (UINT_PTR idClient, ASID idCell, ASID idObject, ASOBJTYPE *pObjectType, ULONG *pStatus)
762 BOOL rc = TRUE;
763 ULONG status = 0;
765 LPASOBJPROP pProperties;
766 if ((pProperties = GetCachedProperties (idCell, idObject)) == NULL)
768 rc = FALSE;
769 status = ERROR_NO_DATA;
771 else if (pProperties->verProperties == verPROP_NO_OBJECT)
773 rc = FALSE;
774 status = ERROR_NO_DATA;
776 else
778 *pObjectType = pProperties->Type;
781 if (!rc && pStatus)
782 *pStatus = status;
783 return rc;
787 BOOL ADMINAPI asc_ObjectPropertiesGet_Fast (UINT_PTR idClient, ASID idCell, ASID idObject, LPASOBJPROP pProperties, ULONG *pStatus)
789 BOOL rc = TRUE;
790 ULONG status = 0;
792 LPASOBJPROP pPropFound;
793 if ((pPropFound = GetCachedProperties (idCell, idObject)) == NULL)
795 rc = FALSE;
796 status = ERROR_NO_DATA;
798 else if (pPropFound->verProperties == verPROP_NO_OBJECT)
800 rc = FALSE;
801 status = ERROR_NO_DATA;
803 else if (pProperties)
805 memcpy (pProperties, pPropFound, sizeof(ASOBJPROP));
808 if (!rc && pStatus)
809 *pStatus = status;
810 return rc;
814 BOOL ADMINAPI asc_ActionGet (UINT_PTR idClient, DWORD idAction, LPASACTION pAction, ULONG *pStatus)
816 BOOL rc = TRUE;
817 ULONG status = 0;
819 RpcTryExcept
821 memset (pAction, 0x00, sizeof(ASACTION));
822 rc = AfsAdmSvr_GetAction (idClient, idAction, pAction, &status);
824 RpcExcept(1)
826 rc = FALSE;
827 status = RPC_S_CALL_FAILED_DNE;
829 RpcEndExcept
831 if (!rc && pStatus)
832 *pStatus = status;
833 return rc;
837 BOOL ADMINAPI asc_ActionGetMultiple (UINT_PTR idClient, UINT_PTR idClientSearch, ASID idCellSearch, LPASACTIONLIST *ppList, ULONG *pStatus)
839 BOOL rc = TRUE;
840 ULONG status = 0;
842 RpcTryExcept
844 *ppList = NULL;
845 rc = AfsAdmSvr_GetActions (idClient, idClientSearch, idCellSearch, ppList, &status);
847 RpcExcept(1)
849 rc = FALSE;
850 status = RPC_S_CALL_FAILED_DNE;
852 RpcEndExcept
854 if (!rc && pStatus)
855 *pStatus = status;
856 return rc;
860 BOOL ADMINAPI asc_ActionListen (UINT_PTR idClient, HWND hNotify, ULONG *pStatus)
862 if (!SetActionNotification (hNotify, TRUE))
864 if (*pStatus)
865 *pStatus = ERROR_NOT_ENOUGH_MEMORY;
866 return FALSE;
868 return TRUE;
872 BOOL ADMINAPI asc_ActionListenClear (UINT_PTR idClient, HWND hNotify, ULONG *pStatus)
874 if (!SetActionNotification (hNotify, FALSE))
876 if (*pStatus)
877 *pStatus = ERROR_NOT_ENOUGH_MEMORY;
878 return FALSE;
880 return TRUE;
884 // AfsAdmSvrCallback_Action
885 // ...called by the server in the context of the CallbackHost() routine;
886 // this routine is used to notify the client whenever an action is
887 // initiated or completed.
889 extern "C" void AfsAdmSvrCallback_Action (LPASACTION pAction, BOOL fFinished)
891 NotifyActionListeners (pAction, fFinished);