One of our senior emea Windows SDK Engineer, Nitin Dhawan, got an interesting issue where  an application was failing to save a registry key to a file on local disk using RegSaveKey(). Investigating further, he found that the API RegSaveKey() was failing with Win32 error 1450 as reported by GetLastError().

 Winerror.h has details about error 1450 as below-

 //

//
MessageId: ERROR_NO_SYSTEM_RESOURCES

//

//
MessageText:

//

//
Insufficient system resources exist to complete the requested service.

//

#define ERROR_NO_SYSTEM_RESOURCES       1450L

 Registry APIs use paged-pool memory for its operations. Paged-pool memory is limited on the machine and shared by multiple components on the system. So if the memory allocation request by RegSaveKey() is not
successful, it returned with error ERROR_NO_SYSTEM_RESOURCES. This may happen even if the paged-pool memory is available but it is fragmented in a way that there is no single block of free memory available to fulfill the request. 

In  this issue, RegSaveKey() was failing with ERROR_NO_SYSTEM_RESOURCES, because the size of the registry key was about 16MB which application was trying to save to the file on local disk.

Note: This link on MSDN has information about Registry Element Size Limits (Windows) . For a registry value the recommendation is less than 1 MB of size or any value more than 2KB should be stored in file and application should be using the file  not the registry.

 The error ERROR_NO_SYSTEM_RESOURCES may happen in other scenarios as well, references as kb article links provided below:

You receive error 1450 "ERROR_NO_SYSTEM_RESOURCES" when you try to create a very large file in Windows XP

http://support.microsoft.com/kb/913872

Backup program is unsuccessful when you back up a large system volume

 http://support.microsoft.com/kb/304101

 Written by: Nitin Dhawan, Senior Support Engineer

Blog Reviewed by: Jeff Lambert(Sr. Escalation Engineer)

 

Follow us on Twitter, www.twitter.com/WindowsSDK.