Click here to Skip to main content
15,895,142 members
Home / Discussions / COM
   

COM

 
GeneralRe: Debugging WMI Providers Pin
krishiyengar29-May-09 2:49
krishiyengar29-May-09 2:49 
GeneralRe: Debugging WMI Providers Pin
Stuart Dootson29-May-09 2:53
professionalStuart Dootson29-May-09 2:53 
GeneralRe: Debugging WMI Providers Pin
krishiyengar29-May-09 3:03
krishiyengar29-May-09 3:03 
GeneralRe: Debugging WMI Providers Pin
Stuart Dootson29-May-09 3:18
professionalStuart Dootson29-May-09 3:18 
GeneralRe: Debugging WMI Providers Pin
krishiyengar29-May-09 3:31
krishiyengar29-May-09 3:31 
GeneralRe: Debugging WMI Providers Pin
Stuart Dootson29-May-09 3:43
professionalStuart Dootson29-May-09 3:43 
GeneralRe: Debugging WMI Providers Pin
krishiyengar29-May-09 3:54
krishiyengar29-May-09 3:54 
GeneralRe: Debugging WMI Providers Pin
krishiyengar29-May-09 4:46
krishiyengar29-May-09 4:46 
I tried again by creating a simple management class which only supports enumeration. Same problem "WMI:Provider load failure", the MOF file and Enumeration function code is below:

MOF File
---------
#pragma namespace("\\\\.\\root")

Instance of __Namespace
{
Name = "KI";
};

#pragma namespace("\\\\.\\root\\KI")

instance of __Win32Provider as $P
{
Name = "KI_Country";
ClsId = "{8A203B80-841D-4274-B753-8A30D8AB862D}";

ClientLoadableCLSID = NULL;
DefaultMachineName = NULL;
ImpersonationLevel = 1;
InitializationReentrancy = 0;
InitializeAsAdminFirst = FALSE;
PerLocaleInitialization = FALSE;
PerUserInitialization = TRUE;
Pure = TRUE;
UnloadTimeout = NULL;
HostingModel = "LocalServiceHost";
};

instance of __InstanceProviderRegistration
{
Provider = $P;
SupportsGet = TRUE;
SupportsEnumeration = TRUE;
};

[
dynamic: ToInstance,
provider("KI_Country"): ToInstance
]
class Country
{
[key] string Name;
uint8 Population;
};

Source code for method for enumeration
---------------------------------------
void CCKICountry::OnCountryInstances(CWbemInstanceList& instList, LPWBEMMETHODCTX ptrs)
{
// Create instance!
LPWBEMINSTANCE pInst = CreateWbemInstance(ptrs);

if (pInst)
{
CComVariant varCapacity(11);
varCapacity.ChangeType(VT_UI1);

// Set property
pInst->SetProperty(L"Name", L"Argentina");
pInst->SetProperty(L"Population", varCapacity);
instList.Add(pInst);

pInst->SetProperty(L"Name", L"Brazil");
pInst->SetProperty(L"Population", varCapacity);
instList.Add(pInst);
}
}

IDL definition
---------------
import "oaidl.idl";
import "ocidl.idl";
import "wbemprov.idl";

[
object,
uuid(7E9375F5-7033-4991-9602-1A406A8BDED5),
helpstring("ICKICountry Interface"),
pointer_default(unique)
]
interface ICKICountry : IUnknown{
};
[
uuid(8A203B80-841D-4274-B753-8A30D8AB862D),
version(1.0),
helpstring("Test4 1.0 Type Library")
]
library Test4Lib
{
importlib("stdole2.tlb");
[
uuid(397891B8-804F-45E6-9D8D-2AF808AE2B49),
helpstring("CKICountry Class")
]
coclass CKICountry
{
[default] interface IWbemProviderInit;
interface IWbemServices;
};
};
GeneralRe: Debugging WMI Providers Pin
krishiyengar29-May-09 5:34
krishiyengar29-May-09 5:34 
GeneralRe: Debugging WMI Providers Pin
Stuart Dootson29-May-09 6:10
professionalStuart Dootson29-May-09 6:10 
GeneralRe: Debugging WMI Providers Pin
krishiyengar29-May-09 6:31
krishiyengar29-May-09 6:31 
GeneralRe: Debugging WMI Providers Pin
krishiyengar29-May-09 6:36
krishiyengar29-May-09 6:36 
GeneralRe: Debugging WMI Providers Pin
Stuart Dootson29-May-09 12:49
professionalStuart Dootson29-May-09 12:49 
GeneralRe: Debugging WMI Providers Pin
krishiyengar1-Jun-09 3:58
krishiyengar1-Jun-09 3:58 
GeneralRe: Debugging WMI Providers Pin
Stuart Dootson1-Jun-09 4:04
professionalStuart Dootson1-Jun-09 4:04 
GeneralRe: Debugging WMI Providers Pin
krishiyengar1-Jun-09 4:09
krishiyengar1-Jun-09 4:09 
GeneralRe: Debugging WMI Providers Pin
krishiyengar1-Jun-09 4:15
krishiyengar1-Jun-09 4:15 
GeneralRe: Debugging WMI Providers Pin
Stuart Dootson1-Jun-09 4:21
professionalStuart Dootson1-Jun-09 4:21 
GeneralRe: Debugging WMI Providers Pin
krishiyengar1-Jun-09 4:36
krishiyengar1-Jun-09 4:36 
GeneralRe: Debugging WMI Providers Pin
Stuart Dootson1-Jun-09 4:43
professionalStuart Dootson1-Jun-09 4:43 
GeneralRe: Debugging WMI Providers Pin
krishiyengar1-Jun-09 5:06
krishiyengar1-Jun-09 5:06 
GeneralRe: Debugging WMI Providers Pin
krishiyengar1-Jun-09 6:34
krishiyengar1-Jun-09 6:34 
QuestionProperteis in ActiveX contol Pin
vibindia26-May-09 3:54
vibindia26-May-09 3:54 
AnswerRe: Properteis in ActiveX contol Pin
Stuart Dootson26-May-09 13:18
professionalStuart Dootson26-May-09 13:18 
QuestionSerial Communication using RS232 using SerialPort Class Pin
Avijit23-May-09 0:10
Avijit23-May-09 0:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.