Index: src/libchcore/TSharedMemory.cpp
===================================================================
diff -u -r2fe97a93f21771d75901d4b6559057d1ea055104 -r68ef7c89b475edd21eac083b8d22660e15f97254
--- src/libchcore/TSharedMemory.cpp	(.../TSharedMemory.cpp)	(revision 2fe97a93f21771d75901d4b6559057d1ea055104)
+++ src/libchcore/TSharedMemory.cpp	(.../TSharedMemory.cpp)	(revision 68ef7c89b475edd21eac083b8d22660e15f97254)
@@ -70,7 +70,7 @@
 	Close();
 }
 
-void TSharedMemory::Create(const wchar_t* pszName, size_t stSize)
+void TSharedMemory::Create(const wchar_t* pszName, shm_size_t stSize)
 {
 	if(!pszName || pszName[0] == _T('\0') || stSize == 0)
 		THROW_CORE_EXCEPTION(eErr_InvalidArgument);
@@ -117,23 +117,23 @@
 
 	TMutexLock lock(m_hMutex);
 
-	m_stSize = stSize + sizeof(size_t);
-	*(size_t*)m_pMappedMemory = sizeof(size_t);  // no data inside (set just in case)
+	m_stSize = stSize + sizeof(shm_size_t);
+	*(shm_size_t*)m_pMappedMemory = sizeof(shm_size_t);  // no data inside (set just in case)
 }
 
 void TSharedMemory::Create(const wchar_t* pszName, const TString& wstrData)
 {
-	Create(pszName, (const BYTE*)wstrData.c_str(), (wstrData.GetLength() + 1) * sizeof(wchar_t));
+	Create(pszName, (const BYTE*)wstrData.c_str(), boost::numeric_cast<shm_size_t>((wstrData.GetLength() + 1) * sizeof(wchar_t)));
 }
 
-void TSharedMemory::Create(const wchar_t* pszName, const BYTE* pbyData, size_t stSize)
+void TSharedMemory::Create(const wchar_t* pszName, const BYTE* pbyData, shm_size_t stSize)
 {
 	Create(pszName, stSize);
 
 	TMutexLock lock(m_hMutex);
 
-	*(size_t*)m_pMappedMemory = stSize;
-	memcpy(m_pMappedMemory + sizeof(size_t), pbyData, stSize);
+	*(shm_size_t*)m_pMappedMemory = stSize;
+	memcpy(m_pMappedMemory + sizeof(shm_size_t), pbyData, stSize);
 }
 
 void TSharedMemory::Open(const wchar_t* pszName)
@@ -159,7 +159,7 @@
 
 	TMutexLock lock(m_hMutex);
 
-	m_stSize = *(size_t*)m_pMappedMemory + sizeof(size_t);
+	m_stSize = *(shm_size_t*)m_pMappedMemory + sizeof(shm_size_t);
 }
 
 void TSharedMemory::Close() throw()
