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 IWbemClassObjec t.
The code is as follows
BSTR bsClassName = SysAllocString( L"Root\\default :StdRegProv");
BSTR bsMethodName = SysAllocString( L"GetStringValu e");
pClass = NULL;
hres = pSvc->GetObject(bsCl assName, 0, NULL, &pClass, NULL);
pInParamsDefini tion = NULL;
hres = pClass->GetMethod(bsMe thodName, 0, NULL, &pInParamsDefin ition);
pClassInstance = NULL;
hres = pInParamsDefini tion->SpawnInstance( 0, &pClassInstance );
VARIANT var;
BSTR ArgName = SysAllocString( L"hDefKey");
// set registry root
VariantClear(&v ar);
var.vt = VT_I4;
var.lVal = 0x80000002;
hres = pClassInstance->Put(ArgName, 0, &var, 0);
// set registry key
VariantClear(&v ar);
var.vt = VT_BSTR;
var.bstrVal =
SysAllocString( L"SYSTEM\\Curre ntControlSet\\C ontrol\\CrashCo ntrol");
hres = pClassInstance->Put(L"sSubKeyN ame", 0, &var, 0);
// set registry key
VariantClear(&v ar);
var.vt = VT_BSTR;
var.bstrVal = SysAllocString( L"AutoReboot ");
hres = pClassInstance->Put(L"sValueNa me", 0, &var, 0);
VariantClear(&v ar);
DWORD dwValue = -1;
hres = pSvc->ExecMethod(bsC lassName, bsMethodName, 0,NULL, pClassInstance,
&pOutParams, NULL);
Are there any samples to do the something similar 0 1083 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 manifest, and I do have the correct permissions
with the user account that I am using...
The VB code works, so it is a issue with the python implementation...
|
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
processes current_user."
how do I pass a UInt32 value? Msdn has it listed as 0x80000001, but
vb.net won't except that. hDefKey only accepts uint32 values... or so it
seems.
|
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 try to collect the installed software via a
call to EnumKey, I get a type mismatch (the exact erro
is: "System.Runtime.InteropServices.COMException (0x80041005): Typ
mismatch"
|
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 of
strings.
I see some examples of VBScript that use the WMI registry provider to
write to the registry. Would this be possible to adapt to VB.NET.
I'm looking at this script right now:...
|
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
| |
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 a for a few days. I'm trying to read a registry
value from a remote system's registry using WMI (System.Management). I'm
able to connect to the system and even run a process, but I cannot figure out
what is I have to do to get the StdRegProv...
|
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 far..
======================================================
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btRDesktop.Click
Const HKEY_CURRENT_USER = &H80000001
|
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 instance of the class I get
the following error.
An unhandled exception of type 'System.Runtime.InteropServices.COMException'
occurred in microsoft.visualbasic.dll
Additional information: Unspecified error
|
by: Lalit |
last post by:
Hi,
how can we get registry settings of a computer within local network using
WMI?
Lalit
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |