• Tidak ada hasil yang ditemukan

Directory UMM :Networking Manual:computer_network_books:

N/A
N/A
Protected

Academic year: 2017

Membagikan "Directory UMM :Networking Manual:computer_network_books:"

Copied!
47
0
0

Teks penuh

(1)

COM

A Slideshow of Epic Proportions

Sean Baxter

(2)

What is COM?

• A standard for interoperable software

• A runtime library providing low-level or hard-to-implement functionality

• A competitive, capitalist marketplace for selling functionality to application

developers

(3)

That Last Slide Was Pulled From Booboo’s

Rear End. What is COM, Really?

• A sacred covenant held by the world’s best developers. All software functionality is

encapsulated through a COM class (coclass) and exposed through COM interfaces

Blah Blah Blah Blah Blah Blah Blah Blah Blah

Booboo

(4)

Interface and Coclass Fundamentals

• An interface is a group of methods

• A coclass is a group of interfaces

• All coclasses implement the IUnknown

interface

• All other interfaces derive IUnknown

• Lollipop diagrams describe coclasses

I U n k n o w n

O i n k

(5)

About Interfaces

• The client communicates with the server through interface pointers (think base class pointers)

• Methods implemented by the coclass are invoked through interface pointers

• Interface pointers are acquired through IUnknown

• Because all interfaces derive IUnknown, any interface pointer on an object can be acquired through any other interface pointer on the object • The method to acquire an interface pointer is

(6)

More About Interfaces

• Interfaces are equivalent to C++ abstract base classes

• Because there is no standard thunk mechanism, interfaces do not support multiple inheritance

• Two IUnknown pointers point to the same

object if their values are equal

• “Dispatch interfaces” are special case interfaces allowed by the COM

(7)

Interfaces and Virtual Tables

• An interface pointer points to the

corresponding slice of a COM object

• The first 4 bytes of this slice comprise a pointer to the interface’s virtual table

• Each slot in this virtual table is the address of an interface method

• A method implementation may be

(8)

p A d d R e f p R e l e a s e p F o o F u n c 1 p F o o F u n c 2 p F o o F u n c 3 p Q u e r y I n t e r f a c e

p A d d R e f p R e l e a s e p B a r F u n c 1 p B a r F u n c 2 p B a r F u n c 3 p Q u e r y I n t e r f a c e

p A d d R e f p R e l e a s e p Q u e r y I n t e r f a c e

I U n k n o w n

O i n k

I F o o I B a r

m _ p U n k V t b l m _ p F o o V t b l m _ p B a r V t b l

Q u e r y I n t e r f a c e ( ) A d d R e f ( ) R e l e a s e ( )

F o o F u n c 1 ( ) F o o F u n c 2 ( ) F o o F u n c 3 ( )

B a r F u n c 1 ( ) B a r F u n c 2 ( ) B a r F u n c 3 ( )

(9)

Reference Counting

• To regulate destruction of objects, COM requires that all coclasses implement a reference counter

• COM objects can have their methods

invoked from other threads, processes, and even machines. Reference Counting

(10)

Reference Counting Rules

• Each object is given a reference count of 1 upon instantiation

IUnknown::AddRef increments the reference

count

• A successful IUnknown::QueryInterface call

increments the reference count

IUnknown::Release decrements the reference

count

(11)

So Why All These Interface and

Reference Counting Formalities?

• One of the most amazing features of COM objects is location transparency: COM marshals interfaces between processes and remote computers

• Reference counting guarantees that a client cannot prematurely destroy a shared object

(12)

Speaking of Location Transparency...

• COM objects (servers) can be delivered in two module types: EXEs or DLLs (aka

OCXs)

• EXEs cannot run in-process • DLLs can only run in-process

(13)

An In-process Server

(same apartment)

I U n k n o w n

F o o

I F o o

p A d d R e f p R e l e a s e p S h a k e

p R a t t l e p R o l l p Q u e r y I n t e r f a c e

p A d d R e f p R e l e a s e p Q u e r y I n t e r f a c e

m _ p U n k V t b l

m _ p F o o V t b l

Q u e r y I n t e r f a c e ( )

A d d R e f ( )

R e le a s e ( )

S h a k e ( )

R a t t l e ( )

(14)

In-process Server

(different apartment)

S T A

C O M I n v i s i b l e W i n d o w

I U n k n o w n

O i n k _ S t u b

I F o o

I B a r I U n k n o w n

O i n k

I F o o I B a r I U n k n o w n

O i n k _ P r o x y

I F o o I B a r

C l i e n t C o d e

(15)

Local Server

I U n k n o w n

F o o _ P r o x y

I F o o

