Bugaboo
Bugaboo

Reputation: 971

Understanding __deref_out

I am new to Windows programming and I can't seem to find any resources on understanding what this SAL annotation means. I'm basically trying to look for examples so I know exactly what this means both for the caller and the callee.

The MSDN article here was of no help.

Any help would be appreciated.

Upvotes: 1

Views: 1824

Answers (1)

Jonathan Potter
Jonathan Potter

Reputation: 37152

"deref" means there's a level of indirection in the passed in pointer. So instead of:

DWORD Function(BYTE* pBuffer);
// pBuffer is a pointer to a BYTE buffer

You might have:

DWORD Function(BYTE** ppBuffer);
// pBuffer is a pointer to another pointer
// To access the buffer, dereference the pointer:
// BYTE* pBuffer = *ppBuffer;

"opt" means the value is optional, that is ppBuffer may be equal to nullptr.

Upvotes: 4

Related Questions