aboutsummaryrefslogtreecommitdiff
path: root/CPP/Windows/PropVariantConv.h
diff options
context:
space:
mode:
authorIgor Pavlov <87184205+ip7z@users.noreply.github.com>2021-12-27 00:00:00 +0000
committerIgor Pavlov <87184205+ip7z@users.noreply.github.com>2022-03-18 15:35:13 +0500
commitf19f813537c7aea1c20749c914e756b54a9c3cf5 (patch)
tree816ba62ca7c0fa19f2eb46d9e9d6f7dd7c3a744d /CPP/Windows/PropVariantConv.h
parent98e06a519b63b81986abe76d28887f6984a7732b (diff)
download7zip-21.07.tar.gz
7zip-21.07.tar.bz2
7zip-21.07.zip
'21.07'21.07
Diffstat (limited to 'CPP/Windows/PropVariantConv.h')
-rw-r--r--CPP/Windows/PropVariantConv.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/CPP/Windows/PropVariantConv.h b/CPP/Windows/PropVariantConv.h
new file mode 100644
index 0000000..390e0b8
--- /dev/null
+++ b/CPP/Windows/PropVariantConv.h
@@ -0,0 +1,37 @@
1// Windows/PropVariantConv.h
2
3#ifndef __PROP_VARIANT_CONV_H
4#define __PROP_VARIANT_CONV_H
5
6#include "../Common/MyTypes.h"
7
8// provide at least 32 bytes for buffer including zero-end
9
10#define kTimestampPrintLevel_DAY -3
11// #define kTimestampPrintLevel_HOUR -2
12#define kTimestampPrintLevel_MIN -1
13#define kTimestampPrintLevel_SEC 0
14#define kTimestampPrintLevel_NTFS 7
15
16bool ConvertUtcFileTimeToString(const FILETIME &ft, char *s, int level = kTimestampPrintLevel_SEC) throw();
17bool ConvertUtcFileTimeToString(const FILETIME &ft, wchar_t *s, int level = kTimestampPrintLevel_SEC) throw();
18
19// provide at least 32 bytes for buffer including zero-end
20// don't send VT_BSTR to these functions
21void ConvertPropVariantToShortString(const PROPVARIANT &prop, char *dest) throw();
22void ConvertPropVariantToShortString(const PROPVARIANT &prop, wchar_t *dest) throw();
23
24inline bool ConvertPropVariantToUInt64(const PROPVARIANT &prop, UInt64 &value)
25{
26 switch (prop.vt)
27 {
28 case VT_UI8: value = (UInt64)prop.uhVal.QuadPart; return true;
29 case VT_UI4: value = prop.ulVal; return true;
30 case VT_UI2: value = prop.uiVal; return true;
31 case VT_UI1: value = prop.bVal; return true;
32 case VT_EMPTY: return false;
33 default: throw 151199;
34 }
35}
36
37#endif