source: trunk/DirectShowSpy/DirectShowSpy.cpp @ 223

Last change on this file since 223 was 196, checked in by roman, 11 years ago

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

  • Property svn:keywords set to Id
File size: 2.1 KB
Line 
1////////////////////////////////////////////////////////////
2// Copyright (C) Roman Ryltsov, 2008-2011
3// Created by Roman Ryltsov roman@alax.info
4
5#include "stdafx.h"
6#include "resource.h"
7#include "DirectShowSpy_i.h"
8#include "dllmain.h"
9
10#if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA)
11#error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM object's and allow use of it's single-threaded COM object implementations. The threading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms."
12#endif
13
14////////////////////////////////////////////////////////////
15// DLL Exports
16
17STDAPI DllCanUnloadNow() throw()
18{
19    return _AtlModule.DllCanUnloadNow();
20}
21
22STDAPI DllGetClassObject(REFCLSID ClassIdentifier, REFIID InterfaceIdentifier, LPVOID* ppvObject) throw()
23{
24    return _AtlModule.DllGetClassObject(ClassIdentifier, InterfaceIdentifier, ppvObject);
25}
26
27STDAPI DllRegisterServer() throw()
28{
29        HRESULT nResult;
30        _ATLTRY
31        {
32                nResult = _AtlModule.DllRegisterServer();
33                __C(nResult);
34        }
35        _ATLCATCH(Exception)
36        {
37                _C(Exception);
38        }
39        return nResult;
40}
41
42STDAPI DllUnregisterServer() throw()
43{
44        HRESULT nResult;
45        _ATLTRY
46        {
47                nResult = _AtlModule.DllUnregisterServer();
48                __C(nResult);
49        }
50        _ATLCATCH(Exception)
51        {
52                _C(Exception);
53        }
54        return nResult;
55}
56
57STDAPI DllInstall(BOOL bInstall, LPCWSTR pszCommandLine) throw()
58{
59        HRESULT nResult;
60        _ATLTRY
61        {
62                static const WCHAR g_pszUser[] = _T("user");
63                if(pszCommandLine)
64                {
65                if(_wcsnicmp(pszCommandLine, g_pszUser, DIM(g_pszUser)) == 0)
66                        AtlSetPerUserRegistration(TRUE);
67                }
68                if(bInstall)
69                {       
70                nResult = DllRegisterServer();
71                if(FAILED(nResult))
72                        DllUnregisterServer();
73                } else
74                nResult = DllUnregisterServer();
75        }
76        _ATLCATCH(Exception)
77        {
78                _C(Exception);
79        }
80        return nResult;
81}
Note: See TracBrowser for help on using the repository browser.