From 3131a7d72894306318e76522f3ac34513ebb3ef1 Mon Sep 17 00:00:00 2001 From: kichik Date: Sat, 5 Aug 2006 11:01:35 +0000 Subject: [PATCH] fixed bug #1535007 - System.dll returns bad values, if function returns short git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4721 212acab6-be3b-0410-9dea-997c60f758d6 --- Contrib/System/Source/System.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Contrib/System/Source/System.c b/Contrib/System/Source/System.c index 9430ba22..719ea7fd 100644 --- a/Contrib/System/Source/System.c +++ b/Contrib/System/Source/System.c @@ -943,6 +943,18 @@ SystemProc __declspec(naked) *CallProc(SystemProc *proc) SYSTEM_EVENT("\n\t\t\tNear call ") SYSTEM_LOG_POST; + // workaround for bug #1535007 + // http://sf.net/tracker/index.php?func=detail&aid=1535007&group_id=22049&atid=373085 + // + // If a function returns short and doesn't clear eax in the process, + // it will only set 2 bytes of eax, and the other 2 bytes remain + // "random". In this case, they'll be part of the proc pointer. + // + // To avoid this, eax is cleared before the function is called. This + // makes sure the value eax will contain is only what the function + // actually sets. + _asm xor eax, eax + _asm { // Call