Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | // Windows/COM.cpp |
michael@0 | 2 | |
michael@0 | 3 | #include "StdAfx.h" |
michael@0 | 4 | |
michael@0 | 5 | #include "Windows/COM.h" |
michael@0 | 6 | #include "Common/StringConvert.h" |
michael@0 | 7 | |
michael@0 | 8 | namespace NWindows { |
michael@0 | 9 | namespace NCOM { |
michael@0 | 10 | |
michael@0 | 11 | // CoInitialize (NULL); must be called! |
michael@0 | 12 | |
michael@0 | 13 | UString GUIDToStringW(REFGUID guid) |
michael@0 | 14 | { |
michael@0 | 15 | UString string; |
michael@0 | 16 | const int kStringSize = 48; |
michael@0 | 17 | StringFromGUID2(guid, string.GetBuffer(kStringSize), kStringSize); |
michael@0 | 18 | string.ReleaseBuffer(); |
michael@0 | 19 | return string; |
michael@0 | 20 | } |
michael@0 | 21 | |
michael@0 | 22 | AString GUIDToStringA(REFGUID guid) |
michael@0 | 23 | { |
michael@0 | 24 | return UnicodeStringToMultiByte(GUIDToStringW(guid)); |
michael@0 | 25 | } |
michael@0 | 26 | |
michael@0 | 27 | HRESULT StringToGUIDW(const wchar_t *string, GUID &classID) |
michael@0 | 28 | { |
michael@0 | 29 | return CLSIDFromString((wchar_t *)string, &classID); |
michael@0 | 30 | } |
michael@0 | 31 | |
michael@0 | 32 | HRESULT StringToGUIDA(const char *string, GUID &classID) |
michael@0 | 33 | { |
michael@0 | 34 | return StringToGUIDW(MultiByteToUnicodeString(string), classID); |
michael@0 | 35 | } |
michael@0 | 36 | |
michael@0 | 37 | }} |