From 58c0561badd9f6775cdeb7dc0f936f4c88587784 Mon Sep 17 00:00:00 2001 From: Rolf Kalbermatter Date: Mon, 22 Sep 2003 19:24:13 +0000 Subject: [PATCH] Added declarations for newly documented SHChangeNotify API and fixed some prototypes. --- dlls/shell32/changenotify.c | 56 ++++++++++++++++++--------------- dlls/shell32/pidl.c | 6 ++-- dlls/shell32/shlview.c | 10 +++--- dlls/shell32/undocshell.h | 33 ------------------- include/shlobj.h | 63 ++++++++++++++++++++++++++++++++++--- 5 files changed, 98 insertions(+), 70 deletions(-) diff --git a/dlls/shell32/changenotify.c b/dlls/shell32/changenotify.c index 258f542d861..78bb2c79ac5 100644 --- a/dlls/shell32/changenotify.c +++ b/dlls/shell32/changenotify.c @@ -18,10 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include -#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_DEBUG critsect_debug = }; 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 @@ static const char * NodeName(LPNOTIFICATIONLIST item) 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("" ); @@ -155,7 +161,7 @@ static void DeleteNode(LPNOTIFICATIONLIST item) /* free the item */ for (i=0; icidl; i++) - SHFree(item->apidl[i].pidlPath); + SHFree((LPITEMIDLIST)item->apidl[i].pidl); SHFree(item->apidl); SHFree(item); } @@ -182,37 +188,37 @@ void FreeChangeNotifications(void) * 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;iapidl[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 @@ SHChangeNotifyRegister( 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 @@ BOOL WINAPI SHChangeNotifyUpdateEntryList(DWORD unknown1, DWORD unknown2, 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 @@ void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID for( i=0; (icidl) && !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 @@ DWORD WINAPI NTSHChangeNotifyRegister( 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 @@ DWORD WINAPI NTSHChangeNotifyRegister( 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 @@ HANDLE WINAPI SHChangeNotification_Lock( { idlist = SHAlloc( sizeof(LPCITEMIDLIST *) * node->cidl ); for(i=0; icidl; i++) - idlist[i] = node->pidlSignaled; + idlist[i] = (LPITEMIDLIST)node->pidlSignaled; *lpwEventId = node->wSignalledEvent; *lppidls = idlist; node->wSignalledEvent = 0; @@ -466,9 +472,9 @@ BOOL WINAPI SHChangeNotification_Unlock ( HANDLE hLock) /************************************************************************* * 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 ); } diff --git a/dlls/shell32/pidl.c b/dlls/shell32/pidl.c index f743a503128..2464499b584 100644 --- a/dlls/shell32/pidl.c +++ b/dlls/shell32/pidl.c @@ -629,11 +629,11 @@ LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1,LPCITEMIDLIST pidl2) * * NOTES */ -LPITEMIDLIST WINAPI SHGetRealIDL(LPSHELLFOLDER lpsf, LPITEMIDLIST pidl, DWORD z) +HRESULT WINAPI SHGetRealIDL(LPSHELLFOLDER lpsf, LPCITEMIDLIST pidlSimple, LPITEMIDLIST *pidlReal) { - FIXME("sf=%p pidl=%p 0x%04lx\n",lpsf,pidl,z); + FIXME("sf=%p pidlSimple=%p pidlReal=%p\n", lpsf, pidlSimple, pidlReal); - pdump (pidl); + pdump (pidlSimple); return 0; } diff --git a/dlls/shell32/shlview.c b/dlls/shell32/shlview.c index 1f5f8e4033a..526a7db1978 100644 --- a/dlls/shell32/shlview.c +++ b/dlls/shell32/shlview.c @@ -89,7 +89,7 @@ typedef struct 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 HRESULT ShellView_FillList(IShellViewImpl * This) static LRESULT ShellView_OnCreate(IShellViewImpl * This) { IDropTarget* pdt; - NOTIFYREGISTER ntreg; + SHChangeNotifyEntry ntreg; IPersistFolder2 * ppf2 = NULL; TRACE("%p\n",This); @@ -656,10 +656,10 @@ static LRESULT ShellView_OnCreate(IShellViewImpl * This) 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); } diff --git a/dlls/shell32/undocshell.h b/dlls/shell32/undocshell.h index 079c9fa9343..bfc861dafa1 100644 --- a/dlls/shell32/undocshell.h +++ b/dlls/shell32/undocshell.h @@ -148,39 +148,6 @@ HRESULT WINAPI StrRetToStrNAW ( #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 */ diff --git a/include/shlobj.h b/include/shlobj.h index 8901dd22130..cdc98dabbcb 100644 --- a/include/shlobj.h +++ b/include/shlobj.h @@ -495,9 +495,15 @@ VOID WINAPI SHGetSettings(LPSHELLFLAGSTATE lpsfs, DWORD dwMask); #define SSF_NOCONFIRMRECYCLE 0x8000 #define SSF_HIDEICONS 0x4000 -/********************************************************************** - * SHChangeNotify - */ +/**************************************************************************** +* SHChangeNotify API +*/ +typedef struct _SHChangeNotifyEntry +{ + LPCITEMIDLIST pidl; + BOOL fRecursive; +} SHChangeNotifyEntry; + #define SHCNE_RENAMEITEM 0x00000001 #define SHCNE_CREATE 0x00000002 #define SHCNE_DELETE 0x00000004 @@ -525,7 +531,9 @@ VOID WINAPI SHGetSettings(LPSHELLFLAGSTATE lpsfs, DWORD dwMask); #define SHCNE_ALLEVENTS 0x7FFFFFFF #define SHCNE_INTERRUPT 0x80000000 -#define SHCNEE_ORDERCHANGED 0x00000002 +#define SHCNEE_ORDERCHANGED 0x0002L +#define SHCNEE_MSI_CHANGE 0x0004L +#define SHCNEE_MSI_UNINSTALL 0x0005L #define SHCNF_IDLIST 0x0000 #define SHCNF_PATHA 0x0001 @@ -537,8 +545,55 @@ VOID WINAPI SHGetSettings(LPSHELLFLAGSTATE lpsfs, DWORD dwMask); #define SHCNF_FLUSH 0x1000 #define SHCNF_FLUSHNOWAIT 0x2000 +#define SHCNF_PATH WINELIB_NAME_AW(SHCNF_PATH) +#define SHCNF_PRINTER WINELIB_NAME_AW(SHCNF_PRINTER) + 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); + +HRESULT WINAPI SHGetRealIDL(IShellFolder *psf, LPCITEMIDLIST pidlSimple, LPITEMIDLIST * ppidlReal); + /**************************************************************************** * SHCreateDirectory API */