473,385 Members | 1,453 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,385 software developers and data experts.

Saving to Registry after upgrade

LDD
Hey folks

I'm upgrading an existing application from VB6 to VB.Net
It's a slow painful process, and there isn't time to rewrite it.
I'm using RegCreateKeyEx(...) to save some data to the registry.
I'm getting Error 1314 and can't seem to find much useful info on this.

If anyone has any information that can help me out that would be great.
Definition:
Public Declare Function RegCreateKeyEx Lib "advapi32.dll" Alias
"RegCreateKeyExA" (ByVal hKey As Integer, ByVal lpSubKey As String, ByVal
Reserved As Integer, ByVal lpClass As String, ByVal dwOptions As Integer,
ByVal samDesired As Integer, ByRef lpSecurityAttributes As
SECURITY_ATTRIBUTES, ByRef lphkResult As Integer, ByRef lpdwDisposition As
Integer) As Integer
Thanks folks

LDD
Nov 21 '05 #1
3 1115
"LDD" <la***************@gmail.com> schrieb:
I'm upgrading an existing application from VB6 to VB.Net
It's a slow painful process, and there isn't time to rewrite it.
I'm using RegCreateKeyEx(...) to save some data to the registry.
I'm getting Error 1314 and can't seem to find much useful info on this.


How do you call the function?

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 21 '05 #2
LDD
Here is where it gets called from.

Public Sub gSetRegParamString(ByRef rlHKey As Integer, ByRef rsSubKey As
String, ByRef rsPropertyName As String, ByRef rsPropertyValue As String)

Dim plRC As Integer
Dim plNewHKey As Integer
Dim psSubKey As String
Dim plOpenKey As Integer

'New for create key
Dim plDispositionBuffer As Integer
Dim SA As SECURITY_ATTRIBUTES

RegCreateKeyEx(HKEY_LOCAL_MACHINE, rsSubKey, 0, vbNullString,
REG_OPTION_NON_VOLATILE, KEY_WRITE, SA, plNewHKey, plDispositionBuffer)
.....

End Sub

I know it's something I'm overlooking...

LDD

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:eY**************@TK2MSFTNGP10.phx.gbl...
"LDD" <la***************@gmail.com> schrieb:
I'm upgrading an existing application from VB6 to VB.Net
It's a slow painful process, and there isn't time to rewrite it.
I'm using RegCreateKeyEx(...) to save some data to the registry.
I'm getting Error 1314 and can't seem to find much useful info on this.


How do you call the function?

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3
Hi dude,

Your declaration seems to be OK, however I would use this one:

~
Public Declare Auto Function RegCreateKeyEx Lib "advapi32.dll" ( _
ByVal hKey As IntPtr, _
<MarshalAs(UnmanagedType.LPTStr), [In]()> ByVal lpSubKey As String,
_
ByVal Reserved As Integer, _
<MarshalAs(UnmanagedType.LPTStr)> ByVal lpClass As StringBuilder, _
ByVal dwOptions As Integer, _
ByVal samDesired As Integer, _
ByRef lpSecurityAttributes As SECURITY_ATTRIBUTES, _
ByRef phkResult As IntPtr, _
ByRef lpdwDisposition As Integer _
)
~

Anyway, this is a matter of liking.

Are you trying to pass NULL to lpSecurityAttributes? If yes, then you
should include overloaded version of your Declare statement with
lpSecurityAttributes declared as IntPtr and then pass IntPtr.Zero to it.

Error 1314 (ERROR_PRIVILEGE_NOT_HELD) means "A required privilege is not
held by the client.", so you may want to check your rights.

If it doesn't work, provide your SECURITY_ATTRIBUTES declaration please.

HTH,
Roman

"LDD" <la***************@gmail.com> сообщил/сообщила в новостях
следующее: news:2L********************@magma.ca...
Hey folks

I'm upgrading an existing application from VB6 to VB.Net
It's a slow painful process, and there isn't time to rewrite it.
I'm using RegCreateKeyEx(...) to save some data to the registry.
I'm getting Error 1314 and can't seem to find much useful info on this.
If anyone has any information that can help me out that would be great. Definition:
Public Declare Function RegCreateKeyEx Lib "advapi32.dll" Alias
"RegCreateKeyExA" (ByVal hKey As Integer, ByVal lpSubKey As String, ByVal Reserved As Integer, ByVal lpClass As String, ByVal dwOptions As Integer, ByVal samDesired As Integer, ByRef lpSecurityAttributes As
SECURITY_ATTRIBUTES, ByRef lphkResult As Integer, ByRef lpdwDisposition As Integer) As Integer
Thanks folks

LDD

Nov 21 '05 #4

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

Similar topics

4
by: Amitabh Deepak | last post by:
Is there any way to check whether daylight saving is enabled on a linux machine?
2
by: manning_news | last post by:
Has anyone had a problem with Access 2003 not saving their coding? I've been using 2003 for a couple of months now and just this week noticed that some coding I'd done for a database was not there...
3
by: Ed P. | last post by:
Hello...I currently have a OpenFileDialog object that I will use to get the path of an Access Database. I would like to save the path of the database (ie c:\MyDatabase.mdb) to the registry so that I...
3
by: Ed P. | last post by:
I am trying to save a location to a database using the registry...I've been successful in this, but is there another way I can save this. I have searched on the net and have found that saving the...
16
by: Larry Woods | last post by:
I need to persist user selections. I know that I can use the Registry, but I was hoping that there was some sort of "text based" solution. TIA, Larry Woods
4
by: Amjad | last post by:
Hi, I'm trying to create dynamic default values in TextBoxes that reflect the last user's input value. How can I save the user's input in a textbox control so that the user can see his last...
4
by: Husam | last post by:
Hi EveryBody: Is there any way to save my text file in Registry Key instaed of saving it in Drive C: or any other drive drive ? any help will be appreciated regard's Husam
9
by: Newbie Coder | last post by:
Hello Newsgroup Readers I would like to know how to go & do the following: I have a certain registry key that has sub values Example: Key1 http://www.microsoft.com Key2 ...
14
by: Newbie Coder | last post by:
Hi all, VB.NET 2003 ONLY PLEASE I have a registry key (HKCU\Software\Newbie\SomeKey) of type string which holds an XML string as follows: <root formID="preferencesform" lang="english" ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.