The assembly looks perfectly fine.
cmp dword ptr [ebp+0Ch],0
is the comparison on pReceivePin
with NULL
. pReceivePin
is a local variable inside your function, so its address is an offset from the beginning of the function's stack frame. ebp
holds the address of the beginning of the stack frame. 0Ch
is the offset of pReceivePin
inside the stack frame. All local variables in your function will be addressed as [ebp + something]
, except for parameters. Parameters are usually addressed as [ebp - something]
.
mov eax,80004003h
is nothing else than E_POINTER
value placed into the "return value" area of the function (register eax
is used for that purpose).
The final jmp
sends control to the epilogue code of the current function (CBasePin::Connect
), which ends in ret
command (and "returns" the current eax
value, i.e. E_POINTER
)
The middle jne
sens control to the code immediately after your macro, if pReceivePin
is not equal to E_POINTER
.