Registry classes
Classes in the Windows Registry enable the organization and management of file type associations and other related settings. Each file type association in the registry is represented by a class that defines the association's properties and behaviors. Classes can be used to define other system objects such as ActiveX controls, fonts, and COM objects in addition to file type associations.
The registry's classes are organized in a hierarchical structure that starts with the root key, HKEY CLASSES ROOT. Subkeys in this key represent file extensions, COM objects, and other objects that can be associated with classes. Each HKEY CLASSES ROOT subkey represents a specific class and contains values that define the class's properties and behaviors.
The class defines which application should be used to open files with a specific extension, as well as any command-line arguments or other settings required to open and handle the file properly. Other behaviors defined by the class include whether the application should open the file in a new window or in an existing instance of the application.
Classes can be modified manually with the Registry Editor or other registry editing tools, or automatically with tools like Group Policy. IT professionals may need to modify classes to ensure that files are correctly opened and handled on their systems, or to prevent specific applications from opening specific file types.
Before we have a look on how to manipulate the file extensions that VLC offers support for, let us first understand what types of registry can be found on machines:
- COM
- Interfaces
- Type Libraries
- File Type Associations (FTA)
- COM+
COM
Microsoft's COM (Component Object Model) is a binary interface standard that allows software components to communicate with one another. Regardless of the programming language used to create the components, COM provides a standard way for applications to interact with one another and with the operating system.
COM is represented in the Windows Registry by a set of registry keys and values that define the properties and behaviors of COM components. These keys and values are used to register COM components on the system, specify which interfaces a component supports, and provide other configuration information to the operating system and applications.
COM components are represented in the Windows Registry by a series of keys and values that define the component's properties and behaviors. Among these keys and values are the following:
- CLSID: This key represents the component and includes subkeys for each version that is installed on the system. Each subkey contains values that specify the component's name, description, and other properties.
- InprocServer32: This key denotes the dynamic link library (DLL) that implements the component and contains values that specify the DLL's path and other properties.
- Interface: This key represents the interfaces exposed by the component and includes subkeys for each. Each subkey contains values that specify the interface's name, GUID, and other properties.
C++, Visual Basic, and.NET are just a few of the programming languages that can be used to create COM components. A COM component, once created, can be used by any application that supports COM, including those written in different programming languages. As a result, COM is a powerful and adaptable technology for developing software components and applications.
One of the key benefits of COM is the ability to enable late binding, which allows applications to call methods on a component without having to understand how the component works. This is accomplished by utilizing interfaces, which provide a standardized means for components to expose their functionality to other components. When an application calls a method on an interface, regardless of the programming language used to create the component, the COM runtime resolves the call to the correct implementation of the method.
Another benefit of COM is its versioning support, which allows components to be updated or replaced without breaking existing code that relies on them. This is accomplished by utilizing interfaces and versioning information stored in the Windows Registry. Developers can modify the implementation of a component without affecting its interface by defining interfaces for components and tracking their versions, ensuring that existing code continues to work as expected.
The following is an example of a registry entry for a COM component:
HKEY_CLASSES_ROOT\CLSID\{9BA05972-F6A8-11CF-A442-00A0C90A8F39} (Default) = "Microsoft Windows Media Player" InprocServer32 = "%ProgramFiles%\Windows Media Player\wmp.dll"
The above registry entry registers the Windows Media Player COM component on the system, specifying the default name of the component and the location of its DLL file.
Interfaces
Interfaces are a fundamental component of COM and are used to define a component's methods and properties that are accessible to other components. Interfaces are represented in the registry by a series of keys and values that define the interface's properties and behaviors, including the methods and properties that are available to other components.
Interfaces are represented in the Windows Registry by a series of keys and values that define the interface's properties and behaviors. Among these keys and values are the following:
- Interface: This key represents the interface and contains values that specify the interface's name, GUID, and other properties.
- Methods: This key represents the interface's exposed methods and contains subkeys for each method. Each subkey contains values that specify the method's name, ID, and other properties.
- Properties: This key represents the interface's exposed properties and contains subkeys for each property. Each subkey contains values that specify the property's name, ID, and other properties.
COM components use interfaces to define their functionality and provide a standardized way for other components to interact with them. Interfaces are language-agnostic, which means that components written in different programming languages can communicate with one another via interfaces.
In COM, interfaces are also used to provide a mechanism for component versioning. Developers can change the implementation of a component without affecting its interface by defining interfaces for components. This means that components can be updated or replaced without interfering with existing code that relies on them.
Assume you have a COM component that provides email sending functionality. The component may define an IEmailSender interface that exposes methods for sending email messages. Other components or applications can use this interface to interact with the email-sending component without having to understand its internal workings.
Here is an example of a registry entry for a COM interface:
HKEY_CLASSES_ROOT\Interface\{00020400-0000-0000-C000-000000000046} (Default) = "IDispatch"
The IDispatch interface, defined in the preceding registry entry, is used to provide automation support for COM components. It specifies the interface's default name and GUID.
Type Libraries
Type libraries, which are used to define the data types and interfaces that a component supports, are another important aspect of COM. Type libraries are represented in the registry by a series of keys and values that define the properties and behaviors of the type library, including the interfaces and data types that are supported.
Type libraries are represented in the Windows Registry by a series of keys and values that define the type library's properties and behaviors. Among these keys and values are the following:
- TypeLib: This key represents the type library and includes subkeys for each version that is installed on the system. Each subkey contains values that specify the type library's name, description, and other properties.
- Version: This key denotes a particular version of the type library and includes subkeys for each interface defined in the type library. Each subkey contains values that specify the interface's name, GUID, and other properties.
- Interface: This key in the type library represents a specific interface and contains subkeys for each method and property defined in the interface. Each subkey contains values that specify the method or property's name, ID, and other properties.
Type libraries are commonly used by COM-compliant development tools and programming languages such as Microsoft Visual Basic, Microsoft Visual C++, and Microsoft.NET Framework. These tools use the type library information to generate code that can be used to call methods and properties on the COM component.
For example, if you have a COM component that exposes an interface for retrieving data from a database, you could generate code that calls the interface's methods and properties using a development tool like Visual Basic. The development tool would generate code based on the information in the type library, ensuring that the correct data types and method signatures are used.
Here is an example of a registry entry for a COM type library:
HKEY_CLASSES_ROOT\TypeLib\{1F2D0E65-8DFE-4BAF-A07E-4A4D4C4B1E9D}\1.0 (Default) = "Microsoft Excel 2010 Object Library"
The registry entry above defines the Microsoft Excel 2010 Object Library type library, which contains Excel's interfaces and data types. It specifies the type library's default name and GUID.
File Type Associations
In the Windows Registry, file type associations represent the link between a file extension and the application that is used to open that file. When a user double-clicks on a file with a specific extension, the operating system searches the registry for the file type association to determine which application should be launched to open the file.
Each registry file type association contains several pieces of information, including the file extension, the application associated with the extension, and the command-line arguments passed to the application when the file is opened. This data is saved in a specific location in the registry, where it can be accessed and modified using tools like the Registry Editor or PowerShell.
Users or applications can change file type associations, and changes to these associations can affect how files are opened and handled on a given system. If an application that claims to handle a specific file type is installed, it may modify the file type association in the registry to ensure that it is launched when a file with that extension is opened. Basically, a file type association is a mapping between a file extension, such as .txt or .docx, and the application that should be used to open files with that extension, such as Notepad or Microsoft Word.
File type associations are represented in the Windows Registry by a series of keys and values that define the properties and behaviors of the association. Among these keys and values are the following:
- File type: This key represents the file type and includes subkeys for each file extension associated with it. Each subkey contains values that specify the file type's name, description, and other properties.
- Shell: This key represents the applications associated with the file type and includes subkeys for each. Each subkey contains values that specify the application's name, path, and other properties.
- DefaultIcon: This key contains values that specify the path to the icon file and represents the icon that is displayed for files with the associated file type.
If we take the .txt file extension as an example, HKEY_CLASSES_ROOT\.txt key represents the file extension ".txt" and contains values that define the properties and behaviors of the associated file type. Here are some examples of values that could be included:
- (Default): The name of the file type associated with the extension is specified by this value. The value in this case could be "txtfile."
- Content Type: This value specifies the file type's MIME type. The value for a text file could be "text/plain."
- PerceivedType: This value specifies the file type's perceived type. The value for a text file could be "text."
- Shell: This key represents the applications associated with the file type and includes subkeys for each. For example, there could be a "edit" subkey that specifies the application to be used to edit text files.
- DefaultIcon: This key represents the icon that is displayed for files with the associated file type and contains values that specify the path to the icon file.
COM+
COM+ is a component services technology that extends the functionality of COM by providing additional features such as transactions, security, and queuing. In the registry, COM+ is represented by a series of keys and values that define the properties and behaviors of the COM+ components and services, including the configuration information that is used by the operating system and applications.
COM+ has several features that make it useful for developing distributed applications, including:
- Transaction support: COM+ includes transactional support, allowing developers to create applications that can perform multiple actions in a single transaction. This is critical in distributed applications to ensure data consistency and reliability.
- Object pooling:Object pooling is a feature of COM+ that allows developers to reuse object instances across multiple client requests. This can boost application performance while lowering the overhead associated with creating and destroying object instances.
- Automatic activation: COM+ supports automatic activation, allowing objects to be created and destroyed as needed. This can improve application performance while reducing the overhead associated with object instance management.
- Just-in-time activation: Just-in-time activation in COM+ allows objects to be created and initialized only when they are required. This can boost application performance by lowering the overhead associated with creating and initializing objects that may never be used.
COM+ components are represented in the Windows Registry by a series of keys and values that define the component's properties and behaviors. Among these keys and values are the following:
- CLSID: This key represents the component and includes subkeys for each version that is installed on the system. Each subkey contains values that specify the component's name, description, and other properties.
- InprocServer32: This key denotes the dynamic link library (DLL) that implements the component and contains values that specify the DLL's path and other properties.
- Interface: This key represents the interfaces exposed by the component and includes subkeys for each. Each subkey contains values that specify the interface's name, GUID, and other properties.
COM+ also includes tools and utilities for managing and configuring distributed applications, such as the Component Services MMC snap-in, which allows developers to configure transaction settings, object pooling, and other COM+ component features.
Here is an example of a registry entry for a COM+ component:
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AppID\{00000000-0000-0000-0000-000000000000} (Default) = "DefaultAppID"
Overall, the Windows Registry plays a critical role in managing and configuring COM components and related technologies such as interfaces, type libraries, and COM+. By providing a standardized way to register and configure these components, the registry ensures that they are properly integrated into the system and available for use by applications and other components. IT professionals who work with COM and related technologies must have a thorough understanding of the registry and its structure, in order to effectively manage and configure these components on their systems.
Let's take a look at how these classes communicate and interact with one another:
COM (Component Object Model): In Windows, COM is the foundational technology for component-based development. It defines how software components communicate and interact with one another. COM allows components to be used across multiple applications and systems by facilitating inter-process communication. It specifies a set of rules and protocols that govern the instantiation, access, and management of components.
Interfaces:Interfaces define the relationship between a component and the clients who use it. They define a set of methods, properties, and events that other components can access and use. Interfaces define how components interact with one another in a consistent and standardized manner. Components communicate in COM by invoking methods defined in interfaces.
Type Libraries: Type Libraries provide a structured and standardized representation of interfaces, data types, and other components' elements. Type Libraries contain information about the interfaces that a component supports, as well as their methods, properties, and parameters. They facilitate component communication and interoperability by providing a clear understanding of their capabilities and how they can be used.
COM+ (Component Services): COM+ is a COM extension that adds features and capabilities for developing enterprise-level applications. It provides transaction management, object pooling, and distributed transactions among other services. COM+ components are intended to operate in a managed environment, enhancing reliability, scalability, and security.
The following are the relationships between these classes:
Interfaces are the primary means of communication between components in COM. Interfaces exposed by components define the methods and properties they provide. Clients of a component use these interfaces to access the component's functionality.
Type Libraries allow you to define and document a component's interfaces and other elements. They serve as a repository for information about the capabilities of the component, making it easier for clients to understand and interact with it.
COM+ enhances COM's capabilities by providing additional services and features. COM+ components can communicate with other components via COM interfaces while leveraging COM+'s enhanced features for advanced functionality such as transaction management or object pooling.