473,386 Members | 1,886 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Having trouble with stdregprov and uintvalue..

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.
Const HKEY_current_user As Long = &H80000001

Dim strkeypath As Object = "Software\Microsoft\Internet Explorer\Main\mas"

Dim wmi As ManagementClass

Dim md As MethodData

Dim RemotePC As String

RemotePC = "."

wmi = New ManagementClass("\\" & RemotePC & "\root\default:StdRegProv")

Dim inParams As ManagementBaseObject = wmi.GetMethodParameters("Createkey")

inParams("hDefKey") = HKEY_current_user

inParams("sSubKeyName") = strkeypath

Dim outParams As ManagementBaseObject = wmi.InvokeMethod("Createkey",
inParams, Nothing)

' Display results

' Note: The return code of the method is provided in the "returnValue"
property of the outParams object

Console.WriteLine("Creation of registry returned: {0}",
outParams("returnValue"))


----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Jul 21 '05 #1
1 4058
Two answers:
- first and best one (to me): use C# which provides unsigned types (uint,
ulong, ...):
const uint HKEY_current_user = 0x80000001;

- second one: using VB, I wrote this horrible (but working) piece of code:
Const HKEY_current_user As String = "80000001"
...
inParams("hDefKey") = UInt32.Parse(HKEY_current_user,
System.Globalization.NumberStyles.HexNumber)

Maybe somebody will find a cleaner solution using VB ?...

Olivier DALET
----------------
"Text" <ma*@mas.com> a écrit dans le message de
news:40**********@127.0.0.1...
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.
Const HKEY_current_user As Long = &H80000001

Dim strkeypath As Object = "Software\Microsoft\Internet Explorer\Main\mas"

Dim wmi As ManagementClass

Dim md As MethodData

Dim RemotePC As String

RemotePC = "."

wmi = New ManagementClass("\\" & RemotePC & "\root\default:StdRegProv")

Dim inParams As ManagementBaseObject = wmi.GetMethodParameters("Createkey")
inParams("hDefKey") = HKEY_current_user

inParams("sSubKeyName") = strkeypath

Dim outParams As ManagementBaseObject = wmi.InvokeMethod("Createkey",
inParams, Nothing)

' Display results

' Note: The return code of the method is provided in the "returnValue"
property of the outParams object

Console.WriteLine("Creation of registry returned: {0}",
outParams("returnValue"))


----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption

=---
Jul 21 '05 #2

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

Similar topics

1
by: Anand | last post by:
Hi i am having trouble adding a recordset into the access database, the code seems to be working fine it passs and parses through all variables just fine without showing any errors and also when i...
1
by: ajackson | last post by:
i am having some trouble installing SQl server Reporting Services. well, in order to install the reporting services i have to install Service Pack 3a. so through my installation of package 3a i...
1
by: mr_burns | last post by:
hi there, Ive been having a few problems recently with this group. Im not sure if any of the other groups have been giving me trouble but recently this one has a couple of times, when attempting...
2
by: ed | last post by:
i'm having trouble with a form. I want to be able to type in the address of the form with the data for the form items in the URL (ie: http://somesite.com/formpage.html?field1=data1&field2=data2)....
1
by: Lauren Wilson | last post by:
I'm having trouble with the Access VBA help on my installation of A2K with Dev tools. Every time I try to retrieve help for items listed in the Object Browser (and SOME other items as well),...
0
by: scheru | last post by:
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...
0
by: Jozef | last post by:
Hello, I'm having trouble with the download links on my web server. The error I'm getting is; CGI Timeout The specified CGI application exceeded the allowed time for processing. The server...
2
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...
2
by: Stu | last post by:
Hi guys, I've been having trouble getting the clock function to work portably, please could I get some thoughts? <Possibly OT comments> It works fine on my laptop (under WinXP) and on my...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
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,...
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
Oralloy
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,...

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.