6 #include <WINNT/afsclass.h>
11 * DEFINITIONS ________________________________________________________________
15 #define cREALLOC_NOTIFY 4 // allocate space for 4 notifies at once
19 * VARIABLES __________________________________________________________________
23 size_t NOTIFYCALLBACK::nNotifyList = 0;
24 LPNOTIFYCALLBACK *NOTIFYCALLBACK::aNotifyList = NULL;
28 * PROTOTYPES _________________________________________________________________
34 * ROUTINES ___________________________________________________________________
38 NOTIFYCALLBACK::NOTIFYCALLBACK (NOTIFYCALLBACKPROC procUser, LPARAM lpUser)
40 procSupplied = procUser;
43 for (size_t iNotify = 0; iNotify < nNotifyList; ++iNotify)
45 if (aNotifyList[ iNotify ] == NULL)
49 if (iNotify >= nNotifyList)
51 REALLOC (aNotifyList, nNotifyList, 1+iNotify, cREALLOC_NOTIFY );
54 if (iNotify < nNotifyList)
56 aNotifyList[ iNotify ] = this;
61 NOTIFYCALLBACK::~NOTIFYCALLBACK (void)
63 for (size_t iNotify = 0; iNotify < nNotifyList; ++iNotify)
65 if (aNotifyList[ iNotify ] == this)
66 aNotifyList[ iNotify ] = NULL;
71 BOOL NOTIFYCALLBACK::SendNotificationToAll (NOTIFYEVENT evt, ULONG status)
73 return SendNotificationToAll (evt, NULL, NULL, NULL, NULL, 0, status);
76 BOOL NOTIFYCALLBACK::SendNotificationToAll (NOTIFYEVENT evt, LPIDENT lpi1, ULONG status)
78 return SendNotificationToAll (evt, lpi1, NULL, NULL, NULL, 0, status);
81 BOOL NOTIFYCALLBACK::SendNotificationToAll (NOTIFYEVENT evt, LPTSTR psz1, ULONG status)
83 return SendNotificationToAll (evt, NULL, NULL, psz1, NULL, 0, status);
86 BOOL NOTIFYCALLBACK::SendNotificationToAll (NOTIFYEVENT evt, LPIDENT lpi1, LPTSTR psz1, ULONG status)
88 return SendNotificationToAll (evt, lpi1, NULL, psz1, NULL, 0, status);
91 BOOL NOTIFYCALLBACK::SendNotificationToAll (NOTIFYEVENT evt, LPIDENT lpi1, LPIDENT lpi2, LPTSTR psz1, LPTSTR psz2, DWORD dw1, ULONG status)
96 memset (&Params, 0x00, sizeof(Params));
99 lstrcpy (Params.sz1, (psz1) ? psz1 : TEXT(""));
100 lstrcpy (Params.sz2, (psz2) ? psz2 : TEXT(""));
102 Params.status = status;
104 for (size_t iNotify = 0; iNotify < nNotifyList; ++iNotify)
106 if (aNotifyList[ iNotify ] != NULL)
108 Params.lpUser = aNotifyList[ iNotify ]->lpSupplied;
109 if (!aNotifyList[ iNotify ]->SendNotification (evt, &Params))
118 BOOL NOTIFYCALLBACK::SendNotification (NOTIFYEVENT evt, PNOTIFYPARAMS pParams)
122 if (procSupplied != NULL) {
124 if (!(*procSupplied)( evt, pParams ))
127 // whoops--never trust a callback.