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.

  • 相关阅读:
    Tomcat搭建Web 应用服务器
    前端代码的开发标准和规范
    全局关键字搜索:Element UI Table内容过滤jQuery过滤器fastLiveFilter插件BootstrapVue插件;
    Highchartsjs使用总结及实时动态刷新图
    百度统计微信网站绑定(vue项目)
    对Vuejs框架原理名词解读
    xml
    webservice
    类加载器
    引入spring时 XML文档中的xmlns、xmlns:xsi和xsi:schemaLocation
  • 原文地址:https://www.cnblogs.com/sunbing/p/3927443.html
Copyright © 2011-2022 走看看