Changeset 149 for trunk/DirectShowSpy


Ignore:
Timestamp:
Nov 23, 2012, 6:37:26 AM (11 years ago)
Author:
roman
Message:
  • unregister using registration path, not local
  • allow registering on top, if currently registered path is not local
  • elevation for per-user registration (we're still hooking!)
  • cosmetic
Location:
trunk/DirectShowSpy
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/DirectShowSpy/Configuration.h

    r147 r149  
    8080                {
    8181                        _A(_pAtlModule);
     82                        const CPath& sLocalPath = GetPath();
    8283                        #pragma region System
    8384                        CPath sPath = FindTypeLibraryPath(HKEY_LOCAL_MACHINE);
     
    8788                        m_PathEdit.GetWindow(GW_HWNDPREV).EnableWindow(!bPathEmpty);
    8889                        m_PathEdit.EnableWindow(!bPathEmpty);
    89                         m_RegisterButton.EnableWindow(bPathEmpty);
     90                        m_RegisterButton.EnableWindow(bPathEmpty || _tcsicmp(sPath, sLocalPath));
    9091                        m_UnregisterButton.EnableWindow(!bPathEmpty);
    9192                        m_sPath = sPath;
     
    9899                        m_UserPathEdit.GetWindow(GW_HWNDPREV).EnableWindow(!bUserPathEmpty);
    99100                        m_UserPathEdit.EnableWindow(!bUserPathEmpty);
    100                         m_UserRegisterButton.EnableWindow(bUserPathEmpty);
     101                        m_UserRegisterButton.EnableWindow(bUserPathEmpty || _tcsicmp(sUserPath, sLocalPath));
    101102                        m_UserUnregisterButton.EnableWindow(!bUserPathEmpty);
    102103                        m_sUserPath = sUserPath;
     
    169170                                if(bSilent)
    170171                                        MessageBeep(nExitCode ? MB_ICONERROR : MB_OK);
     172                                CancelToClose();
    171173                        }
    172174                        _ATLCATCH(Exception)
     
    183185                                CWaitCursor WaitCursor;
    184186                                const BOOL bSilent = !(GetKeyState(VK_SCROLL) & 1);
    185                                 const DWORD nExitCode = ExecuteWait(AtlFormatString(_T("%s /u \"%s\""), bSilent ? _T("/s") : _T(""), GetPath()), TRUE);
    186                                 if(bSilent)
    187                                         MessageBeep(nExitCode ? MB_ICONERROR : MB_OK);
     187                                const CPath& sPath = m_sPath; //GetPath();
     188                                const DWORD nExitCode = ExecuteWait(AtlFormatString(_T("%s /u \"%s\""), bSilent ? _T("/s") : _T(""), sPath), TRUE);
     189                                if(bSilent)
     190                                        MessageBeep(nExitCode ? MB_ICONERROR : MB_OK);
     191                                CancelToClose();
    188192                        }
    189193                        _ATLCATCH(Exception)
     
    203207                                if(bSilent)
    204208                                        MessageBeep(nExitCode ? MB_ICONERROR : MB_OK);
     209                                CancelToClose();
    205210                        }
    206211                        _ATLCATCH(Exception)
     
    217222                                CWaitCursor WaitCursor;
    218223                                const BOOL bSilent = !(GetKeyState(VK_SCROLL) & 1);
    219                                 const DWORD nExitCode = ExecuteWait(AtlFormatString(_T("%s /i:user /n /u \"%s\""), bSilent ? _T("/s") : _T(""), GetPath()));
    220                                 if(bSilent)
    221                                         MessageBeep(nExitCode ? MB_ICONERROR : MB_OK);
     224                                const CPath& sPath = m_sUserPath; //GetPath();
     225                                const DWORD nExitCode = ExecuteWait(AtlFormatString(_T("%s /i:user /n /u \"%s\""), bSilent ? _T("/s") : _T(""), sPath));
     226                                if(bSilent)
     227                                        MessageBeep(nExitCode ? MB_ICONERROR : MB_OK);
     228                                CancelToClose();
    222229                        }
    223230                        _ATLCATCH(Exception)
     
    284291                        class __declspec(uuid("92A3A302-DA7C-4A1F-BA7E-1802BB5D2D02")) PSFactoryBuffer;
    285292                        _A(_pAtlModule);
     293                        const CPath& sLocalPath = m_PropertySheet.m_sPropPagePath;
    286294                        #pragma region System
    287                         //CPath sUserPath = FindTypeLibraryPath(HKEY_LOCAL_MACHINE);
     295                        //CPath sPath = FindTypeLibraryPath(HKEY_LOCAL_MACHINE);
    288296                        CPath sPath = FindClassPath(HKEY_LOCAL_MACHINE, __uuidof(PSFactoryBuffer));
    289297                        const BOOL bPathEmpty = _tcslen(sPath) == 0;
     
    292300                        m_PathEdit.GetWindow(GW_HWNDPREV).EnableWindow(!bPathEmpty);
    293301                        m_PathEdit.EnableWindow(!bPathEmpty);
    294                         m_RegisterButton.EnableWindow(bPathEmpty);
     302                        m_RegisterButton.EnableWindow(bPathEmpty || _tcsicmp(sPath, sLocalPath));
    295303                        m_UnregisterButton.EnableWindow(!bPathEmpty);
    296304                        m_sPath = sPath;
     
    333341                                                m_RegisterButton.SetElevationRequiredState(TRUE);
    334342                                                m_UnregisterButton.SetElevationRequiredState(TRUE);
     343                                                // NOTE: Even per-user registration needs elevation, since we are hooking COM classes
     344                                                m_UserRegisterButton.SetElevationRequiredState(TRUE);
     345                                                m_UserUnregisterButton.SetElevationRequiredState(TRUE);
    335346                                        }
    336347                                }
     
    374385                                if(bSilent)
    375386                                        MessageBeep(nExitCode ? MB_ICONERROR : MB_OK);
     387                                CancelToClose();
    376388                        }
    377389                        _ATLCATCH(Exception)
     
    392404                                if(bSilent)
    393405                                        MessageBeep(nExitCode ? MB_ICONERROR : MB_OK);
     406                                CancelToClose();
    394407                        }
    395408                        _ATLCATCH(Exception)
     
    406419                                CWaitCursor WaitCursor;
    407420                                const BOOL bSilent = !(GetKeyState(VK_SCROLL) & 1);
    408                                 const DWORD nExitCode = ExecuteWait(AtlFormatString(_T("%s /i:user /n \"%s\""), bSilent ? _T("/s") : _T(""), m_PropertySheet.m_sPropPagePath));
    409                                 if(bSilent)
    410                                         MessageBeep(nExitCode ? MB_ICONERROR : MB_OK);
     421                                // NOTE: Even per-user registration needs elevation, since we are hooking COM classes
     422                                const DWORD nExitCode = ExecuteWait(AtlFormatString(_T("%s /i:user /n \"%s\""), bSilent ? _T("/s") : _T(""), m_PropertySheet.m_sPropPagePath), TRUE);
     423                                if(bSilent)
     424                                        MessageBeep(nExitCode ? MB_ICONERROR : MB_OK);
     425                                CancelToClose();
    411426                        }
    412427                        _ATLCATCH(Exception)
     
    423438                                CWaitCursor WaitCursor;
    424439                                const BOOL bSilent = !(GetKeyState(VK_SCROLL) & 1);
    425                                 const DWORD nExitCode = ExecuteWait(AtlFormatString(_T("%s /i:user /n /u \"%s\""), bSilent ? _T("/s") : _T(""), m_PropertySheet.m_sPropPagePath));
    426                                 if(bSilent)
    427                                         MessageBeep(nExitCode ? MB_ICONERROR : MB_OK);
     440                                // NOTE: Even per-user registration needs elevation, since we are hooking COM classes
     441                                const DWORD nExitCode = ExecuteWait(AtlFormatString(_T("%s /i:user /n /u \"%s\""), bSilent ? _T("/s") : _T(""), m_PropertySheet.m_sPropPagePath), TRUE);
     442                                if(bSilent)
     443                                        MessageBeep(nExitCode ? MB_ICONERROR : MB_OK);
     444                                CancelToClose();
    428445                        }
    429446                        _ATLCATCH(Exception)
  • trunk/DirectShowSpy/DirectShowSpy.rc

    r147 r149  
    6262
    6363VS_VERSION_INFO VERSIONINFO
    64  FILEVERSION  1, 0, 0, 796
     64 FILEVERSION  1, 0, 0, 802
    6565 PRODUCTVERSION 1,0,0,1
    6666 FILEFLAGSMASK 0x3fL
     
    8181            VALUE "CompanyName", "Roman Ryltsov"
    8282            VALUE "FileDescription", "Alax.Info DirectShow Spy Module"
    83             VALUE "FileVersion",  "1, 0, 0, 796\0"
     83            VALUE "FileVersion",  "1, 0, 0, 802\0"
    8484            VALUE "InternalName", "DirectShowSpy.dll"
    8585            VALUE "LegalCopyright", "Copyright © Alax.Info, Roman Ryltsov, 2008-2011"
  • trunk/DirectShowSpy/DirectShowSpy_i.c

    r147 r149  
    77
    88 /* File created by MIDL compiler version 7.00.0500 */
    9 /* at Fri Nov 23 00:35:10 2012
     9/* at Fri Nov 23 16:34:56 2012
    1010 */
    1111/* Compiler settings for .\DirectShowSpy.idl:
  • trunk/DirectShowSpy/DirectShowSpy_i.h

    r147 r149  
    55
    66 /* File created by MIDL compiler version 7.00.0500 */
    7 /* at Fri Nov 23 00:35:10 2012
     7/* at Fri Nov 23 16:34:56 2012
    88 */
    99/* Compiler settings for .\DirectShowSpy.idl:
  • trunk/DirectShowSpy/DirectShowSpy_p.c

    r147 r149  
    55
    66 /* File created by MIDL compiler version 7.00.0500 */
    7 /* at Fri Nov 23 00:35:10 2012
     7/* at Fri Nov 23 16:34:56 2012
    88 */
    99/* Compiler settings for .\DirectShowSpy.idl:
Note: See TracChangeset for help on using the changeset viewer.