mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 09:43:04 +00:00
[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
This commit is contained in:
parent
7dc1d07379
commit
7fb342fec3
1 changed files with 14 additions and 11 deletions
|
@ -28,6 +28,8 @@
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
|
|
||||||
|
#define COBJMACROS
|
||||||
|
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <wincon.h>
|
#include <wincon.h>
|
||||||
#include <winnls.h>
|
#include <winnls.h>
|
||||||
|
@ -35,6 +37,7 @@
|
||||||
#include <userenv.h>
|
#include <userenv.h>
|
||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
#include <shlwapi.h>
|
#include <shlwapi.h>
|
||||||
|
#include <shobjidl.h>
|
||||||
#include <rpcproxy.h>
|
#include <rpcproxy.h>
|
||||||
#include <ndk/cmfuncs.h>
|
#include <ndk/cmfuncs.h>
|
||||||
|
|
||||||
|
@ -83,44 +86,44 @@ CreateShellLink(
|
||||||
INT iIconNr,
|
INT iIconNr,
|
||||||
LPCWSTR pszComment)
|
LPCWSTR pszComment)
|
||||||
{
|
{
|
||||||
IShellLink *psl;
|
IShellLinkW *psl;
|
||||||
IPersistFile *ppf;
|
IPersistFile *ppf;
|
||||||
|
|
||||||
HRESULT hr = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, &IID_IShellLink, (LPVOID*)&psl);
|
HRESULT hr = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, &IID_IShellLink, (LPVOID*)&psl);
|
||||||
|
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
hr = psl->lpVtbl->SetPath(psl, pszCmd);
|
hr = IShellLinkW_SetPath(psl, pszCmd);
|
||||||
|
|
||||||
if (pszArg)
|
if (pszArg)
|
||||||
{
|
{
|
||||||
hr = psl->lpVtbl->SetArguments(psl, pszArg);
|
hr = IShellLinkW_SetArguments(psl, pszArg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pszDir)
|
if (pszDir)
|
||||||
{
|
{
|
||||||
hr = psl->lpVtbl->SetWorkingDirectory(psl, pszDir);
|
hr = IShellLinkW_SetWorkingDirectory(psl, pszDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pszIconPath)
|
if (pszIconPath)
|
||||||
{
|
{
|
||||||
hr = psl->lpVtbl->SetIconLocation(psl, pszIconPath, iIconNr);
|
hr = IShellLinkW_SetIconLocation(psl, pszIconPath, iIconNr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pszComment)
|
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))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
hr = ppf->lpVtbl->Save(ppf, pszLinkPath, TRUE);
|
hr = IPersistFile_Save(ppf, pszLinkPath, TRUE);
|
||||||
ppf->lpVtbl->Release(ppf);
|
IPersistFile_Release(ppf);
|
||||||
}
|
}
|
||||||
|
|
||||||
psl->lpVtbl->Release(psl);
|
IShellLinkW_Release(psl);
|
||||||
}
|
}
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
|
@ -297,7 +300,7 @@ CreateTempDir(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get temp dir */
|
/* Get temp dir */
|
||||||
dwLength = ARRAYSIZE(szBuffer) * sizeof(WCHAR);
|
dwLength = sizeof(szBuffer);
|
||||||
if (RegQueryValueExW(hKey,
|
if (RegQueryValueExW(hKey,
|
||||||
VarName,
|
VarName,
|
||||||
NULL,
|
NULL,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue