[ros-dev] question about InterlockedCompareExchange.

Alex Ionescu ionucu at videotron.ca
Sat Oct 11 01:08:47 CEST 2008


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 at 12
> .text:7C8097A2 _InterlockedCompareExchange at 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 at 12 endp
> _______________________________________________
> Ros-dev mailing list
> Ros-dev at reactos.org
> http://www.reactos.org/mailman/listinfo/ros-dev

Best regards,
Alex Ionescu

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.reactos.org/pipermail/ros-dev/attachments/20081010/96b73b03/attachment.html 


More information about the Ros-dev mailing list