On Sat, 2008-10-25 at 10:06 +0800, Paul Wise wrote:

> I'll work on integrating this with the nsis scons build system and
> propose a patch for inclusion upstream.

I get an error (and several warnings) compiling the resulting System.c:

$ i586-mingw32msvc-gcc -o build/debug/System/Source/System.o -c 
-Wno-write-strings -Wall -g -O0 -g -Wall -fno-strict-aliasing -DSYSTEM_EXPORTS 
Contrib/System/Source/System.c
Contrib/System/Source/System.c: In function 'PrepareProc':
Contrib/System/Source/System.c:392: warning: cast to pointer from integer of 
different size
Contrib/System/Source/System.c:673: warning: cast to pointer from integer of 
different size
Contrib/System/Source/System.c:702: warning: cast to pointer from integer of 
different size
Contrib/System/Source/System.c:725: warning: cast to pointer from integer of 
different size
Contrib/System/Source/System.c: In function 'ParamsIn':
Contrib/System/Source/System.c:807: warning: cast to pointer from integer of 
different size
Contrib/System/Source/System.c: In function 'CreateCallback':
Contrib/System/Source/System.c:918: error: lvalue required as increment operand
Contrib/System/Source/System.c: In function 'DllMain':
Contrib/System/Source/System.c:1022: warning: passing argument 4 of 
'VirtualProtect' from incompatible pointer type

Fixed the error with this patch, would that be the correct change?

diff --git a/Contrib/System/Source/System.c b/Contrib/System/Source/System.c
index 28983b4..970fc6e 100644
--- a/Contrib/System/Source/System.c
+++ b/Contrib/System/Source/System.c
@@ -915,7 +915,7 @@ HANDLE CreateCallback(SystemProc *cbproc)
 
         mem = (char *) (cbproc->Proc = VirtualAlloc(NULL, 10, MEM_COMMIT, 
PAGE_EXECUTE_READWRITE));
         *(mem++) = (char) 0xB8; // Mov eax, const
-        *(((int *)mem)++) = (int) cbproc;
+        *(((int *)mem)+1) = (int) cbproc;
         *(mem++) = (char) 0xe9; // Jmp relative
         *((int *)mem) = (int) RealCallBack;
         *((int *)mem) -= ((int) mem) + 4;

-- 
bye,
pabs

http://wiki.debian.org/PaulWise

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to