Your best source of information and news about windows vista , xp and Vista hardware on the internet Votre meilleure source d'informations et actualités sur Windows Vista, XP et Vista matériel sur Internet

Vista ARTICLES Vista ARTICLES TOP 50 TOP 50 Vista VIDEOS Vista VIDÉOS Vista SOFT Vista SOFT Vista HELP Vista AIDE

In Vista, How Does the FLAGS Switch of REG.EXE Work? Dans Vista, comment les drapeaux REG.EXE Changement de travail?


Note: this content originally from Note: ce contenu originaire de http://mygreenpaste.blogspot.com http://mygreenpaste.blogspot.com . . If you are reading it from some other site, please take the time to visit Si vous êtes lecture de certains autres sites, s’il vous plaît prendre le temps de visiter My Green Paste, Inc Ma pâte verte, Inc . . Thank you. Merci.


A while back, there was a topic ( Un peu en arrière, il y avait un thème ( Virtual Registry vs. "Real registry" Registre virtuel ou "Real registre" ) in the ) Dans l' Sysinternals Forums Sysinternals Forums 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. qui a soulevé la question de savoir comment définir la virtualisation liées drapeaux d'une clé de registre programmation dans Vista, plutôt que par l'utilisation de l'outil REG.EXE DRAPEAUX passer. (For more information on the flags, see (Pour plus d'informations sur les drapeaux, voir Mark Russinovich Mark Russinovich 's article in TechNet Magazine, " de l 'article TechNet Magazine " Inside Windows Vista User Account Control Inside Windows Vista contrôle de compte d'utilisateur "). 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.) "). Même avant que sujet dans le forum, je s'est demandé comment il a été fait, mais n'avaient pas eu la chance d'explorer. Il ne semble pas que beaucoup d'autres étaient curieux à ce sujet. Cette question a ressuscité l'idée, mais il est rapidement est tombé sur le bas de la liste. J'ai finalement obtenu autour à l'expérimentation, et qui conduit à ce publi-reportage. je n'ai toujours pas voir beaucoup discuté de ce n'importe où, par la recherche de termes en cause (les types de données, param noms de fonction,…), afin que ce sera je l'espère aider quelqu'un. (N'oubliez pas qu'il existe mai très bien être une raison de Microsoft n'a pas fait de cette disposition par une autre, plus direct 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. Au sujet de la référence, j'avais obtenu à ce jour que la détermination que REG.EXE fait de son travail grâce à l'utilisation de NtSetInformationKey, un "sans papiers" API en NTDLL.DLL.


 NTSYSAPI 

NTSTATUS

NTAPI

NtSetInformationKey( NtSetInformationKey (

IN HANDLE KeyHandle, KeyHandle EN MANCHE,

IN KEY_SET_INFORMATION_CLASS InformationClass, Dans KEY_SET_INFORMATION_CLASS InformationClass,

IN PVOID KeyInformationData, Dans PVOID KeyInformationData,

IN ULONG DataLength ); EN DataLength ULONG);


After a bit of plonking around in WinDbg, I've come up with the following following details. Après un peu autour de plonking dans WinDbg, je suis venu avec ces précisions suivantes. REG.EXE calls REG.EXE appels NtSetInformationKey , specifying a value of 2 for the InformationClass parameter. , En spécifiant une valeur de 2 pour le paramètre InformationClass. This parameter is of type KEY_SET_INFORMATION_CLASS, which wdm.h tells us is an enum: Ce paramètre est de type KEY_SET_INFORMATION_CLASS, qui nous dit wdm.h est un 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 devrait toujours être le dernier enum

} KEY_SET_INFORMATION_CLASS; KEY_SET_INFORMATION_CLASS);


So the 2 for the InformationClass parameter would correspond to KeyControlFlagsInformation. Ainsi, le 2 pour le paramètre InformationClass correspondrait à KeyControlFlagsInformation. WDM.H also suggests that this class has a type that one passes for the KeyInformationData parameter - KEY_CONTROL_FLAGS_INFORMATION: WDM.H suggère également que cette classe a un type qui un laissez-passer pour le paramètre KeyInformationData - 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. Nous avons une idée de base de comment appeler NtSetInformationKey maintenant. But what are the values that the ControlFlags member of KEY_CONTROL_FLAGS_INFORMATION can be set to? Mais quelles sont les valeurs que le ControlFlags membre de KEY_CONTROL_FLAGS_INFORMATION peut être réglé? 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): Il semblerait que les éléments suivants (self-made) enum couvre pertinentes drapeaux - au moins ceux REG.EXE DRAPEAUX peut gérer (mai il être plus):


 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. Les indicateurs de contrôle sont un masque, si vous pouvez ou à se fixer plus d'un.


