forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomhost.cpp
More file actions
667 lines (562 loc) · 21 KB
/
comhost.cpp
File metadata and controls
667 lines (562 loc) · 21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#include "comhost.h"
#include "redirected_error_writer.h"
#include "hostfxr.h"
#include "fxr_resolver.h"
#include "pal.h"
#include "trace.h"
#include "error_codes.h"
#include "utils.h"
#include <type_traits>
#include <minipal/utils.h>
#include <coreclr_delegates.h>
using comhost::clsid_map_entry;
using comhost::clsid_map;
#if defined(_WIN32)
// COM entry points are defined without the __declspec(dllexport) attribute.
// The issue here is that the compiler will throw an error regarding linkage
// redefinion. The solution here is to the use a .def file on Windows.
#define COM_API extern "C"
#else
#define COM_API SHARED_API
#endif // _WIN32
//
// See ComActivator class in System.Private.CoreLib
//
struct com_activation_context
{
GUID class_id;
GUID interface_id;
const pal::char_t *assembly_path;
const pal::char_t *assembly_name;
const pal::char_t *type_name;
void **class_factory_dest;
};
#define ISOLATED_CONTEXT (void*)-1
using com_delegate_fn = int(STDMETHODCALLTYPE*)(com_activation_context*, void*);
using com_delegate_no_load_context_fn = int(STDMETHODCALLTYPE*)(com_activation_context*);
namespace
{
struct com_delegates
{
com_delegate_fn delegate;
// Delegate that does not take a load context. This version has existed since COM support was
// added in .NET Core 3.0. It is used as a fallback when loading in an isolated load context
// in versions of .NET without the functions that take a load context.
com_delegate_no_load_context_fn delegate_no_load_cxt;
};
// Fallback for loading a COM server in an isolated context in versions of .NET that don't have the
// functions that take a load context.
int get_com_delegate_no_load_context(hostfxr_delegate_type del_type, get_function_pointer_fn get_function_pointer, com_delegate_no_load_context_fn *delegate)
{
const pal::char_t* method_name;
switch (del_type)
{
case hostfxr_delegate_type::hdt_com_activation:
method_name = _X("GetClassFactoryForTypeInternal");
break;
case hostfxr_delegate_type::hdt_com_register:
method_name = _X("RegisterClassForTypeInternal");
break;
case hostfxr_delegate_type::hdt_com_unregister:
method_name = _X("UnregisterClassForTypeInternal");
break;
default:
return StatusCode::InvalidArgFailure;
}
return get_function_pointer(
_X("Internal.Runtime.InteropServices.ComActivator, System.Private.CoreLib"),
method_name,
UNMANAGEDCALLERSONLY_METHOD,
nullptr, // load context
nullptr, // reserved
reinterpret_cast<void**>(delegate));
}
int get_com_delegate(hostfxr_delegate_type del_type, pal::string_t *app_path, com_delegates &delegates, void **load_context)
{
delegates.delegate = nullptr;
delegates.delegate_no_load_cxt = nullptr;
get_function_pointer_fn get_function_pointer;
int status = load_fxr_and_get_delegate(
hostfxr_delegate_type::hdt_get_function_pointer,
[app_path](const pal::string_t& host_path, pal::string_t* config_path_out)
{
// Strip the comhost suffix to get the 'app' and config
size_t idx = host_path.rfind(_X(".comhost.dll"));
assert(idx != pal::string_t::npos);
pal::string_t app_path_local{ host_path };
app_path_local.replace(app_path_local.begin() + idx, app_path_local.end(), _X(".dll"));
*app_path = std::move(app_path_local);
pal::string_t config_path_local { host_path };
config_path_local.replace(config_path_local.begin() + idx, config_path_local.end(), _X(".runtimeconfig.json"));
*config_path_out = std::move(config_path_local);
return StatusCode::Success;
},
[load_context](pal::dll_t fxr, hostfxr_handle context)
{
*load_context = ISOLATED_CONTEXT;
auto get_runtime_property_value = reinterpret_cast<hostfxr_get_runtime_property_value_fn>(pal::get_symbol(fxr, "hostfxr_get_runtime_property_value"));
const pal::char_t* value;
if (get_runtime_property_value(context, _X("System.Runtime.InteropServices.COM.LoadComponentInDefaultContext"), &value) == StatusCode::Success
&& pal::strcasecmp(value, _X("true")) == 0)
{
*load_context = nullptr; // Default context
}
},
reinterpret_cast<void**>(&get_function_pointer),
false // do not ignore missing config file if there's an active context
);
if (status != StatusCode::Success)
return status;
const pal::char_t* method_name;
switch (del_type)
{
case hostfxr_delegate_type::hdt_com_activation:
method_name = _X("GetClassFactoryForTypeInContext");
break;
case hostfxr_delegate_type::hdt_com_register:
method_name = _X("RegisterClassForTypeInContext");
break;
case hostfxr_delegate_type::hdt_com_unregister:
method_name = _X("UnregisterClassForTypeInContext");
break;
default:
return StatusCode::InvalidArgFailure;
}
status = get_function_pointer(
_X("Internal.Runtime.InteropServices.ComActivator, System.Private.CoreLib"),
method_name,
UNMANAGEDCALLERSONLY_METHOD,
nullptr, // load context
nullptr, // reserved
(void**)&delegates.delegate);
if (status == StatusCode::Success)
return status;
// Newer methods with context not found and using isolated context.
// Fall back to methods without context.
// The runtime will throw MissingMethodException, so we check for the corresponding COR_E_MISSINGMETHOD HRESULT.
// We also need to check for COR_E_MISSINGMEMBER due to a pre-7.0 bug where the HRESULT was not correctly set on
// MissingMethodException and it ended up with the HRESULT for MissingMemberException
if ((status == 0x80131513 /*COR_E_MISSINGMETHOD*/ || status == 0x80131512 /*COR_E_MISSINGMEMBER*/)
&& *load_context == ISOLATED_CONTEXT)
{
status = get_com_delegate_no_load_context(del_type, get_function_pointer, &delegates.delegate_no_load_cxt);
}
return status;
}
void report_com_error_info(const GUID& guid, pal::string_t errs)
{
ICreateErrorInfo *cei;
if (!errs.empty() && SUCCEEDED(::CreateErrorInfo(&cei)))
{
if (SUCCEEDED(cei->SetGUID(guid)))
{
if (SUCCEEDED(cei->SetDescription((LPOLESTR)errs.c_str())))
{
IErrorInfo *ei;
if (SUCCEEDED(cei->QueryInterface(__uuidof(ei), (void**)&ei)))
{
::SetErrorInfo(0, ei);
ei->Release();
}
}
}
cei->Release();
}
}
}
COM_API HRESULT STDMETHODCALLTYPE DllGetClassObject(
_In_ REFCLSID rclsid,
_In_ REFIID riid,
_Outptr_ LPVOID FAR* ppv)
{
// Check if the CLSID map contains a mapping
clsid_map map;
RETURN_HRESULT_IF_EXCEPT(map = comhost::get_clsid_map());
clsid_map::const_iterator iter = map.find(rclsid);
if (iter == std::end(map))
return CLASS_E_CLASSNOTAVAILABLE;
HRESULT hr;
pal::string_t app_path;
com_delegates act;
void* load_context;
{
trace::setup();
reset_redirected_error_writer();
error_writer_scope_t writer_scope(redirected_error_writer);
int ec = get_com_delegate(hostfxr_delegate_type::hdt_com_activation, &app_path, act, &load_context);
if (ec != StatusCode::Success)
{
report_com_error_info(rclsid, std::move(get_redirected_error_string()));
return __HRESULT_FROM_WIN32(ec);
}
}
assert(act.delegate != nullptr || load_context == ISOLATED_CONTEXT);
// Query the CLR for the type
IUnknown *classFactory = nullptr;
com_activation_context cxt
{
rclsid,
riid,
app_path.c_str(),
iter->second.assembly.c_str(),
iter->second.type.c_str(),
(void**)&classFactory
};
if (act.delegate != nullptr)
{
RETURN_IF_FAILED(act.delegate(&cxt, load_context));
}
else
{
RETURN_IF_FAILED(act.delegate_no_load_cxt(&cxt));
}
assert(classFactory != nullptr);
hr = classFactory->QueryInterface(riid, ppv);
classFactory->Release();
return hr;
}
COM_API HRESULT STDMETHODCALLTYPE DllCanUnloadNow(void)
{
return S_FALSE;
}
#if defined(_WIN32)
namespace
{
const WCHAR ClsidKeyFmt[] = _X("SOFTWARE\\Classes\\CLSID\\%s");
const WCHAR ProgIDKeyFmt[] = _X("SOFTWARE\\Classes\\%s");
struct OleStr : public std::unique_ptr<std::remove_pointer<LPOLESTR>::type, decltype(&::CoTaskMemFree)>
{
OleStr(_In_z_ LPOLESTR raw)
: std::unique_ptr<std::remove_pointer<LPOLESTR>::type, decltype(&::CoTaskMemFree)>(raw, ::CoTaskMemFree)
{ }
};
struct RegKey : public std::unique_ptr<std::remove_pointer<HKEY>::type, decltype(&::RegCloseKey)>
{
RegKey(_In_ HKEY raw)
: std::unique_ptr<std::remove_pointer<HKEY>::type, decltype(&::RegCloseKey)>(raw, ::RegCloseKey)
{ }
};
// Removes the key and all sub-keys
HRESULT RemoveRegistryKey(_In_z_ LPCWSTR regKeyPath)
{
assert(regKeyPath != nullptr);
LSTATUS res;
// Handle sub keys
{
HKEY toDeleteRaw;
res = ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, regKeyPath, 0, KEY_READ | KEY_WRITE, &toDeleteRaw);
if (ERROR_FILE_NOT_FOUND == res)
{
return S_OK;
}
else if (ERROR_SUCCESS != res)
{
return __HRESULT_FROM_WIN32(res);
}
RegKey toDelete{ toDeleteRaw };
res = ::RegDeleteTreeW(toDelete.get(), nullptr);
if (ERROR_SUCCESS != res)
return __HRESULT_FROM_WIN32(res);
}
res = ::RegDeleteKeyW(HKEY_LOCAL_MACHINE, regKeyPath);
if (ERROR_SUCCESS != res)
return __HRESULT_FROM_WIN32(res);
return S_OK;
}
HRESULT RemoveProgId(_In_ const comhost::clsid_map_entry &entry)
{
if (entry.progid.empty())
return S_OK;
HRESULT hr;
WCHAR regKeyPath[1024];
::swprintf_s(regKeyPath, ProgIDKeyFmt, entry.progid.c_str());
// Remove ProgID key
RETURN_IF_FAILED(RemoveRegistryKey(regKeyPath));
return S_OK;
}
HRESULT RemoveClsid(_In_ const comhost::clsid_map_entry &entry)
{
HRESULT hr;
LPOLESTR clsidAsStrRaw;
RETURN_IF_FAILED(::StringFromCLSID(entry.clsid, &clsidAsStrRaw));
OleStr clsidAsStr{ clsidAsStrRaw };
WCHAR regKeyPath[1024];
::swprintf_s(regKeyPath, ClsidKeyFmt, clsidAsStr.get());
// Remove CLSID key
RETURN_IF_FAILED(RemoveRegistryKey(regKeyPath));
RETURN_IF_FAILED(RemoveProgId(entry));
return S_OK;
}
HRESULT RegisterProgId(_In_ const comhost::clsid_map_entry &entry, _In_z_ LPOLESTR clsidAsStr)
{
assert(!entry.progid.empty() && clsidAsStr != nullptr);
WCHAR regKeyProgIdPath[1024];
::swprintf_s(regKeyProgIdPath, ProgIDKeyFmt, entry.progid.c_str());
HKEY regKeyRaw;
DWORD disp;
LSTATUS res = ::RegCreateKeyExW(
HKEY_LOCAL_MACHINE,
regKeyProgIdPath,
0,
REG_NONE,
REG_OPTION_NON_VOLATILE,
(KEY_READ | KEY_WRITE),
nullptr,
®KeyRaw,
&disp);
if (res != ERROR_SUCCESS)
return __HRESULT_FROM_WIN32(res);
RegKey regKey{ regKeyRaw };
// Set the default value for the ProgID to be the type name
// This value is only used for user consumption and has no
// functional impact.
res = ::RegSetValueExW(
regKey.get(),
nullptr,
0,
REG_SZ,
reinterpret_cast<const BYTE*>(entry.type.c_str()),
static_cast<DWORD>((entry.type.size() + 1) * sizeof(entry.type[0])));
if (res != ERROR_SUCCESS)
return __HRESULT_FROM_WIN32(res);
WCHAR regKeyProgIdClsidPath[ARRAY_SIZE(regKeyProgIdPath) * 2];
::swprintf_s(regKeyProgIdClsidPath, L"%s\\CLSID", regKeyProgIdPath);
HKEY regProgIdClsidRaw;
res = ::RegCreateKeyExW(
HKEY_LOCAL_MACHINE,
regKeyProgIdClsidPath,
0,
REG_NONE,
REG_OPTION_NON_VOLATILE,
(KEY_READ | KEY_WRITE),
nullptr,
®ProgIdClsidRaw,
&disp);
if (res != ERROR_SUCCESS)
return __HRESULT_FROM_WIN32(res);
regKey.reset(regProgIdClsidRaw);
// The value for the key is the CLSID
res = ::RegSetValueExW(
regKey.get(),
nullptr,
0,
REG_SZ,
reinterpret_cast<const BYTE*>(clsidAsStr),
static_cast<DWORD>(::wcslen(clsidAsStr) + 1) * sizeof(clsidAsStr[0]));
if (res != ERROR_SUCCESS)
return __HRESULT_FROM_WIN32(res);
return S_OK;
}
HRESULT RegisterClsid(_In_ const comhost::clsid_map_entry &entry, _In_opt_z_ const WCHAR *threadingModel)
{
HRESULT hr;
// Remove the CLSID in case it exists and has undesirable settings
RETURN_IF_FAILED(RemoveClsid(entry));
LPOLESTR clsidAsStrRaw;
RETURN_IF_FAILED(::StringFromCLSID(entry.clsid, &clsidAsStrRaw));
OleStr clsidAsStr{ clsidAsStrRaw };
WCHAR regKeyClsidPath[1024];
::swprintf_s(regKeyClsidPath, ClsidKeyFmt, clsidAsStr.get());
HKEY regKeyRaw;
DWORD disp;
LSTATUS res = ::RegCreateKeyExW(
HKEY_LOCAL_MACHINE,
regKeyClsidPath,
0,
REG_NONE,
REG_OPTION_NON_VOLATILE,
(KEY_READ | KEY_WRITE),
nullptr,
®KeyRaw,
&disp);
if (res != ERROR_SUCCESS)
return __HRESULT_FROM_WIN32(res);
RegKey regKey{ regKeyRaw };
// Set the default value, type name - this matches RegAsm behavior.
res = ::RegSetValueExW(
regKey.get(),
nullptr,
0,
REG_SZ,
reinterpret_cast<const BYTE*>(entry.type.c_str()),
static_cast<DWORD>(entry.type.size() + 1) * sizeof(entry.type[0]));
if (res != ERROR_SUCCESS)
return __HRESULT_FROM_WIN32(res);
WCHAR regKeyServerPath[ARRAY_SIZE(regKeyClsidPath) * 2];
::swprintf_s(regKeyServerPath, L"%s\\InProcServer32", regKeyClsidPath);
HKEY regServerKeyRaw;
res = ::RegCreateKeyExW(
HKEY_LOCAL_MACHINE,
regKeyServerPath,
0,
REG_NONE,
REG_OPTION_NON_VOLATILE,
(KEY_READ | KEY_WRITE),
nullptr,
®ServerKeyRaw,
&disp);
if (res != ERROR_SUCCESS)
return __HRESULT_FROM_WIN32(res);
regKey.reset(regServerKeyRaw);
HMODULE mod;
if (FALSE == ::GetModuleHandleExW(
(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT),
reinterpret_cast<LPCWSTR>(&RegisterClsid),
&mod))
{
return HRESULT_FROM_WIN32(::GetLastError());
}
pal::string_t modPath;
if (!pal::get_own_module_path(&modPath))
return E_UNEXPECTED;
// The default value for the key is the path to the DLL
res = ::RegSetValueExW(
regKey.get(),
nullptr,
0,
REG_SZ,
reinterpret_cast<const BYTE*>(modPath.data()),
static_cast<DWORD>(modPath.size() + 1) * sizeof(modPath[0]));
if (res != ERROR_SUCCESS)
return __HRESULT_FROM_WIN32(res);
// Set the threading model if provided
if (threadingModel != nullptr)
{
res = ::RegSetValueExW(
regKey.get(),
_X("ThreadingModel"),
0,
REG_SZ,
reinterpret_cast<const BYTE*>(threadingModel),
static_cast<DWORD>(::wcslen(threadingModel) + 1) * sizeof(threadingModel[0]));
if (res != ERROR_SUCCESS)
return __HRESULT_FROM_WIN32(res);
}
// Check if a Prog ID is defined
if (!entry.progid.empty())
{
// Register the ProgID in the CLSID key
WCHAR regKeyProgIdPath[ARRAY_SIZE(regKeyClsidPath) * 2];
::swprintf_s(regKeyProgIdPath, L"%s\\ProgID", regKeyClsidPath);
HKEY regProgIdKeyRaw;
res = ::RegCreateKeyExW(
HKEY_LOCAL_MACHINE,
regKeyProgIdPath,
0,
REG_NONE,
REG_OPTION_NON_VOLATILE,
(KEY_READ | KEY_WRITE),
nullptr,
®ProgIdKeyRaw,
&disp);
if (res != ERROR_SUCCESS)
return __HRESULT_FROM_WIN32(res);
regKey.reset(regProgIdKeyRaw);
// The default value for the key is the ProgID
res = ::RegSetValueExW(
regKey.get(),
nullptr,
0,
REG_SZ,
reinterpret_cast<const BYTE*>(entry.progid.c_str()),
static_cast<DWORD>(entry.progid.size() + 1) * sizeof(entry.progid[0]));
if (res != ERROR_SUCCESS)
return __HRESULT_FROM_WIN32(res);
RETURN_IF_FAILED(RegisterProgId(entry, clsidAsStr.get()));
}
return S_OK;
}
}
COM_API HRESULT STDMETHODCALLTYPE DllRegisterServer(void)
{
// Step 0: Initialize logging
trace::setup();
reset_redirected_error_writer();
error_writer_scope_t writer_scope(redirected_error_writer);
// Step 1: Get CLSID mapping
clsid_map map;
RETURN_HRESULT_IF_EXCEPT(map = comhost::get_clsid_map());
trace::info(_X("Registering %d CLSIDs"), (int)map.size());
HRESULT hr;
pal::string_t app_path;
com_delegates reg;
void* load_context;
RETURN_IF_FAILED(get_com_delegate(hostfxr_delegate_type::hdt_com_register, &app_path, reg, &load_context));
assert(reg.delegate != nullptr || load_context == ISOLATED_CONTEXT);
com_activation_context cxt
{
GUID_NULL,
GUID_NULL, // Must be GUID_NULL
app_path.c_str(),
nullptr,
nullptr,
nullptr // Must be nullptr
};
// Step 2: Register each CLSID
for (clsid_map::const_reference p : map)
{
// Register the CLSID in registry
RETURN_IF_FAILED(RegisterClsid(p.second, _X("Both")));
// Call user-defined register function
cxt.class_id = p.first;
cxt.assembly_name = p.second.assembly.c_str();
cxt.type_name = p.second.type.c_str();
if (reg.delegate != nullptr)
{
RETURN_IF_FAILED(reg.delegate(&cxt, load_context));
}
else
{
RETURN_IF_FAILED(reg.delegate_no_load_cxt(&cxt));
}
}
return S_OK;
}
COM_API HRESULT STDMETHODCALLTYPE DllUnregisterServer(void)
{
// Step 0: Initialize logging
trace::setup();
reset_redirected_error_writer();
error_writer_scope_t writer_scope(redirected_error_writer);
// Step 1: Get CLSID mapping
clsid_map map;
RETURN_HRESULT_IF_EXCEPT(map = comhost::get_clsid_map());
trace::info(_X("Unregistering %d CLSIDs"), (int)map.size());
HRESULT hr;
pal::string_t app_path;
com_delegates unreg;
void* load_context;
RETURN_IF_FAILED(get_com_delegate(hostfxr_delegate_type::hdt_com_unregister, &app_path, unreg, &load_context));
assert(unreg.delegate != nullptr || load_context == ISOLATED_CONTEXT);
com_activation_context cxt
{
GUID_NULL,
GUID_NULL, // Must be GUID_NULL
app_path.c_str(),
nullptr,
nullptr,
nullptr // Must be nullptr
};
// Step 2: Unregister each CLSID
for (clsid_map::const_reference p : map)
{
// Call user-defined unregister function
cxt.class_id = p.first;
cxt.assembly_name = p.second.assembly.c_str();
cxt.type_name = p.second.type.c_str();
if (unreg.delegate != nullptr)
{
RETURN_IF_FAILED(unreg.delegate(&cxt, load_context));
}
else
{
RETURN_IF_FAILED(unreg.delegate_no_load_cxt(&cxt));
}
// Unregister the CLSID from registry
RETURN_IF_FAILED(RemoveClsid(p.second));
}
return S_OK;
}
#endif // _WIN32