Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: Shared/Plugin.cpp

Issue 9043003: Visual Studio Express readyness. No MFC. (Closed)
Patch Set: Created Dec. 17, 2012, 2:41 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 #include "PluginStdAfx.h" 1 #include "PluginStdAfx.h"
2 2
3 #include "Plugin.h" 3 #include "Plugin.h"
4 #if (defined PRODUCT_SIMPLEADBLOCK) 4 #if (defined PRODUCT_SIMPLEADBLOCK)
5 #include "../AdBlocker/AdBlocker_i.c" 5 #include "../AdBlocker/AdBlocker_i.c"
6 #endif 6 #endif
7 7
8 #include "PluginClass.h" 8 #include "PluginClass.h"
9 #include "PluginClient.h" 9 #include "PluginClient.h"
10 #include "PluginSystem.h" 10 #include "PluginSystem.h"
11 #include "PluginSettings.h" 11 #include "PluginSettings.h"
12 #include "PluginDictionary.h" 12 #include "PluginDictionary.h"
13 #include "PluginMimeFilterClient.h" 13 #include "PluginMimeFilterClient.h"
14 #include "Msiquery.h" 14 #include "Msiquery.h"
15 15
16 #ifdef SUPPORT_FILTER 16 #ifdef SUPPORT_FILTER
17 #include "PluginFilter.h" 17 #include "PluginFilter.h"
18 #endif 18 #endif
19 #ifdef SUPPORT_CONFIG 19 #ifdef SUPPORT_CONFIG
20 #include "PluginConfig.h" 20 #include "PluginConfig.h"
21 #endif 21 #endif
22 22
23 23
24 CComModule _Module; 24 CComModule _Module;
25 25
26 BEGIN_OBJECT_MAP(ObjectMap) 26 BEGIN_OBJECT_MAP(ObjectMap)
27 OBJECT_ENTRY(CLSID_PluginClass, CPluginClass) 27 OBJECT_ENTRY(CLSID_PluginClass, CPluginClass)
28 END_OBJECT_MAP() 28 END_OBJECT_MAP()
29 29
30 30 //Dll Entry Point
31 class CPluginApp : public CWinApp 31 BOOL WINAPI DllMain(HINSTANCE hInstDll, DWORD fdwReason, LPVOID reserved)
32 { 32 {
33 33
34 public: 34 switch( fdwReason )
35 {
36 case DLL_PROCESS_ATTACH:
37 » » » TCHAR szFilename[MAX_PATH];
38 » » » GetModuleFileName(NULL, szFilename, MAX_PATH);
39 » » » _tcslwr_s(szFilename);
35 40
36 » CPluginApp(); 41 » » » if (_tcsstr(szFilename, _T("explorer.exe")))
37 » ~CPluginApp(); 42 » » » {
43 » » » » return FALSE;
44 » » » }
38 45
39 » virtual BOOL InitInstance(); 46 » » » _Module.Init(ObjectMap, _Module.GetModuleInstance(), &LI BID_PluginLib);
47 break;
40 48
41 » DECLARE_MESSAGE_MAP() 49 case DLL_THREAD_ATTACH:
42 }; 50 // thread-specific initialization.
51 break;
43 52
44 BEGIN_MESSAGE_MAP(CPluginApp, CWinApp)» 53 case DLL_THREAD_DETACH:
45 END_MESSAGE_MAP() 54 // thread-specific cleanup.
55 break;
46 56
47 57 case DLL_PROCESS_DETACH:
48 58 // any necessary cleanup.
49 CPluginApp theApp; 59 break;
50 60 }
51 CPluginApp::CPluginApp()
52 {
53 » //Use next two lines to check for memory leaks
54 //» _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
55 //» _CrtDumpMemoryLeaks();
56 }
57
58
59 CPluginApp::~CPluginApp()
60 {
61
62 }
63 BOOL CPluginApp::InitInstance()
64 {
65 » TCHAR szFilename[MAX_PATH];
66 » GetModuleFileName(NULL, szFilename, MAX_PATH);
67 » _tcslwr_s(szFilename);
68
69 » if (_tcsstr(szFilename, _T("explorer.exe")))
70 » {
71 » » return FALSE;
72 » }
73
74 _Module.Init(ObjectMap, AfxGetInstanceHandle(), &LIBID_PluginLib);
75
76
77 » CWinApp::InitInstance();
78 61
79 return TRUE; 62 return TRUE;
80 } 63 }
81 64
82 65
83 STDAPI DllCanUnloadNow(void) 66 STDAPI DllCanUnloadNow(void)
84 { 67 {
85 LONG count = _Module.GetLockCount(); 68 LONG count = _Module.GetLockCount();
86 if (_Module.GetLockCount() == 0) 69 if (_Module.GetLockCount() == 0)
87 { 70 {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 #ifdef SUPPORT_CONFIG 153 #ifdef SUPPORT_CONFIG
171 DEBUG_GENERAL("*** Generating config file") 154 DEBUG_GENERAL("*** Generating config file")
172 CPluginConfig* config = CPluginConfig::GetInstance(); 155 CPluginConfig* config = CPluginConfig::GetInstance();
173 config->Create(true); 156 config->Create(true);
174 #endif 157 #endif
175 158
176 HKEY hKey = NULL; 159 HKEY hKey = NULL;
177 DWORD dwDisposition = 0; 160 DWORD dwDisposition = 0;
178 161
179 DWORD dwResult = NULL; 162 DWORD dwResult = NULL;
180 163 »
181 // Post async plugin error 164 // Post async plugin error
182 CPluginError pluginError; 165 CPluginError pluginError;
183 while (CPluginClientBase::PopFirstPluginError(pluginError)) 166 while (CPluginClientBase::PopFirstPluginError(pluginError))
184 { 167 {
185 CPluginClientBase::LogPluginError(pluginError.GetErrorCode(), pluginErro r.GetErrorId(), pluginError.GetErrorSubid(), pluginError.GetErrorDescription(), true, pluginError.GetProcessId(), pluginError.GetThreadId()); 168 CPluginClientBase::LogPluginError(pluginError.GetErrorCode(), pluginErro r.GetErrorId(), pluginError.GetErrorSubid(), pluginError.GetErrorDescription(), true, pluginError.GetProcessId(), pluginError.GetThreadId());
186 } 169 }
187 } 170 }
188 171
189 // Called from installer 172 // Called from installer
190 EXTERN_C void STDAPICALLTYPE OnInstall(MSIHANDLE hInstall, MSIHANDLE tmp) 173 EXTERN_C void STDAPICALLTYPE OnInstall(MSIHANDLE hInstall, MSIHANDLE tmp)
191 { 174 {
192 InitPlugin(true); 175 InitPlugin(true);
193 } 176 }
194 177
195 // Called from updater 178 // Called from updater
196 EXTERN_C void STDAPICALLTYPE OnUpdate(void) 179 EXTERN_C void STDAPICALLTYPE OnUpdate(void)
197 { 180 {
198 InitPlugin(false); 181 InitPlugin(false);
199 } 182 }
OLDNEW
« AdPlugin.sln ('K') | « AdPlugin.sln ('k') | Shared/PluginDownloadDialog.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld