* Copyright (c) 2013 Google, Inc. All rights reserved.
* Copyright (c) 2007-2008 VMware, Inc. All rights reserved.
* **********************************************************/
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of VMware, Inc. nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL VMWARE, INC. OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
#if !defined(AFX_DYNAMORIOVIEW_H__93D53B0D_7233_4E40_8240_C733CC5C6DF8__INCLUDED_)
# define AFX_DYNAMORIOVIEW_H__93D53B0D_7233_4E40_8240_C733CC5C6DF8__INCLUDED_
# if _MSC_VER > 1000
# pragma once
# endif
extern "C" {
# include "share.h"
# include "processes.h"
};
* now duplicated here and in client
*/
# include "afxwin.h"
* viewing to processes in the same session.
* Prefixes are not supported on NT.
*/
# define CLIENT_SHMEM_KEY_NT "DynamoRIO_Client_Statistics"
# define CLIENT_SHMEM_KEY "Local\\DynamoRIO_Client_Statistics"
# define CLIENTSTAT_NAME_MAX_LEN 47
typedef struct _client_stats {
uint num_stats;
bool exited;
process_id_t pid;
* num_stats values of type stats_int_t
*/
char data[CLIENTSTAT_NAME_MAX_LEN];
} client_stats;
class CDynamoRIOView : public CFormView {
protected:
CDynamoRIOView();
DECLARE_DYNCREATE(CDynamoRIOView)
public:
enum {
# ifdef DRSTATS_DEMO
IDD = IDD_DRSTATS_DEMO_FORM
# else
IDD = IDD_DYNAMORIO_FORM
# endif
};
public:
CDynamoRIODoc *
GetDocument();
BOOL
SelectProcess(int pid);
public:
public:
virtual BOOL
PreCreateWindow(CREATESTRUCT &cs);
protected:
virtual void
DoDataExchange(CDataExchange *pDX);
virtual void
OnInitialUpdate();
virtual BOOL
OnPreparePrinting(CPrintInfo *pInfo);
virtual void
OnBeginPrinting(CDC *pDC, CPrintInfo *pInfo);
virtual void
OnEndPrinting(CDC *pDC, CPrintInfo *pInfo);
virtual void
OnPrint(CDC *pDC, CPrintInfo *pInfo);
public:
BOOL
UpdateProcessList();
BOOL
Refresh();
virtual ~CDynamoRIOView();
# ifdef _DEBUG
virtual void
AssertValid() const;
virtual void
Dump(CDumpContext &dc) const;
# endif
protected:
void
ZeroStrings();
void
ClearData();
void
EnumerateInstances();
uint
PrintStat(TCHAR *c, uint i, BOOL filter);
uint
PrintClientStats(TCHAR *c, TCHAR *max);
dr_statistics_t *m_stats;
CComboBox m_ProcessList;
HANDLE m_clientMap;
PVOID m_clientView;
client_stats *m_clientStats;
DWORD m_list_pos;
DWORD m_selected_pid;
BOOL m_windows_NT;
CString m_Exited;
# ifndef DRSTATS_DEMO
CString m_LogLevel;
CString m_LogMask;
CString m_LogDir;
# endif
CEdit m_StatsCtl;
CScrollBar m_StatsSB;
CSliderCtrl m_StatsSlider;
DWORD m_StatsViewLines;
CString m_ClientStats;
protected:
afx_msg void
OnSelchangeList();
afx_msg void
OnDropdownList();
# ifndef DRSTATS_DEMO
afx_msg void
OnChangeLogging();
afx_msg void
OnLogDirExplore();
# endif
afx_msg void
OnEditCopystats();
afx_msg void
OnVScroll(UINT nSBCode, UINT nPos, CScrollBar *pScrollBar);
DECLARE_MESSAGE_MAP()
friend BOOL
pw_callback_under_dr(process_info_t *pi, void **param);
};
# ifndef _DEBUG
inline CDynamoRIODoc *
CDynamoRIOView::GetDocument()
{
return (CDynamoRIODoc *)m_pDocument;
}
# endif
#endif