Your best source of information and news about hardware , drivers and microsoft on the internet Ihre beste Quelle von Informationen und Neuigkeiten rund um Hardware, Treiber und Microsoft im Internet

Vista ARTICLES Vista ARTIKELN TOP 50 TOP 50 Vista VIDEOS Vista VIDEOS Vista SOFT Vista-SOFT Vista HELP Vista-Hilfe

In Vista, How Does the FLAGS Switch of REG.EXE Work? In Vista, Wie funktioniert die Fahnen Switch von Reg.exe Arbeit?


Note: this content originally from Hinweis: Die Inhalte dieser ursprünglich aus http://mygreenpaste.blogspot.com http://mygreenpaste.blogspot.com . . If you are reading it from some other site, please take the time to visit Wenn Sie gerade lesen sie aus einigen anderen Seite, nehmen Sie sich bitte die Zeit für einen Besuch My Green Paste, Inc Meine grüne Paste, Inc . . Thank you. Danke.


A while back, there was a topic ( Ein einiger Zeit gab es ein Thema ( Virtual Registry vs. "Real registry" Virtuelle vs der Registry "Real-Registrierung" ) in the ) In der Sysinternals Forums Sysinternals Foren that brought up the question of how to set the virtualization-related flags of a registry key programmatically in Vista, rather than through the use of the REG.EXE tool's FLAGS switch. brachte die Frage auf, wie man die Virtualisierungs-Flags eines Registrierungsschlüssels programmatisch in Vista, anstatt durch den Einsatz der Reg.exe Tool's FLAGS-Schalter. (For more information on the flags, see (Für weitere Informationen über die Flags, siehe Mark Russinovich Mark Russinovich 's article in TechNet Magazine, " 's Artikel in TechNet-Magazin, " Inside Windows Vista User Account Control Inside Windows Vista User Account Control "). Even before that topic in the forum, I had wondered how it was done but had not had a chance to explore. It didn't seem that many others were curious about it. That topic had resurrected the idea, but it quickly fell to the bottom of the list. I've finally gotten around to experimenting, and that leads to this write-up. I still don't see much in the way of this discussed anywhere, by searching for terms involved (data types, function param names, etc.), so hopefully this will help someone. (Keep in mind that there very well may be a reason Microsoft hasn't made this available through another, more direct API.) "). Auch vor diesem Thema im Forum, ich habe mich gewundert, wie es geschah, aber hatte keine Chance hatte zu erkunden. Es hat nicht den Anschein, dass viele andere waren neugierig auf ihn. Das Thema war wieder die Idee, aber es schnell fiel an das Ende der Liste. Ich habe endlich um zu experimentieren, und das führt zu dieser Zuschreibung. ich immer noch nicht viel in der Art und Weise dieser überall diskutiert, von der Suche nach Begriffen beteiligt (Datentypen, Funktion param Namen, usw.), so wird dies hoffentlich jemand helfen. (Denken Sie daran, dass es sehr gut, vielleicht ein Grund, Microsoft hat nicht dieses durch ein anderes, mehr direkte API.)


In the referenced topic, I had gotten so far as determining that REG.EXE was doing its work through the use of NtSetInformationKey, an "undocumented" API in NTDLL.DLL. In der referenzierten Thema, ich hatte mittlerweile so weit wie die Bestimmung, dass Reg.exe tat seine Arbeit durch den Einsatz von NtSetInformationKey, ein "undocumented" API in ntdll.dll.


 NTSYSAPI 

NTSTATUS

NTAPI

NtSetInformationKey( NtSetInformationKey (

IN HANDLE KeyHandle, KeyHandle im Griff,

IN KEY_SET_INFORMATION_CLASS InformationClass, In KEY_SET_INFORMATION_CLASS InformationClass,

IN PVOID KeyInformationData, In PVOID KeyInformationData,

IN ULONG DataLength ); IN ULONG datalength);


After a bit of plonking around in WinDbg, I've come up with the following following details. Nach ein bisschen plonking etwa in WinDbg, ich bin gekommen, sich mit den folgenden folgende Details. REG.EXE calls Reg.exe Anrufe NtSetInformationKey , specifying a value of 2 for the InformationClass parameter. , Wobei ein Wert von 2 für die InformationClass Parameter. This parameter is of type KEY_SET_INFORMATION_CLASS, which wdm.h tells us is an enum: Dieser Parameter ist vom Typ KEY_SET_INFORMATION_CLASS, die wdm.h sagt uns, ist eine ENUM:


 typedef enum _KEY_SET_INFORMATION_CLASS { typedef enum (_KEY_SET_INFORMATION_CLASS 

KeyWriteTimeInformation,

KeyWow64FlagsInformation,

KeyControlFlagsInformation,

KeySetVirtualizationInformation,

KeySetDebugInformation,

MaxKeySetInfoClass // MaxKeySetInfoClass should always be the last enum MaxKeySetInfoClass / / MaxKeySetInfoClass sollte immer das letzte enum

} KEY_SET_INFORMATION_CLASS; KEY_SET_INFORMATION_CLASS);


