summaryrefslogtreecommitdiff
path: root/plugins/WhoUsesMyFiles
diff options
context:
space:
mode:
authorVadim Dashevskiy <watcherhd@gmail.com>2012-06-28 06:29:49 +0000
committerVadim Dashevskiy <watcherhd@gmail.com>2012-06-28 06:29:49 +0000
commitb00398f339de138916202ad625af923512c72efa (patch)
treefdc6e30d63a05efcbf11b857db8cf3e71a79c6ba /plugins/WhoUsesMyFiles
parenta2a58073a331623d006d7ffc2845b437cc0d571d (diff)
WhoUseMyFiles added, FileAsMessage - few fixrs
git-svn-id: http://svn.miranda-ng.org/main/trunk@664 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/WhoUsesMyFiles')
-rw-r--r--plugins/WhoUsesMyFiles/Makefile122
-rw-r--r--plugins/WhoUsesMyFiles/list.c172
-rw-r--r--plugins/WhoUsesMyFiles/res/drive.bmpbin0 -> 222 bytes
-rw-r--r--plugins/WhoUsesMyFiles/res/drive.icobin0 -> 10134 bytes
-rw-r--r--plugins/WhoUsesMyFiles/res/popup.icobin0 -> 894 bytes
-rw-r--r--plugins/WhoUsesMyFiles/res/popup_no.icobin0 -> 894 bytes
-rw-r--r--plugins/WhoUsesMyFiles/res/wumf.readme.txt39
-rw-r--r--plugins/WhoUsesMyFiles/resizer.c131
-rw-r--r--plugins/WhoUsesMyFiles/resource.h47
-rw-r--r--plugins/WhoUsesMyFiles/resource.rc209
-rw-r--r--plugins/WhoUsesMyFiles/wumf.c326
-rw-r--r--plugins/WhoUsesMyFiles/wumf.h167
-rw-r--r--plugins/WhoUsesMyFiles/wumf.sln26
-rw-r--r--plugins/WhoUsesMyFiles/wumf.vcxproj245
-rw-r--r--plugins/WhoUsesMyFiles/wumf.vcxproj.filters44
-rw-r--r--plugins/WhoUsesMyFiles/wumfplug.c629
16 files changed, 2157 insertions, 0 deletions
diff --git a/plugins/WhoUsesMyFiles/Makefile b/plugins/WhoUsesMyFiles/Makefile
new file mode 100644
index 0000000000..5cd7a604d9
--- /dev/null
+++ b/plugins/WhoUsesMyFiles/Makefile
@@ -0,0 +1,122 @@
+!IF "$(CFG)" == ""
+CFG=Release
+#CFG=Debug
+
+!MESSAGE No configuration specified. Defaulting to $(CFG)
+!ENDIF
+
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+LINK32=link.exe
+
+out=../../bin/Debug/Plugins
+obj=obj
+LIBS = user32.lib netapi32.lib comdlg32.lib shlwapi.lib
+
+
+LINK32_OBJS= \
+ "$(obj)\resource.res" \
+ "$(obj)\wumfplug.obj" \
+ "$(obj)\list.obj" \
+ "$(obj)\resizer.obj" \
+ "$(obj)\wumf.obj"
+
+
+all : "$(out)\wumfplug.dll" test
+
+$(obj):
+ if not exist $(obj) mkdir $(obj)
+
+
+$(out):
+ if not exist "$(out)/$(NULL)" mkdir "$(out)"
+
+!IF "$(CFG)" == "Release"
+
+CPP_PROJ=/nologo /MT /W3 /GX /O2 /D "WIN32" /D "_WIN32_WINNT" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Fp"$(obj)/wumfplug.pch" /YX /Fo"$(obj)/" /Fd"$(obj)/" /FD /c
+MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32
+RSC_PROJ=/l 0x809 /fo"$(obj)\resource.res" /d "NDEBUG"
+BSC32=bscmake.exe
+BSC32_FLAGS=/nologo /o"$(obj)\wumfplug.bsc"
+BSC32_SBRS= \
+
+LINK32_FLAGS= $(LIBS) /nologo /dll /incremental:no /pdb:"$(obj)\wumfplug.pdb" /machine:I386 /out:"$(out)/wumfplug.dll" /implib:"$(obj)/wumfplug.lib"
+
+!ELSEIF "$(CFG)" == "Debug"
+
+CPP_PROJ=/nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_WIN32_WINNT" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Fp"$(obj)\wumfplug.pch" /YX /Fo"$(obj)\\" /Fd"$(obj)\\" /FD /GZ /c
+MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32
+RSC_PROJ=/l 0x809 /fo"$(obj)/resource.res" /d "_DEBUG"
+BSC32=bscmake.exe
+BSC32_FLAGS=/nologo /o"$(obj)/wumfplug.bsc"
+BSC32_SBRS= \
+
+LINK32_FLAGS=$(LIBS) /nologo /dll /incremental:yes /pdb:"$(obj)\wumfplug.pdb" /debug /machine:I386 /out:"$(out)\wumfplug.dll" /implib:"$(obj)/wumfplug.lib" /pdbtype:sept
+
+!ENDIF
+
+"$(out)\wumfplug.dll" : "$(out)" $(DEF_FILE) $(LINK32_OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+
+.c{$(obj)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(obj)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(obj)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.c{$(obj)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(obj)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(obj)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+$(obj)/wumfplug.obj: wumfplug.c $(obj) wumf.h
+
+$(obj)/wumf.obj: wumf.c $(obj) wumf.h
+
+$(obj)/resizer.obj: resizer.c $(obj) wumf.h
+
+
+$(obj)/resource.res: resource.rc $(obj)
+ $(RSC) $(RSC_PROJ) resource.rc
+
+clean:
+ rm -f $(obj)/*.* $(out)/wumfplug.* *.aps
+
+yPER: $(out)/wumfplug.dll
+ yPER $(out)/wumfplug.dll /REALIGN_NORMAL
+
+distr: zip
+
+zip: $(out)/wumfplug.dll yPER res/wumf.readme.txt
+ pkzip25 -add -max wumf.zip $(out)/wumfplug.dll res/wumf.readme.txt
+
+src:
+ rar a -ag wumf-src.rar *.c *.h *.hm *.txt Makefile *.rc res/*.*
+
+re: clean all
+
+test:
+ "C:\Documents and Settings\Nike.Neosoft\Application Data\Microsoft\Internet Explorer\Quick Launch\miranda32dbg.exe.lnk"
diff --git a/plugins/WhoUsesMyFiles/list.c b/plugins/WhoUsesMyFiles/list.c
new file mode 100644
index 0000000000..1e52e12e4d
--- /dev/null
+++ b/plugins/WhoUsesMyFiles/list.c
@@ -0,0 +1,172 @@
+#include "wumf.h"
+
+PWumf new_wumf( DWORD dwID,
+ LPTSTR szUser,
+ LPTSTR szPath,
+ LPTSTR szComp,
+ LPTSTR szUNC,
+ DWORD dwSess,
+ DWORD dwPerm,
+ DWORD dwAttr)
+{
+ PWumf w;
+ CHAR szID[10];
+
+ w = (PWumf)malloc(sizeof(Wumf));
+ if(!w)return NULL;
+
+ #define SCPY(X) if(X){w->X = (LPSTR)malloc(1+strlen(X));if(!w->X)return NULL;strcpy(w->X, X);} else { w->X = NULL;}
+ #define SCPYW(X) if(X){w->X = (LPSTR)malloc(1+lstrlenW(X));if(!w->X)return NULL;wsprintfA(w->X, "%S", X);} else { w->X = NULL;}
+
+ #define SCCPY(X, Y) w->X = (LPSTR)malloc(1+strlen(Y));if(!w->X)return NULL;strcpy(w->X, Y)
+
+ SCPYW(szUser);
+ SCPYW(szPath);
+ SCPYW(szComp);
+ SCPYW(szUNC);
+ switch(dwPerm)
+ {
+ case PERM_FILE_READ: SCCPY(szPerm, "Read");break;
+ case PERM_FILE_WRITE: SCCPY(szPerm, "Write");break;
+ case PERM_FILE_CREATE: SCCPY(szPerm, "Create");break;
+ default: SCCPY(szPerm, "Execute");//w->szPerm = NULL;
+ };
+ wsprintf(szID, "%i", dwID);
+ SCPY(szID);
+
+ #undef SCPY
+ w->dwID = dwID;
+ w->dwSess = dwSess;
+ w->dwAttr = dwAttr;
+ w->dwPerm = dwPerm;
+ w->mark = FALSE;
+ w->next = NULL;
+ return w;
+}
+
+BOOL del_wumf(PWumf w)
+{
+ if(!w) return FALSE;
+ free(w->szUser);
+ free(w->szPath);
+ free(w->szComp);
+ free(w->szUNC);
+ free(w->szID);
+ free(w->szPerm);
+ free(w);
+ return TRUE;
+}
+
+BOOL add_cell(PWumf* l, PWumf w)
+{
+ PWumf p;
+ if(!w || !l)return FALSE;
+ if(!(*l))
+ {
+ *l = w;
+ }
+ else
+ {
+ p = *l;
+ while(p->next) p = p->next;
+ p->next = w;
+ }
+ w->next = NULL;
+ return TRUE;
+}
+
+BOOL del_cell(PWumf *l, PWumf w)
+{
+ PWumf p;
+ if(!l || !*l || !w)return FALSE;
+ p = *l;
+ if(w == *l)
+ *l = p->next;
+ else
+ {
+ while(p && p->next != w) p = p->next;
+ if(!p) return FALSE;
+ p->next = w->next;
+ }
+ return del_wumf(w);
+
+};
+
+BOOL cpy_cell(PWumf *l, PWumf w)
+{
+ PWumf w1;
+ w1 = new_wumf(w->dwID, w->szUser, w->szPath, w->szComp,w->szUNC, w->dwSess, w->dwPerm, w->dwAttr);
+ if(!w1) return FALSE;
+ w1->mark = w->mark;
+ return add_cell(l, w1);
+};
+
+PWumf cpy_list(PWumf *l)
+{
+ PWumf w, p = NULL;
+
+ if(!l || !*l) return NULL;
+ w = *l;
+ while(w)
+ {
+ if(!cpy_cell(&p, w))return NULL;
+ w = w->next;
+ }
+ return p;
+}
+
+PWumf fnd_cell(PWumf *l, DWORD dwID)
+{
+ PWumf w;
+ if(!l || !*l)return NULL;
+ w = *l;
+ while(w && w->dwID != dwID) w = w->next;
+ return w;
+}
+
+BOOL del_all(PWumf *l)
+{
+ PWumf w, p;
+ if(!l || !*l) return FALSE;
+ w = *l;
+ while(w)
+ {
+ p = w->next;
+ if(!del_cell(l, w))
+ {
+ return FALSE;
+ }
+ w = p;
+ }
+ *l = NULL;
+
+ return TRUE;
+}
+
+BOOL del_marked(PWumf *l)
+{
+ PWumf w, p;
+ if(!l)return FALSE;
+ w = *l;
+ while(w)
+ {
+ p = w->next;
+ if(w->mark)
+ {
+ if(!del_cell(l, w)) return FALSE;
+ };
+ w = p;
+ }
+ return TRUE;
+}
+
+void mark_all(PWumf *l, BOOL mark)
+{
+ PWumf w;
+ w = *l;
+ while(w)
+ {
+ w->mark = mark;
+ w = w->next;
+ }
+}
diff --git a/plugins/WhoUsesMyFiles/res/drive.bmp b/plugins/WhoUsesMyFiles/res/drive.bmp
new file mode 100644
index 0000000000..767aef2997
--- /dev/null
+++ b/plugins/WhoUsesMyFiles/res/drive.bmp
Binary files differ
diff --git a/plugins/WhoUsesMyFiles/res/drive.ico b/plugins/WhoUsesMyFiles/res/drive.ico
new file mode 100644
index 0000000000..66ce92ddc1
--- /dev/null
+++ b/plugins/WhoUsesMyFiles/res/drive.ico
Binary files differ
diff --git a/plugins/WhoUsesMyFiles/res/popup.ico b/plugins/WhoUsesMyFiles/res/popup.ico
new file mode 100644
index 0000000000..6fdf66e4d7
--- /dev/null
+++ b/plugins/WhoUsesMyFiles/res/popup.ico
Binary files differ
diff --git a/plugins/WhoUsesMyFiles/res/popup_no.ico b/plugins/WhoUsesMyFiles/res/popup_no.ico
new file mode 100644
index 0000000000..03fe0a2406
--- /dev/null
+++ b/plugins/WhoUsesMyFiles/res/popup_no.ico
Binary files differ
diff --git a/plugins/WhoUsesMyFiles/res/wumf.readme.txt b/plugins/WhoUsesMyFiles/res/wumf.readme.txt
new file mode 100644
index 0000000000..f07d9c2275
--- /dev/null
+++ b/plugins/WhoUsesMyFiles/res/wumf.readme.txt
@@ -0,0 +1,39 @@
+WUMF: Who Use My Files?
+-----------------------
+
+ver 0.1.0.1
+
+This plugins scans for network users of
+your shared files and notify you with popups.
+Uses PopUps Interoperability by Luca Santarelli.
+PopUps plugin must be activated!
+
+If you like such functionality,
+and have any questions/comments,
+just write me: nike000@users.sf.net
+
+ChangeLog:
+ + improvement
+ - bugfix
+ * other changes
+-----------------------
+0.1.0.1 2003-09-30
+ - Fixed bug with menu item
+
+0.1.0.0 2003-09-18
+ + TopToolbar button added, connection list added
+ - international (locale) filenames are shown correctly
+ - log is not overwritten every start of Miranda
+
+0.0.8.0 2003-09-09
+ + logging feature, option of log/alert folder access
+
+0.0.7.0 2003-09-08
+ + pop-up options dialog added
+
+0.0.6.0 2003-09-03
+ + size reduced to 4k, thanx to Paul Smakov. nothing more changed.
+
+0.0.5.0 2003-09-01
+ * first public beta.
+
diff --git a/plugins/WhoUsesMyFiles/resizer.c b/plugins/WhoUsesMyFiles/resizer.c
new file mode 100644
index 0000000000..e45d10a453
--- /dev/null
+++ b/plugins/WhoUsesMyFiles/resizer.c
@@ -0,0 +1,131 @@
+#include "wumf.h"
+#pragma hdrstop
+
+typedef struct {
+ DWORD helpID;
+ DWORD exStyle;
+ DWORD style;
+ short x;
+ short y;
+ short cx;
+ short cy;
+ WORD id;
+} START_OF_DLGITEMTEMPLATEEX;
+
+typedef struct {
+ WORD dlgVer;
+ WORD signature;
+ DWORD helpID;
+ DWORD exStyle;
+ DWORD style;
+ WORD cDlgItems;
+ short x;
+ short y;
+ short cx;
+ short cy;
+} START_OF_DLGTEMPLATEEX;
+
+int ResizeDialog(WPARAM wParam,LPARAM lParam)
+{
+ UTILRESIZEDIALOG *urd=(UTILRESIZEDIALOG*)lParam;
+ HDWP hDwp;
+ int i;
+ DLGITEMTEMPLATE *pItem;
+ START_OF_DLGITEMTEMPLATEEX *pItemEx;
+ RECT rc;
+ PWORD pWord;
+ DLGTEMPLATE *pTemplate;
+ START_OF_DLGTEMPLATEEX *pTemplateEx;
+ UTILRESIZECONTROL urc;
+ int procResult;
+ int extendedDlg,itemCount;
+
+ if(urd->cbSize!=sizeof(UTILRESIZEDIALOG)) return 1;
+ pTemplate=(DLGTEMPLATE*)LockResource(LoadResource(urd->hInstance,FindResource(urd->hInstance,urd->lpTemplate,RT_DIALOG)));
+ pTemplateEx=(START_OF_DLGTEMPLATEEX*)pTemplate;
+ extendedDlg=pTemplateEx->signature==0xFFFF;
+ if(extendedDlg && pTemplateEx->dlgVer!=1)
+ return 1;
+
+ if(extendedDlg) pWord=(PWORD)(pTemplateEx+1);
+ else pWord=(PWORD)(pTemplate+1);
+ if(*pWord==0xFFFF) pWord+=2; else while(*pWord++); //menu
+ if(*pWord==0xFFFF) pWord+=2; else while(*pWord++); //class
+ while(*pWord++); //title
+ if(extendedDlg) {
+ if(pTemplateEx->style&DS_SETFONT) {
+ pWord+=3; //font size,weight,italic
+ while(*pWord++); //font name
+ }
+ }
+ else {
+ if(pTemplate->style&DS_SETFONT) {
+ pWord++; //font size
+ while(*pWord++); //font name
+ }
+ }
+
+ urc.cbSize=sizeof(UTILRESIZECONTROL);
+ rc.left=0; rc.top=0;
+ if(extendedDlg) {rc.right=pTemplateEx->cx; rc.bottom=pTemplateEx->cy;}
+ else {rc.right=pTemplate->cx; rc.bottom=pTemplate->cy;}
+ MapDialogRect(urd->hwndDlg,&rc);
+ urc.dlgOriginalSize.cx=rc.right; urc.dlgOriginalSize.cy=rc.bottom;
+ GetClientRect(urd->hwndDlg,&rc);
+ urc.dlgNewSize.cx=rc.right; urc.dlgNewSize.cy=rc.bottom;
+
+ if(extendedDlg) itemCount=pTemplateEx->cDlgItems;
+ else itemCount=pTemplate->cdit;
+ hDwp=BeginDeferWindowPos(itemCount);
+ for(i=0;i<itemCount;i++) {
+ if((unsigned)pWord&2) pWord++; //dword align
+
+ if(extendedDlg) {
+ pItemEx=(START_OF_DLGITEMTEMPLATEEX*)pWord;
+ pWord=(PWORD)(pItemEx+1);
+
+ urc.wId=pItemEx->id;
+ urc.rcItem.left=pItemEx->x; urc.rcItem.top=pItemEx->y;
+ urc.rcItem.right=urc.rcItem.left+pItemEx->cx; urc.rcItem.bottom=urc.rcItem.top+pItemEx->cy;
+ }
+ else {
+ pItem=(DLGITEMTEMPLATE*)pWord;
+ pWord=(PWORD)(pItem+1);
+
+ urc.wId=pItem->id;
+ urc.rcItem.left=pItem->x; urc.rcItem.top=pItem->y;
+ urc.rcItem.right=urc.rcItem.left+pItem->cx; urc.rcItem.bottom=urc.rcItem.top+pItem->cy;
+ }
+ if(*pWord==0xFFFF) pWord+=2; else while(*pWord++); //menu
+ if(*pWord==0xFFFF) pWord+=2; else while(*pWord++); //class
+ pWord+=1+(1+*pWord)/2; //creation data
+
+ if(urc.wId==65535) continue; //using this breaks the dwp, so just ignore it
+
+ MapDialogRect(urd->hwndDlg,&urc.rcItem);
+ procResult=(urd->pfnResizer)(urd->hwndDlg,urd->lParam,&urc);
+ if(procResult&RD_ANCHORX_RIGHT) {
+ urc.rcItem.left+=urc.dlgNewSize.cx-urc.dlgOriginalSize.cx;
+ urc.rcItem.right+=urc.dlgNewSize.cx-urc.dlgOriginalSize.cx;
+ }
+ else if(procResult&RD_ANCHORX_WIDTH)
+ urc.rcItem.right+=urc.dlgNewSize.cx-urc.dlgOriginalSize.cx;
+ else if(procResult&RD_ANCHORX_CENTRE) {
+ urc.rcItem.left+=(urc.dlgNewSize.cx-urc.dlgOriginalSize.cx)/2;
+ urc.rcItem.right+=(urc.dlgNewSize.cx-urc.dlgOriginalSize.cx)/2;
+ }
+ if(procResult&RD_ANCHORY_BOTTOM) {
+ urc.rcItem.top+=urc.dlgNewSize.cy-urc.dlgOriginalSize.cy;
+ urc.rcItem.bottom+=urc.dlgNewSize.cy-urc.dlgOriginalSize.cy;
+ }
+ else if(procResult&RD_ANCHORY_HEIGHT)
+ urc.rcItem.bottom+=urc.dlgNewSize.cy-urc.dlgOriginalSize.cy;
+ else if(procResult&RD_ANCHORY_CENTRE) {
+ urc.rcItem.top+=(urc.dlgNewSize.cy-urc.dlgOriginalSize.cy)/2;
+ urc.rcItem.bottom+=(urc.dlgNewSize.cy-urc.dlgOriginalSize.cy)/2;
+ }
+ hDwp=DeferWindowPos(hDwp,GetDlgItem(urd->hwndDlg,extendedDlg?pItemEx->id:pItem->id),0,urc.rcItem.left,urc.rcItem.top,urc.rcItem.right-urc.rcItem.left,urc.rcItem.bottom-urc.rcItem.top,SWP_NOZORDER);
+ }
+ EndDeferWindowPos(hDwp);
+ return 0;
+} \ No newline at end of file
diff --git a/plugins/WhoUsesMyFiles/resource.h b/plugins/WhoUsesMyFiles/resource.h
new file mode 100644
index 0000000000..3fb3c7e09e
--- /dev/null
+++ b/plugins/WhoUsesMyFiles/resource.h
@@ -0,0 +1,47 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Developer Studio generated include file.
+// Used by resource.rc
+//
+#define IDD_OPTIONS 101
+#define IDI_POPUP 102
+#define IDI_NOPOPUP 103
+#define IDI_DRIVE 106
+#define IDD_CONNLIST 107
+#define IDB_DRIVE 108
+#define IDC_COLOR_SET 1000
+#define IDC_COLOR_WIN 1001
+#define IDC_COLOR_DEF 1002
+#define IDC_COLOR_BACK 1003
+#define IDC_COLOR_TEXT 1004
+#define IDC_FILE 1006
+#define IDC_SEL_FILE 1007
+#define IDC_DELAY_SEC 1026
+#define IDC_PREVIEW 1033
+#define IDC_DEBUG 1034
+#define IDC_DELAY_SET 1049
+#define IDC_DELAY_INF 1050
+#define IDC_DELAY_DEF 1051
+#define IDC_DELAY_NOTE 1052
+#define IDC_TX_DELAY_SEC 1053
+#define IDC_LOG_INTO_FILE 1054
+#define IDC_LOG_FOLDER 1055
+#define IDC_ALERT_FOLDER 1056
+#define IDC_LOG_UNC 1057
+#define IDC_ALERT_UNC 1058
+#define IDC_LOG_COMP 1059
+#define IDC_ALERT_COMP 1060
+#define IDC_CONNLIST 1061
+#define IDC_CONN 1062
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NO_MFC 1
+#define _APS_3D_CONTROLS 1
+#define _APS_NEXT_RESOURCE_VALUE 109
+#define _APS_NEXT_COMMAND_VALUE 40081
+#define _APS_NEXT_CONTROL_VALUE 1063
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/plugins/WhoUsesMyFiles/resource.rc b/plugins/WhoUsesMyFiles/resource.rc
new file mode 100644
index 0000000000..1bf8f41511
--- /dev/null
+++ b/plugins/WhoUsesMyFiles/resource.rc
@@ -0,0 +1,209 @@
+//Microsoft Developer Studio generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Russian resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
+#ifdef _WIN32
+LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
+#pragma code_page(1251)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_CONNLIST DIALOGEX 0, 0, 330, 230
+STYLE WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_VISIBLE | WS_CAPTION | WS_SYSMENU |
+ WS_THICKFRAME
+EXSTYLE WS_EX_NOPARENTNOTIFY
+CAPTION "WUMF: Current connections"
+FONT 8, "MS Sans Serif"
+BEGIN
+ DEFPUSHBUTTON "OK",IDOK,276,212,50,14
+ CONTROL "List1",IDC_CONNLIST,"SysListView32",LVS_REPORT |
+ LVS_SINGLESEL | LVS_SORTASCENDING | WS_TABSTOP,4,4,322,
+ 200,WS_EX_CLIENTEDGE
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO DISCARDABLE
+BEGIN
+ IDD_CONNLIST, DIALOG
+ BEGIN
+ LEFTMARGIN, 4
+ RIGHTMARGIN, 326
+ TOPMARGIN, 4
+ BOTTOMMARGIN, 226
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Bitmap
+//
+
+IDB_DRIVE BITMAP DISCARDABLE "res\\drive.bmp"
+#endif // Russian resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_OPTIONS DIALOGEX 0, 0, 330, 246
+STYLE DS_MODALFRAME | DS_FIXEDSYS | WS_CHILD
+EXSTYLE WS_EX_CONTEXTHELP | WS_EX_CONTROLPARENT
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
+ GROUPBOX "Popup delay settings",IDC_STATIC,9,9,153,93,WS_GROUP
+ EDITTEXT IDC_DELAY_SEC,17,23,20,12,ES_AUTOHSCROLL | ES_NUMBER
+ LTEXT "PopUp Delay (seconds)",IDC_TX_DELAY_SEC,39,25,94,8
+ CONTROL "",IDC_COLOR_BACK,"ColourPicker",WS_TABSTOP,187,24,39,12
+ LTEXT "Background color",IDC_STATIC,231,26,76,8,SS_CENTERIMAGE |
+ NOT WS_GROUP
+ CONTROL "",IDC_COLOR_TEXT,"ColourPicker",WS_TABSTOP,187,39,39,12
+ LTEXT "Text color",IDC_STATIC,231,42,76,8,SS_CENTERIMAGE | NOT
+ WS_GROUP
+ PUSHBUTTON "Previe&w",IDC_PREVIEW,270,231,50,15
+ CONTROL "Show infinitely",IDC_DELAY_INF,"Button",
+ BS_AUTORADIOBUTTON | BS_NOTIFY | WS_TABSTOP,17,50,61,10
+ CONTROL "Default PopUp delay",IDC_DELAY_DEF,"Button",
+ BS_AUTORADIOBUTTON | BS_NOTIFY | WS_TABSTOP,17,61,81,10
+ CONTROL "Choose delay time",IDC_DELAY_SET,"Button",
+ BS_AUTORADIOBUTTON | BS_NOTIFY | WS_TABSTOP,17,39,73,10
+ GROUPBOX "Popup color settings",IDC_STATIC,167,9,153,93,WS_GROUP
+ CONTROL "Use windows colors",IDC_COLOR_WIN,"Button",
+ BS_AUTORADIOBUTTON | BS_NOTIFY | WS_TABSTOP,187,63,79,10
+ CONTROL "Use default PopUp colors",IDC_COLOR_DEF,"Button",
+ BS_AUTORADIOBUTTON | BS_NOTIFY | WS_TABSTOP,187,74,97,10
+ CONTROL "Choose colors",IDC_COLOR_SET,"Button",
+ BS_AUTORADIOBUTTON | BS_NOTIFY | WS_TABSTOP,187,52,61,10
+ GROUPBOX "File access filter && logging settings",IDC_STATIC,9,
+ 106,311,101
+ CTEXT "Please note that this settings has effect only with PopUps Interoperability plugin version 1.0.1.9 or higher",
+ IDC_DELAY_NOTE,14,73,143,26,SS_SUNKEN | WS_DISABLED |
+ NOT WS_GROUP
+ EDITTEXT IDC_FILE,83,123,210,12,ES_AUTOHSCROLL,WS_EX_ACCEPTFILES
+ PUSHBUTTON "...",IDC_SEL_FILE,299,123,14,12
+ CONTROL "Log into text file",IDC_LOG_INTO_FILE,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,14,123,64,12
+ CONTROL "Log folders access",IDC_LOG_FOLDER,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,14,143,75,12
+ CONTROL "Alerts on folders access",IDC_ALERT_FOLDER,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,165,143,91,12
+ CONTROL "Log files and folders in UNC format",IDC_LOG_UNC,"Button",
+ BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,14,163,125,12
+ CONTROL "Alert files && folders in UNC format",IDC_ALERT_UNC,
+ "Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,165,
+ 163,119,12
+ CONTROL "Log computer name with username",IDC_LOG_COMP,"Button",
+ BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,14,183,126,10
+ CONTROL "Alert computer name with username",IDC_ALERT_COMP,
+ "Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,165,
+ 183,128,10
+ LTEXT "Disabled options will be available in the next version",
+ IDC_STATIC,83,194,199,9
+ PUSHBUTTON "Show current connections",IDC_CONN,162,231,104,15
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO DISCARDABLE
+BEGIN
+ IDD_OPTIONS, DIALOG
+ BEGIN
+ RIGHTMARGIN, 320
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_POPUP ICON DISCARDABLE "res\\popup.ico"
+IDI_NOPOPUP ICON DISCARDABLE "res\\popup_no.ico"
+IDI_DRIVE ICON DISCARDABLE "res\\drive.ico"
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/plugins/WhoUsesMyFiles/wumf.c b/plugins/WhoUsesMyFiles/wumf.c
new file mode 100644
index 0000000000..98f741bdd1
--- /dev/null
+++ b/plugins/WhoUsesMyFiles/wumf.c
@@ -0,0 +1,326 @@
+#define MAX_CHARS 4096
+#define WS_WINDOW_STYLE WS_OVERLAPPED
+#define NAME "WUMF"
+#define WM_MYCMD 0x0401
+
+#include "wumf.h"
+static PWumf list = NULL;
+static PWumf lst = NULL;
+
+extern WUMF_OPTIONS WumfOptions;
+extern HANDLE hInst;
+extern HWND hDlg;
+extern char ModuleName[];
+
+HANDLE hLog = INVALID_HANDLE_VALUE;
+BOOL wumf();
+
+static int DlgResizer(HWND hwndDlg,LPARAM lParam,UTILRESIZECONTROL *urc) {
+ switch(urc->wId) {
+ case IDC_CONNLIST:
+ return RD_ANCHORX_WIDTH|RD_ANCHORY_HEIGHT;
+ case IDOK:
+ return RD_ANCHORX_RIGHT|RD_ANCHORY_BOTTOM;
+ }
+ return RD_ANCHORX_LEFT|RD_ANCHORY_TOP;
+}
+
+
+
+void AddToList(HWND hList, PWumf w)
+{
+ LVITEM lvi = { 0 };
+ lvi.iItem=ListView_GetItemCount(hList)+1;
+ lvi.mask= LVIF_PARAM|LVIF_TEXT;
+ lvi.pszText = w->szID;
+ lvi.cchTextMax = strlen(w->szID);
+ lvi.lParam = (LPARAM)w;
+ ListView_InsertItem(hList,&lvi);
+}
+
+void ShowList(PWumf l, HWND hList)
+{
+ PWumf w;
+ w = l;
+ while(w)
+ {
+ AddToList(hList,w);
+ w = w->next;
+ }
+}
+
+VOID OnGetDispInfo(NMLVDISPINFO *plvdi)
+{
+ PWumf w;
+ w = (PWumf)(plvdi->item.lParam);
+ switch (plvdi->item.iSubItem)
+ {
+ case 0:
+ plvdi->item.pszText = w->szID;
+ break;
+ case 1:
+ plvdi->item.pszText = w->szUser;
+ break;
+ case 2:
+ plvdi->item.pszText = w->szPath;
+ break;
+ case 3:
+ plvdi->item.pszText = w->szPerm;
+ break;
+ default:
+ break;
+ }
+}
+
+
+int CALLBACK ConnDlgProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
+{
+ UTILRESIZEDIALOG urd={0};
+ LV_COLUMN lvc = { 0 };
+ char col0[] = "ID";
+ char col1[] = "User";
+ char col2[] = "File";
+ char col3[] = "Access";
+// char buff[256];
+ HWND hList;
+ switch( Msg )
+ {
+ case WM_INITDIALOG:
+ hList = GetDlgItem(hWnd, IDC_CONNLIST);
+// ListView_DeleteAllItems(hList);
+ ListView_SetExtendedListViewStyle(hList, LVS_EX_FULLROWSELECT);
+ lvc.mask = LVCF_TEXT|LVCF_FMT|LVCF_WIDTH;
+ lvc.fmt = LVCFMT_LEFT;
+ lvc.cx = 40;
+ lvc.pszText = col0;
+ lvc.cchTextMax = sizeof(col0);
+ ListView_InsertColumn(hList, 0, &lvc);
+ lvc.cx = 50;
+ lvc.pszText = col1;
+ lvc.cchTextMax = sizeof(col1);
+ ListView_InsertColumn(hList, 1, &lvc);
+ lvc.cx = 250;
+ lvc.pszText = col2;
+ lvc.cchTextMax = sizeof(col2);
+ ListView_InsertColumn(hList, 2, &lvc);
+ lvc.cx = 50;
+ lvc.pszText = col3;
+ lvc.cchTextMax = sizeof(col3);
+ ListView_InsertColumn(hList, 3, &lvc);
+ KillTimer(NULL, 777);
+ lst = cpy_list(&list);
+ SetTimer(NULL, 777, TIME,(TIMERPROC) TimerProc);
+ ShowList(lst, hList);
+ Utils_RestoreWindowPosition(hWnd, NULL, ModuleName,"conn");
+ break;
+ case WM_CLOSE:
+ PostMessage( hWnd, WM_COMMAND, IDCANCEL, 0l );
+ break;
+ case WM_COMMAND:
+ switch( LOWORD(wParam) )
+ {
+ case IDOK:
+ case IDCANCEL:
+ PostMessage( hWnd, WM_DESTROY, 0, 0l );
+ break;
+ }
+ break;
+ case WM_SIZE:
+ urd.cbSize=sizeof(urd);
+ urd.hwndDlg=hWnd;
+ urd.hInstance=hInst;
+ urd.lpTemplate=MAKEINTRESOURCE(IDD_CONNLIST);
+ urd.lParam=(LPARAM)NULL;
+ urd.pfnResizer=DlgResizer;
+ ResizeDialog(0,(LPARAM)&urd);
+ Utils_SaveWindowPosition(hWnd, NULL, ModuleName,"conn");
+ return TRUE;
+ case WM_MOVE:
+ Utils_SaveWindowPosition(hWnd, NULL, ModuleName,"conn");
+ break;
+ case WM_NOTIFY:
+ switch (((LPNMHDR) lParam)->code)
+ {
+ case LVN_GETDISPINFO:
+ OnGetDispInfo((NMLVDISPINFO *) lParam);
+ break;
+ }
+ break;
+ case WM_DESTROY:
+ del_all(&lst);
+ PostQuitMessage(0);
+ break;
+ default:
+ return FALSE;
+ }
+ return TRUE;
+}
+
+void LogWumf(PWumf w)
+{
+ char str[256];
+ LPTSTR lpstr;
+ char lpDateStr[20];
+ char lpTimeStr[20];
+ SYSTEMTIME time;
+ DWORD bytes;
+
+ if(!WumfOptions.LogFolders && (w->dwAttr & FILE_ATTRIBUTE_DIRECTORY)) return;
+
+ if(hLog == INVALID_HANDLE_VALUE || hLog == NULL)
+ {
+ hLog = CreateFile(WumfOptions.LogFile,
+ GENERIC_WRITE,
+ FILE_SHARE_READ,
+ (LPSECURITY_ATTRIBUTES) NULL,
+ OPEN_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL,
+ (HANDLE) NULL);
+ if(hLog == INVALID_HANDLE_VALUE)
+ {
+ FormatMessage(
+ FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ GetLastError(),
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
+ (LPTSTR) &lpstr,
+ 0,
+ NULL);
+ wsprintf(str, "Can't open log file %s\nError:%s", WumfOptions.LogFile, lpstr);
+ LocalFree(lpstr);
+ MessageBox( NULL, str, "Error opening file", MB_OK | MB_ICONSTOP);
+ WumfOptions.LogToFile = FALSE;
+ }
+ }
+ GetLocalTime(&time);
+ GetDateFormat(LOCALE_USER_DEFAULT,DATE_SHORTDATE, &time,NULL, lpDateStr, 20);
+ GetTimeFormat(LOCALE_USER_DEFAULT,TIME_FORCE24HOURFORMAT|TIME_NOTIMEMARKER, &time,NULL, lpTimeStr, 20);
+ wsprintf(str ,"%s %s %20s\t%s\r\n\0",lpDateStr, lpTimeStr, w->szUser, w->szPath);
+ SetFilePointer (hLog, 0, NULL, FILE_END) ; ;
+ WriteFile(hLog, str ,strlen(str),&bytes,NULL);
+}
+
+/*
+BOOL wumf()
+{
+ FILE_INFO_3 *buf, *cur;
+ SESSION_INFO_0 *sinfo;
+ DWORD read, total, resumeh, rc, i, sess = 0L;
+ wchar_t server[20];
+ char user[512], path[512], comp[512];
+ char* UNC = NULL;
+ PWumf w = NULL;
+
+ mbstowcs( server, "\\\\.", 8);
+ resumeh = 0;
+
+ mark_all(&list, TRUE);
+ do
+ {
+ buf = NULL;
+ rc = NetFileEnum( (LPWSTR)server,
+ NULL,
+ NULL, 3,
+ (BYTE **) &buf, 2048, &read, &total, &resumeh );
+ if ( rc != ERROR_MORE_DATA && rc != ERROR_SUCCESS )
+ break;
+ for ( i = 0, cur = buf; i < read; ++ i, ++ cur)
+ {
+ w = fnd_cell(&list, cur->fi3_id);
+ if(!w)
+ {
+ wcstombs(user, (wchar_t *) cur->fi3_username, 512);
+ wcstombs(path, (wchar_t *) cur->fi3_pathname, 512);
+
+ w = new_wumf(cur->fi3_id, user, path, comp, UNC, sess, cur->fi3_permissions,GetFileAttributes(path));
+ w->mark = FALSE;
+ if(!add_cell(&list, w)){
+ msg("Error memory allocation");
+ return FALSE;
+ };
+
+ if(WumfOptions.PopupsEnabled) ShowWumfPopUp(w);
+ if(WumfOptions.LogToFile) LogWumf(w);
+ }
+ else
+ w->mark = FALSE;
+ }
+ if(buf != NULL) NetApiBufferFree( buf );
+ } while(rc == ERROR_MORE_DATA);
+ return del_marked(&list);
+};*/
+
+BOOL wumf()
+{
+ LPSESSION_INFO_1 s_info = NULL;
+ DWORD ent_read = 0, ent_total = 0, res_handle = 0, i = 0;
+ NET_API_STATUS res = NERR_Success;
+ if( (res = NetSessionEnum(NULL, NULL, NULL, 1, (LPBYTE *)&s_info, MAX_PREFERRED_LENGTH, &ent_read, &ent_total, &res_handle)) == NERR_Success ||
+ res == ERROR_MORE_DATA)
+ {
+ mark_all(&list, TRUE);
+ for(i = 0; i < ent_read; i++)
+ {
+ process_session(s_info[ i ]);
+ }
+ NetApiBufferFree(s_info);
+ } else {
+ printError(res);
+ }
+ return del_marked(&list);
+};
+
+void process_session(SESSION_INFO_1 s_info)
+{
+ LPFILE_INFO_3 f_info = NULL;
+ DWORD ent_read = 0, ent_total = 0, res_handle = 0, i = 0;
+ NET_API_STATUS res = NERR_Success;
+ if( (res = NetFileEnum(NULL, NULL, s_info.sesi1_username, 3, (LPBYTE *)&f_info, MAX_PREFERRED_LENGTH, &ent_read, &ent_total, &res_handle)) == NERR_Success ||
+ res == ERROR_MORE_DATA)
+ {
+ for(i = 0; i < ent_read; i++)
+ {
+ process_file(s_info, f_info[ i ]);
+ }
+ NetApiBufferFree(f_info);
+ } else {
+ printError(res);
+ }
+}
+
+void process_file(SESSION_INFO_1 s_info, FILE_INFO_3 f_info)
+{
+ PWumf w = fnd_cell(&list, f_info.fi3_id);
+ if(!w)
+ {
+ w = new_wumf(f_info.fi3_id, f_info.fi3_username, f_info.fi3_pathname, s_info.sesi1_cname, NULL, 0, f_info.fi3_permissions, GetFileAttributes(f_info.fi3_pathname));
+ w->mark = FALSE;
+ if(!add_cell(&list, w)){
+ msg("Error memory allocation");
+ };
+ if(WumfOptions.PopupsEnabled) ShowWumfPopUp(w);
+ if(WumfOptions.LogToFile) LogWumf(w);
+ } else {
+ w->mark = FALSE;
+ }
+}
+
+void printError(DWORD res)
+{
+ LPVOID lpMsgBuf;
+ FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, NULL, res, 0, (LPTSTR) &lpMsgBuf, 0, NULL );
+ OutputDebugString(lpMsgBuf);
+ msg(lpMsgBuf);
+ LocalFree( lpMsgBuf );
+}
+
+VOID CALLBACK TimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
+{
+ if(!wumf())
+ KillTimer(NULL, 777);
+};
+
+void FreeAll()
+{
+ del_all(&list);
+};
diff --git a/plugins/WhoUsesMyFiles/wumf.h b/plugins/WhoUsesMyFiles/wumf.h
new file mode 100644
index 0000000000..026e8974cf
--- /dev/null
+++ b/plugins/WhoUsesMyFiles/wumf.h
@@ -0,0 +1,167 @@
+#define _CRT_SECURE_NO_WARNINGS
+
+#include <windows.h>
+#include <commctrl.h>
+#include <lm.h>
+#include <locale.h>
+
+#include "newpluginapi.h"
+#include "m_system.h"
+#include "m_options.h"
+#include "m_langpack.h"
+#include "m_clui.h"
+#include "m_clist.h"
+#include "m_database.h"
+#include "m_utils.h"
+#include "m_skin.h"
+#include "m_popup.h"
+#include "m_toptoolbar.h"
+
+#include "resource.h"
+
+#define LIFETIME_MAX 60
+#define LIFETIME_MIN 1
+#define MAX_PATHNAME 512
+#define MAX_USERNAME 512
+#define TIME 500
+
+#define POPUPS_ENABLED "1033"
+#define DELAY_SEC "1026"
+#define DELAY_SET "1049"
+#define DELAY_INF "1050"
+#define DELAY_DEF "1051"
+#define COLOR_SET "1000"
+#define COLOR_WIN "1001"
+#define COLOR_DEF "1002"
+#define COLOR_BACK "1003"
+#define COLOR_TEXT "1004"
+#define OPT_FILE "1006"
+#define LOG_INTO_FILE "1054"
+#define LOG_FOLDER "1055"
+#define ALERT_FOLDER "1056"
+#define LOG_UNC "1057"
+#define ALERT_UNC "1058"
+#define LOG_COMP "1059"
+#define ALERT_COMP "1060"
+
+#define IDM_SETUP 0x0402
+#define IDM_ABOUT 0x0403
+#define IDM_SHOW 0x0405
+#define IDM_EXIT 0x0404
+
+typedef struct
+{
+ BOOL PopupsEnabled;
+
+ BOOL UseWinColor;
+ BOOL UseDefColor;
+ BOOL SelectColor;
+ COLORREF ColorText;
+ COLORREF ColorBack;
+ BOOL DelayInf;
+ BOOL DelayDef;
+ BOOL DelaySet;
+ int DelaySec;
+
+ BOOL LogToFile;
+ BOOL LogFolders;
+ BOOL AlertFolders;
+ BOOL LogUNC;
+ BOOL AlertUNC;
+ BOOL LogComp;
+ BOOL AlertComp;
+
+ char LogFile[255];
+} WUMF_OPTIONS;
+
+typedef struct _WUMF{
+ DWORD dwID;
+ LPSTR szID;
+ LPSTR szUser;
+ LPSTR szPath;
+ LPSTR szComp;
+ LPSTR szUNC;
+ LPSTR szPerm;
+ DWORD dwSess;
+ DWORD dwLocks;
+ DWORD dwAttr;
+ DWORD dwPerm;
+ BOOL mark;
+ struct _WUMF* next;
+} Wumf, *PWumf;
+
+PWumf new_wumf(
+ DWORD dwID,
+ LPSTR szUser,
+ LPSTR szPath,
+ LPSTR szComp,
+ LPSTR szUNC,
+ DWORD szSess,
+ DWORD dwPerm,
+ DWORD dwAttr);
+
+BOOL add_cell (PWumf* l, PWumf w);
+BOOL del_cell (PWumf* l, PWumf w);
+BOOL cpy_cell (PWumf* l, PWumf w);
+PWumf fnd_cell (PWumf* l, DWORD dwID);
+PWumf cpy_list (PWumf* l);
+BOOL del_all (PWumf* l);
+void mark_all (PWumf* l, BOOL mark);
+BOOL del_marked(PWumf* l);
+
+
+
+void FreeAll();
+VOID CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD);
+int CALLBACK ConnDlgProc(HWND, UINT, WPARAM, LPARAM);
+int ResizeDialog(WPARAM wParam,LPARAM lParam);
+
+void ShowThePopUp(PWumf w, LPSTR, LPSTR);
+void ShowWumfPopUp(PWumf w);
+
+void process_session(SESSION_INFO_1 s_info);
+void process_file(SESSION_INFO_1 s_info, FILE_INFO_3 f_info);
+void printError(DWORD res);
+
+#define msg(X) MessageBox(NULL, X, "WUMF", MB_OK|MB_ICONSTOP)
+#define __EXP __declspec(dllexport)
+#define MS_WUMF_SWITCHPOPUP "WUMF/SwitchPopup"
+#define MS_WUMF_CONNECTIONSSHOW "WUMF/ShowConnections"
+
+#define malloc(size) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size)
+#define free(something) HeapFree(GetProcessHeap(), 0, something)
+
+#ifndef RD_ANCHORX_CUSTOM
+#define RD_ANCHORX_CUSTOM 0 //function did everything required to the x axis, do no more processing
+#define RD_ANCHORX_LEFT 0 //move the control to keep it constant distance from the left edge of the dialog
+#define RD_ANCHORX_RIGHT 1 //move the control to keep it constant distance from the right edge of the dialog
+#define RD_ANCHORX_WIDTH 2 //size the control to keep it constant distance from both edges of the dialog
+#define RD_ANCHORX_CENTRE 4 //move the control to keep it constant distance from the centre of the dialog
+#define RD_ANCHORY_CUSTOM 0
+#define RD_ANCHORY_TOP 0
+#define RD_ANCHORY_BOTTOM 8
+#define RD_ANCHORY_HEIGHT 16
+#define RD_ANCHORY_CENTRE 32
+
+typedef struct {
+ int cbSize;
+ UINT wId; //control ID
+ RECT rcItem; //original control rectangle, relative to dialog
+ //modify in-place to specify the new position
+ SIZE dlgOriginalSize; //size of dialog client area in template
+ SIZE dlgNewSize; //current size of dialog client area
+} UTILRESIZECONTROL;
+
+typedef int (*DIALOGRESIZERPROC)(HWND hwndDlg,LPARAM lParam,UTILRESIZECONTROL *urc);
+
+typedef struct {
+ int cbSize;
+ HWND hwndDlg;
+ HINSTANCE hInstance; //module containing the dialog template
+ LPCTSTR lpTemplate; //dialog template
+ LPARAM lParam; //caller-defined
+ DIALOGRESIZERPROC pfnResizer;
+} UTILRESIZEDIALOG;
+
+#endif
+
diff --git a/plugins/WhoUsesMyFiles/wumf.sln b/plugins/WhoUsesMyFiles/wumf.sln
new file mode 100644
index 0000000000..da60295c03
--- /dev/null
+++ b/plugins/WhoUsesMyFiles/wumf.sln
@@ -0,0 +1,26 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WumfPlug", "wumf.vcxproj", "{F29CCB9B-79CF-4341-AA05-3626A036D3E3}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Debug|x64 = Debug|x64
+ Release|Win32 = Release|Win32
+ Release|x64 = Release|x64
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {F29CCB9B-79CF-4341-AA05-3626A036D3E3}.Debug|Win32.ActiveCfg = Debug|Win32
+ {F29CCB9B-79CF-4341-AA05-3626A036D3E3}.Debug|Win32.Build.0 = Debug|Win32
+ {F29CCB9B-79CF-4341-AA05-3626A036D3E3}.Debug|x64.ActiveCfg = Debug|x64
+ {F29CCB9B-79CF-4341-AA05-3626A036D3E3}.Debug|x64.Build.0 = Debug|x64
+ {F29CCB9B-79CF-4341-AA05-3626A036D3E3}.Release|Win32.ActiveCfg = Release|Win32
+ {F29CCB9B-79CF-4341-AA05-3626A036D3E3}.Release|Win32.Build.0 = Release|Win32
+ {F29CCB9B-79CF-4341-AA05-3626A036D3E3}.Release|x64.ActiveCfg = Release|x64
+ {F29CCB9B-79CF-4341-AA05-3626A036D3E3}.Release|x64.Build.0 = Release|x64
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/plugins/WhoUsesMyFiles/wumf.vcxproj b/plugins/WhoUsesMyFiles/wumf.vcxproj
new file mode 100644
index 0000000000..b59b02122d
--- /dev/null
+++ b/plugins/WhoUsesMyFiles/wumf.vcxproj
@@ -0,0 +1,245 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{F29CCB9B-79CF-4341-AA05-3626A036D3E3}</ProjectGuid>
+ <RootNamespace>wumf</RootNamespace>
+ <Keyword>Win32Proj</Keyword>
+ <ProjectName>WumfPlug</ProjectName>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Plugins\</OutDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Configuration)64\Plugins\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\</IntDir>
+ <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</IgnoreImportLibrary>
+ <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</IgnoreImportLibrary>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
+ <GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</GenerateManifest>
+ <GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</GenerateManifest>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Plugins\</OutDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Configuration)64\Plugins\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\</IntDir>
+ <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</IgnoreImportLibrary>
+ <IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</IgnoreImportLibrary>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
+ <GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</GenerateManifest>
+ <GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</GenerateManifest>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>false</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ClCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>false</LinkLibraryDependencies>
+ </ProjectReference>
+ <Link>
+ <AdditionalDependencies>user32.lib;netapi32.lib;comdlg32.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <AssemblyDebug>true</AssemblyDebug>
+ <SubSystem>Windows</SubSystem>
+ <OptimizeReferences>
+ </OptimizeReferences>
+ <EntryPointSymbol>DllMain</EntryPointSymbol>
+ <TargetMachine>MachineX86</TargetMachine>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>false</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ClCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>false</LinkLibraryDependencies>
+ </ProjectReference>
+ <Link>
+ <AdditionalDependencies>user32.lib;netapi32.lib;comdlg32.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <AssemblyDebug>true</AssemblyDebug>
+ <SubSystem>Windows</SubSystem>
+ <OptimizeReferences>
+ </OptimizeReferences>
+ <EntryPointSymbol>DllMain</EntryPointSymbol>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_WIN32;_WINNT;_MBCS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>
+ </ExceptionHandling>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+ <DisableLanguageExtensions>false</DisableLanguageExtensions>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <CompileAs>CompileAsC</CompileAs>
+ <AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Optimization>Full</Optimization>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
+ </ClCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>false</LinkLibraryDependencies>
+ </ProjectReference>
+ <Link>
+ <AdditionalDependencies>user32.lib;netapi32.lib;comdlg32.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Windows</SubSystem>
+ <OptimizeReferences>
+ </OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <EntryPointSymbol>
+ </EntryPointSymbol>
+ <TargetMachine>MachineX86</TargetMachine>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_WIN32;_WINNT;_MBCS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>
+ </ExceptionHandling>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+ <DisableLanguageExtensions>false</DisableLanguageExtensions>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <CompileAs>CompileAsC</CompileAs>
+ <AdditionalIncludeDirectories>..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <Optimization>Full</Optimization>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
+ </ClCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>false</LinkLibraryDependencies>
+ </ProjectReference>
+ <Link>
+ <AdditionalDependencies>user32.lib;netapi32.lib;comdlg32.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Windows</SubSystem>
+ <OptimizeReferences>
+ </OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <EntryPointSymbol>
+ </EntryPointSymbol>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ </Link>
+ <ResourceCompile>
+ <AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClInclude Include="resource.h" />
+ <ClInclude Include="wumf.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="resource.rc" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="list.c" />
+ <ClCompile Include="resizer.c" />
+ <ClCompile Include="wumf.c" />
+ <ClCompile Include="wumfplug.c" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/plugins/WhoUsesMyFiles/wumf.vcxproj.filters b/plugins/WhoUsesMyFiles/wumf.vcxproj.filters
new file mode 100644
index 0000000000..923fdf838f
--- /dev/null
+++ b/plugins/WhoUsesMyFiles/wumf.vcxproj.filters
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx</Extensions>
+ </Filter>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="resource.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="wumf.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="resource.rc">
+ <Filter>Resource Files</Filter>
+ </ResourceCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="list.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="resizer.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="wumf.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="wumfplug.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/plugins/WhoUsesMyFiles/wumfplug.c b/plugins/WhoUsesMyFiles/wumfplug.c
new file mode 100644
index 0000000000..3e278e224e
--- /dev/null
+++ b/plugins/WhoUsesMyFiles/wumfplug.c
@@ -0,0 +1,629 @@
+#include "wumf.h"
+
+HINSTANCE hInst;
+PLUGINLINK *pluginLink;
+WUMF_OPTIONS WumfOptions = { 0 };
+const char ModuleName[] = "WUMF Plugin";
+HANDLE hMenuItem = 0;
+extern HANDLE hLog;
+static HWND hDlg;
+static int hWumfBut;
+extern PWumf list;
+
+static PLUGININFO pluginInfo = {
+ sizeof(PLUGININFO),
+ "WUMF: Who Use My Files?",
+ PLUGIN_MAKE_VERSION(0,1,0,1),
+ "Scans for network users of your shared files and notify you with popups. Uses PopUps Interoperability by Luca Santarelli. PopUps plugin must be activated!",
+ "Nikolay Redko",
+ "nike000@users.sf.net",
+ "© 2003 Nike. Freeware. Please mail me all bugs & your suggestions.",
+ "http://miranda-im.org",
+ 0,
+ 0
+};
+
+void LoadOptions()
+{
+ DBVARIANT dbv = { 0 };
+ dbv.type = DBVT_ASCIIZ;
+ ZeroMemory(&WumfOptions, sizeof(WumfOptions));
+ if (DBGetContactSetting(NULL, ModuleName, OPT_FILE, &dbv) == 0)
+ {
+ strncpy(WumfOptions.LogFile, dbv.pszVal, 255);
+ }
+ else
+ {
+ WumfOptions.LogFile[0] = '\0';
+ };
+ WumfOptions.PopupsEnabled = DBGetContactSettingByte(NULL,ModuleName, POPUPS_ENABLED, TRUE);
+
+ WumfOptions.UseDefColor = DBGetContactSettingByte(NULL,ModuleName, COLOR_DEF, TRUE);
+ WumfOptions.UseWinColor = DBGetContactSettingByte(NULL,ModuleName, COLOR_WIN, FALSE);
+ WumfOptions.SelectColor = DBGetContactSettingByte(NULL,ModuleName, COLOR_SET, FALSE);
+
+ WumfOptions.ColorText = DBGetContactSettingDword(NULL,ModuleName, COLOR_TEXT, RGB(0,0,0));
+ WumfOptions.ColorBack = DBGetContactSettingDword(NULL,ModuleName, COLOR_BACK, RGB(255,255,255));
+
+ WumfOptions.DelayDef = DBGetContactSettingByte(NULL,ModuleName, DELAY_DEF, TRUE);
+ WumfOptions.DelayInf = DBGetContactSettingByte(NULL,ModuleName, DELAY_INF, FALSE);
+ WumfOptions.DelaySet = DBGetContactSettingByte(NULL,ModuleName, DELAY_SET, FALSE);
+ WumfOptions.DelaySec = DBGetContactSettingByte(NULL,ModuleName, DELAY_SEC, 0);
+ if(!ServiceExists(MS_POPUP_ADDPOPUPEX))
+ {
+ WumfOptions.DelayDef = TRUE;
+ WumfOptions.DelaySet = FALSE;
+ WumfOptions.DelayInf = FALSE;
+ }
+ WumfOptions.LogToFile = DBGetContactSettingByte(NULL,ModuleName, LOG_INTO_FILE, FALSE);
+ WumfOptions.LogFolders = DBGetContactSettingByte(NULL,ModuleName, LOG_FOLDER, TRUE);
+ WumfOptions.AlertFolders = DBGetContactSettingByte(NULL,ModuleName, ALERT_FOLDER, TRUE);
+ WumfOptions.LogUNC = DBGetContactSettingByte(NULL,ModuleName, LOG_UNC, FALSE);
+ WumfOptions.AlertUNC = DBGetContactSettingByte(NULL,ModuleName, ALERT_UNC, FALSE);
+ WumfOptions.LogComp = DBGetContactSettingByte(NULL,ModuleName, LOG_COMP, FALSE);
+ WumfOptions.AlertComp = DBGetContactSettingByte(NULL,ModuleName, ALERT_COMP, FALSE);
+ return;
+}
+
+
+void ExecuteMenu(HWND hWnd)
+{
+ HMENU hMenu;
+ POINT point;
+
+ hMenu=CreatePopupMenu();
+ if(!hMenu)
+ {
+ MessageBox(NULL, "Error crerating menu", "WUMF",MB_OK);
+ return;
+ };
+ AppendMenu(hMenu,MF_STRING,IDM_ABOUT, "About\0");
+ AppendMenu(hMenu,MF_SEPARATOR,0,NULL);//------------------
+ AppendMenu(hMenu,MF_STRING,IDM_SHOW, "Show connections\0");
+ AppendMenu(hMenu,MF_SEPARATOR,0,NULL);//------------------
+ AppendMenu(hMenu,MF_STRING,IDM_EXIT, "Dismiss popup\0");
+
+ GetCursorPos (&point);
+ SetForegroundWindow (hWnd);
+
+ TrackPopupMenu (hMenu, TPM_LEFTBUTTON | TPM_RIGHTBUTTON | TPM_RIGHTALIGN | TPM_TOPALIGN,
+ point.x, point.y, 0, hWnd, NULL);
+
+ PostMessage (hWnd, WM_USER, 0, 0);
+ DestroyMenu(hMenu);
+}
+
+static int CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+// PWumf w = NULL;
+ switch(message) {
+ case WM_COMMAND:
+ switch (LOWORD(wParam))
+ {
+ case IDM_ABOUT:
+ break;
+ case IDM_EXIT:
+ PUDeletePopUp(hWnd);
+ break;
+ case IDM_SHOW:
+ CallService(MS_WUMF_CONNECTIONSSHOW, (WPARAM)0, (LPARAM)0);
+ return TRUE;
+ }
+ switch (HIWORD(wParam))
+ {
+ case STN_CLICKED:
+ PUDeletePopUp(hWnd);
+ return TRUE;
+ }
+ break;
+ case WM_CONTEXTMENU:
+// ExecuteMenu(hWnd);
+ CallService(MS_WUMF_CONNECTIONSSHOW, (WPARAM)0, (LPARAM)0);
+ break;
+ case UM_FREEPLUGINDATA: {
+/* w = (PWumf)CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hWnd,(LPARAM)w);
+ if(w) free(w);*/
+ return TRUE; //TRUE or FALSE is the same, it gets ignored.
+ }
+ default:
+ break;
+ }
+ return DefWindowProc(hWnd, message, wParam, lParam);
+};
+
+void ShowWumfPopUp(PWumf w)
+{
+ char text[512], title[512];
+
+ if(!WumfOptions.AlertFolders && (w->dwAttr & FILE_ATTRIBUTE_DIRECTORY)) return;
+ mir_snprintf(title, sizeof(title)/sizeof(title[0]), "%s (%s)", w->szComp, w->szUser);
+ mir_snprintf(text, sizeof(text)/sizeof(text[0]), "%s (%s)", w->szPath, w->szPerm);
+ ShowThePopUp(w, title, text);
+}
+void ShowThePopUp(PWumf w, LPSTR title, LPSTR text)
+{
+ POPUPDATAEX ppd = { 0 };
+ COLORREF colorBack;
+ COLORREF colorText;
+
+ colorBack = GetSysColor(COLOR_BTNFACE);
+ colorText = RGB(0,0,0);
+
+ ppd.lchContact = NULL;
+ ppd.lchIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_DRIVE));
+ ppd.iSeconds = -1;
+
+ if(WumfOptions.DelayInf)
+ {
+ ppd.iSeconds = -1;
+ }
+ else if(WumfOptions.DelayDef)
+ {
+ ppd.iSeconds = 0;
+ }
+ else if(WumfOptions.DelaySet)
+ {
+ ppd.iSeconds = WumfOptions.DelaySec;
+ }
+
+ lstrcpyn(ppd.lpzContactName, title, 128);
+ lstrcpyn(ppd.lpzText, text, 128);
+ if(WumfOptions.UseWinColor)
+ {
+ ppd.colorBack = GetSysColor(COLOR_WINDOW);
+ ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
+ }
+ else if(WumfOptions.UseDefColor)
+ {
+ ppd.colorBack = 0L;
+ ppd.colorText = 0L;
+ }
+ else if(WumfOptions.SelectColor)
+ {
+ ppd.colorBack = WumfOptions.ColorBack;
+ ppd.colorText = WumfOptions.ColorText;
+ }
+
+ ppd.PluginWindowProc = (WNDPROC)PopupDlgProc;
+ ppd.PluginData = w;
+ if(CALLSERVICE_NOTFOUND == CallService(MS_POPUP_ADDPOPUPEX, (WPARAM)&ppd, 0))
+ CallService(MS_POPUP_ADDPOPUP, (WPARAM)&ppd, 0);
+}
+
+void ShowThePreview()
+{
+ if(!ServiceExists(MS_POPUP_ADDPOPUP))
+ {
+ MessageBox(NULL,"PopUp plugin not found!", "WUMF plugin", MB_OK|MB_ICONSTOP);
+ return;
+ };
+ if(WumfOptions.AlertFolders)
+ {
+ ShowThePopUp(NULL, "Guest", "C:\\My Share");
+ Sleep(300);
+ ShowThePopUp(NULL, "Guest", "C:\\My Share\\Photos");
+ Sleep(300);
+ }
+ ShowThePopUp(NULL, "Guest", "C:\\Share\\My Photos\\photo.jpg");
+ Sleep(300);
+ if(WumfOptions.AlertFolders)
+ {
+ ShowThePopUp(NULL, "User", "C:\\My Share");
+ Sleep(300);
+ ShowThePopUp(NULL, "User", "C:\\My Share\\Movies");
+ Sleep(300);
+ }
+ ShowThePopUp(NULL, "User", "C:\\My Share\\Movies\\The Two Towers.avi");
+ Sleep(300);
+ if(WumfOptions.AlertFolders)
+ {
+ ShowThePopUp(NULL, "Administrator", "C:\\Distributives");
+ Sleep(300);
+ ShowThePopUp(NULL, "Administrator", "C:\\Distributives\\Win2k");
+ Sleep(300);
+ }
+ ShowThePopUp(NULL, "Administrator", "C:\\Distributives\\Win2k\\setup.exe");
+};
+
+
+
+BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)
+{
+ hInst=hinstDLL;
+ return TRUE;
+}
+
+DWORD WINAPI ThreadProc(LPVOID lpParameter)
+{
+ MSG msg; //Message pump.
+ if(hDlg)
+ {
+ ShowWindow(hDlg, SW_SHOWNORMAL);
+ SetForegroundWindow(hDlg);
+ return (int)(1);
+ }
+ hDlg = CreateDialog(hInst, MAKEINTRESOURCE(IDD_CONNLIST), NULL, (DLGPROC)ConnDlgProc);
+ SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(hInst,MAKEINTRESOURCE(IDI_DRIVE)));
+ ShowWindow(hDlg, SW_SHOW);
+ while(GetMessage(&msg, NULL, 0, 0) == TRUE)
+ {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
+ hDlg = NULL;
+ ExitThread(0);
+
+ return (int)(1);
+}
+
+
+static int WumfShowConnections(WPARAM wParam,LPARAM lParam)
+{
+ DWORD threadID = 0;
+ CloseHandle(CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)ThreadProc, (LPVOID)NULL,0,&threadID));
+ Sleep(100);
+ CallService(MS_TTB_SETBUTTONSTATE,hWumfBut,TTBST_RELEASED);
+ return 0;
+}
+
+static int WumfMenuCommand(WPARAM wParam,LPARAM lParam)
+{
+ BOOL MajorTo0121 = FALSE;
+ int iResult = 0;
+ CLISTMENUITEM mi = { 0 };
+
+ mi.cbSize = sizeof(mi);
+ if (WumfOptions.PopupsEnabled == TRUE)
+ {
+ WumfOptions.PopupsEnabled = FALSE;
+ mi.pszName = Translate("Enable WUMF popups");
+ mi.hIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_NOPOPUP));
+ }
+ else
+ {
+ WumfOptions.PopupsEnabled = TRUE;
+ mi.pszName = Translate("Disable WUMF popups");
+ mi.hIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_POPUP));
+ }
+ DBWriteContactSettingByte(NULL, ModuleName, POPUPS_ENABLED, (BYTE)WumfOptions.PopupsEnabled);
+ mi.flags = CMIM_NAME | CMIM_ICON;
+ iResult = CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hMenuItem,(LPARAM)&mi);
+ return iResult;
+}
+
+__EXP PLUGININFO* MirandaPluginInfo(DWORD mirandaVersion)
+{
+ return &pluginInfo;
+}
+
+void DisableDelayOptions(HWND hwndDlg)
+{
+ CheckDlgButton(hwndDlg, IDC_DELAY_INF,BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_DELAY_SET,BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_DELAY_DEF,BST_CHECKED);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DELAY_INF), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DELAY_SET), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DELAY_DEF), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DELAY_SEC), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_TX_DELAY_SEC), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DELAY_NOTE), TRUE);
+}
+void ChooseFile(HWND hDlg)
+{
+ OPENFILENAME ofn; // common dialog box structure
+ char szFile[260]; // buffer for filename
+ HANDLE hf; // file handle
+ // Initialize OPENFILENAME
+ ZeroMemory(&ofn, sizeof(OPENFILENAME));
+ ofn.lStructSize = sizeof(OPENFILENAME);
+ ofn.hwndOwner =hDlg;
+ szFile[0]=0;
+ ofn.lpstrFile = szFile;
+ ofn.nMaxFile = 260;
+ ofn.lpstrFilter = "All files (*.*)\0*.*\0Text files (*.txt)\0*.txt\0Log files (*.log)\0*.log\0\0";
+ ofn.nFilterIndex = 2;
+ ofn.lpstrFileTitle = NULL;
+ ofn.nMaxFileTitle = 0;
+ ofn.lpstrInitialDir = NULL;
+ ofn.Flags = OFN_CREATEPROMPT;
+ // Display the Open dialog box.
+ if (GetSaveFileName(&ofn)==TRUE)
+ {
+ hf = CreateFile(ofn.lpstrFile,
+ GENERIC_WRITE,
+ 0,
+ (LPSECURITY_ATTRIBUTES) NULL,
+ OPEN_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL,
+ (HANDLE) NULL);
+ if(hf!=INVALID_HANDLE_VALUE)
+ {
+ SetDlgItemText(hDlg,IDC_FILE,ofn.lpstrFile);
+ lstrcpyn(WumfOptions.LogFile, ofn.lpstrFile, 255);
+ CloseHandle(hf);
+ }
+ }
+ else if(CommDlgExtendedError()!=0L)
+ {
+ char str[256];
+ wsprintf(str,"Common Dialog Error 0x%lx",CommDlgExtendedError());
+ MessageBox(hDlg,str,"Wumf plugin",MB_OK|MB_ICONSTOP);
+ };
+
+};
+
+BOOL CALLBACK OptionsDlgProc(HWND hwndDlg,UINT msg,WPARAM wparam,LPARAM lparam)
+{
+ WORD wControlId = LOWORD(wparam);
+ WORD wNotifyCode = HIWORD(wparam);
+ int seconds;
+
+ switch(msg)
+ {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
+ CheckDlgButton(hwndDlg, IDC_COLOR_WIN, WumfOptions.UseWinColor?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_COLOR_DEF, WumfOptions.UseDefColor?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_COLOR_SET, WumfOptions.SelectColor?BST_CHECKED:BST_UNCHECKED);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR_BACK), WumfOptions.SelectColor);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR_TEXT), WumfOptions.SelectColor);
+ if(WumfOptions.SelectColor)
+ {
+ SendDlgItemMessage(hwndDlg,IDC_COLOR_BACK,CPM_SETCOLOUR,0,WumfOptions.ColorBack);
+ SendDlgItemMessage(hwndDlg,IDC_COLOR_TEXT,CPM_SETCOLOUR,0,WumfOptions.ColorText);
+ }
+ if(!ServiceExists(MS_POPUP_ADDPOPUPEX))
+ {
+ DisableDelayOptions(hwndDlg);
+ break;
+ }
+ CheckDlgButton(hwndDlg, IDC_DELAY_INF, WumfOptions.DelayInf?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_DELAY_DEF, WumfOptions.DelayDef?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_DELAY_SET, WumfOptions.DelaySet?BST_CHECKED:BST_UNCHECKED);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DELAY_SEC), WumfOptions.DelaySet);
+ SetDlgItemInt(hwndDlg, IDC_DELAY_SEC, WumfOptions.DelaySec, FALSE);
+ //Logging & alerts
+ CheckDlgButton(hwndDlg, IDC_LOG_FOLDER, WumfOptions.LogFolders?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_ALERT_FOLDER, WumfOptions.AlertFolders?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_LOG_UNC, WumfOptions.LogUNC?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_ALERT_UNC, WumfOptions.AlertUNC?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_LOG_COMP, WumfOptions.LogComp?BST_CHECKED:BST_UNCHECKED);
+
+ if(WumfOptions.LogToFile)
+ {
+ CheckDlgButton(hwndDlg,IDC_LOG_INTO_FILE,BST_CHECKED);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_FILE), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SEL_FILE), TRUE);
+ SetDlgItemText(hwndDlg,IDC_FILE,WumfOptions.LogFile);
+ }
+ else
+ {
+ CheckDlgButton(hwndDlg,IDC_LOG_INTO_FILE,BST_UNCHECKED);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_FILE), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SEL_FILE), FALSE);
+ SetDlgItemText(hwndDlg,IDC_FILE,"");
+ };
+
+ break;
+ case WM_COMMAND:
+ switch(wNotifyCode)
+ {
+ case BN_CLICKED :
+ switch(wControlId)
+ {
+ case IDC_DELAY_SET:
+ case IDC_DELAY_DEF:
+ case IDC_DELAY_INF:
+ WumfOptions.DelaySet = (IsDlgButtonChecked(hwndDlg, IDC_DELAY_SET) == BST_CHECKED);
+ WumfOptions.DelayDef = (IsDlgButtonChecked(hwndDlg, IDC_DELAY_DEF) == BST_CHECKED);
+ WumfOptions.DelayInf = (IsDlgButtonChecked(hwndDlg, IDC_DELAY_INF) == BST_CHECKED);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DELAY_SEC), WumfOptions.DelaySet);
+ SetDlgItemInt(hwndDlg, IDC_DELAY_SEC, WumfOptions.DelaySec, TRUE);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ case IDC_COLOR_SET:
+ case IDC_COLOR_DEF:
+ case IDC_COLOR_WIN:
+ WumfOptions.SelectColor = (IsDlgButtonChecked(hwndDlg, IDC_COLOR_SET) == BST_CHECKED);
+ WumfOptions.UseDefColor = (IsDlgButtonChecked(hwndDlg, IDC_COLOR_DEF) == BST_CHECKED);
+ WumfOptions.UseWinColor = (IsDlgButtonChecked(hwndDlg, IDC_COLOR_WIN) == BST_CHECKED);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR_BACK),WumfOptions.SelectColor);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR_TEXT), WumfOptions.SelectColor);
+ SendDlgItemMessage(hwndDlg,IDC_COLOR_BACK,CPM_SETCOLOUR,0,WumfOptions.ColorBack);
+ SendDlgItemMessage(hwndDlg,IDC_COLOR_TEXT,CPM_SETCOLOUR,0,WumfOptions.ColorText);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ /* not implemented */
+ case IDC_LOG_COMP:
+ case IDC_ALERT_COMP:
+ case IDC_LOG_UNC:
+ case IDC_ALERT_UNC:
+ MessageBox(NULL, "Not implemented yet...", "WUMF", MB_OK|MB_ICONINFORMATION);
+ break;
+ /* end */
+ case IDC_LOG_INTO_FILE:
+ WumfOptions.LogToFile = (IsDlgButtonChecked(hwndDlg, IDC_LOG_INTO_FILE) == BST_CHECKED);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_FILE), WumfOptions.LogToFile);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SEL_FILE), WumfOptions.LogToFile);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ case IDC_SEL_FILE:
+ ChooseFile(hwndDlg);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ case IDC_LOG_FOLDER:
+ WumfOptions.LogFolders = (IsDlgButtonChecked(hwndDlg, IDC_LOG_FOLDER) == BST_CHECKED);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ case IDC_ALERT_FOLDER:
+ WumfOptions.AlertFolders = (IsDlgButtonChecked(hwndDlg, IDC_ALERT_FOLDER) == BST_CHECKED);
+ break;
+/* case IDC_LOG_COMP:
+ WumfOptions.LogComp = (IsDlgButtonChecked(hwndDlg, IDC_LOG_COMP) == BST_CHECKED);
+ break;
+ case IDC_ALERT_COMP:
+ WumfOptions.AlertComp = (IsDlgButtonChecked(hwndDlg, IDC_ALERT_COMP) == BST_CHECKED);
+ break;
+ case IDC_LOG_UNC:
+ WumfOptions.LogUNC = (IsDlgButtonChecked(hwndDlg, IDC_LOG_UNC) == BST_CHECKED);
+ break;
+ case IDC_ALERT_UNC:
+ WumfOptions.AlertUNC = (IsDlgButtonChecked(hwndDlg, IDC_ALERT_UNC) == BST_CHECKED);
+ break;
+*/ case IDC_PREVIEW:
+ ShowThePreview();
+ break;
+ case IDC_CONN:
+ CallService(MS_WUMF_CONNECTIONSSHOW, (WPARAM)0, (LPARAM)0);
+ break;
+ }
+ break;
+ case CPN_COLOURCHANGED:
+ WumfOptions.ColorText = SendDlgItemMessage(hwndDlg,IDC_COLOR_TEXT,CPM_GETCOLOUR,0,0);
+ WumfOptions.ColorBack = SendDlgItemMessage(hwndDlg,IDC_COLOR_BACK,CPM_GETCOLOUR,0,0);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ case EN_CHANGE:
+ switch(wControlId)
+ {
+ case IDC_DELAY_SEC:
+ seconds = GetDlgItemInt(hwndDlg, IDC_DELAY_SEC, NULL, FALSE);
+ if (seconds > LIFETIME_MAX)
+ WumfOptions.DelaySec = LIFETIME_MAX;
+ else if (seconds < LIFETIME_MIN)
+ WumfOptions.DelaySec = LIFETIME_MIN;
+ else if (seconds <= LIFETIME_MAX || seconds >= LIFETIME_MIN)
+ WumfOptions.DelaySec = seconds;
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ case IDC_FILE:
+ GetDlgItemText(hwndDlg,IDC_FILE,WumfOptions.LogFile, sizeof(WumfOptions.LogFile));
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ }
+ break;
+ case EN_KILLFOCUS:
+ switch(wControlId)
+ {
+ case IDC_DELAY_SEC:
+ SetDlgItemInt(hwndDlg, IDC_DELAY_SEC, WumfOptions.DelaySec, FALSE);
+ break;
+ };
+ break;
+ }
+ break;
+ case WM_NOTIFY:
+ switch(((LPNMHDR)lparam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR)lparam)->code) {
+ case PSN_RESET:
+ LoadOptions();
+ return TRUE;
+ case PSN_APPLY:
+ DBWriteContactSettingByte(NULL,ModuleName, COLOR_DEF, (BYTE)WumfOptions.UseDefColor);
+ DBWriteContactSettingByte(NULL,ModuleName, COLOR_WIN, (BYTE)WumfOptions.UseWinColor);
+ DBWriteContactSettingByte(NULL,ModuleName, COLOR_SET, (BYTE)WumfOptions.SelectColor );
+ DBWriteContactSettingDword(NULL,ModuleName, COLOR_TEXT, (DWORD)WumfOptions.ColorText);
+ DBWriteContactSettingDword(NULL,ModuleName, COLOR_BACK, (DWORD)WumfOptions.ColorBack);
+ DBWriteContactSettingByte(NULL,ModuleName, DELAY_DEF, (BYTE)WumfOptions.DelayDef);
+ DBWriteContactSettingByte(NULL,ModuleName, DELAY_INF, (BYTE)WumfOptions.DelayInf);
+ DBWriteContactSettingByte(NULL,ModuleName, DELAY_SET, (BYTE)WumfOptions.DelaySet);
+ DBWriteContactSettingByte(NULL,ModuleName, DELAY_SEC, (BYTE)WumfOptions.DelaySec);
+ DBWriteContactSettingByte(NULL,ModuleName, LOG_INTO_FILE, (BYTE)WumfOptions.LogToFile);
+ DBWriteContactSettingByte(NULL,ModuleName, LOG_FOLDER, (BYTE)WumfOptions.LogFolders);
+ DBWriteContactSettingByte(NULL,ModuleName, ALERT_FOLDER, (BYTE)WumfOptions.AlertFolders);
+ DBWriteContactSettingByte(NULL,ModuleName, LOG_UNC, (BYTE)WumfOptions.LogUNC);
+ DBWriteContactSettingByte(NULL,ModuleName, ALERT_UNC, (BYTE)WumfOptions.AlertUNC);
+ DBWriteContactSettingByte(NULL,ModuleName, LOG_COMP, (BYTE)WumfOptions.LogComp);
+ DBWriteContactSettingByte(NULL,ModuleName, ALERT_COMP, (BYTE)WumfOptions.AlertComp);
+ GetDlgItemText(hwndDlg,IDC_FILE,WumfOptions.LogFile, 255);
+ DBWriteContactSettingString(NULL,ModuleName, OPT_FILE, WumfOptions.LogFile);
+ break;
+ }
+ break;
+ }
+ break;
+ }
+ return 0;
+}
+int InitTopToolbar(WPARAM wparam,LPARAM lparam)
+{
+ TTBButton ttb = { 0 };
+ char buttonname[] = "WUMF: Show connections list";
+ ttb.cbSize = sizeof(ttb);
+ ttb.hbBitmapUp = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_DRIVE));
+ ttb.hbBitmapDown = ttb.hbBitmapUp;
+ ttb.pszServiceUp = MS_WUMF_CONNECTIONSSHOW;
+ ttb.pszServiceDown = MS_WUMF_CONNECTIONSSHOW;;
+ ttb.dwFlags = TTBBF_VISIBLE|TTBBF_SHOWTOOLTIP|TTBBF_DRAWBORDER;
+ ttb.name = buttonname;
+ hWumfBut = CallService(MS_TTB_ADDBUTTON, (WPARAM)&ttb,(LPARAM)0);
+ return 0;
+}
+int OptionsInit(WPARAM wparam,LPARAM lparam)
+{
+ OPTIONSDIALOGPAGE odp = { 0 };
+
+
+ odp.cbSize=sizeof(odp);
+ odp.position=945000000;
+ odp.hInstance=hInst;
+ odp.pszTemplate=MAKEINTRESOURCE(IDD_OPTIONS);
+ odp.pszTitle="Wumf";
+ odp.pfnDlgProc=OptionsDlgProc;
+ odp.pszGroup=Translate("Plugins");
+ odp.flags=ODPF_BOLDGROUPS;
+ CallService(MS_OPT_ADDPAGE,wparam,(LPARAM)&odp);
+ return 0;
+}
+
+int __EXP Load(PLUGINLINK *link)
+{
+ CLISTMENUITEM mi = { 0 };
+
+ pluginLink=link;
+
+ ZeroMemory(&mi, sizeof(mi));
+ mi.cbSize = sizeof(mi);
+ LoadOptions();
+
+ CreateServiceFunction(MS_WUMF_SWITCHPOPUP,WumfMenuCommand);
+ CreateServiceFunction(MS_WUMF_CONNECTIONSSHOW,WumfShowConnections);
+ if (WumfOptions.PopupsEnabled == FALSE)
+ {
+ mi.pszName = Translate("Enable WUMF popups");
+ mi.hIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_NOPOPUP));
+ }
+ else
+ {
+ mi.pszName = Translate("Disable WUMF popups");
+ mi.hIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_POPUP));
+ }
+ mi.pszService = MS_WUMF_SWITCHPOPUP;
+ mi.popupPosition = 1999990000;
+ mi.pszPopupName = Translate("PopUps");
+ hMenuItem = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM, (WPARAM)0, (LPARAM)&mi);
+
+ mi.pszName = Translate("WUMF: Show connections");
+ mi.hIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_DRIVE));
+ mi.pszService = MS_WUMF_CONNECTIONSSHOW;
+ mi.popupPosition = 1999990000;
+ mi.pszPopupName = NULL;
+ CallService(MS_CLIST_ADDMAINMENUITEM, (WPARAM)0, (LPARAM)&mi);
+
+ HookEvent(ME_OPT_INITIALISE,OptionsInit);
+ HookEvent(ME_TTB_MODULELOADED, InitTopToolbar);
+ setlocale( LC_ALL, ".ACP");
+// _setmbcp(_MB_CP_ANSI);
+ SetTimer(NULL, 777, TIME,(TIMERPROC) TimerProc);
+ return 0;
+
+}
+
+int __EXP Unload(void)
+{
+ KillTimer(NULL, 777);
+ CloseHandle(hLog);
+ FreeAll();
+ return 0;
+} \ No newline at end of file