Understanding __deref_out

1.7k views Asked by At

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.

1

There are 1 answers

0
Jonathan Potter On

"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.