ReactOS 0.4.15-dev-7934-g1dc8d80
shell32_apitest_sub.cpp File Reference
#include "shelltest.h"
#include "shell32_apitest_sub.h"
Include dependency graph for shell32_apitest_sub.cpp:

Go to the source code of this file.

Functions

static BOOL OnCreate (HWND hwnd)
 
static void OnCommand (HWND hwnd, UINT id)
 
static void OnDestroy (HWND hwnd)
 
static BOOL DoPathes (PIDLIST_ABSOLUTE pidl1, PIDLIST_ABSOLUTE pidl2)
 
static VOID DoPathesAndFlags (UINT type, PIDLIST_ABSOLUTE pidl1, PIDLIST_ABSOLUTE pidl2)
 
static void DoShellNotify (HWND hwnd, PIDLIST_ABSOLUTE pidl1, PIDLIST_ABSOLUTE pidl2, LONG lEvent)
 
static INT_PTR OnShellNotify (HWND hwnd, WPARAM wParam, LPARAM lParam)
 
static LRESULT OnGetNotifyFlags (HWND hwnd)
 
static void DoSetPaths (HWND hwnd)
 
static LRESULT CALLBACK WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static BOOL ParseCommandLine (LPWSTR lpCmdLine)
 
INT APIENTRY wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, INT nCmdShow)
 

Variables

static HWND s_hwnd = NULL
 
static UINT s_uRegID = 0
 
static BOOL s_fRecursive = FALSE
 
static DIRTYPE s_iWatchDir = DIRTYPE_NULL
 
static INT s_nSources = 0
 
static LPITEMIDLIST s_pidl = NULL
 
static WCHAR s_path1 [MAX_PATH]
 
static WCHAR s_path2 [MAX_PATH]
 
static BYTE s_counters [TYPE_MAX+1]
 
static HANDLE s_hEvent = NULL
 

Function Documentation

◆ DoPathes()

static BOOL DoPathes ( PIDLIST_ABSOLUTE  pidl1,
PIDLIST_ABSOLUTE  pidl2 
)
static

Definition at line 59 of file shell32_apitest_sub.cpp.

60{
62 if (!SHGetPathFromIDListW(pidl1, path))
63 {
64 s_path1[0] = s_path2[0] = 0;
65 return FALSE;
66 }
67
68 if (wcsstr(path, L"Recent") != NULL)
69 return FALSE;
70
72
73 if (!SHGetPathFromIDListW(pidl2, s_path2))
74 s_path2[0] = 0;
75
76 return TRUE;
77}
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define MAX_PATH
Definition: compat.h:34
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)
#define L(x)
Definition: ntvdm.h:50
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1353
static WCHAR s_path1[MAX_PATH]
static WCHAR s_path2[MAX_PATH]
#define _countof(array)
Definition: sndvol32.h:68
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by DoPathesAndFlags().

◆ DoPathesAndFlags()

static VOID DoPathesAndFlags ( UINT  type,
PIDLIST_ABSOLUTE  pidl1,
PIDLIST_ABSOLUTE  pidl2 
)
static

Definition at line 79 of file shell32_apitest_sub.cpp.

80{
81 if (DoPathes(pidl1, pidl2))
82 {
83 s_counters[type] = 1;
85 }
86}
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static BOOL DoPathes(PIDLIST_ABSOLUTE pidl1, PIDLIST_ABSOLUTE pidl2)
static HANDLE s_hEvent
static BYTE s_counters[TYPE_MAX+1]
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733

Referenced by DoShellNotify().

◆ DoSetPaths()

static void DoSetPaths ( HWND  hwnd)
static

Definition at line 182 of file shell32_apitest_sub.cpp.

