PDA

View Full Version : خواندن مقدار یک کلید از رجیستری



مهدی رحیم زاده
جمعه 23 آذر 1386, 09:23 صبح
سلام
می خوام که مقدار کلید (Default) رو از این مسیر توی رجیستری بخونم :

HKEY_CLASSES_ROOT\.txt
اما مقدار اونو نمی ده !
اما وقی می خوام مقادیر باقی کلید های اونجا رو بخونم درست میده ، مثلا مقدار این کلید رو درست میده : Content Type
چکار کنم که بتونم مقدار کلید Default رو بخونم ؟؟؟؟
اینم کدی که با اون می خوام مقدار رو بخونم :

r = Registry.ClassesRoot.OpenSubKey(".txt");
string command = Convert.ToString(r.GetValue("(Default)"));
MessageBox.Show(command);

مهدی رحیم زاده
جمعه 23 آذر 1386, 20:27 عصر
کسی نمیدونه که من باید چکار کنم ...
خیلی لازمش دارم !

beh_develop
شنبه 24 آذر 1386, 13:20 عصر
همه کدهایی که نوشتین درسته فقط به جای "(Default)" بنویسین "" ، فیلد های Default می تونین با رشته خالی بدست بیارین و بقه فیلدها را با اسمشان

madrazma
یک شنبه 25 آذر 1386, 02:59 صبح
سلام
چطور میشه از رجیستری یک کبی گرفت

مهدی رحیم زاده
یک شنبه 25 آذر 1386, 04:43 صبح
فکر کنم چون رجیستری هم یک فایله ، میشه خیلی ساده از اون مثل فایلهای دیگه کپی گرفت ...

sinpin
یک شنبه 25 آذر 1386, 08:11 صبح
سلام
چطور میشه از رجیستری یک کبی گرفت

توی خود رجیستری منوی (File) گزینه ی Export داره.

sinpin
یک شنبه 25 آذر 1386, 08:13 صبح
فکر کنم چون رجیستری هم یک فایله ، میشه خیلی ساده از اون مثل فایلهای دیگه کپی گرفت ...
:لبخندساده:
البته نه دقیقا یک فایل :

The Registry is stored in several files; depending upon the version of Windows, there will be different files and different locations for these files, but they are all on the local machine, except for the Ntuser.dat files. There is one such file per user that contains the information in HKEY_CURRENT_USER


Windows NT, 2000, XP, Server 2003, and Vista

The following Registry files are stored in %SystemRoot%\System32\Config\:
Sam – HKEY_LOCAL_MACHINE\SAM
Security – HKEY_LOCAL_MACHINE\SECURITY
Software – HKEY_LOCAL_MACHINE\SOFTWARE
System – HKEY_LOCAL_MACHINE\SYSTEM
Default – HKEY_USERS\.DEFAULT
Userdiff - Not associated with a hive. Used only when upgrading operating systems.[8] (http://en.wikipedia.org/wiki/Windows_Registry#_note-6)The following files are stored in each user's profile folder:
%UserProfile%\Ntuser.dat – HKEY_USERS\<User SID> (linked to by HKEY_CURRENT_USER)
%UserProfile%\Local Settings\Application Data\Microsoft\Windows\Usrclass.dat (path is localized) – HKEY_USERS\<User SID>_Classes (HKEY_CURRENT_USER\Software\Classes)[edit (http://en.wikipedia.org/w/index.php?title=Windows_Registry&action=edit&section=16)] Windows 95, 98, and Me

The registry files are named USER.DAT and SYSTEM.DAT and are stored in the %WINDIR% directory. In Windows Me, Classes.dat was added. Also, each user profile (if profiles are enabled) has its own USER.DAT in profile's directory.


HKEY_CLASSES_ROOT

Abbreviated HKCR, HKEY_CLASSES_ROOT stores information about registered applications, such as Associations from File Extensions and OLE (http://en.wikipedia.org/wiki/Object_linking_and_embedding) Object Class IDs tying them to the applications used to handle these items. On Windows 2000 and above, HKCR is a compilation of HKCU\Software\Classes and HKLM\Software\Classes. If a given value exists in both of the subkeys above, the one in HKCU\Software\Classes is used.[4] (http://en.wikipedia.org/wiki/Windows_Registry#_note-2)

[edit (http://en.wikipedia.org/w/index.php?title=Windows_Registry&action=edit&section=5)] HKEY_CURRENT_USER

Abbreviated HKCU, HKEY_CURRENT_USER stores settings that are specific to the currently logged-in user. The HKCU key is a link to the subkey of HKEY_USERS that corresponds to the user; the same information is reflected in both locations. On Windows-NT based systems, each user's settings are stored in their own files called NTUSER.DAT and USRCLASS.DAT inside their own documents and settings subfolder.

[edit (http://en.wikipedia.org/w/index.php?title=Windows_Registry&action=edit&section=6)] HKEY_LOCAL_MACHINE

Abbreviated HKLM, HKEY_LOCAL_MACHINE stores settings that are general to all users on the computer. On NT-based versions of Windows, HKLM contains four subkeys, SAM, SECURITY, SOFTWARE and SYSTEM, that are found within their respective files located in the %SystemRoot%\System32\Config folder. A fifth subkey, HARDWARE, is volatile and is created dynamically, and as such is not stored in a file. Information about system hardware drivers and services are located under the SYSTEM subkey, whilst the SOFTWARE subkey contains software and windows settings.

[edit (http://en.wikipedia.org/w/index.php?title=Windows_Registry&action=edit&section=7)] HKEY_USERS

Abbreviated HKU, HKEY_USERS contains subkeys corresponding to the HKEY_CURRENT_USER keys for each user registered on the machine.

[edit (http://en.wikipedia.org/w/index.php?title=Windows_Registry&action=edit&section=8)] HKEY_CURRENT_CONFIG

Abbreviated HKCC, HKEY_CURRENT_CONFIG contains information gathered at runtime; information stored in this key is not permanently stored on disk, but rather regenerated at boot time.


منبع :
http://en.wikipedia.org/wiki/Windows_Registry