shell32: move the ChangeNotifyAPI declarations to shlobj.h
Rolf Kalbermatter
rolf.kalbermatter at citeng.com
Fri Sep 19 01:27:46 CDT 2003
Changelog
- include/shlobj.h
Add declarations for newly documented SHChangeNotify API
- dlls/shell32/undocshell.h
Remove now documented SHChangeNotify API
- dlls/shell32/changenotify.c
Fix parameter type of SHChangeNotifyRegister function
- dlls/shell32/shlview.c
A few changes caused by the different parameter types of SHChangeNotifyRegister
License: X11
Rolf Kalbermatter
Index: include/shlobj.h
===================================================================
RCS file: /home/wine/wine/include/shlobj.h,v
retrieving revision 1.75
diff -u -r1.75 shlobj.h
--- include/shlobj.h 15 Sep 2003 22:10:48 -0000 1.75
+++ include/shlobj.h 16 Sep 2003 22:14:36 -0000
@@ -495,8 +495,17 @@
#define SSF_NOCONFIRMRECYCLE 0x8000
#define SSF_HIDEICONS 0x4000
-/**********************************************************************
- * SHChangeNotify
+/****************************************************************************
+* File System Notification APIs
+*/
+typedef struct _SHChangeNotifyEntry
+{
+ LPCITEMIDLIST pidl;
+ BOOL fRecursive;
+} SHChangeNotifyEntry;
+
+/*
+ * File System Notification flags
*/
#define SHCNE_RENAMEITEM 0x00000001
#define SHCNE_CREATE 0x00000002
@@ -525,8 +534,16 @@
#define SHCNE_ALLEVENTS 0x7FFFFFFF
#define SHCNE_INTERRUPT 0x80000000
-#define SHCNEE_ORDERCHANGED 0x00000002
+/*
+ * SHCNE_EXTENDED_EVENT extended events. These events are ordinals and not a bitfield.
+ */
+#define SHCNEE_ORDERCHANGED 0x0002L
+#define SHCNEE_MSI_CHANGE 0x0004L
+#define SHCNEE_MSI_UNINSTALL 0x0005L
+/* Flags
+ * uFlags & SHCNF_TYPE is an ID which indicates what dwItem1 and dwItem2 mean
+ */
#define SHCNF_IDLIST 0x0000
#define SHCNF_PATHA 0x0001
#define SHCNF_PRINTERA 0x0002
@@ -537,8 +554,62 @@
#define SHCNF_FLUSH 0x1000
#define SHCNF_FLUSHNOWAIT 0x2000
+#ifdef UNICODE
+#define SHCNF_PATH SHCNF_PATHW
+#define SHCNF_PRINTER SHCNF_PRINTERW
+#else
+#define SHCNF_PATH SHCNF_PATHA
+#define SHCNF_PRINTER SHCNF_PRINTERA
+#endif
+
void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2);
+/*
+ * IShellChangeNotify
+ */
+typedef struct IShellChangeNotify IShellChangeNotify, *LPSHELLCHANGENOTIFY;
+
+#define INTERFACE IShellChangeNotify
+#define IShellChangeNotify_METHODS \
+ IUnknown_METHODS \
+ STDMETHOD(OnChange)(THIS_ LONG lEvent, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2) PURE;
+
+ICOM_DEFINE(IShellChangeNotify, IUnknown)
+#undef INTERFACE
+
+#ifdef COBJMACROS
+/*** IUnknown methods ***/
+#define IShellChangeNotify_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
+#define IShellChangeNotify_AddRef(p) (p)->lpVtbl->AddRef(p)
+#define IShellChangeNotify_Release(p) (p)->lpVtbl->Release(p)
+/*** IShellChangeNotify methods ***/
+#define IShellChangeNotify_OnChange(p,a,b,c) (p)->lpVtbl->OnChange(p,a,b,c)
+#endif
+
+typedef struct _SHChangeDWORDAsIDList {
+ USHORT cb;
+ DWORD dwItem1;
+ DWORD dwItem2;
+ USHORT cbZero;
+} SHChangeDWORDAsIDList, *LPSHChangeDWORDAsIDList;
+
+typedef struct _SHChangeProductKeyAsIDList {
+ USHORT cb;
+ WCHAR wszProductKey[39];
+ USHORT cbZero;
+} SHChangeProductKeyAsIDList, *LPSHChangeProductKeyAsIDList;
+
+ULONG WINAPI SHChangeNotifyRegister(HWND hwnd, int fSources, LONG fEvents, UINT wMsg,
+ int cEntries, SHChangeNotifyEntry *pshcne);
+BOOL WINAPI SHChangeNotifyDeregister(ULONG ulID);
+HANDLE WINAPI SHChangeNotification_Lock(HANDLE hChangeNotification, DWORD dwProcessId,
+ LPITEMIDLIST **pppidl, LONG *plEvent);
+BOOL WINAPI SHChangeNotification_Unlock(HANDLE hLock);
+
+/* The pidls used for ChangeNotifyEvents are simple Pidls, this function will
+ convert them to true PIDLs. */
+HRESULT WINAPI SHGetRealIDL(IShellFolder *psf, LPCITEMIDLIST pidlSimple, LPITEMIDLIST * ppidlReal);
+
/****************************************************************************
* SHCreateDirectory API
*/
Index: dlls/shell32/undocshell.h
===================================================================
RCS file: /home/wine/wine/dlls/shell32/undocshell.h,v
retrieving revision 1.15
diff -u -r1.15 undocshell.h
--- dlls/shell32/undocshell.h 5 Sep 2003 23:08:30 -0000 1.15
+++ dlls/shell32/undocshell.h 16 Sep 2003 22:14:34 -0000
@@ -148,39 +148,6 @@
#define SHCNRF_RecursiveInterrupt 0x1000 /* Must be combined with SHCNRF_InterruptLevel */
#define SHCNRF_NewDelivery 0x8000 /* Messages use shared memory */
-typedef struct
-{
- LPITEMIDLIST pidlPath;
- BOOL bWatchSubtree;
-} NOTIFYREGISTER, *LPNOTIFYREGISTER;
-
-typedef const LPNOTIFYREGISTER LPCNOTIFYREGISTER;
-
-typedef struct
-{
- USHORT cb;
- DWORD dwItem1;
- DWORD dwItem2;
-} DWORDITEMID;
-
-HANDLE WINAPI SHChangeNotifyRegister(
- HWND hwnd,
- LONG dwFlags,
- LONG wEventMask,
- UINT uMsg,
- int cItems,
- LPNOTIFYREGISTER lpItems);
-
-BOOL WINAPI SHChangeNotifyDeregister(HANDLE hNotify);
-
-HANDLE WINAPI SHChangeNotification_Lock(
- HANDLE hMemoryMap,
- DWORD dwProcessId,
- LPCITEMIDLIST **lppidls,
- LPLONG lpwEventId);
-
-BOOL WINAPI SHChangeNotification_Unlock(HANDLE hLock);
-
/****************************************************************************
* Shell Common Dialogs
*/
Index: dlls/shell32/changenotify.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/changenotify.c,v
retrieving revision 1.27
diff -u -r1.27 changenotify.c
--- dlls/shell32/changenotify.c 15 Sep 2003 22:09:46 -0000 1.27
+++ dlls/shell32/changenotify.c 16 Sep 2003 22:14:30 -0000
@@ -18,10 +18,14 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include <stdarg.h>
#include <string.h>
-#include "wine/debug.h"
+#define NONAMELESSUNION
+#define NONAMELESSSTRUCT
#include "windef.h"
+#include "winbase.h"
+#include "wine/debug.h"
#include "wingdi.h"
#include "pidl.h"
#include "shell32_main.h"
@@ -38,6 +42,8 @@
};
static CRITICAL_SECTION SHELL32_ChangenotifyCS = { &critsect_debug, -1, 0, 0, 0, 0 };
+typedef SHChangeNotifyEntry *LPNOTIFYREGISTER;
+
/* internal list of notification clients (internal) */
typedef struct _NOTIFICATIONLIST
{
@@ -107,7 +113,7 @@
const char *str;
WCHAR path[MAX_PATH];
- if(SHGetPathFromIDListW(item->apidl[0].pidlPath, path ))
+ if(SHGetPathFromIDListW(item->apidl[0].pidl, path ))
str = wine_dbg_sprintf("%s", debugstr_w(path));
else
str = wine_dbg_sprintf("<not a disk file>" );
@@ -155,7 +161,7 @@
/* free the item */
for (i=0; i<item->cidl; i++)
- SHFree(item->apidl[i].pidlPath);
+ SHFree((LPITEMIDLIST)item->apidl[i].pidl);
SHFree(item->apidl);
SHFree(item);
}
@@ -182,37 +188,37 @@
* SHChangeNotifyRegister [SHELL32.2]
*
*/
-HANDLE WINAPI
+ULONG WINAPI
SHChangeNotifyRegister(
HWND hwnd,
- LONG dwFlags,
+ int fSources,
LONG wEventMask,
UINT uMsg,
int cItems,
- LPCNOTIFYREGISTER lpItems)
+ SHChangeNotifyEntry *lpItems)
{
LPNOTIFICATIONLIST item;
int i;
item = SHAlloc(sizeof(NOTIFICATIONLIST));
- TRACE("(%p,0x%08lx,0x%08lx,0x%08x,0x%08x,%p) item=%p\n",
- hwnd, dwFlags, wEventMask, uMsg, cItems, lpItems, item);
+ TRACE("(%p,0x%08x,0x%08lx,0x%08x,%d,%p) item=%p\n",
+ hwnd, fSources, wEventMask, uMsg, cItems, lpItems, item);
item->next = NULL;
item->prev = NULL;
item->cidl = cItems;
- item->apidl = SHAlloc(sizeof(NOTIFYREGISTER) * cItems);
+ item->apidl = SHAlloc(sizeof(SHChangeNotifyEntry) * cItems);
for(i=0;i<cItems;i++)
{
- item->apidl[i].pidlPath = ILClone(lpItems[i].pidlPath);
- item->apidl[i].bWatchSubtree = lpItems[i].bWatchSubtree;
+ item->apidl[i].pidl = ILClone(lpItems[i].pidl);
+ item->apidl[i].fRecursive = lpItems[i].fRecursive;
}
item->hwnd = hwnd;
item->uMsg = uMsg;
item->wEventMask = wEventMask;
item->wSignalledEvent = 0;
- item->dwFlags = dwFlags;
+ item->dwFlags = fSources;
TRACE("new node: %s\n", NodeName( item ));
@@ -222,21 +228,21 @@
LeaveCriticalSection(&SHELL32_ChangenotifyCS);
- return (HANDLE)item;
+ return (ULONG)item;
}
/*************************************************************************
* SHChangeNotifyDeregister [SHELL32.4]
*/
-BOOL WINAPI SHChangeNotifyDeregister(HANDLE hNotify)
+BOOL WINAPI SHChangeNotifyDeregister(ULONG hNotify)
{
LPNOTIFICATIONLIST node;
- TRACE("(%p)\n",hNotify);
+ TRACE("(0x%08lx)\n", hNotify);
EnterCriticalSection(&SHELL32_ChangenotifyCS);
- node = FindNode(hNotify);
+ node = FindNode((HANDLE)hNotify);
if( node )
DeleteNode(node);
@@ -257,7 +263,7 @@
return -1;
}
-static BOOL should_notify( LPITEMIDLIST changed, LPITEMIDLIST watched, BOOL sub )
+static BOOL should_notify( LPITEMIDLIST changed, LPCITEMIDLIST watched, BOOL sub )
{
TRACE("%p %p %d\n", changed, watched, sub );
if ( !watched )
@@ -357,8 +363,8 @@
for( i=0; (i<ptr->cidl) && !notify ; i++ )
{
- LPITEMIDLIST pidl = ptr->apidl[i].pidlPath;
- BOOL subtree = ptr->apidl[i].bWatchSubtree;
+ LPCITEMIDLIST pidl = ptr->apidl[i].pidl;
+ BOOL subtree = ptr->apidl[i].fRecursive;
if (wEventId & ptr->wEventMask)
{
@@ -411,7 +417,7 @@
LONG events2,
DWORD msg,
int count,
- LPCNOTIFYREGISTER idlist)
+ SHChangeNotifyEntry *idlist)
{
FIXME("(%p,0x%08lx,0x%08lx,0x%08lx,0x%08x,%p):semi stub.\n",
hwnd,events1,events2,msg,count,idlist);
@@ -425,12 +431,12 @@
HANDLE WINAPI SHChangeNotification_Lock(
HANDLE hChange,
DWORD dwProcessId,
- LPCITEMIDLIST **lppidls,
+ LPITEMIDLIST **lppidls,
LPLONG lpwEventId)
{
DWORD i;
LPNOTIFICATIONLIST node;
- LPCITEMIDLIST *idlist;
+ LPITEMIDLIST *idlist;
TRACE("%p %08lx %p %p\n", hChange, dwProcessId, lppidls, lpwEventId);
@@ -441,7 +447,7 @@
{
idlist = SHAlloc( sizeof(LPCITEMIDLIST *) * node->cidl );
for(i=0; i<node->cidl; i++)
- idlist[i] = node->pidlSignaled;
+ idlist[i] = (LPITEMIDLIST)node->pidlSignaled;
*lpwEventId = node->wSignalledEvent;
*lppidls = idlist;
node->wSignalledEvent = 0;
@@ -466,9 +472,9 @@
/*************************************************************************
* NTSHChangeNotifyDeregister [SHELL32.641]
*/
-DWORD WINAPI NTSHChangeNotifyDeregister(LONG x1)
+DWORD WINAPI NTSHChangeNotifyDeregister(ULONG x1)
{
FIXME("(0x%08lx):semi stub.\n",x1);
- return SHChangeNotifyDeregister( (HANDLE)x1 );
+ return SHChangeNotifyDeregister( x1 );
}
Index: dlls/shell32/shlview.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shlview.c,v
retrieving revision 1.85
diff -u -r1.85 shlview.c
--- dlls/shell32/shlview.c 10 Sep 2003 03:56:47 -0000 1.85
+++ dlls/shell32/shlview.c 16 Sep 2003 22:14:33 -0000
@@ -89,7 +89,7 @@
UINT cidl;
LPITEMIDLIST *apidl;
LISTVIEW_SORT_INFO ListViewSortInfo;
- HANDLE hNotify; /* change notification handle */
+ ULONG hNotify; /* change notification handle */
HANDLE hAccel;
} IShellViewImpl;
@@ -630,7 +630,7 @@
static LRESULT ShellView_OnCreate(IShellViewImpl * This)
{
IDropTarget* pdt;
- NOTIFYREGISTER ntreg;
+ SHChangeNotifyEntry ntreg;
IPersistFolder2 * ppf2 = NULL;
TRACE("%p\n",This);
@@ -656,10 +656,10 @@
IShellFolder_QueryInterface(This->pSFParent, &IID_IPersistFolder2, (LPVOID*)&ppf2);
if (ppf2)
{
- IPersistFolder2_GetCurFolder(ppf2, &ntreg.pidlPath);
- ntreg.bWatchSubtree = FALSE;
+ IPersistFolder2_GetCurFolder(ppf2, (LPITEMIDLIST*)&ntreg.pidl);
+ ntreg.fRecursive = FALSE;
This->hNotify = SHChangeNotifyRegister(This->hWnd, SHCNF_IDLIST, SHCNE_ALLEVENTS, SHV_CHANGE_NOTIFY, 1, &ntreg);
- SHFree(ntreg.pidlPath);
+ SHFree((LPITEMIDLIST)ntreg.pidl);
IPersistFolder2_Release(ppf2);
}
More information about the wine-patches
mailing list