COUNTED_REASON_CONTEXT structure

The COUNTED_REASON_CONTEXT structure contains one or more strings that give reasons for a power request.

Syntax


typedef struct _COUNTED_REASON_CONTEXT {
  ULONG Version;
  ULONG Flags;
  union {
    struct {
      UNICODE_STRING  ResourceFileName;
      USHORT          ResourceReasonId;
      ULONG           StringCount;
      PUNICODE_STRING ReasonStrings;
    };
    UNICODE_STRING SimpleString;
  };
} COUNTED_REASON_CONTEXT, *PCOUNTED_REASON_CONTEXT;

Members

Version

The version number of the structure. Set this member to DIAGNOSTIC_REASON_VERSION.

Flags

Indicates whether the structure contains a simple reason string or a detailed set of reason strings. Set this member to one of the following constants:

  • DIAGNOSTIC_REASON_SIMPLE_STRING

  • DIAGNOSTIC_REASON_DETAILED_STRING

If Flags = DIAGNOSTIC_REASON_SIMPLE_STRING, the SimpleString member of the union is valid. If Flags = DIAGNOSTIC_REASON_DETAILED_STRING, the ResourceFileName, ResourceReasonId, StringCount, and ReasonStrings members are valid (and the SimpleString member is not valid).

ResourceFileName

A pointer to a wide-character, null-terminated string that contains the pathname of a resource file. This resource file contains one or more localized strings that give reasons for a power request. This member is optional and can be specified as NULL or as an empty string if no resource file is required. This member is valid only if Flags = DIAGNOSTIC_REASON_DETAILED_STRING.

ResourceReasonId

The resource ID assigned to the first reason string in the resource file that is specified by ResourceFileName. This member is valid only if Flags = DIAGNOSTIC_REASON_DETAILED_STRING.

StringCount

The number of reason strings in the ReasonStrings array or in the resource file that is specified by ResourceFileName. This member is valid only if Flags = DIAGNOSTIC_REASON_DETAILED_STRING.

ReasonStrings

A pointer to an array of string pointers. Each array element is a pointer to a wide-character, null-terminated string. The number of array elements is specified by StringCount. This member is valid only if Flags = DIAGNOSTIC_REASON_DETAILED_STRING.

SimpleString

A pointer to a wide-character, null-terminated string that explains the reason for a power request. This member is valid only if Flags = DIAGNOSTIC_REASON_SIMPLE_STRING.

Remarks

This structure is used by the PoCreatePowerRequest routine.

The power manager uses the reason string or strings contained in this structure as a diagnostic aid during functional and performance testing.

The COUNTED_REASON_CONTEXT structure can contain either a simple reason string or a set of detailed reason strings. If Flags = DIAGNOSTIC_REASON_SIMPLE_STRING, the SimpleString member points to a string that explains the reason for the power request. If Flags = DIAGNOSTIC_REASON_DETAILED_STRING, the ResourceFileName, ResourceReasonId, StringCount, and ReasonStrings members can give a detailed set of reasons for the power request.

The DIAGNOSTIC_REASON_DETAILED_STRING flag supports localization. If the localized resource file specified by ResourceFileName exists, the power manager retrieves a set of resource strings from the file and uses these strings in place of the strings contained in the ReasonStrings array. ResourceId specifies the resource index of the first string in the file to use as a reason string, and StringCount specifies the number of resource strings to use as reason strings. The resource strings must have consecutive resource indexes.

Requirements

Version

Supported in Windows 7 and later versions of the Windows operating system.

Header

Wdm.h (include Wdm.h, Ntddk.h, or Ntifs.h)

See also

PoCreatePowerRequest

 

 

Send comments about this topic to Microsoft

Show: