OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
ocreg.cpp
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectComponents
3// Copyright (c) 1994, 1996 by Borland International, All Rights Reserved
4//
5/// \file
6/// OLE Registration implementation
7//----------------------------------------------------------------------------
8#include <ocf/pch.h>
9#include <ocf/ocreg.h>
10#include <ocf/appdesc.h>
11#include <owl/pointer.h>
12#include <owl/module.h>
13#include <shellapi.h>
14#include <string.h>
15#include <stdlib.h>
16
17namespace ocf {
18
21
22using namespace owl;
23
24#if defined(BI_APP_DLL)
26#endif
27
28//----------------------------------------------------------------------------
29// Internal registration template table and registration item key table
30//
31
32//
33/// Registration template table, ordering determines sequence of registration.
34/// Also, these are all based on HKEY_CLASSES_ROOT
35/// \note the parameter table is dependent on template indices in this table
36//
37static const _TCHAR* OcRegTemplates[] = {
38/* 001 */ _T("CLSID\\<clsid>\\<serverctx>Server32 = <debugger> <path> <cmdline><extraopt>"),
39/* 002 */ _T("CLSID\\<clsid>\\ProgID = <progid>"),
40/* 003 */ _T("CLSID\\<clsid> = <description>"),
41/* 004 */ _T("CLSID\\<clsid>\\DefaultIcon = <path>,<iconindex>"),
42/* 005 */ _T("CLSID\\<clsid>\\InprocHandler32 = <handler>"),
43/* 006 */ _T("<progid>\\CLSID = <clsid>"),
44/* 007 */ _T("<progid> = <description>"),
45
46/* 010 */ _T("<progid>\\protocol\\StdFileEditing\\verb\\0 = <verb0>"),
47/* 011 */ _T("<progid>\\protocol\\StdFileEditing\\verb\\1 = <verb1>"),
48/* 012 */ _T("<progid>\\protocol\\StdFileEditing\\verb\\2 = <verb2>"),
49/* 013 */ _T("<progid>\\protocol\\StdFileEditing\\verb\\3 = <verb3>"),
50/* 014 */ _T("<progid>\\protocol\\StdFileEditing\\verb\\4 = <verb4>"),
51/* 015 */ _T("<progid>\\protocol\\StdFileEditing\\verb\\5 = <verb5>"),
52/* 016 */ _T("<progid>\\protocol\\StdFileEditing\\verb\\6 = <verb6>"),
53/* 017 */ _T("<progid>\\protocol\\StdFileEditing\\verb\\7 = <verb7>"),
54
55/* 020 */ _T("CLSID\\<clsid>\\Verb\\0 = <verb0>,<verb0opt>"),
56/* 021 */ _T("CLSID\\<clsid>\\Verb\\1 = <verb1>,<verb1opt>"),
57/* 022 */ _T("CLSID\\<clsid>\\Verb\\2 = <verb2>,<verb2opt>"),
58/* 023 */ _T("CLSID\\<clsid>\\Verb\\3 = <verb3>,<verb3opt>"),
59/* 024 */ _T("CLSID\\<clsid>\\Verb\\4 = <verb4>,<verb4opt>"),
60/* 025 */ _T("CLSID\\<clsid>\\Verb\\5 = <verb5>,<verb5opt>"),
61/* 026 */ _T("CLSID\\<clsid>\\Verb\\6 = <verb6>,<verb6opt>"),
62/* 027 */ _T("CLSID\\<clsid>\\Verb\\7 = <verb7>,<verb7opt>"),
63
64/* 030 */ _T("CLSID\\<clsid>\\DataFormats\\GetSet\\0 = <format0>"),
65/* 031 */ _T("CLSID\\<clsid>\\DataFormats\\GetSet\\1 = <format1>"),
66/* 032 */ _T("CLSID\\<clsid>\\DataFormats\\GetSet\\2 = <format2>"),
67/* 033 */ _T("CLSID\\<clsid>\\DataFormats\\GetSet\\3 = <format3>"),
68/* 034 */ _T("CLSID\\<clsid>\\DataFormats\\GetSet\\4 = <format4>"),
69/* 035 */ _T("CLSID\\<clsid>\\DataFormats\\GetSet\\5 = <format5>"),
70/* 036 */ _T("CLSID\\<clsid>\\DataFormats\\GetSet\\6 = <format6>"),
71/* 037 */ _T("CLSID\\<clsid>\\DataFormats\\GetSet\\7 = <format7>"),
72
73/* 040 */ _T("CLSID\\<clsid>\\MiscStatus = <aspectall>"),
74/* 041 */ _T("CLSID\\<clsid>\\MiscStatus\\1 = <aspectcontent>"),
75/* 042 */ _T("CLSID\\<clsid>\\MiscStatus\\2 = <aspectthumbnail>"),
76/* 043 */ _T("CLSID\\<clsid>\\MiscStatus\\4 = <aspecticon>"),
77/* 044 */ _T("CLSID\\<clsid>\\MiscStatus\\8 = <aspectdocprint>"),
78/* 045 */ _T("CLSID\\<clsid>\\AuxUserType\\2 = <menuname>"),
79/* 046 */ _T("CLSID\\<clsid>\\AuxUserType\\3 = <appname>"),
80/* 047 */ _T("CLSID\\<clsid>\\Insertable"),
81
82/* 050 */ _T("<permid> = <permname>"),
83/* 051 */ _T("<permid>\\CLSID = <clsid>"),
84/* 052 */ _T("<permid>\\CurVer = <progid>"),
85/* 053 */ _T("CLSID\\<clsid>\\VersionIndependentProgID = <permid>"),
86
87/* 054 */ _T("CLSID\\<clsid>\\Version = <version>"),
88/* 055 */ _T("CLSID\\<clsid>\\DataFormats\\DefaultFile = <filefmt>"),
89/* 056 */ _T("CLSID\\<clsid>\\Ole1Class = <progid>"), /// is this really needed?
90/* 057 */ _T(".<extension> = <progid>"),
91
92/* 060 */ _T("<progid>\\Shell\\Print\\Command = <path> \"%1\""),
93/* 061 */ _T("<progid>\\Shell\\Open\\Command = <path> \"%1\""),
94/* 062 */ _T("<progid>\\protocol\\StdFileEditing\\server = <debugger> <path><extraopt>"),
95/* 063 */ _T("<progid>\\Insertable"),
96
97// Following entries are specific to controls
98//
99
100/* 064 */ _T("CLSID\\<clsid>\\Control"),
101/* 065 */ _T("CLSID\\<clsid>\\ToolBoxBitmap32 = <path>,<toolbmpindex>"),
102 0,
103};
104
105//
106/// Registration parameter table, ordering is arbitrary, parameters lowercase
107//
108static const TRegParamList::TEntry OcRegParams[] = {
109 {_T("clsid"), 0, _T("") },// GUID standard string form
110 {_T("progid"), 0, _T("\001\002\003\005\006\007")},// A unique name
111 {_T("insertable"), 0, _T("\046\047\062\063")},// Defined to publish server
112 {_T("control"), 0, _T("\064\065") },// Defined to publish control
113 {_T("usage"), ocrSingleUse, _T("") },// Class factory registration
114 {_T("description"), 0, _T("") },// Human readable, 40 chars max
115 {_T("handler"), _T("ole32.dll"), _T("\005") },// Inproc handler
116 {_T("serverctx"), 0, _T("\001") },// "Local"(EXE) or "Inproc"(DLL)
117 {_T("path"), 0, _T("") },// OC defaults to load path
118 {_T("cmdline"), _T(""), _T("") },// /Automation if app class
119 {_T("debugger"), _T(""), _T("") },// Debugger to invoke server
120 {_T("permid"), 0, _T("\050\051\053") },// Version independent clsid
121 {_T("permname"), 0, _T("\052") },// Version independent progid
122 {_T("iconindex"), _T("0"), _T("\004") },// Zero-based resource icon
123 {_T("toolbmpindex"),_T("1"), _T("\065") },// Index of resource bitmap for palette
124 {_T("menuname"), _T(""), _T("\045") },// 15 characters maximum
125 {_T("appname"), 0, _T("") },// AppName, AuxUserType/3
126 {_T("verb0"), 0, _T("\010\020") },// Name of primary verb
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") },// From REGVERBOPT macro
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") },// From REGFORMAT macro
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") },// Default file format name
154 {_T("aspectall"), _T("0"), _T("\040") },// Option flags for all aspects
155 {_T("aspectcontent"), 0, _T("\041") },// Option flags for content view
156 {_T("aspectthumbnail"), 0, _T("\042") },// Option flags thumbnail view
157 {_T("aspecticon"), 0, _T("\043") },// Option flags for icon view
158 {_T("aspectdocprint"), 0, _T("\044") },// Option flags docprint view
159 {_T("extension"), 0, _T("\057\060\061") },// Extension for shell loading
160 {_T("version"), 0, _T("\054") },// App/typelib version string
161 {_T("helpdir"), 0, _T("") },// Help directory for typehelp
162 {_T("typehelp"), 0, _T("") },// Help file for type library
163 {_T("language"), 0, _T("") },// Set internally from func arg
164 {_T("docflags"), _T("0"), _T("") },
165 {_T("directory"), 0, _T("") },
166 {_T("docfilter"), 0, _T("") },
167 {_T("debugclsid"), 0, _T("")/*INTERNAL GEN*/},// Internal,NOT USER SPECIFIED
168 {_T("extraopt"), _T(""), _T("")/*INTERNAL USE*/},// Cmdline debug/non-debug flag
169 {_T("debugprogid"), 0, _T("") },// Define to force debug reg
170 {_T("debugdesc"), 0, _T("") },// Different string for debug
171 {0, 0, 0 },// End
172};
173
174//
175/// Generate OLE registration file image to an output stream
176///
177/// Process a given regInfo table to produce an ascii registration list out to
178/// an ostream. Arguments are:
179/// \param regInfo - main registration list to work from
180/// \param module - hinstance of program module for 'path' & 'serverctx' entries
181/// \param out - output stream to receive reg entry lines
182/// \param lang - language id for 'language' entry & string translation
183/// \param filter - optional template restricting filter
184/// \param defaults - optional reg entries processed before main list
185/// \param overrides- optional reg entries processed after main list
186//
190{
191 // Use OCF global registration templates & parameters
192 //
193 TRegSymbolTable symbolTable(TRegKey::GetClassesRoot(), OcRegTemplates, OcRegParams);
194
195 // Initialize the symbol table
196 //
197 symbolTable.Init(filter);
198
199 // Check for language defaulted to system or user configuration &
200 // assign language parameter based on TLocaleString's setting
201 //
202 if (lang == LangSysDefault)
204 else if (lang == LangUserDefault)
206
207 int langIdx = symbolTable.Params.Find(_T("language"));
208 _TCHAR langBuf[10];
209 wsprintf(langBuf, _T("%X"), lang);
210 symbolTable.Params.Value(langIdx) = langBuf;
211
212 // Assign path parameter initially to module load path of the given HINSTANCE
213 //
214 const int pathSize = 512;
216 if(!module)
217 module = &GetGlobalModule();
218 module->GetModuleFileName(path, pathSize);
219 symbolTable.Params.Value(symbolTable.Params.Find(_T("path"))) = path;
220
221 // Assign server context based on whether it is an EXE or a DLL
222 //
223 // NOTE: Assumes that this code is linked into server's module
224 //
225 {
226 int svrIdx = symbolTable.Params.Find(_T("serverctx"));
227 if (svrIdx >= 0)
228 {
229 if (::GetModuleHandle(0) == module->GetHandle()) // Check instance handle for 32bit EXE
230 symbolTable.Params.Value(svrIdx) = _T("Local");
231 else
232 symbolTable.Params.Value(svrIdx) = _T("Inproc");
233 }
234 }
235
236 // Build params from the 3 lists provided in this order:
237 //
238 // 0: defaults list (defaults)
239 // 1: user list of parameters and custom keys (regList)
240 // 2: and overrides list (overrides)
241 //
242 symbolTable.UpdateParams(lang, defaults);
243 symbolTable.UpdateParams(lang, regInfo.Items);
244 if (!defaults) { //SL: fix for progId without description, Jul-2009
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)
250 hasProgId=true;
251 }
252 for (regItem = regInfo.Items; regItem->Key != 0 && !hasDescription; regItem++) {
253 if (strcmp(regItem->Key, "description") == 0)
254 hasDescription=true;
255 }
256// if (regInfo.Lookup("progid") && !regInfo.Lookup("description"))
258 {
260 { "description", {_T("OCF default description")}},
261 {0,{0}} };
262 symbolTable.UpdateParams(lang, auxAppReg_list);
263 }
264 }
265 symbolTable.UpdateParams(lang, overrides);
266
267 symbolTable.StreamOut(regInfo.Items, out);
268
269 // Decode & return document template flags
270 //
271 int i = symbolTable.Params.Find(_T("docflags"));
272 if (i >= 0)
273 return _ttol(symbolTable.Params.Value(i));
274 return 0;
275}
276
277//
278/// Unregister application or class from registration database
279///
280/// These params are the only ones needed to unregister an OLE program or class
281//
283{
284 static const TRegistry::TUnregParams unregParams[] = {
285 { _T('.'),_T("extension"), &TRegKey::GetClassesRoot() },
286 { 0, _T("debugclsid"), &TRegKey::GetClassesRootClsid() },
287 { 0, _T("debugprogid"), &TRegKey::GetClassesRoot() },
288 { 0, _T("clsid"), &TRegKey::GetClassesRootClsid() },
289 { 0, _T("progid"), &TRegKey::GetClassesRoot() },
290 { 0, _T("permid"), &TRegKey::GetClassesRoot() },
291 { 0, 0, 0 },
292 };
294}
295
296//----------------------------------------------------------------------------
297// Separate debugging registration for application and documents
298// Overrides non-debug values with values from debug keys
299//
300
301//
302//
303//
304TRegItem OcRegNoDebug[] = { {"debugger", {_T("")}}, {0,{0}} };
305TRegItem OcRegNotDll[] = { {"cmdline", {_T("")}}, {"debugger", {_T("")}}, {0,{0}} };
306
307//
308// Filters limit the templates used when setting up debug registration
309//
310_TCHAR AppDebugFilter[] = _T("\001\002\003\005\006\007");
311_TCHAR DocDebugFilter[] = _T("\001\002\003\005\006\007")\
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");
316
317//
318//
319//
320struct TDebugRegKey { enum { progid, clsid, description, extraopt};};
321const _TCHAR* OcReplaceKeys[] = { _T("progid"), _T("clsid"), _T("description"), _T("extraopt")};
322const _TCHAR* OcDebugKeys[] = {_T("debugprogid"), _T("debugclsid"), _T("debugdesc"), _T("debugopt")};
323
324//
325/// Walk thru a reginfo list using debug entries to create a parallel non-debug
326/// set for alternate, debug registration.
327/// Return:
328/// - 0 - No debug registration needed / available
329/// - 1 - Debug registration using passed classid
330/// - -1 - Debug registration using classid found in reginfo
331//
333{
336
337 // Walk thru the special keys with debug alternates
338 //
339 int stat = -1; // Initialize for regInfo-supplied clsid
340 for (int i = 0; i < COUNTOF(OcReplaceKeys); i++,oldKey++,newKey++,regDebug++) {
342 LPCTSTR value = regInfo.Lookup(_W2A(*newKey), lang);
343
344 // If not value found for a given key, supply a default if possible, else
345 // throw an exception.
346 //
347 if (!value) {
348 switch (i) {
349 case TDebugRegKey::progid:
350 return 0; // No debug registration if progid missing
351 case TDebugRegKey::extraopt:
352 value = _T(" /Debug"); // Default to "/Debug" on command line
353 break;
354 case TDebugRegKey::clsid:
355 if (clsid) {
356 value = clsid;
357 stat = 1; // Flag use of supplied clsid
358 break;
359 } // else fall through to throw exception--clsid is required
360 case TDebugRegKey::description:
361 throw TXRegistry{_T("ocf::OcSetupDebugReg: incomplete debug registration"), *newKey};
362 }
363 }
364 regDebug->Key = _W2A(*oldKey); // Write normal key + debug value to
365 regDebug->Value = value; // output reg list
366 }
367 regDebug->Key = 0; // 0-terminate reg list
368 return stat;
369}
370
371
372//----------------------------------------------------------------------------
373// TRegistrar - Application registration manager interface class
374//
375
376//
377//
378//
379TRegistrar* TRegistrar::RegistrarList = 0;
380
381//
382//
383//
385 owl::tstring& cmdLine, TModule* module)
386:
387 AppDesc(*new TAppDescriptor(regInfo, callback, cmdLine, module))
388{
389 Next = RegistrarList;
390 RegistrarList = this;
391 TRACEX(OcfRefCount, 1, "TRegistrar() @" << (void*)this);
392}
393
394//
395//
396//
398:
399 AppDesc(appDesc)
400{
401 Next = RegistrarList;
402 RegistrarList = this;
403}
404
405//
406//
407//
409{
410 // Since TRegistrars are destroyed when the module is shutdown
411 // we do not need to detach each registrar from the linked list
412 //
413 delete &AppDesc;
414}
415
416//
417//
418//
420{
421 return reg ? reg->Next : RegistrarList;
422}
423
424//
425//
426//
427void * TRegistrar::GetFactory(const GUID& clsid, const GUID & iid)
428{
429 void * retObj = 0;
430 if (clsid != AppDesc.AppClassId)
431 return 0;
432 ((IUnknown&)AppDesc).QueryInterface(iid, &retObj);
433 return retObj; // QueryInterface sets to null if fails
434}
435
436//
437//
438//
440{
441 return static_cast<bool>(!AppDesc.IsBound());
442}
443
444//
445//
446//
448{
450 return 0; // inproc server waits until class factory created and called
452 if (!factory)
453 return 1;
456 IUnknown* ifc = (factory)(0, GetOptions() | amRun, 0); // create app and run it
457
458 // App is now running its message loop, factory may get called again by OLE
459 //
460 ifc = (factory)(ifc, GetOptions() | amShutdown, 0); // EXE finished, destroy it
461 if (ifc && !(GetOptions() & amServedApp))
462 ifc->Release(); // we own the reference count, else container released it
463 return 0;
464}
465
466//
467//
468//
470{
471 if (!AppDesc.GetFactory())
472 return;
474 if (releasedObj)
475 releasedObj->Release();
476}
477
478} // OCF namespace
479
480//==============================================================================
481
482using namespace ocf;
483
484//----------------------------------------------------------------------------
485// DLL server entry points
486//
487
488//
489/// Entry point for complete registration management via command line
490/// Don't let any exceptions blow back to OLE.
491//
492# if defined(BI_COMP_MSC)
493STDAPI
494#else
496#endif
498{
499 try {
500 bool isDebug = false;
502
503 // Need to set up typelibrary state information in case multiple components
504 //
505 while ((registrar = TRegistrar::GetNext(registrar)) != 0) {
507 registrar->ProcessCmdLine(cmd);
508 if (registrar->IsOptionSet(amDebug))
509 isDebug = true;
510 }
511 if (isDebug)
512 OWL_BREAK;
513 return HR_OK;
514 }
515 catch (...) {
516 return HR_FAIL;
517 }
518}
519
520//
521/// OLE 2.0 entry point for obtaining a class factory for a particular CLSID
522/// Don't let any exceptions blow back to OLE.
523//
524STDAPI DllGetClassObject(const GUID& clsid, const GUID& iid, void** retObj)
525{
526 try {
528 while ((registrar = TRegistrar::GetNext(registrar)) != 0) {
529 *retObj = registrar->GetFactory(clsid, iid);
530 if (*retObj)
531 return HR_OK;
532 }
533 return HR_FAIL;
534 }
535 catch (...) {
536 return HR_FAIL;
537 }
538}
539
540//
541/// OLE 2.0 entry point for checking if DLL has no clients and can be unloaded
542//
544{
546 while ((registrar = TRegistrar::GetNext(registrar)) != 0) {
547 if (!registrar->CanUnload()) {
548 TRACEX(OcfDll, 1, "DllCanUnloadNow returning HR_FALSE");
549 return HR_FALSE;
550 }
551 }
552 TRACEX(OcfDll, 1, "DllCanUnloadNow returning HR_OK");
553 return HR_OK;
554}
555
556//
557/// OLE 2.0 entry point for registering DLL, no locale info passed
558//
560{
561 return DllRegisterCommand(_T("/RegServer"));
562}
563
564//
565/// OLE 2.0 entry point for unregistering DLL
566//
568{
569 return DllRegisterCommand(_T("/UnregServer"));
570}
571
572#if defined(BI_COMP_MSC)
575
576//Jogy - this is not correct!!
577#if !defined(OWL_DLLNAME)
578# if defined (_UNICODE)
579# if defined(__TRACE) || defined(__WARN)
580# define OWL_DLLNAME "owl620vud.dll"
581# else
582# define OWL_DLLNAME "owl620vu.dll"
583# endif
584# else
585# if defined(__TRACE) || defined(__WARN)
586# define OWL_DLLNAME "owl620vd.dll"
587# else
588# define OWL_DLLNAME "owl620v.dll"
589# endif
590#endif
591#endif
592
593extern "C"
595{
597 // Prevent the OWL DLL from being unloaded prematurely
599 }
600 else if (dwReason == DLL_PROCESS_DETACH){
601 // Now it's OK for the OWL DLLs to be unloaded (see LoadLibrary above)
603 }
604 return TRUE; // ok
605}
606
607extern "C"
609#else
611#endif
612{
613 //TRACEX(OwlMain, 0, "DllEntryPoint(" << hInstance << ", " << reason << ", " <<
614 // ") called");
615
616 switch (reason) {
618
619 // If you provide your own version of DLL EntryPoint, make sure
620 // you call OwlInitUserDLL to allow OWL to initialize the global module.
621 // Second parameter - command line, if it = 0 std::string will crash //Y.B.
622 return OWLInitUserDLL(hInstance, _T("")) ? 1 : 0;
623 }
624 return 1;
625}
626
627
628
TAppDescriptor - OLE application descriptor definitions.
#define OWL_BREAK
Definition borlandc.h:49
#define DIAG_DECLARE_GROUP(group)
Definition checks.h:404
#define TRACEX(group, level, message)
Definition checks.h:263
#define DIAG_DEFINE_GROUP_INIT(f, g, e, l)
Definition checks.h:429
TComponentFactory GetFactory() const
Definition appdesc.h:65
bool IsAutomated() const
Definition appdesc.h:64
TBaseClassId AppClassId
Definition appdesc.h:136
Application registration manager interface class.
Definition ocreg.h:109
bool IsOptionSet(owl::uint32 option) const
Definition ocreg.h:343
virtual ~TRegistrar()
Definition ocreg.cpp:408
owl::uint32 GetOptions() const
Definition ocreg.h:350
void RegisterAppClass()
Definition ocreg.h:327
virtual int Run()
Definition ocreg.cpp:447
virtual void Shutdown(IUnknown *releasedObj, owl::uint32 options)
Definition ocreg.cpp:469
TAppDescriptor & AppDesc
Definition ocreg.h:157
static TRegistrar * GetNext(TRegistrar *reg)
Definition ocreg.cpp:419
virtual void * GetFactory(const GUID &clsid, const GUID &iid)
Definition ocreg.cpp:427
virtual bool CanUnload()
Definition ocreg.cpp:439
TRegistrar(owl::TRegList &regInfo, TComponentFactory callback, owl::tstring &cmdLine, owl::TModule *module=&owl::GetGlobalModule())
Definition ocreg.cpp:384
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
Definition module.h:75
static auto GetClassesRoot() -> TRegKey &
Special predefined root key used by shell and OLE applications (HKEY_CLASSES_ROOT).
Definition registry.cpp:32
static auto GetClassesRootClsid() -> TRegKey &
Commonly used subkey by shell and OLE applications (HKEY_CLASSES_ROOT\CLSID).
Definition registry.cpp:41
A registration parameter table, composed of a list of TRegItems.
Definition registry.h:531
High level symbol-based registry entry manipulation.
Definition registry.h:814
static int Unregister(TRegList &regInfo, const TUnregParams *params, const TRegItem *overrides=nullptr)
Unregisters entries given a reglist.
Thrown for errors within the Registry classes.
Definition registry.h:457
#define _ttol
Definition cygwin.h:65
#define _T(x)
Definition cygwin.h:51
THandle GetHandle() const
Return the instance handle of the library module represented by the TModule obect.
Definition module.h:1233
#define ocrSingleUse
Single client per instance.
Definition registry.h:726
Include for OC, gets common headers when precompiled headers are enabled.
#define _W2A(lpw)
Definition memory.h:219
#define _USES_CONVERSION
Definition memory.h:217
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....
Definition initdll.cpp:31
Object Component Framework (COM encapsulation)
Definition appdesc.h:22
const GUID void ** retObj
Definition appdesc.h:328
IUnknown *(* TComponentFactory)(IUnknown *outer, owl::uint32 options, owl::uint32 id)
Definition appdesc.h:35
TCHAR DocDebugFilter[]
Definition ocreg.cpp:311
const TCHAR * OcDebugKeys[]
Definition ocreg.cpp:322
int OcSetupDebugReg(owl::TRegList &regInfo, 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,...
Definition ocreg.cpp:332
TCHAR AppDebugFilter[]
Definition ocreg.cpp:310
owl::TRegItem OcRegNotDll[]
Definition ocreg.cpp:305
owl::TRegItem OcRegNoDebug[]
Definition ocreg.cpp:304
long OcRegisterClass(owl::TRegList &regInfo, 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.
Definition ocreg.cpp:187
const TCHAR * OcReplaceKeys[]
Definition ocreg.cpp:321
@ amAutomation
set from cmdline when EXE lauched for automation
Definition ocreg.h:81
@ amShutdown
set in factory call to shutdown/delete app
Definition ocreg.h:93
@ amServedApp
per instance flag, app refcnt held by container
Definition ocreg.h:89
@ amExeModule
set for EXE components, 0 if DLL inproc server
Definition ocreg.h:87
@ amDebug
user requested launching for debugging
Definition ocreg.h:85
@ amRun
set in factory call to run application msg loop
Definition ocreg.h:92
int OcUnregisterClass(owl::TRegList &regInfo, owl::TRegItem *overrides=0)
Unregister application or class from registration database.
Definition ocreg.cpp:282
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
unsigned long uint32
Definition number.h:34
owl::uint16 TLangId
Holds a language ID, a predefined number that represents a base language and dialect.
Definition lclstrng.h:26
const TLangId LangUserDefault
Definition lclstrng.h:31
std::string tstring
Definition defs.h:79
std::ostream tostream
Definition strmdefs.h:40
const TLangId LangSysDefault
Definition lclstrng.h:30
#define HR_OK
Definition defs.h:74
#define HR_FALSE
Definition defs.h:75
#define HR_FAIL
Definition defs.h:83
STDAPI DllRegisterServer()
OLE 2.0 entry point for registering DLL, no locale info passed.
Definition ocreg.cpp:559
STDAPI DllCanUnloadNow()
OLE 2.0 entry point for checking if DLL has no clients and can be unloaded.
Definition ocreg.cpp:543
STDAPI DllUnregisterServer()
OLE 2.0 entry point for unregistering DLL.
Definition ocreg.cpp:567
STDAPI __declspec(dllexport) DllRegisterCommand(LPCTSTR cmdLine)
Entry point for complete registration management via command line Don't let any exceptions blow back ...
Definition ocreg.cpp:495
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...
Definition ocreg.cpp:524
int WINAPI DllEntryPoint(HINSTANCE hInstance, uint32 reason, LPVOID)
Definition ocreg.cpp:610
OLE Registration definitions.
#define OWL_INI
Definition defs.h:170
#define COUNTOF(s)
Array element count Important: Only use this with an argument of array type.
Definition defs.h:376
Various types of smart pointer templatized classes.
Definition of class TString, a flexible universal string envelope class.
static TLangId SystemDefaultLangId
The default language identifier.
Definition lclstrng.h:84
static TLangId UserDefaultLangId
The user-defined default language identifier.
Definition lclstrng.h:87
A single registration list entry.
Definition registry.h:508
Definition registry.h:784