| Previous | Next |
| ERROR_PREDEFINED_HANDLE | ERROR_SERVICE_NOTIFICATION |
ERROR_WAS_UNLOCKED
A memory page was unlocked as a side effect of changing protection
ERROR_WAS_UNLOCKED corresponds to Win32 error value documented as: {Page Unlocked} The page protection of a locked page was changed to 'No Access' and the page was unlocked from memory and from the process. The affected page had been locked in physical memory, but a protection change made it inaccessible and Windows removed the lock. The return conveys a state transition that callers may need to account for rather than a simple failure.
Where the result appears in real systems
- Low-level memory managers combining VirtualLock with VirtualProtect.
- Debuggers and instrumentation engines changing page access.
- Security software temporarily marking regions as no-access.
What to collect before making changes
Log the base address, region size, old and requested protection flags, and whether VirtualLock previously succeeded; inspect the complete region with VirtualQuery; confirm that page boundaries and sizes are calculated correctly.
Handling and recovery
Treat the page as no longer locked and rebuild the intended sequence explicitly. If the page must remain resident, restore an accessible protection first and call VirtualLock again only after checking the security and resource implications.
What not to infer from this code
This result differs from ERROR_NOT_LOCKED: it reports that a page had been locked and then lost that state because another operation changed its protection.
References
Looking for a different code? Search another status or error code.