Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Important
Windows baseline protection is in preview through the Windows Insider Program. General availability is planned for spring 2027. Some information relates to prerelease product that might be modified before it's commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Warning
The API name and type names in this article are subject to change. The preview API is exposed as Experimental_WldpQueryBaselineSecurityMode. Microsoft might rename the function, its types, and its enumeration names, or remove the experimental export entirely, as the API contract is finalized. The API might also return E_NOTIMPL when the underlying feature is turned off. Don't ship production code that depends on the experimental export. The numeric values of the enumerations and the layout of the structure are the binary contract with wldp.dll and won't change meaning, even if names change.
Note
Windows baseline protection was previously referred to as Windows Baseline Security Mode (BSM). The preview API and its types still use the earlier name (for example, WLDP_BASELINE_SECURITY_MODE_STATE_IN). Device management for baseline protection is surfaced in the Microsoft 365 admin center under Baseline security mode.
Windows baseline protection brings foundational Windows security protections together into a single, versioned device security state that Windows evaluates at boot. Instead of checking individual settings such as TPM, secure boot, or virtualization-based security yourself, your app can ask Windows one question: does this device meet the baseline protection requirements?
Baseline protection isn't a switch that the system is placed into. It's a description of the boot that's currently running: a boot meets baseline protection when every requirement in the baseline is in its secure state for that boot.
In this preview, the baseline protection API is a local, audit-mode API. Your app can read the device's baseline protection state and per-requirement details on the device, and use that information for telemetry, auditing, diagnostics, and user guidance. A cloud-verified, attestation-backed API for enforcement scenarios is planned for a later release.
This guide explains:
- What baseline protection is and which protections it covers
- How Windows reports the baseline protection state
- How to call the preview API and interpret the results
- How to use the result for audit and telemetry today
- How to test that your app works on devices that meet the baseline
Why use Windows baseline protection
Historically, apps that needed to understand the integrity of a Windows device ran their own security checks. A banking app might test for a TPM, a game's anti-cheat might inspect driver signing, and an exam-proctoring service might verify secure boot. Each app looked for different things and interpreted the results differently.
During the preview, the most valuable things you can do with the signal are:
Measure. Learn what share of your users' devices meet baseline protection, and which requirements are most often missing.
Guide. Tell users when their device doesn't meet the baseline and send them to Settings to fix it.
Validate compatibility. Confirm your app works when every protection is turned on.
Prepare. Build the plumbing and policy logic you'll later connect to attestation-backed verification.
Baseline protection requirements
A device meets baseline protection only when it meets every requirement in the evaluated version. The current baseline requires:
| Requirement | API criterion value | What it does |
|---|---|---|
| Security processor | WLDP_BASELINE_SECURITY_CRITERION_TPM | Helps protect sensitive data by using dedicated hardware (TPM 2.0 or Microsoft Pluton). |
| Secure Boot | WLDP_BASELINE_SECURITY_CRITERION_SECURE_BOOT | Helps prevent malicious software from loading when the device starts. |
| Virtualization-based security (VBS) | WLDP_BASELINE_SECURITY_CRITERION_VBS | Uses hardware virtualization to create an isolated environment that helps protect critical processes. |
| Memory integrity | WLDP_BASELINE_SECURITY_CRITERION_MEMORY_INTEGRITY | Helps prevent malicious code from running in protected parts of Windows. |
| Signed drivers only | WLDP_BASELINE_SECURITY_CRITERION_SIGNED_DRIVERS_ONLY | Allows only signed drivers to load. |
| Kernel debugger protection | WLDP_BASELINE_SECURITY_CRITERION_KERNEL_DEBUGGER_PROTECTION | Helps prevent tools from bypassing Windows security protections through the kernel debugger. |
| Windows-certified drivers | WLDP_BASELINE_SECURITY_CRITERION_WHQL_ONLY | Allows only drivers that meet Windows hardware signing (WHQL) requirements. |
| Vulnerable driver protection | WLDP_BASELINE_SECURITY_CRITERION_VULNERABLE_DRIVER_BLOCKLIST | Helps prevent known vulnerable drivers from weakening Windows security protections. |
Every one of these protections already exists in Windows 11. What's new is that Windows evaluates them together, as one result.
Versioning and new criteria
Baseline protection is a floor, not a ceiling. Additional criteria will join over time. As a result:
An app built against an older header can see fewer criteria than the system evaluates. Don't assume a full buffer covers the whole baseline.
Your app must tolerate criterion values it doesn't recognize. Report them by number rather than dropping them or failing.
Don't hard-code the number or identity of criteria. Use the overall verdict and enumerate whatever the API returns.
How Windows evaluates baseline protection
Windows evaluates the baseline protection state at boot, using measurements from the security processor. Every requirement is enforced from boot onward, and turning off any requirement requires a restart. Because of this, your app can check the state once per session rather than polling.
Boot state and next-boot state
Every criterion is reported twice, because the two questions apps ask have different answers and different sources:
| View | API field | What it represents | Contributes to the overall verdict? |
|---|---|---|---|
| Boot state | BootState, BootResultCode | What was actually true when the running boot started. Comes from measurements the platform recorded during boot, not from configuration that can change afterward. | Yes. The overall state is derived from each criterion's boot state. |
| Current (next-boot) state | CurrentState, CurrentResultCode | What the device is configured to do now, and therefore what's expected on the next boot. Comes from live system state and configuration. It's a projection, not a promise. | No. It's rolled up separately into nextBootState. |
The two states carry independent result codes because Windows obtains them independently; one can be unavailable while the other is known.
Comparing the two states lets your app distinguish "this device isn't protected" from "this device is configured correctly and needs a restart to finish."
Overall states
| Value | Meaning |
|---|---|
| WLDP_BASELINE_SECURITY_MODE_STATE_IN | Every criterion was evaluated and all are in their secure state. |
| WLDP_BASELINE_SECURITY_MODE_STATE_NOT_IN | Every criterion was evaluated and at least one isn't in its secure state. |
| WLDP_BASELINE_SECURITY_MODE_STATE_UNKNOWN | The state of at least one criterion couldn't be determined, so no statement can be made about the boot. The individual criterion states say which ones and why. |
Criterion states
| Value | Meaning |
|---|---|
| WLDP_BASELINE_SECURITY_CRITERION_STATE_ON | The criterion is in its secure state. |
| WLDP_BASELINE_SECURITY_CRITERION_STATE_OFF | Evaluation succeeded, but the criterion isn't in its secure state. |
| WLDP_BASELINE_SECURITY_CRITERION_STATE_UNKNOWN | The criterion couldn't be evaluated. The accompanying result code explains why. |
| WLDP_BASELINE_SECURITY_CRITERION_STATE_NOT_SUPPORTED | The device can't satisfy this criterion, for example because required hardware or firmware support is absent. |
Warning
The preview API is an audit-mode, local evaluation API. The result is computed and returned on the same device your app is checking, and a remote service can't cryptographically verify it. Don't use it as a security boundary. Use it to observe, measure, and guide. Enforcement scenarios should wait for the attestation-backed API, which is planned for an upcoming release.
API reference (preview)
Caution
Names are subject to change. See the caution at the top of this article.
typedef HRESULT (WINAPI *PFN_Experimental_WldpQueryBaselineSecurityMode)(
_Out_ PEXPERIMENTAL_WLDP_BASELINE_SECURITY_MODE_STATE state,
_Out_opt_ PEXPERIMENTAL_WLDP_BASELINE_SECURITY_MODE_STATE nextBootState,
_In_ DWORD criteriaCount,
_Out_writes_to_opt_(criteriaCount, *criteriaReturned) PEXPERIMENTAL_WLDP_BASELINE_SECURITY_CRITERION_STATUS criteria,
_Out_ PDWORD criteriaReturned
);
Parameters
| Parameter | Description |
|---|---|
| state | Out. The verdict for the boot that's running, derived from each criterion's BootState. Comes from boot measurements. |
| nextBootState | Out, optional. The same roll-up computed over each criterion's CurrentState, that is, what the device is configured to produce on the next boot. A projection, not a promise. |
| criteriaCount | In. The number of entries in the criteria buffer. Pass 0 with criteria = NULL to get only the overall states and the required count. |
| criteria | Out, optional. Buffer that receives one EXPERIMENTAL_WLDP_BASELINE_SECURITY_CRITERION_STATUS per evaluated criterion. |
| criteriaReturned | Out. The number of entries written, or the number required when the buffer is absent or too small. |
Return values
| Value | Meaning |
|---|---|
| S_OK | The query completed. This includes the case where individual criteria couldn't be evaluated. Those results carry WLDP_BASELINE_SECURITY_CRITERION_STATE_UNKNOWN and a reason code. |
HRESULT_FROM_WIN32(ERROR_MORE_DATA) |
The criteria is too small. criteriaReturned holds the required count, and nothing is written to criteria. |
| E_INVALIDARG | Inconsistent arguments, such as state or criteriaReturned is NULL, or criteria is NULL with a non-zero criteriaCount. |
| E_NOTIMPL | The underlying feature is turned off on this system. |
If the build of Windows doesn't include the API, GetProcAddress returns NULL.
Choose how to call the API
Most apps only need the yes or no answer, and that answer takes a single call. The per-criterion report is a second, optional call. Use it only when you need the detail.
| You need | How to call |
|---|---|
| "Does this device meet baseline protection?" | One call with criteriaCount = 0 and criteria = NULL. Both overall states still come back. |
| Per-criterion detail (telemetry, diagnostics) | The two-call pattern: get the count, allocate, call again, and retry on ERROR_MORE_DATA. |
Resolve the function
Because the preview function isn't in wldp.lib, load wldp.dll from System32 and resolve the export at run time:
HMODULE wldp = LoadLibraryExW(L"wldp.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32);
if (wldp == nullptr)
{
// Record that the state couldn't be read, and continue normally.
}
auto queryBsm = reinterpret_cast<PFN_Experimental_WldpQueryBaselineSecurityMode>(
GetProcAddress(wldp, "Experimental_WldpQueryBaselineSecurityMode"));
if (queryBsm == nullptr)
{
// This build of Windows doesn't include the API. Continue normally.
}
The common case: one call
This approach works for most apps:
EXPERIMENTAL_WLDP_BASELINE_SECURITY_MODE_STATE state = WLDP_BASELINE_SECURITY_MODE_STATE_UNKNOWN;
EXPERIMENTAL_WLDP_BASELINE_SECURITY_MODE_STATE nextBootState = WLDP_BASELINE_SECURITY_MODE_STATE_UNKNOWN;
DWORD ignoredCount = 0;
HRESULT hr = queryBsm(&state, &nextBootState, 0, nullptr, &ignoredCount);
if (SUCCEEDED(hr) && state == WLDP_BASELINE_SECURITY_MODE_STATE_IN)
{
// The device met the baseline for this boot. Record it.
}
Request nextBootState even in the simple case. It costs nothing, and it makes the difference between telling a user "your device isn't protected" and "your device is already configured correctly; restart to finish," which are very different messages.
The detailed case: two calls
The per-criterion report is mainly useful for telemetry: recording which criteria are off across your app's install base, so you see the full picture rather than just the pass/fail rate.
Call once with
criteriaCount = 0andcriteria = NULLto get the count. Both overall states are still returned.Allocate a buffer of that size, then call again.
Retry on
ERROR_MORE_DATA. The criteria list grows over time, so the count can change between calls.
See the full sample for the complete pattern.
Interpret the result
Overall state
Use state and nextBootState together. In audit mode, your app's response should be informational, never blocking.
| state | nextBootState | What it means | Suggested audit-mode behavior |
|---|---|---|---|
| In | In | The device meets baseline protection. | Record the result. No user action needed. |
| Not in / Unknown | In | The device is configured correctly but needs a restart. | Record the result. Optionally suggest a restart. |
| In | Not in | The device met the baseline this boot, but a protection has since been turned off. | Record the result. Optionally tell the user a protection will be off after restart. |
| Not in | Not in | One or more protections are off. | Record the result. Optionally tell the user and link to Settings. |
| Unknown | Any | Windows couldn't determine the state. | Record per-criterion result codes. Don't present it to users as a problem with their device. |
Individual criteria
| BootState | CurrentState | Meaning |
|---|---|---|
| Off | On | Configured; takes effect after a restart. |
| On | Off | Was secure this boot, has since been turned off; won't be secure next boot. |
| On | On | Steady state. |
| Unknown | Any | Couldn't be evaluated. BootResultCode carries the reason. |
Send users to Settings to fix missing protections
Your app might want to show information about a particular criterion, but the general guidance is not to build your own remediation flow. Instead, send the user to the Settings app. Settings is designed to give a one-click experience for bringing the device back into baseline protection, and it stays correct as the criteria change.
If you create your own remediation flow, you duplicate logic that changes whenever a criterion is added. Each criterion is fixed in a different place, such as firmware setup, policy, or driver configuration. Settings already handles that, including guiding users through firmware (UEFI) changes such as turning on secure boot or the TPM.
Launch the baseline protection page in Settings with this URI or visit Settings > Baseline protection:
ShellExecuteW(nullptr, L"open", L"ms-settings:baseline-protection", nullptr, nullptr, SW_SHOWNORMAL);
Note
During the preview, this Settings page is gated and might not appear on the build of Windows you're testing.
Note
On managed devices, users might not be able to change these settings themselves. In that case, tell users to contact their IT administrator. IT administrators manage baseline protection by using Baseline security mode in the Microsoft 365 admin center, Microsoft Intune, or third-party management tools.
Sample: Query baseline protection and print each criterion
This sample takes the detailed path, so it shows run-time resolution, the sizing loop, and the error handling that every caller needs. For the common yes or no case, keep the same setup and use the single call.
//
// Sample: query baseline protection and print each criterion.
//
// Build: cl /std:c++17 /EHsc bsmsample.cpp
// The API is a PRIVATE export of wldp.dll, so no import library is needed.
//
#include <windows.h>
//
// wldp_bsm.h is the header from Appendix A. Once your Windows SDK declares the
// API, delete it and include <wldp.h> instead.
//
#include "wldp_bsm.h"
#include <cstdio>
#include <vector>
namespace
{
const wchar_t* ModeStateToString(EXPERIMENTAL_WLDP_BASELINE_SECURITY_MODE_STATE state)
{
switch (state)
{
case WLDP_BASELINE_SECURITY_MODE_STATE_IN: return L"In baseline protection";
case WLDP_BASELINE_SECURITY_MODE_STATE_NOT_IN: return L"Not in baseline protection";
case WLDP_BASELINE_SECURITY_MODE_STATE_UNKNOWN: return L"Unknown";
default: return L"<unrecognized>";
}
}
const wchar_t* CriterionStateToString(EXPERIMENTAL_WLDP_BASELINE_SECURITY_CRITERION_STATE state)
{
switch (state)
{
case WLDP_BASELINE_SECURITY_CRITERION_STATE_ON: return L"On";
case WLDP_BASELINE_SECURITY_CRITERION_STATE_OFF: return L"Off";
case WLDP_BASELINE_SECURITY_CRITERION_STATE_NOT_SUPPORTED: return L"Not supported";
case WLDP_BASELINE_SECURITY_CRITERION_STATE_UNKNOWN: return L"Unknown";
default: return L"<unrecognized>";
}
}
//
// Criteria are appended over time, so anything past the end of this table is
// reported by number rather than dropped.
//
const wchar_t* CriterionToString(EXPERIMENTAL_WLDP_BASELINE_SECURITY_CRITERION criterion)
{
switch (criterion)
{
case WLDP_BASELINE_SECURITY_CRITERION_TPM: return L"TPM";
case WLDP_BASELINE_SECURITY_CRITERION_SECURE_BOOT: return L"Secure Boot";
case WLDP_BASELINE_SECURITY_CRITERION_VBS: return L"VBS";
case WLDP_BASELINE_SECURITY_CRITERION_MEMORY_INTEGRITY: return L"Memory Integrity";
case WLDP_BASELINE_SECURITY_CRITERION_SIGNED_DRIVERS_ONLY: return L"Signed Drivers Only";
case WLDP_BASELINE_SECURITY_CRITERION_KERNEL_DEBUGGER_PROTECTION: return L"Kernel Debugger Protection";
case WLDP_BASELINE_SECURITY_CRITERION_WHQL_ONLY: return L"WHQL Only";
case WLDP_BASELINE_SECURITY_CRITERION_VULNERABLE_DRIVER_BLOCKLIST: return L"Vulnerable Driver Blocklist";
default: return nullptr;
}
}
}
int wmain()
{
HMODULE wldp = LoadLibraryExW(L"wldp.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32);
if (wldp == nullptr)
{
wprintf(L"LoadLibraryExW(wldp.dll) failed: %lu\n", GetLastError());
return 1;
}
auto queryBsm = reinterpret_cast<PFN_Experimental_WldpQueryBaselineSecurityMode>(
GetProcAddress(wldp, "Experimental_WldpQueryBaselineSecurityMode"));
if (queryBsm == nullptr)
{
wprintf(L"This build of wldp.dll does not export the API: %lu\n", GetLastError());
FreeLibrary(wldp);
return 1;
}
EXPERIMENTAL_WLDP_BASELINE_SECURITY_MODE_STATE state = WLDP_BASELINE_SECURITY_MODE_STATE_UNKNOWN;
EXPERIMENTAL_WLDP_BASELINE_SECURITY_MODE_STATE nextBootState = WLDP_BASELINE_SECURITY_MODE_STATE_UNKNOWN;
std::vector<EXPERIMENTAL_WLDP_BASELINE_SECURITY_CRITERION_STATUS> criteria;
DWORD returned = 0;
//
// Size the buffer, then fill it. The loop re-sizes because the criterion list
// can be longer than the header this sample was built against.
//
HRESULT hr = queryBsm(&state, &nextBootState, 0, nullptr, &returned);
for (int attempt = 0; SUCCEEDED(hr) && attempt < 4; ++attempt)
{
criteria.assign(returned, EXPERIMENTAL_WLDP_BASELINE_SECURITY_CRITERION_STATUS{});
hr = queryBsm(
&state,
&nextBootState,
static_cast<DWORD>(criteria.size()),
criteria.empty() ? nullptr : criteria.data(),
&returned);
if (hr != HRESULT_FROM_WIN32(ERROR_MORE_DATA))
{
break;
}
//
// ERROR_MORE_DATA leaves the buffer untouched and puts the required count
// in returned, so just grow and retry.
//
hr = S_OK;
}
if (hr == E_NOTIMPL)
{
wprintf(L"Baseline protection is not enabled on this system.\n");
FreeLibrary(wldp);
return 0;
}
if (FAILED(hr))
{
wprintf(L"Experimental_WldpQueryBaselineSecurityMode failed: 0x%08X\n", hr);
FreeLibrary(wldp);
return 1;
}
wprintf(L"This boot : %s\n", ModeStateToString(state));
wprintf(L"Next boot : %s\n\n", ModeStateToString(nextBootState));
if (state != WLDP_BASELINE_SECURITY_MODE_STATE_IN &&
nextBootState == WLDP_BASELINE_SECURITY_MODE_STATE_IN)
{
wprintf(L"Configured correctly; restart to finish.\n\n");
}
for (DWORD i = 0; i < returned; ++i)
{
const auto& entry = criteria[i];
const wchar_t* name = CriterionToString(entry.Criterion);
if (name != nullptr)
{
wprintf(L"%-28s", name);
}
else
{
wprintf(L"Criterion %-18u", static_cast<unsigned>(entry.Criterion));
}
wprintf(
L" boot=%-14s (0x%08X) current=%-14s (0x%08X)\n",
CriterionStateToString(entry.BootState),
entry.BootResultCode,
CriterionStateToString(entry.CurrentState),
entry.CurrentResultCode);
}
FreeLibrary(wldp);
return 0;
}
Use baseline protection for audit and telemetry
Audit mode is the right time to understand your user base before any enforcement is possible. We recommend that your app records:
| Field | Why it's useful |
|---|---|
| state | Share of devices that meet baseline protection today |
| nextBootState | Share of devices with a pending change (for example, waiting for a restart) |
| Per-criterion BootState and CurrentState | Which requirements are most often missing |
| Per-criterion BootResultCode and CurrentResultCode | Diagnosing Unknown results and unexpected behavior |
| API HRESULT (including E_NOTIMPL or a missing export) | Separating availability failures from device state |
| Windows build number | Correlating results with Windows versions |
| Timestamp | Tracking changes in your population over time |
Use this data to:
Estimate how many of your users would be affected if you later require baseline protection for a feature.
Prioritize user guidance for the requirements that are most often missing.
Find compatibility problems between your app and specific protections.
Plan the policy you'll apply once attestation-backed verification is available.
Test your app on devices that meet baseline protection
Make sure your app works when all baseline protection requirements are turned on. If your app depends on any of these protections being off (for example, it installs an unsigned or non-certified driver, or needs the kernel debugger), it depends on a weakened platform state and might not work on protected devices.
Try this test flow:
Set up a test device or VM that meets baseline protection.
Call the API and record
stateandnextBootState.Enumerate the criteria and record
BootState,CurrentState, and both result codes for each.Change one supported security setting.
Query the API again before restarting and record the result.
Restart, query again, and compare the new boot state and current state.
Confirm that your app's core scenarios work with all protections turned on.
When you report an unexpected result, include the Windows build number, the returned states and result codes, and reproduction steps.
Best practices
Observe, don't enforce. In preview, use the result for telemetry, auditing, diagnostics, and user guidance only. Don't block, deny, or downgrade users based on it.
Don't ship a dependency on the experimental export. The name might change or be removed. Always handle a
NULLfromGetProcAddressand anE_NOTIMPLresult.Use the platform signal instead of building your own checks. Don't reimplement baseline protection by independently querying TPM, secure boot, VBS, or driver settings.
Use one call when that's all you need. Request per-criterion detail only when you'll use it.
Always request
nextBootState. It tells you whether the user just needs to restart.Retry on
ERROR_MORE_DATA. The criteria list can grow.Tolerate unrecognized criteria. Report them by number; never assume your header lists every criterion.
Keep result codes. Include both per-criterion result codes in your logs and diagnostics.
Send users to Settings. Deep-link to
ms-settings:baseline-protectioninstead of building your own remediation.Respect managed devices. Route users on managed devices to their IT administrator.
Don't assume Unknown means insecure. An unknown state means Windows couldn't establish the state. Handle it separately from "not in baseline protection."
Frequently asked questions
Can I use the preview API to block users or gate access? No. The preview API is a local, audit-mode API, and a remote service can't independently verify its result. Use it for telemetry, auditing, and user guidance. Enforcement scenarios should use the attestation-backed API when it becomes available.
Will the API name change? It might. Experimental_WldpQueryBaselineSecurityMode and its type names are subject to change before the API is finalized. Enumeration values and the structure layout won't change meaning. When your SDK's wldp.h declares the final API, switch to it.
How is Windows baseline protection different from security baselines in Intune? Intune security baselines are admin-defined groups of recommended settings. Windows baseline protection is a Microsoft-defined, versioned device security state that Windows evaluates at boot and reports to apps and services.
Is baseline protection the same as Baseline security mode in the Microsoft 365 admin center? Baseline security mode in the Microsoft 365 admin center is where IT administrators report on and manage baseline protection for the Windows devices in their organization, alongside other Microsoft 365 recommendations.
Does my app need to turn on baseline protection? No. Your app reads the state. Users turn on protections in Settings, and IT administrators manage them through their management tools.