xwlan/dprofiler

Crashes when attaching to process

Boscop opened this issue · 4 comments

I built dprofiler from source using MSVC 2015, but everytime I try to attach to a process, it crashes.
Profiling by launching works though.

xwlan commented

you can run as admin to have a test, profiler require admin to attach to other process.

When I run it as admin it also crashes when I try to attach!

xwlan commented

Can you please paste a stack trace of crash here?

Unhandled exception at 0x00007FF8B5C11B70 (ntdll.dll) in dprofiler.exe: 0xC0000374: A heap has been corrupted (parameters: 0x00007FF8B5C4ED40).

VOID
CcrDeleteTask(
	__in HWND hWnd 
	)
{
	HWND hWndCtrl;
	PAPS_PROCESS Process;
	int Count, i;
	
	hWndCtrl = GetDlgItem(hWnd, IDC_LIST_TASK);
	Count = ListView_GetItemCount(hWndCtrl);

	for(i = 0; i < Count; i++) {
		ListViewGetParam(hWndCtrl, i, (LPARAM *)&Process);
		if (Process != NULL) {
			ApsFreeProcess(Process); // this line
			ListViewSetParam(hWndCtrl, i, (LPARAM)NULL);
		}
	}
}

Call stack:

 	ntdll.dll!00007ff8b5c11b70()	Unknown
 	ntdll.dll!00007ff8b5c14db2()	Unknown
 	ntdll.dll!00007ff8b5c159b0()	Unknown
 	ntdll.dll!00007ff8b5bca810()	Unknown
 	dprofiler.exe!_free_base(void * block) Line 107	C++
>	dprofiler.exe!CcrDeleteTask(HWND__ * hWnd) Line 507	C
 	dprofiler.exe!CpuTaskOnFinish(HWND__ * hWnd, _WIZARD_CONTEXT * Context) Line 438	C
 	dprofiler.exe!CpuTaskOnNotify(HWND__ * hWnd, unsigned int lp, unsigned __int64) Line 478	C
 	[External Code]	
 	dprofiler.exe!CpuWizard(HWND__ * hWndParent, _WIZARD_CONTEXT * Context) Line 135	C
 	dprofiler.exe!FrameOnCpu(HWND__ * hWnd, unsigned int) Line 1420	C
 	dprofiler.exe!FrameProcedure(HWND__ * hWnd, unsigned int uMsg, unsigned __int64 wp, __int64 lp) Line 1023	C
 	[External Code]	
 	dprofiler.exe!MainMessagePump() Line 44	C
 	dprofiler.exe!wWinMain(HINSTANCE__ * Instance, HINSTANCE__ * Previous, wchar_t * CommandLine, int nCmdShow) Line 69	C
 	[External Code]