183{
184 WCHAR szText[MAX_PATH * 2];
185 StringCchCopyW(szText, _countof(szText), s_path1);
186 StringCchCatW(szText, _countof(szText), L"|");
187 StringCchCatW(szText, _countof(szText), s_path2);
188
189 FILE *fp = _wfopen(TEMP_FILE, L"wb");
190 if (fp)
191 {
192 fwrite(szText, (wcslen(szText) + 1) * sizeof(WCHAR), 1, fp);
193 fflush(fp);
194 fclose(fp);
195 }
196}
_Check_return_ _CRTIMP FILE *__cdecl _wfopen(_In_z_ const wchar_t *_Filename, _In_z_ const wchar_t *_Mode)
_Check_return_opt_ _CRTIMP int __cdecl fflush(_Inout_opt_ FILE *_File)
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
_Check_return_opt_ _CRTIMP size_t __cdecl fwrite(_In_reads_bytes_(_Size *_Count) const void *_Str, _In_ size_t _Size, _In_ size_t _Count, _Inout_ FILE *_File)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define TEMP_FILE
STRSAFEAPI StringCchCatW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:325

Referenced by WindowProc().

◆ DoShellNotify()

static void DoShellNotify ( HWND  hwnd,
PIDLIST_ABSOLUTE  pidl1,
PIDLIST_ABSOLUTE  pidl2,
LONG  lEvent 
)
static

Definition at line 89 of file shell32_apitest_sub.cpp.

90{
91 switch (lEvent)
92 {
94 DoPathesAndFlags(TYPE_RENAMEITEM, pidl1, pidl2);
95 break;
96 case SHCNE_CREATE:
97 DoPathesAndFlags(TYPE_CREATE, pidl1, pidl2);
98 break;
99 case SHCNE_DELETE:
100 DoPathesAndFlags(TYPE_DELETE, pidl1, pidl2);
101 break;
102 case SHCNE_MKDIR:
103 DoPathesAndFlags(TYPE_MKDIR, pidl1, pidl2);
104 break;
105 case SHCNE_RMDIR:
106 DoPathesAndFlags(TYPE_RMDIR, pidl1, pidl2);
107 break;
109 break;
111 break;
113 break;
114 case SHCNE_DRIVEADD:
115 break;
116 case SHCNE_NETSHARE:
117 break;
118 case SHCNE_NETUNSHARE:
119 break;
120 case SHCNE_ATTRIBUTES:
121 break;
122 case SHCNE_UPDATEDIR:
123 DoPathesAndFlags(TYPE_UPDATEDIR, pidl1, pidl2);
124 break;
125 case SHCNE_UPDATEITEM:
126 break;
128 break;
130 break;
132 break;
134 DoPathesAndFlags(TYPE_RENAMEFOLDER, pidl1, pidl2);
135 break;
136 case SHCNE_FREESPACE:
137 break;
139 break;
141 break;
142 default:
143 break;
144 }
145}
static VOID DoPathesAndFlags(UINT type, PIDLIST_ABSOLUTE pidl1, PIDLIST_ABSOLUTE pidl2)
@ TYPE_RENAMEFOLDER
@ TYPE_RMDIR
@ TYPE_UPDATEDIR
@ TYPE_MKDIR
@ TYPE_DELETE
@ TYPE_RENAMEITEM
@ TYPE_CREATE
#define SHCNE_DRIVEREMOVED
Definition: shlobj.h:1882
#define SHCNE_DRIVEADDGUI
Definition: shlobj.h:1891
#define SHCNE_RMDIR
Definition: shlobj.h:1879
#define SHCNE_DELETE
Definition: shlobj.h:1877
#define SHCNE_MKDIR
Definition: shlobj.h:1878
#define SHCNE_UPDATEITEM
Definition: shlobj.h:1888
#define SHCNE_RENAMEITEM
Definition: shlobj.h:1875
#define SHCNE_UPDATEDIR
Definition: shlobj.h:1887
#define SHCNE_MEDIAINSERTED
Definition: shlobj.h:1880
#define SHCNE_UPDATEIMAGE
Definition: shlobj.h:1890
#define SHCNE_CREATE
Definition: shlobj.h:1876
#define SHCNE_RENAMEFOLDER
Definition: shlobj.h:1892
#define SHCNE_SERVERDISCONNECT
Definition: shlobj.h:1889
#define SHCNE_MEDIAREMOVED
Definition: shlobj.h:1881
#define SHCNE_EXTENDED_EVENT
Definition: shlobj.h:1895
#define SHCNE_DRIVEADD
Definition: shlobj.h:1883
#define SHCNE_ASSOCCHANGED
Definition: shlobj.h:1896
#define SHCNE_ATTRIBUTES
Definition: shlobj.h:1886
#define SHCNE_NETUNSHARE
Definition: shlobj.h:1885
#define SHCNE_FREESPACE
Definition: shlobj.h:1893
#define SHCNE_NETSHARE
Definition: shlobj.h:1884
HANDLE lEvent
Definition: tftpd.cpp:56

