Started implementation of shell notifications.
authorJuergen Schmied <juergen.schmied@debitel.net>
Sun, 20 Feb 2000 18:40:55 +0000 (18:40 +0000)
committerAlexandre Julliard <julliard@winehq.org>
Sun, 20 Feb 2000 18:40:55 +0000 (18:40 +0000)
dlls/shell32/changenotify.c [new file with mode: 0644]
dlls/shell32/shell32.spec
dlls/shell32/shellord.c
include/shell.h
include/shellapi.h
include/shlobj.h

diff --git a/dlls/shell32/changenotify.c b/dlls/shell32/changenotify.c
new file mode 100644 (file)
index 0000000..7ae4ece
--- /dev/null
@@ -0,0 +1,252 @@
+/*
+ *     shell change notification
+ *
+ *     Juergen Schmied <juergen.schmied@debitel.de>
+ *
+ */
+
+#include <string.h>
+
+#include "debugtools.h"
+#include "pidl.h"
+#include "shell32_main.h"
+#include "winversion.h"
+#include "wine/undocshell.h"
+
+DEFAULT_DEBUG_CHANNEL(shell)
+
+typedef struct
+{
+       LPCITEMIDLIST pidlPath;
+       BOOL bWatchSubtree;
+} NOTIFYREGISTER, *LPNOTIFYREGISTER;
+
+typedef const LPNOTIFYREGISTER LPCNOTIFYREGISTER;
+
+typedef struct
+{
+       USHORT  cb;
+       DWORD   dwItem1;
+       DWORD   dwItem2;
+} DWORDITEMID;
+
+
+#define SHCNF_ACCEPT_INTERRUPTS                0x0001
+#define SHCNF_ACCEPT_NON_INTERRUPTS    0x0002
+#define SHCNF_NO_PROXY                 0x8001
+
+/* internal list of notification clients */
+typedef struct _NOTIFICATIONLIST
+{
+       struct _NOTIFICATIONLIST *next;
+       struct _NOTIFICATIONLIST *prev; 
+       HWND hwnd;              /* window to notify */
+       DWORD uMsg;             /* message to send */
+       LPNOTIFYREGISTER * apidl; /* array of entrys to watch*/
+       UINT cidl;              /* number of pidls in array */
+       LONG wEventMask;        /* subscribed events */
+       DWORD dwFlags;          /* client flags */
+} NOTIFICATIONLIST, *LPNOTIFICATIONLIST;
+
+NOTIFICATIONLIST head;
+NOTIFICATIONLIST tail;
+
+void InitChangeNotifications()
+{
+       ZeroMemory(&head, sizeof(NOTIFICATIONLIST));
+       ZeroMemory(&tail, sizeof(NOTIFICATIONLIST));
+       head.next = &tail;
+       tail.prev = &head;
+}
+
+void FreeChangeNotifications()
+{
+       LPNOTIFICATIONLIST ptr, item;
+
+       ptr = head.next;
+
+       while(ptr != &tail)
+       { 
+         int i;
+         item = ptr;
+         ptr = ptr->next;
+
+         /* free the item */
+         for (i=0; i<item->cidl;i++) SHFree(item->apidl[i]);
+         SHFree(item->apidl);
+         SHFree(item);
+       }
+       head.next = NULL;
+       tail.prev = NULL;
+}
+
+static BOOL AddNode(LPNOTIFICATIONLIST item)
+{
+       LPNOTIFICATIONLIST last;
+       
+       /* lock list */
+
+       /* get last entry */
+       last = tail.prev;
+
+       /* link items */
+       last->next = item;
+       item->prev = last;
+       item->next = &tail;
+       tail.prev = item;
+       return TRUE;
+
+       /* unlock list */
+}
+
+static BOOL DeleteNode(LPNOTIFICATIONLIST item)
+{
+       LPNOTIFICATIONLIST ptr;
+       int ret = FALSE;
+
+       /* lock list */
+
+       ptr = head.next;
+       while(ptr != &tail)
+       { 
+         if (ptr == item)
+         {
+           int i;
+           
+           /* remove item from list */
+           item->prev->next = item->next;
+           item->next->prev = item->prev;
+
+           /* free the item */
+           for (i=0; i<item->cidl;i++) SHFree(item->apidl[i]);
+           SHFree(item->apidl);
+           SHFree(item);
+           ret = TRUE;
+         }
+       }
+       
+       /* unlock list */
+       return ret;
+       
+}
+
+/*************************************************************************
+ * SHChangeNotifyRegister                      [SHELL32.2]
+ *
+ */
+HANDLE WINAPI
+SHChangeNotifyRegister(
+    HWND hwnd,
+    LONG dwFlags,
+    LONG wEventMask,
+    DWORD uMsg,
+    int cItems,
+    LPCNOTIFYREGISTER *lpItems)
+{
+       LPNOTIFICATIONLIST item;
+       int i;
+
+       TRACE("(0x%04x,0x%08lx,0x%08lx,0x%08lx,0x%08x,%p)\n",
+               hwnd,wEventMask,wEventMask,uMsg,cItems,lpItems);
+       
+       item = SHAlloc(sizeof(NOTIFICATIONLIST));
+       item->next = NULL;
+       item->prev = NULL;
+       item->cidl = cItems;
+       item->apidl = SHAlloc(sizeof(NOTIFYREGISTER) * cItems);
+       for(i=0;i<cItems;i++)
+       {
+         item->apidl[i]->pidlPath = ILClone(lpItems[i]->pidlPath);
+         item->apidl[i]->bWatchSubtree = lpItems[i]->bWatchSubtree;
+       }
+       item->hwnd = hwnd;
+       item->uMsg = uMsg;
+       item->wEventMask = wEventMask;
+       item->dwFlags = dwFlags;
+       AddNode(item);
+       return (HANDLE)item;
+}
+
+/*************************************************************************
+ * SHChangeNotifyDeregister                    [SHELL32.4]
+ */
+BOOL WINAPI
+SHChangeNotifyDeregister(
+       HANDLE hNotify)
+{
+       TRACE("(0x%08x)\n",hNotify);
+
+       return DeleteNode((LPNOTIFICATIONLIST)hNotify);;
+}
+
+/*************************************************************************
+ * SHChangeNotify                              [SHELL32.239]
+ */
+void WINAPI SHChangeNotifyW (LONG wEventId, UINT  uFlags, LPCVOID dwItem1, LPCVOID dwItem2)
+{
+       FIXME("(0x%08lx,0x%08x,%p,%p):stub.\n", wEventId,uFlags,dwItem1,dwItem2);
+}
+
+void WINAPI SHChangeNotifyA (LONG wEventId, UINT  uFlags, LPCVOID dwItem1, LPCVOID dwItem2)
+{
+       FIXME("(0x%08lx,0x%08x,%p,%p):stub.\n", wEventId,uFlags,dwItem1,dwItem2);
+}
+
+void WINAPI SHChangeNotifyAW (LONG wEventId, UINT  uFlags, LPCVOID dwItem1, LPCVOID dwItem2)
+{
+       if(VERSION_OsIsUnicode())
+         return SHChangeNotifyW (wEventId, uFlags, dwItem1, dwItem2);
+       return SHChangeNotifyA (wEventId, uFlags, dwItem1, dwItem2);
+}
+
+/*************************************************************************
+ * 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,
+    LPNOTIFYREGISTER idlist)
+{
+       FIXME("(0x%04x,0x%08lx,0x%08lx,0x%08lx,0x%08x,%p):stub.\n",
+               hwnd,events1,events2,msg,count,idlist);
+       return 0;
+}
+
+/*************************************************************************
+ * SHChangeNotification_Lock                   [SHELL32.644]
+ */
+HANDLE WINAPI SHChangeNotification_Lock(
+       HANDLE hMemoryMap,
+       DWORD dwProcessId,
+       LPCITEMIDLIST **lppidls,
+       LPLONG lpwEventId)
+{
+       FIXME("\n");
+       return 0;
+}
+
+/*************************************************************************
+ * SHChangeNotification_Unlock                 [SHELL32.645]
+ */
+BOOL WINAPI SHChangeNotification_Unlock (
+       HANDLE hLock)
+{
+       FIXME("\n");
+       return 0;
+}
+
+/*************************************************************************
+ * NTSHChangeNotifyDeregister                  [SHELL32.641]
+ */
+DWORD WINAPI NTSHChangeNotifyDeregister(LONG x1)
+{
+       FIXME("(0x%08lx):stub.\n",x1);
+       return 0;
+}
+
index 2462622..b677f72 100644 (file)
@@ -245,7 +245,7 @@ rsrc        shell32
  236 stdcall SHBrowseForFolder(ptr) SHBrowseForFolderA   # exported by name
  237 stdcall SHBrowseForFolderA(ptr) SHBrowseForFolderA   # exported by name
  238 stub SHBrowseForFolderW@4   # exported by name
