Commit 58c0561b authored by Rolf Kalbermatter's avatar Rolf Kalbermatter Committed by Alexandre Julliard

Added declarations for newly documented SHChangeNotify API and fixed

some prototypes.
parent f42bc61b
...@@ -18,10 +18,14 @@ ...@@ -18,10 +18,14 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include <stdarg.h>
#include <string.h> #include <string.h>
#include "wine/debug.h" #define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "windef.h" #include "windef.h"
#include "winbase.h"
#include "wine/debug.h"
#include "wingdi.h" #include "wingdi.h"
#include "pidl.h" #include "pidl.h"
#include "shell32_main.h" #include "shell32_main.h"
...@@ -38,6 +42,8 @@ static CRITICAL_SECTION_DEBUG critsect_debug = ...@@ -38,6 +42,8 @@ static CRITICAL_SECTION_DEBUG critsect_debug =
}; };
static CRITICAL_SECTION SHELL32_ChangenotifyCS = { &critsect_debug, -1, 0, 0, 0, 0 }; static CRITICAL_SECTION SHELL32_ChangenotifyCS = { &critsect_debug, -1, 0, 0, 0, 0 };
typedef SHChangeNotifyEntry *LPNOTIFYREGISTER;
/* internal list of notification clients (internal) */ /* internal list of notification clients (internal) */
typedef struct _NOTIFICATIONLIST typedef struct _NOTIFICATIONLIST
{ {
...@@ -107,7 +113,7 @@ static const char * NodeName(LPNOTIFICATIONLIST item) ...@@ -107,7 +113,7 @@ static const char * NodeName(LPNOTIFICATIONLIST item)
const char *str; const char *str;
WCHAR path[MAX_PATH]; 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)); str = wine_dbg_sprintf("%s", debugstr_w(path));
else else
str = wine_dbg_sprintf("<not a disk file>" ); str = wine_dbg_sprintf("<not a disk file>" );
...@@ -155,7 +161,7 @@ static void DeleteNode(LPNOTIFICATIONLIST item) ...@@ -155,7 +161,7 @@ static void DeleteNode(LPNOTIFICATIONLIST item)
/* free the item */ /* free the item */
for (i=0; i<item->cidl; i++) for (i=0; i<item->cidl; i++)
SHFree(item->apidl[i].pidlPath); SHFree((LPITEMIDLIST)item->apidl[i].pidl);
SHFree(item->apidl); SHFree(item->apidl);
SHFree(item); SHFree(item);
} }
...@@ -182,37 +188,37 @@ void FreeChangeNotifications(void) ...@@ -182,37 +188,37 @@ void FreeChangeNotifications(void)
* SHChangeNotifyRegister [SHELL32.2] * SHChangeNotifyRegister [SHELL32.2]
* *
*/ */
HANDLE WINAPI ULONG WINAPI
SHChangeNotifyRegister( SHChangeNotifyRegister(
HWND hwnd, HWND hwnd,
LONG dwFlags, int fSources,
LONG wEventMask, LONG wEventMask,
UINT uMsg, UINT uMsg,
int cItems, int cItems,
LPCNOTIFYREGISTER lpItems) SHChangeNotifyEntry *lpItems)
{ {
LPNOTIFICATIONLIST item; LPNOTIFICATIONLIST item;
int i; int i;
item = SHAlloc(sizeof(NOTIFICATIONLIST)); item = SHAlloc(sizeof(NOTIFICATIONLIST));
TRACE("(%p,0x%08lx,0x%08lx,0x%08x,0x%08x,%p) item=%p\n", TRACE("(%p,0x%08x,0x%08lx,0x%08x,%d,%p) item=%p\n",
hwnd, dwFlags, wEventMask, uMsg, cItems, lpItems, item); hwnd, fSources, wEventMask, uMsg, cItems, lpItems, item);
item->next = NULL; item->next = NULL;
item->prev = NULL; item->prev = NULL;
item->cidl = cItems; item->cidl = cItems;
item->apidl = SHAlloc(sizeof(NOTIFYREGISTER) * cItems); item->apidl = SHAlloc(sizeof(SHChangeNotifyEntry) * cItems);
for(i=0;i<cItems;i++) for(i=0;i<cItems;i++)
{ {
item->apidl[i].pidlPath = ILClone(lpItems[i].pidlPath); item->apidl[i].pidl = ILClone(lpItems[i].pidl);
item->apidl[i].bWatchSubtree = lpItems[i].bWatchSubtree; item->apidl[i].fRecursive = lpItems[i].fRecursive;
} }
item->hwnd = hwnd; item->hwnd = hwnd;
item->uMsg = uMsg; item->uMsg = uMsg;
item->wEventMask = wEventMask; item->wEventMask = wEventMask;
item->wSignalledEvent = 0; item->wSignalledEvent = 0;
item->dwFlags = dwFlags; item->dwFlags = fSources;
TRACE("new node: %s\n", NodeName( item )); TRACE("new node: %s\n", NodeName( item ));
...@@ -222,21 +228,21 @@ SHChangeNotifyRegister( ...@@ -222,21 +228,21 @@ SHChangeNotifyRegister(
LeaveCriticalSection(&SHELL32_ChangenotifyCS); LeaveCriticalSection(&SHELL32_ChangenotifyCS);
return (HANDLE)item; return (ULONG)item;
} }
/************************************************************************* /*************************************************************************
* SHChangeNotifyDeregister [SHELL32.4] * SHChangeNotifyDeregister [SHELL32.4]
*/ */
BOOL WINAPI SHChangeNotifyDeregister(HANDLE hNotify) BOOL WINAPI SHChangeNotifyDeregister(ULONG hNotify)
{ {
LPNOTIFICATIONLIST node; LPNOTIFICATIONLIST node;
TRACE("(%p)\n",hNotify); TRACE("(0x%08lx)\n", hNotify);
EnterCriticalSection(&SHELL32_ChangenotifyCS); EnterCriticalSection(&SHELL32_ChangenotifyCS);
node = FindNode(hNotify); node = FindNode((HANDLE)hNotify);
if( node ) if( node )
DeleteNode(node); DeleteNode(node);
...@@ -257,7 +263,7 @@ BOOL WINAPI SHChangeNotifyUpdateEntryList(DWORD unknown1, DWORD unknown2, ...@@ -257,7 +263,7 @@ BOOL WINAPI SHChangeNotifyUpdateEntryList(DWORD unknown1, DWORD unknown2,
return -1; 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 ); TRACE("%p %p %d\n", changed, watched, sub );
if ( !watched ) if ( !watched )
...@@ -357,8 +363,8 @@ void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID ...@@ -357,8 +363,8 @@ void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID
for( i=0; (i<ptr->cidl) && !notify ; i++ ) for( i=0; (i<ptr->cidl) && !notify ; i++ )
{ {
LPITEMIDLIST pidl = ptr->apidl[i].pidlPath; LPCITEMIDLIST pidl = ptr->apidl[i].pidl;
BOOL subtree = ptr->apidl[i].bWatchSubtree; BOOL subtree = ptr->apidl[i].fRecursive;
if (wEventId & ptr->wEventMask) if (wEventId & ptr->wEventMask)
{ {
...@@ -411,7 +417,7 @@ DWORD WINAPI NTSHChangeNotifyRegister( ...@@ -411,7 +417,7 @@ DWORD WINAPI NTSHChangeNotifyRegister(
LONG events2, LONG events2,
DWORD msg, DWORD msg,
int count, int count,
LPCNOTIFYREGISTER idlist) SHChangeNotifyEntry *idlist)
{ {
FIXME("(%p,0x%08lx,0x%08lx,0x%08lx,0x%08x,%p):semi stub.\n", FIXME("(%p,0x%08lx,0x%08lx,0x%08lx,0x%08x,%p):semi stub.\n",
hwnd,events1,events2,msg,count,idlist); hwnd,events1,events2,msg,count,idlist);
...@@ -425,12 +431,12 @@ DWORD WINAPI NTSHChangeNotifyRegister( ...@@ -425,12 +431,12 @@ DWORD WINAPI NTSHChangeNotifyRegister(
HANDLE WINAPI SHChangeNotification_Lock( HANDLE WINAPI SHChangeNotification_Lock(
HANDLE hChange, HANDLE hChange,
DWORD dwProcessId, DWORD dwProcessId,
LPCITEMIDLIST **lppidls, LPITEMIDLIST **lppidls,
LPLONG lpwEventId) LPLONG lpwEventId)
{ {
DWORD i; DWORD i;
LPNOTIFICATIONLIST node; LPNOTIFICATIONLIST node;
LPCITEMIDLIST *idlist; LPITEMIDLIST *idlist;
TRACE("%p %08lx %p %p\n", hChange, dwProcessId, lppidls, lpwEventId); TRACE("%p %08lx %p %p\n", hChange, dwProcessId, lppidls, lpwEventId);
...@@ -441,7 +447,7 @@ HANDLE WINAPI SHChangeNotification_Lock( ...@@ -441,7 +447,7 @@ HANDLE WINAPI SHChangeNotification_Lock(
{ {
idlist = SHAlloc( sizeof(LPCITEMIDLIST *) * node->cidl ); idlist = SHAlloc( sizeof(LPCITEMIDLIST *) * node->cidl );
for(i=0; i<node->cidl; i++) for(i=0; i<node->cidl; i++)
idlist[i] = node->pidlSignaled; idlist[i] = (LPITEMIDLIST)node->pidlSignaled;
*lpwEventId = node->wSignalledEvent; *lpwEventId = node->wSignalledEvent;
*lppidls = idlist; *lppidls = idlist;
node->wSignalledEvent = 0; node->wSignalledEvent = 0;
...@@ -466,9 +472,9 @@ BOOL WINAPI SHChangeNotification_Unlock ( HANDLE hLock) ...@@ -466,9 +472,9 @@ BOOL WINAPI SHChangeNotification_Unlock ( HANDLE hLock)
/************************************************************************* /*************************************************************************
* NTSHChangeNotifyDeregister [SHELL32.641] * NTSHChangeNotifyDeregister [SHELL32.641]
*/ */
DWORD WINAPI NTSHChangeNotifyDeregister(LONG x1) DWORD WINAPI NTSHChangeNotifyDeregister(ULONG x1)
{ {
FIXME("(0x%08lx):semi stub.\n",x1); FIXME("(0x%08lx):semi stub.\n",x1);
return SHChangeNotifyDeregister( (HANDLE)x1 ); return SHChangeNotifyDeregister( x1 );
} }
...@@ -629,11 +629,11 @@ LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1,LPCITEMIDLIST pidl2) ...@@ -629,11 +629,11 @@ LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1,LPCITEMIDLIST pidl2)
* *
* NOTES * 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; return 0;
} }
......
...@@ -89,7 +89,7 @@ typedef struct ...@@ -89,7 +89,7 @@ typedef struct
UINT cidl; UINT cidl;
LPITEMIDLIST *apidl; LPITEMIDLIST *apidl;
LISTVIEW_SORT_INFO ListViewSortInfo; LISTVIEW_SORT_INFO ListViewSortInfo;
HANDLE hNotify; /* change notification handle */ ULONG hNotify; /* change notification handle */
HANDLE hAccel; HANDLE hAccel;
} IShellViewImpl; } IShellViewImpl;
...@@ -630,7 +630,7 @@ static HRESULT ShellView_FillList(IShellViewImpl * This) ...@@ -630,7 +630,7 @@ static HRESULT ShellView_FillList(IShellViewImpl * This)
static LRESULT ShellView_OnCreate(IShellViewImpl * This) static LRESULT ShellView_OnCreate(IShellViewImpl * This)
{ {
IDropTarget* pdt; IDropTarget* pdt;
NOTIFYREGISTER ntreg; SHChangeNotifyEntry ntreg;
IPersistFolder2 * ppf2 = NULL; IPersistFolder2 * ppf2 = NULL;
TRACE("%p\n",This); TRACE("%p\n",This);
...@@ -656,10 +656,10 @@ static LRESULT ShellView_OnCreate(IShellViewImpl * This) ...@@ -656,10 +656,10 @@ static LRESULT ShellView_OnCreate(IShellViewImpl * This)
IShellFolder_QueryInterface(This->pSFParent, &IID_IPersistFolder2, (LPVOID*)&ppf2); IShellFolder_QueryInterface(This->pSFParent, &IID_IPersistFolder2, (LPVOID*)&ppf2);
if (ppf2) if (ppf2)
{ {
IPersistFolder2_GetCurFolder(ppf2, &ntreg.pidlPath); IPersistFolder2_GetCurFolder(ppf2, (LPITEMIDLIST*)&ntreg.pidl);
ntreg.bWatchSubtree = FALSE; ntreg.fRecursive = FALSE;
This->hNotify = SHChangeNotifyRegister(This->hWnd, SHCNF_IDLIST, SHCNE_ALLEVENTS, SHV_CHANGE_NOTIFY, 1, &ntreg); This->hNotify = SHChangeNotifyRegister(This->hWnd, SHCNF_IDLIST, SHCNE_ALLEVENTS, SHV_CHANGE_NOTIFY, 1, &ntreg);
SHFree(ntreg.pidlPath); SHFree((LPITEMIDLIST)ntreg.pidl);
IPersistFolder2_Release(ppf2); IPersistFolder2_Release(ppf2);
} }
......
...@@ -148,39 +148,6 @@ HRESULT WINAPI StrRetToStrNAW ( ...@@ -148,39 +148,6 @@ HRESULT WINAPI StrRetToStrNAW (
#define SHCNRF_RecursiveInterrupt 0x1000 /* Must be combined with SHCNRF_InterruptLevel */ #define SHCNRF_RecursiveInterrupt 0x1000 /* Must be combined with SHCNRF_InterruptLevel */
#define SHCNRF_NewDelivery 0x8000 /* Messages use shared memory */ #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 * Shell Common Dialogs
*/ */
......
...@@ -495,9 +495,15 @@ VOID WINAPI SHGetSettings(LPSHELLFLAGSTATE lpsfs, DWORD dwMask); ...@@ -495,9 +495,15 @@ VOID WINAPI SHGetSettings(LPSHELLFLAGSTATE lpsfs, DWORD dwMask);
#define SSF_NOCONFIRMRECYCLE 0x8000 #define SSF_NOCONFIRMRECYCLE 0x8000
#define SSF_HIDEICONS 0x4000 #define SSF_HIDEICONS 0x4000
/********************************************************************** /****************************************************************************
* SHChangeNotify * SHChangeNotify API
*/ */
typedef struct _SHChangeNotifyEntry
{
LPCITEMIDLIST pidl;
BOOL fRecursive;
} SHChangeNotifyEntry;
#define SHCNE_RENAMEITEM 0x00000001 #define SHCNE_RENAMEITEM 0x00000001
#define SHCNE_CREATE 0x00000002 #define SHCNE_CREATE 0x00000002
#define SHCNE_DELETE 0x00000004 #define SHCNE_DELETE 0x00000004
...@@ -525,7 +531,9 @@ VOID WINAPI SHGetSettings(LPSHELLFLAGSTATE lpsfs, DWORD dwMask); ...@@ -525,7 +531,9 @@ VOID WINAPI SHGetSettings(LPSHELLFLAGSTATE lpsfs, DWORD dwMask);
#define SHCNE_ALLEVENTS 0x7FFFFFFF #define SHCNE_ALLEVENTS 0x7FFFFFFF
#define SHCNE_INTERRUPT 0x80000000 #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_IDLIST 0x0000
#define SHCNF_PATHA 0x0001 #define SHCNF_PATHA 0x0001
...@@ -537,8 +545,55 @@ VOID WINAPI SHGetSettings(LPSHELLFLAGSTATE lpsfs, DWORD dwMask); ...@@ -537,8 +545,55 @@ VOID WINAPI SHGetSettings(LPSHELLFLAGSTATE lpsfs, DWORD dwMask);
#define SHCNF_FLUSH 0x1000 #define SHCNF_FLUSH 0x1000
#define SHCNF_FLUSHNOWAIT 0x2000 #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); 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 * SHCreateDirectory API
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment