Getting windows handle error Run-Time Check Failure #2 - Stack around the variable 'ret' was corrupted

Problems building or running the engine, queries about how to use features etc.
Post Reply
Niubbo
Goblin
Posts: 211
Joined: Sat Jan 23, 2016 11:26 am
x 17

Getting windows handle error Run-Time Check Failure #2 - Stack around the variable 'ret' was corrupted

Post by Niubbo »

Ogre Version: 1.12.8
Operating System: win10
Render System: dx11

I'm trying to obtain the windows handle after the creation of window using ogrebites with SDL2 with this instructions

Code: Select all

	m_hWnd = (HWND)getRenderWindow()->getCustomAttribute("WINDOW");
	
But I obtain (in debug) the error Run-Time Check Failure #2 - Stack around the variable 'ret' was corrupted.

I tried with various dimension variable but the error remains. Inside the routine the value of variable ret seems ok before leave the function, so it seems this happen when the value return to the destination field.

Any idea what could be the problem? thanks
Niubbo
Goblin
Posts: 211
Joined: Sat Jan 23, 2016 11:26 am
x 17

Re: Getting windows handle error Run-Time Check Failure #2 - Stack around the variable 'ret' was corrupted

Post by Niubbo »

I saw this function doesn't work well in this context without pass the parameter of the memory area to read, so I switched like this in order to have the sdl window handle

Code: Select all

	SDL_Window* temp = mWindows[0].native;
	SDL_SysWMinfo wmInfo;
	SDL_VERSION(&wmInfo.version);
	SDL_GetWindowWMInfo(temp, &wmInfo);
	m_hWnd = wmInfo.info.win.window;
paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1074
Contact:

Re: Getting windows handle error Run-Time Check Failure #2 - Stack around the variable 'ret' was corrupted

Post by paroj »

Niubbo wrote: Sun Feb 21, 2021 6:21 pm Any idea what could be the problem? thanks
yes, HWND does not fit into uint32, hence you should use the other overload:
https://ogrecave.github.io/ogre/api/lat ... ccf3d9e166
Post Reply