COM programming course trainsec

COM Programming 1: Windows COM Course in C++

Learn how Windows COM really works by building it yourself in C++. Pavel Yosifovich, co-author of Windows Internals, takes you from plain C++ classes to interfaces, IUnknown, class factories, activation and registration, then to IDL, type libraries and ATL, with hands-on labs including a client for the Windows BITS service.

58 Lessons
Lifetime access
$390
or $99 x 4 installments
blue depth
Windows master developer badge 1

This course is part of Windows Master Developer

$1,478 or $150 X 10 installments
Trusted by 10K+ students and companies
Sentinel one logo white
microsoft logo white
google logo white
mandiant logo white
intel logo white
cisco white logo tr
citibank logo white
alfa bank logo white
malwarebytes logo white
proofpoint logo white
epam logo white
Sentinel one logo white
microsoft logo white
google logo white
mandiant logo white
intel logo white
cisco white logo tr
citibank logo white
alfa bank logo white
malwarebytes logo white
proofpoint logo white
epam logo white

14+ hours

on-demand video

Labs

with full solution walkthroughs

55

video lessons

3

downloadable resources

12 CPE

CEU credits, self-reported

Certification

Certificate of completion

COM Programming: understand Windows components from the inside

The Component Object Model is everywhere in Windows. The shell, DirectX, the Background Intelligent Transfer Service, Windows Management Instrumentation and the Windows Runtime are all built on COM, and countless enterprise applications still ship COM components. Yet most developers only ever call CoCreateInstance and hope for the best. When registration fails, a reference leaks or a call deadlocks, they have no model of what is happening underneath.

In this course Pavel Yosifovich, co-author of Windows Internals, builds that model from first principles. You start with a plain C++ class in a DLL and fix its problems one by one until you arrive at COM: abstract interfaces, vtables, factories, runtime interface discovery and reference counting. Then you implement a complete in-process COM server by hand, with its class factory, DLL exports and registration, and write clients for it in C++ and C#. The second half covers callbacks with the Windows BITS service, interface definitions in IDL and type libraries, and building components with ATL, including smart pointers, non-creatable classes, singletons, containment and aggregation.

The course is a recording of a live class: 55 video lessons, with the slides, a lab manual and the lab sources. You build several COM servers and clients along the way, from a bank account server to an RPN calculator and a process manager. The course covers the first four modules of the COM curriculum; automation, out-of-process servers and apartments continue in COM Programming 2. Every video has English captions, and you learn at your own pace with lifetime access.

Pavel Yosifovich
Pavel Yosifovich
Developer, trainer, author and (sometimes) speaker. Co-founder of TrainSec academy.

Pavel has been building Windows software in C and C++ for more than 25 years, as a developer, consultant, trainer, author and speaker, and is a Microsoft MVP. He is the co-author of “Windows Internals, 7th Edition, Part 1” (Microsoft Press) and the author of “Windows Kernel Programming”, “Windows 10 System Programming” and “Windows Native API Programming”.

His work on Windows internals and system programming shapes how he teaches COM: not as a set of APIs to memorize, but as a design you build yourself, so you understand exactly how activation, registration and interfaces work.

What you will learn in the COM Programming 1 course

Who is this COM programming course for?

  • C++ developers on Windows who call COM-based APIs (shell, BITS, DirectX, WinRT) and want to understand what really happens underneath.
  • Developers who need to write their own in-process COM components, by hand or with ATL.
  • Engineers maintaining legacy COM or ATL code who want a solid grasp of registration, class factories and reference counting.
  • Developers who need native COM components to work with .NET (C#) clients.
  • Security researchers who want to understand COM activation and per-user registration from the developer side.

Not the right fit if you are new to C++ (take Modern C++ Programming first) or to the Windows API (start with Windows System Programming 1). Automation (IDispatch), out-of-process EXE servers and apartments are covered in COM Programming 2.

Roles this course prepares you for: Windows developers, security researchers and malware analysts.

What do you need before you start?

  • Solid C++: classes, inheritance, virtual functions and pointers. COM is built directly on C++ vtables.
  • Experience with the Windows API in C or C++, as stated in the course introduction.
  • Basic experience building and using DLLs in Visual Studio, and familiarity with the Windows registry.
  • No prior COM knowledge is needed.
  • Some C# is helpful but optional: a few demos use a .NET client.
  • A Windows 10 or 11 PC with Visual Studio 2022 and its C++ workload, including ATL. On a Mac, you can use Windows on ARM in Parallels.

What does the COM Programming 1 course cover?

COM is one of those technologies that every serious Windows developer meets sooner or later, whether calling shell and DirectX APIs, maintaining a legacy component, exposing native code to .NET, or researching how Windows activates objects. This course gives you a complete, working understanding of COM in C++, from the binary standard up to ATL.

Most chapters combine slides, live coding and debugging, and the labs are followed by full solution walkthroughs. This course covers the first four modules of the live class. Automation with IDispatch, out-of-process EXE servers, marshaling and COM threading and apartments continue in COM Programming 2.

Why learn COM?

COM is not legacy trivia. It is the foundation of large parts of Windows, including the shell, DirectX, BITS, WMI and the Windows Runtime, and many Windows APIs are only available through COM interfaces. Understanding COM lets you use those APIs confidently, write and maintain components that other languages can call, and diagnose the registration, lifetime and threading problems that otherwise feel like magic.

Build COM servers by hand, then with ATL

The course does not start with wizards. You first build a COM server from scratch, so you see every piece: the interface, the class, the class factory, DllGetClassObject and registration, stepped through in the debugger. Only then do you move to ATL, and you understand what the generated code does for you. The same template-based style continues in GUI Programming with WTL, and both COM courses are part of the Windows Master Developer learning path.

What does each chapter of the course cover?

Course Introduction

Meet the course and its instructor: the goals, the prerequisites, the module plan and recommended books and resources. The slides, the lab manual and the lab sources are available here. This course covers modules 1 to 4 of the live class; modules 5 to 7 are covered in COM Programming 2.

From C++ to COM

Why COM exists, shown step by step. Starting from a C++ class exported from a DLL, the chapter fixes its problems one at a time: immutable abstract interfaces, vtables, factory functions, extending interfaces, discovering interfaces at runtime and reference counting. It ends with the idea that COM is a language-neutral binary standard built on exactly these mechanisms.

COM Fundamentals

The ideas from the first chapter mapped onto real COM. You learn where COM came from, what a COM object is, the IUnknown interface with QueryInterface, AddRef and Release, the calling convention, GUIDs and HRESULTs, and the rules for QueryInterface, object identity and reference counting.

Implementing COM Component DLL

Your first COM component, built from scratch without ATL. You define an IAccount interface and its IID, implement the class and IUnknown, add a class factory, and write a client that creates the object with CoGetClassObject and CoCreateInstance. The chapter ends with a “class not registered” error, which sets up the next chapter.

Activation (Creation)

How COM creates objects. The chapter explains the two-step creation model, the class factory and CoCreateInstance as the shortcut, and how an in-process server is activated: the registry lookup, InprocServer32 and DllGetClassObject, stepped through in the debugger. It also builds a C# client using COM interop and covers the 64-bit, threading and vtable-order pitfalls.

COM DLL Exports

The functions every COM DLL exports: DllGetClassObject, DllRegisterServer, DllUnregisterServer, DllCanUnloadNow and DllInstall. You implement self-registration with regsvr32, learn how HKEY_CLASSES_ROOT merges machine and per-user registrations and what that means for admin rights, and handle 32-bit versus 64-bit registration. It ends with a recap of all the steps to build a server.

Labs (BITS and RPN Calculator)

Two hands-on labs. The first is a COM client for the Windows Background Intelligent Transfer Service: create a download job, add a file, start it, poll its state and handle errors. The second builds a complete COM server from scratch, an RPN calculator, with its interface, class, class factory, DLL exports and registration, plus a client.

Debugging and Extending

Finishing the hand-built servers. You debug registration with regsvr32, fix per-user registry placement, and compare per-user and per-machine registration. Then you extend a class with a second interface through QueryInterface, and use __uuidof and declspec(uuid) as a cleaner way to work with GUIDs.

Callbacks

COM callbacks with a real Windows service. You implement IBackgroundCopyCallback so BITS notifies your client when a transfer completes, fails or changes, instead of polling. Along the way you build a local object without a class factory, free COM-allocated memory correctly, and debug a deadlock caused by the apartment model.

Introduction to IDL

Defining interfaces the COM way. You learn why C++ headers are not enough, the RPC heritage of IDL, its attributes and types, and what the MIDL compiler generates: the header, the GUID file, proxy and stub sources and the type library. The chapter also covers properties and inspecting type libraries with OleView.

ATL COM Components

Building COM servers with the Active Template Library. You create a full in-process server with the ATL wizards and walk through what they generate: the IDL, the module object, the registration script and the COM map. Then you add methods and a second interface, write a C++ client, and summarize the ATL workflow.

Advanced ATL and COM

ATL and COM in depth. The chapter inspects servers with the OLE/COM Object Viewer, explains the ATL class hierarchy, and covers COM smart pointers with ATL and WIL and the #import directive. You build a NumberStack server with a .NET client, a process manager with non-creatable classes created through a root object, and learn singleton class factories and COM reuse through containment and aggregation.

COM programming course: frequently asked questions

Do I need to know COM already?

No. The course starts from plain C++ classes in a DLL and builds up to COM step by step, then shows the real COM mechanisms.

What do I need to know before taking the course?

Solid C++ (classes, inheritance, virtual functions and pointers) and some experience with the Windows API. If you need to strengthen those first, take Modern C++ Programming and Windows System Programming 1.

What software do I need?

A Windows 10 or 11 PC with Visual Studio 2022 and its C++ workload, including ATL. The course also uses regsvr32, Registry Editor and OleView, and a few demos use a C# client and the WIL library from NuGet.

Is the course hands-on?

Yes. You build a COM server by hand, register it, write C++ and C# clients, use the Windows BITS service as a real COM API, and complete labs such as an RPN calculator server, a NumberStack server with ATL and a process manager with non-creatable classes.

Does it cover ATL?

Yes. Two chapters cover ATL: the wizards, the generated IDL, registration scripts, COM maps, the ATL class hierarchy, smart pointers, singletons, non-creatable classes and aggregation.

Does it cover IDispatch, EXE servers or apartments?

Not in depth. Automation with IDispatch, out-of-process EXE servers, marshaling, and COM threading and apartments are covered in COM Programming 2. Apartments come up briefly in the BITS callback lab.

How is this different from the COM module in Windows System Programming 3?

Windows System Programming 3 has a single introductory COM module. COM Programming 1 is a full course that implements servers from scratch, covers registration, IDL, ATL and smart pointers in depth, and includes several labs.

Is the course live or recorded?

Recorded and self-paced. It is a recording of a live class, so you will occasionally hear student questions. You get lifetime access, and every video has English captions.

What should I take after this course?

COM Programming 2, which covers automation, EXE servers and marshaling, and COM threading and apartments. Both courses are part of the Windows Master Developer learning path.

Do I get a certificate?

Yes. When you complete every lesson you receive a certificate of completion and a Credly digital badge. The course also earns 12 CPE/CEU credits, which you self-report to your certification body using your certificate.

Can I watch some lessons before I buy?

Yes. Three lessons are free to preview: Introduction, Why COM and IUnknown. Watch them on the course page.

How long is the course?

55 video lessons, more than 14 hours of video, plus the slides, the labs PDF and the code.

How much does it cost, and is there a payment plan?

$390 as a single payment, or 4 monthly payments of $99 ($396 in total). It is also included in the Windows Master Developer learning path.

How long do I have access?

Lifetime access, including future updates. Videos stream in the browser and cannot be downloaded.

Can I get a refund?

Yes. Refunds are available up to 14 days after purchase, to the original payment method. Email [email protected].

Pavel Yosifovich
Pavel Yosifovich
Developer, trainer, author and (sometimes) speaker. Co-founder of TrainSec academy.

Pavel has been building Windows software in C and C++ for more than 25 years, as a developer, consultant, trainer, author and speaker, and is a Microsoft MVP. He is the co-author of “Windows Internals, 7th Edition, Part 1” (Microsoft Press) and the author of “Windows Kernel Programming”, “Windows 10 System Programming” and “Windows Native API Programming”.

His work on Windows internals and system programming shapes how he teaches COM: not as a set of APIs to memorize, but as a design you build yourself, so you understand exactly how activation, registration and interfaces work.

COM programming course trainsec
COM Programming 1

Learn how Windows COM really works by building it yourself in C++. Pavel Yosifovich, co-author of Windows Internals, takes you from plain C++ classes to interfaces, IUnknown, class factories, activation and registration, then to IDL, type libraries and ATL, with hands-on labs including a client for the Windows BITS service.