From 7fb342fec3c7b5cc91a53b041d99f09f09d70cb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Sat, 26 Mar 2016 02:11:58 +0000 Subject: [PATCH] [SYSSETUP] - Reduce the C COM "ugliness" by using suitable macros. Thanks to Mark Jansen for having pointed that. - Use sizeof() instead of ARRAYSIZE() * sizeof(WCHAR) to do the same thing. svn path=/trunk/; revision=71051 --- reactos/dll/win32/syssetup/install.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/reactos/dll/win32/syssetup/install.c b/reactos/dll/win32/syssetup/install.c index 6d467b1a61f..26235e1a5b6 100644 --- a/reactos/dll/win32/syssetup/install.c +++ b/reactos/dll/win32/syssetup/install.c @@ -28,6 +28,8 @@ #include "precomp.h" +#define COBJMACROS + #include #include #include @@ -35,6 +37,7 @@ #include #include #include +#include #include #include @@ -83,44 +86,44 @@ CreateShellLink( INT iIconNr, LPCWSTR pszComment) { - IShellLink *psl; + IShellLinkW *psl; IPersistFile *ppf; HRESULT hr = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, &IID_IShellLink, (LPVOID*)&psl); if (SUCCEEDED(hr)) { - hr = psl->lpVtbl->SetPath(psl, pszCmd); + hr = IShellLinkW_SetPath(psl, pszCmd); if (pszArg) { - hr = psl->lpVtbl->SetArguments(psl, pszArg); + hr = IShellLinkW_SetArguments(psl, pszArg); } if (pszDir) { - hr = psl->lpVtbl->SetWorkingDirectory(psl, pszDir); + hr = IShellLinkW_SetWorkingDirectory(psl, pszDir); } if (pszIconPath) { - hr = psl->lpVtbl->SetIconLocation(psl, pszIconPath, iIconNr); + hr = IShellLinkW_SetIconLocation(psl, pszIconPath, iIconNr); } if (pszComment) { - hr = psl->lpVtbl->SetDescription(psl, pszComment); + hr = IShellLinkW_SetDescription(psl, pszComment); } - hr = psl->lpVtbl->QueryInterface(psl, &IID_IPersistFile, (LPVOID*)&ppf); + hr = IShellLinkW_QueryInterface(psl, &IID_IPersistFile, (LPVOID*)&ppf); if (SUCCEEDED(hr)) { - hr = ppf->lpVtbl->Save(ppf, pszLinkPath, TRUE); - ppf->lpVtbl->Release(ppf); + hr = IPersistFile_Save(ppf, pszLinkPath, TRUE); + IPersistFile_Release(ppf); } - psl->lpVtbl->Release(psl); + IShellLinkW_Release(psl); } return hr; @@ -297,7 +300,7 @@ CreateTempDir( } /* Get temp dir */ - dwLength = ARRAYSIZE(szBuffer) * sizeof(WCHAR); + dwLength = sizeof(szBuffer); if (RegQueryValueExW(hKey, VarName, NULL,