SymFromAddr api returning 487 error code

Ashutosh Kumar Verma 0 Reputation points
2024-12-16T09:54:13.1066667+00:00

SymFromAddr api returning 487 error codex for the following code:

DWORD64  dwDisplacement = 0;

		char buffer[sizeof(SYMBOL_INFO) + MAX_SYM_NAME * sizeof(CHAR)];
		PSYMBOL_INFO pSymbol = (PSYMBOL_INFO)buffer;

		pSymbol->SizeOfStruct = sizeof(SYMBOL_INFO);
		pSymbol->MaxNameLen = MAX_SYM_NAME;

		if (SymFromAddr(hProcess, dwAddress, &dwDisplacement, pSymbol) && pSymbol->NameLen > 0 && pSymbol->Name[0] != 0)
		{
			// SymFromAddr returned success
			return std::string(pSymbol->Name, pSymbol->NameLen);
		}
		else
		{
			// SymFromAddr failed
			AI_HANG_MONITOR_LOG_ERROR("Error Getting Symbol name from Address:" + std::to_string(GetLastError()) );
		}

Error that I see, is this:

Dec 13 14:19:32	[ Error:   ] Error Getting Symbol name from Address:487 (at D:\Jenkins\ws\ilst_rel_28\app\Framework\UI\app_only\AIHangMonitor.cpp:128)

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
11,911 questions
Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,699 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.