Xearinox
Xearinox

Reputation: 3234

What DLLMain lpReserved parameter really mean?

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?

Upvotes: 2

Views: 3493

Answers (1)

David Heffernan
David Heffernan

Reputation: 612804

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.

Upvotes: 7

Related Questions