Changeset 196


Ignore:
Timestamp:
Jul 7, 2013, 2:37:32 AM (11 years ago)
Author:
roman
Message:

Cosmetic fixes, new .BAT names, UnregisterTreatAsClasses? export to force removal of TreatAs? keys

Location:
trunk/DirectShowSpy
Files:
4 added
4 deleted
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/DirectShowSpy/AboutDialog.h

    r95 r196  
    22// Copyright (C) Roman Ryltsov, 2008-2011
    33// Created by Roman Ryltsov roman@alax.info
    4 //
    5 // $Id: AboutDialog.h 302 2011-07-26 08:46:45Z alax $
    64
    75#pragma once
  • trunk/DirectShowSpy/Common.h

    r95 r196  
    22// Copyright (C) Roman Ryltsov, 2008-2011
    33// Created by Roman Ryltsov roman@alax.info
    4 //
    5 // $Id$
    64
    75#pragma once
     
    136134        _Z4(atlTraceRegistrar, 4, _T("nOsVersion 0x%08x\n"), nOsVersion);
    137135        CProcessTokenPrivileges ProcessTokenPrivileges;
    138         if(nOsVersion >= 0x060000) // Vista+
     136        if(nOsVersion >= 0x060000) // Win Vista+
    139137                _ATLTRY
    140138                {
     
    153151        if(!bRegister && nCoGetTreatAsClassResult == S_OK)
    154152        {
    155                 if(nOsVersion >= 0x060000) // Vista+
     153                if(nOsVersion >= 0x060000) // Win Vista+
    156154                        ClassIdentifierRegKeySecurity.Adjust();
    157155                __C(CoTreatAsClass(TreatAsClassIdentifier, CLSID_NULL));
     
    161159        if(bRegister)
    162160        {
    163                 if(nOsVersion >= 0x060000) // Vista+
     161                if(nOsVersion >= 0x060000) // Win Vista+
    164162                        ClassIdentifierRegKeySecurity.Adjust();
    165 #if _DEVELOPMENT
    166                 const HRESULT nCoTreatAsClassResult = CoTreatAsClass(TreatAsClassIdentifier, T::GetObjectCLSID());
    167                 _Z2(atlTraceRegistrar, SUCCEEDED(nCoTreatAsClassResult) ? 4 : 2, _T("nCoTreatAsClassResult 0x%08x\n"), nCoTreatAsClassResult);
    168                 __C(nCoTreatAsClassResult);
    169                 const HRESULT nCoGetTreatAsClassResult = CoGetTreatAsClass(TreatAsClassIdentifier, &CurrentTreatAsClassIdentifier);
    170                 _Z4(atlTraceRegistrar, 4, _T("nCoGetTreatAsClassResult 0x%08x, CurrentTreatAsClassIdentifier %ls\n"), nCoGetTreatAsClassResult, _PersistHelper::StringFromIdentifier(CurrentTreatAsClassIdentifier));
    171                 _A(CurrentTreatAsClassIdentifier == T::GetObjectCLSID());
    172 #else
    173                 __C(CoTreatAsClass(TreatAsClassIdentifier, T::GetObjectCLSID()));
    174 #endif // _DEVELOPMENT
     163                #if _DEVELOPMENT
     164                        const HRESULT nCoTreatAsClassResult = CoTreatAsClass(TreatAsClassIdentifier, T::GetObjectCLSID());
     165                        _Z2(atlTraceRegistrar, SUCCEEDED(nCoTreatAsClassResult) ? 4 : 2, _T("nCoTreatAsClassResult 0x%08x\n"), nCoTreatAsClassResult);
     166                        __C(nCoTreatAsClassResult);
     167                        const HRESULT nCoGetTreatAsClassResult = CoGetTreatAsClass(TreatAsClassIdentifier, &CurrentTreatAsClassIdentifier);
     168                        _Z4(atlTraceRegistrar, 4, _T("nCoGetTreatAsClassResult 0x%08x, CurrentTreatAsClassIdentifier %ls\n"), nCoGetTreatAsClassResult, _PersistHelper::StringFromIdentifier(CurrentTreatAsClassIdentifier));
     169                        _A(CurrentTreatAsClassIdentifier == T::GetObjectCLSID());
     170                #else
     171                        __C(CoTreatAsClass(TreatAsClassIdentifier, T::GetObjectCLSID()));
     172                #endif // _DEVELOPMENT
    175173        }
    176174}
  • trunk/DirectShowSpy/Configuration.cpp

    r193 r196  
    44
    55#include "stdafx.h"
     6#include <dshow.h>
    67#include "resource.h"
     8#include "Common.h"
    79#include "Configuration.h"
    810
    911////////////////////////////////////////////////////////////
    10 // CRegistrationPropertySheet
     12// UnregisterTreatAsClasses
     13
     14#if defined(_WIN64)
     15        extern "C" __declspec(dllexport)
     16#else
     17        #pragma comment(linker, "/EXPORT:UnregisterTreatAsClasses=_UnregisterTreatAsClasses@0,PRIVATE")
     18        extern "C" // __declspec(dllexport)
     19#endif // defined(_WIN64)
     20
     21HRESULT STDMETHODCALLTYPE UnregisterTreatAsClasses() throw()
     22{
     23        _ATLTRY
     24        {
     25                static const CLSID* g_ppClassIdentifiers[] =
     26                {
     27                        &CLSID_FilterMapper2, // CFilterMapperSpy
     28                        &CLSID_SystemDeviceEnum, // CLSID_SystemDeviceEnumeratorSpy
     29                        &CLSID_FilterGraph, // CLSID_Spy
     30                        &CLSID_FilterGraphNoThread, // CLSID_NoThreadSpy
     31                };
     32                const ULONG nOsVersion = GetOsVersion();
     33                _Z4(atlTraceGeneral, 4, _T("nOsVersion 0x%08x\n"), nOsVersion);
     34                CProcessTokenPrivileges ProcessTokenPrivileges;
     35                BOOL bProcessTokenPrivilegesAdjustNeeded = TRUE;
     36                for(SIZE_T nIndex = 0; nIndex < DIM(g_ppClassIdentifiers); nIndex++)
     37                {
     38                        const CLSID& ClassIdentifier = *g_ppClassIdentifiers[nIndex];
     39                        _Z4(atlTraceGeneral, 4, _T("nIndex %d, ClassIdentifier %ls\n"), nIndex, _PersistHelper::StringFromIdentifier(ClassIdentifier));
     40                        _ATLTRY
     41                        {
     42                                CLSID CurrentTreatAsClassIdentifier = CLSID_NULL;
     43                                const HRESULT nCoGetTreatAsClassResult = CoGetTreatAsClass(ClassIdentifier, &CurrentTreatAsClassIdentifier);
     44                                _Z4_HRESULT(nCoGetTreatAsClassResult);
     45                                __C(nCoGetTreatAsClassResult);
     46                                if(nCoGetTreatAsClassResult != S_OK)
     47                                        continue;
     48                                _Z4(atlTraceGeneral, 4, _T("CurrentTreatAsClassIdentifier %ls\n"), _PersistHelper::StringFromIdentifier(CurrentTreatAsClassIdentifier));
     49                                #pragma region Adjust
     50                                if(bProcessTokenPrivilegesAdjustNeeded)
     51                                {
     52                                        bProcessTokenPrivilegesAdjustNeeded = FALSE;
     53                                        if(nOsVersion >= 0x060000) // Win Vista+
     54                                                _ATLTRY
     55                                                {
     56                                                        ProcessTokenPrivileges.Adjust();
     57                                                }
     58                                                _ATLCATCHALL()
     59                                                {
     60                                                        _Z_EXCEPTION();
     61                                                }
     62                                }
     63                                #pragma endregion
     64                                CClassIdentifierRegKeySecurity ClassIdentifierRegKeySecurity(ClassIdentifier);
     65                                if(nOsVersion >= 0x060000) // Win Vista+
     66                                        ClassIdentifierRegKeySecurity.Adjust();
     67                                const HRESULT nCoTreatAsClassResult = CoTreatAsClass(ClassIdentifier, CLSID_NULL);
     68                                _Z4_HRESULT(nCoTreatAsClassResult);
     69                                __C(nCoTreatAsClassResult);
     70                        }
     71                        _ATLCATCHALL()
     72                        {
     73                                _Z_EXCEPTION();
     74                        }
     75                }
     76        }
     77        _ATLCATCH(Exception)
     78        {
     79                _C(Exception);
     80        }
     81        return S_OK;
     82}
     83
     84////////////////////////////////////////////////////////////
     85// DoRegistrationPropertySheetModal
    1186
    1287#if defined(_WIN64)
  • trunk/DirectShowSpy/Configuration.h

    r171 r196  
    22// Copyright (C) Roman Ryltsov, 2008-2011
    33// Created by Roman Ryltsov roman@alax.info
    4 //
    5 // $Id$
    64
    75#pragma once
  • trunk/DirectShowSpy/DirectShowSpy.cpp

    r95 r196  
    22// Copyright (C) Roman Ryltsov, 2008-2011
    33// Created by Roman Ryltsov roman@alax.info
    4 //
    5 // $Id$
    64
    75#include "stdafx.h"
  • trunk/DirectShowSpy/DirectShowSpy.rc

    r193 r196  
    6060
    6161VS_VERSION_INFO VERSIONINFO
    62  FILEVERSION  1, 0, 0, 941
     62 FILEVERSION  1, 0, 0, 952
    6363 PRODUCTVERSION 1,0,0,1
    6464 FILEFLAGSMASK 0x3fL
     
    7979            VALUE "CompanyName", "Roman Ryltsov"
    8080            VALUE "FileDescription", "Alax.Info DirectShow Spy Module"
    81             VALUE "FileVersion",  "1, 0, 0, 941\0"
     81            VALUE "FileVersion",  "1, 0, 0, 952\0"
    8282            VALUE "InternalName", "DirectShowSpy.dll"
    8383            VALUE "LegalCopyright", "Copyright © Alax.Info, Roman Ryltsov, 2008-2013"
  • trunk/DirectShowSpy/DirectShowSpy_i.c

    r193 r196  
    77
    88 /* File created by MIDL compiler version 7.00.0555 */
    9 /* at Sat Jul 06 22:59:33 2013
     9/* at Sun Jul 07 12:24:05 2013
    1010 */
    1111/* Compiler settings for DirectShowSpy.idl:
  • trunk/DirectShowSpy/DirectShowSpy_i.h

    r193 r196  
    55
    66 /* File created by MIDL compiler version 7.00.0555 */
    7 /* at Sat Jul 06 22:59:33 2013
     7/* at Sun Jul 07 12:24:05 2013
    88 */
    99/* Compiler settings for DirectShowSpy.idl:
  • trunk/DirectShowSpy/DirectShowSpy_p.c

    r193 r196  
    55
    66 /* File created by MIDL compiler version 7.00.0555 */
    7 /* at Sat Jul 06 22:59:33 2013
     7/* at Sun Jul 07 12:24:05 2013
    88 */
    99/* Compiler settings for DirectShowSpy.idl:
  • trunk/DirectShowSpy/FilterGraphList.h

    r193 r196  
    497497                                                        #define J(x) I(pMediaType->x)
    498498                                                        #define K1(x) sText += AtlFormatString(_T(" * `") _T(#x) _T("`: %s") _T("\r\n"), J(x))
     499                                                        sText += AtlFormatString(_T(" * ") _T("Data: %s") _T("\r\n"), I(AtlFormatData((const BYTE*) (const AM_MEDIA_TYPE*) pMediaType, sizeof *pMediaType).TrimRight()));
    499500                                                        sText += AtlFormatString(_T(" * ") _T("`majortype`: %s") _T("\r\n"), I(_FilterGraphHelper::FormatMajorType(pMediaType->majortype)));
    500501                                                        if(pMediaType->subtype != MEDIASUBTYPE_NULL)
     
    511512                                                                K1(cbFormat);
    512513                                                                if(pMediaType->pbFormat)
    513                                                                 {
    514                                                                         CString sFormat = AtlFormatData(pMediaType->pbFormat, pMediaType->cbFormat).TrimRight();
    515                                                                         sFormat.Replace(_T(" "), _T("` `"));
    516                                                                         sFormat.Insert(0, _T("`"));
    517                                                                         sFormat.Append(_T("`"));
    518                                                                         sText += AtlFormatString(_T(" * ") _T("`pbFormat`: %s") _T("\r\n"), sFormat);
    519                                                                 }
     514                                                                        sText += AtlFormatString(_T(" * ") _T("Format Data, `pbFormat`: %s") _T("\r\n"), I(AtlFormatData(pMediaType->pbFormat, pMediaType->cbFormat).TrimRight()));
    520515                                                        }
    521516                                                        #undef J
     
    682677                                                                if(!pnExtraData)
    683678                                                                        pnExtraData = pMediaType->pbFormat + pMediaType->cbFormat - nExtraDataSize;
    684                                                                 CString sFormat = AtlFormatData(pnExtraData, nExtraDataSize).TrimRight();
    685                                                                 sFormat.Replace(_T(" "), _T("` `"));
    686                                                                 sFormat.Insert(0, _T("`"));
    687                                                                 sFormat.Append(_T("`"));
    688                                                                 sText += AtlFormatString(_T("  * ") _T("Extra Data: %s") _T("\r\n"), sFormat);
     679                                                                sText += AtlFormatString(_T("  * ") _T("Extra Data: %s") _T("\r\n"), I(AtlFormatData(pnExtraData, nExtraDataSize).TrimRight()));
    689680                                                        }
    690681                                                        #pragma endregion
  • trunk/DirectShowSpy/FilterGraphSpy.h

    r155 r196  
    22// Copyright (C) Roman Ryltsov, 2008-2011
    33// Created by Roman Ryltsov roman@alax.info
    4 //
    5 // $Id$
    64
    75#pragma once
  • trunk/DirectShowSpy/FilterMapperSpy.h

    r144 r196  
    22// Copyright (C) Roman Ryltsov, 2008-2011
    33// Created by Roman Ryltsov roman@alax.info
    4 //
    5 // $Id$
    64
    75#pragma once
  • trunk/DirectShowSpy/SystemDeviceEnumeratorSpy.h

    r144 r196  
    22// Copyright (C) Roman Ryltsov, 2008-2011
    33// Created by Roman Ryltsov roman@alax.info
    4 //
    5 // $Id$
    64
    75#pragma once
  • trunk/DirectShowSpy/dllmain.cpp

    r95 r196  
    22// Copyright (C) Roman Ryltsov, 2008-2011
    33// Created by Roman Ryltsov roman@alax.info
    4 //
    5 // $Id$
    64
    75#include "stdafx.h"
  • trunk/DirectShowSpy/dllmain.h

    r147 r196  
    22// Copyright (C) Roman Ryltsov, 2008-2011
    33// Created by Roman Ryltsov roman@alax.info
    4 //
    5 // $Id$
    64
    75#pragma once
  • trunk/DirectShowSpy/stdafx.cpp

    r95 r196  
    22// Copyright (C) Roman Ryltsov, 2008-2011
    33// Created by Roman Ryltsov roman@alax.info
    4 //
    5 // $Id$
    64
    75#include "stdafx.h"
  • trunk/DirectShowSpy/stdafx.h

    r95 r196  
    22// Copyright (C) Roman Ryltsov, 2008-2011
    33// Created by Roman Ryltsov roman@alax.info
    4 //
    5 // $Id$
    64
    75#pragma once
  • trunk/DirectShowSpy/targetver.h

    r95 r196  
    22// Copyright (C) Roman Ryltsov, 2008-2011
    33// Created by Roman Ryltsov roman@alax.info
    4 //
    5 // $Id$
    64
    75#pragma once
Note: See TracChangeset for help on using the changeset viewer.