@@ -192,17 +192,17 @@
 
 void TSharedMemory::Read(TString& wstrData) const
 {
-	if(!m_hFileMapping || !m_pMappedMemory || m_stSize <= sizeof(size_t))
+	if(!m_hFileMapping || !m_pMappedMemory || m_stSize <= sizeof(shm_size_t))
 		THROW_CORE_EXCEPTION(eErr_SharedMemoryNotOpen);
 
 	TMutexLock lock(m_hMutex);
 
-	size_t stByteSize = *(size_t*)m_pMappedMemory;
+	shm_size_t stByteSize = *(shm_size_t*)m_pMappedMemory;
 	if((stByteSize % 2) != 0)
 		THROW_CORE_EXCEPTION(eErr_SharedMemoryInvalidFormat);
 
-	const wchar_t* pszRealData = (const wchar_t*)(m_pMappedMemory + sizeof(size_t));
-	size_t stCharCount = stByteSize / 2;
+	const wchar_t* pszRealData = (const wchar_t*)(m_pMappedMemory + sizeof(shm_size_t));
+	shm_size_t stCharCount = stByteSize / 2;
 
 	if(pszRealData[stCharCount - 1] != _T('\0'))
 		THROW_CORE_EXCEPTION(eErr_SharedMemoryInvalidFormat);
@@ -212,51 +212,51 @@
 
 void TSharedMemory::Write(const TString& wstrData)
 {
-	Write((const BYTE*)wstrData.c_str(), (wstrData.GetLength() + 1) * sizeof(wchar_t));
+	Write((const BYTE*)wstrData.c_str(), boost::numeric_cast<shm_size_t>((wstrData.GetLength() + 1) * sizeof(wchar_t)));
 }
 
-void TSharedMemory::Write(const BYTE* pbyData, size_t stSize)
+void TSharedMemory::Write(const BYTE* pbyData, shm_size_t stSize)
 {
-	if(stSize + sizeof(size_t) > m_stSize)
+	if(stSize + sizeof(shm_size_t) > m_stSize)
 		THROW_CORE_EXCEPTION(eErr_BoundsExceeded);
 
 	TMutexLock lock(m_hMutex);
 
-	*(size_t*)m_pMappedMemory = stSize;
-	memcpy(m_pMappedMemory + sizeof(size_t), pbyData, stSize);
+	*(shm_size_t*)m_pMappedMemory = stSize;
+	memcpy(m_pMappedMemory + sizeof(shm_size_t), pbyData, stSize);
 }
 
 const BYTE* TSharedMemory::GetData() const
 {
-	if(!m_hFileMapping || !m_pMappedMemory || m_stSize <= sizeof(size_t))
+	if(!m_hFileMapping || !m_pMappedMemory || m_stSize <= sizeof(shm_size_t))
 		return NULL;
 
-	return (BYTE*)m_pMappedMemory + sizeof(size_t);
+	return (BYTE*)m_pMappedMemory + sizeof(shm_size_t);
 }
 
 BYTE* TSharedMemory::GetData()
 {
-	if(!m_hFileMapping || !m_pMappedMemory || m_stSize <= sizeof(size_t))
+	if(!m_hFileMapping || !m_pMappedMemory || m_stSize <= sizeof(shm_size_t))
 		return NULL;
 
-	return (BYTE*)m_pMappedMemory + sizeof(size_t);
+	return (BYTE*)m_pMappedMemory + sizeof(shm_size_t);
 }
 
-size_t TSharedMemory::GetSharedMemorySize() const
+TSharedMemory::shm_size_t TSharedMemory::GetSharedMemorySize() const
 {
 	if(!m_hFileMapping || !m_pMappedMemory)
 		return 0;
 	return m_stSize;
 }
 
-size_t TSharedMemory::GetDataSize() const
+TSharedMemory::shm_size_t TSharedMemory::GetDataSize() const
 {
-	if(!m_hFileMapping || !m_pMappedMemory || m_stSize <= sizeof(size_t))
+	if(!m_hFileMapping || !m_pMappedMemory || m_stSize <= sizeof(shm_size_t))
 		return 0;
 
 	TMutexLock lock(m_hMutex);
 
-	return *(size_t*)m_pMappedMemory;
+	return *(shm_size_t*)m_pMappedMemory;
 }
 
 END_CHCORE_NAMESPACE
Index: src/libchcore/TSharedMemory.h
===================================================================
diff -u -rbe5d5dfa17e79a1db8e64ad2d2ed5faea30399cb -r68ef7c89b475edd21eac083b8d22660e15f97254
--- src/libchcore/TSharedMemory.h	(.../TSharedMemory.h)	(revision be5d5dfa17e79a1db8e64ad2d2ed5faea30399cb)
+++ src/libchcore/TSharedMemory.h	(.../TSharedMemory.h)	(revision 68ef7c89b475edd21eac083b8d22660e15f97254)
@@ -30,31 +30,34 @@
 class LIBCHCORE_API TSharedMemory
 {
 public:
+	typedef unsigned int shm_size_t;
+
+public:
 	TSharedMemory();
 	~TSharedMemory();
 
-	void Create(const wchar_t* pszName, size_t stSize);
+	void Create(const wchar_t* pszName, shm_size_t stSize);
 	void Create(const wchar_t* pszName, const TString& wstrData);
-	void Create(const wchar_t* pszName, const BYTE* pbyData, size_t stSize);
+	void Create(const wchar_t* pszName, const BYTE* pbyData, shm_size_t stSize);
 
 	void Open(const wchar_t* pszName);
 	void Close() throw();
 
 	void Read(TString& wstrData) const;
 	void Write(const TString& wstrData);
-	void Write(const BYTE* pbyData, size_t stSize);
+	void Write(const BYTE* pbyData, shm_size_t stSize);
 
 	// below are the unsafe functions (i.e. not protected with mutex)
 	const BYTE* GetData() const;
 	BYTE* GetData();
 
-	size_t GetSharedMemorySize() const;
-	size_t GetDataSize() const;
+	shm_size_t GetSharedMemorySize() const;
+	shm_size_t GetDataSize() const;
 
 private:
 	HANDLE m_hFileMapping;
 	BYTE* m_pMappedMemory;
-	size_t m_stSize;     // contains full size of the allocated shared memory (in case we created the memory), size of occupied memory in case we opened the memory.
+	shm_size_t m_stSize;     // contains full size of the allocated shared memory (in case we created the memory), size of occupied memory in case we opened the memory.
 
 	HANDLE m_hMutex;
 };