Konrad
Konrad

Reputation: 40947

When will DllMain be called with the DLL_PROCESS_VERIFIER flag?

On Windows, the standard DLL entry point is called DllMain. The second parameter is a DWORD, ul_reason_for_call.

I have looked up the possible values for this second parameter on MSDN. The following are obvious:

DLL_PROCESS_ATTACH:
DLL_THREAD_ATTACH:
DLL_THREAD_DETACH:
DLL_PROCESS_DETACH:

But what about:

DLL_PROCESS_VERIFIER

When will the entry point be called with this flag? Should I worry about it during 'normal' operation of the DLL?

Note that I only see DLL_PROCESS_VERIFIER in header files from Visual Studio 2005, not 2008.

Upvotes: 3

Views: 2134

Answers (3)

Hans Passant
Hans Passant

Reputation: 941277

This is really obscure. It is not ever documented in the SDK and doesn't appear in the SDK header files. Google produces only a few hits, most sites are down or untrusted. The only decent hit I get is XBox code, it only declares it but doesn't actually use it.

I'm not sufficiently convinced that this is a real code that you'd ever encounter in a regular Windows program.

Upvotes: 1

Adam Driscoll
Adam Driscoll

Reputation: 9483

I think it can have then value if it is run through Application Verifier. Kind of guessing :)

Upvotes: 0

Chris Becke
Chris Becke

Reputation: 36016

I guess in theory Microsoft could invent new usages and flags any time they feel they need a new one. So the simple rule is to ensure that your code tolerates unexpected values: i.e. write it to handle the cases that you need to handle and ignore the rest, by returning zero.

Upvotes: 5

Related Questions