Referenced by OnShellNotify().

◆ OnCommand()

static void OnCommand ( HWND  hwnd,
UINT  id 
)
static

Definition at line 35 of file shell32_apitest_sub.cpp.

36{
37 switch (id)
38 {
39 case IDOK:
40 case IDCANCEL:
42 break;
43 }
44}
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define IDCANCEL
Definition: winuser.h:831
#define IDOK
Definition: winuser.h:830
BOOL WINAPI DestroyWindow(_In_ HWND)

Referenced by WindowProc().

◆ OnCreate()

static BOOL OnCreate ( HWND  hwnd)
static

Definition at line 22 of file shell32_apitest_sub.cpp.

23{
24 s_hwnd = hwnd;
26
28 entry.pidl = s_pidl;
29 entry.fRecursive = s_fRecursive;
31 return s_uRegID != 0;
32}
EXTERN_C ULONG WINAPI SHChangeNotifyRegister(HWND hwnd, INT fSources, LONG wEventMask, UINT uMsg, INT cItems, SHChangeNotifyEntry *lpItems)
uint32_t entry
Definition: isohybrid.c:63
static HWND s_hwnd
static LPITEMIDLIST s_pidl
static DIRTYPE s_iWatchDir
static UINT s_uRegID
static INT s_nSources
static BOOL s_fRecursive
LPITEMIDLIST DoGetPidl(DIRTYPE iDir)
#define WM_SHELL_NOTIFY
#define SHCNE_ALLEVENTS
Definition: shlobj.h:1899

Referenced by WindowProc().

◆ OnDestroy()

static void OnDestroy ( HWND  hwnd)
static

Definition at line 47 of file shell32_apitest_sub.cpp.

48{
50 s_uRegID = 0;
51
53 s_pidl = NULL;
54
56 s_hwnd = NULL;
57}
EXTERN_C BOOL WINAPI SHChangeNotifyDeregister(ULONG hNotify)
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)

Referenced by WindowProc().

◆ OnGetNotifyFlags()

static LRESULT OnGetNotifyFlags ( HWND  hwnd)
static

Definition at line 167 of file shell32_apitest_sub.cpp.

168{
169 if (s_uRegID == 0)
170 return 0xFFFFFFFF;
171
172 DWORD dwFlags = 0;
173 for (size_t i = 0; i < _countof(s_counters); ++i)
174 {
175 if (s_counters[i])
176 dwFlags |= (1 << i);
177 }
178 return dwFlags;
179}
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176

Referenced by WindowProc().

◆ OnShellNotify()

