zoukankan      html  css  js  c++  java
  • VS的rgs脚本编写规则

    分享至http://msdn.microsoft.com/en-us/library/k32htktc.aspx

    Registry Scripting Examples

    Visual Studio 2013

    Other Versions

    This topic has not yet been rated - Rate this topic

    The scripting examples in this topic demonstrate how to add a key to the system registry, register the Registrar COM server, and specify multiple parse trees.

    Add a Key to HKEY_CURRENT_USER

    The following parse tree illustrates a simple script that adds a single key to the system registry. In particular, the script adds the key, MyVeryOwnKey, to HKEY_CURRENT_USER. It also assigns the default string value of HowGoesIt? to the new key:

    HKEY_CURRENT_USER
    {
       'MyVeryOwnKey' = s 'HowGoesIt?'
    }

    This script can easily be extended to define multiple subkeys as follows:

    HKCU
    {
       'MyVeryOwnKey' = s 'HowGoesIt?'
       {
          'HasASubkey'
          {
             'PrettyCool?' = d '55'
             val 'ANameValue' = s 'WithANamedValue'
          }
       }
    }

    Now, the script adds a subkey, HasASubkey, to MyVeryOwnKey. To this subkey, it adds both the PrettyCool? subkey (with a default DWORD value of 55) and the ANameValuenamed value (with a string value of WithANamedValue).

    Register the Registrar COM Server

    The following script registers the Registrar COM server itself.

    HKCR
    {
       ATL.Registrar = s 'ATL Registrar Class'
       {
          CLSID = s '{44EC053A-400F-11D0-9DCD-00A0C90391D3}'
       }
       NoRemove CLSID
       {
          ForceRemove {44EC053A-400F-11D0-9DCD-00A0C90391D3} =
                       s 'ATL Registrar Class'
          {
             ProgID = s 'ATL.Registrar'
             InprocServer32 = s '%MODULE%'
             {
                val ThreadingModel = s 'Apartment'
             }
          }
       }
    }

    At run time, this parse tree adds the ATL.Registrar key to HKEY_CLASSES_ROOT. To this new key, it then:

    • Specifies ATL Registrar Class as the key's default string value.

    • Adds CLSID as a subkey.

    • Specifies {44EC053A-400F-11D0-9DCD-00A0C90391D3} for CLSID. (This value is the Registrar's CLSID for use with CoCreateInstance.)

    Since CLSID is shared, it should not be removed in Unregister mode. The statement, NoRemove CLSID, does this by indicating that CLSID should be opened in Register mode and ignored in Unregister mode.

    The ForceRemove statement provides a housekeeping function by removing a key and all of its subkeys before re-creating the key. This can be useful if the names of the subkeys have changed. In this scripting example, ForceRemove checks to see if {44EC053A-400F-11D0-9DCD-00A0C90391D3} already exists. If it does, ForceRemove:

    • Recursively deletes {44EC053A-400F-11D0-9DCD-00A0C90391D3} and all of its subkeys.

    • Re-creates {44EC053A-400F-11D0-9DCD-00A0C90391D3}.

    • Adds ATL Registrar Class as the default string value for {44EC053A-400F-11D0-9DCD-00A0C90391D3}.

    The parse tree now adds two new subkeys to {44EC053A-400F-11D0-9DCD-00A0C90391D3}. The first key, ProgID, gets a default string value that is the ProgID. The second key, InprocServer32, gets a default string value, %MODULE%, that is a preprocessor value explained in the section, Using Replaceable Parameters (The Registrar's Preprocessor), of this article. InprocServer32 also gets a named value, ThreadingModel, with a string value of Apartment.

    Specify Multiple Parse Trees

    To specify more than one parse tree in a script, simply place one tree at the end of another. For example, the following script adds the key, MyVeryOwnKey, to the parse trees for both HKEY_CLASSES_ROOT and HKEY_CURRENT_USER:

    HKCR
    {
       'MyVeryOwnKey' = s 'HowGoesIt?'
    }
    HKEY_CURRENT_USER
    {
       'MyVeryOwnKey' = s 'HowGoesIt?'
    }

    NoteNote

    In a Registrar script, 4K is the maximum token size. (A token is any recognizable element in the syntax.) In the previous scripting example, HKCR, HKEY_CURRENT_USER,'MyVeryOwnKey', and 'HowGoesIt?' are all tokens.

  • 相关阅读:
    扯蛋的密码规则
    【转】mysql安全基线设置
    阿里云安全基线 记录如下 不定时更新
    解决Apache的错误日志巨大的问题以及关闭Apache web日志记录
    cms如何绑定二级域名
    宝塔面板定时/同步备份网站及数据库至FTP存储空间完整教程
    宝塔部署项目报Warning: require(): open_basedir restriction in effect的解决方案
    git学习笔记(一)—— git环境搭建
    vim学习笔记(一)—— vim安装方法
    Intel Edison学习笔记(二)—— 入门环境配置
  • 原文地址:https://www.cnblogs.com/sunbing/p/3927443.html
Copyright © 2011-2022 走看看