GetDeveloperDriveEnablementState function (sysinfoapi.h)

Gets a value indicating whether the developer drive is enabled.

Syntax

DEVELOPER_DRIVE_ENABLEMENT_STATE GetDeveloperDriveEnablementState();

Return value

Returns a DEVELOPER_DRIVE_ENABLEMENT_STATE value indicating the developer drive enablement state.

Remarks

GetDeveloperDriveEnablementState returns information indicating whether the developer drive feature is enabled. If the developer drive feature is disabled, the DEVELOPER_DRIVE_ENABLEMENT_STATE returned indicates whether developer drive is disabled via group policy or via local policy.

If GetDeveloperDriveEnablementState fails, it returns DeveloperDriveEnablementStateError and sets the last error.

Examples

The following example shows how to use GetDeveloperDriveEnablementState to determine whether the developer drive is enabled.

#include <Windows.h>

void PrintDevDriveEnabledStatus()
{
    DEVELOPER_DRIVE_ENABLEMENT_STATE state = GetDeveloperDriveEnablementState();

    switch (state) {
    case DeveloperDriveEnabled:
        printf("Developer drive is enabled.\n");
        break;
    case DeveloperDriveDisabledByGroupPolicy:
        printf("Developer drive is disabled by Group Policy.\n");
        break;
    case DeveloperDriveEnablementStateError:
        printf("Error querying developer drive info: %d\n", GetLastError());
        break;
    case DeveloperDriveDisabledBySystemPolicy:
    default:
        printf("Developer drive is disabled.");
        break;
    }
}

Requirements

Requirement Value
Minimum supported client Windows 11 23H2 [desktop apps only]
Target Platform Windows
Header sysinfoapi.h (include Windows.h)
DLL api-ms-win-core-sysinfo-l1-2-6.dll

See also

DEVELOPER_DRIVE_ENABLEMENT_STATE