What DLLMain lpReserved parameter really mean?

dll, internals, winapi, windows

Solution

The quote in the question contains all the information that you are permitted to rely on:

If fdwReason is DLL_PROCESS_ATTACH, lpvReserved is NULL for dynamic loads and non-NULL for static loads.

All you are entitled to do is treat `lpvReserved` as a boolean that signals information about whether the load is dynamic or static (aka implicit).

It's perfectly plausible that there are versions of Windows for which `lpvReserved` carries more information that a plain boolean. However, that is a private implementation detail and you should not rely on that.

Problem

One of well-known DLLMain function parameters is LPVOID lpvReserved. From MSDN documentation: If fdwReason is DLL_PROCESS_ATTACH, lpvReserved is NULL for dynamic loads and non-NULL for static loads. But what lpReserved really mean? Is pointer to somenthing?

Original source