/////////////////////////////////////////////////////////////////////// // // VP_SAMPLE2.MOF // // Purpose: Sample view provider MOF for join views // // Copyright (c) 1999-2001 Microsoft Corporation, All Rights Reserved // /////////////////////////////////////////////////////////////////////// #pragma namespace("\\\\.\\root") instance of __namespace { Name = "sample_views"; }; #pragma namespace("\\\\.\\root\\sample_views") instance of __Win32Provider as $DataProv { Name = "MS_VIEW_INSTANCE_PROVIDER"; ClsId = "{AA70DDF4-E11C-11D1-ABB0-00C04FD9159E}"; ImpersonationLevel = 1; PerUserInitialization = "True"; }; instance of __InstanceProviderRegistration { Provider = $DataProv; SupportsPut = True; SupportsGet = True; SupportsDelete = True; SupportsEnumeration = True; QuerySupportLevels = {"WQL:UnarySelect"}; }; //********************************************************************************************************* // // The following classes demonstrate joins of classes // //********************************************************************************************************* // JOIN CASE1 // The following class creates a new class from many related WDM classes // NOTE: The WDM Provider is only available on (or after) Windows 98 and Windows 2000. //====================================================================================== [JoinOn("MSNdis_MediaConnectStatus.InstanceName = MSNdis_MediaInUse.InstanceName \ and MSNdis_MediaConnectStatus.InstanceName = MSNdis_MACOptions.InstanceName \ and MSNdis_MediaConnectStatus.InstanceName = MSNdis_CoMediaConnectStatus.InstanceName \ and MSNdis_MediaConnectStatus.InstanceName = MSNdis_CoMediaInUse.InstanceName \ and MSNdis_MediaConnectStatus.InstanceName = MSNdis_CoTransmitPdusOk.InstanceName \ and MSNdis_MediaConnectStatus.InstanceName = MSNdis_CoVendorDescription.InstanceName \ and MSNdis_MediaConnectStatus.InstanceName = MSNdis_CoVendorDriverVersion.InstanceName \ and MSNdis_MediaConnectStatus.InstanceName = MSNdis_CoVendorId.InstanceName \ and MSNdis_MediaConnectStatus.InstanceName = MSNdis_CurrentLookahead.InstanceName" ), ViewSources { "Select * from MSNdis_MediaConnectStatus", "Select * from MSNdis_MediaInUse", "Select * from MSNdis_MACOptions", "Select * from MSNdis_CoMediaConnectStatus", "Select * from MSNdis_CoMediaInUse", "Select * from MSNdis_CoTransmitPdusOk", "Select * from MSNdis_CoVendorDescription", "Select * from MSNdis_CoVendorDriverVersion", "Select * from MSNdis_CoVendorId", "Select * from MSNdis_CurrentLookahead" }, ViewSpaces { "\\\\.\\root\\wmi", "\\\\.\\root\\wmi", "\\\\.\\root\\wmi", "\\\\.\\root\\wmi", "\\\\.\\root\\wmi", "\\\\.\\root\\wmi", "\\\\.\\root\\wmi", "\\\\.\\root\\wmi", "\\\\.\\root\\wmi", "\\\\.\\root\\wmi" }, dynamic, provider("MS_VIEW_INSTANCE_PROVIDER")] class Join_WDM_Media { [ PropertySources{"InstanceName","InstanceName","InstanceName", \ "InstanceName","InstanceName","InstanceName", \ "InstanceName","InstanceName","InstanceName", \ "InstanceName"}, key ] string VName; [ PropertySources{"NdisMediaConnectStatus","","","","","","","","",""} ] uint32 VMediaConnectStatus; [ PropertySources{"","NdisMediaInUse","","","","","","","",""} ] uint32 VMediaInUse []; [ PropertySources{"","NumberElements","","","","","","","",""} ] uint32 VMediaInUseNumberElements; [ PropertySources{"","","NdisMACOptions","","","","","","",""} ] uint32 VMACOptions; [ PropertySources{"","","","NdisCoMediaConnectStatus","","","","","",""} ] uint32 VCoMediaConnectStatus; [ PropertySources{"","","","","NdisCoMediaInUse","","","","",""} ] uint32 VCoMediaInUse []; [ PropertySources{"","","","","NumberElements","","","","",""} ] uint32 VCoMediaInUseNumberElements; [ PropertySources{"","","","","","NdisCoTransmitPdusOk","","","",""} ] uint32 VCoTransmitPdusOk; [ PropertySources{"","","","","","","NdisCoVendorDescription","","",""} ] string VNdisCoVendorDescription; [ PropertySources{"","","","","","","Active","","",""} ] Boolean VNdisCoVendorDescriptionActive; [ PropertySources{"","","","","","","","NdisCoVendorDriverVersion","",""} ] uint32 VNdisCoVendorDriverVersion; [ PropertySources{"","","","","","","","Active","",""} ] Boolean VNdisCoVendorDriverVersionActive; [ PropertySources{"","","","","","","","","NdisCoVendorID",""} ] uint32 VNdisCoVendorID; [ PropertySources{"","","","","","","","","Active",""} ] Boolean VNdisCoVendorIdActive; [ PropertySources{"","","","","","","","","","NdisCurrentLookAhead"} ] Uint32 VCurrentLookAhead; }; // JOIN CASE2 // The following class creates a new class from two classes relating the same type // of information provided by two different providers. // NOTE: The HiPerf Provider is only available on Windows 2000 (and later). //====================================================================================== [JoinOn("Win32_PerfRawData_PerfProc_Process.IDProcess = Win32_Process.ProcessId"), ViewSources { "Select * from Win32_PerfRawData_PerfProc_Process", "Select * from Win32_Process" }, ViewSpaces { "\\\\.\\root\\cimv2", "\\\\.\\root\\cimv2" }, dynamic, provider("MS_VIEW_INSTANCE_PROVIDER")] class Join_Process { [key, PropertySources{"Name",""}] string Name; [PropertySources{"PercentProcessorTime",""}] uint64 PercentProcessorTime; [PropertySources{"PercentUserTime",""}] uint64 PercentUserTime; [PropertySources{"PercentPrivilegedTime",""}] uint64 PercentPrivilegedTime; [PropertySources{"VirtualBytesPeak",""}] uint64 VirtualBytesPeak; [PropertySources{"VirtualBytes",""}] uint64 VirtualBytes; [PropertySources{"PageFaultsPersec",""}] uint32 PageFaultsPersec; [PropertySources{"PageFileBytesPeak",""}] uint64 PageFileBytesPeak; [PropertySources{"PageFileBytes",""}] uint64 PageFileBytes; [PropertySources{"PrivateBytes",""}] uint64 PrivateBytes; [PropertySources{"ThreadCount",""}] uint32 ThreadCount; [PropertySources{"PriorityBase",""}] uint32 PriorityBase; [PropertySources{"ElapsedTime",""}] uint64 ElapsedTime; [key, PropertySources{"IDProcess","ProcessId"}] uint32 IDProcess; [PropertySources{"CreatingProcessID",""}] uint32 CreatingProcessID; [PropertySources{"HandleCount",""}] uint32 HandleCount; [PropertySources{"IOReadOperationsPersec",""}] uint64 IOReadOperationsPersec; [PropertySources{"IOWriteOperationsPersec",""}] uint64 IOWriteOperationsPersec; [PropertySources{"IODataOperationsPersec",""}] uint64 IODataOperationsPersec; [PropertySources{"IOOtherOperationsPersec",""}] uint64 IOOtherOperationsPersec; [PropertySources{"IOReadBytesPersec",""}] uint64 IOReadBytesPersec; [PropertySources{"IOWriteBytesPersec",""}] uint64 IOWriteBytesPersec; [PropertySources{"IODataBytesPersec",""}] uint64 IODataBytesPersec; [PropertySources{"IOOtherBytesPersec",""}] uint64 IOOtherBytesPersec; [PropertySources{"","ExecutablePath"}] string ExecutablePath; [PropertySources{"","ExecutionState"}] uint16 ExecutionState; [PropertySources{"","MaximumWorkingSetSize"}] uint32 MaximumWorkingSetSize; [PropertySources{"","MinimumWorkingSetSize"}] uint32 MinimumWorkingSetSize; [PropertySources{"","PeakWorkingSetSize"}] uint32 PeakWorkingSetSize; [PropertySources{"","QuotaNonPagedPoolUsage"}] uint32 QuotaNonPagedPoolUsage; [PropertySources{"","QuotaPagedPoolUsage"}] uint32 QuotaPagedPoolUsage; [PropertySources{"","QuotaPeakNonPagedPoolUsage"}] uint32 QuotaPeakNonPagedPoolUsage; [PropertySources{"","QuotaPeakPagedPoolUsage"}] uint32 QuotaPeakPagedPoolUsage; [PropertySources{"","WindowsVersion"}] string WindowsVersion; [PropertySources{"","SessionId"}] uint32 SessionId; }; // JOIN CASE3 // The following class creates a new class by combining process information with // the file information associated to the process executable. // NOTE: This class uses the EnumerateClasses qualifier as enumerating files is // far more expensive than enumerating processes. Other interesting points are the // select statement for the datafile names properties of interest only and the query // for processes asks only for those processes which have a file path. Since getting // all properties for a datafile is expensive and the Win32 provider will optimize // where possible. It is a good idead to scope queries as much as possible to allow // providers to optimize where possible. //====================================================================================== [JoinOn("CIM_DataFile.Name = Win32_Process.ExecutablePath"), EnumerateClasses{"Win32_Process"}, ViewSources { "Select Name, Compressed, Readable, Writeable, FileSize from CIM_DataFile", "Select * from Win32_Process where ExecutablePath <> NULL" }, ViewSpaces { "\\\\.\\root\\cimv2", "\\\\.\\root\\cimv2" }, dynamic, provider("MS_VIEW_INSTANCE_PROVIDER")] class Join_ProcessWithFileInfo { [PropertySources{"Compressed",""}] boolean FileCompressed; [PropertySources{"Readable",""}] boolean FileReadable; [PropertySources{"FileSize",""}] uint64 FileSize; [PropertySources{"Writeable",""}] boolean FileWriteable; [key, PropertySources{"Name","ExecutablePath"}] string FileName; [key, PropertySources{"","Handle"}] string ProcessHandle; [PropertySources{"","Priority"}] uint32 ProcessPriority; [PropertySources{"","MaximumWorkingSetSize"}] uint32 ProcessMaximumWorkingSetSize; [PropertySources{"","MinimumWorkingSetSize"}] uint32 ProcessMinimumWorkingSetSize; [PropertySources{"","PageFaults"}] uint32 ProcessPageFaults; [PropertySources{"","PageFileUsage"}] uint32 ProcessPageFileUsage; [PropertySources{"","PeakPageFileUsage"}] uint32 ProcessPeakPageFileUsage; [PropertySources{"","PeakWorkingSetSize"}] uint32 ProcessPeakWorkingSetSize; [PropertySources{"","QuotaNonPagedPoolUsage"}] uint32 ProcessQuotaNonPagedPoolUsage; [PropertySources{"","QuotaPagedPoolUsage"}] uint32 ProcessQuotaPagedPoolUsage; [PropertySources{"","QuotaPeakNonPagedPoolUsage"}] uint32 ProcessQuotaPeakNonPagedPoolUsage; [PropertySources{"","QuotaPeakPagedPoolUsage"}] uint32 ProcessQuotaPeakPagedPoolUsage; [PropertySources{"","WindowsVersion"}] string ProcessWindowsVersion; [PropertySources{"","ThreadCount"}] uint32 ProcessThreadCount; [PropertySources{"","HandleCount"}] uint32 ProcessHandleCount; [PropertySources{"","ParentProcessId"}] uint32 ProcessParentProcessId; [PropertySources{"","SessionId"}] uint32 ProcessSessionId; [PropertySources{"","PrivatePageCount"}] uint64 ProcessPrivatePageCount; [PropertySources{"","PeakVirtualSize"}] uint64 ProcessPeakVirtualSize; [PropertySources{"","VirtualSize"}] uint64 ProcessVirtualSize; [PropertySources{"","ReadOperationCount"}] uint64 ProcessReadOperationCount; [PropertySources{"","WriteOperationCount"}] uint64 ProcessWriteOperationCount; [PropertySources{"","OtherOperationCount"}] uint64 ProcessOtherOperationCount; [PropertySources{"","ReadTransferCount"}] uint64 ProcessReadTransferCount; [PropertySources{"","WriteTransferCount"}] uint64 ProcessWriteTransferCount; [PropertySources{"","OtherTransferCount"}] uint64 ProcessOtherTransferCount; [PropertySources{"","ExecutionState"}] uint16 ProcessExecutionState; [PropertySources{"","WorkingSetSize"}] uint64 ProcessWorkingSetSize; }; // JOIN CASE4 // The following classese create a new class by combining connection information with // the logical disk information. // NOTE: This class uses the PostJoinFilter qualifier. The PostJoinFilter allows the // results to be filtered by comparing properties in the view class which allows // properties in different source classes to be validated together. //====================================================================================== [JoinOn("Win32_LogicalDisk.DeviceID = Win32_NetworkConnection.LocalName"), PostJoinFilter("Select * from Join_DiskConnectionAlert where " "((DiskFreeSpace < 500000000) AND (ConnectionState = \"Connected\")) OR " "ConnectionState <> \"Connected\""), ViewSources { "Select * from Win32_LogicalDisk", "Select * from Win32_NetworkConnection where LocalName <> NULL" }, ViewSpaces { "\\\\.\\root\\cimv2", "\\\\.\\root\\cimv2" }, dynamic, provider("MS_VIEW_INSTANCE_PROVIDER")] class Join_DiskConnectionAlert { [key, PropertySources{"DeviceID","LocalName"}] string Name; [PropertySources{"Compressed",""}] boolean DiskCompressed; [PropertySources{"Description",""}] string DiskDescription; [PropertySources{"DriveType",""}] uint32 DiskDriveType; [PropertySources{"FileSystem",""}] string DiskFileSystem; [PropertySources{"FreeSpace",""}] uint64 DiskFreeSpace; [PropertySources{"MaximumComponentLength",""}] uint32 DiskMaximumComponentLength; [PropertySources{"MediaType",""}] uint32 DiskMediaType; [PropertySources{"ProviderName",""}] string DiskProviderName; [PropertySources{"Size",""}] uint64 DiskSize; [PropertySources{"SupportsFileBasedCompression",""}] boolean DiskSupportsFileBasedCompression; [PropertySources{"VolumeName",""}] string DiskVolumeName; [PropertySources{"VolumeSerialNumber",""}] string DiskVolumeSerialNumber; [key, PropertySources{"","Name"}] string Moniker; [PropertySources{"","Comment"}] string ConnectionComment; [PropertySources{"","ConnectionState"}] string ConnectionState; [PropertySources{"","ConnectionType"}] string ConnectionType; [PropertySources{"","DisplayType"}] string ConnectionDisplayType; [PropertySources{"","Persistent"}] boolean IsConnectionPersistent; [PropertySources{"","ProviderName"}] string ConnectionProviderName; [PropertySources{"","RemoteName"}] string ConnectionRemoteName; [PropertySources{"","RemotePath"}] string ConnectionRemotePath; [PropertySources{"","ResourceType"}] string ConnectionResourceType; [PropertySources{"","Status"}] string ConnectionStatus; [PropertySources{"","UserName"}] string ConnectionUserName; }; [JoinOn("Win32_LogicalDisk.DeviceID = Win32_NetworkConnection.LocalName"), PostJoinFilter("Select * from Join_DiskConnectionOK where " "(DiskFreeSpace >= 500000000) AND (ConnectionState = \"Connected\")"), ViewSources { "Select * from Win32_LogicalDisk", "Select * from Win32_NetworkConnection where LocalName <> NULL" }, ViewSpaces { "\\\\.\\root\\cimv2", "\\\\.\\root\\cimv2" }, dynamic, provider("MS_VIEW_INSTANCE_PROVIDER")] class Join_DiskConnectionOK { [key, PropertySources{"DeviceID","LocalName"}] string Name; [PropertySources{"Compressed",""}] boolean DiskCompressed; [PropertySources{"Description",""}] string DiskDescription; [PropertySources{"DriveType",""}] uint32 DiskDriveType; [PropertySources{"FileSystem",""}] string DiskFileSystem; [PropertySources{"FreeSpace",""}] uint64 DiskFreeSpace; [PropertySources{"MaximumComponentLength",""}] uint32 DiskMaximumComponentLength; [PropertySources{"MediaType",""}] uint32 DiskMediaType; [PropertySources{"ProviderName",""}] string DiskProviderName; [PropertySources{"Size",""}] uint64 DiskSize; [PropertySources{"SupportsFileBasedCompression",""}] boolean DiskSupportsFileBasedCompression; [PropertySources{"VolumeName",""}] string DiskVolumeName; [PropertySources{"VolumeSerialNumber",""}] string DiskVolumeSerialNumber; [key, PropertySources{"","Name"}] string Moniker; [PropertySources{"","Comment"}] string ConnectionComment; [PropertySources{"","ConnectionState"}] string ConnectionState; [PropertySources{"","ConnectionType"}] string ConnectionType; [PropertySources{"","DisplayType"}] string ConnectionDisplayType; [PropertySources{"","Persistent"}] boolean IsConnectionPersistent; [PropertySources{"","ProviderName"}] string ConnectionProviderName; [PropertySources{"","RemoteName"}] string ConnectionRemoteName; [PropertySources{"","RemotePath"}] string ConnectionRemotePath; [PropertySources{"","ResourceType"}] string ConnectionResourceType; [PropertySources{"","Status"}] string ConnectionStatus; [PropertySources{"","UserName"}] string ConnectionUserName; };