mirror of
https://github.com/ONLYOFFICE/desktop-apps.git
synced 2026-04-07 14:09:22 +08:00
1
.gitignore
vendored
1
.gitignore
vendored
@ -38,6 +38,7 @@ Makefile
|
||||
Makefile.*
|
||||
*.stash
|
||||
*.user
|
||||
*.user.*
|
||||
*.xcuserstate
|
||||
*.xcuserdatad
|
||||
*.xcscmblueprint
|
||||
|
||||
@ -3,4 +3,4 @@ DESTDIR = $$PWD
|
||||
include(common.pri)
|
||||
|
||||
DEFINES += COPYRIGHT_YEAR=$${CURRENT_YEAR}
|
||||
DEFINES += APP_ICON_PATH=\"./res/icons/desktopeditors.ico\"
|
||||
DEFINES += APP_ICON_PATH=\"./icons/desktopeditors.ico\"
|
||||
|
||||
@ -30,7 +30,7 @@ ENV_PRODUCT_VERSION = $$(PRODUCT_VERSION)
|
||||
}
|
||||
|
||||
core_windows {
|
||||
RC_FILE = $$PWD/version.rc
|
||||
RC_FILE = $$PWD/res/version.rc
|
||||
|
||||
CONFIG += embed_manifest_exe
|
||||
# Uncomment to testing service control
|
||||
@ -67,6 +67,9 @@ core_windows {
|
||||
$$PWD/src/classes/platform_win/cunzip.cpp \
|
||||
$$PWD/src/classes/platform_win/cdownloader.cpp
|
||||
|
||||
OTHER_FILES += $$PWD/res/version.rc \
|
||||
$$PWD/res/manifest/update-daemon.exe.manifest
|
||||
|
||||
build_xp {
|
||||
DESTDIR = $$DESTDIR/xp
|
||||
DEFINES += __OS_WIN_XP
|
||||
|
||||
@ -12,13 +12,4 @@
|
||||
/>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges>
|
||||
<requestedExecutionLevel
|
||||
level="requireAdministrator"
|
||||
uiAccess="false"/>
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
</assembly>
|
||||
@ -1,11 +1,11 @@
|
||||
#include "src/platform_win/resource.h"
|
||||
#include "../src/platform_win/resource.h"
|
||||
IDI_MAINICON ICON DISCARDABLE APP_ICON_PATH
|
||||
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "./res/manifest/update-daemon.manifest"
|
||||
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "./manifest/update-daemon.exe.manifest"
|
||||
|
||||
#include <windows.h>
|
||||
#define RC_COMPILE_FLAG
|
||||
# pragma code_page(65001)
|
||||
# include "src/version.h"
|
||||
# include "../src/version.h"
|
||||
#undef RC_COMPILE_FLAG
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
@ -95,7 +95,7 @@ int __cdecl _tmain (int argc, TCHAR *argv[])
|
||||
|
||||
CApplication app;
|
||||
CSvcManager upd;
|
||||
socket.onMessageReceived([&app](void *buff, size_t bufsize) {
|
||||
socket.onMessageReceived([&app](void *buff, size_t) {
|
||||
if (strcmp((const char*)buff, "stop") == 0)
|
||||
app.exit(0);
|
||||
});
|
||||
|
||||
@ -57,20 +57,16 @@ namespace NS_Utils
|
||||
{
|
||||
wstring GetLastErrorAsString()
|
||||
{
|
||||
DWORD errorMessageID = ::GetLastError();
|
||||
if (errorMessageID == 0)
|
||||
DWORD errID = ::GetLastError();
|
||||
if (errID == 0)
|
||||
return L"";
|
||||
|
||||
LPWSTR messageBuffer = NULL;
|
||||
size_t size = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
|
||||
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
NULL, errorMessageID,
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||
(LPWSTR)&messageBuffer, 0, NULL);
|
||||
|
||||
wstring message(messageBuffer, (int)size);
|
||||
LocalFree(messageBuffer);
|
||||
return message;
|
||||
LPWSTR msgBuff = NULL;
|
||||
size_t size = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
NULL, errID, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)&msgBuff, 0, NULL);
|
||||
wstring msg(msgBuff, size);
|
||||
LocalFree(msgBuff);
|
||||
return msg;
|
||||
}
|
||||
|
||||
int ShowMessage(wstring str, bool showError)
|
||||
@ -78,11 +74,11 @@ namespace NS_Utils
|
||||
if (showError)
|
||||
str += L" " + GetLastErrorAsString();
|
||||
wchar_t *title = const_cast<LPTSTR>(TEXT(VER_PRODUCTNAME_STR));
|
||||
size_t title_size = wcslen(title) * sizeof(wchar_t);
|
||||
DWORD title_size = (DWORD)wcslen(title) * sizeof(wchar_t);
|
||||
DWORD res;
|
||||
DWORD session_id = WTSGetActiveConsoleSessionId();
|
||||
WTSSendMessageW(WTS_CURRENT_SERVER_HANDLE, session_id, title, title_size,
|
||||
const_cast<LPTSTR>(str.c_str()), str.size() * sizeof(wchar_t),
|
||||
const_cast<LPTSTR>(str.c_str()), (DWORD)str.size() * sizeof(wchar_t),
|
||||
MB_OK | MB_ICONERROR | MB_SERVICE_NOTIFICATION_NT3X | MB_SETFOREGROUND, 8, &res, TRUE);
|
||||
return res;
|
||||
}
|
||||
@ -335,7 +331,7 @@ namespace NS_File
|
||||
|
||||
bool removeFile(const wstring &filePath)
|
||||
{
|
||||
return DeleteFile(filePath.c_str()) != 0 ? true : false;
|
||||
return DeleteFile(filePath.c_str()) != 0;
|
||||
}
|
||||
|
||||
bool removeDirRecursively(const wstring &dir)
|
||||
@ -381,9 +377,7 @@ namespace NS_File
|
||||
if (!WTSQueryUserToken(sesId, &hUserToken)) {
|
||||
WCHAR buff[MAX_PATH] = {0};
|
||||
DWORD res = ::GetTempPath(MAX_PATH, buff);
|
||||
if (res != 0)
|
||||
return fromNativeSeparators(parentPath(buff));
|
||||
return L"";
|
||||
return (res != 0) ? fromNativeSeparators(parentPath(buff)) : L"";
|
||||
}
|
||||
|
||||
HANDLE hTokenDup = NULL;
|
||||
@ -407,10 +401,7 @@ namespace NS_File
|
||||
{
|
||||
WCHAR buff[MAX_PATH];
|
||||
DWORD res = ::GetModuleFileName(NULL, buff, MAX_PATH);
|
||||
if (res != 0) {
|
||||
return fromNativeSeparators(parentPath(wstring(buff)));
|
||||
}
|
||||
return L"";
|
||||
return (res != 0) ? fromNativeSeparators(parentPath(buff)) : L"";
|
||||
}
|
||||
|
||||
string getFileHash(const wstring &fileName)
|
||||
@ -517,11 +508,7 @@ namespace NS_File
|
||||
winTrustData.pwszURLReference = NULL;
|
||||
winTrustData.dwUIContext = 0;
|
||||
winTrustData.pFile = &fileInfo;
|
||||
|
||||
LONG lStatus = WinVerifyTrust(NULL, &guidAction, &winTrustData);
|
||||
if (lStatus == ERROR_SUCCESS)
|
||||
return true;
|
||||
return false;
|
||||
return WinVerifyTrust(NULL, &guidAction, &winTrustData) == ERROR_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user