MCPcopy Create free account
hub / github.com/WinMerge/winmerge / CalculateHashValue

Function CalculateHashValue

Src/PropertySystem.cpp:59–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57}
58
59static bool CalculateHashValue(const String& path, const PROPERTYKEY& key, PROPVARIANT& value)
60{
61 int i = GetPropertyIndexFromKey(key);
62 if (i >= 0)
63 {
64 std::vector<uint8_t> hash;
65 HANDLE hFile = CreateFile(path.c_str(), GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
66 if (hFile != INVALID_HANDLE_VALUE)
67 {
68 CalculateHashValue(hFile, g_HashProperties[i].pszDisplayName, hash);
69 CloseHandle(hFile);
70 }
71 InitPropVariantFromBuffer(hash.data(), static_cast<unsigned>(hash.size()), &value);
72 return true;
73 }
74 return false;
75}
76
77PropertyValues::PropertyValues() = default;
78

Callers 1

GetPropertyValuesMethod · 0.70

Calls 3

GetPropertyIndexFromKeyFunction · 0.85
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected