aboutsummaryrefslogtreecommitdiff
path: root/CPP/Windows/COM.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/COM.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/COM.h')
-rw-r--r--CPP/Windows/COM.h70
1 files changed, 70 insertions, 0 deletions
diff --git a/CPP/Windows/COM.h b/CPP/Windows/COM.h
new file mode 100644
index 0000000..cee7f70
--- /dev/null
+++ b/CPP/Windows/COM.h
@@ -0,0 +1,70 @@
1// Windows/COM.h
2
3#ifndef __WINDOWS_COM_H
4#define __WINDOWS_COM_H
5
6#include "../Common/MyString.h"
7
8namespace NWindows {
9namespace NCOM {
10
11#ifdef _WIN32
12
13class CComInitializer
14{
15public:
16 CComInitializer()
17 {
18 #ifdef UNDER_CE
19 CoInitializeEx(NULL, COINIT_MULTITHREADED);
20 #else
21 // it's single thread. Do we need multithread?
22 CoInitialize(NULL);
23 #endif
24 };
25 ~CComInitializer() { CoUninitialize(); }
26};
27
28class CStgMedium
29{
30 STGMEDIUM _object;
31public:
32 bool _mustBeReleased;
33 CStgMedium(): _mustBeReleased(false) {}
34 ~CStgMedium() { Free(); }
35 void Free()
36 {
37 if (_mustBeReleased)
38 ReleaseStgMedium(&_object);
39 _mustBeReleased = false;
40 }
41 const STGMEDIUM* operator->() const { return &_object;}
42 STGMEDIUM* operator->() { return &_object;}
43 STGMEDIUM* operator&() { return &_object; }
44};
45
46#endif
47
48/*
49//////////////////////////////////
50// GUID <--> String Conversions
51UString GUIDToStringW(REFGUID guid);
52AString GUIDToStringA(REFGUID guid);
53#ifdef UNICODE
54 #define GUIDToString GUIDToStringW
55#else
56 #define GUIDToString GUIDToStringA
57#endif
58
59HRESULT StringToGUIDW(const wchar_t *string, GUID &classID);
60HRESULT StringToGUIDA(const char *string, GUID &classID);
61#ifdef UNICODE
62 #define StringToGUID StringToGUIDW
63#else
64 #define StringToGUID StringToGUIDA
65#endif
66*/
67
68}}
69
70#endif