24#if defined(BI_APP_DLL)
37static const _TCHAR* OcRegTemplates[] = {
38 _T(
"CLSID\\<clsid>\\<serverctx>Server32 = <debugger> <path> <cmdline><extraopt>"),
39 _T(
"CLSID\\<clsid>\\ProgID = <progid>"),
40 _T(
"CLSID\\<clsid> = <description>"),
41 _T(
"CLSID\\<clsid>\\DefaultIcon = <path>,<iconindex>"),
42 _T(
"CLSID\\<clsid>\\InprocHandler32 = <handler>"),
43 _T(
"<progid>\\CLSID = <clsid>"),
44 _T(
"<progid> = <description>"),
46 _T(
"<progid>\\protocol\\StdFileEditing\\verb\\0 = <verb0>"),
47 _T(
"<progid>\\protocol\\StdFileEditing\\verb\\1 = <verb1>"),
48 _T(
"<progid>\\protocol\\StdFileEditing\\verb\\2 = <verb2>"),
49 _T(
"<progid>\\protocol\\StdFileEditing\\verb\\3 = <verb3>"),
50 _T(
"<progid>\\protocol\\StdFileEditing\\verb\\4 = <verb4>"),
51 _T(
"<progid>\\protocol\\StdFileEditing\\verb\\5 = <verb5>"),
52 _T(
"<progid>\\protocol\\StdFileEditing\\verb\\6 = <verb6>"),
53 _T(
"<progid>\\protocol\\StdFileEditing\\verb\\7 = <verb7>"),
55 _T(
"CLSID\\<clsid>\\Verb\\0 = <verb0>,<verb0opt>"),
56 _T(
"CLSID\\<clsid>\\Verb\\1 = <verb1>,<verb1opt>"),
57 _T(
"CLSID\\<clsid>\\Verb\\2 = <verb2>,<verb2opt>"),
58 _T(
"CLSID\\<clsid>\\Verb\\3 = <verb3>,<verb3opt>"),
59 _T(
"CLSID\\<clsid>\\Verb\\4 = <verb4>,<verb4opt>"),
60 _T(
"CLSID\\<clsid>\\Verb\\5 = <verb5>,<verb5opt>"),
61 _T(
"CLSID\\<clsid>\\Verb\\6 = <verb6>,<verb6opt>"),
62 _T(
"CLSID\\<clsid>\\Verb\\7 = <verb7>,<verb7opt>"),
64 _T(
"CLSID\\<clsid>\\DataFormats\\GetSet\\0 = <format0>"),
65 _T(
"CLSID\\<clsid>\\DataFormats\\GetSet\\1 = <format1>"),
66 _T(
"CLSID\\<clsid>\\DataFormats\\GetSet\\2 = <format2>"),
67 _T(
"CLSID\\<clsid>\\DataFormats\\GetSet\\3 = <format3>"),
68 _T(
"CLSID\\<clsid>\\DataFormats\\GetSet\\4 = <format4>"),
69 _T(
"CLSID\\<clsid>\\DataFormats\\GetSet\\5 = <format5>"),
70 _T(
"CLSID\\<clsid>\\DataFormats\\GetSet\\6 = <format6>"),
71 _T(
"CLSID\\<clsid>\\DataFormats\\GetSet\\7 = <format7>"),
73 _T(
"CLSID\\<clsid>\\MiscStatus = <aspectall>"),
74 _T(
"CLSID\\<clsid>\\MiscStatus\\1 = <aspectcontent>"),
75 _T(
"CLSID\\<clsid>\\MiscStatus\\2 = <aspectthumbnail>"),
76 _T(
"CLSID\\<clsid>\\MiscStatus\\4 = <aspecticon>"),
77 _T(
"CLSID\\<clsid>\\MiscStatus\\8 = <aspectdocprint>"),
78 _T(
"CLSID\\<clsid>\\AuxUserType\\2 = <menuname>"),
79 _T(
"CLSID\\<clsid>\\AuxUserType\\3 = <appname>"),
80 _T(
"CLSID\\<clsid>\\Insertable"),
82 _T(
"<permid> = <permname>"),
83 _T(
"<permid>\\CLSID = <clsid>"),
84 _T(
"<permid>\\CurVer = <progid>"),
85 _T(
"CLSID\\<clsid>\\VersionIndependentProgID = <permid>"),
87 _T(
"CLSID\\<clsid>\\Version = <version>"),
88 _T(
"CLSID\\<clsid>\\DataFormats\\DefaultFile = <filefmt>"),
89 _T(
"CLSID\\<clsid>\\Ole1Class = <progid>"),
90 _T(
".<extension> = <progid>"),
92 _T(
"<progid>\\Shell\\Print\\Command = <path> \"%1\""),
93 _T(
"<progid>\\Shell\\Open\\Command = <path> \"%1\""),
94 _T(
"<progid>\\protocol\\StdFileEditing\\server = <debugger> <path><extraopt>"),
95 _T(
"<progid>\\Insertable"),
100 _T(
"CLSID\\<clsid>\\Control"),
101 _T(
"CLSID\\<clsid>\\ToolBoxBitmap32 = <path>,<toolbmpindex>"),
109 {
_T(
"clsid"), 0,
_T(
"") },
110 {
_T(
"progid"), 0,
_T(
"\001\002\003\005\006\007")},
111 {
_T(
"insertable"), 0,
_T(
"\046\047\062\063")},
112 {
_T(
"control"), 0,
_T(
"\064\065") },
114 {
_T(
"description"), 0,
_T(
"") },
115 {
_T(
"handler"),
_T(
"ole32.dll"),
_T(
"\005") },
116 {
_T(
"serverctx"), 0,
_T(
"\001") },
117 {
_T(
"path"), 0,
_T(
"") },
118 {
_T(
"cmdline"),
_T(
""),
_T(
"") },
119 {
_T(
"debugger"),
_T(
""),
_T(
"") },
120 {
_T(
"permid"), 0,
_T(
"\050\051\053") },
121 {
_T(
"permname"), 0,
_T(
"\052") },
122 {
_T(
"iconindex"),
_T(
"0"),
_T(
"\004") },
123 {
_T(
"toolbmpindex"),
_T(
"1"),
_T(
"\065") },
124 {
_T(
"menuname"),
_T(
""),
_T(
"\045") },
125 {
_T(
"appname"), 0,
_T(
"") },
126 {
_T(
"verb0"), 0,
_T(
"\010\020") },
127 {
_T(
"verb1"), 0,
_T(
"\011\021") },
128 {
_T(
"verb2"), 0,
_T(
"\012\022") },
129 {
_T(
"verb3"), 0,
_T(
"\013\023") },
130 {
_T(
"verb4"), 0,
_T(
"\014\024") },
131 {
_T(
"verb5"), 0,
_T(
"\015\025") },
132 {
_T(
"verb6"), 0,
_T(
"\016\026") },
133 {
_T(
"verb7"), 0,
_T(
"\017\027") },
134 {
_T(
"verb8"), 0,
_T(
"\018\028") },
135 {
_T(
"verb0opt"),
_T(
"0,2"),
_T(
"\020") },
136 {
_T(
"verb1opt"),
_T(
"0,2"),
_T(
"\021") },
137 {
_T(
"verb2opt"),
_T(
"0,2"),
_T(
"\022") },
138 {
_T(
"verb3opt"),
_T(
"0,2"),
_T(
"\023") },
139 {
_T(
"verb4opt"),
_T(
"0,2"),
_T(
"\024") },
140 {
_T(
"verb5opt"),
_T(
"0,2"),
_T(
"\025") },
141 {
_T(
"verb6opt"),
_T(
"0,2"),
_T(
"\026") },
142 {
_T(
"verb7opt"),
_T(
"0,2"),
_T(
"\027") },
143 {
_T(
"verb8opt"),
_T(
"0,2"),
_T(
"\028") },
144 {
_T(
"format0"), 0,
_T(
"\030") },
145 {
_T(
"format1"), 0,
_T(
"\031") },
146 {
_T(
"format2"), 0,
_T(
"\032") },
147 {
_T(
"format3"), 0,
_T(
"\033") },
148 {
_T(
"format4"), 0,
_T(
"\034") },
149 {
_T(
"format5"), 0,
_T(
"\035") },
150 {
_T(
"format6"), 0,
_T(
"\036") },
151 {
_T(
"format7"), 0,
_T(
"\037") },
152 {
_T(
"format8"), 0,
_T(
"\038") },
153 {
_T(
"filefmt"), 0,
_T(
"\055") },
154 {
_T(
"aspectall"),
_T(
"0"),
_T(
"\040") },
155 {
_T(
"aspectcontent"), 0,
_T(
"\041") },
156 {
_T(
"aspectthumbnail"), 0,
_T(
"\042") },
157 {
_T(
"aspecticon"), 0,
_T(
"\043") },
158 {
_T(
"aspectdocprint"), 0,
_T(
"\044") },
159 {
_T(
"extension"), 0,
_T(
"\057\060\061") },
160 {
_T(
"version"), 0,
_T(
"\054") },
161 {
_T(
"helpdir"), 0,
_T(
"") },
162 {
_T(
"typehelp"), 0,
_T(
"") },
163 {
_T(
"language"), 0,
_T(
"") },
164 {
_T(
"docflags"),
_T(
"0"),
_T(
"") },
165 {
_T(
"directory"), 0,
_T(
"") },
166 {
_T(
"docfilter"), 0,
_T(
"") },
167 {
_T(
"debugclsid"), 0,
_T(
"")},
168 {
_T(
"extraopt"),
_T(
""),
_T(
"")},
169 {
_T(
"debugprogid"), 0,
_T(
"") },
170 {
_T(
"debugdesc"), 0,
_T(
"") },
197 symbolTable.
Init(filter);
209 wsprintf(langBuf,
_T(
"%X"), lang);
214 const int pathSize = 512;
217 module = &GetGlobalModule();
218 module->GetModuleFileName(path, pathSize);
229 if (::GetModuleHandle(0) == module->
GetHandle())
245 bool hasProgId=
false;
246 bool hasDescription=
false;
248 for (regItem = regInfo.
Items; regItem->
Key != 0 && !hasProgId; regItem++) {
249 if (strcmp(regItem->
Key,
"progid") == 0)
252 for (regItem = regInfo.
Items; regItem->
Key != 0 && !hasDescription; regItem++) {
253 if (strcmp(regItem->
Key,
"description") == 0)
257 if (hasProgId && !hasDescription)
260 {
"description", {
_T(
"OCF default description")}},
312 _T(
"\020\021\022\023\024\025\026\027")\
313 _T(
"\030\031\032\033\034\035\036\037")\
314 _T(
"\040\041\042\043\044\045\046\047")\
315 _T(
"\054\055\062\063");
320struct TDebugRegKey {
enum { progid, clsid, description, extraopt};};
342 LPCTSTR value = regInfo.
Lookup(
_W2A(*newKey), lang);
349 case TDebugRegKey::progid:
351 case TDebugRegKey::extraopt:
352 value =
_T(
" /Debug");
354 case TDebugRegKey::clsid:
360 case TDebugRegKey::description:
361 throw TXRegistry{
_T(
"ocf::OcSetupDebugReg: incomplete debug registration"), *newKey};
365 regDebug->
Value = value;
389 Next = RegistrarList;
390 RegistrarList =
this;
391 TRACEX(OcfRefCount, 1,
"TRegistrar() @" << (
void*)
this);
401 Next = RegistrarList;
402 RegistrarList =
this;
421 return reg ? reg->Next : RegistrarList;
475 releasedObj->Release();
492# if defined(BI_COMP_MSC)
497DllRegisterCommand(LPCTSTR cmdLine)
500 bool isDebug =
false;
548 TRACEX(OcfDll, 1,
"DllCanUnloadNow returning HR_FALSE");
552 TRACEX(OcfDll, 1,
"DllCanUnloadNow returning HR_OK");
561 return DllRegisterCommand(
_T(
"/RegServer"));
569 return DllRegisterCommand(
_T(
"/UnregServer"));
572#if defined(BI_COMP_MSC)
573extern "C" BOOL WINAPI RawDllMain(HINSTANCE, DWORD dwReason, LPVOID);
574extern "C" BOOL (WINAPI* _pRawDllMain)(HINSTANCE, DWORD, LPVOID) = &RawDllMain;
577BOOL WINAPI RawDllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID)
583BOOL WINAPI DllMain(HINSTANCE hInstance,
uint32 reason, LPVOID)
592 case DLL_PROCESS_ATTACH:
TAppDescriptor - OLE application descriptor definitions.
#define TRACEX(group, level, message)
TComponentFactory GetFactory() const
Application registration manager interface class.
bool IsOptionSet(owl::uint32 option) const
void ProcessCmdLine(owl::tstring &cmdLine)
owl::uint32 GetOptions() const
virtual void Shutdown(IUnknown *releasedObj, owl::uint32 options)
static TRegistrar * GetNext(TRegistrar *reg)
virtual void * GetFactory(const GUID &clsid, const GUID &iid)
TRegistrar(owl::TRegList ®Info, TComponentFactory callback, owl::tstring &cmdLine, owl::TModule *module=&owl::GetGlobalModule())
Pointer to an array of type T.
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
static auto GetClassesRoot() -> TRegKey &
Special predefined root key used by shell and OLE applications (HKEY_CLASSES_ROOT).
static auto GetClassesRootClsid() -> TRegKey &
Commonly used subkey by shell and OLE applications (HKEY_CLASSES_ROOT\CLSID).
A registration parameter table, composed of a list of TRegItems.
LPCTSTR Lookup(LPCSTR key, TLangId lang=TLocaleString::UserDefaultLangId)
Performs the lookup of the TRegItems using a key (an item name such as progid) and returns the value ...
const tchar *& Value(int i)
Return the value of the param entry at the passed index.
int Find(LPCTSTR param)
Looks for a given param in this param list.
High level symbol-based registry entry manipulation.
void StreamOut(TRegItem *item, tostream &out)
void Init(LPCTSTR filter)
void UpdateParams(TLangId lang, TRegItem *item)
static int Unregister(TRegList ®Info, const TUnregParams *params, const TRegItem *overrides=nullptr)
Unregisters entries given a reglist.
Thrown for errors within the Registry classes.
THandle GetHandle() const
Return the instance handle of the library module represented by the TModule obect.
#define ocrSingleUse
Single client per instance.
Include for OC, gets common headers when precompiled headers are enabled.
int WINAPI DllEntryPoint(HINSTANCE hInstance, uint32 reason, LPVOID)
Definition of class TModule.
bool OWLInitUserDLL(HINSTANCE hInstance, LPCTSTR cmdLine)
Initialization routine that must be called from User DLL if DLL provides it's own entry point [i....
Object Component Framework (COM encapsulation).
const GUID void ** retObj
const TCHAR * OcDebugKeys[]
int OcSetupDebugReg(owl::TRegList ®Info, owl::TRegItem *regDebug, owl::TLangId lang, TCHAR *clsid)
Walk thru a reginfo list using debug entries to create a parallel non-debug set for alternate,...
owl::TRegItem OcRegNotDll[]
owl::TRegItem OcRegNoDebug[]
IUnknown *(*) TComponentFactory(IUnknown *outer, owl::uint32 options, owl::uint32 id)
long OcRegisterClass(owl::TRegList ®Info, owl::TModule *module, owl::tostream &out, owl::TLangId lang, LPCTSTR filter=0, owl::TRegItem *defaults=0, owl::TRegItem *overrides=0)
Generate OLE registration file image to an output stream.
const TCHAR * OcReplaceKeys[]
@ amAutomation
set from cmdline when EXE lauched for automation
@ amShutdown
set in factory call to shutdown/delete app
@ amServedApp
per instance flag, app refcnt held by container
@ amExeModule
set for EXE components, 0 if DLL inproc server
@ amDebug
user requested launching for debugging
@ amRun
set in factory call to run application msg loop
int OcUnregisterClass(owl::TRegList ®Info, owl::TRegItem *overrides=0)
Unregister application or class from registration database.
Object Windows Library (OWLNext Core).
owl::uint16 TLangId
Holds a language ID, a predefined number that represents a base language and dialect.
const TLangId LangUserDefault
DIAG_DEFINE_GROUP_INIT(OWL_INI, OwlApp, 1, 0)
const TLangId LangSysDefault
DIAG_DECLARE_GROUP(OwlThread)
STDAPI DllRegisterServer()
OLE 2.0 entry point for registering DLL, no locale info passed.
STDAPI DllCanUnloadNow()
OLE 2.0 entry point for checking if DLL has no clients and can be unloaded.
STDAPI DllUnregisterServer()
OLE 2.0 entry point for unregistering DLL.
STDAPI __declspec(dllexport) DllRegisterCommand(LPCTSTR cmdLine)
Entry point for complete registration management via command line Don't let any exceptions blow back ...
STDAPI DllGetClassObject(const GUID &clsid, const GUID &iid, void **retObj)
OLE 2.0 entry point for obtaining a class factory for a particular CLSID Don't let any exceptions blo...
OLE Registration definitions.
#define COUNTOF(s)
Array element count Important: Only use this with an argument of array type.
Various types of smart pointer templatized classes.
Definition of class TString, a flexible universal string envelope class.
static TLangId SystemDefaultLangId
The default language identifier.
static TLangId UserDefaultLangId
The user-defined default language identifier.
A single registration list entry.
TLocaleString Value
Localizable value for parameter or subkey.
const char * Key
Non-localized parameter or registry subkey.