Skip to content

Commit d5d8caf

Browse files
committed
Fix x86 build, change ASSOC_PROGID_FORMAT to C-style enum
x86 build is needed since x64 systems have a WOW64 OpenWith.exe. Judging by the name format of ASSOC_PROGID_FORMAT, it was originally a C-style enum, and not a C++ enum class.
1 parent e18c2b3 commit d5d8caf

9 files changed

Lines changed: 66 additions & 84 deletions

src/OpenWithEx.vcxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
<SubSystem>Windows</SubSystem>
108108
<GenerateDebugInformation>true</GenerateDebugInformation>
109109
<MinimumRequiredVersion>6.0</MinimumRequiredVersion>
110-
<AdditionalDependencies>shell32.lib;shlwapi.lib;comctl32.lib;uxtheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
110+
<AdditionalDependencies>shell32.lib;shlwapi.lib;comctl32.lib;uxtheme.lib;crypt32.lib;bcrypt.lib;rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
111111
<AdditionalManifestDependencies>"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'";%(AdditionalManifestDependencies)</AdditionalManifestDependencies>
112112
</Link>
113113
<ResourceCompile>
@@ -146,7 +146,7 @@ link /dll /noentry /out:"$(OutDir)en-US\$(TargetFileName).mui" $(IntermediateOut
146146
<OptimizeReferences>true</OptimizeReferences>
147147
<GenerateDebugInformation>true</GenerateDebugInformation>
148148
<MinimumRequiredVersion>6.0</MinimumRequiredVersion>
149-
<AdditionalDependencies>shell32.lib;shlwapi.lib;comctl32.lib;uxtheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
149+
<AdditionalDependencies>shell32.lib;shlwapi.lib;comctl32.lib;uxtheme.lib;crypt32.lib;bcrypt.lib;rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
150150
<AdditionalManifestDependencies>"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'";%(AdditionalManifestDependencies)</AdditionalManifestDependencies>
151151
</Link>
152152
<ResourceCompile>

src/baseopenasdlg.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ void CBaseOpenAsDlg::_OnOk()
437437
// If our association handler already supports ProgIDs, then we'll
438438
// just retrieve that ProgID.
439439
pAssocInfo->GetInternalProgID(
440-
ASSOC_PROGID_FORMAT::APF_DEFAULT,
440+
APF_DEFAULT,
441441
&lpszProgId
442442
);
443443
}
@@ -447,7 +447,7 @@ void CBaseOpenAsDlg::_OnOk()
447447
// to tell the system to make one. The following is what TWinUI does,
448448
// although I'm not sure the significance of APF_APPLICATION here.
449449
pAssocInfo->GetInternalProgID(
450-
ASSOC_PROGID_FORMAT::APF_APPLICATION,
450+
APF_APPLICATION,
451451
&lpszProgId
452452
);
453453

src/iassochandler_internal.h

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,30 +21,12 @@
2121
/**
2222
* Format for IAssocHandlerInfo::GetInternalProgID.
2323
*/
24-
enum class ASSOC_PROGID_FORMAT : int
24+
enum ASSOC_PROGID_FORMAT
2525
{
2626
APF_DEFAULT = 0,
2727
APF_APPLICATION = 1,
2828
};
2929

30-
///**
31-
// * These are internal flags returned by IAssocHandlerInfo::GetFlags.
32-
// *
33-
// * Names are taken from:
34-
// * https://github.com/marlersoft/cwin32/blob/c0dbf4dbe4867bd197ea499f4770d4c10893448e/include/ui/shell.h#L3506-L3515
35-
// */
36-
//enum class AHTYPE : int
37-
//{
38-
// UNDEFINED = 0x0,
39-
// USER_APPLICATION = 0x8,
40-
// ANY_APPLICATION = 0x10,
41-
// MACHINE_DEFAULT = 0x20,
42-
// PROGID = 0x40,
43-
// APPLICATION = 0x80,
44-
// CLASS_APPLICATION = 0x100,
45-
// ANY_PROGID = 0x200,
46-
//};
47-
4830
MIDL_INTERFACE("D5C0CDAC-7A15-4F0A-87BA-2E7AAF19E0EC")
4931
IAssocHandlerInfo : public IUnknown
5032
{
@@ -53,7 +35,7 @@ IAssocHandlerInfo : public IUnknown
5335
*
5436
* This is used to highlight newly-installed applications in the GUI.
5537
*/
56-
virtual bool IsRecentlyInstalled() = 0;
38+
STDMETHOD_(bool, IsRecentlyInstalled)() PURE;
5739

5840
/**
5941
* Get the internal ProgID of the handler.
@@ -62,14 +44,14 @@ IAssocHandlerInfo : public IUnknown
6244
* a generated ProgID from the application path if no ProgID exists for the
6345
* handler.
6446
*/
65-
virtual HRESULT GetInternalProgID(ASSOC_PROGID_FORMAT fmt, LPWSTR *ppszProgId) = 0;
47+
STDMETHOD(GetInternalProgID)(ASSOC_PROGID_FORMAT fmt, LPWSTR *ppszProgId) PURE;
6648

6749
/**
6850
* Gets the type of the association handler.
6951
*
7052
* @see {@link AHTYPE}
7153
*/
72-
virtual HRESULT GetHandlerType(AHTYPE *pAssociationTypeOut) = 0;
54+
STDMETHOD(GetHandlerType)(AHTYPE *pAssociationTypeOut) PURE;
7355
};
7456

