
// testVirtualMemoryUnusableDlg.h : header file
//

#pragma once

#include <vector>

// CtestVirtualMemoryUnusableDlg dialog
class CtestVirtualMemoryUnusableDlg : public CDialogEx
{
// Construction
public:
	typedef enum _followBlockAction
	{
		FBA_ALLOCATOR1_VIRTUAL_ALLOC_LEAK,
		FBA_ALLOCATOR2_SIMPLE_HEAP_MANAGER
	} FOLLOWING_BLOCK_ACTION;

	CtestVirtualMemoryUnusableDlg(CWnd* pParent = NULL);	// standard constructor

// Dialog Data
	enum { IDD = IDD_TESTVIRTUALMEMORYUNUSABLE_DIALOG };

	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support


// Implementation
protected:
	HICON m_hIcon;

	// Generated message map functions
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	DECLARE_MESSAGE_MAP()
	virtual void OnOK();
	virtual void OnCancel();
	afx_msg void OnBnClickedButtonDeallocate();

private:
	void addAllocation(DWORD					size,
					   FOLLOWING_BLOCK_ACTION	action,
					   int						reserveWholeParagraphFirst);

	void flush();

	void addToCombo(CComboBox	&combo,
					DWORD		size);

	void addToCombo(CComboBox				&combo,
					const TCHAR				*str,
					FOLLOWING_BLOCK_ACTION	action);

	void displayData(void	*ptr, 
					 DWORD	size);

	void *allocateVM(DWORD	size);

private:
	std::vector<void *>	allocations;

	CComboBox	comboSize;
	CComboBox	comboAction;
	CListCtrl	list;
};
