Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.9.1, 0.9.1.1, and 0.9.2

stable shellext: move remaining implementations of CShellExtCMenu to ContextMenu.cpp

Changeset e8add5046b79

Parent 9e2478510012

by Adrian Buehlmann

Changes to 2 files · Browse files at e8add5046b79 Showing diff from parent 9e2478510012 Diff from another changeset...

 
1
2
3
4
5
6
7
8
 
 
 
 
9
10
11
 
810
811
812
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
 
2
3
4
5
6
7
8
9
10
11
12
13
14
 
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
@@ -1,11 +1,14 @@
 #include "stdafx.h" -#include "CShellExtCMenu.h"  #include "TortoiseUtils.h"  #include "StringUtils.h"  #include "Dirstatecache.h"  #include "Thgstatus.h"  #include "Winstat.h"  #include "InitStatus.h" +#include "ShellExt.h" + +#include "CShellExtCMenu.h" +  #include <map>     @@ -810,3 +813,64 @@
    return NOERROR;  } + + +CShellExtCMenu::CShellExtCMenu(char dummy) : + m_ppszFileUserClickedOn(0) +{ + m_cRef = 0L; + CShellExt::IncDllRef(); +} + + +CShellExtCMenu::~CShellExtCMenu() +{ + CShellExt::DecDllRef(); +} + + +STDMETHODIMP_(ULONG) CShellExtCMenu::AddRef() +{ + ThgCriticalSection cs(CShellExt::GetCriticalSection()); + return ++m_cRef; +} + + +STDMETHODIMP_(ULONG) CShellExtCMenu::Release() +{ + ThgCriticalSection cs(CShellExt::GetCriticalSection()); + if(--m_cRef) + return m_cRef; + delete this; + return 0L; +} + + +STDMETHODIMP CShellExtCMenu::QueryInterface(REFIID riid, LPVOID FAR* ppv) +{ + *ppv = NULL; + if (IsEqualIID(riid, IID_IShellExtInit) || IsEqualIID(riid, IID_IUnknown)) + { + *ppv = (LPSHELLEXTINIT) this; + } + else if (IsEqualIID(riid, IID_IContextMenu)) + { + *ppv = (LPCONTEXTMENU) this; + } + else if (IsEqualIID(riid, IID_IContextMenu2)) + { + *ppv = (IContextMenu2*) this; + } + else if (IsEqualIID(riid, IID_IContextMenu3)) + { + *ppv = (IContextMenu3*) this; + } + + if (*ppv) + { + AddRef(); + return NOERROR; + } + + return E_NOINTERFACE; +}
 
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
 
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
 
235
236
237
238
239
240
241
242
243
244
245
 
250
251
252
253
254
255
256
257
258
259
260
261
 
142
143
144
 
 
 
 
 
 
 
145
146
147
148
149
150
 
 
 
 
 
 
151
152
153
 
186
187
188
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
189
190
191
 
193
194
195
 
 
 
 
 
196
197
198
 
203
204
205
 
 
 
 
 
 
 
 
 
@@ -142,25 +142,12 @@
  CShellExt::IncDllRef();  }   -CShellExtCMenu::CShellExtCMenu(char dummy) : - m_ppszFileUserClickedOn(0) -{ - m_cRef = 0L; - CShellExt::IncDllRef(); -} -    CShellExtOverlay::~CShellExtOverlay()  {   CShellExt::DecDllRef();  }   -CShellExtCMenu::~CShellExtCMenu() -{ - CShellExt::DecDllRef(); -} - -  LPCRITICAL_SECTION CShellExt::GetCriticalSection()  {   return &g_critical_section; @@ -199,35 +186,6 @@
  return E_NOINTERFACE;  }   -STDMETHODIMP CShellExtCMenu::QueryInterface(REFIID riid, LPVOID FAR* ppv) -{ - *ppv = NULL; - if (IsEqualIID(riid, IID_IShellExtInit) || IsEqualIID(riid, IID_IUnknown)) - { - *ppv = (LPSHELLEXTINIT) this; - } - else if (IsEqualIID(riid, IID_IContextMenu)) - { - *ppv = (LPCONTEXTMENU) this; - } - else if (IsEqualIID(riid, IID_IContextMenu2)) - { - *ppv = (IContextMenu2*) this; - } - else if (IsEqualIID(riid, IID_IContextMenu3)) - { - *ppv = (IContextMenu3*) this; - } - - if (*ppv) - { - AddRef(); - return NOERROR; - } - - return E_NOINTERFACE; -} -    STDMETHODIMP_(ULONG) CShellExtOverlay::AddRef()  { @@ -235,11 +193,6 @@
  return ++m_cRef;  }   -STDMETHODIMP_(ULONG) CShellExtCMenu::AddRef() -{ - ThgCriticalSection cs(CShellExt::GetCriticalSection()); - return ++m_cRef; -}      STDMETHODIMP_(ULONG) CShellExtOverlay::Release() @@ -250,12 +203,3 @@
  delete this;   return 0L;  } - -STDMETHODIMP_(ULONG) CShellExtCMenu::Release() -{ - ThgCriticalSection cs(CShellExt::GetCriticalSection()); - if(--m_cRef) - return m_cRef; - delete this; - return 0L; -}