summaryrefslogtreecommitdiff
path: root/protocols/Skype
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2012-10-25 19:14:12 +0000
committerKirill Volinsky <mataes2007@gmail.com>2012-10-25 19:14:12 +0000
commit831067a0bad76972d1f4739c14e858bb053a8042 (patch)
treecfd52447e5d910d9947f7f56d0abb855b8194cf4 /protocols/Skype
parent9732b636e4df2c53a99c3cf9810d4f7540a88d87 (diff)
more correct way of copying skypekit
git-svn-id: http://svn.miranda-ng.org/main/trunk@2078 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Skype')
-rw-r--r--protocols/Skype/src/skype.cpp64
1 files changed, 33 insertions, 31 deletions
diff --git a/protocols/Skype/src/skype.cpp b/protocols/Skype/src/skype.cpp
index cc93390ec5..80ba931a6b 100644
--- a/protocols/Skype/src/skype.cpp
+++ b/protocols/Skype/src/skype.cpp
@@ -174,43 +174,45 @@ int StartSkypeRuntime()
mir_sntprintf(szFilename, SIZEOF(szFilename), _T("%s\\%s"), szFilename, _T("SkypeKit.exe"));
if (!PathFileExists(szFilename))
{
- // Check the current process's "run as administrator" status.
- // Elevate the process if it is not run as administrator.
- if (!IsRunAsAdmin())
- {
- wchar_t szPath[MAX_PATH], cmdLine[100];
- GetModuleFileName(NULL, szPath, ARRAYSIZE(szPath));
- TCHAR *profilename = Utils_ReplaceVarsT(_T("%miranda_profilename%"));
- mir_sntprintf(cmdLine, SIZEOF(cmdLine), _T(" /restart:%d /profile=%s"), GetCurrentProcessId(), profilename);
- // Launch itself as administrator.
- SHELLEXECUTEINFO sei = { sizeof(sei) };
- sei.lpVerb = L"runas";
- sei.lpFile = szPath;
- sei.lpParameters = cmdLine;
- //sei.hwnd = hDlg;
- sei.nShow = SW_NORMAL;
-
- if (!ShellExecuteEx(&sei))
- {
- DWORD dwError = GetLastError();
- if (dwError == ERROR_CANCELLED)
- {
- // The user refused to allow privileges elevation.
- // Do nothing ...
- }
- }
- else
- {
- //DestroyWindow(hDlg); // Quit itself
- CallService("CloseAction", 0, 0);
- }
- }
if ((hFile = CreateFile(szFilename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0)) != INVALID_HANDLE_VALUE) {
WriteFile(hFile, (void *)pData, dwSize, &written, NULL);
CloseHandle(hFile);
}
else
+ {
+ // Check the current process's "run as administrator" status.
+ // Elevate the process if it is not run as administrator.
+ if (!IsRunAsAdmin())
+ {
+ wchar_t szPath[MAX_PATH], cmdLine[100];
+ GetModuleFileName(NULL, szPath, ARRAYSIZE(szPath));
+ TCHAR *profilename = Utils_ReplaceVarsT(_T("%miranda_profilename%"));
+ mir_sntprintf(cmdLine, SIZEOF(cmdLine), _T(" /restart:%d /profile=%s"), GetCurrentProcessId(), profilename);
+ // Launch itself as administrator.
+ SHELLEXECUTEINFO sei = { sizeof(sei) };
+ sei.lpVerb = L"runas";
+ sei.lpFile = szPath;
+ sei.lpParameters = cmdLine;
+ //sei.hwnd = hDlg;
+ sei.nShow = SW_NORMAL;
+
+ if (!ShellExecuteEx(&sei))
+ {
+ DWORD dwError = GetLastError();
+ if (dwError == ERROR_CANCELLED)
+ {
+ // The user refused to allow privileges elevation.
+ // Do nothing ...
+ }
+ }
+ else
+ {
+ //DestroyWindow(hDlg); // Quit itself
+ CallService("CloseAction", 0, 0);
+ }
+ }
return 0;
+ }
}
}
}