mirror of
https://github.com/ONLYOFFICE/desktop-apps.git
synced 2026-02-10 18:05:16 +08:00
[win] projicons: adjust shellassoc code indentation
This commit is contained in:
@ -590,56 +590,56 @@ bool SetUserFileAssoc(const std::vector<AssocPair> &assocList)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
char pBrowsrCmd[MAX_PATH] = {0};
|
char pBrowsrCmd[MAX_PATH] = {0};
|
||||||
if (_stricmp(data.extension.c_str(), "http") == 0 || _stricmp(data.extension.c_str(), "https") == 0) {
|
if (_stricmp(data.extension.c_str(), "http") == 0 || _stricmp(data.extension.c_str(), "https") == 0) {
|
||||||
if (_stricmp(data.progId.c_str(), EDGE_UWP_LEGACY_ID) == 0 || _stricmp(data.progId.c_str(), EDGE_UWP_MODERN_ID) == 0) {
|
if (_stricmp(data.progId.c_str(), EDGE_UWP_LEGACY_ID) == 0 || _stricmp(data.progId.c_str(), EDGE_UWP_MODERN_ID) == 0) {
|
||||||
strcpy_s(pBrowsrCmd, _countof(pBrowsrCmd), EDGE_UWP_EXE_PATH);
|
strcpy_s(pBrowsrCmd, _countof(pBrowsrCmd), EDGE_UWP_EXE_PATH);
|
||||||
} else {
|
} else {
|
||||||
if (!FindBrowserCommandByProtocol(HKEY_CURRENT_USER, data.extension.c_str(), data.progId.c_str(), sizeof(pBrowsrCmd), pBrowsrCmd))
|
if (!FindBrowserCommandByProtocol(HKEY_CURRENT_USER, data.extension.c_str(), data.progId.c_str(), sizeof(pBrowsrCmd), pBrowsrCmd))
|
||||||
FindBrowserCommandByProtocol(HKEY_LOCAL_MACHINE, data.extension.c_str(), data.progId.c_str(), sizeof(pBrowsrCmd), pBrowsrCmd);
|
FindBrowserCommandByProtocol(HKEY_LOCAL_MACHINE, data.extension.c_str(), data.progId.c_str(), sizeof(pBrowsrCmd), pBrowsrCmd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
char pSource[STRING_BUFFER];
|
||||||
char pSource[STRING_BUFFER];
|
if (winVer > Win8_1) {
|
||||||
if (winVer > Win8_1) {
|
std::string ts = GetRegistryKeyTimestampHex(data.regKeyPath.c_str());
|
||||||
std::string ts = GetRegistryKeyTimestampHex(data.regKeyPath.c_str());
|
std::string sid = GetCurrentUserSidString();
|
||||||
std::string sid = GetCurrentUserSidString();
|
if (winVer <= Win10UpTo1607) {
|
||||||
if (winVer <= Win10UpTo1607) {
|
snprintf(pSource, _countof(pSource), "%s%s%s%s%s%s", data.extension.c_str(), sid.c_str(), data.progId.c_str(), pBrowsrCmd, ts.c_str(), (const char*)ASSOC_DESCRIPTOR);
|
||||||
snprintf(pSource, _countof(pSource), "%s%s%s%s%s%s", data.extension.c_str(), sid.c_str(), data.progId.c_str(), pBrowsrCmd, ts.c_str(), (const char*)ASSOC_DESCRIPTOR);
|
} else {
|
||||||
|
snprintf(pSource, _countof(pSource), "%s%s%s%s%s", data.extension.c_str(), sid.c_str(), data.progId.c_str(), ts.c_str(), (const char*)ASSOC_DESCRIPTOR);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
snprintf(pSource, _countof(pSource), "%s%s%s%s%s", data.extension.c_str(), sid.c_str(), data.progId.c_str(), ts.c_str(), (const char*)ASSOC_DESCRIPTOR);
|
std::string sid = GetCurrentUserSidString();
|
||||||
|
snprintf(pSource, _countof(pSource), "%s%s%s%s", data.extension.c_str(), sid.c_str(), data.progId.c_str(), pBrowsrCmd);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
std::string sid = GetCurrentUserSidString();
|
|
||||||
snprintf(pSource, _countof(pSource), "%s%s%s%s", data.extension.c_str(), sid.c_str(), data.progId.c_str(), pBrowsrCmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t cbDest;
|
size_t cbDest;
|
||||||
wchar_t pDest[STRING_BUFFER] = {0};
|
wchar_t pDest[STRING_BUFFER] = {0};
|
||||||
mbstowcs_s(&cbDest, pDest, sizeof(pDest)/sizeof(pDest[0]), pSource, strlen(pSource));
|
mbstowcs_s(&cbDest, pDest, sizeof(pDest)/sizeof(pDest[0]), pSource, strlen(pSource));
|
||||||
cbDest = (wcslen(pDest) + 1) * sizeof(pDest[0]);
|
cbDest = (wcslen(pDest) + 1) * sizeof(pDest[0]);
|
||||||
_wcslwr_s(pDest);
|
_wcslwr_s(pDest);
|
||||||
|
|
||||||
uint32_t md5Hash[2] = {0};
|
uint32_t md5Hash[2] = {0};
|
||||||
CalcMD5Hash(pDest, cbDest, md5Hash);
|
CalcMD5Hash(pDest, cbDest, md5Hash);
|
||||||
|
|
||||||
unsigned int len = ((cbDest & 4) == 0) + (cbDest >> 2) - 1;
|
unsigned int len = ((cbDest & 4) == 0) + (cbDest >> 2) - 1;
|
||||||
uint32_t outHash[4] = {0};
|
uint32_t outHash[4] = {0};
|
||||||
CalcCustomHash_V1((uint32_t*)pDest, len, md5Hash, outHash);
|
CalcCustomHash_V1((uint32_t*)pDest, len, md5Hash, outHash);
|
||||||
CalcCustomHash_V2((uint32_t*)pDest, len, md5Hash, outHash + 2);
|
CalcCustomHash_V2((uint32_t*)pDest, len, md5Hash, outHash + 2);
|
||||||
uint64_t hashVal1 = *(uint64_t*)(outHash + 2) ^ *(uint64_t*)outHash;
|
uint64_t hashVal1 = *(uint64_t*)(outHash + 2) ^ *(uint64_t*)outHash;
|
||||||
uint64_t hashVal2 = *(uint64_t*)(outHash + 3) ^ *(uint64_t*)(outHash + 1);
|
uint64_t hashVal2 = *(uint64_t*)(outHash + 3) ^ *(uint64_t*)(outHash + 1);
|
||||||
uint8_t outHashBase[8] = {0};
|
uint8_t outHashBase[8] = {0};
|
||||||
memcpy(outHashBase, &hashVal1, sizeof(outHashBase)/2);
|
memcpy(outHashBase, &hashVal1, sizeof(outHashBase)/2);
|
||||||
memcpy(outHashBase + 4, &hashVal2, sizeof(outHashBase)/2);
|
memcpy(outHashBase + 4, &hashVal2, sizeof(outHashBase)/2);
|
||||||
|
|
||||||
std::string base64Enc;
|
std::string base64Enc;
|
||||||
if (!Base64Encode((const BYTE*)outHashBase, sizeof(outHashBase), base64Enc)) {
|
if (!Base64Encode((const BYTE*)outHashBase, sizeof(outHashBase), base64Enc)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
char resHash[20];
|
char resHash[20];
|
||||||
snprintf(resHash, 20, "%s", base64Enc.c_str());
|
snprintf(resHash, 20, "%s", base64Enc.c_str());
|
||||||
data.hash = resHash;
|
data.hash = resHash;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!data.specialExt) {
|
if (!data.specialExt) {
|
||||||
|
|||||||
Reference in New Issue
Block a user