learn.microsoft.com Open in urlscan Pro
2a02:26f0:480:b9a::3544  Public Scan

Submitted URL: https://docs.microsoft.com/en-us/windows/win32/sysinfo/registry-value-types
Effective URL: https://learn.microsoft.com/en-us/windows/win32/sysinfo/registry-value-types
Submission: On September 24 via api from US — Scanned from DE

Form analysis 3 forms found in the DOM

Name: site-header-search-form-mobileGET /en-us/search/

<form class="flex-grow-1" method="GET" role="search" id="ms--site-header-search-form-mobile" data-bi-name="site-header-search-form-mobile" name="site-header-search-form-mobile" aria-label="Search" action="/en-us/search/">
  <div class="autocomplete display-block" data-bi-name="autocomplete"><!---->
    <div class="field-body control ">
      <input role="combobox" maxlength="100" aria-autocomplete="list" autocapitalize="off" autocomplete="off" autocorrect="off" spellcheck="false" id="site-header-search-autocomplete-input-mobile"
        data-test-id="site-header-search-autocomplete-input-mobile" class="autocomplete-input input 
						
						width-full" type="search" name="terms" aria-expanded="false" aria-owns="ax-1-listbox" aria-controls="ax-1-listbox" aria-activedescendant="" aria-label="Search" aria-describedby="ms--site-header-search-autocomplete-input-mobile-description"
        placeholder="Search" data-bi-name="site-header-search-autocomplete-input-mobile" pattern=".*">
      <span aria-hidden="true" class="autocomplete-loader loader has-text-primary " hidden=""></span>
      <span hidden="" id="ms--site-header-search-autocomplete-input-mobile-description"> Suggestions will filter as you type </span>
    </div>
    <ul role="listbox" id="ax-1-listbox" data-test-id="site-header-search-autocomplete-input-mobile-listbox" class="autocomplete-suggestions is-vertically-scrollable padding-xxs " aria-label="Suggestions" hidden="">
    </ul>
    <!---->
  </div>
  <!-- mobile safari will not dispatch submit event unless there's a submit button that is not display:none -->
  <button type="submit" class="visually-hidden" tabindex="-1" aria-hidden="true"></button>
  <input name="category" hidden="" value="">
</form>

Name: site-header-search-formGET /en-us/search/

<form class="flex-grow-1" method="GET" role="search" id="ms--site-header-search-form" data-bi-name="site-header-search-form" name="site-header-search-form" aria-label="Search" action="/en-us/search/">
  <div class="autocomplete display-block" data-bi-name="autocomplete"><!---->
    <div class="field-body control ">
      <input role="combobox" maxlength="100" aria-autocomplete="list" autocapitalize="off" autocomplete="off" autocorrect="off" spellcheck="false" id="site-header-search-autocomplete-input" data-test-id="site-header-search-autocomplete-input" class="autocomplete-input input input-sm
						
						width-full" type="search" name="terms" aria-expanded="false" aria-owns="ax-0-listbox" aria-controls="ax-0-listbox" aria-activedescendant="" aria-label="Search" aria-describedby="ms--site-header-search-autocomplete-input-description"
        placeholder="Search" data-bi-name="site-header-search-autocomplete-input" pattern=".*">
      <span aria-hidden="true" class="autocomplete-loader loader has-text-primary " hidden=""></span>
      <span hidden="" id="ms--site-header-search-autocomplete-input-description"> Suggestions will filter as you type </span>
    </div>
    <ul role="listbox" id="ax-0-listbox" data-test-id="site-header-search-autocomplete-input-listbox" class="autocomplete-suggestions is-vertically-scrollable padding-xxs " aria-label="Suggestions" hidden="">
    </ul>
    <!---->
  </div>
  <!-- mobile safari will not dispatch submit event unless there's a submit button that is not display:none -->
  <button type="submit" class="visually-hidden" tabindex="-1" aria-hidden="true"></button>
  <input name="category" hidden="" value="">
</form>

javascript:

<form action="javascript:" role="search" aria-label="Search" class="margin-bottom-xxs"><label class="visually-hidden" for="ax-2">Search</label>
  <div class="autocomplete display-block" data-bi-name="autocomplete"><!---->
    <div class="field-body control has-icons-left">
      <input role="combobox" maxlength="100" aria-autocomplete="list" autocapitalize="off" autocomplete="off" autocorrect="off" spellcheck="false" id="ax-2" data-test-id="ax-2" class="autocomplete-input input input-sm
						control has-icons-left
						width-full" type="text" aria-expanded="false" aria-owns="ax-3-listbox" aria-controls="ax-3-listbox" aria-activedescendant="" aria-describedby="ms--ax-2-description" placeholder="Filter by title" pattern=".*">
      <span aria-hidden="true" class="icon is-small is-left">
        <span class="has-text-primary docon docon-filter-settings"></span>
      </span>
      <span aria-hidden="true" class="autocomplete-loader loader has-text-primary " hidden=""></span>
      <span hidden="" id="ms--ax-2-description"> Suggestions will filter as you type </span>
    </div>
    <ul role="listbox" id="ax-3-listbox" data-test-id="ax-2-listbox" class="autocomplete-suggestions is-vertically-scrollable padding-xxs " aria-label="Suggestions" hidden="">
    </ul>
    <!---->
  </div>
</form>

Text Content

Skip to main content

We use optional cookies to improve your experience on our websites, such as
through social media connections, and to display personalized advertising based
on your online activity. If you reject optional cookies, only cookies necessary
to provide you the services will be used. You may change your selection by
clicking “Manage Cookies” at the bottom of the page. Privacy Statement
Third-Party Cookies

Accept Reject Manage cookies


AI SKILLS CHALLENGE

Sep 24 – Nov 1, 2024

Excel in AI technologies with Microsoft Copilot, Azure, and Fabric. Start the
challenge today.

Register now
Dismiss alert

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security
updates, and technical support.

Download Microsoft Edge More info about Internet Explorer and Microsoft Edge

Learn
Suggestions will filter as you type
Sign in


 * Profile
 * Settings

Sign out

Learn
   
 * Discover
      
    * Documentation
      
      In-depth articles on Microsoft developer tools and technologies
   
      
    * Training
      
      Personalized learning paths and courses
   
      
    * Credentials
      
      Globally recognized, industry-endorsed credentials
   
      
    * Q&A
      
      Technical questions and answers moderated by Microsoft
   
      
    * Code Samples
      
      Code sample library for Microsoft developer tools and technologies
   
      
    * Assessments
      
      Interactive, curated guidance and recommendations
   
      
    * Shows
      
      Thousands of hours of original programming from Microsoft experts
   
      
   
   Microsoft Learn for Organizations
   
   Boost your team's technical skills
   
   Access curated resources to upskill your team and close skills gaps.

   
 * Product documentation
      
    * ASP.NET
      
    * Azure
      
    * Dynamics 365
      
    * Microsoft 365
      
    * Microsoft Edge
      
    * Microsoft Entra
      
    * Microsoft Graph
      
    * Microsoft Intune
      
    * Microsoft Purview
      
    * Microsoft Teams
      
    * .NET
      
    * Power Apps
      
    * Power Automate
      
    * Power BI
      
    * Power Platform
      
    * PowerShell
      
    * SQL
      
    * Sysinternals
      
    * Visual Studio
      
    * Windows
      
    * Windows Server
      
   
   View all products
   
   Microsoft Learn for Organizations
   
   Boost your team's technical skills
   
   Access curated resources to upskill your team and close skills gaps.

   
 * Development languages
      
    * C++
      
    * C#
      
    * DAX
      
    * Java
      
    * OData
      
    * OpenAPI
      
    * Power Query M
      
    * VBA
      
   
   Microsoft Learn for Organizations
   
   Boost your team's technical skills
   
   Access curated resources to upskill your team and close skills gaps.

   
 * Topics
      
    * Artificial intelligence
      
    * Compliance
      
    * DevOps
      
    * Platform engineering
      
    * Security
      
   
   Microsoft Learn for Organizations
   
   Boost your team's technical skills
   
   Access curated resources to upskill your team and close skills gaps.

   

Suggestions will filter as you type
Sign in


 * Profile
 * Settings

