Class PESubsystemInfo
This class exposes methods for obtaining the subsystem ID encoded into the NT header of a Windows Portable Executable (PE) file. Such files include, but are not limited to, character mode and graphical mode programs implemented in both native or managed programming languages, dynamic link libraries, and device drivers.
Inherited Members
Namespace: WizardWrx.AssemblyUtils
Assembly: WizardWrx.AssemblyUtils.dll
Syntax
public class PESubsystemInfo : GenericSingletonBase<PESubsystemInfo>
Fields
| Improve this Doc View SourceIMAGE_SUBSYSTEM_UNKNOWN
The ProcessSubsystmID property returns this value until the private constructor initializes it.
Declaration
public const Int16 IMAGE_SUBSYSTEM_UNKNOWN = null
Field Value
Type | Description |
---|---|
Int16 |
IMAGE_SUBSYSTEM_WINDOWS_CUI
The ProcessSubsystmID property returns this value when queried on an PESubsystemInfo singleton instance that was initialized by a console (character mode) entry assembly.
Static method GetPESubsystemID returns this value when queried about the subsystem ID of a console (character mode) assembly or compiled native program.
Declaration
public const Int16 IMAGE_SUBSYSTEM_WINDOWS_CUI = null
Field Value
Type | Description |
---|---|
Int16 |
IMAGE_SUBSYSTEM_WINDOWS_GUI
The ProcessSubsystmID property returns this value when queried on an PESubsystemInfo singleton instance that was initialized by a Windows (graphical mode) entry assembly.
Static method GetPESubsystemID returns this value when queried about the subsystem ID of a Windows (graphical mode) assembly or compiled native program.
Declaration
public const Int16 IMAGE_SUBSYSTEM_WINDOWS_GUI = null
Field Value
Type | Description |
---|---|
Int16 |
Properties
| Improve this Doc View SourceDefaultAppDomainSubsystem
Get the subsystem in which the default application domain executes.
Declaration
public PESubsystemInfo.PESubsystemID DefaultAppDomainSubsystem { get; }
Property Value
Type | Description |
---|---|
PESubsystemInfo.PESubsystemID |
See Also
| Improve this Doc View SourceDefaultAppDomainSubsystemID
Get the subsystem ID of the default application domain.
Declaration
public Int16 DefaultAppDomainSubsystemID { get; }
Property Value
Type | Description |
---|---|
Int16 |
See Also
| Improve this Doc View SourceDefaultDomainEntryAssemblyName
Get the fully qualified AssemblyName of the first assembly that was loaded into the default application domain.
Declaration
public AssemblyName DefaultDomainEntryAssemblyName { get; }
Property Value
Type | Description |
---|---|
AssemblyName |
Remarks
AssemblyName has properties that expose the parts of an assembly name, its simple name, version, culture, and public key token.
DomainEntryAssemblyLocation
Get the fully qualified name of the file from which the first assembly that was loaded into the default application domain was read.
Declaration
public string DomainEntryAssemblyLocation { get; }
Property Value
Type | Description |
---|---|
System.String |
Methods
| Improve this Doc View SourceGetPESubsystem(String)
Use this wrapper to get the PESubsystemID enumeration member equivalent to the integer returned by GetPESubsystemID.
Declaration
public static PESubsystemInfo.PESubsystemID GetPESubsystem(string pstrFileName)
Parameters
Type | Name | Description |
---|---|---|
System.String | pstrFileName | This string must be the name of a file that can be found in the current security context. Names may be either relative or fully qualified. Relative file names are resolved relative to the current working directory. |
Returns
Type | Description |
---|---|
PESubsystemInfo.PESubsystemID | If the function succeeds, its return value is a PESubsystemID member that corresponds to the 16-bit integer returned by GetPESubsystemID, which it calls internally. |
See Also
| Improve this Doc View SourceGetPESubsystemDescription(Int16, PESubsystemInfo.SubsystemDescription)
Get the short (one or two word) or long (complete, grammatically correct sentence) description that corresponds to a Portable Executable (PE) subsystem ID, such as the value returned by passing a file name to GetPESubsystemID.
Declaration
public static string GetPESubsystemDescription(Int16 pintSubsystemID, PESubsystemInfo.SubsystemDescription penmSubsystemDescription)
Parameters
Type | Name | Description |
---|---|---|
Int16 | pintSubsystemID | Specify the subsystem ID for which the corresponding short or long description is wanted. Suitable inputs include the signed integer returned by GetPESubsystemID, which may be called as a nested method if you have no further use for the subsystem ID. |
PESubsystemInfo.SubsystemDescription | penmSubsystemDescription | A member of the SubsystemDescription specifies whether to return the short (one or two word) description or the long (complete sentence) description that corresponds to the specified subsystem ID. |
Returns
Type | Description |
---|---|
System.String | If the function succeeds, the return value is a string containing a short or long description that corresponds to a specified subsystem ID. |
See Also
GetPESubsystemDescription(PESubsystemInfo.PESubsystemID, PESubsystemInfo.SubsystemDescription)
Get the short (one or two word) or long (complete, grammatically correct sentence) description that corresponds to a Portable Executable (PE) subsystem ID, such as the value returned by passing a file name to GetPESubsystemID.
Declaration
public static string GetPESubsystemDescription(PESubsystemInfo.PESubsystemID penmSubsystemID, PESubsystemInfo.SubsystemDescription penmSubsystemDescription)
Parameters
Type | Name | Description |
---|---|---|
PESubsystemInfo.PESubsystemID | penmSubsystemID | Specify the PESubsystemID enumeration value for which the corresponding string is needed. Suitable inputs include the value returned by GetPESubsystem or the DefaultDomainSubsystem property returned by the singleton instance. |
PESubsystemInfo.SubsystemDescription | penmSubsystemDescription | A member of the SubsystemDescription specifies whether to return the short (one or two word) description or the long (complete sentence) description that corresponds to the specified subsystem ID. |
Returns
Type | Description |
---|---|
System.String | If the function succeeds, the return value is a string containing a short or long description that corresponds to a specified subsystem ID. |
Remarks
This method casts penmSubsystemID to Int16, and feeds it to GetPESubsystemDescription, since the cast wound be necessary, sooner or later, to use the lookup tables that contain the descriptions.
See Also
| Improve this Doc View SourceGetPESubsystemID(String)
Call this method with the name of a file to get its subsystem ID.
Declaration
public static Int16 GetPESubsystemID(string pstrFileName)
Parameters
Type | Name | Description |
---|---|---|
System.String | pstrFileName | This string must be the name of a file that can be found in the current security context. Names may be either relative or fully qualified. Relative file names are resolved relative to the current working directory. |
Returns
Type | Description |
---|---|
Int16 | If the specified file exists and is a valid Windows Portable Executable (PE) file, its subsystem ID is returned. Since the ID is represented internally as a 16 bit signed integer, the return type of Int16 is guaranteed to be correct, regardless of the machine architecture. Debuggers and stack traces may represent this type as a short, a common alias for Int16. |
See Also
ToString()
Override the default ToString method to display the subsystem type.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | The returned string resembles the following example. {{Subsystem ID = Console (3)}} WizardWrx.AssemblyUtils.PESubsystemInfo |