tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

PropVariantConv.h (1288B)


      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 
     16 bool ConvertUtcFileTimeToString(const FILETIME &ft, char *s, int level = kTimestampPrintLevel_SEC) throw();
     17 bool 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
     21 void ConvertPropVariantToShortString(const PROPVARIANT &prop, char *dest) throw();
     22 void ConvertPropVariantToShortString(const PROPVARIANT &prop, wchar_t *dest) throw();
     23 
     24 inline 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