p A d d R e f _ P r o x y p R e l e a s e _ P r o x y p S h a k e _ P r o x y

p R a t t l e _ P r o x y p R o l l _ P r o x y p Q u e r y I n t e r f a c e _ P r o x y

p A d d R e f _ P r o x y p R e l e a s e _ P r o x y p Q u e r y I n t e r f a c e _ P r o x y

m _ p U n k V t b l m _ p F o o V t b l

Q u e r y I n t e r f a c e _ P r o x y ( ) A d d R e f _ P r o x y ( ) R e l e a s e _ P r o x y ( )

S h a k e _ P r o x y ( ) R a t t l e _ P r o x y ( ) R o l l _ P r o x y ( )

Q u e r y I n t e r f a c e _ S t u b ( )

S h a k e _ S t u b ( ) R a t t l e _ S t u b ( ) R o l l _ S t u b ( ) P r o c e s s

B o u n d a r y

I F o o

I U n k n o w n

F o o

m _ p U n k V t b l m _ p F o o V t b l

(16)

Remote Server

I U n k n o w n

F o o _ P r o x y

I F o o

p A d d R e f _ P r o x y p R e l e a s e _ P r o x y

p S h a k e _ P r o x y p R a t t l e _ P r o x y p R o l l _ P r o x y p Q u e r y I n t e r f a c e _ P r o x y

p A d d R e f _ P r o x y p R e l e a s e _ P r o x y p Q u e r y I n t e r f a c e _ P r o x y

m _ p U n k V t b l m _ p F o o V t b l

Q u e r y I n t e r f a c e _ P r o x y ( ) A d d R e f _ P r o x y ( ) R e l e a s e _ P r o x y ( )

S h a k e _ P r o x y ( ) R a t t l e _ P r o x y ( ) R o l l _ P r o x y ( )

Q u e r y I n t e r f a c e _ S t u b ( )

S h a k e _ S t u b ( ) R a t t l e _ S t u b ( ) R o l l _ S t u b ( )

I F o o

I U n k n o w n

F o o

m _ p U n k V t b l m _ p F o o V t b l

C l i e n t M a c h i n e

S e r v e r M a c h i n e

(17)

Things To Note

• All interface method calls are synchronous; a

remote call to a New York server must complete its round-trip before the client can continue execution • Asynchronous services are available through

Microsoft Message Queue (MSMQ) and ICallFactory (Windows 2000)

• Encryption, authentication, and impersonation services are available with remote server

(18)

Confused?

Where Am I?

(19)

COM Owns You

So what does all this nonsense about location transparency and reference counting have to do with anything?

(20)

WRONG!

They

are

COM.

(21)

MS

Marketecture

:

Common Misperceptions

• OLE is a system of linking and embedding data into a document (hence the acronym “Object Link and Embedding”)

• ActiveX, like Java, is a system for building web page applets

• Microsoft Transaction Server (MTS) processes business data from the internet

(22)

The Journey of COM

• Dynamic Data Exchange (DDE) was introduced while the Earth was still cooling.

• DDE was unsavory. MS unveils OLE 1.0 after the villagers riot

• OLE 1.0 is a big success but hard to program. MS unveils OLE 2.0 for Windows 3.1: COM is born (it’s 16bit)

(23)

The Journey of COM (II)

• To celebrate Windows 95, MS blesses COM with the apartment model

• 1996 sees Windows NT 4. DCOM brings network and multithreading enhancements to COM

• Microsoft Transaction Server (MTS) becomes

