add_subdirectory(shellmenu)
add_subdirectory(shellrecyclebin)
-set_cpp(WITH_RUNTIME WITH_EXCEPTIONS)
+set_cpp(WITH_RUNTIME)
spec2def(shell32.dll shell32.spec ADD_IMPORTLIB)
if(NOT MSVC)
add_definitions(
-D_SHELL32_
- -D_WINE)
+ -D_WINE
+ -D_ATL_NO_EXCEPTIONS)
include_directories(
${REACTOS_SOURCE_DIR}/sdk/lib/atl
--- /dev/null
+
+#ifndef __ATLEXCEPT_H__
+#define __ATLEXCEPT_H__
+
+
+//FIXME: Enable when RaiseException is marked as NORETURN
+//DECLSPEC_NORETURN
+inline void AtlThrowImp(HRESULT hr)
+{
+#ifdef ATLTRACE
+ ATLTRACE(hr);
+#endif
+
+#ifdef _ATL_NO_EXCEPTIONS
+
+ ATLASSERT(false);
+
+ RaiseException(
+ hr == E_OUTOFMEMORY ? STATUS_NO_MEMORY : EXCEPTION_ILLEGAL_INSTRUCTION,
+ EXCEPTION_NONCONTINUABLE, 0, NULL
+ );
+
+#else
+
+ // FIXME: This is horribly wrong, we should implement CException!
+ throw;
+
+#endif
+
+}
+
+
+
+#ifndef AtlThrow
+#define AtlThrow(x) AtlThrowImp(x)
+#endif
+
+#endif
#pragma once
#include <atlcore.h>
-
+#include <atlexcept.h>
namespace ATL
{
CStringData* pNewData = pOldData->pStringMgr->Clone()->Allocate(nLength, sizeof(XCHAR));
if (pNewData == NULL)
{
- throw; // ThrowMemoryException();
+ ThrowMemoryException();
}
int nCharsToCopy = ((nOldLength < nLength) ? nOldLength : nLength) + 1;
CopyChars(PXSTR(pNewData->data()), nCharsToCopy,
CStringData* pNewData = pStringMgr->Reallocate(pOldData, nLength, sizeof(XCHAR));
if (pNewData == NULL)
{
- throw; // ThrowMemoryException();
+ ThrowMemoryException();
}
Attach(pNewData);
ATLASSERT(nLength <= GetData()->nAllocLength);
if (nLength < 0 || nLength > GetData()->nAllocLength)
- throw;
+ {
+ AtlThrow(E_INVALIDARG);
+ }
GetData()->nDataLength = nLength;
m_pszData[nLength] = 0;
pNewData = pNewStringMgr->Allocate(pData->nDataLength, sizeof(XCHAR));
if (pNewData == NULL)
{
- throw; // ThrowMemoryException();
+ ThrowMemoryException();
}
pNewData->nDataLength = pData->nDataLength;
return pNewData;
}
+
+ static void ThrowMemoryException()
+ {
+ AtlThrow(E_OUTOFMEMORY);
+ }
+
};
}