So the 2 for the InformationClass parameter would correspond to KeyControlFlagsInformation. Also die 2 für die InformationClass Parameter entsprechen würde KeyControlFlagsInformation. WDM.H also suggests that this class has a type that one passes for the KeyInformationData parameter - KEY_CONTROL_FLAGS_INFORMATION: WDM.H auch darauf hin, dass dieser Klasse hat eine Art, dass man für die KeyInformationData Parameter - KEY_CONTROL_FLAGS_INFORMATION:


 typedef struct _KEY_CONTROL_FLAGS_INFORMATION { typedef struct (_KEY_CONTROL_FLAGS_INFORMATION 

ULONG ControlFlags; ULONG ControlFlags;

} KEY_CONTROL_FLAGS_INFORMATION, *PKEY_CONTROL_FLAGS_INFORMATION; KEY_CONTROL_FLAGS_INFORMATION), * PKEY_CONTROL_FLAGS_INFORMATION;


We have a basic idea of how to call NtSetInformationKey now. Wir haben eine Grundidee, wie man jetzt anrufen NtSetInformationKey. But what are the values that the ControlFlags member of KEY_CONTROL_FLAGS_INFORMATION can be set to? Aber was sind die Werte, dass die ControlFlags Mitglied KEY_CONTROL_FLAGS_INFORMATION so eingestellt werden kann? It would appear that the following (self-made) enum covers the pertinent flags - at least the ones REG.EXE FLAGS can handle (there may be more): Es hat den Anschein, dass die folgenden (Eigenbau) enum bezieht sich auf die einschlägigen Flaggen - zumindest diejenigen Reg.exe FLAGS kann (es gibt vielleicht noch mehr):


 typedef enum _CONTROL_FLAGS { typedef enum (_CONTROL_FLAGS 

RegKeyClearFlags = 0, RegKeyClearFlags = 0,

RegKeyDontVirtualize = 2, RegKeyDontVirtualize = 2,

RegKeyDontSilentFail = 4, RegKeyDontSilentFail = 4,

RegKeyRecurseFlag = 8 RegKeyRecurseFlag = 8

} CONTROL_FLAGS; CONTROL_FLAGS);


The control flags are a bitmask, so you can OR them to set more than one. Die Steuer-Flags sind eine Bitmaske, sodass Sie können oder sie zu mehr als eins.


Now that we have this information, what's left? Jetzt, da wir diese Informationen haben, was ist links? We need to put it all together in a call to NtSetInformationKey. Wir müssen sie alle zusammen in einem Aufruf an NtSetInformationKey. So, we need to get a pointer to the function in NTDLL.DLL. Also müssen wir einen Zeiger auf die Funktion in ntdll.dll. Then, we can declare a struct of type KEY_CONTROL_FLAGS_INFORMATION, set the ControlFlags member to be what we wish, and open a key to the desired location in the registry, that can be passed to NtSetInformationKey. Dann können wir erklären, ein struct vom Typ KEY_CONTROL_FLAGS_INFORMATION, setzen Sie die ControlFlags Mitglied zu sein, was wir wollen, und öffnen Sie eine Taste an die gewünschte Stelle in der Registry, das kann an NtSetInformationKey. In the end, we wind up with something like the following (error handling has been omitted): Am Ende haben wir Wind mit so etwas wie das folgende (Fehlerbehandlung wurde weggelassen):


 typedef NTSYSAPI NTSTATUS (NTAPI* FuncNtSetInformationKey) ( typedef NTSYSAPI NTSTATUS (NTAPI * FuncNtSetInformationKey) ( 

HANDLE KeyHandle, HANDLE KeyHandle,

KEY_SET_INFORMATION_CLASS InformationClass, KEY_SET_INFORMATION_CLASS InformationClass,

PVOID KeyInformationData, PVOID KeyInformationData,

ULONG DataLength ); ULONG datalength);

//...

