Your best source of information and news about windows vista , BIOS and software on the internet Su mejor fuente de información y noticias acerca de Windows Vista, BIOS y de software en Internet

Vista ARTICLES Vista ARTÍCULOS TOP 50 TOP 50 Vista VIDEOS Vista VIDEOS Vista SOFT Vista SOFT Vista HELP Vista AYUDA

In Vista, How Does the FLAGS Switch of REG.EXE Work? En Vista, ¿Cómo Cambiar las banderas de REG.EXE trabajo?


Note: this content originally from Nota: este contenido originario 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 está leyendo desde algún otro sitio, por favor, tómese el tiempo para visitar My Green Paste, Inc Mi pasta verde, Inc . . Thank you. Gracias.


A while back, there was a topic ( Un tiempo, hubo un tema ( Virtual Registry vs. "Real registry" Secretaría Virtual vs Real registro " ) in the ) En la Sysinternals Forums Sysinternals Foros 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. que plantearon la cuestión de cómo configurar la virtualización relacionada con las banderas de una clave de registro en forma programada Vista, en lugar de mediante el uso de la herramienta de REG.EXE BANDERAS cambiar. (For more information on the flags, see (Para obtener más información sobre las banderas, véase Mark Russinovich Mark Russinovich 's article in TechNet Magazine, " 's artículo en la revista TechNet, " Inside Windows Vista User Account Control Dentro de Windows Vista cuenta de usuario de 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.) "). Incluso antes de ese tema en el foro, me ha preguntado cómo se ha hecho pero no había tenido la oportunidad de explorar. No parece que muchos otros fueron curiosidad sobre ella. Ese tema había resucitado la idea, pero rápidamente cayó a la parte inferior de la lista. finalmente he llegado a experimentar de todo, y que conduce a esta escritura. todavía no veo mucho en el camino de este discutido en cualquier lugar, mediante la búsqueda de términos implicados (tipos de datos, función param nombres, etc), así que esperemos que esto ayude a alguien. (Tenga en cuenta que muy bien puede ser una razón, Microsoft no ha hecho esto se encuentra disponible a través de otra, más directa 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. En el tema de referencia, yo había llegado hasta ahora como la determinación de REG.EXE que estaba haciendo su trabajo a través del uso de NtSetInformationKey, un "indocumentado" en NTDLL.DLL API.


 NTSYSAPI 

NTSTATUS

NTAPI

NtSetInformationKey( NtSetInformationKey (

IN HANDLE KeyHandle, A manejar KeyHandle,

IN KEY_SET_INFORMATION_CLASS InformationClass, En KEY_SET_INFORMATION_CLASS InformationClass,

IN PVOID KeyInformationData, En 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. Después de un poco de plonking en torno a WinDbg, he llegado hasta con los siguientes datos siguientes. REG.EXE calls REG.EXE llamadas NtSetInformationKey , specifying a value of 2 for the InformationClass parameter. , Especificando un valor de 2 para el InformationClass parámetro. This parameter is of type KEY_SET_INFORMATION_CLASS, which wdm.h tells us is an enum: Este parámetro es de tipo KEY_SET_INFORMATION_CLASS, wdm.h que nos dice es 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 debe ser siempre el último enum

} KEY_SET_INFORMATION_CLASS; KEY_SET_INFORMATION_CLASS);


So the 2 for the InformationClass parameter would correspond to KeyControlFlagsInformation. Por lo tanto, el 2 de la InformationClass parámetro correspondería a KeyControlFlagsInformation. WDM.H also suggests that this class has a type that one passes for the KeyInformationData parameter - KEY_CONTROL_FLAGS_INFORMATION: WDM.H también sugiere que esta clase tiene un tipo que se pasa por el parámetro 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. Tenemos una idea básica de cómo llamar a NtSetInformationKey ahora. But what are the values that the ControlFlags member of KEY_CONTROL_FLAGS_INFORMATION can be set to? Pero, ¿cuáles son los valores que la ControlFlags miembro de KEY_CONTROL_FLAGS_INFORMATION se puede ajustar a? 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): Parece que el siguiente (self made) enum cubre el pabellón pertinente - por lo menos aquellos REG.EXE BANDERAS puede manejar (puede haber más):


 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. Los indicadores de control son una máscara de bits, por lo que puede Oregón a establecer más de uno.


Now that we have this information, what's left? Ahora que tenemos esta información, lo que queda? We need to put it all together in a call to NtSetInformationKey. Tenemos que poner todo junto en una llamada a NtSetInformationKey. So, we need to get a pointer to the function in NTDLL.DLL. Por lo tanto, tenemos que obtener un puntero a la función en 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. Entonces, podemos declarar una estructura de tipo KEY_CONTROL_FLAGS_INFORMATION, el conjunto ControlFlags miembro que será lo que queremos, y abrir una clave para la ubicación deseada en el registro, que puede transmitirse a NtSetInformationKey. In the end, we wind up with something like the following (error handling has been omitted): Al final, cerrar con algo como lo siguiente (el manejo de errores se ha omitido):


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

HANDLE KeyHandle, ASAS 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 \ \ Sea cual sea"), 0, KEY_ALL_ACCESS, & hTheKey);

ntsik( hTheKey, KeyControlFlagsInformation, &kcfi, sizeof( KEY_CONTROL_FLAGS_INFORMATION ) ); ntsik (hTheKey, KeyControlFlagsInformation, y 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 . El código anterior es el equivalente de invocar REG.EXE BANDERAS HKLM \ Software \ Sea cual sea SET DONT_VIRTUALIZE RECURSE_FLAGS. To clear the flags, just set kcfi.ControlFlags to RegKeyClearFlags (same as REG.EXE FLAGS HKLM\Software\Whatever SET) . Para borrar las banderas, acaba de kcfi.ControlFlags a RegKeyClearFlags (igual que REG.EXE BANDERAS HKLM \ Software \ Sea cual sea SET).

Hopefully, this will prove useful to those that have wished to set these flags programmatically. Cabe esperar que esto resulte útil a aquellos que han querido establecer estos parámetros de programación. In a future post, I hope to explore querying for these flags, ala REG.EXE FLAGS HKLM\Software\Whatever QUERY . En un futuro post, espero a explorar para consultar estas banderas, ala REG.EXE BANDERAS HKLM \ Software \ Sea cual sea la consulta.


Note that this exploration was done on Windows Vista SP1. Tenga en cuenta que esta exploración se realizó en el SP1 de Windows Vista. I would expect the content here to also apply to Windows Vista (no SP) as well as Windows Server 2008, but... Espero que el contenido aquí también se aplican a Windows Vista (no SP), así como Windows Server 2008, pero ...

Popularity: 4% Popularity: 4%


Written by «/\/\Ø|ö±ò\/»®©. Escrito por el  «/ \ / \ à ~ |  ¶ à ± à ² \ / »  ®  ©. Read more great feeds at is source Leer más grandes se alimenta de la fuente WEBSITE SITIO WEB
no comments No hay comentarios . .
Read more articles on Leer más artículos sobre flags banderas and y NtSetInformationKey NtSetInformationKey and y REG_KEY_DONT_VIRTUALIZE REG_KEY_DONT_VIRTUALIZE and y Sysinternals Forum Sysinternals Foro and y reg.exe flags reg.exe banderas and y registry virtualization registro de virtualización and y reg Reg and y REG_KEY_DONT_SILENT_FAIL REG_KEY_DONT_SILENT_FAIL and y Troubleshooting Solución de problemas and y vista Vista and y windbg windbg and y otherSoftware otherSoftware and y registry registro and y Virtualization Virtualización . .

No comments No hay comentarios

There are still no comments on this article. Todavía no hay comentarios sobre este artículo.

Leave your comment... Deja tu comentario ...

If you want to leave your comment on this article, simply fill out the next form: Si quieres dejar tu comentario sobre este artículo, tan sólo debe rellenar el siguiente formulario:




You can use these XHTML tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong> . Puede utilizar estas etiquetas XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i > <strike> <strong>.