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