Source

gb_emulator / gb_debugger_msvs / program_provider.cpp

Full commit
/*  Copyright Š 2011 Chris Spencer <spencercw@gmail.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

#include "stdafx.h"

#include "program_provider.h"

#include "program.h"

// IDebugProgram2 methods

HRESULT CProgramProvider::GetProviderProcessData(PROVIDER_FLAGS Flags, IDebugDefaultPort2 *,
	AD_PROCESS_ID processId, CONST_GUID_ARRAY, PROVIDER_PROCESS_DATA *pProcess)
{
	if (Flags & PFLAG_GET_PROGRAM_NODES && processId.ProcessIdType == AD_PROCESS_ID_SYSTEM &&
		processId.ProcessId.dwProcessId == GetCurrentProcessId())
	{
		memset(pProcess, 0, sizeof(*pProcess));

		CComObject<CProgram> *program;
		CComObject<CProgram>::CreateInstance(&program);
		program->AddRef();

		IDebugProgramNode2 **programNodes =
			reinterpret_cast<IDebugProgramNode2 **>(CoTaskMemAlloc(sizeof(IDebugProgramNode2 *)));
		programNodes[0] = program;

		pProcess->Fields = PFIELD_PROGRAM_NODES;
		pProcess->ProgramNodes.dwCount = 1;
		pProcess->ProgramNodes.Members = programNodes;
		pProcess->fIsDebuggerPresent = FALSE;

		return S_OK;
	}

	return S_FALSE;
}

HRESULT CProgramProvider::GetProviderProgramNode(PROVIDER_FLAGS /*Flags*/,
	IDebugDefaultPort2 * /*pPort*/, AD_PROCESS_ID /*processId*/, const GUID & /*guidEngine*/,
	UINT64 /*programId*/, IDebugProgramNode2 ** /*ppProgramNode*/)
{
	return E_NOTIMPL;
}

HRESULT CProgramProvider::WatchForProviderEvents(PROVIDER_FLAGS /*Flags*/,
	IDebugDefaultPort2 * /*pPort*/, AD_PROCESS_ID /*processId*/, CONST_GUID_ARRAY /*EngineFilter*/,
	const GUID & /*guidLaunchingEngine*/, IDebugPortNotify2 * /*pEventCallback*/)
{
	return S_OK;
}

HRESULT CProgramProvider::SetLocale(WORD /*wLangID*/)
{
	return E_NOTIMPL;
}