Advertisement

PeekMessage causes an access violation

Started by May 20, 2024 07:43 AM
1 comment, last by StrikerTheHedgefox 6 months, 4 weeks ago

I am currently working on a source port for a game, and for some damn reason, PeekMessage is causing an exception when debugging. I have looked high and low across StackOverflow and here on GameDev.net and haven't found anything useful for my scenario.

	while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) && !quitFlag)
	{
		switch(msg.message)
		{
			case WM_QUIT:
				quitFlag = 1;
				break;
		}

		if (!TranslateAccelerator(hwndApp,hAccelApp,&msg))
		{
			TranslateMessage(&msg); // Does some very necessary stuff
			DispatchMessage(&msg);	// Does some very necessary stuff
		}
	}

But the odd thing is, if I hit “continue” twice in Visual Studio, the program continues on as if nothing happened, and works fine.

The exception details:

Exception thrown at 0x759D98B2 in tfury.exe: Microsoft C++ exception: wil::ResultException at memory location 0x01FCDDFC.

The stack is as follows:

 	[External Code]	
 	msvcrt.dll!__CxxThrowException@8()	Unknown
 	msctf.dll!wil::details::ThrowResultExceptionInternal(struct wil::FailureInfo const &)	Unknown
 	msctf.dll!wil::ThrowResultException(struct wil::FailureInfo const &)	Unknown
 	msctf.dll!wil::details::ReportFailure_NoReturn<0>(void *,unsigned int,char const *,char const *,char const *,void *,struct wil::details::ResultStatus const &,unsigned short const *,enum wil::details::ReportFailureOptions)	Unknown
 	msctf.dll!wil::details::ReportFailure_Base<0,0>(void *,unsigned int,char const *,char const *,char const *,void *,struct wil::details::ResultStatus const &,unsigned short const *,enum wil::details::ReportFailureOptions)	Unknown
 	msctf.dll!wil::details::ReportFailure_Hr<0>(void *,unsigned int,char const *,char const *,char const *,void *,long)	Unknown
 	msctf.dll!wil::details::in1diag3::_Throw_Hr(void *,unsigned int,char const *,long)	Unknown
 	msctf.dll!wil::GetActivationFactory<struct Windows::Internal::ApplicationTargetedFeatureDatabase::IApplicationTargetedFeatureConfigStatics>(unsigned short const *)	Unknown
 	msctf.dll!ShellHandwriting::HandwritingClient::Initialize(long)	Unknown
 	msctf.dll!SYSTHREAD::OnShellHandwriting(unsigned int,long)	Unknown
 	msctf.dll!_GetMsgHook(struct SYSTHREAD *,unsigned int,long)	Unknown
 	msctf.dll!_TF_Notify@12()	Unknown
 	user32.dll!CtfHookProcWorker(int,unsigned int,long,unsigned long)	Unknown
 	user32.dll!CallHookWithSEH()	Unknown
 	user32.dll!__fnHkINLPMSG()	Unknown
 	ntdll.dll!_KiUserCallbackDispatcher@12()	Unknown
 	user32.dll!_PeekMessageA@20()	Unknown
>	tfury.exe!messageCheck(...) Line 237	C
 	tfury.exe!idleCheck(...) Line 289	C
 	tfury.exe!toggle(...) Line 876	C
 	tfury.exe!fadeInScreen(char * name, char * palfile, int time) Line 1521	C
 	tfury.exe!showTRILogo(...) Line 1247	C
 	tfury.exe!intro(...) Line 922	C
 	tfury.exe!mainProgram(...) Line 417	C
 	tfury.exe!WinMain(HINSTANCE__ * hInst, HINSTANCE__ * hPrev, char * szCmdLine, int sw) Line 822	C
 	[External Code]	

None

I wish I could change the thread title and tags. Meant to say exception not access violation.

Anyway, seems to be related to this? https://stackoverflow.com/questions/63407764/what-is-a-wilresultexception-and-what-does-it-mean-to-rethrow

I don't know of the solution, but in the meantime I guess I can disable wil::resultException and [rethrow] in Visual Studio's debugger until either Microsoft fixes it or there's a workaround.

None

This topic is closed to new replies.

Advertisement