From 8e1d4cedccb53559a4c624ccc112bec1db7912fa Mon Sep 17 00:00:00 2001 From: Ming Fang Date: Sun, 3 Jul 2016 03:04:49 +0800 Subject: [PATCH] Fix bug in 64bit windows Windows use LLP64 mode, the long is still 32bit. So we need to use LONGLONG when calling SetWindowLongPtr. --- Common/Source/Win32/esUtil_win32.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Common/Source/Win32/esUtil_win32.c b/Common/Source/Win32/esUtil_win32.c index 0b28e43..5f3c3d2 100644 --- a/Common/Source/Win32/esUtil_win32.c +++ b/Common/Source/Win32/esUtil_win32.c @@ -164,7 +164,12 @@ GLboolean WinCreate ( ESContext *esContext, const char *title ) // Set the ESContext* to the GWL_USERDATA so that it is available to the // ESWindowProc - SetWindowLongPtr ( esContext->eglNativeWindow, GWL_USERDATA, ( LONG ) ( LONG_PTR ) esContext ); +#ifdef _WIN64 + //In LLP64 LONG is stll 32bit. + SetWindowLongPtr( esContext->eglNativeWindow, GWL_USERDATA, ( LONGLONG ) ( LONG_PTR )esContext); +#else + SetWindowLongPtr ( esContext->eglNativeWindow, GWL_USERDATA, ( LONG ) ( LONG_PTR ) esContext ); +#endif if ( esContext->eglNativeWindow == NULL )