On a further note, please don't paste Windows disassembly on this mailing list.

On 10-Oct-08, at 2:27 PM, Jack Yi wrote:

question about InterlockedCompareExchange.
 
MSDN says: The function returns the initial value of the destination.
I just don't understand, why can we get the initial value of destination as return value by 'return 0Ch' ?
Thank you!
 
 
.text:7C8097A2 ; PVOID __stdcall InterlockedCompareExchange(PVOID *Destination,PVOID Exchange,PVOID Comperand)
.text:7C8097A2                 public _InterlockedCompareExchange@12
.text:7C8097A2 _InterlockedCompareExchange@12 proc near
.text:7C8097A2                                         ; CODE XREF: BaseComputeProcessDllPath(x,x)+97B3p
.text:7C8097A2                                         ; CreateActCtxW(x)+15D2Dp
.text:7C8097A2
.text:7C8097A2 Destination     = dword ptr  4
.text:7C8097A2 Exchange        = dword ptr  8
.text:7C8097A2 Comperand       = dword ptr  0Ch
.text:7C8097A2
.text:7C8097A2                 mov     ecx, [esp+Destination]
.text:7C8097A6                 mov     edx, [esp+Exchange]
.text:7C8097AA                 mov     eax, [esp+Comperand]
.text:7C8097AE
.text:7C8097AE loc_7C8097AE:                           ; DATA XREF: .data:7C884014o
.text:7C8097AE                 lock cmpxchg [ecx], edx
.text:7C8097B2                 retn    0Ch
.text:7C8097B2 _InterlockedCompareExchange@12 endp
_______________________________________________
Ros-dev mailing list
Ros-dev@reactos.org
http://www.reactos.org/mailman/listinfo/ros-dev

Best regards,
Alex Ionescu