static INT_PTR OnShellNotify ( HWND  hwnd,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 148 of file shell32_apitest_sub.cpp.

149{
150 LONG lEvent;
151 PIDLIST_ABSOLUTE *pidlAbsolute;
152 HANDLE hLock = SHChangeNotification_Lock((HANDLE)wParam, (DWORD)lParam, &pidlAbsolute, &lEvent);
153 if (hLock)
154 {
155 DoShellNotify(hwnd, pidlAbsolute[0], pidlAbsolute[1], lEvent);
157 }
158 else
159 {
160 pidlAbsolute = (PIDLIST_ABSOLUTE *)wParam;
161 DoShellNotify(hwnd, pidlAbsolute[0], pidlAbsolute[1], lParam);
162 }
163 return TRUE;
164}
EXTERN_C HANDLE WINAPI SHChangeNotification_Lock(HANDLE hTicket, DWORD dwOwnerPID, LPITEMIDLIST **lppidls, LPLONG lpwEventId)
EXTERN_C BOOL WINAPI SHChangeNotification_Unlock(HANDLE hLock)
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
long LONG
Definition: pedump.c:60
static void DoShellNotify(HWND hwnd, PIDLIST_ABSOLUTE pidl1, PIDLIST_ABSOLUTE pidl2, LONG lEvent)

Referenced by WindowProc().

◆ ParseCommandLine()

static BOOL ParseCommandLine ( LPWSTR  lpCmdLine)
static

Definition at line 235 of file shell32_apitest_sub.cpp.

236{
237 LPWSTR pch = lpCmdLine; // fRecursive,iWatchDir,nSources
238 s_fRecursive = !!wcstoul(pch, NULL, 0);
239 pch = wcschr(pch, L',');
240 if (!pch)
241 return FALSE;
242 ++pch;
243
245 pch = wcschr(pch, L',');
246 if (!pch)
247 return FALSE;
248 ++pch;
249
250 s_nSources = wcstoul(pch, NULL, 0);
251 return TRUE;
252}
#define wcschr
Definition: compat.h:17
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define pch(ap)
Definition: match.c:418
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by wWinMain().

◆ WindowProc()

static LRESULT CALLBACK WindowProc ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 199 of file shell32_apitest_sub.cpp.

200{
201 switch (uMsg)
202 {
203 case WM_CREATE:
204 return (OnCreate(hwnd) ? 0 : -1);
205
206 case WM_COMMAND:
208 break;
209
210 case WM_SHELL_NOTIFY:
212
213 case WM_DESTROY:
215 break;
216
218 return OnGetNotifyFlags(hwnd);
219
220 case WM_CLEAR_FLAGS:
222 s_path1[0] = s_path2[0] = 0;
223 break;
224
225 case WM_SET_PATHS:
227 break;
228
229 default:
230 return DefWindowProcW(hwnd, uMsg, wParam, lParam);
231 }
232 return 0;
233}
#define LOWORD(l)
Definition: pedump.c:82
static void DoSetPaths(HWND hwnd)
static BOOL OnCreate(HWND hwnd)
static LRESULT OnGetNotifyFlags(HWND hwnd)
static void OnCommand(HWND hwnd, UINT id)
static void OnDestroy(HWND hwnd)
static INT_PTR OnShellNotify(HWND hwnd, WPARAM wParam, LPARAM lParam)
#define WM_CLEAR_FLAGS
#define WM_GET_NOTIFY_FLAGS
#define WM_SET_PATHS
#define ZeroMemory
Definition: winbase.h:1712
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_CREATE
Definition: winuser.h:1608
#define WM_COMMAND
Definition: winuser.h:1740
#define WM_DESTROY
Definition: winuser.h:1609

Referenced by wWinMain().

◆ wWinMain()

INT APIENTRY wWinMain ( HINSTANCE  hInstance,
HINSTANCE  hPrevInstance,
LPWSTR  lpCmdLine,
INT  nCmdShow 
)

Definition at line 255 of file shell32_apitest_sub.cpp.

259{
260 if (lstrcmpiW(lpCmdLine, L"") == 0 || lstrcmpiW(lpCmdLine, L"TEST") == 0)
261 return 0;
262
263 if (!ParseCommandLine(lpCmdLine))
264 return -1;
265
267
268 WNDCLASSW wc;
269 ZeroMemory(&wc, sizeof(wc));
274 wc.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1);
276 if (!RegisterClassW(&wc))
277 return -1;
278
280 CW_USEDEFAULT, CW_USEDEFAULT, 400, 100,
282 if (!hwnd)
283 return -1;
284
287
288 MSG msg;
289 while (GetMessageW(&msg, NULL, 0, 0))
290 {
293 }
294
296
297 return 0;
298}
#define msg(x)
Definition: auth_time.c:54
#define CloseHandle
Definition: compat.h:739
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
#define EVENT_ALL_ACCESS
Definition: isotest.c:82
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
static LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
static BOOL ParseCommandLine(LPWSTR lpCmdLine)
#define EVENT_NAME
#define CLASSNAME
LPCWSTR lpszClassName
Definition: winuser.h:3185
HBRUSH hbrBackground
Definition: winuser.h:3183
HICON hIcon
Definition: winuser.h:3181
HINSTANCE hInstance
Definition: winuser.h:3180
WNDPROC lpfnWndProc
Definition: winuser.h:3177
HCURSOR hCursor
Definition: winuser.h:3182
HANDLE WINAPI DECLSPEC_HOTPATCH OpenEventW(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN LPCWSTR lpName)
Definition: synch.c:682
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
#define SW_SHOWNORMAL
Definition: winuser.h:770
BOOL WINAPI TranslateMessage(_In_ const MSG *)
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI GetMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
#define IDC_ARROW
Definition: winuser.h:687
#define IDI_APPLICATION
Definition: winuser.h:704
#define LoadIcon
Definition: winuser.h:5813
BOOL WINAPI UpdateWindow(_In_ HWND)
#define LoadCursor
Definition: winuser.h:5812
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4316
#define CW_USEDEFAULT
Definition: winuser.h:225
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
#define COLOR_3DFACE
Definition: winuser.h:929