- 239 stdcall SHChangeNotify (long long ptr ptr) SHChangeNotify  # exported by name
+ 239 stdcall SHChangeNotify (long long ptr ptr) SHChangeNotifyAW  # exported by name
  240 stub SHEmptyRecycleBinA@12   # exported by name
  241 stub SHEmptyRecycleBinW@12   # exported by name
  242 stdcall SHFileOperation (ptr) SHFileOperationAW   # exported by name
index b8f5fff..dbf60e8 100644 (file)
 
 DEFAULT_DEBUG_CHANNEL(shell);
 
-/*************************************************************************
- * SHChangeNotifyRegister                      [SHELL32.2]
- *
- * NOTES
- *   Idlist is an array of structures and Count specifies how many items in the array
- *   (usually just one I think).
- */
-DWORD WINAPI
-SHChangeNotifyRegister(
-    HWND hwnd,
-    LONG events1,
-    LONG events2,
-    DWORD msg,
-    int count,
-    IDSTRUCT *idlist)
-{      FIXME("(0x%04x,0x%08lx,0x%08lx,0x%08lx,0x%08x,%p):stub.\n",
-               hwnd,events1,events2,msg,count,idlist);
-       return 0;
-}
-/*************************************************************************
- * SHChangeNotifyDeregister                    [SHELL32.4]
- */
-DWORD WINAPI
-SHChangeNotifyDeregister(LONG x1)
-{      FIXME("(0x%08lx):stub.\n",x1);
-       return 0;
-}
-/*************************************************************************
- * 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,
-    IDSTRUCT *idlist)
-{      FIXME("(0x%04x,0x%08lx,0x%08lx,0x%08lx,0x%08x,%p):stub.\n",
-               hwnd,events1,events2,msg,count,idlist);
-       return 0;
-}
-/*************************************************************************
- * NTSHChangeNotifyDeregister                  [SHELL32.641]
- */
-DWORD WINAPI NTSHChangeNotifyDeregister(LONG x1)
-{      FIXME("(0x%08lx):stub.\n",x1);
-       return 0;
-}
-
 /*************************************************************************
  * ParseField                                  [SHELL32.58]
  *
@@ -470,7 +418,7 @@ DWORD WINAPI SHCreateDirectory(LPSECURITY_ATTRIBUTES sec,LPCSTR path) {
  *     free_ptr() - frees memory using IMalloc
  *     exported by ordinal
  */
