A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-lockresource below:

LockResource function (libloaderapi.h) - Win32 apps

LockResource function (libloaderapi.h)

In this article

Retrieves a pointer to the specified resource in memory.

Syntax
LPVOID LockResource(
  [in] HGLOBAL hResData
);
Parameters

[in] hResData

Type: HGLOBAL

A handle to the resource to be accessed. The LoadResource function returns this handle. Note that this parameter is listed as an HGLOBAL variable only for backward compatibility. Do not pass any value as a parameter other than a successful return value from the LoadResource function.

Return value

Type: LPVOID

If the loaded resource is available, the return value is a pointer to the first byte of the resource; otherwise, it is NULL.

The pointer returned by LockResource is valid until the module containing the resource is unloaded. It is not necessary to unlock resources because the system automatically deletes them when the process that created them terminates.

Do not try to lock a resource by using the handle returned by the FindResourceA function or FindResourceExA function function. Such a handle points to random data.

Note

LockResource does not actually lock memory; it is just used to obtain a pointer to the memory containing the resource data. The name of the function comes from versions prior to Windows XP, when it was used to lock a global memory block allocated by LoadResource.

Examples

For an example, see Updating Resources.

Requirements Requirement Value Minimum supported client Windows 2000 Professional [desktop apps only] Minimum supported server Windows 2000 Server [desktop apps only] Target Platform Windows Header libloaderapi.h (include Windows.h) Library Kernel32.lib DLL Kernel32.dll See also Conceptual Reference

Additional resources

In this article

Was this page helpful?


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4