Sign out
Windows App Development
   
 * Explore
     
   * Desktop app types
     
   * Windows App SDK
     
   * Windows UI Library
     
   * MSIX
     
   
 * Development
     
   * Get started
     
   * Design
     
   * Develop
     
   * Deploy
     
   * Samples
     
   
 * Platforms
     
   * Desktop apps
       
     * WinUI 3
       
     * Win32
       
     * WPF
       
     * Windows Forms
       
     * UWP
       
     
   * Web
     
   * Windows IoT
     
   * Mixed Reality
     
   * Games
     
   
 * Troubleshooting
   
 * Resources
     
   * Downloads
     
   * Windows Dev Center
     
   * Windows developer support
     
   * Windows Insider Program
     
   * What's new for Windows 11
     
   * Microsoft Store
     
   * Windows training
     
   * Windows on Q&A
     
   * Windows Developer on Twitter
     
   
 * More
     
   * Explore
       
     * Desktop app types
       
     * Windows App SDK
       
     * Windows UI Library
       
     * MSIX
       
     
   * Development
       
     * Get started
       
     * Design
       
     * Develop
       
     * Deploy
       
     * Samples
       
     
   * Platforms
       
     * Desktop apps
         
       * WinUI 3
         
       * Win32
         
       * WPF
         
       * Windows Forms
         
       * UWP
         
       
     * Web
       
     * Windows IoT
       
     * Mixed Reality
       
     * Games
       
     
   * Troubleshooting
     
   * Resources
       
     * Downloads
       
     * Windows Dev Center
       
     * Windows developer support
       
     * Windows Insider Program
       
     * What's new for Windows 11
       
     * Microsoft Store
       
     * Windows training
       
     * Windows on Q&A
       
     * Windows Developer on Twitter
       
     
   

Dashboard
Table of contents Exit focus mode

Search
Suggestions will filter as you type
 * Windows System Information
 * Handles and Objects
 * Registry
   * Registry
   * About the Registry
   * Using the Registry
   * Registry Reference
     * Registry Reference
     * Registry Functions
     * Registry Structures
     * Registry Element Size Limits
     * Registry Value Types
 * System Information
 * Time
 * Time Provider
 * WaaS Assessment Platform

Download PDF
    
 1. Learn
    
    
 2. Windows
    
    
 3. Apps
    
    
 4. Win32
    
    
 5. Desktop Technologies
    
    
 6. System Services
    
    
 7. Windows System Information
    

    
 1. Learn
    
    
 2. Windows
    
    
 3. Apps
    
    
 4. Win32
    
    
 5. Desktop Technologies
    
    
 6. System Services
    
    
 7. Windows System Information
    

Read in English Save
 * Add to Collections
 * Add to Plan

Table of contents Read in English Add to Collections Add to Plan Edit


--------------------------------------------------------------------------------

SHARE VIA

Facebook x.com LinkedIn Email

--------------------------------------------------------------------------------

Print
Table of contents


REGISTRY VALUE TYPES

 * Article
 * 02/09/2023
 * 7 contributors

Feedback


IN THIS ARTICLE

    
 1. String values
    
 2. Byte formats
    

A registry value can store data in one of several formats, such as a string
value or an integer value. When you store data in a registry value—for instance
by calling the RegSetValueEx function—you can indicate the type of data being
stored by specifying one of the types in the table below. When you retrieve a
registry value, functions such as RegQueryValueEx use these types to indicate
the type of data retrieved.

The following registry value types are defined in the winnt.h header file:

Expand table

Value Type REG_BINARY Binary data in any form. REG_DWORD A 32-bit number.
REG_DWORD_LITTLE_ENDIAN A 32-bit number in little-endian format. Windows is
designed to run on little-endian computer architectures. Therefore, this value
is defined as REG_DWORD in the Windows header files. REG_DWORD_BIG_ENDIAN A
32-bit number in big-endian format. Some UNIX systems support big-endian
architectures. REG_EXPAND_SZ A null-terminated string that contains unexpanded
references to environment variables, for example, %PATH%. It's either a Unicode
or an ANSI string, depending on whether you use the Unicode or ANSI functions.
To expand the environment variable references, use the ExpandEnvironmentStrings
function. REG_LINK A null-terminated Unicode string that contains the target
path of a symbolic link that was created by calling the RegCreateKeyEx function
with REG_OPTION_CREATE_LINK. REG_MULTI_SZ A sequence of null-terminated strings,
terminated by an empty string (\0). The following is an example:
String1\0String2\0String3\0LastString\0\0. The first \0 terminates the first
string, the second-from-last \0 terminates the last string, and the final \0
terminates the sequence. Note that the final terminator must be factored into
the length of the string. REG_NONE No defined value type. REG_QWORD A 64-bit
number. REG_QWORD_LITTLE_ENDIAN A 64-bit number in little-endian format. Windows
is designed to run on little-endian computer architectures. Therefore, this
value is defined as REG_QWORD in the Windows header files. REG_SZ A
null-terminated string. It's either a Unicode or an ANSI string, depending on
whether you use the Unicode or ANSI functions.


