From: Sebastian Lackner Subject: ole32: Fix an invalid usage of InterlockedCompareExchange. Message-Id: <54F53C30.3090208@fds-team.de> Date: Tue, 03 Mar 2015 05:44:32 +0100 The result of InterlockedCompareExchange is compared against the new value instead of the old value. No critical issue, but it needs two loops until it finally finishes instead of one. --- dlls/ole32/marshal.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) From 21ec337f85e2c0c042db7aecf8224839fd191efa Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Tue, 3 Mar 2015 05:39:46 +0100 Subject: ole32: Fix an invalid usage of InterlockedCompareExchange. --- dlls/ole32/marshal.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dlls/ole32/marshal.c b/dlls/ole32/marshal.c index b308600..c5c2023 100644 --- a/dlls/ole32/marshal.c +++ b/dlls/ole32/marshal.c @@ -805,11 +805,12 @@ static HRESULT proxy_manager_construct( static inline void proxy_manager_set_context(struct proxy_manager *This, MSHCTX dest_context, void *dest_context_data) { - MSHCTX old_dest_context = This->dest_context; + MSHCTX old_dest_context; MSHCTX new_dest_context; do { + old_dest_context = This->dest_context; new_dest_context = old_dest_context; /* "stronger" values overwrite "weaker" values. stronger values are * ones that disable more optimisations */ @@ -853,7 +854,7 @@ static inline void proxy_manager_set_context(struct proxy_manager *This, MSHCTX if (old_dest_context == new_dest_context) break; - old_dest_context = InterlockedCompareExchange((PLONG)&This->dest_context, new_dest_context, old_dest_context); + new_dest_context = InterlockedCompareExchange((PLONG)&This->dest_context, new_dest_context, old_dest_context); } while (new_dest_context != old_dest_context); if (dest_context_data) -- 2.3.0