} // public static PESubsystemID GetPESubsystem /// <summary> /// 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. /// </summary> /// <param name="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. /// </param> /// <seealso cref="GetPESubsystemID"/> /// <param name="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. /// </param> /// <see cref="SubsystemDescription"/> /// <returns> /// If the function succeeds, the return value is a string containing a /// short or long description that corresponds to a specified subsystem /// ID. /// </returns> /// <exception cref="ArgumentOutOfRangeException"> /// If the subsystem ID specified by argument pintSubsystemID is either /// negative or greater than the largest valid subsystem ID (9, at /// present, though future editions of the Microsoft Platform SDK might /// define additional IDs), an ArgumentOutOfRangeException exception is /// thrown, which reports the /// </exception> /// <exception cref="System.ComponentModel.InvalidEnumArgumentException"> /// An System.ComponentModel.InvalidEnumArgumentException exception is /// thrown when the second argument, penmSubsystemDescription, is either /// SubsystemDescription.Unspecified or is not a valid member of the /// SubsystemDescription enumeration. Unspecified is defined, but marked /// as invalid to ensure that if penmSubsystemDescription is a variable, /// it is initialized. /// </exception> /// <see cref="GetPESubsystemID"/> /// <seealso cref="GetPESubsystemDescription(PESubsystemID,SubsystemDescription)"/> public static string GetPESubsystemDescription( Int16 pintSubsystemID, SubsystemDescription penmSubsystemDescription) { const string ARG_SUBSYST = "pintSubsystemID"; const string ARG_ENUM_NAME = "penmSubsystemDescription"; if (pintSubsystemID >= IMAGE_SUBSYSTEM_UNKNOWN && pintSubsystemID < s_astrLongNames.Length) { switch (penmSubsystemDescription) { case SubsystemDescription.Short: return(s_astrShortNames [pintSubsystemID]); case SubsystemDescription.Long: return(s_astrLongNames [pintSubsystemID]); default: throw new System.ComponentModel.InvalidEnumArgumentException( ARG_ENUM_NAME, // Parameter (Argument) Name ( int )penmSubsystemDescription, // Parameter (Argument) Value, cast to Integer penmSubsystemDescription.GetType( )); // Parameter (Enumeration) Type } // switch ( penmSubsystemDescription ) } // TRUE (anticipated outcome) block, if ( pintSubsystemID > IMAGE_SUBSYSTEM_UNKNOWN && pintSubsystemID < s_astrLongNames.Length ) else { throw new ArgumentOutOfRangeException( ARG_SUBSYST, // Parameter (Argument) Name pintSubsystemID, // Value passed in as a subsystem ID Properties.Resources.MSG_XLATE_SUBSYST_INVALID_ID); // Explanatory text } // FALSE (unanticipated outcome) block, if ( pintSubsystemID > IMAGE_SUBSYSTEM_UNKNOWN && pintSubsystemID < s_astrLongNames.Length ) } // public static string GetPESubsystemDescription (1 of 2)
} // public static string GetPESubsystemDescription (1 of 2) /// <summary> /// 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. /// </summary> /// <param name="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. /// </param> /// <param name="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. /// </param> /// <see cref="SubsystemDescription"/> /// <returns> /// If the function succeeds, the return value is a string containing a /// short or long description that corresponds to a specified subsystem /// ID. /// </returns> /// <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. /// </remarks> /// <see cref="GetPESubsystem"/> /// <seealso cref="GetPESubsystemID"/> /// <seealso cref="GetPESubsystemDescription(Int16,SubsystemDescription)"/> public static string GetPESubsystemDescription( PESubsystemID penmSubsystemID, SubsystemDescription penmSubsystemDescription) { return(GetPESubsystemDescription( ( Int16 )penmSubsystemID, penmSubsystemDescription)); } // public static string GetPESubsystemDescription (2 of 2)