-#define MEM_DEBUG 0
+#define MEM_DEBUG 1
 DWORD WINAPI SHFree(LPVOID x) 
 {
 #if MEM_DEBUG
@@ -630,51 +578,6 @@ DWORD WINAPI SHAddToRecentDocs (UINT uFlags,LPCVOID pv)
        }
   return 0;
 }
-/*************************************************************************
- * SHFileOperation                             [SHELL32.242]
- *
- */
-DWORD WINAPI SHFileOperationAW(DWORD x)
-{      FIXME("0x%08lx stub\n",x);
-       return 0;
-
-}
-
-/*************************************************************************
- * SHFileOperationA                            [SHELL32.243]
- *
- * NOTES
- *     exported by name
- */
-DWORD WINAPI SHFileOperationA (LPSHFILEOPSTRUCTA lpFileOp)   
-{ FIXME("(%p):stub.\n", lpFileOp);
-  return 1;
-}
-/*************************************************************************
- * SHFileOperationW                            [SHELL32.244]
- *
- * NOTES
- *     exported by name
- */
-DWORD WINAPI SHFileOperationW (LPSHFILEOPSTRUCTW lpFileOp)   
-{ FIXME("(%p):stub.\n", lpFileOp);
-  return 1;
-}
-
-/*************************************************************************
- * SHChangeNotify                              [SHELL32.239]
- *
- * NOTES
- *     exported by name
- */
-DWORD WINAPI SHChangeNotify (
-    INT   wEventId,  /* [IN] flags that specifies the event*/
-    UINT  uFlags,   /* [IN] the meaning of dwItem[1|2]*/
-               LPCVOID dwItem1,
-               LPCVOID dwItem2)
-{ FIXME("(0x%08x,0x%08ux,%p,%p):stub.\n", wEventId,uFlags,dwItem1,dwItem2);
-  return 0;
-}
 /*************************************************************************
  * SHCreateShellFolderViewEx                   [SHELL32.174]
  *
index b46558d..feb8d48 100644 (file)
@@ -77,19 +77,6 @@ BOOL WINAPI SHGetPathFromIDListA (LPCITEMIDLIST pidl,LPSTR pszPath);
 BOOL WINAPI SHGetPathFromIDListW (LPCITEMIDLIST pidl,LPWSTR pszPath);
 #define  SHGetPathFromIDList WINELIB_NAME_AW(SHGetPathFromIDList)
 
-
-
-/****************************************************************************
-* SHChangeNotifyRegister API
-*/
-typedef struct
-{ LPITEMIDLIST pidl;
-  DWORD unknown;
-} IDSTRUCT;
-
-DWORD WINAPI SHChangeNotifyRegister(HWND hwnd,LONG events1,LONG events2,DWORD msg,int count,IDSTRUCT *idlist);
-DWORD WINAPI SHChangeNotifyDeregister(LONG x1);
-
 /****************************************************************************
 * SHAddToRecentDocs API
 */