Variable Documentation

◆ s_counters

BYTE s_counters[TYPE_MAX+1]
static

Definition at line 18 of file shell32_apitest_sub.cpp.

Referenced by DoPathesAndFlags(), OnGetNotifyFlags(), and WindowProc().

◆ s_fRecursive

BOOL s_fRecursive = FALSE
static

Definition at line 13 of file shell32_apitest_sub.cpp.

Referenced by OnCreate(), and ParseCommandLine().

◆ s_hEvent

HANDLE s_hEvent = NULL
static

Definition at line 19 of file shell32_apitest_sub.cpp.

Referenced by DoPathesAndFlags(), and wWinMain().

◆ s_hwnd

HWND s_hwnd = NULL
static

Definition at line 11 of file shell32_apitest_sub.cpp.

Referenced by OnCreate(), and OnDestroy().

◆ s_iWatchDir

DIRTYPE s_iWatchDir = DIRTYPE_NULL
static

Definition at line 14 of file shell32_apitest_sub.cpp.

Referenced by OnCreate(), and ParseCommandLine().

◆ s_nSources

INT s_nSources = 0
static

Definition at line 15 of file shell32_apitest_sub.cpp.

Referenced by OnCreate(), and ParseCommandLine().

◆ s_path1

WCHAR s_path1[MAX_PATH]
static

Definition at line 17 of file shell32_apitest_sub.cpp.

Referenced by DoPathes(), DoSetPaths(), and WindowProc().

◆ s_path2

WCHAR s_path2[MAX_PATH]
static

Definition at line 17 of file shell32_apitest_sub.cpp.

Referenced by DoPathes(), DoSetPaths(), and WindowProc().

◆ s_pidl

LPITEMIDLIST s_pidl = NULL
static

Definition at line 16 of file shell32_apitest_sub.cpp.

Referenced by OnCreate(), and OnDestroy().

◆ s_uRegID

UINT s_uRegID = 0
static

Definition at line 12 of file shell32_apitest_sub.cpp.

Referenced by OnCreate(), OnDestroy(), and OnGetNotifyFlags().