In Vista, How Does the FLAGS Switch of REG.EXE Work? في فيستا ، كيف يمكن للاعلام reg.exe التحول من العمل؟
Note: this content originally from ملاحظه : هذا المحتوى في الاصل من http://mygreenpaste.blogspot.com http://mygreenpaste.blogspot.com . . If you are reading it from some other site, please take the time to visit اذا كنت قراءة بعض من موقع آخر ، يرجى اخذ الوقت لزيارة My Green Paste, Inc الصق بلدي الاخضر ، لجنة التفاوض الحكوميه الدولية . . Thank you. شكرا لك.
A while back, there was a topic ( من حين الى الوراء ، كان هناك موضوع) Virtual Registry vs. "Real registry" سجل الافتراضيه مقابل "السجل الحقيقي" ) in the (في Sysinternals Forums منتديات sysinternals 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. ان طرح مسألة كيفية تعيين المحاكاه الافتراضيه المتصله اعلام مفتاح تسجيل فيستا في برنامجيا ، وليس من خلال الاستفادة من هذه الاداه reg.exe اعلام التبديل. (For more information on the flags, see (لمزيد من المعلومات عن الاعلام ، انظر Mark Russinovich علامة russinovich 's article in TechNet Magazine, " 'المادة في مجلة شبكة التكنولوجيا ،" 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.) "). وحتى قبل هذا الموضوع في المنتدى ، كان لي تساؤل عن الكيفيه التي تم ولكن لم تتح لها الفرصة لاستكشاف. انه لا يبدو ان العديد من البلدان الاخرى كانت غريبة عنه ، ومن ذلك الموضوع قد احياء فكرة ، ولكن سرعان ما انخفضت الى اسفل القائمة. لقد بدأت أخيرا في جميع انحاء لتجريب ، والتي تقود الى هذا الشطب. وما زلت لا ارى الكثير في سبيل ذلك ناقش في أي مكان ، عن طريق البحث عن الشروط التي تنطوي عليها) انواع البيانات ، وظيفة المعلمه اسماء ، وما الى ذلك) ، ولذلك نأمل ان هذا من شأنه ان يساعد شخص ما. (خذ بعين الاعتبار ان هناك جيدا يمكن ان يكون السبب لم تقدم مايكروسوفت هذا المتاحة عن طريق آخر ، اكثر مباشرة 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. في الموضوع المشار اليه ، كنت قد بدأت حتى الان كما ان تحديد reg.exe تفعل عملها من خلال استخدام ntsetinformationkey ، "غير المسجلين" في ntdll.dll API.
NTSYSAPI Ntsysapi
NTSTATUS Ntstatus
NTAPI Ntapi
NtSetInformationKey( Ntsetinformationkey)
IN HANDLE KeyHandle, في التعامل مع keyhandle ،
IN KEY_SET_INFORMATION_CLASS InformationClass, في key_set_information_class informationclass ،
IN PVOID KeyInformationData, في pvoid keyinformationdata ،
IN ULONG DataLength ); في ulong datalength) ؛
After a bit of plonking around in WinDbg, I've come up with the following following details. بعد قليلا من plonking في جميع انحاء windbg ، لقد قمت الخروج فيما يلى التفاصيل التالية. REG.EXE calls ويدعو reg.exe NtSetInformationKey Ntsetinformationkey , specifying a value of 2 for the InformationClass parameter. ، مع تحديد قيمتها (2) لinformationclass معلمه. This parameter is of type KEY_SET_INFORMATION_CLASS, which wdm.h tells us is an enum: هذه المعلمه هو من نوع key_set_information_class ، الذي يخبرنا wdm.h هو انجليزى :
typedef enum _KEY_SET_INFORMATION_CLASS { typedef انجليزى _key_set_information_class (
KeyWriteTimeInformation, Keywritetimeinformation ،
KeyWow64FlagsInformation, Keywow64flagsinformation ،
KeyControlFlagsInformation, Keycontrolflagsinformation ،
KeySetVirtualizationInformation, Keysetvirtualizationinformation ،
KeySetDebugInformation, Keysetdebuginformation ،
MaxKeySetInfoClass // MaxKeySetInfoClass should always be the last enum Maxkeysetinfoclass / / maxkeysetinfoclass ينبغي دائما ان يكون آخر انجليزى
} KEY_SET_INFORMATION_CLASS; Key_set_information_class) ؛
So the 2 for the InformationClass parameter would correspond to KeyControlFlagsInformation. لذلك (2) لinformationclass المعلمه ، تتطابق مع keycontrolflagsinformation. WDM.H also suggests that this class has a type that one passes for the KeyInformationData parameter - KEY_CONTROL_FLAGS_INFORMATION: Wdm.h يشير ايضا الى ان هذه الطبقة من نوع واحد يمر لkeyinformationdata المعلمه -- key_control_flags_information :
typedef struct _KEY_CONTROL_FLAGS_INFORMATION { typedef بنية _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. لدينا الفكره الاساسية لكيفية طلب ntsetinformationkey الآن. But what are the values that the ControlFlags member of KEY_CONTROL_FLAGS_INFORMATION can be set to? ولكن ما هي القيم التي controlflags عضو key_control_flags_information يمكن لمجموعة؟ 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): ويبدو ان ما يلى (ادلى الذاتي) ويغطي انجليزى ذات الصلة اعلام -- على الاقل هم reg.exe يمكنهم التعامل مع الاعلام (قد يكون هناك المزيد) :
typedef enum _CONTROL_FLAGS { typedef انجليزى _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. السيطرة على الاعلام هي bitmask ، او حتى تتمكن من لهم أكثر من مجموعة واحدة.
Now that we have this information, what's left? الآن وقد اصبح لدينا هذه المعلومات ، على ما تبقى؟ We need to put it all together in a call to NtSetInformationKey. نحن بحاجة الى وضع كل ذلك معا في الدعوة الى ntsetinformationkey. So, we need to get a pointer to the function in NTDLL.DLL. ذلك ، نحن بحاجة الى الحصول على مؤشر على وظيفة في 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. بعد ذلك ، يمكننا ان يعلن بنية من نوع key_control_flags_information ، حدد controlflags الاعضاء الى ما نود أن يكون ، وفتح السبيل الى المكان الذي يريده في قلم المحكمه ، التي يمكن ان تكون مرت على ntsetinformationkey. In the end, we wind up with something like the following (error handling has been omitted): وفي نهاية المطاف ، ونحن مع النتيجة شيئا مثل ما يلي (معالجة الاخطاء وقد حذفت) :
typedef NTSYSAPI NTSTATUS (NTAPI* FuncNtSetInformationKey) ( typedef ntsysapi ntstatus (ntapi * funcntsetinformationkey ()
HANDLE KeyHandle, التعامل مع 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 = لاغيه ؛
RegOpenKeyEx( HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Whatever"), 0, KEY_ALL_ACCESS, &hTheKey ); Regopenkeyex (HKEY_LOCAL_MACHINE ، _t ( "البرمجيات \ \ ايا كان") ، 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 = لاغيه ؛
The code above is the equivalent of invoking REG.EXE FLAGS HKLM\Software\Whatever SET DONT_VIRTUALIZE RECURSE_FLAGS . المدونه أعلاه هو ما يعادل الاحتجاج reg.exe اعلام hklm \ برامج \ ايا كانت مجموعة dont_virtualize recurse_flags. To clear the flags, just set kcfi.ControlFlags to RegKeyClearFlags (same as REG.EXE FLAGS HKLM\Software\Whatever SET) . لأعلام واضحة وعادلة لregkeyclearflags مجموعة kcfi.controlflags (نفس reg.exe اعلام hklm \ برامج \ ايا كانت مجموعة).
Hopefully, this will prove useful to those that have wished to set these flags programmatically. ونأمل ان هذه ستكون مفيدة لتلك التي ترغب في وضع هذه اعلام البرنامجية. In a future post, I hope to explore querying for these flags, ala REG.EXE FLAGS HKLM\Software\Whatever QUERY . في ما بعد في المستقبل ، وامل ان يستكشف سؤال لاعلام هذه ، علاء reg.exe اعلام hklm \ برامج \ ايا استفسار.
Note that this exploration was done on Windows Vista SP1. لاحظ ان هذا قد تم على استكشاف ويندوز فيستا SP1. I would expect the content here to also apply to Windows Vista (no SP) as well as Windows Server 2008, but... اتوقع ان مضمون هنا لتنطبق ايضا على ويندوز فيستا (آي س) وكذلك ويندز 2008 ، ولكن...
Popularity: 4% الشعبية : 4 ٪
Written by «/\/\Ø|ö±ò\/»®©. كتب â «/ \ / \ ã ~ | ã ¶ â ± ² ã \ / â» â ® â ©. Read more great feeds at is source أقرأ المزيد كبيرة في الفيد هو المصدر WEBSITE موقع ويب
no comments لا يوجد تعليقات . .
Read more articles on أقرأ المزيد المواد المتعلقة flags اعلام and و NtSetInformationKey Ntsetinformationkey and و REG_KEY_DONT_VIRTUALIZE Reg_key_dont_virtualize and و Sysinternals Forum منتدى sysinternals and و reg.exe flags reg.exe اعلام and و registry virtualization سجل المحاكاه الافتراضيه and و reg م and و REG_KEY_DONT_SILENT_FAIL Reg_key_dont_silent_fail and و Troubleshooting حل المشاكل and و vista المشهد and و windbg windbg and و otherSoftware othersoftware and و registry قلم المحكمه and و Virtualization المحاكاه الافتراضيه . .
- [+] Digg [+] البحث بعمق : Feature this article : سمات هذه المادة
- [+] Del.icio.us [+] Del.icio.us : Bookmark this article : علامة هذه المادة
- [+] Furl [+] Furl : Bookmark this article : علامة هذه المادة