available for NT Server. This doesn’t process web business data. It’s a COM runtime environment which allows components to run more efficiently (solving scalability difficulties often faced in

(24)

The Journey of COM (III)

• OLE-DB provides consistency when accessing data from a variety of providers

• MS makes web browsers a priority (IE3) and

simultaneously coins the term “ActiveX,” adding to the COM marketecture. Like OLE, ActiveX is a

synonym for COM.

• Microsoft Message Queue (MSMQ) delivers

asynchronous (and vastly more reliable) method calls • Visual C++ 5.0 ships with ATL 2.1. OLE Control

(25)

The Journey of COM (IV)

• Windows 2000 ships in 2004. Microsoft introduces COM+ acronym: COM+ is simply COM on Win2k • Win2k includes many COM updates including a

third threading model (the Neutral Threaded

Apartment) and integration of MTS into the COM runtimes

• COM+ 2.0 delivers legendary COM virtual machine

• Windows NT 6 device contexts replaced by DirectDraw surfaces. Classic OLE Control

(26)

COMprehension

• COM is a set of many, many technologies. • COM is really Microsoft’s software

engineering strategy

• Computer people (you) are betting the bank on Microsoft

(27)

COM Defined

A single sentence can’t define COM,

because COM is such a monumental and omnipresent set of technologies.

So what is a COM technology? Any

(28)

COM in Everyday Life

The Month View is from the Microsoft Windows Common

(29)

Property Pages

(30)

Events

(31)
(32)
(33)
(34)
(35)
(36)
(37)

Standard Interfaces

• Programming sucks. Best to fall back on platform-provided functionality

• A container/client can interact with any

server/control simply by implementing the required site interfaces

• Application developers who license your components are already familiar with the interfaces

(38)

What Are Some COM-Based

Technologies?

• OLE Controls • OLE-DB

• ADO • DAO • DirectX • TAPI 3.0

• Exchange Server • Exchange Client • Active Scripting

• CDO 2.0 • MAPI

• SQL-DMO • SQL-NS

• Microsoft Repository • Broadcast Architecture • Still Image API

(39)

Still More COM Technologies!

• Active Desktop • IIS

• Microsoft Agent

• Microsoft Java SDK • NetMeeting

• NetShow

• Microsoft Wallet • Active Directory

• Active Accessibility • Clustering Service

• Fax Services • MSMQ

• RAS

• Synchronization Manager • Structured Storage

• MTS • MMC

(40)

The Glory of COM

• COM eliminates thread synchronization and IPC/RPC confusion

• COM enables real polymorphism: language

transparency and location transparency • COM mandates a consistency among

component interfaces to reduce learning curves • COM allows versionless updates

(41)

DLL Server Mechanisms

DllRegisterServer and DllUnregisterServer manipulate the registry

DllCanUnloadNow tells COM when the module is not being used

DllGetClassObject provides the client with the class factory of the required COM

(42)

EXE Server Mechanisms

• A /RegServer argument registers the EXE • A /UnregServer argument un-registers the

EXE

CoRegisterClassObject registers a class factory for clients to connect to

(43)

COM Object Instantiation

CoGetClassObject (wrapped by

CoCreateInstance and CoCreateInstanceEx) launches a module and retrieves its class

factory

CoGetClassObjectFromURL downloads a module from an URL, decompresses it,

registers it, and invokes CoGetClassObject on it

(44)

COM Security

CoInitializeSecurity sets the authentication requirements for the current process

• The COSERVERINFO structure specifies the machine name and authentication info for

clients connecting to remote objects

(45)

Books of COMpetency

• The C++ Programming Language (Bjarne Stroustrup)

• Programming Windows (Charles Petzold) • Advanced Windows (Jeffrey Richter)

• Design Patterns (Gamma, Helm, Johnson, Vlissides)

(46)

Hoorah For Reading!

• Effective COM (Box, Brown, Ewald, Sells) • Inside OLE (Kraig Brockschmidt)

• Professional ATL COM Programming (Richard Grimes)

• Microsoft Systems Journal (www.microsoft.com/msj)

(47)

May the COM Be With You

Referensi

Dokumen terkait

Said Sukanto Tahun 2017, melalui layanan pengadaan secara elektronik (LPSE) Polri telah melaksanakan rapat pemberian penjelasan (aanwijzing) Dokumen Pengadaan Alkes

Jika dibandingkan dengan metode vogel konvensional yaitu North West Corner Metode (NWCM), Least Cost (LCM) dan Vogel Approximation Method (VAM), metodologi baru

2011, telah melaksanakan rapat Evaluasi Penawaran terhadap 5 (lima) Perusahaan yang upload/memasukkan penawaran untuk paket lelang pekerjaan tersebut di atas, dan

Dimana pada praktiknya di lapangan nanti, kegiatan yang akan kami suguhkan adalah program program ini diharapkan mampu membangun mental siswa SMA

DINA ARSYI FAZRIN : Akuisisi N, P, K dan Produksi Kelapa sawit Menghasilkan melalui Peningkatan Keanekaragaman Tanaman Sela.. Dibimbing oleh CHAIRANI HANUM

Skripsi dengan judul “ Pengaruh Kompensasi Eksekutif, Sales Growth, Financial Distress , dan Kompensasi Rugi Fiskal Terhadap Tax Avoidance dengan Komisaris Independen

Setelah disetujui kemudian instrumen tersebut diujicobakan, dimana responden uji coba pada penelitian ini adalah Warga RW 010 RT 008 Jati Cempaka, Pondok Gede sebanyak 30

Usulan pengabdian masyarakat harus sudah diterima LPPM Universitas 'Aisyiyah Yogyakarta sesuai dengan jadwal dan waktu yang telah ditentukan.. JANGKA WAKTU PENGABDIAN