7557
MIDL_INTERFACE("E1B15A0F-2139-44F2-8C6C-3D2CA890F9D9")
@@ -90,7 +72,7 @@ IAssocHandlerWithCompanyName : public IUnknown
9072
* The above usage is the only usage of this function by the entire OS, so
9173
* assumedly TWinUI gets the company name in a different way.
9274
*/
93-
virtual HRESULT GetCompany(LPWSTR *ppszCompanyName) = 0;
75+
STDMETHOD(GetCompany)(LPWSTR *ppszCompanyName) PURE;
9476
};
9577

9678
enum ASSOCHANDLER_PROMPTUPDATE_BEHAVIOR
@@ -108,7 +90,7 @@ IAssocHandlerPromptCount : public IUnknown
10890
*
10991
* This is new behaviour as of Windows 10.
11092
*/
111-
virtual HRESULT UpdatePromptCount(ASSOCHANDLER_PROMPTUPDATE_BEHAVIOR) = 0;
93+
STDMETHOD(UpdatePromptCount)(ASSOCHANDLER_PROMPTUPDATE_BEHAVIOR) PURE;
11294
};
11395

11496
MIDL_INTERFACE("571A5DB3-3B08-441F-B796-68E8164259BB")
@@ -117,7 +99,7 @@ IAssocHandlerMakeDefault : public IUnknown
11799
/**
118100
* This method was removed at some point.
119101
*/
120-
virtual HRESULT placeholder0(void *) = 0;
102+
STDMETHOD(placeholder0)(void *) PURE;
121103

122104
/*
123105
* Tries to register the application association.
@@ -152,5 +134,5 @@ IAssocHandlerMakeDefault : public IUnknown
152134
* Obviously, it is not used when some sort of registration already exists,
153135
* such as a ProgID.
154136
*/
155-
virtual HRESULT TryRegisterApplicationAssoc() = 0;
137+
STDMETHOD(TryRegisterApplicationAssoc)() PURE;
156138
};

src/iassociationelement.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ MIDL_INTERFACE("D8F6AD5B-B44F-4BCC-88FD-EB3473DB7502")
2121
IAssociationElement : IUnknown
2222
{
2323
public:
24-
virtual HRESULT QueryString(ASSOCQUERY flags, PCWSTR lpValueName, PWSTR *ppszOut) = 0;
25-
virtual HRESULT QueryDword(ASSOCQUERY flags, PCWSTR lpValueName, DWORD *pdwOut) = 0;
26-
virtual HRESULT QueryExists(ASSOCQUERY flags, PCWSTR lpValueName) = 0;
27-
virtual HRESULT QueryDirect(ASSOCQUERY flags, PCWSTR lpValueName, FLAGGED_BYTE_BLOB **) = 0;
28-
virtual HRESULT QueryObject(ASSOCQUERY flags, PCWSTR lpValueName, REFIID riid, void **ppvObject) = 0;
29-
virtual HRESULT QueryGuid(ASSOCQUERY flags, PCWSTR lpValueName, GUID *pGuidOut) = 0;
24+
STDMETHOD(QueryString)(ASSOCQUERY flags, PCWSTR lpValueName, PWSTR *ppszOut) PURE;
25+
STDMETHOD(QueryDword)(ASSOCQUERY flags, PCWSTR lpValueName, DWORD *pdwOut) PURE;
26+
STDMETHOD(QueryExists)(ASSOCQUERY flags, PCWSTR lpValueName) PURE;
27+
STDMETHOD(QueryDirect)(ASSOCQUERY flags, PCWSTR lpValueName, FLAGGED_BYTE_BLOB **) PURE;
28+
STDMETHOD(QueryObject)(ASSOCQUERY flags, PCWSTR lpValueName, REFIID riid, void **ppvObject) PURE;
29+
STDMETHOD(QueryGuid)(ASSOCQUERY flags, PCWSTR lpValueName, GUID *pGuidOut) PURE;
3030
};