index 1633d72..c9472ef 100644 (file)
@@ -197,8 +197,6 @@ DWORD       WINAPI SHFileOperationA (LPSHFILEOPSTRUCTA lpFileOp);
 DWORD  WINAPI SHFileOperationW (LPSHFILEOPSTRUCTW lpFileOp);
 #define  SHFileOperation WINELIB_NAME_AW(SHFileOperation)
 
-DWORD WINAPI SHFileOperationAW(DWORD x);
-
 /******************************************
  * ShellExecute
  */
index 00f0d0a..f245399 100644 (file)
@@ -200,7 +200,7 @@ typedef struct tagBROWSEINFOA {
     UINT        ulFlags;
     BFFCALLBACK   lpfn;
     LPARAM        lParam;
-       INT         iImage;
+    INT         iImage;
 } BROWSEINFOA, *PBROWSEINFOA, *LPBROWSEINFOA;
 
 typedef struct tagBROWSEINFOW {
@@ -211,7 +211,7 @@ typedef struct tagBROWSEINFOW {
     UINT        ulFlags;
     BFFCALLBACK   lpfn;
     LPARAM        lParam;
-       INT         iImage;
+    INT         iImage;
 } BROWSEINFOW, *PBROWSEINFOW, *LPBROWSEINFOW; 
 
 #define BROWSEINFO   WINELIB_NAME_AW(BROWSEINFO)
@@ -260,7 +260,7 @@ typedef struct tagBROWSEINFOW {
 */
 
 LPITEMIDLIST WINAPI SHBrowseForFolderA(LPBROWSEINFOA lpbi);
-/*LPITEMIDLIST WINAPI SHBrowseForFolder32W(LPBROWSEINFO32W lpbi);*/
+LPITEMIDLIST WINAPI SHBrowseForFolder32W(LPBROWSEINFOW lpbi);
 #define  SHBrowseForFolder WINELIB_NAME_AW(SHBrowseForFolder)
 
 /****************************************************************************
@@ -403,7 +403,53 @@ void WINAPI SHGetSettings(LPSHELLFLAGSTATE lpsfs, DWORD dwMask, DWORD dwx);
 #define SSF_NOCONFIRMRECYCLE           0x8000
 #define SSF_HIDEICONS                  0x4000
 
-/**********************************************************************/
+/**********************************************************************
+ * SHChangeNotify
+ */
+#define SHCNE_RENAMEITEM       0x00000001
+#define SHCNE_CREATE           0x00000002
+#define SHCNE_DELETE           0x00000004
+#define SHCNE_MKDIR            0x00000008
+#define SHCNE_RMDIR            0x00000010
+#define SHCNE_MEDIAINSERTED    0x00000020
+#define SHCNE_MEDIAREMOVED     0x00000040
+#define SHCNE_DRIVEREMOVED     0x00000080
+#define SHCNE_DRIVEADD         0x00000100
+#define SHCNE_NETSHARE         0x00000200
+#define SHCNE_NETUNSHARE       0x00000400
+#define SHCNE_ATTRIBUTES       0x00000800
+#define SHCNE_UPDATEDIR                0x00001000
+#define SHCNE_UPDATEITEM       0x00002000
+#define SHCNE_SERVERDISCONNECT 0x00004000
+#define SHCNE_UPDATEIMAGE      0x00008000
+#define SHCNE_DRIVEADDGUI      0x00010000
+#define SHCNE_RENAMEFOLDER     0x00020000
+#define SHCNE_FREESPACE                0x00040000
+
+#define SHCNE_EXTENDED_EVENT   0x04000000
+#define SHCNE_ASSOCCHANGED     0x08000000
+#define SHCNE_DISKEVENTS       0x0002381F
+#define SHCNE_GLOBALEVENTS     0x0C0581E0
+#define SHCNE_ALLEVENTS                0x7FFFFFFF
+#define SHCNE_INTERRUPT                0x80000000
+
+#define SHCNEE_ORDERCHANGED    0x00000002
+
+#define SHCNF_IDLIST           0x0000
+#define SHCNF_PATHA            0x0001
+#define SHCNF_PRINTERA         0x0002
+#define SHCNF_DWORD            0x0003
+#define SHCNF_PATHW            0x0005
+#define SHCNF_PRINTERW         0x0006
+#define SHCNF_TYPE             0x00FF
+#define SHCNF_FLUSH            0x1000
+#define SHCNF_FLUSHNOWAIT      0x2000
+
+void WINAPI SHChangeNotifyA(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2);
+void WINAPI SHChangeNotifyW(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2);
+#define  SHChangeNotify WINELIB_NAME_AW(SHChangeNotify)
+
+ /**********************************************************************/
 
 #ifdef __cplusplus
 } /* extern "C" */