Your best source of information and news about software , hardware and xp on the internet Sua melhor fonte de informação e notícias sobre software, hardware e xp na internet

Vista ARTICLES Vista ARTIGOS TOP 50 TOP 50 Vista VIDEOS Vista VÍDEOS Vista SOFT Vista SOFT Vista HELP Vista AJUDA

In Vista, How Does the FLAGS Switch of REG.EXE Work? No Vista, de que forma a BANDEIRAS Switch REG.EXE de Trabalho?


Note: this content originally from Nota: este conteúdo originalmente de http://mygreenpaste.blogspot.com http://mygreenpaste.blogspot.com . . If you are reading it from some other site, please take the time to visit Se você está lendo-o de qualquer outro site, por favor, aproveite para visitar My Green Paste, Inc A minha pasta verde, Inc . . Thank you. Obrigado.


A while back, there was a topic ( Uma volta ao mesmo tempo, houve um tema ( Virtual Registry vs. "Real registry" Secretaria vs Virtual "registro Real" ) in the ) Na Sysinternals Forums Sysinternals Fóruns 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 levantou a questão de saber como definir a virtualização relacionadas com as bandeiras de uma chave Registo programática, em Vista, e não através do uso da ferramenta REG.EXE BANDEIRAS switch's. (For more information on the flags, see (Para obter mais informações sobre as bandeiras, veja Mark Russinovich Mark Russinovich 's article in TechNet Magazine, " 's no artigo TechNet Magazine, " 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.) "). Mesmo antes que o tema no fórum, eu tinha de saber como ele foi feito, mas não tinha tido a chance de explorar. Ela não parecia que muitos outros foram curioso sobre isso. Esse assunto havia ressuscitado a idéia, mas rapidamente desceu para o fundo da lista. Eu finalmente obtido em torno de experimentação, e que leva a escrever esta-up. eu ainda não consigo ver muito com as discutido esta em qualquer lugar, através de pesquisa para termos envolvidos (os tipos de dados, função param nomes, etc), e por isso espero que isto irá ajudar alguém. (Tenha em mente que há muito bem pode ser uma razão Microsoft não tenha feito esta disponível através de outra, de forma mais direta 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. No referenciado tópico, eu tinha obtido medida em que determina REG.EXE estava a fazer o seu trabalho através da utilização de NtSetInformationKey, um "indocumentados" API em NTDLL.DLL.


 NTSYSAPI 

NTSTATUS

NTAPI

NtSetInformationKey( NtSetInformationKey (

IN HANDLE KeyHandle, Em lidar com KeyHandle,

IN KEY_SET_INFORMATION_CLASS InformationClass, Em KEY_SET_INFORMATION_CLASS InformationClass,

IN PVOID KeyInformationData, Em 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. Após um pouco de plonking em torno WinDbg, que eu venha com a seguinte sequência detalhes. REG.EXE calls REG.EXE chamadas NtSetInformationKey , specifying a value of 2 for the InformationClass parameter. , Especificando o valor 2 para o InformationClass parâmetro. This parameter is of type KEY_SET_INFORMATION_CLASS, which wdm.h tells us is an enum: Este parâmetro é do tipo KEY_SET_INFORMATION_CLASS, wdm.h diz-nos que é um 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 deve ser sempre a última enum

} KEY_SET_INFORMATION_CLASS; KEY_SET_INFORMATION_CLASS);


So the 2 for the InformationClass parameter would correspond to KeyControlFlagsInformation. Portanto, o n º 2 para o InformationClass parâmetro que corresponderia 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 também sugere que esta classe tem um tipo que passa por uma KeyInformationData o parâmetro - 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. Nós temos uma idéia básica de como a chamada NtSetInformationKey agora. But what are the values that the ControlFlags member of KEY_CONTROL_FLAGS_INFORMATION can be set to? Mas quais são os valores que a ControlFlags membro do KEY_CONTROL_FLAGS_INFORMATION podem ser definidos para o? 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): Ao que parece, os seguintes (self-made) enum abrange os pavilhões pertinentes - pelo menos as que podem lidar com REG.EXE BANDEIRAS (pode haver mais):


 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. O controle bandeiras são um bitmask, assim que você pode lhes OR para definir mais do que uma.


Now that we have this information, what's left? Agora que temos esta informação, o que há de esquerda? We need to put it all together in a call to NtSetInformationKey. Temos que colocar tudo isso em conjunto de uma chamada para NtSetInformationKey. So, we need to get a pointer to the function in NTDLL.DLL. Por isso, precisamos de obter um ponteiro para a função em 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. Então, nós podemos declarar uma struct do tipo KEY_CONTROL_FLAGS_INFORMATION, definir o ControlFlags membro a ser aquilo que queremos, e abrir uma chave para o local desejado no registro, que podem ser passadas para o NtSetInformationKey. In the end, we wind up with something like the following (error handling has been omitted): No final, nós encerrar com algo como o seguinte (erro movimentação foi omitida):


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

HANDLE KeyHandle, MANUSEIE AS 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 \ \ Independentemente"), 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 . O código acima é o equivalente a invocação REG.EXE BANDEIRAS HKLM \ Software \ Independentemente 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 limpar os pavilhões, basta definir kcfi.ControlFlags a RegKeyClearFlags (o mesmo que REG.EXE BANDEIRAS HKLM \ Software \ Independentemente SET).

Hopefully, this will prove useful to those that have wished to set these flags programmatically. Esperemos que este virá a ser útil para aqueles que têm quis definir essas bandeiras programática. In a future post, I hope to explore querying for these flags, ala REG.EXE FLAGS HKLM\Software\Whatever QUERY . Em um futuro post, espero que explore examinando para estas bandeiras, Ala REG.EXE BANDEIRAS HKLM \ Software \ Independentemente consulta.


Note that this exploration was done on Windows Vista SP1. Note que esta pesquisa foi feita com SP1 Windows Vista. I would expect the content here to also apply to Windows Vista (no SP) as well as Windows Server 2008, but... Quero esperar que o conteúdo aqui para também se aplica aos Windows Vista (sem SP), assim como o Windows Server 2008, mas ...

Popularity: 4% Popularity: 4%


Written by «/\/\Ø|ö±ò\/»®©. Escrito por  «/ \ / \ à ~ | à ¶  ± à ² \ / Â"  ®  ©. Read more great feeds at is source Leia mais alimenta a grande fonte é WEBSITE SITE
no comments sem comentários . .
Read more articles on Leia mais artigos sobre flags Bandeiras and e NtSetInformationKey NtSetInformationKey and e REG_KEY_DONT_VIRTUALIZE REG_KEY_DONT_VIRTUALIZE and e Sysinternals Forum Sysinternals Fórum and e reg.exe flags reg.exe bandeiras and e registry virtualization Registro virtualização and e reg Reg and e REG_KEY_DONT_SILENT_FAIL REG_KEY_DONT_SILENT_FAIL and e Troubleshooting Problemas and e vista Vista and e windbg windbg and e otherSoftware otherSoftware and e registry Registro and e Virtualization Virtualização . .

No comments Não há comentários

There are still no comments on this article. Ainda não há comentários sobre este artigo.

Leave your comment... Deixe o seu comentário ...

If you want to leave your comment on this article, simply fill out the next form: Se você quiser deixar seu comentário sobre este artigo, basta preencher o formulário seguinte forma:




You can use these XHTML tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong> . Você pode usar estes XHTML tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i > <strike> <strong>.