Autor Beitrag
Gary 0n T0ur
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 17



BeitragVerfasst: Di 28.12.10 09:40 
Hallo,

Könnt Ihr mir erklären wie man in C# in der Registry einen Key Wert ändert z.B. den Key "Test" mit dem Wert "1" ändern in den Wert "0" der in z.B. LOCAL MACHINE und vom Typ DWORD ist.

Hab in Google ein paar Sachen gefunden aber hat leider nie funktioniert.
z.B. csharp-tricks.blogsp...gistry-tutorial.html hat bei mir nicht funktioniert.

vielen Dank!

MFG GARY


Moderiert von user profile iconKha: Topic aus C# - Die Sprache verschoben am Di 28.12.2010 um 09:46
c#surfer
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 42
Erhaltene Danke: 2



BeitragVerfasst: Di 28.12.10 11:42 
was hat denn nicht funktioniert? Gab es eine Fehlermeldung?
Für das Schreiben in HKEY_LOCAL_MACHINE benötigst du Admin-Rechte.
Gary 0n T0ur Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 17



BeitragVerfasst: Di 28.12.10 11:56 
Fehlermeldung gab es keine es basierte nichts der Wert des Keys hat sich nicht geändert aber auch keine Fehlermeldung.
Das mit den Admin-Rechten hab ich mir auch schon mal gedacht arbeite mit einen Konto mit Benutzerrechten :!:
Werde es versuchen wenn ich zu Hause bin. :wink:

Melde mich dann wieder
Gary
Gary 0n T0ur Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 17



BeitragVerfasst: Mi 29.12.10 17:53 
Hallo euch allen,

ich hab jetzt mal das Ganze als Admin ausgeführt da kommt dann leider ein Fehler!

ausblenden C#-Quelltext
1:
Registry.SetValue(@"HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Authentication\\LogonUI\\Background\\OEMBackground""1""OEMBackground");					


ausblenden C#-Quelltext
1:
using Microsoft.Win32;					

Hab ich hinzugefügt :lol:


ich glaube fast zu 100% das das falsch ist :oops: könnt ihr mir das erklären thx @all :D

Mfg Gary
Greenberet
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 339
Erhaltene Danke: 20

Win 10
C# (VS 2012), C++ (VS 2012/GCC), PAWN(Notepad++), Java(NetBeans)
BeitragVerfasst: Mi 29.12.10 18:09 
user profile iconGary 0n T0ur hat folgendes geschrieben Zum zitierten Posting springen:
Hallo euch allen,

ich hab jetzt mal das Ganze als Admin ausgeführt da kommt dann leider ein Fehler!


und welcher?
Gary 0n T0ur Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 17



BeitragVerfasst: Mi 29.12.10 18:49 
user defined image

mfg
Greenberet
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 339
Erhaltene Danke: 20

Win 10
C# (VS 2012), C++ (VS 2012/GCC), PAWN(Notepad++), Java(NetBeans)
BeitragVerfasst: Mi 29.12.10 19:01 
Steht doch da: "Pfadname ist ungültig".

Überprüf doch mal ob der Pfad in der Registry existiert. ( z.b. mit regedit )
Th69
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Moderator
Beiträge: 4764
Erhaltene Danke: 1052

Win10
C#, C++ (VS 2017/19/22)
BeitragVerfasst: Mi 29.12.10 19:12 
Hallo,

entweder "...\\..." oder @"...\...", aber nicht beides -)
Gary 0n T0ur Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 17



BeitragVerfasst: Mi 29.12.10 19:25 
Zitat:
entweder "...\\..." oder @"...\...", aber nicht beides -)


hab ich gemacht alles überprüft und jetzt sieht das ganze so aus

ausblenden C#-Quelltext
1:
Registry.SetValue("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Authentication\\LogonUI\\Background""1""OEMBackground");					


jetzt kommt kein fehler mehr (Admin-Rechte) aber noch immer bleibt der Key-Wert auf 0 und nicht auf 1

Mfg Gary
Th69
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Moderator
Beiträge: 4764
Erhaltene Danke: 1052

Win10
C#, C++ (VS 2017/19/22)
BeitragVerfasst: Mi 29.12.10 19:37 
Hallo nochmals,

vertausche mal die letzten beiden Parameter ("OEMBackground" ist doch der Key-Name und "1" der Wert, oder?) ...
Gary 0n T0ur Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 17



BeitragVerfasst: Mi 29.12.10 19:45 
Stimmt OEMBackground ist der Key Name und 1 ist der Wert.

Hab ich gemacht aber leider wieder nichts geholfen.

MFG
c#surfer
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 42
Erhaltene Danke: 2



BeitragVerfasst: Mi 29.12.10 21:11 
sollte aber, ich habs eben getestet, funktioniert auch ohne Admin-Rechte:

ausblenden C#-Quelltext
1:
Registry.SetValue("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Authentication\\LogonUI\\Background""OEMBackground","1");					
Gary 0n T0ur Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 17



BeitragVerfasst: Mi 29.12.10 22:45 
@C#surfer

Kannst du mir mal den ganzen Quelltext geben wäre sehr dankbar.

thx

Gary
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19276
Erhaltene Danke: 1741

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mi 29.12.10 22:47 
Ich rate einmal:
  • Du hast ein 64-Bit System
  • Du erstellst eine 32-Bit Exe
  • Du schaust unter dem genannten Pfad in der Registry statt dem für 32-Bit Software
Schau einfach einmal in dem korrekten Pfad, da steht der Wert auch...
ausblenden Quelltext
1:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background					
Gary 0n T0ur Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 17



BeitragVerfasst: Mi 29.12.10 23:13 
Ja ich hab ein 64 Bit sys
aber wie kann ich jetzt trotzdem den Key ändern:
ausblenden C#-Quelltext
1:
HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Authentication\\LogonUI\\Background					


Bei dem hat es zumindest den Key-Wert geändert aber er hat nicht die gleiche Wirkung wie der andere!
ausblenden C#-Quelltext
1:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background					


Wie kann ich jetzt den anderen ändern?

vielen Dank schon mal !!!

Gary
c#surfer
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 42
Erhaltene Danke: 2



BeitragVerfasst: Do 30.12.10 00:14 
ich befürchte, dann wird es nur aufwendig über WinAPI gehen, beschrieben in How to remotely access the Win64 registry from a Win32 machine in managed code (Part II)
Kha
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3803
Erhaltene Danke: 176

Arch Linux
Python, C, C++ (vim)
BeitragVerfasst: Do 30.12.10 02:00 
Oder man stellt das Platform Target einfach auf AnyCPU, damit die Exe als 64-Bit-Prozess gestartet wird.

_________________
>λ=
Gary 0n T0ur Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 17



BeitragVerfasst: Do 30.12.10 22:27 
Danke @all :D

aber besonderen Dank @KHA :D :D

user profile iconKha hat folgendes geschrieben Zum zitierten Posting springen:
Oder man stellt das Platform Target einfach auf AnyCPU, damit die Exe als 64-Bit-Prozess gestartet wird.


hat super funktioniert hab es auf AnyCPU gestellt und sehe da der Key-Wert hat sich geändert.

MFG Gary