-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathReg.hpp
119 lines (105 loc) · 3.59 KB
/
Reg.hpp
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
/****************************** Module Header ******************************\
Module Name: Reg.h
Project: CppShellExtContextMenuHandler
Copyright (c) Microsoft Corporation.
The file declares reusable helper functions to register and unregister
in-process COM components and shell context menu handlers in the registry.
RegisterInprocServer - register the in-process component in the registry.
UnregisterInprocServer - unregister the in-process component in the registry.
RegisterShellExtContextMenuHandler - register the context menu handler.
UnregisterShellExtContextMenuHandler - unregister the context menu handler.
This source is subject to the Microsoft Public License.
See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL.
All other rights reserved.
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
\***************************************************************************/
#pragma once
#include <windows.h>
//
// FUNCTION: RegisterInprocServer
//
// PURPOSE: Register the in-process component in the registry.
//
// PARAMETERS:
// * pszModule - Path of the module that contains the component
// * clsid - Class ID of the component
// * pszFriendlyName - Friendly name
// * pszThreadModel - Threading model
//
// NOTE: The function creates the HKCR\CLSID\{<CLSID>} key in the registry.
//
// HKCR
// {
// NoRemove CLSID
// {
// ForceRemove {<CLSID>} = s '<Friendly Name>'
// {
// InprocServer32 = s '%MODULE%'
// {
// val ThreadingModel = s '<Thread Model>'
// }
// }
// }
// }
//
HRESULT RegisterInprocServer(PCWSTR pszModule, const CLSID& clsid,
PCWSTR pszFriendlyName, PCWSTR pszThreadModel);
//
// FUNCTION: UnregisterInprocServer
//
// PURPOSE: Unegister the in-process component in the registry.
//
// PARAMETERS:
// * clsid - Class ID of the component
//
// NOTE: The function deletes the HKCR\CLSID\{<CLSID>} key in the registry.
//
HRESULT UnregisterInprocServer(const CLSID& clsid);
//
// FUNCTION: RegisterShellExtContextMenuHandler
//
// PURPOSE: Register the context menu handler.
//
// PARAMETERS:
// * pszFileType - The file type that the context menu handler is
// associated with. For example, '*' means all file types; '.txt' means
// all .txt files. The parameter must not be NULL.
// * clsid - Class ID of the component
// * pszFriendlyName - Friendly name
//
// NOTE: The function creates the following key in the registry.
//
// HKCR
// {
// NoRemove <File Type>
// {
// NoRemove shellex
// {
// NoRemove ContextMenuHandlers
// {
// {<CLSID>} = s '<Friendly Name>'
// }
// }
// }
// }
//
HRESULT RegisterShellExtContextMenuHandler(
PCWSTR pszFileType, const CLSID& clsid, PCWSTR pszFriendlyName);
//
// FUNCTION: UnregisterShellExtContextMenuHandler
//
// PURPOSE: Unregister the context menu handler.
//
// PARAMETERS:
// * pszFileType - The file type that the context menu handler is
// associated with. For example, '*' means all file types; '.txt' means
// all .txt files. The parameter must not be NULL.
// * clsid - Class ID of the component
//
// NOTE: The function removes the {<CLSID>} key under
// HKCR\<File Type>\shellex\ContextMenuHandlers in the registry.
//
HRESULT UnregisterShellExtContextMenuHandler(
PCWSTR pszFileType, const CLSID& clsid);