src/iobjectwithassociationelement.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ MIDL_INTERFACE("E157C3A1-A532-4DE2-9480-1452B7426EEE")
99
IObjectWithAssociationElement : IUnknown
1010
{
1111
public:
12-
virtual HRESULT SetAssocElement(IAssociationElement *pae) = 0;
13-
virtual HRESULT GetAssocElement(REFIID riid, void **ppv) = 0;
12+
STDMETHOD(SetAssocElement)(IAssociationElement *pae) PURE;
13+
STDMETHOD(GetAssocElement)(REFIID riid, void **ppv) PURE;
1414
};

src/iobjectwithopenwithflags.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ MIDL_INTERFACE("9D923EDC-B7A9-4F77-9933-284E7E2B2536")
77
IObjectWithOpenWithFlags : IUnknown
88
{
99
public:
10-
virtual HRESULT get_Flags(IMMERSIVE_OPENWITH_FLAGS *out) = 0;
10+
STDMETHOD(get_Flags)(IMMERSIVE_OPENWITH_FLAGS *out) PURE;
1111
};

src/iopenwithlauncher.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ MIDL_INTERFACE("6A283FE2-ECFA-4599-91C4-E80957137B26")
77
IOpenWithLauncher : public IUnknown
88
{
99
public:
10-
virtual HRESULT Launch(HWND hWndParent, LPCWSTR lpszPath, IMMERSIVE_OPENWITH_FLAGS flags) = 0;
10+
STDMETHOD(Launch)(HWND hWndParent, LPCWSTR lpszPath, IMMERSIVE_OPENWITH_FLAGS flags) PURE;
1111
};

src/openwithexlauncher.cpp

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ void COpenWithExLauncher::Log(const wchar_t *szMethodName, const wchar_t *format
5252
fFailedToFind = false; \
5353
}
5454

55-
HRESULT COpenWithExLauncher::QueryInterface(REFIID riid, LPVOID *ppvObj)
55+
STDMETHODIMP COpenWithExLauncher::QueryInterface(REFIID riid, LPVOID *ppvObj)
5656
{
5757
DebugSetMethodName(L"COpenWithExLauncher::QueryInterface");
5858
HRESULT hr = E_NOINTERFACE;
@@ -113,7 +113,7 @@ HRESULT COpenWithExLauncher::QueryInterface(REFIID riid, LPVOID *ppvObj)
113113
}
114114

115115

116-
ULONG COpenWithExLauncher::AddRef()
116+
STDMETHODIMP_(ULONG) COpenWithExLauncher::AddRef()
117117
{
118118
DebugSetMethodName(L"COpenWithExLauncher::AddRef");
119119

@@ -124,7 +124,7 @@ ULONG COpenWithExLauncher::AddRef()
124124
return rv;
125125
}
126126

