开发者

What do curly braces in the Windows registry mean?

开发者 https://www.devze.com 2023-01-27 07:19 出处:网络
I\'ve been wondering this for a while and can\'t seem to get answer. In Windows (maybe other places too), what do the curly braces mean? I\'m guessing it has to do with hex but not sure.

I've been wondering this for a while and can't seem to get answer.

In Windows (maybe other places too), what do the curly braces mean? I'm guessing it has to do with hex but not sure.

Any help would be appreciated.

*UPDATE

I'm sorry I wasn't as specific as I should have been. I was talking about in the registry, but I've al开发者_如何学Cso seen it in folder paths.


You mean curly braces as in {}? They're just characters and you can pretty well assign any meaning you want to them, although they're more useful in "balancing" situations, the same as [], <> and ().

Examples are:

  • block delineation in certain programming languages:
    if (true) { do something }
  • array initialisers in certain programming languages:
    int x[] = { 1, 2, 3 };
  • formatted printing where they're replaced in a format string with actual arguments, something like:
    format ("My name is {1:s}{0:s}", "Diablo", "Pax");
  • Limiting the characters used in environment variable names in certain shells:
    echo ${name}Diablo
  • surrounding character for GUIDs:
    {3F2504E0-4F89-11D3-9A0C-0305E82C3301}

There are no doubt dozens of other uses in other scenarios as well, those were just the ones that came immediately to mind.


Since you seem to be specifically asking about GUIDs (based on your comment), you can start here.


  • Repetition in regular expressions: /a{3,5}/.

  • Anonymous hash composers in Perl: my $rec = { };. Also for dictionaries in Python.

  • Data assignments of structures or arrays in languages like C or Java: String data[] = { "TGF-βs", "XPTTD", "CIMPR", "CFU-F", "Qiagen", "BrdU-positive", "TSFLLRVYFQPGPPATAAPVPSPT", "Amersham", "DAPI-stained" };

  • Perl dereferencing operators: ${ $array_of_refs[17} }.

  • Hash subscripting in Perl: $ENV{USER}

  • Filename globbing in the shell: % echo {this,that,those,these}_{here,there,everywhere} produces this_here this_there this_everywhere that_here that_there that_everywhere those_here those_there those_everywhere these_here these_there these_everywhere

  • Hiding a semicolon in plain sight, since a CTRL-{ is a ;. That’s because the CONTROL- operation is an xor with an @. \cC is @^C == chr(3), so \c{ is @^{ == chr(59) eq ";".

  • Balanced pick-your-own-quotes operators to avoid escaping slashes, like print if m{^/usr/local/bin}

  • History substitution disambiguating: “ !{v}doc would expand unambiguously to vi wumpus.mandoc

  • Unambiguous octal and hex escapes in strings, like "10\o{377}01" and "The \x{bee} character is TAMIL DIGIT EIGHT".

  • A symbol used in mathematics and music.

  • The name of particularly little-known variable in Perl: perl -le '$} = "eskimo"; print $}' prints eskimo!


Depends on the usage.

In C# {0} is a placeholder; it gets replaced with the value that follows the quoted text, i.e.:

Console.WriteLine("Radius = {0}, PI = {1}", radius, PI);

Note that the first place holder is always a 0, the next usage is 1, etc...


In programming, curly braces are used for a lot of different things. Different languages use them in completely different contexts.

If you're talking about program flow in C++, I like to think of them as tiers that progressively get more specific. Example:

string myName = "Max";

if (myName[0] == 'M') // If the first letter of myName is M...
{
    cout << "The first letter is M." << endl;

    if (myName.length() == 3) // If myName is three characters long...
    {
        cout << "myName is three chars long." << endl;

        if(myName[2] == 'x') // If the third letter is x...
        {
             cout << "The third letter is x." << endl;
        }
    }
}

They're also used in array assignment in C++, like so:

int myArray[5] = {1, 2, 3, 4, 5};

There are other uses, but these two are probably the most common.


The symbols { }, are used in computer programs for showing that things written between them should be considered together. Certainly this is the current dictionary definition.

And as such probably represents the most authoritative overall definition you're likely to get, though the other answers have dealt with more specific use cases.


Came upon this question when searching for win registry values as numbers enclosed in braces.

Turns out the 128 bit numbers guarantee to be unique in space and time without the need to be centrally registered, and "used to index" "information about objects". You "can view the registration information on your system" with Regedit.exe /v

GUIDs are created with the tool Guidgen.exe, which produces a very large hexadecimal number that "uniquely identifies an object", and stored in Windows Registry (where OLE and applications get information about classes).

Here's a sample code to convert/decode GUID/UUID/CLSID in Windows Registry.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号