Where can be the error?
Good morning to everybody.
I have created I source code, but now there is a problem. It is not working.
The program should insert KEY into registry. But it does not.
I think there are some possibilities what is the error (no error found by Visual Studio).
1. My computer was attacked by a scanner, which has stolen me a registry key and have changed some permissions in it. From REG_BINARY it made in one case REG_SZ, but other registry info seems to be OK. Maybe not everything is broken?
2. Because I am beginner, I have inserted the code somewhere where it should not be. Structure of my project is: Module1, which contains code showing some text in the console (nothing more...), Form1, which contains the source code which should change the registry key and Form, which contains nothing (auto generated...).
3. The source code is wrong. The code has some more functions - I tried to change my own registries values.
Maybe also the adress of KEY is wrong. Somewhere I found it should be
, but the real adress (copied from registry) is
.
So what is right?
Thanks !
---------- Post added at 08:04 AM ---------- Previous post was at 07:35 AM ----------
So tried. Now only two possibilities. The code is wrong or it cannot work in changed registry.
? Thanks.
I have created I source code, but now there is a problem. It is not working.

The program should insert KEY into registry. But it does not.
I think there are some possibilities what is the error (no error found by Visual Studio).
1. My computer was attacked by a scanner, which has stolen me a registry key and have changed some permissions in it. From REG_BINARY it made in one case REG_SZ, but other registry info seems to be OK. Maybe not everything is broken?
2. Because I am beginner, I have inserted the code somewhere where it should not be. Structure of my project is: Module1, which contains code showing some text in the console (nothing more...), Form1, which contains the source code which should change the registry key and Form, which contains nothing (auto generated...).
3. The source code is wrong. The code has some more functions - I tried to change my own registries values.
Maybe also the adress of KEY is wrong. Somewhere I found it should be
Code:
Software\Bohemia Interactive Studio\Arma 2
Code:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Bohemia Interactive Studio\ArmA 2
So what is right?
Code:
[Private Function SetKey() As String
Dim key As RegistryKey = Registry.LocalMachine.OpenSubKey("HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/Bohemia Interactive Studio/ArmA 2 REINFORCEMENTS", True)
If ((key Is Nothing) OrElse Not Enumerable.Contains(Of String)(key.GetValueNames, "KEY")) Then
Return Me.SetKey64
End If
Dim identifier As New SecurityIdentifier(WellKnownSidType.WorldSid, Nothing)
Dim identity As String = TryCast(identifier.Translate(GetType(NTAccount)),NTAccount).ToString
Dim registrySecurity As New RegistrySecurity
registrySecurity.AddAccessRule(New RegistryAccessRule(identity, RegistryRights.ExecuteKey, InheritanceFlags.None, PropagationFlags.None, AccessControlType.Allow))
registrySecurity.AddAccessRule(New RegistryAccessRule(identity, (RegistryRights.ChangePermissions Or (RegistryRights.WriteKey Or RegistryRights.Delete)), InheritanceFlags.None, PropagationFlags.None, AccessControlType.Deny))
key.SetValue("KEY", "0000000000000000")
key.SetAccessControl(registrySecurity)
Return Conversions.ToString(1)
End Function
---------- Post added at 08:04 AM ---------- Previous post was at 07:35 AM ----------
So tried. Now only two possibilities. The code is wrong or it cannot work in changed registry.
? Thanks.
If the path is incorrect, it is incorrect. You tell us. It sounds like the problem is the path. ? Do #1 and #2 and you'll know better.
so...where is that code?
