473,471 Members | 2,017 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

WMI and StdRegProv

I am trying to access the stdregprov using the COM interface using C++. I am
unsuccessful in invoking the Put method that initializes the variables before
calling the Exec method of IWbemClassObject.
The code is as follows
BSTR bsClassName = SysAllocString(L"Root\\default:StdRegProv");
BSTR bsMethodName = SysAllocString(L"GetStringValue");

pClass = NULL;
hres = pSvc->GetObject(bsClassName, 0, NULL, &pClass, NULL);
pInParamsDefinition = NULL;
hres = pClass->GetMethod(bsMethodName, 0, NULL, &pInParamsDefinition);

pClassInstance = NULL;
hres = pInParamsDefinition->SpawnInstance(0, &pClassInstance);

VARIANT var;
BSTR ArgName = SysAllocString(L"hDefKey");
// set registry root
VariantClear(&var);
var.vt = VT_I4;
var.lVal = 0x80000002;
hres = pClassInstance->Put(ArgName, 0, &var, 0);

// set registry key
VariantClear(&var);
var.vt = VT_BSTR;
var.bstrVal =
SysAllocString(L"SYSTEM\\CurrentControlSet\\Contro l\\CrashControl");
hres = pClassInstance->Put(L"sSubKeyName", 0, &var, 0);
// set registry key
VariantClear(&var);
var.vt = VT_BSTR;
var.bstrVal = SysAllocString(L"AutoReboot");
hres = pClassInstance->Put(L"sValueName", 0, &var, 0);
VariantClear(&var);

DWORD dwValue = -1;
hres = pSvc->ExecMethod(bsClassName, bsMethodName, 0,NULL, pClassInstance,
&pOutParams, NULL);
Are there any samples to do the something similar
Nov 17 '05 #1
0 1070

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: benjamin schollnick | last post by:
I am attempting to convert the following VB Script code to Python, but with limited success. I appear to be connecting fine, but I can't get the registry information out... I can get the...
1
by: Text | last post by:
I'm trying to invoke the createkey method under StdRegProv but I can't seem to get the first imparam correct it says that "Value was either too large or too small for a UInt32 when it...
1
by: Rob F | last post by:
Hell I'm wondering if anyone can shed some light on this? I'm trying to enumerate the uninstall registry key (to display installed applications) with VB.NET and WMI I'm pretty stuck. When I...
2
by: Steve Bernard | last post by:
Hey there, I was wondering if anyone has been able to write reg_multi_sz multi-string values to the registry from VB.NET. All the registry stuff I find from MS can't differentiate different types...
7
by: Microsoft | last post by:
I'm not sure where to physically place my subroutines in vb.net I get namespace and not declared errors... Imports System Imports System.Management Public Class Form1
1
by: JJG | last post by:
Hello. I'm not sure if this is the right forum, so please let me know what is the correct one if it isn't. (I posted this one also to the win32.programmer.wmi forum). I've been puzzled by this...
1
by: james | last post by:
I am attempting to write a VB.net program to alter remote registeries. I am familiar with VBScript and so I was using WMI to connect to remote machines. How would I do this in VB.Net? I got this...
2
by: Brx | last post by:
I am having an issue using WMI StdRegProv in a class that I'm creating to make it easer to access remote registries. It works great the first time I create and access it, but if I create a second...
4
by: Lalit | last post by:
Hi, how can we get registry settings of a computer within local network using WMI? Lalit
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.