plugins/consoles/rcons/server/win32/Misc.h
author Tom Sutcliffe <thomas.sutcliffe@accenture.com>
Wed, 13 Oct 2010 12:41:05 +0100
changeset 66 2a78c4ff2eab
parent 0 7f656887cf89
permissions -rw-r--r--
Migrated ciftest and various fixes from FCL to MCL.

// Misc.h
// 
// Copyright (c) 2010 Accenture. All rights reserved.
// This component and the accompanying materials are made available
// under the terms of the "Eclipse Public License v1.0"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
// 
// Initial Contributors:
// Accenture - Initial contribution
//
#ifndef __MISC_H__
#define __MISC_H__

#define UNICODE

#include <memory>
#include "stdafx.h"

enum TException
	{
	KExceptionNoMemory,
	KExceptionWindowClassRegistrationFailed,
	KExceptionWindowConstructFailed,
	KExceptionConsoleWindowConstructFailed,
	KExceptionWinSockStartupFailed,
	KExceptionWinSockVersionInvalid,
	KExceptionSocketConstructFailed,
	KExceptionSocketBindFailed,
	KExceptionSocketSelectFailed,
	KExceptionSocketListenFailed,
	KExceptionSocketAcceptFailed,
	KExceptionSocketReadFailed,
	KExceptionInvalidClientVersion,
	KExceptionFailedToFindPrefsFileName,
	KExceptionFailedToReadPrefsFile,
	KExceptionFailedToWritePrefsFile,
	KExceptionFailedToCreateCaptureFile,
	KExceptionFailedToWriteToCaptureFile,
	KExceptionFailedToDeleteExistingCaptureFile,
	KExceptionUnknown
	};

enum TThrow { EThrow = 0 };
void* operator new(size_t n, TThrow);
void operator delete(void* const p, TThrow);

void* operator new[](size_t, TThrow);
void operator delete[](void* const p, TThrow);

#ifdef _DEBUG
#define ASSERT(x) if (!(x)) Panic()
#else
#define ASSERT(x)
#endif

void Panic();
void DebugLog(LPCTSTR aFormat, ...);
bool FileExists(LPCTSTR aFileName);
void ConvertNarrowToWide(const char* aNarrow, int aLength, WCHAR* aWide);
void ConvertNarrowToWideAlloc(const char* aNarrow, int aLength, WCHAR*& aWide);
void ConvertWideToNarrow(const WCHAR* aWide, int aLength, char* aNarrow);
void ConvertWideToNarrowAlloc(const WCHAR* aWide, int aLength, char*& aNarrow);

#endif