FuncNtSetInformationKey ntsik = (FuncNtSetInformationKey)GetProcAddress( FuncNtSetInformationKey ntsik = (FuncNtSetInformationKey) GetProcAddress (

GetModuleHandle( _T("ntdll.dll") ), "NtSetInformationKey" ); GetModuleHandle (_T ( "ntdll.dll")), "NtSetInformationKey");

KEY_CONTROL_FLAGS_INFORMATION kcfi = {0}; KEY_CONTROL_FLAGS_INFORMATION kcfi = (0);

kcfi.ControlFlags = RegKeyDontVirtualize | RegKeyRecurseFlag; kcfi.ControlFlags = RegKeyDontVirtualize | RegKeyRecurseFlag;

HKEY hTheKey = NULL; HKEY hTheKey = NULL;

RegOpenKeyEx( HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Whatever"), 0, KEY_ALL_ACCESS, &hTheKey ); RegOpenKeyEx (HKEY_LOCAL_MACHINE, _T ( "SOFTWARE \ \ Was auch immer"), 0, KEY_ALL_ACCESS, & hTheKey);

ntsik( hTheKey, KeyControlFlagsInformation, &kcfi, sizeof( KEY_CONTROL_FLAGS_INFORMATION ) ); ntsik (hTheKey, KeyControlFlagsInformation, & kcfi, sizeof (KEY_CONTROL_FLAGS_INFORMATION));

RegCloseKey( hTheKey ); RegCloseKey (hTheKey);

hTheKey = NULL; hTheKey = NULL;



The code above is the equivalent of invoking REG.EXE FLAGS HKLM\Software\Whatever SET DONT_VIRTUALIZE RECURSE_FLAGS . Der Code oben ist das Äquivalent der Berufung Reg.exe FLAGS HKLM \ Software \ Unabhängig SET DONT_VIRTUALIZE RECURSE_FLAGS. To clear the flags, just set kcfi.ControlFlags to RegKeyClearFlags (same as REG.EXE FLAGS HKLM\Software\Whatever SET) . So löschen Sie die Flaggen, gerade kcfi.ControlFlags zu RegKeyClearFlags (wie Reg.exe FLAGS HKLM \ Software \ Wie auch immer gesetzt).

Hopefully, this will prove useful to those that have wished to set these flags programmatically. Hoffentlich wird dies als nützlich erweisen an diejenigen, wollte diese Flaggen programmatisch. In a future post, I hope to explore querying for these flags, ala REG.EXE FLAGS HKLM\Software\Whatever QUERY . In einer Zukunft nach, ich hoffe, zu erkunden Abfrage für diese Fahnen, ala Reg.exe FLAGS HKLM \ Software \ Unabhängig Abfrage.


Note that this exploration was done on Windows Vista SP1. Beachten Sie, dass diese Erkundung erfolgte auf Windows Vista SP1. I would expect the content here to also apply to Windows Vista (no SP) as well as Windows Server 2008, but... Ich würde erwarten, dass die Inhalte hier zu gelten auch für Windows Vista (kein SP) sowie Windows Server 2008, aber ...

Popularity: 4% Popularity: 4%


Written by «/\/\Ø|ö±ò\/»®©. Geschrieben von  «/ \ / \ à ~ | à ¶  ± à ² \ / »  ®  ©. Read more great feeds at is source Lesen Sie mehr im großen RSS-Feeds ist Quelle WEBSITE WEBSITE
no comments keine Kommentare . .
Read more articles on Lesen Sie mehr Artikel über flags Flaggen and und NtSetInformationKey NtSetInformationKey and und REG_KEY_DONT_VIRTUALIZE REG_KEY_DONT_VIRTUALIZE and und Sysinternals Forum Sysinternals Forum and und reg.exe flags Reg.exe Flags and und registry virtualization Registrierung Virtualisierung and und reg reg and und REG_KEY_DONT_SILENT_FAIL REG_KEY_DONT_SILENT_FAIL and und Troubleshooting Fehlersuche and und vista Vista and und windbg windbg and und otherSoftware otherSoftware and und registry Registrierung and und Virtualization Virtualisierung . .

No comments Noch keine Kommentare

There are still no comments on this article. Es gibt noch keine Kommentare zu diesem Artikel.

Leave your comment... Lassen Sie Ihren Kommentar ...

If you want to leave your comment on this article, simply fill out the next form: Wenn Sie wollen, lassen Sie Ihren Kommentar zu diesem Artikel, füllen Sie einfach das nächste Formular aus:




You can use these XHTML tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong> . Sie können diese XHTML-Tags: <a href= title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i > <strike> <strong>.