2000-02-20 19:40:55 +01:00
|
|
|
/*
|
|
|
|
* shell change notification
|
|
|
|
*
|
2002-03-10 00:29:33 +01:00
|
|
|
* Copyright 2000 Juergen Schmied
|
2000-02-20 19:40:55 +01:00
|
|
|
*
|
2002-03-10 00:29:33 +01:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2000-02-20 19:40:55 +01:00
|
|
|
*/
|
|
|
|
|
2003-09-22 21:24:13 +02:00
|
|
|
#include <stdarg.h>
|
2000-02-20 19:40:55 +01:00
|
|
|
#include <string.h>
|
|
|
|
|
2003-09-22 21:24:13 +02:00
|
|
|
#define NONAMELESSUNION
|
|
|
|
#define NONAMELESSSTRUCT
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "windef.h"
|
2003-09-22 21:24:13 +02:00
|
|
|
#include "winbase.h"
|
2010-04-09 14:28:26 +02:00
|
|
|
#include "wine/list.h"
|
2003-09-22 21:24:13 +02:00
|
|
|
#include "wine/debug.h"
|
2000-02-20 19:40:55 +01:00
|
|
|
#include "shell32_main.h"
|
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(shell);
|
2000-02-20 19:40:55 +01:00
|
|
|
|
2003-08-13 01:50:54 +02:00
|
|
|
static CRITICAL_SECTION SHELL32_ChangenotifyCS;
|
|
|
|
static CRITICAL_SECTION_DEBUG critsect_debug =
|
|
|
|
{
|
|
|
|
0, 0, &SHELL32_ChangenotifyCS,
|
|
|
|
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
|
2005-09-09 12:19:44 +02:00
|
|
|
0, 0, { (DWORD_PTR)(__FILE__ ": SHELL32_ChangenotifyCS") }
|
2003-08-13 01:50:54 +02:00
|
|
|
};
|
|
|
|
static CRITICAL_SECTION SHELL32_ChangenotifyCS = { &critsect_debug, -1, 0, 0, 0, 0 };
|
2000-02-20 19:40:55 +01:00
|
|
|
|
2003-09-22 21:24:13 +02:00
|
|
|
typedef SHChangeNotifyEntry *LPNOTIFYREGISTER;
|
|
|
|
|
2000-02-26 19:44:08 +01:00
|
|
|
/* internal list of notification clients (internal) */
|
2000-02-20 19:40:55 +01:00
|
|
|
typedef struct _NOTIFICATIONLIST
|
|
|
|
{
|
2010-04-09 14:28:26 +02:00
|
|
|
struct list entry;
|
2000-02-20 19:40:55 +01:00
|
|
|
HWND hwnd; /* window to notify */
|
|
|
|
DWORD uMsg; /* message to send */
|
2001-11-06 22:01:32 +01:00
|
|
|
LPNOTIFYREGISTER apidl; /* array of entries to watch*/
|
2000-02-20 19:40:55 +01:00
|
|
|
UINT cidl; /* number of pidls in array */
|
|
|
|
LONG wEventMask; /* subscribed events */
|
2003-07-15 22:53:39 +02:00
|
|
|
LONG wSignalledEvent; /* event that occurred */
|
2000-02-20 19:40:55 +01:00
|
|
|
DWORD dwFlags; /* client flags */
|
2003-09-02 03:01:06 +02:00
|
|
|
LPCITEMIDLIST pidlSignaled; /*pidl of the path that caused the signal*/
|
2010-04-09 14:42:29 +02:00
|
|
|
ULONG id;
|
2000-02-20 19:40:55 +01:00
|
|
|
} NOTIFICATIONLIST, *LPNOTIFICATIONLIST;
|
|
|
|
|
2010-04-09 14:28:26 +02:00
|
|
|
static struct list notifications = LIST_INIT( notifications );
|
2010-04-09 14:42:29 +02:00
|
|
|
static LONG next_id;
|
2000-02-20 19:40:55 +01:00
|
|
|
|
2003-06-23 21:49:40 +02:00
|
|
|
#define SHCNE_NOITEMEVENTS ( \
|
|
|
|
SHCNE_ASSOCCHANGED )
|
2000-02-20 19:40:55 +01:00
|
|
|
|
2003-06-23 21:49:40 +02:00
|
|
|
#define SHCNE_ONEITEMEVENTS ( \
|
|
|
|
SHCNE_ATTRIBUTES | SHCNE_CREATE | SHCNE_DELETE | SHCNE_DRIVEADD | \
|
|
|
|
SHCNE_DRIVEADDGUI | SHCNE_DRIVEREMOVED | SHCNE_FREESPACE | \
|
|
|
|
SHCNE_MEDIAINSERTED | SHCNE_MEDIAREMOVED | SHCNE_MKDIR | \
|
|
|
|
SHCNE_NETSHARE | SHCNE_NETUNSHARE | SHCNE_RMDIR | \
|
|
|
|
SHCNE_SERVERDISCONNECT | SHCNE_UPDATEDIR | SHCNE_UPDATEIMAGE )
|
2000-02-20 19:40:55 +01:00
|
|
|
|
2003-06-23 21:49:40 +02:00
|
|
|
#define SHCNE_TWOITEMEVENTS ( \
|
|
|
|
SHCNE_RENAMEFOLDER | SHCNE_RENAMEITEM | SHCNE_UPDATEITEM )
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2003-06-23 21:49:40 +02:00
|
|
|
/* for dumping events */
|
|
|
|
static const char * DumpEvent( LONG event )
|
|
|
|
{
|
|
|
|
if( event == SHCNE_ALLEVENTS )
|
|
|
|
return "SHCNE_ALLEVENTS";
|
|
|
|
#define DUMPEV(x) ,( event & SHCNE_##x )? #x " " : ""
|
|
|
|
return wine_dbg_sprintf( "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"
|
|
|
|
DUMPEV(RENAMEITEM)
|
|
|
|
DUMPEV(CREATE)
|
|
|
|
DUMPEV(DELETE)
|
|
|
|
DUMPEV(MKDIR)
|
|
|
|
DUMPEV(RMDIR)
|
|
|
|
DUMPEV(MEDIAINSERTED)
|
|
|
|
DUMPEV(MEDIAREMOVED)
|
|
|
|
DUMPEV(DRIVEREMOVED)
|
|
|
|
DUMPEV(DRIVEADD)
|
|
|
|
DUMPEV(NETSHARE)
|
|
|
|
DUMPEV(NETUNSHARE)
|
|
|
|
DUMPEV(ATTRIBUTES)
|
|
|
|
DUMPEV(UPDATEDIR)
|
|
|
|
DUMPEV(UPDATEITEM)
|
|
|
|
DUMPEV(SERVERDISCONNECT)
|
|
|
|
DUMPEV(UPDATEIMAGE)
|
|
|
|
DUMPEV(DRIVEADDGUI)
|
|
|
|
DUMPEV(RENAMEFOLDER)
|
|
|
|
DUMPEV(FREESPACE)
|
|
|
|
DUMPEV(EXTENDED_EVENT)
|
|
|
|
DUMPEV(ASSOCCHANGED)
|
|
|
|
DUMPEV(INTERRUPT)
|
|
|
|
);
|
|
|
|
#undef DUMPEV
|
2000-02-20 19:40:55 +01:00
|
|
|
}
|
|
|
|
|
2007-09-11 00:09:58 +02:00
|
|
|
static const char * NodeName(const NOTIFICATIONLIST *item)
|
2000-02-20 19:40:55 +01:00
|
|
|
{
|
2003-06-23 21:49:40 +02:00
|
|
|
const char *str;
|
|
|
|
WCHAR path[MAX_PATH];
|
|
|
|
|
2003-09-22 21:24:13 +02:00
|
|
|
if(SHGetPathFromIDListW(item->apidl[0].pidl, path ))
|
2003-06-23 21:49:40 +02:00
|
|
|
str = wine_dbg_sprintf("%s", debugstr_w(path));
|
|
|
|
else
|
|
|
|
str = wine_dbg_sprintf("<not a disk file>" );
|
|
|
|
return str;
|
2000-02-20 19:40:55 +01:00
|
|
|
}
|
|
|
|
|
2003-06-23 21:49:40 +02:00
|
|
|
static void DeleteNode(LPNOTIFICATIONLIST item)
|
|
|
|
{
|
|
|
|
UINT i;
|
|
|
|
|
2010-04-09 14:28:26 +02:00
|
|
|
TRACE("item=%p\n", item);
|
2003-06-23 21:49:40 +02:00
|
|
|
|
|
|
|
/* remove item from list */
|
2010-04-09 14:28:26 +02:00
|
|
|
list_remove( &item->entry );
|
2003-06-23 21:49:40 +02:00
|
|
|
|
|
|
|
/* free the item */
|
|
|
|
for (i=0; i<item->cidl; i++)
|
2003-09-22 21:24:13 +02:00
|
|
|
SHFree((LPITEMIDLIST)item->apidl[i].pidl);
|
2003-06-23 21:49:40 +02:00
|
|
|
SHFree(item->apidl);
|
|
|
|
SHFree(item);
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2003-06-23 21:49:40 +02:00
|
|
|
void InitChangeNotifications(void)
|
|
|
|
{
|
|
|
|
}
|
2000-02-26 19:44:08 +01:00
|
|
|
|
2003-06-23 21:49:40 +02:00
|
|
|
void FreeChangeNotifications(void)
|
|
|
|
{
|
2010-04-09 14:28:26 +02:00
|
|
|
LPNOTIFICATIONLIST ptr, next;
|
|
|
|
|
2003-06-23 21:49:40 +02:00
|
|
|
TRACE("\n");
|
2000-02-20 19:40:55 +01:00
|
|
|
|
2003-06-23 21:49:40 +02:00
|
|
|
EnterCriticalSection(&SHELL32_ChangenotifyCS);
|
2002-06-28 19:34:35 +02:00
|
|
|
|
2010-04-09 14:28:26 +02:00
|
|
|
LIST_FOR_EACH_ENTRY_SAFE( ptr, next, ¬ifications, NOTIFICATIONLIST, entry )
|
|
|
|
DeleteNode( ptr );
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2003-06-23 21:49:40 +02:00
|
|
|
LeaveCriticalSection(&SHELL32_ChangenotifyCS);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2003-06-23 21:49:40 +02:00
|
|
|
DeleteCriticalSection(&SHELL32_ChangenotifyCS);
|
2000-02-20 19:40:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHChangeNotifyRegister [SHELL32.2]
|
|
|
|
*
|
|
|
|
*/
|
2003-09-22 21:24:13 +02:00
|
|
|
ULONG WINAPI
|
2000-02-20 19:40:55 +01:00
|
|
|
SHChangeNotifyRegister(
|
|
|
|
HWND hwnd,
|
2003-09-22 21:24:13 +02:00
|
|
|
int fSources,
|
2000-02-20 19:40:55 +01:00
|
|
|
LONG wEventMask,
|
2003-08-30 00:11:23 +02:00
|
|
|
UINT uMsg,
|
2000-02-20 19:40:55 +01:00
|
|
|
int cItems,
|
2003-09-22 21:24:13 +02:00
|
|
|
SHChangeNotifyEntry *lpItems)
|
2000-02-20 19:40:55 +01:00
|
|
|
{
|
2003-06-23 21:49:40 +02:00
|
|
|
LPNOTIFICATIONLIST item;
|
2003-08-30 00:11:23 +02:00
|
|
|
int i;
|
2003-06-23 21:49:40 +02:00
|
|
|
|
|
|
|
item = SHAlloc(sizeof(NOTIFICATIONLIST));
|
|
|
|
|
2006-10-07 20:18:14 +02:00
|
|
|
TRACE("(%p,0x%08x,0x%08x,0x%08x,%d,%p) item=%p\n",
|
2003-09-22 21:24:13 +02:00
|
|
|
hwnd, fSources, wEventMask, uMsg, cItems, lpItems, item);
|
2003-06-23 21:49:40 +02:00
|
|
|
|
|
|
|
item->cidl = cItems;
|
2003-09-22 21:24:13 +02:00
|
|
|
item->apidl = SHAlloc(sizeof(SHChangeNotifyEntry) * cItems);
|
2003-06-23 21:49:40 +02:00
|
|
|
for(i=0;i<cItems;i++)
|
|
|
|
{
|
2003-09-22 21:24:13 +02:00
|
|
|
item->apidl[i].pidl = ILClone(lpItems[i].pidl);
|
|
|
|
item->apidl[i].fRecursive = lpItems[i].fRecursive;
|
2003-06-23 21:49:40 +02:00
|
|
|
}
|
|
|
|
item->hwnd = hwnd;
|
|
|
|
item->uMsg = uMsg;
|
|
|
|
item->wEventMask = wEventMask;
|
|
|
|
item->wSignalledEvent = 0;
|
2003-09-22 21:24:13 +02:00
|
|
|
item->dwFlags = fSources;
|
2010-04-09 14:42:29 +02:00
|
|
|
item->id = InterlockedIncrement( &next_id );
|
2003-06-23 21:49:40 +02:00
|
|
|
|
|
|
|
TRACE("new node: %s\n", NodeName( item ));
|
|
|
|
|
|
|
|
EnterCriticalSection(&SHELL32_ChangenotifyCS);
|
|
|
|
|
2010-04-09 14:28:26 +02:00
|
|
|
list_add_tail( ¬ifications, &item->entry );
|
2003-06-23 21:49:40 +02:00
|
|
|
|
|
|
|
LeaveCriticalSection(&SHELL32_ChangenotifyCS);
|
|
|
|
|
2010-04-09 14:42:29 +02:00
|
|
|
return item->id;
|
2000-02-20 19:40:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHChangeNotifyDeregister [SHELL32.4]
|
|
|
|
*/
|
2003-09-22 21:24:13 +02:00
|
|
|
BOOL WINAPI SHChangeNotifyDeregister(ULONG hNotify)
|
2000-02-20 19:40:55 +01:00
|
|
|
{
|
2003-06-23 21:49:40 +02:00
|
|
|
LPNOTIFICATIONLIST node;
|
|
|
|
|
2006-10-07 20:18:14 +02:00
|
|
|
TRACE("(0x%08x)\n", hNotify);
|
2003-06-23 21:49:40 +02:00
|
|
|
|
|
|
|
EnterCriticalSection(&SHELL32_ChangenotifyCS);
|
|
|
|
|
2010-04-09 14:42:29 +02:00
|
|
|
LIST_FOR_EACH_ENTRY( node, ¬ifications, NOTIFICATIONLIST, entry )
|
|
|
|
{
|
|
|
|
if (node->id == hNotify)
|
|
|
|
{
|
|
|
|
DeleteNode( node );
|
|
|
|
LeaveCriticalSection(&SHELL32_ChangenotifyCS);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
2003-06-23 21:49:40 +02:00
|
|
|
LeaveCriticalSection(&SHELL32_ChangenotifyCS);
|
2010-04-09 14:42:29 +02:00
|
|
|
return FALSE;
|
2000-02-20 19:40:55 +01:00
|
|
|
}
|
|
|
|
|
2001-10-02 19:25:36 +02:00
|
|
|
/*************************************************************************
|
|
|
|
* SHChangeNotifyUpdateEntryList [SHELL32.5]
|
|
|
|
*/
|
2003-06-23 21:49:40 +02:00
|
|
|
BOOL WINAPI SHChangeNotifyUpdateEntryList(DWORD unknown1, DWORD unknown2,
|
2001-10-02 19:25:36 +02:00
|
|
|
DWORD unknown3, DWORD unknown4)
|
|
|
|
{
|
2006-10-07 20:18:14 +02:00
|
|
|
FIXME("(0x%08x, 0x%08x, 0x%08x, 0x%08x)\n",
|
2003-06-23 21:49:40 +02:00
|
|
|
unknown1, unknown2, unknown3, unknown4);
|
2001-10-02 19:25:36 +02:00
|
|
|
|
2003-06-23 21:49:40 +02:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2004-11-30 22:38:57 +01:00
|
|
|
static BOOL should_notify( LPCITEMIDLIST changed, LPCITEMIDLIST watched, BOOL sub )
|
2003-06-23 21:49:40 +02:00
|
|
|
{
|
|
|
|
TRACE("%p %p %d\n", changed, watched, sub );
|
|
|
|
if ( !watched )
|
|
|
|
return FALSE;
|
|
|
|
if (ILIsEqual( watched, changed ) )
|
|
|
|
return TRUE;
|
2010-11-12 22:32:55 +01:00
|
|
|
if( sub && ILIsParent( watched, changed, FALSE ) )
|
2003-06-23 21:49:40 +02:00
|
|
|
return TRUE;
|
|
|
|
return FALSE;
|
2001-10-02 19:25:36 +02:00
|
|
|
}
|
|
|
|
|
2000-02-20 19:40:55 +01:00
|
|
|
/*************************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* SHChangeNotify [SHELL32.@]
|
2000-02-20 19:40:55 +01:00
|
|
|
*/
|
2003-01-21 20:36:24 +01:00
|
|
|
void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2)
|
2000-02-20 19:40:55 +01:00
|
|
|
{
|
2011-09-21 09:52:28 +02:00
|
|
|
struct notification_recipients {
|
|
|
|
struct list entry;
|
|
|
|
HWND hwnd;
|
|
|
|
DWORD msg;
|
|
|
|
DWORD flags;
|
|
|
|
} *cur, *next;
|
|
|
|
|
|
|
|
LPITEMIDLIST Pidls[2];
|
2003-06-23 21:49:40 +02:00
|
|
|
LPNOTIFICATIONLIST ptr;
|
2011-09-21 09:52:28 +02:00
|
|
|
struct list recipients;
|
2003-06-23 21:49:40 +02:00
|
|
|
|
|
|
|
Pidls[0] = NULL;
|
|
|
|
Pidls[1] = NULL;
|
|
|
|
|
2011-09-21 09:52:28 +02:00
|
|
|
TRACE("(0x%08x,0x%08x,%p,%p)\n", wEventId, uFlags, dwItem1, dwItem2);
|
|
|
|
|
|
|
|
if(uFlags & ~(SHCNF_TYPE|SHCNF_FLUSH))
|
|
|
|
FIXME("ignoring unsupported flags: %x\n", uFlags);
|
2003-06-23 21:49:40 +02:00
|
|
|
|
|
|
|
if( ( wEventId & SHCNE_NOITEMEVENTS ) && ( dwItem1 || dwItem2 ) )
|
|
|
|
{
|
|
|
|
TRACE("dwItem1 and dwItem2 are not zero, but should be\n");
|
|
|
|
dwItem1 = 0;
|
|
|
|
dwItem2 = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if( ( wEventId & SHCNE_ONEITEMEVENTS ) && dwItem2 )
|
|
|
|
{
|
|
|
|
TRACE("dwItem2 is not zero, but should be\n");
|
|
|
|
dwItem2 = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( ( ( wEventId & SHCNE_NOITEMEVENTS ) &&
|
|
|
|
( wEventId & ~SHCNE_NOITEMEVENTS ) ) ||
|
|
|
|
( ( wEventId & SHCNE_ONEITEMEVENTS ) &&
|
|
|
|
( wEventId & ~SHCNE_ONEITEMEVENTS ) ) ||
|
|
|
|
( ( wEventId & SHCNE_TWOITEMEVENTS ) &&
|
|
|
|
( wEventId & ~SHCNE_TWOITEMEVENTS ) ) )
|
|
|
|
{
|
|
|
|
WARN("mutually incompatible events listed\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* convert paths in IDLists*/
|
2011-09-21 09:52:28 +02:00
|
|
|
switch (uFlags & SHCNF_TYPE)
|
2003-06-23 21:49:40 +02:00
|
|
|
{
|
|
|
|
case SHCNF_PATHA:
|
2009-02-18 22:46:39 +01:00
|
|
|
if (dwItem1) Pidls[0] = SHSimpleIDListFromPathA(dwItem1);
|
|
|
|
if (dwItem2) Pidls[1] = SHSimpleIDListFromPathA(dwItem2);
|
2003-06-23 21:49:40 +02:00
|
|
|
break;
|
|
|
|
case SHCNF_PATHW:
|
2009-02-18 22:46:39 +01:00
|
|
|
if (dwItem1) Pidls[0] = SHSimpleIDListFromPathW(dwItem1);
|
|
|
|
if (dwItem2) Pidls[1] = SHSimpleIDListFromPathW(dwItem2);
|
2003-06-23 21:49:40 +02:00
|
|
|
break;
|
|
|
|
case SHCNF_IDLIST:
|
2011-09-21 09:52:28 +02:00
|
|
|
Pidls[0] = ILClone(dwItem1);
|
|
|
|
Pidls[1] = ILClone(dwItem2);
|
2003-06-23 21:49:40 +02:00
|
|
|
break;
|
|
|
|
case SHCNF_PRINTERA:
|
|
|
|
case SHCNF_PRINTERW:
|
2004-01-27 01:01:43 +01:00
|
|
|
FIXME("SHChangeNotify with (uFlags & SHCNF_PRINTER)\n");
|
2003-06-23 21:49:40 +02:00
|
|
|
return;
|
|
|
|
case SHCNF_DWORD:
|
|
|
|
default:
|
2011-09-21 09:52:28 +02:00
|
|
|
FIXME("unknown type %08x\n", uFlags & SHCNF_TYPE);
|
2003-06-23 21:49:40 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-09-21 09:52:28 +02:00
|
|
|
list_init(&recipients);
|
2003-06-23 21:49:40 +02:00
|
|
|
EnterCriticalSection(&SHELL32_ChangenotifyCS);
|
2010-04-09 14:28:26 +02:00
|
|
|
LIST_FOR_EACH_ENTRY( ptr, ¬ifications, NOTIFICATIONLIST, entry )
|
2003-06-23 21:49:40 +02:00
|
|
|
{
|
2011-09-21 09:52:28 +02:00
|
|
|
struct notification_recipients *item;
|
|
|
|
BOOL notify = FALSE;
|
2003-06-23 21:49:40 +02:00
|
|
|
DWORD i;
|
|
|
|
|
|
|
|
for( i=0; (i<ptr->cidl) && !notify ; i++ )
|
|
|
|
{
|
2003-09-22 21:24:13 +02:00
|
|
|
LPCITEMIDLIST pidl = ptr->apidl[i].pidl;
|
|
|
|
BOOL subtree = ptr->apidl[i].fRecursive;
|
2003-06-23 21:49:40 +02:00
|
|
|
|
|
|
|
if (wEventId & ptr->wEventMask)
|
|
|
|
{
|
|
|
|
if( !pidl ) /* all ? */
|
|
|
|
notify = TRUE;
|
|
|
|
else if( wEventId & SHCNE_NOITEMEVENTS )
|
|
|
|
notify = TRUE;
|
|
|
|
else if( wEventId & ( SHCNE_ONEITEMEVENTS | SHCNE_TWOITEMEVENTS ) )
|
|
|
|
notify = should_notify( Pidls[0], pidl, subtree );
|
|
|
|
else if( wEventId & SHCNE_TWOITEMEVENTS )
|
|
|
|
notify = should_notify( Pidls[1], pidl, subtree );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !notify )
|
|
|
|
continue;
|
|
|
|
|
2011-09-21 09:52:28 +02:00
|
|
|
item = SHAlloc(sizeof(struct notification_recipients));
|
|
|
|
if(!item) {
|
|
|
|
ERR("out of memory\n");
|
|
|
|
continue;
|
|
|
|
}
|
2003-06-23 21:49:40 +02:00
|
|
|
|
2011-09-21 09:52:28 +02:00
|
|
|
item->hwnd = ptr->hwnd;
|
|
|
|
item->msg = ptr->uMsg;
|
|
|
|
item->flags = ptr->dwFlags;
|
|
|
|
list_add_tail(&recipients, &item->entry);
|
|
|
|
}
|
|
|
|
LeaveCriticalSection(&SHELL32_ChangenotifyCS);
|
|
|
|
|
|
|
|
LIST_FOR_EACH_ENTRY_SAFE(cur, next, &recipients, struct notification_recipients, entry)
|
|
|
|
{
|
|
|
|
TRACE("notifying %p, event %s(%x)\n", cur->hwnd, DumpEvent(wEventId), wEventId);
|
2003-06-23 21:49:40 +02:00
|
|
|
|
|
|
|
ptr->wSignalledEvent |= wEventId;
|
2004-02-03 00:08:54 +01:00
|
|
|
|
2011-09-21 09:52:28 +02:00
|
|
|
if (cur->flags & SHCNRF_NewDelivery)
|
|
|
|
FIXME("SHCNRF_NewDelivery flag is not supported\n");
|
2004-06-02 23:33:47 +02:00
|
|
|
else
|
2011-09-21 09:52:28 +02:00
|
|
|
SendMessageA(cur->hwnd, cur->msg, (WPARAM)Pidls, wEventId);
|
2003-06-23 21:49:40 +02:00
|
|
|
|
2011-09-21 09:52:28 +02:00
|
|
|
list_remove(&cur->entry);
|
|
|
|
SHFree(cur);
|
2003-06-23 21:49:40 +02:00
|
|
|
}
|
2011-09-21 09:52:28 +02:00
|
|
|
SHFree(Pidls[0]);
|
|
|
|
SHFree(Pidls[1]);
|
2009-06-11 20:52:03 +02:00
|
|
|
|
|
|
|
if (wEventId & SHCNE_ASSOCCHANGED)
|
|
|
|
{
|
2009-10-27 11:21:34 +01:00
|
|
|
static const WCHAR args[] = {' ','-','a',0 };
|
2009-06-11 20:52:03 +02:00
|
|
|
TRACE("refreshing file type associations\n");
|
2009-10-27 11:21:34 +01:00
|
|
|
run_winemenubuilder( args );
|
2009-06-11 20:52:03 +02:00
|
|
|
}
|
2000-02-20 19:40:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* NTSHChangeNotifyRegister [SHELL32.640]
|
|
|
|
* NOTES
|
|
|
|
* Idlist is an array of structures and Count specifies how many items in the array
|
|
|
|
* (usually just one I think).
|
|
|
|
*/
|
|
|
|
DWORD WINAPI NTSHChangeNotifyRegister(
|
|
|
|
HWND hwnd,
|
|
|
|
LONG events1,
|
|
|
|
LONG events2,
|
|
|
|
DWORD msg,
|
|
|
|
int count,
|
2003-09-22 21:24:13 +02:00
|
|
|
SHChangeNotifyEntry *idlist)
|
2000-02-20 19:40:55 +01:00
|
|
|
{
|
2006-10-07 20:18:14 +02:00
|
|
|
FIXME("(%p,0x%08x,0x%08x,0x%08x,0x%08x,%p):semi stub.\n",
|
2000-02-20 19:40:55 +01:00
|
|
|
hwnd,events1,events2,msg,count,idlist);
|
2003-06-23 21:49:40 +02:00
|
|
|
|
2008-01-19 17:54:24 +01:00
|
|
|
return SHChangeNotifyRegister(hwnd, events1, events2, msg, count, idlist);
|
2000-02-20 19:40:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHChangeNotification_Lock [SHELL32.644]
|
|
|
|
*/
|
|
|
|
HANDLE WINAPI SHChangeNotification_Lock(
|
2003-06-23 21:49:40 +02:00
|
|
|
HANDLE hChange,
|
2000-02-20 19:40:55 +01:00
|
|
|
DWORD dwProcessId,
|
2003-09-22 21:24:13 +02:00
|
|
|
LPITEMIDLIST **lppidls,
|
2000-02-20 19:40:55 +01:00
|
|
|
LPLONG lpwEventId)
|
|
|
|
{
|
2003-06-23 21:49:40 +02:00
|
|
|
DWORD i;
|
|
|
|
LPNOTIFICATIONLIST node;
|
2004-11-30 22:38:57 +01:00
|
|
|
LPCITEMIDLIST *idlist;
|
2003-06-23 21:49:40 +02:00
|
|
|
|
2006-10-07 20:18:14 +02:00
|
|
|
TRACE("%p %08x %p %p\n", hChange, dwProcessId, lppidls, lpwEventId);
|
2003-06-23 21:49:40 +02:00
|
|
|
|
|
|
|
/* EnterCriticalSection(&SHELL32_ChangenotifyCS); */
|
|
|
|
|
2010-04-09 14:42:29 +02:00
|
|
|
LIST_FOR_EACH_ENTRY( node, ¬ifications, NOTIFICATIONLIST, entry )
|
2003-06-23 21:49:40 +02:00
|
|
|
{
|
2010-04-09 14:42:29 +02:00
|
|
|
if (node == hChange)
|
|
|
|
{
|
|
|
|
idlist = SHAlloc( sizeof(LPCITEMIDLIST *) * node->cidl );
|
|
|
|
for(i=0; i<node->cidl; i++)
|
|
|
|
idlist[i] = node->pidlSignaled;
|
|
|
|
*lpwEventId = node->wSignalledEvent;
|
|
|
|
*lppidls = (LPITEMIDLIST*)idlist;
|
|
|
|
node->wSignalledEvent = 0;
|
|
|
|
/* LeaveCriticalSection(&SHELL32_ChangenotifyCS); */
|
|
|
|
return node;
|
|
|
|
}
|
2003-06-23 21:49:40 +02:00
|
|
|
}
|
2010-04-09 14:42:29 +02:00
|
|
|
ERR("Couldn't find %p\n", hChange );
|
2003-06-23 21:49:40 +02:00
|
|
|
|
|
|
|
/* LeaveCriticalSection(&SHELL32_ChangenotifyCS); */
|
|
|
|
|
2010-04-09 14:42:29 +02:00
|
|
|
return 0;
|
2000-02-20 19:40:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHChangeNotification_Unlock [SHELL32.645]
|
|
|
|
*/
|
2003-06-23 21:49:40 +02:00
|
|
|
BOOL WINAPI SHChangeNotification_Unlock ( HANDLE hLock)
|
2000-02-20 19:40:55 +01:00
|
|
|
{
|
2003-06-23 21:49:40 +02:00
|
|
|
TRACE("\n");
|
|
|
|
return 1;
|
2000-02-20 19:40:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* NTSHChangeNotifyDeregister [SHELL32.641]
|
|
|
|
*/
|
2003-09-22 21:24:13 +02:00
|
|
|
DWORD WINAPI NTSHChangeNotifyDeregister(ULONG x1)
|
2000-02-20 19:40:55 +01:00
|
|
|
{
|
2006-10-07 20:18:14 +02:00
|
|
|
FIXME("(0x%08x):semi stub.\n",x1);
|
2003-06-23 21:49:40 +02:00
|
|
|
|
2003-09-22 21:24:13 +02:00
|
|
|
return SHChangeNotifyDeregister( x1 );
|
2000-02-20 19:40:55 +01:00
|
|
|
}
|