Now that we have this information, what's left? Maintenant que nous avons cette information, ce qui reste? We need to put it all together in a call to NtSetInformationKey. Nous avons besoin de les mettre tous ensemble dans un appel à NtSetInformationKey. So, we need to get a pointer to the function in NTDLL.DLL. Donc, nous avons besoin pour obtenir un pointeur vers la fonction dans 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. Ensuite, nous pouvons déclarer une structure de type KEY_CONTROL_FLAGS_INFORMATION, réglez le ControlFlags membre à ce que nous voulons, et d'ouvrir une clé à l'emplacement souhaité dans le registre, qui peut être transmise à NtSetInformationKey. In the end, we wind up with something like the following (error handling has been omitted): En fin de compte, nous retrouve avec quelque chose comme ce qui suit (la gestion des erreurs a été omis):


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

HANDLE KeyHandle, KeyHandle MANCHE,

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 \ \ Quelle que soit"), 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 . Le code ci-dessus est l'équivalent d'invoquer REG.EXE DRAPEAUX HKLM \ Software \ Quelle que soit SET DONT_VIRTUALIZE RECURSE_FLAGS. To clear the flags, just set kcfi.ControlFlags to RegKeyClearFlags (same as REG.EXE FLAGS HKLM\Software\Whatever SET) . Pour effacer les drapeaux, viennent de kcfi.ControlFlags à RegKeyClearFlags (le même que REG.EXE DRAPEAUX HKLM \ Software \ Quelle que soit SET).

Hopefully, this will prove useful to those that have wished to set these flags programmatically. Il faut espérer que ce sera utile à ceux qui ont voulu définir ces drapeaux programmation. In a future post, I hope to explore querying for these flags, ala REG.EXE FLAGS HKLM\Software\Whatever QUERY . Dans un futur post, je l'espère, à étudier les requêtes de ces drapeaux, ala REG.EXE DRAPEAUX HKLM \ Software \ Quelle que soit la requête.


Note that this exploration was done on Windows Vista SP1. Il est à noter que cette exploration a été réalisée sur Windows Vista SP1. I would expect the content here to also apply to Windows Vista (no SP) as well as Windows Server 2008, but... Je voudrais que le contenu ici pour s'appliquent également à Windows Vista (pas SP), ainsi que Windows Server 2008, mais ...

Popularity: 6% Popularité: 6%


Written by «/\/\Ø|ö±ò\/»®©. Ecrit par  «/ \ / \ ~ à | à ¶  ± à ² \ / »  ®  ©. Read more great feeds at is source Lire plus grand flux à la source est WEBSITE SITE WEB
no comments pas de commentaire . .
Read more articles on Lire la suite d'articles sur flags drapeaux and et NtSetInformationKey NtSetInformationKey and et REG_KEY_DONT_VIRTUALIZE REG_KEY_DONT_VIRTUALIZE and et Sysinternals Forum Sysinternals Forum and et reg.exe flags reg.exe drapeaux and et registry virtualization registre de virtualisation and et reg Reg and et REG_KEY_DONT_SILENT_FAIL REG_KEY_DONT_SILENT_FAIL and et Troubleshooting Dépannage and et vista Vista and et windbg WinDbg and et otherSoftware otherSoftware and et registry registre and et Virtualization Virtualisation . .

No comments Pas de commentaires

There are still no comments on this article. Il n'ya pas encore de commentaires sur cet article.

Leave your comment... Laissez votre commentaire ...

If you want to leave your comment on this article, simply fill out the next form: Si vous souhaitez laisser votre commentaire sur cet article, il suffit de remplir le formulaire suivant:




You can use these XHTML tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong> . Vous pouvez utiliser ces balises XHTML: <a href="" title="fete_christel <abbr title="fete_christel <acronym title="fete_christel <b> <blockquote cite=""> <code> <em> <i > <strike> <strong>.