📄 jwawmistr.pas
字号:
{******************************************************************************}
{ }
{ WMI Structure Definitions API interface Unit for Object Pascal }
{ }
{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft }
{ Corporation. All Rights Reserved. }
{ }
{ The original file is: wmistr.h, released November 2002. The original Pascal }
{ code is: WmiStr.pas, released April 2002. The initial developer of the }
{ Pascal code is Marcel van Brakel (brakelm@chello.nl). }
{ }
{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001 }
{ Marcel van Brakel. All Rights Reserved. }
{ }
{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI) }
{ }
{ You may retrieve the latest version of this file at the Project JEDI home }
{ page, located at http://delphi-jedi.org or my personal homepage located at }
{ http://members.chello.nl/m.vanbrakel2 }
{ }
{ The contents of this file are used with permission, subject to the Mozilla }
{ Public License Version 1.1 (the "License"); you may not use this file except }
{ in compliance with the License. You may obtain a copy of the License at }
{ http://www.mozilla.org/MPL/MPL-1.1.html }
{ }
{ Software distributed under the License is distributed on an "AS IS" basis, }
{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
{ the specific language governing rights and limitations under the License. }
{ }
{ Alternatively, the contents of this file may be used under the terms of the }
{ GNU Lesser General Public License (the "LGPL License"), in which case the }
{ provisions of the LGPL License are applicable instead of those above. }
{ If you wish to allow use of your version of this file only under the terms }
{ of the LGPL License and not to allow others to use your version of this file }
{ under the MPL, indicate your decision by deleting the provisions above and }
{ replace them with the notice and other provisions required by the LGPL }
{ License. If you do not delete the provisions above, a recipient may use }
{ your version of this file under either the MPL or the LGPL License. }
{ }
{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
{ }
{******************************************************************************}
unit JwaWmiStr;
{$WEAKPACKAGEUNIT}
{$HPPEMIT ''}
{$HPPEMIT '#include "wmistr.h"'}
{$HPPEMIT ''}
{$I WINDEFINES.INC}
interface
uses
JwaWinType, JwaWinNT;
//
// WNODE definition
type
_WNODE_HEADER = record
BufferSize: ULONG; // Size of entire buffer inclusive of this ULONG
ProviderId: ULONG; // Provider Id of driver returning this buffer
U1: record
case Integer of
0: (
HistoricalContext: ULONG64); // Logger use
1: (
Version: ULONG; // Reserved
Linkage: ULONG); // Linkage field reserved for WMI
end;
u2: record
case Integer of
0: (CountLost: ULONG); // Reserved
1: (KernelHandle: HANDLE); // Kernel handle for data block
2: (TimeStamp: LARGE_INTEGER); // Timestamp as returned in units of 100ns
// since 1/1/1601
end;
Guid: GUID; // Guid for data block returned with results
ClientContext: ULONG;
Flags: ULONG; // Flags, see below
end;
{$EXTERNALSYM _WNODE_HEADER}
WNODE_HEADER = _WNODE_HEADER;
{$EXTERNALSYM WNODE_HEADER}
PWNODE_HEADER = ^WNODE_HEADER;
{$EXTERNALSYM PWNODE_HEADER}
TWNodeHeader = WNODE_HEADER;
PWNodeHeader = PWNODE_HEADER;
//
// WNODE_HEADER flags are defined as follows
const
WNODE_FLAG_ALL_DATA = $00000001; // set for WNODE_ALL_DATA
{$EXTERNALSYM WNODE_FLAG_ALL_DATA}
WNODE_FLAG_SINGLE_INSTANCE = $00000002; // set for WNODE_SINGLE_INSTANCE
{$EXTERNALSYM WNODE_FLAG_SINGLE_INSTANCE}
WNODE_FLAG_SINGLE_ITEM = $00000004; // set for WNODE_SINGLE_ITEM
{$EXTERNALSYM WNODE_FLAG_SINGLE_ITEM}
WNODE_FLAG_EVENT_ITEM = $00000008; // set for WNODE_EVENT_ITEM
{$EXTERNALSYM WNODE_FLAG_EVENT_ITEM}
// Set if data block size is
// identical for all instances
// (used with WNODE_ALL_DATA
// only)
WNODE_FLAG_FIXED_INSTANCE_SIZE = $00000010;
{$EXTERNALSYM WNODE_FLAG_FIXED_INSTANCE_SIZE}
WNODE_FLAG_TOO_SMALL = $00000020; // set for WNODE_TOO_SMALL
{$EXTERNALSYM WNODE_FLAG_TOO_SMALL}
// Set when a data provider returns a
// WNODE_ALL_DATA in which the number of
// instances and their names returned
// are identical to those returned from the
// previous WNODE_ALL_DATA query. Only data
// blocks registered with dynamic instance
// names should use this flag.
WNODE_FLAG_INSTANCES_SAME = $00000040;
{$EXTERNALSYM WNODE_FLAG_INSTANCES_SAME}
// Instance names are not specified in
// WNODE_ALL_DATA; values specified at
// registration are used instead. Always
// set for guids registered with static
// instance names
WNODE_FLAG_STATIC_INSTANCE_NAMES = $00000080;
{$EXTERNALSYM WNODE_FLAG_STATIC_INSTANCE_NAMES}
WNODE_FLAG_INTERNAL = $00000100; // Used internally by WMI
{$EXTERNALSYM WNODE_FLAG_INTERNAL}
// timestamp should not be modified by
// a historical logger
WNODE_FLAG_USE_TIMESTAMP = $00000200;
{$EXTERNALSYM WNODE_FLAG_USE_TIMESTAMP}
WNODE_FLAG_PERSIST_EVENT = $00000400;
{$EXTERNALSYM WNODE_FLAG_PERSIST_EVENT}
WNODE_FLAG_EVENT_REFERENCE = $00002000;
{$EXTERNALSYM WNODE_FLAG_EVENT_REFERENCE}
// Set if Instance names are ansi. Only set when returning from
// WMIQuerySingleInstanceA and WMIQueryAllDataA
WNODE_FLAG_ANSI_INSTANCENAMES = $00004000;
{$EXTERNALSYM WNODE_FLAG_ANSI_INSTANCENAMES}
// Set if WNODE is a method call
WNODE_FLAG_METHOD_ITEM = $00008000;
{$EXTERNALSYM WNODE_FLAG_METHOD_ITEM}
// Set if instance names originated from a PDO
WNODE_FLAG_PDO_INSTANCE_NAMES = $00010000;
{$EXTERNALSYM WNODE_FLAG_PDO_INSTANCE_NAMES}
// The second byte, except the first bit is used exclusively for tracing
WNODE_FLAG_TRACED_GUID = $00020000; // denotes a trace
{$EXTERNALSYM WNODE_FLAG_TRACED_GUID}
WNODE_FLAG_LOG_WNODE = $00040000; // request to log Wnode
{$EXTERNALSYM WNODE_FLAG_LOG_WNODE}
WNODE_FLAG_USE_GUID_PTR = $00080000; // Guid is actually a pointer
{$EXTERNALSYM WNODE_FLAG_USE_GUID_PTR}
WNODE_FLAG_USE_MOF_PTR = $00100000; // MOF data are dereferenced
{$EXTERNALSYM WNODE_FLAG_USE_MOF_PTR}
WNODE_FLAG_NO_HEADER = $00200000; // Trace without header
{$EXTERNALSYM WNODE_FLAG_NO_HEADER}
// Set for events that are WNODE_EVENT_REFERENCE
// Mask for event severity level. Level 0xff is the most severe type of event
WNODE_FLAG_SEVERITY_MASK = DWORD($ff000000);
{$EXTERNALSYM WNODE_FLAG_SEVERITY_MASK}
//
// This structure is used within the WNODE_ALL_DATA when the data blocks
// for the different instances are different lengths. If the data blocks
// for the different instances are identical lengths then
// WNODE_FLAG_FIXED_INSTANCE_SIZE should be set and FixedInstanceSize
// set to the common data block size.
type
OFFSETINSTANCEDATAANDLENGTH = record
OffsetInstanceData: ULONG; // Offset from beginning of WNODE_ALL_DATA
// to Data block for instance
LengthInstanceData: ULONG; // Length of data block for instance
end;
{$EXTERNALSYM OFFSETINSTANCEDATAANDLENGTH}
POFFSETINSTANCEDATAANDLENGTH = ^OFFSETINSTANCEDATAANDLENGTH;
{$EXTERNALSYM POFFSETINSTANCEDATAANDLENGTH}
TOffsetInstanceDataAndLength = OFFSETINSTANCEDATAANDLENGTH;
PWNODE_ALL_DATA = ^WNODE_ALL_DATA;
{$EXTERNALSYM PWNODE_ALL_DATA}
tagWNODE_ALL_DATA = record
WnodeHeader: WNODE_HEADER;
DataBlockOffset: ULONG; // Offset from begin of WNODE to first data block
InstanceCount: ULONG; // Count of instances whose data follows.
// Offset to an array of offsets to the instance names
OffsetInstanceNameOffsets: ULONG;
// If WNODE_FLAG_FIXED_INSTANCE_SIZE is set in Flags then
// FixedInstanceSize specifies the size of each data block. In this case
// there is one ULONG followed by the data blocks.
// If WNODE_FLAG_FIXED_INSTANCE_SIZE is not set
// then OffsetInstanceDataAndLength
// is an array of OFFSETINSTANCEDATAANDLENGTH that specifies the
// offsets and lengths of the data blocks for each instance.
case Integer of
0: (FixedInstanceSize: ULONG);
1: (OffsetInstanceDataAndLength: POFFSETINSTANCEDATAANDLENGTH);
// [InstanceCount]
// padding so that first data block begins on a 8 byte boundry
// data blocks and instance names for all instances
end;
{$EXTERNALSYM tagWNODE_ALL_DATA}
WNODE_ALL_DATA = tagWNODE_ALL_DATA;
{$EXTERNALSYM WNODE_ALL_DATA}
TWNodeAllData = WNODE_ALL_DATA;
PWNodeAllData = PWNODE_ALL_DATA;
PWNODE_SINGLE_INSTANCE = ^WNODE_SINGLE_INSTANCE;
{$EXTERNALSYM PWNODE_SINGLE_INSTANCE}
tagWNODE_SINGLE_INSTANCE = record
WnodeHeader: _WNODE_HEADER;
// Offset from beginning of WNODE_SINGLE_INSTANCE
// to instance name. Use when
// WNODE_FLAG_STATIC_INSTANCE_NAMES is reset
// (Dynamic instance names)
OffsetInstanceName: ULONG;
// Instance index when
// WNODE_FLAG_STATIC_INSTANCE_NAME is set
InstanceIndex: ULONG; // (Static Instance Names)
DataBlockOffset: ULONG; // offset from beginning of WNODE to data block
SizeDataBlock: ULONG; // Size of data block for instance
VariableData: PUCHAR;
// instance names and padding so data block begins on 8 byte boundry
// data block
end;
{$EXTERNALSYM tagWNODE_SINGLE_INSTANCE}
WNODE_SINGLE_INSTANCE = tagWNODE_SINGLE_INSTANCE;
{$EXTERNALSYM WNODE_SINGLE_INSTANCE}
TWNodeSingleInstance = WNODE_SINGLE_INSTANCE;
PWNodeSingleInstance = PWNODE_SINGLE_INSTANCE;
PWNODE_SINGLE_ITEM = ^WNODE_SINGLE_ITEM;
{$EXTERNALSYM PWNODE_SINGLE_ITEM}
tagWNODE_SINGLE_ITEM = record
WnodeHeader: WNODE_HEADER;
// Offset from beginning of WNODE_SINGLE_INSTANCE
// to instance name. Examine when
// WNODE_FLAG_STATIC_INSTANCE_NAME is reset
// (Dynamic instance names)
OffsetInstanceName: ULONG;
// Instance index when
// WNODE_FLAG_STATIC_INSTANCE_NAME
InstanceIndex: ULONG; // set (Static Instance Names)
ItemId: ULONG; // Item Id for data item being set
DataBlockOffset: ULONG; // offset from WNODE begin to data item value
SizeDataItem: ULONG; // Size of data item
VariableData: PUCHAR;
// instance names and padding so data value begins on 8 byte boundry
// data item value
end;
{$EXTERNALSYM tagWNODE_SINGLE_ITEM}
WNODE_SINGLE_ITEM = tagWNODE_SINGLE_ITEM;
{$EXTERNALSYM WNODE_SINGLE_ITEM}
TWNodeSingleItem = WNODE_SINGLE_ITEM;
PWNodeSingleItem = PWNODE_SINGLE_ITEM;
PWNODE_METHOD_ITEM = ^WNODE_METHOD_ITEM;
{$EXTERNALSYM PWNODE_METHOD_ITEM}
tagWNODE_METHOD_ITEM = record
WnodeHeader: WNODE_HEADER;
// Offset from beginning of WNODE_METHOD_ITEM
// to instance name. Examine when
// WNODE_FLAG_STATIC_INSTANCE_NAME is reset
// (Dynamic instance names)
OffsetInstanceName: ULONG;
// Instance index when
// WNODE_FLAG_STATIC_INSTANCE_NAME
InstanceIndex: ULONG; // set (Static Instance Names)
MethodId: ULONG; // Method id of method being called
DataBlockOffset: ULONG; // On Entry: offset from WNODE to input data
// On Return: offset from WNODE to input and
// output data blocks
SizeDataBlock: ULONG; // On Entry: Size of input data, 0 if no input
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -