-
Notifications
You must be signed in to change notification settings - Fork 2
/
uComAdmin.pas
3314 lines (2941 loc) · 133 KB
/
uComAdmin.pas
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
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
unit uComAdmin;
// Compile with typeinfo for RTTI support
{$TYPEINFO ON}
// https://docs.microsoft.com/en-us/windows/win32/cossdk/com--administration-collections
interface
uses
System.Generics.Collections,
System.SysUtils,
COMAdmin_TLB;
type
TCOMAdminAccessChecksLevelOptions = (COMAdminAccessChecksApplicationLevel, COMAdminAccessChecksApplicationComponentLevel);
TCOMAdminApplicationActivation = (COMAdminActivationInproc, COMAdminActivationLocal);
TCOMAdminAuthenticationCapability = (COMAdminAuthenticationCapabilitiesNone = $0, COMAdminAuthenticationCapabilitiesSecureReference = $2,
COMAdminAuthenticationCapabilitiesStaticCloaking = $20, COMAdminAuthenticationCapabilitiesDynamicCloaking = $40);
TCOMAdminAuthenticationLevel = (COMAdminAuthenticationDefault, COMAdminAuthenticationNone, COMAdminAuthenticationConnect,
COMAdminAuthenticationCall, COMAdminAuthenticationPacket, COMAdminAuthenticationIntegrity,
COMAdminAuthenticationPrivacy);
TCOMAdminComponentType = (COMAdmin32BitComponent = $1, COMAdmin64BitComponent = $2);
TCOMAdminImpersonationLevel = (COMAdminImpersonationAnonymous, COMAdminImpersonationIdentify, COMAdminImpersonationImpersonate, COMAdminImpersonationDelegate);
TCOMAdminOperatingSystem = (COMAdminOSNotInitialized, COMAdminOSWindows3_1, COMAdminOSWindows9x, COMAdminOSWindows2000,
COMAdminOSWindows2000AdvancedServer, COMAdminOSWindows2000Unknown, COMAdminOSUnknown, COMAdminOSWindowsXPPersonal,
COMAdminOSWindowsXPProfessional, COMAdminOSWindowsNETStandardServer, COMAdminOSWindowsNETEnterpriseServer,
COMAdminOSWindowsNETDatacenterServer, COMAdminOSWindowsNETWebServer, COMAdminOSWindowsLonghornPersonal,
COMAdminOSWindowsLonghornProfessional, COMAdminOSWindowsLonghornStandardServer, COMAdminOSWindowsLonghornEnterpriseServer,
COMAdminOSWindowsLonghornDatacenterServer, COMAdminOSWindowsLonghornWebServer, COMAdminOSWindows7Personal,
COMAdminOSWindows7Professional, COMAdminOSWindows7StandardServer, COMAdminOSWindows7EnterpriseServer,
COMAdminOSWindows7DatacenterServer, COMAdminOSWindows7WebServer, COMAdminOSWindows8Personal,
COMAdminOSWindows8Professional, COMAdminOSWindows8StandardServer, COMAdminOSWindows8EnterpriseServer,
COMAdminOSWindows8DatacenterServer, COMAdminOSWindows8WebServer, COMAdminOSWindowsBluePersonal,
COMAdminOSWindowsBlueProfessional, COMAdminOSWindowsBlueStandardServer, COMAdminOSWindowsBlueEnterpriseServer,
COMAdminOSWindowsBlueDatacenterServer, COMAdminOSWindowsBlueWebServer);
TCOMAdminQCAuthenticateMsgs = (COMAdminQCMessageAuthenticateSecureApps, COMAdminQCMessageAuthenticateOff, COMAdminQCMessageAuthenticateOn);
TCOMAdminSRPTrustLevel = (COMAdminSRPDisallow = $0, COMAminSRPFullyTrusted = $40000);
TCOMAdminProtocol = (COMAdminProtocolTCP, COMAdminProtocolHTTP, COMAdminProtocolSPX);
TComAdminReadEvent = procedure (ALevel: Integer; const AObjectType, AObjectName: string) of object;
TComAdminDebug = procedure(const AMessage: string) of object;
const
COM_ADMIN_PROTOCOLS: array[COMAdminProtocolTCP..COMAdminProtocolSPX] of string = ('ncacn_ip_tcp', 'ncacn_http', 'ncacn_spx');
DEFAULT_CREATION_TIMEOUT = 60000;
DEFAULT_MAX_DUMP = 5;
DEFAULT_MAX_POOL = 1048576;
DEFAULT_RECYCLE_TIMEOUT = 15;
DEFAULT_SHUTDOWN = 3;
DEFAULT_TRANSACTION_TIMEOUT = 60;
MAX_DUMP_COUNT = 200;
MAX_LIFETIME_LIMIT = 30240;
MAX_POOL_SIZE = DEFAULT_MAX_POOL;
MAX_RECYCLE_TIMEOUT = 1440;
MAX_THREADS = 1000;
MAX_TIMEOUT = 3600;
IID_IUserCollection: TGUID = '{C29ADAEE-CB81-4D36-BEDF-9F131094D9A5}';
type
// Interface for objects that have a users collection
IUserCollection = Interface(IInterface)
['{C29ADAEE-CB81-4D36-BEDF-9F131094D9A5}']
function GetUsersCollectionName: string;
end;
// forward declaration of internally used classes
TComAdminBaseObject = class;
TComAdminBaseList = class;
TComAdminCatalog = class;
TComAdminAvailableCollections = class(TList<string>)
public
constructor Create(ACatalog: ICOMAdminCatalog2); reintroduce; overload;
constructor Create(ABaseObject: TComAdminBaseObject); reintroduce; overload;
destructor Destroy; override;
function ToString: string; reintroduce;
end;
// generic base class for all single objects
TComAdminBaseObject = class(TInterfacedObject)
strict private
FAvailableCollections: TComAdminAvailableCollections;
FCatalogCollection: ICatalogCollection;
FCatalogObject: ICatalogObject;
FCollection: TComAdminBaseList;
FLevel: Integer;
FKey: string;
FName: string;
FSupportsUsers: Boolean;
function GetLevel: Integer;
private
function InternalCheckRange(AMinValue, AMaxValue, AValue: Cardinal): Boolean;
public
constructor Create(ACollection: TComAdminBaseList; ACatalogObject: ICatalogObject); reintroduce; overload;
destructor Destroy; override;
procedure CopyProperties(ASourceObject, ATargetObject: TComAdminBaseObject);
property AvailableCollections: TComAdminAvailableCollections read FAvailableCollections;
property CatalogCollection: ICatalogCollection read FCatalogCollection;
property CatalogObject: ICatalogObject read FCatalogObject;
property Collection: TComAdminBaseList read FCollection;
property Key: string read FKey write FKey;
property Level: Integer read FLevel;
property Name: string read FName write FName; // will be set to published in some ancestors to provide copying
property SupportsUsers: Boolean read FSupportsUsers write FSupportsUsers default False;
end;
// generic list class for all collections of objects
TComAdminBaseList = class(TObjectList<TComAdminBaseObject>)
strict private
FCatalog: TComAdminCatalog;
FCatalogCollection: ICatalogCollection;
FName: string;
FOwner: TComAdminBaseObject;
function GetIndexByKey(const AKey: string): Integer;
public
constructor Create(AOwner: TComAdminBaseObject; ACatalog: TComAdminCatalog; ACatalogCollection: ICatalogCollection); reintroduce;
function Contains(const AItemName: string): Boolean;
function Delete(Index: Integer): Integer;
procedure RaiseExtendedError(AException: Exception; ACollection: ICatalogCollection);
function SaveChanges: Integer;
property Catalog: TComAdminCatalog read FCatalog write FCatalog;
property CatalogCollection: ICatalogCollection read FCatalogCollection write FCatalogCollection;
property Name: string read FName;
property Owner: TComAdminBaseObject read FOwner;
end;
TComAdminUser = class(TComAdminBaseObject)
published
property Name;
end;
TComAdminUserList = class(TComAdminBaseList)
strict private
function GetItem(Index: Integer): TComAdminUser;
public
function Append(ASourceUser: TComAdminUser): TComAdminUser;
function Find(const AName: string; out AUser: TComAdminUser): Boolean;
property Items[Index: Integer]: TComAdminUser read GetItem; default;
end;
TComAdminRole = class(TComAdminBaseObject)
strict private
FDescription: string;
FUsers: TComAdminUserList;
procedure GetUsers;
function HasUsersCollection: Boolean;
procedure SetDescription(const Value: string);
public
constructor Create(ACollection: TComAdminBaseList; ACatalogObject: ICatalogObject); reintroduce;
destructor Destroy; override;
function CopyProperties(ASourceRole: TComAdminRole): Integer;
procedure SyncUsers(ASourceRole: TComAdminRole);
property Users: TComAdminUserList read FUsers write FUsers;
published
property Description: string read FDescription write SetDescription;
property Name;
end;
TComAdminRoleList = class(TComAdminBaseList)
strict private
function GetItem(Index: Integer): TComAdminRole;
public
function Append(ASourceRole: TComAdminRole): TComAdminRole;
function Find(const AName: string; out ARole: TComAdminRole): Boolean;
property Items[Index: Integer]: TComAdminRole read GetItem; default;
end;
TComAdminInstance = class(TComAdminBaseObject)
strict private
FProcessID: Cardinal;
FHasRecycled: Boolean;
FIsPaused: Boolean;
procedure ReadExtendedProperties;
public
constructor Create(ACollection: TComAdminBaseList; ACatalogObject: ICatalogObject); reintroduce;
published
property HasRecycled: Boolean read FHasRecycled;
property IsPaused: Boolean read FIsPaused;
property ProcessID: Cardinal read FProcessID;
property Name;
end;
TComAdminInstanceList = class(TComAdminBaseList)
strict private
function GetItem(Index: Integer): TComAdminInstance;
public
property Items[Index: Integer]: TComAdminInstance read GetItem; default;
end;
TComAdminPartition = class(TComAdminBaseObject, IUserCollection)
strict private
FDescription: string;
FChangeable: Boolean;
FDeleteable: Boolean;
FID: string;
FRoles: TComAdminRoleList;
procedure GetRoles;
procedure ReadExtendedProperties;
procedure SetChangeable(const Value: Boolean);
procedure SetDeleteable(const Value: Boolean);
procedure SetDescription(const Value: string);
procedure SetID(const Value: string);
public
constructor Create(ACollection: TComAdminBaseList; ACatalogObject: ICatalogObject); reintroduce;
destructor Destroy; override;
function GetUsersCollectionName: string;
property Roles: TComAdminRoleList read FRoles write FRoles;
published
property Changeable: Boolean read FChangeable write SetChangeable default True;
property Deleteable: Boolean read FDeleteable write SetDeleteable default True;
property Description: string read FDescription write SetDescription;
property ID: string read FID write SetID;
property Name;
end;
TComAdminPartitionList = class(TComAdminBaseList)
strict private
function GetItem(Index: Integer): TComAdminPartition;
public
property Items[Index: Integer]: TComAdminPartition read GetItem; default;
end;
TComAdminMethod = class(TComAdminBaseObject)
strict private
FAutoComplete: Boolean;
FCLSID: string;
FDescription: string;
FIID: string;
FIndex: Cardinal;
FRoles: TComAdminRoleList;
procedure GetRoles;
procedure ReadExtendedProperties;
procedure SetAutoComplete(const Value: Boolean);
procedure SetDescription(const Value: string);
public
constructor Create(ACollection: TComAdminBaseList; ACatalogObject: ICatalogObject); reintroduce;
destructor Destroy; override;
property Roles: TComAdminRoleList read FRoles write FRoles;
published
property AutoComplete: Boolean read FAutoComplete write SetAutoComplete default False;
property Description: string read FDescription write SetDescription;
property CLSID: string read FCLSID;
property IID: string read FIID;
property Index: Cardinal read FIndex;
property Name;
end;
TComAdminMethodList = class(TComAdminBaseList)
strict private
function GetItem(Index: Integer): TComAdminMethod;
public
property Items[Index: Integer]: TComAdminMethod read GetItem; default;
end;
TComAdminInterface = class(TComAdminBaseObject)
strict private
FCLSID: string;
FDescription: string;
FIID: string;
FRoles: TComAdminRoleList;
FMethods: TComAdminMethodList;
FQueuingEnabled: Boolean;
FQueuingSupported: Boolean;
procedure GetRoles;
procedure GetMethods;
procedure ReadExtendedProperties;
procedure SetQueuingEnabled(const Value: Boolean);
procedure SetFDescription(const Value: string);
public
constructor Create(ACollection: TComAdminBaseList; ACatalogObject: ICatalogObject); reintroduce;
destructor Destroy; override;
property Methods: TComAdminMethodList read FMethods write FMethods;
property Roles: TComAdminRoleList read FRoles write FRoles;
published
property CLSID: string read FCLSID;
property Description: string read FDescription write SetFDescription;
property IID: string read FIID;
property Name;
property QueuingEnabled: Boolean read FQueuingEnabled write SetQueuingEnabled;
property QueuingSupported: Boolean read FQueuingSupported;
end;
TComAdminInterfaceList = class(TComAdminBaseList)
strict private
function GetItem(Index: Integer): TComAdminInterface;
public
property Items[Index: Integer]: TComAdminInterface read GetItem; default;
end;
TCOMAdminComponent = class(TComAdminBaseObject)
strict private
FAllowInprocSubscribers: Boolean;
FApplicationID: string;
FBitness: TCOMAdminComponentType;
FComponentAccessChecksEnabled: Boolean;
FComponentTransactionTimeout: Cardinal;
FComponentTransactionTimeoutEnabled: Boolean;
FCOMTIIntrinsics: Boolean;
FConstructionEnabled: Boolean;
FConstructorString: string;
FCreationTimeout: Cardinal;
FDescription: string;
FDll: string;
FEventTrackingEnabled: Boolean;
FExceptionClass: string;
FFireInParallel: Boolean;
FIISIntrinsics: Boolean;
FInitializeServerApplication: Boolean;
FIsEnabled: Boolean;
FIsInstalled: Boolean;
FJustInTimeActivation: Boolean;
FLoadBalancingSupported: Boolean;
FInterfaces: TComAdminInterfaceList;
FIsEventClass: Boolean;
FIsPrivateComponent: Boolean;
FMinPoolSize: Cardinal;
FMaxPoolSize: Cardinal;
FMultiInterfacePublisherFilterCLSID: string;
FMustRunInDefaultContext: Boolean;
FMustRunInClientContext: Boolean;
FObjectPoolingEnabled: Boolean;
FProgID: string;
FRoles: TComAdminRoleList;
procedure GetInterfaces;
procedure GetRoles;
procedure ReadExtendedProperties;
procedure SetAllowInprocSubscribers(const Value: Boolean);
procedure SetApplicationID(const Value: string);
procedure SetBitness(const Value: TCOMAdminComponentType);
procedure SetComponentAccessChecksEnabled(const Value: Boolean);
procedure SetComponentTransactionTimeout(const Value: Cardinal);
procedure SetComponentTransactionTimeoutEnabled(const Value: Boolean);
procedure SetCOMTIIntrinsics(const Value: Boolean);
procedure SetConstructionEnabled(const Value: Boolean);
procedure SetConstructorString(const Value: string);
procedure SetCreationTimeout(const Value: Cardinal);
procedure SetDescription(const Value: string);
procedure SetDll(const Value: string);
procedure SetEventTrackingEnabled(const Value: Boolean);
procedure SetExceptionClass(const Value: string);
procedure SetFireInParallel(const Value: Boolean);
procedure SetIISIntrinsics(const Value: Boolean);
procedure SetInitializeServerApplication(const Value: Boolean);
procedure SetIsEnabled(const Value: Boolean);
procedure SetIsEventClass(const Value: Boolean);
procedure SetIsInstalled(const Value: Boolean);
procedure SetIsPrivateComponent(const Value: Boolean);
procedure SetJustInTimeActivation(const Value: Boolean);
procedure SetLoadBalancingSupported(const Value: Boolean);
procedure SetMaxPoolSize(const Value: Cardinal);
procedure SetMinPoolSize(const Value: Cardinal);
procedure SetMultiInterfacePublisherFilterCLSID(const Value: string);
procedure SetMustRunInClientContext(const Value: Boolean);
procedure SetMustRunInDefaultContext(const Value: Boolean);
procedure SetObjectPoolingEnabled(const Value: Boolean);
procedure SetProgID(const Value: string);
procedure SyncRoles(ASourceComponent: TCOMAdminComponent);
public
constructor Create(ACollection: TComAdminBaseList; ACatalogObject: ICatalogObject); reintroduce;
destructor Destroy; override;
function CopyProperties(ASourceComponent: TCOMAdminComponent): Integer;
property ApplicationID: string read FApplicationID write SetApplicationID;
property Roles: TComAdminRoleList read FRoles write FRoles;
property Interfaces: TComAdminInterfaceList read FInterfaces write FInterfaces;
published
property AllowInprocSubscribers: Boolean read FAllowInprocSubscribers write SetAllowInprocSubscribers default True;
property Bitness: TCOMAdminComponentType read FBitness write SetBitness;
property ComponentAccessChecksEnabled: Boolean read FComponentAccessChecksEnabled write SetComponentAccessChecksEnabled default False;
property ComponentTransactionTimeout: Cardinal read FComponentTransactionTimeout write SetComponentTransactionTimeout default DEFAULT_TRANSACTION_TIMEOUT;
property ComponentTransactionTimeoutEnabled: Boolean read FComponentTransactionTimeoutEnabled write SetComponentTransactionTimeoutEnabled default False;
property COMTIIntrinsics: Boolean read FCOMTIIntrinsics write SetCOMTIIntrinsics default False;
property ConstructionEnabled: Boolean read FConstructionEnabled write SetConstructionEnabled default False;
property ConstructorString: string read FConstructorString write SetConstructorString;
property CreationTimeout: Cardinal read FCreationTimeout write SetCreationTimeout default DEFAULT_CREATION_TIMEOUT;
property Description: string read FDescription write SetDescription;
property Dll: string read FDll write SetDll;
property EventTrackingEnabled: Boolean read FEventTrackingEnabled write SetEventTrackingEnabled default True;
property ExceptionClass: string read FExceptionClass write SetExceptionClass;
property FireInParallel: Boolean read FFireInParallel write SetFireInParallel default False;
property IISIntrinsics: Boolean read FIISIntrinsics write SetIISIntrinsics default False;
property InitializeServerApplication: Boolean read FInitializeServerApplication write SetInitializeServerApplication default False;
property IsEnabled: Boolean read FIsEnabled write SetIsEnabled default True;
property IsEventClass: Boolean read FIsEventClass write SetIsEventClass default False;
property IsInstalled: Boolean read FIsInstalled write SetIsInstalled default False;
property IsPrivateComponent: Boolean read FIsPrivateComponent write SetIsPrivateComponent default False;
property JustInTimeActivation: Boolean read FJustInTimeActivation write SetJustInTimeActivation default False;
property LoadBalancingSupported: Boolean read FLoadBalancingSupported write SetLoadBalancingSupported default False;
property MaxPoolSize: Cardinal read FMaxPoolSize write SetMaxPoolSize default DEFAULT_MAX_POOL;
property MinPoolSize: Cardinal read FMinPoolSize write SetMinPoolSize default 0;
property MultiInterfacePublisherFilterCLSID: string read FMultiInterfacePublisherFilterCLSID write SetMultiInterfacePublisherFilterCLSID;
property MustRunInClientContext: Boolean read FMustRunInClientContext write SetMustRunInClientContext default False;
property MustRunInDefaultContext: Boolean read FMustRunInDefaultContext write SetMustRunInDefaultContext default False;
property Name;
property ObjectPoolingEnabled: Boolean read FObjectPoolingEnabled write SetObjectPoolingEnabled default False;
property ProgID: string read FProgID write SetProgID;
end;
TCOMAdminComponentList = class(TComAdminBaseList)
strict private
function GetItem(Index: Integer): TCOMAdminComponent;
function BuildLibraryName(AComponent: TCOMAdminComponent): string;
public
function Append(ASourceComponent: TCOMAdminComponent): TCOMAdminComponent;
function CopyLibrary(ASourceComponent: TCOMAdminComponent; AOverwrite: Boolean = False): Boolean;
function Find(const AName: string; out AComponent: TCOMAdminComponent): Boolean;
property Items[Index: Integer]: TCOMAdminComponent read GetItem; default;
end;
TComAdminApplication = class(TComAdminBaseObject, IUserCollection)
strict private
FAccessChecksEnabled: Boolean;
FAccessChecksLevel: TCOMAdminAccessChecksLevelOptions;
FActivation: TCOMAdminApplicationActivation;
FAuthenticationCapability: TCOMAdminAuthenticationCapability;
FAuthenticationLevel: TCOMAdminAuthenticationLevel;
FChangeable: Boolean;
FCommandLine: string;
FComponents: TCOMAdminComponentList;
FConcurrentApps: Cardinal;
FCreatedBy: string;
FCRMEnabled: Boolean;
FCRMLogFile: string;
FDeleteable: Boolean;
FDescription: string;
FDirectory: string;
FDumpEnabled: Boolean;
FDumpOnException: Boolean;
FDumpOnFailFast: Boolean;
FDumpPath: string;
FEventsEnabled: Boolean;
FGig3SupportEnabled: Boolean;
FIdentity: string;
FImpersonationLevel: TCOMAdminImpersonationLevel;
FInstances: TComAdminInstanceList;
FIsEnabled: Boolean;
FIsSystem: Boolean;
FMaxDumpCount: Cardinal;
FPartitionID: string;
FProxy: Boolean;
FProxyServerName: string;
FQCAuthenticateMsgs: TCOMAdminQCAuthenticateMsgs;
FQCListenerMaxThreads: Cardinal;
FQueueListenerEnabled: Boolean;
FQueuingEnabled: Boolean;
FRecycleActivationLimit: Cardinal;
FRecycleCallLimit: Cardinal;
FRecycleExpirationTimeout: Cardinal;
FRecycleLifetimeLimit: Cardinal;
FRecycleMemoryLimit: Cardinal;
FReplicable: Boolean;
FRoles: TComAdminRoleList;
FRunForever: Boolean;
FServiceName: string;
FShutdownAfter: Cardinal;
FSoapActivated: Boolean;
FSoapBaseUrl: string;
FSoapMailTo: string;
FSoapVRoot: string;
FSRPEnabled: Boolean;
FSRPTrustLevel: TCOMAdminSRPTrustLevel;
function BuildInstallFileName: string;
procedure GetComponents;
function GetInstances: TComAdminInstanceList;
procedure GetRoles;
function GetUsersCollectionName: string;
procedure ReadExtendedProperties;
procedure SetAccessChecksEnabled(const Value: Boolean);
procedure SetAccessChecksLevel(const Value: TCOMAdminAccessChecksLevelOptions);
procedure SetActivation(const Value: TCOMAdminApplicationActivation);
procedure SetAuthenticationCapability(const Value: TCOMAdminAuthenticationCapability);
procedure SetAuthenticationLevel(const Value: TCOMAdminAuthenticationLevel);
procedure SetChangeable(const Value: Boolean);
procedure SetCommandLine(const Value: string);
procedure SetConcurrentApps(const Value: Cardinal);
procedure SetCreatedBy(const Value: string);
procedure SetCRMEnabled(const Value: Boolean);
procedure SetCRMLogFile(const Value: string);
procedure SetDeleteable(const Value: Boolean);
procedure SetDescription(const Value: string);
procedure SetDirectory(const Value: string);
procedure SetDumpEnabled(const Value: Boolean);
procedure SetDumpOnException(const Value: Boolean);
procedure SetDumpOnFailFast(const Value: Boolean);
procedure SetDumpPath(const Value: string);
procedure SetEventsEnabled(const Value: Boolean);
procedure SetGig3SupportEnabled(const Value: Boolean);
procedure SetIdentity(const Value: string);
procedure SetImpersonationLevel(const Value: TCOMAdminImpersonationLevel);
procedure SetIsEnabled(const Value: Boolean);
procedure SetMaxDumpCount(const Value: Cardinal);
procedure SetPartitionID(const Value: string);
procedure SetPassword(const Value: string);
procedure SetProxy(const Value: Boolean);
procedure SetProxyServerName(const Value: string);
procedure SetQCAuthenticateMsgs(const Value: TCOMAdminQCAuthenticateMsgs);
procedure SetQCListenerMaxThreads(const Value: Cardinal);
procedure SetQueueListenerEnabled(const Value: Boolean);
procedure SetQueuingEnabled(const Value: Boolean);
procedure SetRecycleActivationLimit(const Value: Cardinal);
procedure SetRecycleCallLimit(const Value: Cardinal);
procedure SetRecycleExpirationTimeout(const Value: Cardinal);
procedure SetRecycleLifetimeLimit(const Value: Cardinal);
procedure SetRecycleMemoryLimit(const Value: Cardinal);
procedure SetReplicable(const Value: Boolean);
procedure SetRunForever(const Value: Boolean);
procedure SetServiceName(const Value: string);
procedure SetShutdownAfter(const Value: Cardinal);
procedure SetSoapActivated(const Value: Boolean);
procedure SetSoapBaseUrl(const Value: string);
procedure SetSoapMailTo(const Value: string);
procedure SetSoapVRoot(const Value: string);
procedure SetSRPEnabled(const Value: Boolean);
procedure SetSRPTrustLevel(const Value: TCOMAdminSRPTrustLevel);
procedure SyncComponents(ASourceApplication: TCOMAdminApplication);
procedure SyncRoles(ASourceApplication: TCOMAdminApplication);
public
constructor Create(ACollection: TComAdminBaseList; ACatalogObject: ICatalogObject); reintroduce;
destructor Destroy; override;
function CopyProperties(ASourceApplication: TCOMAdminApplication; const APassword: string): Integer;
function CopyToServer(ATargetServer: TComAdminCatalog; AOptions: Integer): Boolean;
function InstallComponent(const ALibraryName: string): TCOMAdminComponent;
function IsIntegratedIdentity: Boolean;
procedure SetApplicationEnabled(AValue: Boolean);
property Components: TCOMAdminComponentList read FComponents;
property Instances: TComAdminInstanceList read GetInstances;
property Roles: TComAdminRoleList read FRoles write FRoles;
published
property AccessChecksEnabled: Boolean read FAccessChecksEnabled write SetAccessChecksEnabled default True;
property AccessChecksLevel: TCOMAdminAccessChecksLevelOptions read FAccessChecksLevel write SetAccessChecksLevel default COMAdminAccessChecksApplicationComponentLevel;
property Activation: TCOMAdminApplicationActivation read FActivation write SetActivation default COMAdminActivationLocal;
property AuthenticationCapability: TCOMAdminAuthenticationCapability read FAuthenticationCapability write SetAuthenticationCapability default COMAdminAuthenticationCapabilitiesDynamicCloaking;
property AuthenticationLevel: TCOMAdminAuthenticationLevel read FAuthenticationLevel write SetAuthenticationLevel default COMAdminAuthenticationDefault;
property Changeable: Boolean read FChangeable write SetChangeable default True;
property CommandLine: string read FCommandLine write SetCommandLine;
property ConcurrentApps: Cardinal read FConcurrentApps write SetConcurrentApps default 1;
property CreatedBy: string read FCreatedBy write SetCreatedBy;
property CRMEnabled: Boolean read FCRMEnabled write SetCRMEnabled default False;
property CRMLogFile: string read FCRMLogFile write SetCRMLogFile;
property Deleteable: Boolean read FDeleteable write SetDeleteable default True;
property Description: string read FDescription write SetDescription;
property Directory: string read FDirectory write SetDirectory;
property DumpEnabled: Boolean read FDumpEnabled write SetDumpEnabled default False;
property DumpOnException: Boolean read FDumpOnException write SetDumpOnException default False;
property DumpOnFailFast: Boolean read FDumpOnFailFast write SetDumpOnFailFast default False;
property DumpPath: string read FDumpPath write SetDumpPath;
property EventsEnabled: Boolean read FEventsEnabled write SetEventsEnabled default True;
property Gig3SupportEnabled: Boolean read FGig3SupportEnabled write SetGig3SupportEnabled default False;
property Identity: string read FIdentity write SetIdentity;
property ImpersonationLevel: TCOMAdminImpersonationLevel read FImpersonationLevel write SetImpersonationLevel default COMAdminImpersonationImpersonate;
property IsEnabled: Boolean read FIsEnabled write SetIsEnabled default True;
property IsSystem: Boolean read FIsSystem default False;
property MaxDumpCount: Cardinal read FMaxDumpCount write SetMaxDumpCount default DEFAULT_MAX_DUMP;
property Name;
property PartitionID: string read FPartitionID write SetPartitionID;
property Password: string write SetPassword;
property Proxy: Boolean read FProxy write SetProxy default False;
property ProxyServerName: string read FProxyServerName write SetProxyServerName;
property QCAuthenticateMsgs: TCOMAdminQCAuthenticateMsgs read FQCAuthenticateMsgs write SetQCAuthenticateMsgs default COMAdminQCMessageAuthenticateSecureApps;
property QCListenerMaxThreads: Cardinal read FQCListenerMaxThreads write SetQCListenerMaxThreads default 0;
property QueueListenerEnabled: Boolean read FQueueListenerEnabled write SetQueueListenerEnabled default False;
property QueuingEnabled: Boolean read FQueuingEnabled write SetQueuingEnabled default False;
property RecycleActivationLimit: Cardinal read FRecycleActivationLimit write SetRecycleActivationLimit default 0;
property RecycleCallLimit: Cardinal read FRecycleCallLimit write SetRecycleCallLimit default 0;
property RecycleExpirationTimeout: Cardinal read FRecycleExpirationTimeout write SetRecycleExpirationTimeout default DEFAULT_RECYCLE_TIMEOUT;
property RecycleLifetimeLimit: Cardinal read FRecycleLifetimeLimit write SetRecycleLifetimeLimit default 0;
property RecycleMemoryLimit: Cardinal read FRecycleMemoryLimit write SetRecycleMemoryLimit default 0;
property Replicable: Boolean read FReplicable write SetReplicable default True;
property RunForever: Boolean read FRunForever write SetRunForever default False;
property ServiceName: string read FServiceName write SetServiceName;
property ShutdownAfter: Cardinal read FShutdownAfter write SetShutdownAfter default DEFAULT_SHUTDOWN;
property SoapActivated: Boolean read FSoapActivated write SetSoapActivated default False;
property SoapBaseUrl: string read FSoapBaseUrl write SetSoapBaseUrl;
property SoapMailTo: string read FSoapMailTo write SetSoapMailTo;
property SoapVRoot: string read FSoapVRoot write SetSoapVRoot;
property SRPEnabled: Boolean read FSRPEnabled write SetSRPEnabled default False;
property SRPTrustLevel: TCOMAdminSRPTrustLevel read FSRPTrustLevel write SetSRPTrustLevel default COMAminSRPFullyTrusted;
end;
TComAdminApplicationList = class(TComAdminBaseList)
strict private
function GetItem(Index: Integer): TComAdminApplication;
public
function Append(ASourceApplication: TComAdminApplication; const ACreatorString: string = ''; const APassword: string = ''): TComAdminApplication;
function Find(const AName: string; out AApplication: TComAdminApplication): Boolean;
property Items[Index: Integer]: TComAdminApplication read GetItem; default;
end;
TComAdminComputer = class(TComAdminBaseObject)
strict private
FApplicationProxyRSN: string;
FAuthenticationLevel: TCOMAdminAuthenticationLevel;
FCISEnabled: Boolean;
FCollection: ICatalogCollection;
FDCOMEnabled: Boolean;
FDefaultToInternetPorts: Boolean;
FDescription: string;
FDSPartitionLookupEnabled: Boolean;
FImpersonationLevel: TCOMAdminImpersonationLevel;
FInternetPortsListed: Boolean;
FIsRouter: Boolean;
FLoadBalancingCLSID: string;
FLocalPartitionLookupEnabled: Boolean;
FOperatingSystem: TCOMAdminOperatingSystem;
FOwner: TComAdminCatalog;
FPartitionsEnabled: Boolean;
FPorts: string;
FResourcePoolingEnabled: Boolean;
FRPCProxyEnabled: Boolean;
FSecureReferencesEnabled: Boolean;
FSecurityTrackingEnabled: Boolean;
FSRPActivateAsActivatorChecks: Boolean;
FSRPRunningObjectChecks: Boolean;
FTransactionTimeout: Cardinal;
procedure ReadExtendedProperties;
procedure SetApplicationProxyRSN(const Value: string);
procedure SetAuthenticationLevel(const Value: TCOMAdminAuthenticationLevel);
procedure SetCISEnabled(const Value: Boolean);
procedure SetDCOMEnabled(const Value: Boolean);
procedure SetDefaultToInternetPorts(const Value: Boolean);
procedure SetDescription(const Value: string);
procedure SetDSPartitionLookupEnabled(const Value: Boolean);
procedure SetImpersonationLevel(const Value: TCOMAdminImpersonationLevel);
procedure SetInternetPortsListed(const Value: Boolean);
procedure SetIsRouter(const Value: Boolean);
procedure SetLoadBalancingCLSID(const Value: string);
procedure SetLocalPartitionLookupEnabled(const Value: Boolean);
procedure SetOperatingSystem(const Value: TCOMAdminOperatingSystem);
procedure SetPartitionsEnabled(const Value: Boolean);
procedure SetPorts(const Value: string);
procedure SetResourcePoolingEnabled(const Value: Boolean);
procedure SetRPCProxyEnabled(const Value: Boolean);
procedure SetSecureReferencesEnabled(const Value: Boolean);
procedure SetSecurityTrackingEnabled(const Value: Boolean);
procedure SetSRPActivateAsActivatorChecks(const Value: Boolean);
procedure SetSRPRunningObjectChecks(const Value: Boolean);
procedure SetTransactionTimeout(const Value: Cardinal);
public
constructor Create(AOwner: TComAdminCatalog; ACatalogCollection: ICatalogCollection); reintroduce;
procedure SyncFromServer(ASourceComputer: TComAdminComputer);
property Owner: TComAdminCatalog read FOwner;
published
property ApplicationProxyRSN: string read FApplicationProxyRSN write SetApplicationProxyRSN;
property CISEnabled: Boolean read FCISEnabled write SetCISEnabled default False;
property DCOMEnabled: Boolean read FDCOMEnabled write SetDCOMEnabled default True;
property DefaultAuthenticationLevel: TCOMAdminAuthenticationLevel read FAuthenticationLevel write SetAuthenticationLevel default COMAdminAuthenticationConnect;
property DefaultImpersonationLevel: TCOMAdminImpersonationLevel read FImpersonationLevel write SetImpersonationLevel default COMAdminImpersonationIdentify;
property DefaultToInternetPorts: Boolean read FDefaultToInternetPorts write SetDefaultToInternetPorts default False;
property Description: string read FDescription write SetDescription;
property DSPartitionLookupEnabled: Boolean read FDSPartitionLookupEnabled write SetDSPartitionLookupEnabled default True;
property InternetPortsListed: Boolean read FInternetPortsListed write SetInternetPortsListed default False;
property IsRouter: Boolean read FIsRouter write SetIsRouter default False;
property LoadBalancingCLSID: string read FLoadBalancingCLSID write SetLoadBalancingCLSID;
property LocalPartitionLookupEnabled: Boolean read FLocalPartitionLookupEnabled write SetLocalPartitionLookupEnabled default True;
property OperatingSystem: TCOMAdminOperatingSystem read FOperatingSystem write SetOperatingSystem default COMAdminOSNotInitialized;
property PartitionsEnabled: Boolean read FPartitionsEnabled write SetPartitionsEnabled default False;
property Ports: string read FPorts write SetPorts;
property ResourcePoolingEnabled: Boolean read FResourcePoolingEnabled write SetResourcePoolingEnabled default True;
property RPCProxyEnabled: Boolean read FRPCProxyEnabled write SetRPCProxyEnabled default False;
property SecureReferencesEnabled: Boolean read FSecureReferencesEnabled write SetSecureReferencesEnabled default False;
property SecurityTrackingEnabled: Boolean read FSecurityTrackingEnabled write SetSecurityTrackingEnabled default True;
property SRPActivateAsActivatorChecks: Boolean read FSRPActivateAsActivatorChecks write SetSRPActivateAsActivatorChecks default True;
property SRPRunningObjectChecks: Boolean read FSRPRunningObjectChecks write SetSRPRunningObjectChecks default True;
property TransactionTimeout: Cardinal read FTransactionTimeout write SetTransactionTimeout default DEFAULT_TRANSACTION_TIMEOUT;
end;
TComAdminApplicationServer = class(TComAdminBaseObject);
TComAdminApplicationCluster = class(TComAdminBaseList);
TComAdminDCOMProtocol = class(TComAdminBaseObject)
strict private
FOrder: Cardinal;
FProtocolCode: TCOMAdminProtocol;
procedure ReadExtendedProperties;
procedure SetOrder(const Value: Cardinal);
procedure SetProtocolCode(const Value: TCOMAdminProtocol);
public
constructor Create(ACollection: TComAdminBaseList; ACatalogObject: ICatalogObject); reintroduce;
published
property Name;
property Order: Cardinal read FOrder write SetOrder default 0;
property ProtocolCode: TCOMAdminProtocol read FProtocolCode write SetProtocolCode;
end;
TComAdminDCOMProtocolList = class(TComAdminBaseList)
strict private
function GetItem(Index: Integer): TComAdminDCOMProtocol;
public
property Items[Index: Integer]: TComAdminDCOMProtocol read GetItem; default;
end;
TComAdminEventClass = class(TComAdminBaseObject)
strict private
FBitness: TCOMAdminComponentType;
FApplication: string;
FProgID: string;
FDescription: string;
FCLSID: string;
FIsPrivateComponent: Boolean;
procedure ReadExtendedProperties;
public
constructor Create(ACollection: TComAdminBaseList; ACatalogObject: ICatalogObject); reintroduce;
published
property Application: string read FApplication;
property Bitness: TCOMAdminComponentType read FBitness;
property CLSID: string read FCLSID;
property Description: string read FDescription;
property IsPrivateComponent: Boolean read FIsPrivateComponent default False;
property Name;
property ProgID: string read FProgID;
end;
TComAdminEventClassList = class(TComAdminBaseList)
strict private
function GetItem(Index: Integer): TComAdminEventClass;
public
property Items[Index: Integer]: TComAdminEventClass read GetItem; default;
end;
TComAdminInprocServer = class(TComAdminBaseObject)
strict private
FCLSID: string;
FInprocServer32: string;
FProgID: string;
procedure ReadExtendedProperties;
public
constructor Create(ACollection: TComAdminBaseList; ACatalogObject: ICatalogObject); reintroduce;
published
property CLSID: string read FCLSID;
property InprocServer32: string read FInprocServer32;
property Name;
property ProdID: string read FProgID;
end;
TComAdminInprocServerList = class(TComAdminBaseList)
strict private
function GetItem(Index: Integer): TComAdminInprocServer;
public
property Items[Index: Integer]: TComAdminInprocServer read GetItem; default;
end;
TComAdminSubscriberProperties = class(TComAdminBaseObject)
strict private
FValue: Variant;
procedure ReadExtendedProperties;
procedure SetValue(AValue: Variant);
public
constructor Create(ACollection: TComAdminBaseList; ACatalogObject: ICatalogObject); reintroduce;
published
property Name;
property Value: Variant read FValue write SetValue;
end;
TComAdminSubscriberPropertiesList = class(TComAdminBaseList)
strict private
function GetItem(Index: Integer): TComAdminSubscriberProperties;
public
property Items[Index: Integer]: TComAdminSubscriberProperties read GetItem; default;
end;
TComAdminTransientSubscription = class(TComAdminBaseObject)
strict private
FDescription: string;
FEnabled: Boolean;
FEventClassPartitionID: string;
FEventCLSID: string;
FFilterCriteria: string;
FID: string;
FInterfaceID: string;
FMethodName: string;
FPerUser: Boolean;
FPublisherID: string;
FSubscriberInterface: Variant;
FSubscriberPartitionID: string;
FUserName: string;
FPublishers: TComAdminSubscriberPropertiesList;
FSubscribers: TComAdminSubscriberPropertiesList;
procedure ReadExtendedProperties;
procedure GetPublishers;
procedure GetSubscribers;
procedure SetDescription(const Value: string);
procedure SetEnabled(const Value: Boolean);
procedure SetEventClassPartitionID(const Value: string);
procedure SetEventCLSID(const Value: string);
procedure SetFilterCriteria(const Value: string);
procedure SetID(const Value: string);
procedure SetInterfaceID(const Value: string);
procedure SetMethodName(const Value: string);
procedure SetPerUser(const Value: Boolean);
procedure SetPublisherID(const Value: string);
procedure SetSubscriberInterface(const Value: Variant);
procedure SetSubscriberPartitionID(const Value: string);
procedure SetUserName(const Value: string);
public
constructor Create(ACollection: TComAdminBaseList; ACatalogObject: ICatalogObject); reintroduce;
destructor Destroy; override;
published
property Description: string read FDescription write SetDescription;
property Enabled: Boolean read FEnabled write SetEnabled;
property EventClassPartitionID: string read FEventClassPartitionID write SetEventClassPartitionID;
property EventCLSID: string read FEventCLSID write SetEventCLSID;
property FilterCriteria: string read FFilterCriteria write SetFilterCriteria;
property ID: string read FID write SetID;
property InterfaceID: string read FInterfaceID write SetInterfaceID;
property MethodName_: string read FMethodName write SetMethodName;
property Name;
property PerUser: Boolean read FPerUser write SetPerUser;
property PublisherID: string read FPublisherID write SetPublisherID;
property SubscriberInterface: Variant read FSubscriberInterface write SetSubscriberInterface;
property SubscriberPartitionID: string read FSubscriberPartitionID write SetSubscriberPartitionID;
property UserName: string read FUserName write SetUserName;
end;
TComAdminTransientSubscriptionList = class(TComAdminBaseList)
strict private
function GetItem(Index: Integer): TComAdminTransientSubscription;
public
property Items[Index: Integer]: TComAdminTransientSubscription read GetItem; default;
end;
// List class to hold passwords for different identities
TPasswordList = class(TList<TPair<string,string>>)
public
destructor Destroy; override;
end;
TComAdminCatalog = class(TObject)
strict private
FApplicationCluster: TComAdminApplicationCluster;
FApplications: TComAdminApplicationList;
FAvailableCollections: TComAdminAvailableCollections;
FCatalog: ICOMAdminCatalog2;
FChangeCount: Integer;
FComputer: TComAdminComputer;
FCopiedLibraries: TList<string>;
FCopyLibraries: Boolean;
FDebug: Boolean;
FEventClasses: TComAdminEventClassList;
FFilter: string;
FInprocServers: TComAdminInprocServerList;
FLibraryPath: string;
FOnDebug: TComAdminDebug;
FOnReadObject: TComAdminReadEvent;
FPasswords: TPasswordList;
FPartitions: TComAdminPartitionList;
FProtocols: TComAdminDCOMProtocolList;
FServer: string;
FTransientSubscriptions: TComAdminTransientSubscriptionList;
procedure GetApplications;
procedure GetEventClasses;
procedure GetInprocServers;
procedure GetPartitions;
procedure GetProtocols;
procedure GetServers;
procedure GetTransientSubscription;
function GetLocalComputerName: string;
procedure SetFilter(const Value: string);
public
constructor Create(const AServer: string; const AFilter: string; AOnReadEvent: TComAdminReadEvent; AOnDebug: TComAdminDebug); reintroduce; overload;
destructor Destroy; override;
procedure AddPasswordForIdentity(const AIdentity, APassword: string);
procedure DebugMessage(const AMessage: string); overload;
procedure DebugMessage(const AMessage: string; AParams: array of const); overload;
procedure ExportApplication(AIndex: Integer; const AFilename: string);
procedure ExportApplicationByKey(const AKey, AFilename: string);
procedure ExportApplicationByName(const AName, AFilename: string);
function GetPasswordForIdentity(const AIdentity: string): string;
function IsLocalComputer: Boolean;
function SyncToServer(const ATargetServer, ACreatorString: string; ASyncComputers: Boolean = False): Integer; overload;
property ApplicationCluster: TComAdminApplicationCluster read FApplicationCluster write FApplicationCluster;
property Applications: TComAdminApplicationList read FApplications;
property Catalog: ICOMAdminCatalog2 read FCatalog;
property ChangeCount: Integer read FChangeCount write FChangeCount;
property Computer: TComAdminComputer read FComputer write FComputer;
property CopiedLibraries: TList<string> read FCopiedLibraries write FCopiedLibraries;
property CopyLibraries: Boolean read FCopyLibraries write FCopyLibraries;
property DCOMProtocols: TComAdminDCOMProtocolList read FProtocols;
property Debug: Boolean read FDebug write FDebug default False;
property EventClasses: TComAdminEventClassList read FEventClasses;
property Filter: string read FFilter write SetFilter;
property LibraryPath: string read FLibraryPath write FLibraryPath;
property OnDebug: TComAdminDebug read FOnDebug write FOnDebug;
property OnReadObject: TComAdminReadEvent read FOnReadObject write FOnReadObject;
property Server: string read FServer;
end;
EExtendedComAdminException = class(Exception)
public
constructor Create(const ErrorCode, MajorRef, MinorRef, Name: string);
end;
EItemNotFoundException = Exception;
EUnknownProtocolException = Exception;
implementation
uses
System.Masks,
System.Variants,
Winapi.Windows, System.Rtti, System.TypInfo, System.IOUtils;
{$I uComAdminConst.inc}
{ EExtendedComAdminException }
constructor EExtendedComAdminException.Create(const ErrorCode, MajorRef, MinorRef, Name: string);
begin
raise Exception.CreateFmt(ERROR_EXTENDED_MESSAGE, [ErrorCode, MajorRef, MinorRef, Name]);
end;
{ TComAdminAvailableCollections }
constructor TComAdminAvailableCollections.Create(ACatalog: ICOMAdminCatalog2);
var
CollectionList: ICatalogCollection;
i: Integer;
begin
inherited Create;
CollectionList := ACatalog.GetCollection(COLLECTION_NAME_RELATED_COLLECTIONS) as ICatalogCollection;
CollectionList.Populate;
for i := 0 to CollectionList.Count - 1 do
Add((CollectionList.Item[i] as ICatalogObject).Name);
end;
constructor TComAdminAvailableCollections.Create(ABaseObject: TComAdminBaseObject);
var
CollectionList: ICatalogCollection;
i: Integer;
begin
inherited Create;
CollectionList := ABaseObject.CatalogCollection.GetCollection(COLLECTION_NAME_RELATED_COLLECTIONS, ABaseObject.Key) as ICatalogCollection;
CollectionList.Populate;
for i := 0 to CollectionList.Count - 1 do
Add((CollectionList.Item[i] as ICatalogObject).Name);
if Assigned(ABaseObject.Collection) then
ABaseObject.Collection.Catalog.OnReadObject(ABaseObject.Level, COLLECTION_NAME_RELATED_COLLECTIONS, ToString);
end;
destructor TComAdminAvailableCollections.Destroy;
begin
Clear;
inherited;
end;
function TComAdminAvailableCollections.ToString: string;
var
i: Integer;
begin
if Count > 0 then
begin
Result := Items[0];
for i := 1 to Count - 1 do
Result := Format('%s, %s', [Result, Items[i]]);
end else
Result := '';
end;
{ TComAdminBaseObject }
constructor TComAdminBaseObject.Create(ACollection: TComAdminBaseList; ACatalogObject: ICatalogObject);
begin
inherited Create;
FCollection := ACollection;
FCatalogObject := ACatalogObject;
FKey := FCatalogObject.Key;
FName := FCatalogObject.Name;
if Assigned(ACollection) then
begin
FLevel := GetLevel;
FCatalogCollection := ACollection.CatalogCollection;
if Assigned(ACollection.Catalog.OnReadObject) then
ACollection.Catalog.OnReadObject(FLevel, ACollection.Name, ACatalogObject.Name);
FAvailableCollections := TComAdminAvailableCollections.Create(Self);
end;
end;
destructor TComAdminBaseObject.Destroy;
begin
if Assigned(FAvailableCollections) then
FAvailableCollections.Free;
inherited;
end;
function TComAdminBaseObject.GetLevel: Integer;
begin
if Assigned(FCollection.Owner) then
begin
Result := 1;
if Assigned(FCollection.Owner.Collection.Owner) then
begin
Result := 2;
if Assigned(FCollection.Owner.Collection.Owner.Collection.Owner) then
begin
Result := 3;
if Assigned(FCollection.Owner.Collection.Owner.Collection.Owner.Collection.Owner) then
begin