127-
ULONG COpenWithExLauncher::Release()
127+
STDMETHODIMP_(ULONG) COpenWithExLauncher::Release()
128128
{
129129
DebugSetMethodName(L"COpenWithExLauncher::Release");
130130

@@ -146,7 +146,7 @@ ULONG COpenWithExLauncher::Release()
146146
#pragma endregion // "IUnknown"
147147

148148
#pragma region "IExecuteCommandApplicationHostEnvironment"
149-
HRESULT COpenWithExLauncher::GetValue(AHE_TYPE *pahe)
149+
STDMETHODIMP COpenWithExLauncher::GetValue(AHE_TYPE *pahe)
150150
{
151151
DebugSetMethodName(L"COpenWithExLauncher::GetValue");
152152

@@ -170,7 +170,7 @@ HRESULT COpenWithExLauncher::GetValue(AHE_TYPE *pahe)
170170
#pragma endregion // "IExecuteCommandApplicationHostEnvironment"
171171

172172
#pragma region "IServiceProvider"
173-
HRESULT COpenWithExLauncher::QueryService(REFGUID guidService, REFIID riid, void **ppvObject)
173+
STDMETHODIMP COpenWithExLauncher::QueryService(REFGUID guidService, REFIID riid, void **ppvObject)
174174
{
175175
DebugSetMethodName(L"COpenWithExLauncher::QueryService");
176176

@@ -193,7 +193,7 @@ HRESULT COpenWithExLauncher::QueryService(REFGUID guidService, REFIID riid, void
193193
#pragma endregion // "IServiceProvider"
194194

195195
#pragma region "IObjectWithSite"
196-
HRESULT COpenWithExLauncher::GetSite(REFIID riid, void **ppvObject)
196+
STDMETHODIMP COpenWithExLauncher::GetSite(REFIID riid, void **ppvObject)
197197
{
198198
DebugSetMethodName(L"COpenWithExLauncher::GetSite");
199199

@@ -209,7 +209,7 @@ HRESULT COpenWithExLauncher::GetSite(REFIID riid, void **ppvObject)
209209
}
210210
}
211211

212-
HRESULT COpenWithExLauncher::SetSite(IUnknown *pUnkSite)
212+
STDMETHODIMP COpenWithExLauncher::SetSite(IUnknown *pUnkSite)
213213
{
214214
DebugSetMethodName(L"COpenWithExLauncher::SetSite");
215215

@@ -221,7 +221,7 @@ HRESULT COpenWithExLauncher::SetSite(IUnknown *pUnkSite)
221221
#pragma endregion // "IObjectWithSite"
222222

223223
#pragma region "IObjectWithAssociationElement"
224-
HRESULT COpenWithExLauncher::SetAssocElement(IAssociationElement *pae)
224+
STDMETHODIMP COpenWithExLauncher::SetAssocElement(IAssociationElement *pae)
225225
{
226226
DebugSetMethodName(L"COpenWithExLauncher::SetAssocElement");
227227

@@ -231,7 +231,7 @@ HRESULT COpenWithExLauncher::SetAssocElement(IAssociationElement *pae)
231231
return S_OK;
232232
}
233233

234-
HRESULT COpenWithExLauncher::GetAssocElement(REFIID riid, void **ppv)
234+
STDMETHODIMP COpenWithExLauncher::GetAssocElement(REFIID riid, void **ppv)
235235
{
236236
DebugSetMethodName(L"COpenWithExLauncher::GetAssocElement");
237237

@@ -248,7 +248,7 @@ HRESULT COpenWithExLauncher::GetAssocElement(REFIID riid, void **ppv)
248248
#pragma endregion // "IObjectWithAssociationElement"
249249

250250
#pragma region "IObjectWithSelection"
251-
HRESULT COpenWithExLauncher::GetSelection(REFIID riid, void **ppv)
251+
STDMETHODIMP COpenWithExLauncher::GetSelection(REFIID riid, void **ppv)
252252
{
253253
DebugSetMethodName(L"COpenWithExLauncher::GetSelection");
254254

@@ -263,7 +263,7 @@ HRESULT COpenWithExLauncher::GetSelection(REFIID riid, void **ppv)
263263
}
264264
}
265265

266-
HRESULT COpenWithExLauncher::SetSelection(IShellItemArray *psia)
266+
STDMETHODIMP COpenWithExLauncher::SetSelection(IShellItemArray *psia)
267267
{
268268
DebugSetMethodName(L"COpenWithExLauncher::SetSelection");
269269

@@ -275,7 +275,7 @@ HRESULT COpenWithExLauncher::SetSelection(IShellItemArray *psia)
275275
#pragma endregion // "IObjectWithSelection"
276276

277277
#pragma region "IInitializeCommand"
278-
HRESULT COpenWithExLauncher::Initialize(LPCWSTR pszCommandName, IPropertyBag *ppb)
278+
STDMETHODIMP COpenWithExLauncher::Initialize(LPCWSTR pszCommandName, IPropertyBag *ppb)
279279
{
280280
DebugSetMethodName(L"COpenWithExLauncher::Initialize");
281281

@@ -286,7 +286,7 @@ HRESULT COpenWithExLauncher::Initialize(LPCWSTR pszCommandName, IPropertyBag *pp
286286
#pragma endregion // "IInitializeCommand"
287287

288288
#pragma region "IExecuteCommand"
289-
HRESULT COpenWithExLauncher::SetKeyState(DWORD grfKeyState)
289+
STDMETHODIMP COpenWithExLauncher::SetKeyState(DWORD grfKeyState)
290290
{
291291
DebugSetMethodName(L"COpenWithExLauncher::SetKeyState");
292292

@@ -297,7 +297,7 @@ HRESULT COpenWithExLauncher::SetKeyState(DWORD grfKeyState)
297297
return S_OK;
298298
}
299299

300-
HRESULT COpenWithExLauncher::SetParameters(__RPC__in_string LPCWSTR pszParameters)
300+
STDMETHODIMP COpenWithExLauncher::SetParameters(__RPC__in_string LPCWSTR pszParameters)
301301
{
302302
DebugSetMethodName(L"COpenWithExLauncher::SetParameters");
303303

@@ -308,7 +308,7 @@ HRESULT COpenWithExLauncher::SetParameters(__RPC__in_string LPCWSTR pszParameter
308308
return S_OK;
309309
}
310310

311-
HRESULT COpenWithExLauncher::SetPosition(POINT pt)
311+
STDMETHODIMP COpenWithExLauncher::SetPosition(POINT pt)
312312
{
313313
DebugSetMethodName(L"COpenWithExLauncher::SetPosition");
314314

@@ -319,7 +319,7 @@ HRESULT COpenWithExLauncher::SetPosition(POINT pt)
319319
return S_OK;
320320
}
321321

322-
HRESULT COpenWithExLauncher::SetShowWindow(int nShow)
322+
STDMETHODIMP COpenWithExLauncher::SetShowWindow(int nShow)
323323
{
324324
DebugSetMethodName(L"COpenWithExLauncher::SetShowWindow");
325325

@@ -330,7 +330,7 @@ HRESULT COpenWithExLauncher::SetShowWindow(int nShow)
330330
return S_OK;
331331
}
332332

333-
HRESULT COpenWithExLauncher::SetNoShowUI(BOOL fNoShowUI)
333+
STDMETHODIMP COpenWithExLauncher::SetNoShowUI(BOOL fNoShowUI)
334334
{
335335
DebugSetMethodName(L"COpenWithExLauncher::SetNoShowUI");
336336

@@ -341,7 +341,7 @@ HRESULT COpenWithExLauncher::SetNoShowUI(BOOL fNoShowUI)
341341
return S_OK;
342342
}
343343

344-
HRESULT COpenWithExLauncher::SetDirectory(__RPC__in_string LPCWSTR pszDirectory)
344+
STDMETHODIMP COpenWithExLauncher::SetDirectory(__RPC__in_string LPCWSTR pszDirectory)
345345
{
346346
DebugSetMethodName(L"COpenWithExLauncher::SetDirectory");
347347

@@ -352,7 +352,7 @@ HRESULT COpenWithExLauncher::SetDirectory(__RPC__in_string LPCWSTR pszDirectory)
352352
return S_OK;
353353
}
354354

355-
HRESULT COpenWithExLauncher::Execute()
355+
STDMETHODIMP COpenWithExLauncher::Execute()
356356
{
357357
DebugSetMethodName(L"COpenWithExLauncher::Execute");
358358

@@ -418,7 +418,7 @@ HRESULT COpenWithExLauncher::Execute()
418418
#pragma endregion
419419

420420
#pragma region "IOpenWithLauncher"
421-
HRESULT COpenWithExLauncher::Launch(HWND hWndParent, LPCWSTR lpszPath, IMMERSIVE_OPENWITH_FLAGS flags)
421+
STDMETHODIMP COpenWithExLauncher::Launch(HWND hWndParent, LPCWSTR lpszPath, IMMERSIVE_OPENWITH_FLAGS flags)
422422
{
423423
debuglog(
424424
L"[COpenWithExLauncher] IOpenWithLauncher::Launch info:\n"
@@ -432,7 +432,7 @@ HRESULT COpenWithExLauncher::Launch(HWND hWndParent, LPCWSTR lpszPath, IMMERSIVE
432432
#pragma endregion // "IOpenWithLauncher"
433433

434434
#pragma region "IClassFactory"
435-
HRESULT COpenWithExLauncher::CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppvObject)
435+
STDMETHODIMP COpenWithExLauncher::CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppvObject)
436436
{
437437
DebugSetMethodName(L"COpenWithExLauncher::CreateInstance");
438438

@@ -458,7 +458,7 @@ HRESULT COpenWithExLauncher::CreateInstance(IUnknown *pUnkOuter, REFIID riid, vo
458458
return S_OK;
459459
}
460460

461-
HRESULT COpenWithExLauncher::LockServer(BOOL fLock)
461+
STDMETHODIMP COpenWithExLauncher::LockServer(BOOL fLock)
462462
{
463463
DebugSetMethodName(L"COpenWithExLauncher::LockServer");
464464

0 commit comments

Comments
 (0)