This function relinquishes access to an area of shared memory.


BOOL SHUnlockShared (LPVOID lpData);


The lpData argument is the address of the shared memory area.

Return Value

The function returns a non-zero value if successful, else FALSE.


The shared memory area lies within a view of a file-mapping object in the address space of the current process. This function unmaps that view.


The SHUnlockShared function is exported from SHLWAPI.DLL as ordinal 9 in version 4.71 and higher.

Though this function dates from as long ago as 1997, it was still not documented by Microsoft in the MSDN Library at least as late as the CD edition dated January 2004.

The function also exists indirectly as an export from SHELL32.DLL. Indeed, this existence predates its implementation in SHLWAPI. The NT releases of SHELL32 version 4.00, as long ago as 1996, and all releases of later SHELL32 versions export SHUnlockShared as ordinal 522. From SHELL32 version 4.71, the implementation in SHELL32 is just a jump to the corresponding implementation imported from SHLWAPI. Late builds of SHELL32 version 6.00 export the function by name. This change may be related to Microsoft’s programme of documenting interfaces for compliance with a consent decree. A SHELL32 function named SHUnlockShared was documented among the Settlement Program Interfaces in December 2002. The function is said there to require SHELL32 “version 5.0 or later”, as if to ignore three years or more of earlier existence.