Repository: PowerShell/PowerShell
File: src/System.Management.Automation/namespaces/FileSystemProvider.cs (C#)

Code before:
            {
                if (reader != null)
                {
                    ((IDisposable)reader).Dispose();
                }
            }

            return string.Empty;
        }

        #endregion

        #region CmdletProvider members
        // OneDrive placeholder support (issue #8315)
#if !UNIX
        [DllImport("ntdll.dll")]
        static extern sbyte RtlQueryProcessPlaceholderCompatibilityMode();
        [DllImport("ntdll.dll")]
        static extern sbyte RtlSetProcessPlaceholderCompatibilityMode(sbyte pcm);

        const sbyte PHCM_APPLICATION_DEFAULT = 0;
        const sbyte PHCM_DISGUISE_PLACEHOLDER = 1;
        const sbyte PHCM_EXPOSE_PLACEHOLDERS = 2;
        const sbyte PHCM_MAX = 2;
        const sbyte PHCM_ERROR_INVALID_PARAMETER = -1;
        const sbyte PHCM_ERROR_NO_TEB = -2;

#endif


        /// <summary>
        /// Starts the File System provider.  This method sets the Home for the
        /// provider to providerInfo.Home if specified, and %USERPROFILE%
        /// otherwise.
        /// </summary>
        /// <param name="providerInfo">
        /// The ProviderInfo object that holds the provider's configuration.
        /// </param>
        /// <returns>
        /// The updated ProviderInfo object that holds the provider's configuration.
        /// </returns>
        protected override ProviderInfo Start(ProviderInfo providerInfo)
        {
            // Set the home folder for the user
            if (providerInfo != null && string.IsNullOrEmpty(providerInfo.Home))
            {
                // %USERPROFILE% - indicate where a user's home directory is located in the file system.
                string homeDirectory = Environment.GetEnvironmentVariable(Platform.CommonEnvVariableNames.Home);

                if (!string.IsNullOrEmpty(homeDirectory))
                {

Review comment (refactor):
Seems like you could define an enum type for this purpose? The PHCM_MAX constant would either be implicit or a duplicate/Alias definition to the EXPOSE_PLACEHOLDERS value.

Code after:
            {
                if (reader != null)
                {
                    ((IDisposable)reader).Dispose();
                }
            }

            return string.Empty;
        }

        #endregion

        #region CmdletProvider members
        /// <summary>
        /// Starts the File System provider.  This method sets the Home for the
        /// provider to providerInfo.Home if specified, and %USERPROFILE%
        /// otherwise.
        /// </summary>
        /// <param name="providerInfo">
        /// The ProviderInfo object that holds the provider's configuration.
        /// </param>
        /// <returns>
        /// The updated ProviderInfo object that holds the provider's configuration.
        /// </returns>
        protected override ProviderInfo Start(ProviderInfo providerInfo)
        {
            // Set the home folder for the user
            if (providerInfo != null && string.IsNullOrEmpty(providerInfo.Home))
            {
                // %USERPROFILE% - indicate where a user's home directory is located in the file system.
                string homeDirectory = Environment.GetEnvironmentVariable(Platform.CommonEnvVariableNames.Home);

                if (!string.IsNullOrEmpty(homeDirectory))
                {
                    if (Directory.Exists(homeDirectory))
                    {
                        s_tracer.WriteLine("Home = {0}", homeDirectory);
                        providerInfo.Home = homeDirectory;
                    }
                    else
                        s_tracer.WriteLine("Not setting home directory {0} - does not exist", homeDirectory);
                }
            }

            // OneDrive placeholder support (issue #8315)
            // make it so OneDrive placeholders are perceived as such with *all* their attributes accessible
#if !UNIX
            // The placeholder mode management APIs Rtl(Set|Query)(Process|Thread)PlaceholderCompatibilityMode
            // are only supported starting with Windows 10 version 1803 (build 17134)
            Version minBuildForPlaceHolderAPIs = new Version(10, 0, 17134, 0);
            if (Environment.OSVersion.Version >= minBuildForPlaceHolderAPIs)