Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
Learning DCOM
SPECIAL OFFER: Upgrade this ebook with O’Reilly
A Note Regarding Supplemental Files
Preface
Scope of This Book
Some Assumptions About the Reader
Accompanying Source Code
FTP
FTPMAIL
Conventions
Related Sources of Information
Specifications and References
The Classics
Knowledge Base Articles
Technical Articles
Other Related Documentation
Acknowledgments
1. Distributed Computing
Dumb Terminals
Client/Server Computing
Distributed Computing Using RPC
Distributed Objects
Distributed Components
2. Distributed COM Overview
COM
The Object-Oriented Model
Encapsulation
Inheritance
Polymorphism
The Client/Server Model
Distributed COM
COM Facilities and Services
Location Transparency
Dynamic and Remote Object Activation
Security
Interfaces
Lifetime Support and Dynamic Discovery
Binary Interoperability
Connection Management
Concurrency Management
Reuse
Interface Repository
Implementation Repository
Static Invocation
Dynamic Invocation
Events
Applying COM
3. Objects
Interfaces
IUnknown
Microsoft Interface Definition Language
MIDL basics
Defining a custom interface using MIDL
Examining the attributes of IUnknown
Arrays and strings as interface method parameters
Custom types as interface method parameters
Adding more custom interfaces
Defining a type library
Published interfaces must never change
Return Values
HRESULT
Custom HRESULTs
Data Types
Base data types
Automation compatible types
Interface Marshalers: Proxy and Stub
The Binary Layout
Dispatch and Dual Interfaces
An Interface Recap
Objects
Implementing Interfaces
IUnknown Rules
Identity rules
Existence rules
Implementing COM Objects
COM object definition using the nested classes technique
COM object definition using the multiple inheritance technique
Implementing IUnknown methods
Implementing other interface methods
Class Factories
Standard Factories
Custom Factories
4. Components
Servers
Server Types
Out-of-process servers
In-process servers
Initialization and Termination
Out-of-process servers
In-process servers
Dynamic Activation Support
Out-of-process servers
In-process servers
Component Lifetime
Out-of-process servers
In-process servers
Implementation Registration
Out-of-process servers
In-process servers
Registering interface marshalers
Clients
Initialization and Termination
Creating an Object
CoCreateInstance
CoCreateInstanceEx
CoGetClassObject
Class monikers
Initializing an Object
Using an Object
Deleting an Object
In- and Out-of-Process Issues
Object Orientation
Encapsulation
Polymorphism
Reuse
Containment
Aggregation
Using objects that support aggregation
Developing objects that support aggregation
5. Infrastructure
Memory
Simple Data Types and Top-Level Pointers
Secondary and Embedded Pointers
COM API functions for distributed memory management
Managing embedded pointers
Character Pointers
Automation Data Types
Memory management for a BSTR
Memory management for a SAFEARRAY
Transparency
Structure of a Marshaled Interface Reference
Activation
Standard Marshaling
More on activation
Remote invocation
Custom Marshaling
The object’s responsibility
The custom proxy’s responsibility
Handler Marshaling
Automation Marshaling
Remote Connection Management
Concurrency
Single-Threaded Apartment
Basic requirements
Synchronization
Other issues
Sharing Interface Pointers Among Apartments
Multithreaded Apartment
Basic requirements
Synchronization
Other issues
Out-of-Process Server Considerations
In-Process Server Considerations
ThreadingModel=“” (default)
ThreadingModel=“Apartment”
ThreadingModel=“Free”
ThreadingModel=“Both”
Free-Threaded Marshaler
Performance
Security
Configurable Security
Machine-wide security
Application-wide security
Application identity
Programmable Security
General application-wide security on both the client and server side
Access security on the server side
Activation security on the client side
Call-level security on the client side
Using the security context on the server side
6. Building Components with ATL
Creating a Component
Adding an Object
The Generated Code
Generated Interface
Generated Implementation
Common Responsibilities
Implementing Interface Methods
Adding a Custom Interface
Adding Another Dual Interface
Finishing Up
7. Using COM Objects
Simple Client
Initializing and Uninitializing COM
Creating the User Interface
The COleDispatchDriver Technique
Creating an Interface Wrapper Class
The COleDispatchDriver Class
Using COM Interfaces with Generated Wrappers
The #import Technique
The #import Statement
Using COM Interfaces with Smart Pointers
Native C++ Compiler Features
More on smart pointers
Exception handling
The Manual Technique
Remote Activation API Functions
Using COM Interfaces Manually
The Reusable echnique
The RemotePtr Class
Using the RemotePtr Class
Review
8. COM in Cyberspace
ATL ActiveX Controls
Creating the Project
Adding an ActiveX Control
Merging the Proxy/Stub Code
Adding Properties
Adding Methods
Step 1: Merging the proxy/stub code for external (remote) interfaces
Step 2: Reusing the RemotePtr class
Step 3: Coding the OcrImage method
Web-Enabled Clients
Control Buttons
Server Name and Image Location
Wang Image Edit ActiveX Control
OCR Results
ATLCyberOcr ActiveX Control
Complete HTML and VBScript Source Code
Problems with COM over the Internet
Problems with security
Problems with firewalls or proxy servers
MFC Composites
Creating an MFC ActiveX Control Project
Understanding the generated code
Creating the user interface
Using an ActiveX control within an ActiveX control
Implementing the ActiveX Control: CMFCCyberServerCtrl
CMFCCyberServerCtrl::OnCreate
CMFCCyberServerCtrl::OnDraw
Implementing CImagingWindow
CImagingWindow::OnCreate
CImagingWindow::OnSize
Handling command messages
ATL Composites
Creating the Project
Adding a Composite Control
Creating the User Interface
Putting common controls onto the composite
Putting ActiveX controls onto the composite
Testing the user interface
Implementation
Importing the embedded ActiveX control
Adding command handlers in ATL
Testing the final product
ActiveX Control Properties
Playing with Property Pages
Step 1: Creating the application
Step 2: Adding the two views
Step 3: Adding a splitter window
Step 4: Putting the two ActiveX controls on their appropriate views
Step 5: Showing the property pages
Adding a Property to CMFCCyberServerCtrl
9. Applying Security
Server-Side COM Security
Creating the Project and a COM Object
Implementing the SecureOcrImage Method
Validating the Invocation
Access Token
Constructor and Destructor
Getting the Access Token
Getting User Information
Getting Group Information
Audit Trail
Creating Message Files
Creating a message file for your component
Compiling a message file
Updating the Registry with Event Source Information
Logging Messages
Administrative Alert
Administrative Alert Setup
Generating an Administrative Alert
Client-Side Security
Setting the Authentication Identity
Setting the Process-Wide Security
Merging Proxy/Stub Code into a Client EXE Component
Using Activation Security
Using Call Security
Handling Errors
Testing and Understanding COM Security
Test Scenario I—Observing call-level security and logged events
Test Scenario II—Observing administrative alerts
Test Scenario III—Observing activation security
10. Connecting Objects
Object Reference
Referrers
Creating the ChatBroker Component
Adding a Broker COM Object
The IRegisterChatServer interface
The IDiscussions interface
Caching a List of Discussions
CChatDiscussionList::AddDiscussion
CChatDiscussionList::RemoveDiscussion
CChatDiscussionList::GetDiscussionList
CChatDiscussionList::GetChatServer
CChatDiscussionList::GetSize
ChatBroker’s special condition for component lifetime management
Implementing the Interface Methods
Merging Proxy/Stub Code into a Server EXE Component
Connection Points
Event Sources
Creating an Event Source Object
Adding a Connection Point
Step 1: Define a callback interface using MIDL
Step 2: Implement a connection point object
Step 3: Add a connection point to the event source object
Receiving and Disseminating a Chat Message
The Responsibility of the ChatServer Application
Handling of command-line options
Registering interface marshalers
Opening and closing the discussion
Running the ChatServer
Event Sinks
Creating the ChatClient Project
Creating the user interface and adding command handlers
Merging proxy/stub code into a project without an IDL File
Connecting to and Disconnecting from a ChatBroker
Joining and Leaving a Chat Discussion
Sending a Chat Message
Receiving Chat Messages
Performance Impact of Connection Points
Security Impact of the OBJREF
A. Debugging Techniques
Using the FormatMessage Function
Using the _com_error Class
Breaking into the Server
B. Performance
Performance Results for ThreadingModel=“”
Performance Results for ThreadingModel=“Apartment”
Performance Results for ThreadingModel=“Free”
Performance Results for ThreadingModel=“Both”
C. New COM Features and COM+
Endpoint Configuration
Nonblocking Calls
COM+
Runtime that Simplifies Component Development and Usage
Hide nonbusiness logic complexities
Simplify component development and usage
Services that Support Large-Scale Enterprise Needs
D. Hello, Universe!
Client/Server Protocol = COM Interface
Client Component
Server Component
The main( ) routine
The Class Factory
The COM Object
Comforting Words
Index
Colophon
SPECIAL OFFER: Upgrade this ebook with O’Reilly
← Prev
Back
Next →
← Prev
Back
Next →