summaryrefslogtreecommitdiff
path: root/plugins/Toaster/src/add_to_start_menu.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Toaster/src/add_to_start_menu.cpp')
-rw-r--r--plugins/Toaster/src/add_to_start_menu.cpp35
1 files changed, 6 insertions, 29 deletions
diff --git a/plugins/Toaster/src/add_to_start_menu.cpp b/plugins/Toaster/src/add_to_start_menu.cpp
index ae2d1e7131..ac0f2ff7b2 100644
--- a/plugins/Toaster/src/add_to_start_menu.cpp
+++ b/plugins/Toaster/src/add_to_start_menu.cpp
@@ -1,38 +1,15 @@
#include "stdafx.h"
+#define SHORTCUT_PATH "\\Microsoft\\Windows\\Start Menu\\Programs\\Miranda NG.lnk"
+
using namespace Microsoft::WRL;
wchar_t* GetShortcutPath()
{
- wchar_t shortcutPath[MAX_PATH];
- GetEnvironmentVariable(_T("APPDATA"), shortcutPath, MAX_PATH);
- wcscat_s(shortcutPath, ARRAYSIZE(shortcutPath), L"\\Microsoft\\Windows\\Start Menu\\Programs\\Miranda NG.lnk");
-
- return mir_wstrdup(shortcutPath);
-}
-
-HRESULT ShortcutExists()
-{
- HRESULT hr;
- DWORD attributes = GetFileAttributes(ptrW(GetShortcutPath()));
- bool fileExists = attributes < 0xFFFFFFF;
-
- if (!fileExists)
- {
- hr = S_OK;
- }
- else
- {
- hr = S_FALSE;
- }
- return hr;
-}
-
-HRESULT TryCreateShortcut()
-{
- if (!ShortcutExists())
- return InstallShortcut(ptrW(GetShortcutPath()));
- return S_OK;
+ wchar_t path[MAX_PATH];
+ GetEnvironmentVariable(_T("APPDATA"), path, MAX_PATH);
+ wcscat_s(path, _T(SHORTCUT_PATH));
+ return mir_wstrdup(path);
}
HRESULT InstallShortcut(_In_z_ wchar_t *shortcutPath)