Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

569 lines
18 KiB

  1. //+--------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1994 - 1997.
  5. //
  6. // File: snapin.cpp
  7. //
  8. // Contents: DLL support routines, class factory and registration
  9. // functions.
  10. //
  11. // Classes:
  12. //
  13. // Functions:
  14. //
  15. // History: 2-12-1998 stevebl comment header added
  16. //
  17. //---------------------------------------------------------------------------
  18. #include "precomp.hxx"
  19. #include "initguid.h"
  20. #include "gpedit.h"
  21. extern const CLSID CLSID_Snapin = {0xBACF5C8A,0xA3C7,0x11D1,{0xA7,0x60,0x00,0xC0,0x4F,0xB9,0x60,0x3F}};
  22. extern const wchar_t * szCLSID_Snapin = L"{BACF5C8A-A3C7-11D1-A760-00C04FB9603F}";
  23. extern const CLSID CLSID_MachineSnapin = {0x942A8E4F,0xA261,0x11D1,{0xA7,0x60,0x00,0xc0,0x4f,0xb9,0x60,0x3f}};
  24. extern const wchar_t * szCLSID_MachineSnapin = L"{942A8E4F-A261-11D1-A760-00C04FB9603F}";
  25. // Main NodeType GUID on numeric format
  26. extern const GUID cNodeType = {0xF8B3A900,0X8EA5,0X11D0,{0X8D,0X3C,0X00,0XA0,0XC9,0X0D,0XCA,0XE7}};
  27. // Main NodeType GUID on string format
  28. extern const wchar_t* cszNodeType = L"{F8B3A900-8EA5-11D0-8D3C-00A0C90DCAE7}";
  29. // No public place for this now, real def is in gina\gpext\appmgmt\cs.idl.
  30. extern const IID IID_IClassAdmin = {0x00000191,0x0000,0x0000,{0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}};
  31. // RSOP flavors:
  32. extern const CLSID CLSID_RSOP_Snapin = {
  33. 0x1bc972d6,
  34. 0x555c,
  35. 0x4ff7,
  36. {0xbe, 0x2c, 0xc5, 0x84, 0x02, 0x1a, 0x0a, 0x6a}};
  37. extern const wchar_t * szCLSID_RSOP_Snapin = L"{1BC972D6-555C-4FF7-BE2C-C584021A0A6A}";
  38. extern const CLSID CLSID_RSOP_MachineSnapin = {
  39. 0x7e45546f,
  40. 0x6d52,
  41. 0x4d10,
  42. {0xb7, 0x02, 0x9c, 0x2e, 0x67, 0x23, 0x2e, 0x62}};
  43. extern const wchar_t * szCLSID_RSOP_MachineSnapin = L"{7E45546F-6D52-4D10-B702-9C2E67232E62}";
  44. #include "safereg.hxx"
  45. #define BREAK_ON_FAIL_HRESULT(hr) if (FAILED(hr)) break
  46. #define PSBUFFER_STR L"AppManagementBuffer"
  47. #define THREADING_STR L"Apartment"
  48. HRESULT
  49. RegisterInterface(
  50. CSafeReg *pshkInterface,
  51. LPWSTR wszInterfaceGUID,
  52. LPWSTR wszInterfaceName,
  53. LPWSTR wszNumMethods,
  54. LPWSTR wszProxyCLSID);
  55. CComModule _Module;
  56. BEGIN_OBJECT_MAP(ObjectMap)
  57. OBJECT_ENTRY(CLSID_Snapin, CUserComponentDataImpl)
  58. OBJECT_ENTRY(CLSID_MachineSnapin, CMachineComponentDataImpl)
  59. OBJECT_ENTRY(CLSID_RSOP_Snapin, CRSOPUserComponentDataImpl)
  60. OBJECT_ENTRY(CLSID_RSOP_MachineSnapin, CRSOPMachineComponentDataImpl)
  61. END_OBJECT_MAP()
  62. CLSID CLSID_Temp;
  63. #ifdef _DEBUG
  64. #define new DEBUG_NEW
  65. #undef THIS_FILE
  66. static char THIS_FILE[] = __FILE__;
  67. #endif
  68. class CSnapinApp : public CWinApp
  69. {
  70. public:
  71. virtual BOOL InitInstance();
  72. virtual int ExitInstance();
  73. };
  74. CSnapinApp theApp;
  75. HINSTANCE ghInstance;
  76. BOOL CSnapinApp::InitInstance()
  77. {
  78. ghInstance = m_hInstance;
  79. _Module.Init(ObjectMap, m_hInstance);
  80. // CoGetMalloc(1, &g_pIMalloc);
  81. #if DBG
  82. InitDebugSupport();
  83. #endif
  84. // Add theme'ing support
  85. SHFusionInitializeFromModuleID (m_hInstance, 2);
  86. return CWinApp::InitInstance();
  87. }
  88. int CSnapinApp::ExitInstance()
  89. {
  90. _Module.Term();
  91. DEBUG_VERIFY_INSTANCE_COUNT(CResultPane);
  92. DEBUG_VERIFY_INSTANCE_COUNT(CScopePane);
  93. // Cleanup required by fusion support
  94. SHFusionUninitialize();
  95. // g_pIMalloc->Release();
  96. return CWinApp::ExitInstance();
  97. }
  98. /////////////////////////////////////////////////////////////////////////////
  99. // Used to determine whether the DLL can be unloaded by OLE
  100. STDAPI DllCanUnloadNow(void)
  101. {
  102. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  103. return (AfxDllCanUnloadNow()==S_OK && _Module.GetLockCount()==0) ? S_OK : S_FALSE;
  104. }
  105. /////////////////////////////////////////////////////////////////////////////
  106. // Returns a class factory to create an object of the requested type
  107. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  108. {
  109. return _Module.GetClassObject(rclsid, riid, ppv);
  110. }
  111. const wchar_t * szUser_Namespace = L"{59849DF9-A256-11D1-A760-00C04FB9603F}";
  112. const wchar_t * szMachine_Namespace = L"{4D53F093-A260-11D1-A760-00C04FB9603F}";
  113. const wchar_t * szMachineAppName = L"Software Installation (Computers)";
  114. const wchar_t * szUserAppName = L"Software Installation (Users)";
  115. const wchar_t * szUser_RSOP_Namespace = L"{9D5EB218-8EA3-4EE9-B120-52FC68C8D128}";
  116. const wchar_t * szMachine_RSOP_Namespace = L"{DFA38559-8B35-42EF-8B00-E8F6CBF99BC0}";
  117. const wchar_t * szUserAppNameIndirect = L"@appmgr.dll,-50";
  118. const wchar_t * szMachineAppNameIndirect = L"@appmgr.dll,-51";
  119. /////////////////////////////////////////////////////////////////////////////
  120. // DllRegisterServer - Adds entries to the system registry
  121. STDAPI DllRegisterServer(void)
  122. {
  123. CSafeReg shk;
  124. CSafeReg shkCLSID;
  125. CSafeReg shkServer;
  126. CSafeReg shkTemp;
  127. HRESULT hr = S_OK;
  128. do
  129. {
  130. CLSID_Temp = CLSID_Snapin;
  131. hr = _Module.RegisterServer(FALSE);
  132. BREAK_ON_FAIL_HRESULT(hr);
  133. // register extension
  134. hr = shkCLSID.Open(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\MMC\\SnapIns", KEY_WRITE);
  135. BREAK_ON_FAIL_HRESULT(hr);
  136. hr = shkCLSID.Create(szCLSID_Snapin, &shk);
  137. BREAK_ON_FAIL_HRESULT(hr);
  138. hr = shk.SetValue(L"NameString",
  139. REG_SZ,
  140. (CONST BYTE *) szUserAppName,
  141. sizeof(WCHAR) * (lstrlen(szUserAppName)+ 1));
  142. hr = shk.SetValue(L"NameStringIndirect",
  143. REG_SZ,
  144. (CONST BYTE *) szUserAppNameIndirect,
  145. sizeof(WCHAR) * (lstrlen(szUserAppNameIndirect)+ 1));
  146. hr = shk.Create(L"NodeTypes", &shkTemp);
  147. BREAK_ON_FAIL_HRESULT(hr);
  148. hr = shkTemp.Create(szUser_Namespace, &shkServer);
  149. BREAK_ON_FAIL_HRESULT(hr);
  150. shkServer.Close();
  151. shkTemp.Close();
  152. shk.Close();
  153. hr = shkCLSID.Create(szCLSID_MachineSnapin, &shk);
  154. BREAK_ON_FAIL_HRESULT(hr);
  155. hr = shk.SetValue(L"NameString",
  156. REG_SZ,
  157. (CONST BYTE *) szMachineAppName,
  158. sizeof(WCHAR) * (lstrlen(szMachineAppName)+ 1));
  159. hr = shk.SetValue(L"NameStringIndirect",
  160. REG_SZ,
  161. (CONST BYTE *) szMachineAppNameIndirect,
  162. sizeof(WCHAR) * (lstrlen(szMachineAppNameIndirect)+ 1));
  163. hr = shk.Create(L"NodeTypes", &shkTemp);
  164. BREAK_ON_FAIL_HRESULT(hr);
  165. hr = shkTemp.Create(szMachine_Namespace, &shkServer);
  166. BREAK_ON_FAIL_HRESULT(hr);
  167. shkServer.Close();
  168. shkTemp.Close();
  169. shk.Close();
  170. shkCLSID.Close();
  171. hr = shkCLSID.Open(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\MMC\\NodeTypes", KEY_WRITE);
  172. BREAK_ON_FAIL_HRESULT(hr);
  173. hr = shkCLSID.Create(szUser_Namespace, &shk);
  174. BREAK_ON_FAIL_HRESULT(hr);
  175. shk.Close();
  176. hr = shkCLSID.Create(szMachine_Namespace, &shk);
  177. BREAK_ON_FAIL_HRESULT(hr);
  178. shk.Close();
  179. WCHAR szGUID[50];
  180. StringFromGUID2 (NODEID_UserSWSettings, szGUID, 50);
  181. hr = shkCLSID.Create(szGUID, &shk);
  182. BREAK_ON_FAIL_HRESULT(hr);
  183. hr = shk.Create(L"Extensions", &shkServer);
  184. BREAK_ON_FAIL_HRESULT(hr);
  185. hr = shkServer.Create(L"NameSpace", &shkTemp);
  186. BREAK_ON_FAIL_HRESULT(hr);
  187. hr = shkTemp.SetValue(szCLSID_Snapin,
  188. REG_SZ,
  189. (CONST BYTE *) szUserAppName,
  190. sizeof(WCHAR) * (lstrlen(szUserAppName)+ 1));
  191. shkTemp.Close();
  192. shkServer.Close();
  193. shk.Close();
  194. StringFromGUID2 (NODEID_MachineSWSettings, szGUID, 50);
  195. hr = shkCLSID.Create(szGUID, &shk);
  196. BREAK_ON_FAIL_HRESULT(hr);
  197. hr = shk.Create(L"Extensions", &shkServer);
  198. BREAK_ON_FAIL_HRESULT(hr);
  199. hr = shkServer.Create(L"NameSpace", &shkTemp);
  200. BREAK_ON_FAIL_HRESULT(hr);
  201. hr = shkTemp.SetValue(szCLSID_MachineSnapin,
  202. REG_SZ,
  203. (CONST BYTE *) szMachineAppName,
  204. sizeof(WCHAR) * (lstrlen(szMachineAppName)+ 1));
  205. shkTemp.Close();
  206. shkServer.Close();
  207. shk.Close();
  208. shkCLSID.Close();
  209. //
  210. // RSOP versions
  211. //
  212. CLSID_Temp = CLSID_RSOP_Snapin;
  213. hr = _Module.RegisterServer(FALSE);
  214. BREAK_ON_FAIL_HRESULT(hr);
  215. // register extension
  216. hr = shkCLSID.Open(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\MMC\\SnapIns", KEY_WRITE);
  217. BREAK_ON_FAIL_HRESULT(hr);
  218. hr = shkCLSID.Create(szCLSID_RSOP_Snapin, &shk);
  219. BREAK_ON_FAIL_HRESULT(hr);
  220. hr = shk.SetValue(L"NameString",
  221. REG_SZ,
  222. (CONST BYTE *) szUserAppName,
  223. sizeof(WCHAR) * (lstrlen(szUserAppName)+ 1));
  224. hr = shk.SetValue(L"NameStringIndirect",
  225. REG_SZ,
  226. (CONST BYTE *) szUserAppNameIndirect,
  227. sizeof(WCHAR) * (lstrlen(szUserAppNameIndirect)+ 1));
  228. hr = shk.Create(L"NodeTypes", &shkTemp);
  229. BREAK_ON_FAIL_HRESULT(hr);
  230. hr = shkTemp.Create(szUser_RSOP_Namespace, &shkServer);
  231. BREAK_ON_FAIL_HRESULT(hr);
  232. shkServer.Close();
  233. shkTemp.Close();
  234. shk.Close();
  235. hr = shkCLSID.Create(szCLSID_RSOP_MachineSnapin, &shk);
  236. BREAK_ON_FAIL_HRESULT(hr);
  237. hr = shk.SetValue(L"NameString",
  238. REG_SZ,
  239. (CONST BYTE *) szMachineAppName,
  240. sizeof(WCHAR) * (lstrlen(szMachineAppName)+ 1));
  241. hr = shk.SetValue(L"NameStringIndirect",
  242. REG_SZ,
  243. (CONST BYTE *) szMachineAppNameIndirect,
  244. sizeof(WCHAR) * (lstrlen(szMachineAppNameIndirect)+ 1));
  245. hr = shk.Create(L"NodeTypes", &shkTemp);
  246. BREAK_ON_FAIL_HRESULT(hr);
  247. hr = shkTemp.Create(szMachine_RSOP_Namespace, &shkServer);
  248. BREAK_ON_FAIL_HRESULT(hr);
  249. shkServer.Close();
  250. shkTemp.Close();
  251. shk.Close();
  252. shkCLSID.Close();
  253. hr = shkCLSID.Open(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\MMC\\NodeTypes", KEY_WRITE);
  254. BREAK_ON_FAIL_HRESULT(hr);
  255. hr = shkCLSID.Create(szUser_RSOP_Namespace, &shk);
  256. BREAK_ON_FAIL_HRESULT(hr);
  257. shk.Close();
  258. hr = shkCLSID.Create(szMachine_RSOP_Namespace, &shk);
  259. BREAK_ON_FAIL_HRESULT(hr);
  260. shk.Close();
  261. StringFromGUID2 (NODEID_RSOPUserSWSettings, szGUID, 50);
  262. hr = shkCLSID.Create(szGUID, &shk);
  263. BREAK_ON_FAIL_HRESULT(hr);
  264. hr = shk.Create(L"Extensions", &shkServer);
  265. BREAK_ON_FAIL_HRESULT(hr);
  266. hr = shkServer.Create(L"NameSpace", &shkTemp);
  267. BREAK_ON_FAIL_HRESULT(hr);
  268. hr = shkTemp.SetValue(szCLSID_RSOP_Snapin,
  269. REG_SZ,
  270. (CONST BYTE *) szUserAppName,
  271. sizeof(WCHAR) * (lstrlen(szUserAppName)+ 1));
  272. shkTemp.Close();
  273. shkServer.Close();
  274. shk.Close();
  275. StringFromGUID2 (NODEID_RSOPMachineSWSettings, szGUID, 50);
  276. hr = shkCLSID.Create(szGUID, &shk);
  277. BREAK_ON_FAIL_HRESULT(hr);
  278. hr = shk.Create(L"Extensions", &shkServer);
  279. BREAK_ON_FAIL_HRESULT(hr);
  280. hr = shkServer.Create(L"NameSpace", &shkTemp);
  281. BREAK_ON_FAIL_HRESULT(hr);
  282. hr = shkTemp.SetValue(szCLSID_RSOP_MachineSnapin,
  283. REG_SZ,
  284. (CONST BYTE *) szMachineAppName,
  285. sizeof(WCHAR) * (lstrlen(szMachineAppName)+ 1));
  286. shkTemp.Close();
  287. shkServer.Close();
  288. shk.Close();
  289. shkCLSID.Close();
  290. hr = shkCLSID.Open(HKEY_CLASSES_ROOT, L"CLSID", KEY_WRITE);
  291. BREAK_ON_FAIL_HRESULT(hr);
  292. } while (0);
  293. return hr;
  294. }
  295. /////////////////////////////////////////////////////////////////////////////
  296. // DllUnregisterServer - Removes entries from the system registry
  297. STDAPI DllUnregisterServer(void)
  298. {
  299. CLSID_Temp = CLSID_Snapin;
  300. _Module.UnregisterServer();
  301. HKEY hkey;
  302. CString sz;
  303. RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\MMC\\SnapIns\\", 0, KEY_WRITE, &hkey);
  304. if (hkey)
  305. {
  306. RegDeleteTree(hkey, (LPOLESTR)((LPCOLESTR)szCLSID_Snapin));
  307. RegCloseKey(hkey);
  308. }
  309. RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\MMC\\NodeTypes\\", 0, KEY_WRITE, &hkey);
  310. if (hkey)
  311. {
  312. RegDeleteTree(HKEY_LOCAL_MACHINE, (LPOLESTR)((LPCOLESTR)szUser_Namespace));
  313. RegCloseKey(hkey);
  314. }
  315. WCHAR szGUID[50];
  316. sz = L"Software\\Microsoft\\MMC\\NodeTypes\\";
  317. StringFromGUID2 (NODEID_UserSWSettings, szGUID, 50);
  318. sz += szGUID;
  319. sz += L"\\Extensions\\NameSpace";
  320. RegOpenKeyEx(HKEY_LOCAL_MACHINE, sz, 0, KEY_WRITE, &hkey);
  321. if (hkey)
  322. {
  323. RegDeleteValue(hkey, szCLSID_Snapin);
  324. RegCloseKey(hkey);
  325. }
  326. RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\MMC\\SnapIns\\", 0, KEY_WRITE, &hkey);
  327. if (hkey)
  328. {
  329. RegDeleteTree(hkey, (LPOLESTR)((LPCOLESTR)szCLSID_MachineSnapin));
  330. RegCloseKey(hkey);
  331. }
  332. RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\MMC\\NodeTypes\\", 0, KEY_WRITE, &hkey);
  333. if (hkey)
  334. {
  335. RegDeleteTree(HKEY_LOCAL_MACHINE, (LPOLESTR)((LPCOLESTR)szMachine_Namespace));
  336. RegCloseKey(hkey);
  337. }
  338. sz = L"Software\\Microsoft\\MMC\\NodeTypes\\";
  339. StringFromGUID2 (NODEID_MachineSWSettings, szGUID, 50);
  340. sz += szGUID;
  341. sz += L"\\Extensions\\NameSpace";
  342. RegOpenKeyEx(HKEY_LOCAL_MACHINE, sz, 0, KEY_WRITE, &hkey);
  343. if (hkey)
  344. {
  345. RegDeleteValue(hkey, szCLSID_MachineSnapin);
  346. RegCloseKey(hkey);
  347. }
  348. //
  349. // RSOP versions
  350. //
  351. CLSID_Temp = CLSID_RSOP_Snapin;
  352. _Module.UnregisterServer();
  353. RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\MMC\\SnapIns\\", 0, KEY_WRITE, &hkey);
  354. if (hkey)
  355. {
  356. RegDeleteTree(hkey, (LPOLESTR)((LPCOLESTR)szCLSID_RSOP_Snapin));
  357. RegCloseKey(hkey);
  358. }
  359. RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\MMC\\NodeTypes\\", 0, KEY_WRITE, &hkey);
  360. if (hkey)
  361. {
  362. RegDeleteTree(HKEY_LOCAL_MACHINE, (LPOLESTR)((LPCOLESTR)szUser_RSOP_Namespace));
  363. RegCloseKey(hkey);
  364. }
  365. sz = L"Software\\Microsoft\\MMC\\NodeTypes\\";
  366. StringFromGUID2 (NODEID_RSOPUserSWSettings, szGUID, 50);
  367. sz += szGUID;
  368. sz += L"\\Extensions\\NameSpace";
  369. RegOpenKeyEx(HKEY_LOCAL_MACHINE, sz, 0, KEY_WRITE, &hkey);
  370. if (hkey)
  371. {
  372. RegDeleteValue(hkey, szCLSID_Snapin);
  373. RegCloseKey(hkey);
  374. }
  375. RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\MMC\\SnapIns\\", 0, KEY_WRITE, &hkey);
  376. if (hkey)
  377. {
  378. RegDeleteTree(hkey, (LPOLESTR)((LPCOLESTR)szCLSID_RSOP_MachineSnapin));
  379. RegCloseKey(hkey);
  380. }
  381. RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\MMC\\NodeTypes\\", 0, KEY_WRITE, &hkey);
  382. if (hkey)
  383. {
  384. RegDeleteTree(HKEY_LOCAL_MACHINE, (LPOLESTR)((LPCOLESTR)szMachine_Namespace));
  385. RegCloseKey(hkey);
  386. }
  387. sz = L"Software\\Microsoft\\MMC\\NodeTypes\\";
  388. StringFromGUID2 (NODEID_RSOPMachineSWSettings, szGUID, 50);
  389. sz += szGUID;
  390. sz += L"\\Extensions\\NameSpace";
  391. RegOpenKeyEx(HKEY_LOCAL_MACHINE, sz, 0, KEY_WRITE, &hkey);
  392. if (hkey)
  393. {
  394. RegDeleteValue(hkey, szCLSID_RSOP_MachineSnapin);
  395. RegCloseKey(hkey);
  396. }
  397. return S_OK;
  398. }
  399. //+--------------------------------------------------------------------------
  400. //
  401. // Function: RegisterInterface
  402. //
  403. // Synopsis: Add the registry entries required for an interface.
  404. //
  405. // Arguments: [pshkInterface] - handle to CLSID\Interface key
  406. // [wszInterfaceGUID] - GUID of interface to add
  407. // [wszInterfaceName] - human-readable name of interface
  408. // [wszNumMethods] - number of methods (including inherited)
  409. // [wszProxyCLSID] - GUID of dll containing proxy/stubs
  410. //
  411. // Returns: HRESULT
  412. //
  413. // History: 3-31-1997 DavidMun Created
  414. // 5-09-1997 SteveBl Modified for use with AppMgr
  415. //
  416. //---------------------------------------------------------------------------
  417. HRESULT
  418. RegisterInterface(
  419. CSafeReg *pshkInterface,
  420. LPWSTR wszInterfaceGUID,
  421. LPWSTR wszInterfaceName,
  422. LPWSTR wszNumMethods,
  423. LPWSTR wszProxyCLSID)
  424. {
  425. HRESULT hr = S_OK;
  426. CSafeReg shkIID;
  427. CSafeReg shkNumMethods;
  428. CSafeReg shkProxy;
  429. do
  430. {
  431. hr = pshkInterface->Create(wszInterfaceGUID, &shkIID);
  432. BREAK_ON_FAIL_HRESULT(hr);
  433. hr = shkIID.SetValue(NULL,
  434. REG_SZ,
  435. (CONST BYTE *) wszInterfaceName,
  436. sizeof(WCHAR) * (lstrlen(wszInterfaceName) + 1));
  437. BREAK_ON_FAIL_HRESULT(hr);
  438. hr = shkIID.Create(L"NumMethods", &shkNumMethods);
  439. BREAK_ON_FAIL_HRESULT(hr);
  440. hr = shkNumMethods.SetValue(NULL,
  441. REG_SZ,
  442. (CONST BYTE *)wszNumMethods,
  443. sizeof(WCHAR) * (lstrlen(wszNumMethods) + 1));
  444. BREAK_ON_FAIL_HRESULT(hr);
  445. hr = shkIID.Create(L"ProxyStubClsid32", &shkProxy);
  446. BREAK_ON_FAIL_HRESULT(hr);
  447. hr = shkProxy.SetValue(NULL,
  448. REG_SZ,
  449. (CONST BYTE *)wszProxyCLSID,
  450. sizeof(WCHAR) * (lstrlen(wszProxyCLSID) + 1));
  451. BREAK_ON_FAIL_HRESULT(hr);
  452. } while (0);
  453. return hr;
  454. }