Changeset 256


Ignore:
Timestamp:
Jan 17, 2014, 10:25:19 AM (9 years ago)
Author:
roman
Message:
  • fallback to logging to AppData? if log file in Common AppData? is not accessible
  • added log mailer with Bzip2 compression for log data
  • paste into From field checked against single persistence string for the entire message object, for quick setting
  • cosmetic minor changes
Location:
trunk/DirectShowSpy
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/DirectShowSpy/DirectShowSpy.rc

    r251 r256  
    5959
    6060VS_VERSION_INFO VERSIONINFO
    61  FILEVERSION  1, 0, 0, 1248
     61 FILEVERSION  1, 0, 0, 1293
    6262 PRODUCTVERSION 1,0,0,1
    6363 FILEFLAGSMASK 0x3fL
     
    7878            VALUE "CompanyName", "Roman Ryltsov"
    7979            VALUE "FileDescription", "Alax.Info DirectShow Spy Module"
    80             VALUE "FileVersion",  "1, 0, 0, 1248\0"
     80            VALUE "FileVersion",  "1, 0, 0, 1293\0"
    8181            VALUE "InternalName", "DirectShowSpy.dll"
    8282            VALUE "LegalCopyright", "Copyright © Alax.Info, Roman Ryltsov, 2008-2014"
     
    296296END
    297297
     298IDD_FILTERGRAPHHELPER_EMAIL_LOG DIALOGEX 0, 0, 374, 254
     299STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
     300EXSTYLE WS_EX_CONTROLPARENT
     301FONT 8, "MS Shell Dlg", 400, 0, 0x0
     302BEGIN
     303    LTEXT           "Email Attachments: Log Files",IDC_FILTERGRAPHHELPER_EMAIL_LOG_TITLE,6,0,294,18
     304    CONTROL         "",IDC_FILTERGRAPHHELPER_EMAIL_LOG_FILE,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,6,42,360,168
     305    LTEXT           "Use controls below to specify log files to attach to the email to be sent. The files will be BZip2 compressed. ",IDC_FILTERGRAPHHELPER_EMAIL_LOG_INTRODUCTION,6,24,360,8,0,WS_EX_TRANSPARENT
     306    LTEXT           "&Truncation Policy: ",IDC_FILTERGRAPHHELPER_EMAIL_LOG_TRUNCATETITLE,12,218,60,8
     307    COMBOBOX        IDC_FILTERGRAPHHELPER_EMAIL_LOG_TRUNCATE,78,216,192,120,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
     308    LTEXT           "&Deletion Policy: ",IDC_FILTERGRAPHHELPER_EMAIL_LOG_DELETETITLE,12,236,52,8
     309    COMBOBOX        IDC_FILTERGRAPHHELPER_EMAIL_LOG_DELETE,78,234,192,120,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
     310END
     311
    298312
    299313/////////////////////////////////////////////////////////////////////////////
     
    327341        RIGHTMARGIN, 368
    328342        BOTTOMMARGIN, 200
     343    END
     344
     345    IDD_FILTERGRAPHHELPER_EMAIL_LOG, DIALOG
     346    BEGIN
     347        RIGHTMARGIN, 366
     348        BOTTOMMARGIN, 248
    329349    END
    330350END
     
    474494END
    475495
     496STRINGTABLE
     497BEGIN
     498    IDC_FILTERGRAPHHELPER_EMAIL_LOG_FILE
     499                            "v, 1\nx, 0x424, 0x424\nc, File Name, 210, -1\nc, Size, 150, 1, ""f, 1""\nc, Update Time, 180, 2\nc, Directory, 240, 3\n"
     500END
     501
     502STRINGTABLE
     503BEGIN
     504    IDC_FILTERGRAPHHELPER_EMAIL_LOG_TRUNCATE
     505                            "Attach up to Most Recent 1 MB per File\nAttach up to Most Recent 10 MB per File\nAttach up to Most Recent 25 MB per File\nAttach up to Most Recent 50 MB per File\n"
     506    IDC_FILTERGRAPHHELPER_EMAIL_LOG_DELETE
     507                            "Leave Sent Files Intact\nAttempt to Delete Sent Files\n"
     508END
     509
    476510#endif    // English (United States) resources
    477511/////////////////////////////////////////////////////////////////////////////
  • trunk/DirectShowSpy/DirectShowSpy.vcxproj

    r233 r256  
    103103    <IgnoreImportLibrary>true</IgnoreImportLibrary>
    104104    <LinkIncremental>true</LinkIncremental>
     105    <IncludePath>..\..\Repository-Private\Utilities\DeflateTools\bzip2-1.0.6;$(IncludePath)</IncludePath>
    105106  </PropertyGroup>
    106107  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
     
    109110    <IgnoreImportLibrary>true</IgnoreImportLibrary>
    110111    <LinkIncremental>true</LinkIncremental>
     112    <IncludePath>..\..\Repository-Private\Utilities\DeflateTools\bzip2-1.0.6;$(IncludePath)</IncludePath>
    111113  </PropertyGroup>
    112114  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     
    115117    <IgnoreImportLibrary>true</IgnoreImportLibrary>
    116118    <LinkIncremental>false</LinkIncremental>
     119    <IncludePath>..\..\Repository-Private\Utilities\DeflateTools\bzip2-1.0.6;$(IncludePath)</IncludePath>
    117120  </PropertyGroup>
    118121  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
     
    121124    <IgnoreImportLibrary>true</IgnoreImportLibrary>
    122125    <LinkIncremental>false</LinkIncremental>
     126    <IncludePath>..\..\Repository-Private\Utilities\DeflateTools\bzip2-1.0.6;$(IncludePath)</IncludePath>
    123127  </PropertyGroup>
    124128  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Trace|Win32'">
     
    127131    <IgnoreImportLibrary>true</IgnoreImportLibrary>
    128132    <LinkIncremental>false</LinkIncremental>
     133    <IncludePath>..\..\Repository-Private\Utilities\DeflateTools\bzip2-1.0.6;$(IncludePath)</IncludePath>
    129134  </PropertyGroup>
    130135  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Trace|x64'">
     
    133138    <IgnoreImportLibrary>true</IgnoreImportLibrary>
    134139    <LinkIncremental>false</LinkIncremental>
     140    <IncludePath>..\..\Repository-Private\Utilities\DeflateTools\bzip2-1.0.6;$(IncludePath)</IncludePath>
    135141  </PropertyGroup>
    136142  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     
    169175      <SubSystem>Windows</SubSystem>
    170176      <TargetMachine>MachineX86</TargetMachine>
     177      <AdditionalLibraryDirectories>..\..\Repository-Private\Utilities\DeflateTools\_Bin</AdditionalLibraryDirectories>
    171178    </Link>
    172179  </ItemDefinitionGroup>
     
    205212      <SubSystem>Windows</SubSystem>
    206213      <TargetMachine>MachineX64</TargetMachine>
     214      <AdditionalLibraryDirectories>..\..\Repository-Private\Utilities\DeflateTools\_Bin</AdditionalLibraryDirectories>
    207215    </Link>
    208216  </ItemDefinitionGroup>
     
    250258      <EnableCOMDATFolding>true</EnableCOMDATFolding>
    251259      <TargetMachine>MachineX86</TargetMachine>
     260      <AdditionalLibraryDirectories>..\..\Repository-Private\Utilities\DeflateTools\_Bin</AdditionalLibraryDirectories>
    252261    </Link>
    253262  </ItemDefinitionGroup>
     
    294303      <EnableCOMDATFolding>true</EnableCOMDATFolding>
    295304      <TargetMachine>MachineX64</TargetMachine>
     305      <AdditionalLibraryDirectories>..\..\Repository-Private\Utilities\DeflateTools\_Bin</AdditionalLibraryDirectories>
    296306    </Link>
    297307  </ItemDefinitionGroup>
     
    339349      <EnableCOMDATFolding>true</EnableCOMDATFolding>
    340350      <TargetMachine>MachineX86</TargetMachine>
     351      <AdditionalLibraryDirectories>..\..\Repository-Private\Utilities\DeflateTools\_Bin</AdditionalLibraryDirectories>
    341352    </Link>
    342353  </ItemDefinitionGroup>
     
    383394      <EnableCOMDATFolding>true</EnableCOMDATFolding>
    384395      <TargetMachine>MachineX64</TargetMachine>
     396      <AdditionalLibraryDirectories>..\..\Repository-Private\Utilities\DeflateTools\_Bin</AdditionalLibraryDirectories>
    385397    </Link>
    386398  </ItemDefinitionGroup>
  • trunk/DirectShowSpy/DirectShowSpy_i.c

    r251 r256  
    77
    88 /* File created by MIDL compiler version 7.00.0555 */
    9 /* at Sun Jan 12 15:13:15 2014
     9/* at Fri Jan 17 17:28:17 2014
    1010 */
    1111/* Compiler settings for DirectShowSpy.idl:
  • trunk/DirectShowSpy/DirectShowSpy_i.h

    r251 r256  
    55
    66 /* File created by MIDL compiler version 7.00.0555 */
    7 /* at Sun Jan 12 15:13:15 2014
     7/* at Fri Jan 17 17:28:17 2014
    88 */
    99/* Compiler settings for DirectShowSpy.idl:
  • trunk/DirectShowSpy/DirectShowSpy_p.c

    r251 r256  
    55
    66 /* File created by MIDL compiler version 7.00.0555 */
    7 /* at Sun Jan 12 15:13:15 2014
     7/* at Fri Jan 17 17:28:17 2014
    88 */
    99/* Compiler settings for DirectShowSpy.idl:
  • trunk/DirectShowSpy/FilterGraphHelper.h

    r249 r256  
    1111#include "AboutDialog.h"
    1212#include "..\..\Repository-Private\Utilities\EmailTools\Message.h"
     13#define  BZ_NO_STDIO
     14#include "..\..\Repository-Private\Utilities\DeflateTools\Bzip2Item.h"
    1315
    1416INT_PTR DoFilterGraphListPropertySheetModal(HWND hParentWindow);
     
    335337
    336338                ////////////////////////////////////////////////////
     339                // CEmailLogDialog
     340
     341                class CEmailLogDialog :
     342                        public CDialogImpl<CEmailLogDialog>,
     343                        public CDialogResize<CEmailLogDialog>
     344                {
     345                public:
     346                        enum { IDD = IDD_FILTERGRAPHHELPER_EMAIL_LOG };
     347
     348                BEGIN_MSG_MAP_EX(CEmailLogDialog)
     349                        //CHAIN_MSG_MAP(CDialogImpl<CEmailLogDialog>)
     350                        CHAIN_MSG_MAP(CDialogResize<CEmailLogDialog>)
     351                        MSG_WM_INITDIALOG(OnInitDialog)
     352                        MSG_LVN_GETDISPINFO(IDC_FILTERGRAPHHELPER_EMAIL_LOG_FILE, OnFileListViewGetDispInfo)
     353                        //MSG_LVN_GETINFOTIP()
     354                        MSG_LVN_ITEMCHANGED(IDC_FILTERGRAPHHELPER_EMAIL_LOG_FILE, OnFileListViewItemChanged)
     355                        //COMMAND_HANDLER_EX(IDC_FILTERGRAPHHELPER_EMAIL_LOG_TRUNCATE, CBN_CHANGE, OnChanged)
     356                        //COMMAND_HANDLER_EX(IDC_FILTERGRAPHHELPER_EMAIL_LOG_DELETE, CBN_CHANGE, OnChanged)
     357                        REFLECT_NOTIFICATIONS()
     358                END_MSG_MAP()
     359
     360                BEGIN_DLGRESIZE_MAP(CEmailLogDialog)
     361                        DLGRESIZE_CONTROL(IDC_FILTERGRAPHHELPER_EMAIL_LOG_FILE, DLSZ_SIZE_X | DLSZ_SIZE_Y)
     362                        DLGRESIZE_CONTROL(IDC_FILTERGRAPHHELPER_EMAIL_LOG_TRUNCATETITLE, DLSZ_MOVE_Y)
     363                        DLGRESIZE_CONTROL(IDC_FILTERGRAPHHELPER_EMAIL_LOG_TRUNCATE, DLSZ_MOVE_Y)
     364                        DLGRESIZE_CONTROL(IDC_FILTERGRAPHHELPER_EMAIL_LOG_DELETETITLE, DLSZ_MOVE_Y)
     365                        DLGRESIZE_CONTROL(IDC_FILTERGRAPHHELPER_EMAIL_LOG_DELETE, DLSZ_MOVE_Y)
     366                END_DLGRESIZE_MAP()
     367
     368                public:
     369
     370                        ////////////////////////////////////////////////
     371                        // CFileData
     372
     373                        class CFileData
     374                        {
     375                        public:
     376                                UINT m_nLocation;
     377                                CPath m_sPath;
     378                                ULONGLONG m_nSize;
     379                                FILETIME m_UpdateTime;
     380
     381                        public:
     382                        // CFileData
     383                                CFileData(UINT nLocation, LPCTSTR pszDirectory, WIN32_FIND_DATA FindData)
     384                                {
     385                                        m_nLocation = nLocation;
     386                                        m_sPath.Combine(pszDirectory, FindData.cFileName);
     387                                        m_nSize = ((ULONGLONG) FindData.nFileSizeHigh << 32) + FindData.nFileSizeLow;
     388                                        m_UpdateTime = FindData.ftLastWriteTime;
     389                                }
     390                                FILETIME GetLocalUpdateTime() const
     391                                {
     392                                        FILETIME UpdateTime;
     393                                        _W(FileTimeToLocalFileTime(&m_UpdateTime, &UpdateTime));
     394                                        return UpdateTime;
     395                                }
     396                        };
     397
     398                        ////////////////////////////////////////////////
     399                        // CFileDataSortTraits
     400
     401                        class CFileDataSortTraits :
     402                                public CDefaultSortTraitsT<CFileData>
     403                        {
     404                        public:
     405                        // CFileDataSortTraits
     406                                static INT_PTR CompareElements(const CFileData& FileData1, const CFileData& FileData2, PARAMETERARGUMENT Parameter)
     407                                {
     408                                        const INT nLocation = FileData1.m_nLocation - FileData2.m_nLocation;
     409                                        if(nLocation)
     410                                                return nLocation;
     411                                        return _tcsicmp(FindFileName(FileData1.m_sPath), FindFileName(FileData2.m_sPath));
     412                                }
     413                        };
     414
     415                        ////////////////////////////////////////////////
     416                        // CFileDataArray
     417
     418                        class CFileDataArray :
     419                                public CRoArrayT<CFileData>
     420                        {
     421                        public:
     422                        // CFileDataArray
     423                                static BOOL CompareLocation(const CFileData& FileData, UINT nLocation)
     424                                {
     425                                        return FileData.m_nLocation == nLocation;
     426                                }
     427                                SIZE_T GetCountForLocation(UINT nLocation)
     428                                {
     429                                        return GetCountThatT<UINT>(&CFileDataArray::CompareLocation, nLocation);
     430                                }
     431                        };
     432
     433                        ////////////////////////////////////////////////
     434                        // CSelectedFileData
     435
     436                        class CSelectedFileData
     437                        {
     438                        public:
     439                                CPath m_sPath;
     440                                CString m_sName;
     441
     442                        public:
     443                        // CSelectedFileData
     444                        };
     445
     446                private:
     447                        CPropertyFrameDialog* m_pOwner;
     448                        BOOL m_bActivating;
     449                        CStatic m_TitleStatic;
     450                        CFont m_TitleFont;
     451                        CRoListViewT<CFileData, CRoListControlDataTraitsT> m_FileListView;
     452                        INT m_nFileListViewGroupViewEnabled;
     453                        CRoComboBoxT<> m_TruncateComboBox;
     454                        CRoComboBoxT<> m_DeleteComboBox;
     455                        CRoMapT<INT_PTR, BOOL> m_ChangeMap;
     456
     457                public:
     458                // CEmailLogDialog
     459                        CEmailLogDialog()
     460                        {
     461                        }
     462                        VOID UpdateControls()
     463                        {
     464                        }
     465                        VOID InitializeFileListView()
     466                        {
     467                                CWindowRedraw FileListViewRedraw(m_FileListView);
     468                                m_FileListView.DeleteAllItems();
     469                                m_FileListView.DeleteAllGroups();
     470                                #pragma region File
     471                                CFileDataArray FileDataArray;
     472                                static DWORD g_pnLocations[] =
     473                                {
     474                                        CSIDL_COMMON_APPDATA,
     475                                        CSIDL_APPDATA,
     476                                };
     477                                for(SIZE_T nLocationIndex = 0; nLocationIndex < DIM(g_pnLocations); nLocationIndex++)
     478                                        _ATLTRY
     479                                        {
     480                                                TCHAR pszDirectory[MAX_PATH] = { 0 };
     481                                                if(!SHGetSpecialFolderPath(NULL, pszDirectory, g_pnLocations[nLocationIndex], FALSE))
     482                                                        continue;
     483                                                CFindFiles FindFiles;
     484                                                for(BOOL bFound = FindFiles.FindFirstFile(pszDirectory, _T("*.log")); bFound; bFound = FindFiles.FindNextFile())
     485                                                {
     486                                                        const WIN32_FIND_DATA& Data = FindFiles.GetFindData();
     487                                                        FileDataArray.Add(CFileData((UINT) nLocationIndex, pszDirectory, Data));
     488                                                }
     489                                        }
     490                                        _ATLCATCHALL()
     491                                        {
     492                                                _Z_EXCEPTION();
     493                                        }
     494                                _SortHelper::QuickSort<CFileDataSortTraits>(FileDataArray);
     495                                if(m_nFileListViewGroupViewEnabled >= 0)
     496                                {
     497                                        if(FileDataArray.GetCountForLocation(0))
     498                                                m_FileListView.InsertGroup(0, 0, _T("Local Machine (Common AppData)"));
     499                                        if(FileDataArray.GetCountForLocation(1))
     500                                                m_FileListView.InsertGroup(1, 1, _T("Current User (AppData)"));
     501                                }
     502                                CPath sPrivateLogFileName = FindFileName(GetModulePath());
     503                                sPrivateLogFileName.RenameExtension(_T(".log"));
     504                                for(SIZE_T nIndex = 0; nIndex < FileDataArray.GetCount(); nIndex++)
     505                                {
     506                                        CFileData& FileData = FileDataArray[nIndex];
     507                                        INT nItem;
     508                                        if(m_nFileListViewGroupViewEnabled >= 0)
     509                                                nItem = m_FileListView.InsertGroupItem(m_FileListView.GetItemCount(), FileData.m_nLocation, FileData);
     510                                        else
     511                                                nItem = m_FileListView.InsertItem(m_FileListView.GetItemCount(), FileData);
     512                                        if(_tcsicmp(FindFileName(FileData.m_sPath), sPrivateLogFileName) == 0)
     513                                                m_FileListView.SetCheckState(nItem, TRUE);
     514                                }
     515                        }
     516                        SIZE_T GetFiles(CRoArrayT<CSelectedFileData>& Array)
     517                        {
     518                                _A(Array.IsEmpty());
     519                                for(INT nItem = 0; nItem < m_FileListView.GetItemCount(); nItem++)
     520                                {
     521                                        if(!m_FileListView.GetCheckState(nItem))
     522                                                continue;
     523                                        const CFileData& FileData = m_FileListView.GetItemData(nItem);
     524                                        CSelectedFileData SelectedFileData;
     525                                        SelectedFileData.m_sPath = FileData.m_sPath;
     526                                        CPath sName = FindFileName(FileData.m_sPath);
     527                                        if(FileData.m_nLocation == 1)
     528                                        {
     529                                                CString sExtention = FindExtension(sName);
     530                                                sName.RemoveExtension();
     531                                                sName = (LPCTSTR) AtlFormatString(_T("%s (%s)%s"), sName, _T("Current User"), sExtention);
     532                                        }
     533                                        SelectedFileData.m_sName = (LPCTSTR) sName;
     534                                        Array.Add(SelectedFileData);
     535                                }
     536                                return Array.GetCount();
     537                        }
     538                        ULONGLONG GetTruncateSize()
     539                        {
     540                                static const ULONGLONG g_pnTruncateSizes[] =
     541                                {
     542                                         1i64 << 20, //  1 MB
     543                                        10i64 << 20, // 10 MB
     544                                        25i64 << 20, // 25 MB
     545                                        50i64 << 20, // 50 MB
     546                                };
     547                                const INT nItem = m_TruncateComboBox.GetCurSel();
     548                                _A(nItem >= 0 && nItem < DIM(g_pnTruncateSizes));
     549                                return g_pnTruncateSizes[nItem];
     550                        }
     551                        BOOL GetDelete()
     552                        {
     553                                return m_DeleteComboBox.GetCurSel() == 1;
     554                        }
     555
     556                // Window Message Handler
     557                        LRESULT OnInitDialog(HWND, LPARAM lParam)
     558                        {
     559                                m_pOwner = (CPropertyFrameDialog*) lParam;
     560                                m_bActivating = TRUE;
     561                                _ATLTRY
     562                                {
     563                                        CWaitCursor WaitCursor;
     564                                        m_TitleStatic = GetDlgItem(IDC_FILTERGRAPHHELPER_EMAIL_LOG_TITLE);
     565                                        CreateTitleFont(m_TitleFont, m_TitleStatic);
     566                                        m_FileListView.Initialize(GetDlgItem(IDC_FILTERGRAPHHELPER_EMAIL_LOG_FILE));
     567                                        m_nFileListViewGroupViewEnabled = m_FileListView.EnableGroupView(TRUE);
     568                                        m_TruncateComboBox.Initialize(GetDlgItem(IDC_FILTERGRAPHHELPER_EMAIL_LOG_TRUNCATE));
     569                                        m_DeleteComboBox.Initialize(GetDlgItem(IDC_FILTERGRAPHHELPER_EMAIL_LOG_DELETE));
     570                                        DlgResize_Init(FALSE, FALSE);
     571                                        InitializeFileListView();
     572                                        m_FileListView.SetColumnWidth(3, LVSCW_AUTOSIZE);
     573                                        m_TruncateComboBox.SetCurSel(2);
     574                                        m_DeleteComboBox.SetCurSel(0);
     575                                        UpdateControls();
     576                                        m_bActivating = FALSE;
     577                                }
     578                                _ATLCATCH(Exception)
     579                                {
     580                                        for(CWindow Window = GetWindow(GW_CHILD); Window; Window = Window.GetWindow(GW_HWNDNEXT))
     581                                                Window.EnableWindow(FALSE);
     582                                        AtlExceptionMessageBox(m_hWnd, Exception);
     583                                }
     584                                return TRUE;
     585                        }
     586                        LRESULT OnChanged(UINT, INT_PTR nIdentifier, HWND)
     587                        {
     588                                if(m_bActivating)
     589                                        return 0;
     590                                m_ChangeMap[nIdentifier] = TRUE;
     591                                UpdateControls();
     592                                return 0;
     593                        }
     594                        LRESULT OnChanged(NMHDR* pHeader)
     595                        {
     596                                return OnChanged(pHeader->code, pHeader->idFrom, pHeader->hwndFrom);
     597                        }
     598                        LRESULT OnFileListViewGetDispInfo(NMLVDISPINFO* pHeader)
     599                        {
     600                                const CFileData& FileData = m_FileListView.DataFromParameter(pHeader->item.lParam);
     601                                if(pHeader->item.mask & LVIF_TEXT)
     602                                {
     603                                        CString& sTextBuffer = m_FileListView.GetTextBufferString(TRUE);
     604                                        switch(pHeader->item.iSubItem)
     605                                        {
     606                                        case 1: // Size
     607                                                sTextBuffer = _StringHelper::FormatNumber((LONGLONG) FileData.m_nSize);
     608                                                break;
     609                                        case 2: // Update Time
     610                                                sTextBuffer = _StringHelper::FormatDateTime(FileData.GetLocalUpdateTime());
     611                                                break;
     612                                        case 3: // Directory
     613                                                sTextBuffer = (LPCTSTR) GetPathDirectory(FileData.m_sPath);
     614                                                break;
     615                                        default: // File Name
     616                                                sTextBuffer = FindFileName(FileData.m_sPath);
     617                                        }
     618                                        pHeader->item.pszText = m_FileListView.GetTextBuffer();
     619                                }
     620                                return 0;
     621                        }
     622                        LRESULT OnFileListViewItemChanged(NMLISTVIEW* pHeader)
     623                        {
     624                                return m_FileListView.OnReflectedItemChanged(pHeader);
     625                        }
     626                };
     627
     628                ////////////////////////////////////////////////////
    337629                // CEmailDialog
    338630
     
    360652                        NOTIFY_HANDLER_EX(IDC_FILTERGRAPHHELPER_EMAIL_CLEANUP, CRoHyperStatic::NC_ANCHORCLICKED, OnCleanupStaticAnchorClicked)
    361653                        REFLECT_NOTIFICATIONS()
     654                ALT_MSG_MAP(IDC_FILTERGRAPHHELPER_EMAIL_FROM)
     655                        MSG_WM_PASTE(OnFromEditPaste)
    362656                END_MSG_MAP()
    363657
     
    373667                        CStatic m_TitleStatic;
    374668                        CFont m_TitleFont;
    375                         CRoEdit m_FromEdit;
     669                        CContainedWindowT<CRoEdit> m_FromEdit;
    376670                        CRoEdit m_ToEdit;
    377671                        CRoComboBoxT<> m_MethodComboBox;
     
    387681                public:
    388682                // CEmailDialog
    389                         VOID InitializeControlsFromRegistry()
    390                         {
    391                                 const CString sMessageString = _RegKeyHelper::QueryStringValue(HKEY_CURRENT_USER, REGISTRY_ROOT, _T("Email Message Template"));
    392                                 if(sMessageString.IsEmpty())
    393                                         return;
     683                        CEmailDialog() :
     684                                m_FromEdit(this, IDC_FILTERGRAPHHELPER_EMAIL_FROM)
     685                        {
     686                        }
     687                        BOOL InitializeControlsFromMessageString(const CString& sMessageString)
     688                        {
    394689                                _ATLTRY
    395690                                {
     
    448743                                {
    449744                                        _Z_EXCEPTION();
    450                                 }
     745                                        return FALSE;
     746                                }
     747                                return TRUE;
     748                        }
     749                        VOID InitializeControlsFromRegistry()
     750                        {
     751                                const CString sMessageString = _RegKeyHelper::QueryStringValue(HKEY_CURRENT_USER, REGISTRY_ROOT, _T("Email Message Template"));
     752                                if(sMessageString.IsEmpty())
     753                                        return;
     754                                InitializeControlsFromMessageString(sMessageString);
    451755                        }
    452756                        VOID InitializeBody()
     
    501805                                        sText += AtlFormatString(_T(" * ") _T("Version: %s") _T("\r\n"), _StringHelper::Join(VersionArray, _T("; ")));
    502806                                        #pragma endregion
    503                                         TCHAR pszComputerName[256] = { 0 };
    504                                         DWORD nComputerNameLength = DIM(pszComputerName);
    505                                         GetComputerName(pszComputerName, &nComputerNameLength);
    506                                         sText += AtlFormatString(_T(" * ") _T("Computer Name: %s") _T("\r\n"), I(pszComputerName));
     807                                        sText += AtlFormatString(_T(" * ") _T("Computer Name: %s") _T("\r\n"), I(GetComputerName()));
    507808                                        TCHAR pszUserName[256] = { 0 };
    508809                                        DWORD nUserNameLength = DIM(pszUserName);
     
    581882                                m_SendButton.EnableWindow(bAllowSend);
    582883                        }
     884                        static CString GetComputerName()
     885                        {
     886                                TCHAR pszComputerName[256] = { 0 };
     887                                DWORD nComputerNameLength = DIM(pszComputerName);
     888                                ::GetComputerName(pszComputerName, &nComputerNameLength);
     889                                return pszComputerName;
     890                        }
    583891
    584892                // Window Message Handler
     
    592900                                        m_TitleStatic = GetDlgItem(IDC_FILTERGRAPHHELPER_EMAIL_TITLE);
    593901                                        CreateTitleFont(m_TitleFont, m_TitleStatic);
    594                                         m_FromEdit = GetDlgItem(IDC_FILTERGRAPHHELPER_EMAIL_FROM);
     902                                        _W(m_FromEdit.SubclassWindow(GetDlgItem(IDC_FILTERGRAPHHELPER_EMAIL_FROM)));
    595903                                        m_ToEdit = GetDlgItem(IDC_FILTERGRAPHHELPER_EMAIL_TO);
    596904                                        m_MethodComboBox.Initialize(GetDlgItem(IDC_FILTERGRAPHHELPER_EMAIL_METHOD));
     
    639947                        {
    640948                                return OnChanged(pHeader->code, pHeader->idFrom, pHeader->hwndFrom);
     949                        }
     950                        LRESULT OnFromEditPaste()
     951                        {
     952                                _ATLTRY
     953                                {
     954                                        CString sText;
     955                                        if(GetClipboardText(m_hWnd, sText))
     956                                        {
     957                                                const INT nLength = sText.GetLength();
     958                                                if(nLength >= 128 && nLength < 8192)
     959                                                {
     960                                                        sText.Trim();
     961                                                        const BOOL bResult = InitializeControlsFromMessageString(sText);
     962                                                        UpdateControls();
     963                                                        if(bResult)
     964                                                                return 0;
     965                                                }
     966                                        }
     967                                }
     968                                _ATLCATCHALL()
     969                                {
     970                                        MessageBeep(MB_ICONERROR);
     971                                }
     972                                return 0;
    641973                        }
    642974                        LRESULT OnSend(UINT, INT, HWND)
     
    6971029                                sText += m_sFilterGraphText;
    6981030                                __C(pMessage->put_Body(CComBSTR(sText)));
    699                                 CString sSubject = AtlFormatString(_T("DirectShow Filter Graph by %s"), AtlLoadString(IDS_PROJNAME));
     1031                                CString sSubject = AtlFormatString(_T("DirectShow Filter Graph from %s by %s"), GetComputerName(), AtlLoadString(IDS_PROJNAME));
    7001032                                __C(pMessage->put_Subject(CComBSTR(sSubject)));
     1033                                #pragma region Attachment
     1034                                CRoArrayT<CPath> DeleteArray;
     1035                                {
     1036                                        CEmailLogDialog& EmailLogDialog = m_pOwner->m_EmailLogDialog;
     1037                                        CRoArrayT<CEmailLogDialog::CSelectedFileData> Array;
     1038                                        if(EmailLogDialog.GetFiles(Array))
     1039                                        {
     1040                                                const ULONGLONG nTruncateSize = EmailLogDialog.GetTruncateSize();
     1041                                                const BOOL bDelete = EmailLogDialog.GetDelete();
     1042                                                for(SIZE_T nIndex = 0; nIndex < Array.GetCount(); nIndex++)
     1043                                                        _ATLTRY
     1044                                                        {
     1045                                                                CEmailLogDialog::CSelectedFileData& FileData = Array[nIndex];
     1046                                                                CLocalObjectPtr<CBzip2Item> pItem;
     1047                                                                pItem->LoadFromFile(FileData.m_sPath, nTruncateSize);
     1048                                                                CHeapPtr<BYTE> pnData;
     1049                                                                SIZE_T nDataSize;
     1050                                                                pItem->GetData(pnData, nDataSize);
     1051                                                                if(nDataSize)
     1052                                                                {
     1053                                                                        CObjectPtr<CMessage::CComAttachment> pAttachment = pMessage->GetAttachments()->Add();
     1054                                                                        _ATLTRY
     1055                                                                        {
     1056                                                                                pAttachment->SetType(L"application/bzip2");
     1057                                                                                pAttachment->SetDisposition(L"attachment");
     1058                                                                                pAttachment->SetName(CStringW(FileData.m_sName + _T(".bz2")));
     1059                                                                                CLocalObjectPtr<CUnmanagedMemoryStream> pStream;
     1060                                                                                pStream->Initialize(pnData, nDataSize);
     1061                                                                                pAttachment->LoadFromStream(pStream);
     1062                                                                        }
     1063                                                                        _ATLCATCHALL()
     1064                                                                        {
     1065                                                                                _V(pMessage->GetAttachments()->Remove(pAttachment));
     1066                                                                                _ATLRETHROW;
     1067                                                                        }
     1068                                                                }
     1069                                                                if(bDelete)
     1070                                                                        DeleteArray.Add(FileData.m_sPath);
     1071                                                        }
     1072                                                        _ATLCATCHALL()
     1073                                                        {
     1074                                                                _Z_EXCEPTION()
     1075                                                        }
     1076                                        }
     1077                                }
     1078                                #pragma endregion
    7011079                                __C(pMessage->Send());
     1080                                for(SIZE_T nIndex = 0; nIndex < DeleteArray.GetCount(); nIndex++)
     1081                                        DeleteFile(DeleteArray[nIndex]);
    7021082                                _RegKeyHelper::SetStringValue(HKEY_CURRENT_USER, REGISTRY_ROOT, _T("Email Message Template"), CString(sMessageString));
    703                                 AtlOptionalMessageBoxEx(m_hWnd, _T("CFilterGraphHelper::CPropertyFrameDialog::CEmailDialog::CredentialsSaved"), _T("The email was sent") _T("\r\n\r\n") _T("The credentials were written into registry for further reuse. Use Erase Cached Credentials link to delete them from registry."), IDS_INFORMATION, MB_ICONINFORMATION | MB_OK);
     1083                                AtlOptionalMessageBoxEx(m_hWnd, _T("CFilterGraphHelper::CPropertyFrameDialog::CEmailDialog::CredentialsSaved"), _T("The email was sent.") _T("\r\n\r\n") _T("The credentials were written into registry for further reuse. Use Erase Cached Credentials link to delete them from registry."), IDS_INFORMATION, MB_ICONINFORMATION | MB_OK);
    7041084                                MessageBeep(MB_OK);
    7051085                                return 0;
     
    7081088                        {
    7091089                                _RegKeyHelper::DeleteValue(HKEY_CURRENT_USER, REGISTRY_ROOT, _T("Email Message Template"));
    710                                 AtlOptionalMessageBoxEx(m_hWnd, _T("CFilterGraphHelper::CPropertyFrameDialog::CEmailDialog::SavedCredentialsDeleted"), _T("Cached email credentials are removed from registry."), IDS_INFORMATION, MB_ICONINFORMATION | MB_OK);
     1090                                AtlOptionalMessageBoxEx(m_hWnd, _T("CFilterGraphHelper::CPropertyFrameDialog::CEmailDialog::SavedCredentialsDeleted"), _T("Cached email credentials were removed from registry."), IDS_INFORMATION, MB_ICONINFORMATION | MB_OK);
    7111091                                MessageBeep(MB_OK);
    7121092                                return 0;
     
    7321112                                TYPE_ACTION,
    7331113                                TYPE_EMAIL,
     1114                                TYPE_EMAIL_LOG,
    7341115                        } TYPE;
    7351116
     
    8081189                CTreeItem m_ActionItem;
    8091190                CTreeItem m_EmailItem;
     1191                CTreeItem m_EmailLogItem;
    8101192                CTabCtrl m_Tab;
    8111193                CRoEdit m_TextEdit;
     
    8181200                CActionDialog m_ActionDialog;
    8191201                CEmailDialog m_EmailDialog;
     1202                CEmailLogDialog m_EmailLogDialog;
    8201203
    8211204                static VOID CreateTitleFont(CFont& Font, HWND hStaticWindow = NULL)
     
    9111294                        m_EmailItem.m_hTreeItem = EmailItem;
    9121295                        m_EmailItem.m_pTreeView = &m_TreeView;
     1296                        CTreeItem EmailLogItem = m_TreeView.InsertItem(EmailItem, NULL, CData(CData::TYPE_EMAIL_LOG), _T("Log Files"));
     1297                        m_EmailLogItem.m_hTreeItem = EmailLogItem;
     1298                        m_EmailLogItem.m_pTreeView = &m_TreeView;
     1299                        m_TreeView.Expand(EmailItem);
    9131300                }
    9141301                VOID HideCurrentSite()
     
    9461333                        _W(m_ActionDialog.SetWindowPos(NULL, Position, SWP_NOZORDER | SWP_NOACTIVATE));
    9471334                        _W(m_EmailDialog.SetWindowPos(NULL, Position, SWP_NOZORDER | SWP_NOACTIVATE));
     1335                        _W(m_EmailLogDialog.SetWindowPos(NULL, Position, SWP_NOZORDER | SWP_NOACTIVATE));
    9481336                }
    9491337
     
    9921380                                __E(m_ActionDialog.Create(m_hWnd, (LPARAM) this));
    9931381                                __E(m_EmailDialog.Create(m_hWnd, (LPARAM) this));
     1382                                __E(m_EmailLogDialog.Create(m_hWnd, (LPARAM) this));
    9941383                                DlgResize_Init(TRUE);
    9951384                                UpdateTree();
     
    10821471                                if(Data.m_Type != CData::TYPE_EMAIL)
    10831472                                        m_EmailDialog.ShowWindow(SW_HIDE);
     1473                                if(Data.m_Type != CData::TYPE_EMAIL_LOG)
     1474                                        m_EmailLogDialog.ShowWindow(SW_HIDE);
    10841475                                if(Data.m_pBaseFilter)
    10851476                                {
     
    11951586                                                break;
    11961587                                        #pragma endregion
     1588                                        #pragma region TYPE_EMAIL_LOG
     1589                                        case CData::TYPE_EMAIL_LOG:
     1590                                                m_TextEdit.ShowWindow(SW_HIDE);
     1591                                                _W(m_EmailLogDialog.SetWindowPos(NULL, GetTextEditPosition(), SWP_NOZORDER | SWP_SHOWWINDOW));
     1592                                                break;
     1593                                        #pragma endregion
    11971594                                        default:
    11981595                                                m_TextEdit.ShowWindow(SW_SHOW);
     
    12001597                                                m_ActionDialog.ShowWindow(SW_HIDE);
    12011598                                                m_EmailDialog.ShowWindow(SW_HIDE);
     1599                                                m_EmailLogDialog.ShowWindow(SW_HIDE);
    12021600                                        }
    12031601                                        m_ApplyButton.EnableWindow(FALSE);
     
    12091607                                m_ActionDialog.ShowWindow(SW_HIDE);
    12101608                                m_EmailDialog.ShowWindow(SW_HIDE);
     1609                                m_EmailLogDialog.ShowWindow(SW_HIDE);
    12111610                                m_ApplyButton.EnableWindow(FALSE);
    12121611                        }
  • trunk/DirectShowSpy/GraphBuilderCallbackPropertySheet.h

    r242 r256  
    13261326        {
    13271327                if(!_tcslen(m_sPath))
    1328                         m_sPath = CDebugTraceBase::GetFilePath();
     1328                        m_sPath = CDebugTraceBase::GetLocalMachineFilePath();
    13291329                #if _DEVELOPMENT && FALSE
    13301330                        static LPCTSTR g_pszPath = _T("D:\\Projects\\A&H\\LuxRiot\\_Issues\\45 Sanyo XP Issues\\DirectShowSpy.log");
  • trunk/DirectShowSpy/resource.h

    r247 r256  
    8989#define IDC_FILTERGRAPHHELPER_ACTION_OPENLIST 1711
    9090#define IDC_FILTERGRAPHHELPER_ACTION_OPENLISTDESCRIPTION 1712
     91#define IDD_FILTERGRAPHHELPER_EMAIL_LOG 1800
     92#define IDC_FILTERGRAPHHELPER_EMAIL_LOG_TITLE 1801
     93#define IDC_FILTERGRAPHHELPER_EMAIL_LOG_INTRODUCTION 1805
     94#define IDC_FILTERGRAPHHELPER_EMAIL_LOG_FILE 1806
     95#define IDC_FILTERGRAPHHELPER_EMAIL_LOG_TRUNCATE 1810
     96#define IDC_FILTERGRAPHHELPER_EMAIL_LOG_TRUNCATETITLE 1811
     97#define IDC_FILTERGRAPHHELPER_EMAIL_LOG_DELETETITLE 1812
     98#define IDC_FILTERGRAPHHELPER_EMAIL_LOG_DELETE 1813
    9199#define IDR_FILTERGRAPHSPY              25000
    92100#define IDR_NOTHREADFILTERGRAPHSPY      25001
     
    112120#define _APS_NEXT_RESOURCE_VALUE        211
    113121#define _APS_NEXT_COMMAND_VALUE         32781
    114 #define _APS_NEXT_CONTROL_VALUE         229
     122#define _APS_NEXT_CONTROL_VALUE         236
    115123#define _APS_NEXT_SYMED_VALUE           103
    116124#endif
Note: See TracChangeset for help on using the changeset viewer.