STRING VALUES

If data has the REG_SZ, REG_MULTI_SZ, or REG_EXPAND_SZ type, then the string
might not have been stored with the proper terminating null characters. So when
reading a string from the registry, you must ensure that the string is properly
terminated before using it; otherwise, it might overwrite a buffer. Note that
REG_MULTI_SZ strings should have two terminating null characters.

When you write a string to the registry, you must specify the length of the
string, including the terminating null character (\0). A common error is to use
the strlen function to determine the length of the string, but to forget that
strlen returns only the count of characters in the string, not counting the
terminating null. So you should calculate the length of the string with
strlen(string) + 1

A REG_MULTI_SZ string ends with a string of length 0. Therefore, it's not
possible to include a zero-length string in the sequence. An empty sequence
would be defined as follows: \0.

The following example walks a REG_MULTI_SZ string.

C++ Copy


#include <windows.h>
#include <tchar.h>
#include <stdio.h>

void SampleSzz(PTSTR pszz)
{
   _tprintf(_TEXT("\tBegin multi-sz string\n"));
   while (*pszz) 
   {
      _tprintf(_TEXT("\t\t%s\n"), pszz);
      pszz = pszz + _tcslen(pszz) + 1;
   }
   _tprintf(_TEXT("\tEnd multi-sz\n"));
}

int __cdecl main(int argc, char **argv)
{
   // Because the compiler adds a \0 at the end of quoted strings, 
   // there are two \0 terminators at the end. 

   _tprintf(_TEXT("Conventional multi-sz string:\n"));  
   SampleSzz(_TEXT("String1\0String2\0String3\0LastString\0"));

   _tprintf(_TEXT("\nTest case with no strings:\n"));  
   SampleSzz(_TEXT(""));

   return 0;
}



BYTE FORMATS

In little-endian format, a multi-byte value is stored in memory from the lowest
byte (the little end) to the highest byte. For example, the value 0x12345678 is
stored as 0x78 0x56 0x34 0x12 in little-endian format.

In big-endian format, a multi-byte value is stored in memory from the highest
byte (the big end) to the lowest byte. For example, the value 0x12345678 is
stored as 0x12 0x34 0x56 0x78 in big-endian format.

Those terms are light-hearted cultural references to Jonathan Swift's satirical
novel Gulliver's Travels.





--------------------------------------------------------------------------------


FEEDBACK

Was this page helpful?

Yes No
Provide product feedback |
Get help at Microsoft Q&A

--------------------------------------------------------------------------------


ADDITIONAL RESOURCES



--------------------------------------------------------------------------------

Training

Module

Explore Windows architecture - Training

This module provides information about the operating system’s architecture and
supported devices. It also describes the desktop support environment and
troubleshooting terminology.

--------------------------------------------------------------------------------

Events

Nov 19, 12 AM - Nov 23, 12 AM

Gain the competitive edge you need with powerful AI and Cloud solutions at
Microsoft Ignite.

Register now

English (United States)
California Consumer Privacy Act (CCPA) Opt-Out Icon Your Privacy Choices
Theme
 * Light
 * Dark
 * High contrast

 * Manage cookies
 * Previous Versions
 * Blog
 * Contribute
 * Privacy
 * Terms of Use
 * Trademarks
 * © Microsoft 2024


ADDITIONAL RESOURCES

--------------------------------------------------------------------------------

Events

Nov 19, 12 AM - Nov 23, 12 AM

Gain the competitive edge you need with powerful AI and Cloud solutions at
Microsoft Ignite.

Register now

--------------------------------------------------------------------------------

Training

Module

Explore Windows architecture - Training

This module provides information about the operating system’s architecture and
supported devices. It also describes the desktop support environment and
troubleshooting terminology.




IN THIS ARTICLE



English (United States)
California Consumer Privacy Act (CCPA) Opt-Out Icon Your Privacy Choices
Theme
 * Light
 * Dark
 * High contrast

 * Manage cookies
 * Previous Versions
 * Blog
 * Contribute
 * Privacy
 * Terms of Use
 * Trademarks
 * © Microsoft 2024