Error when mapping a Vertex Buffer Object

I have a running aplication made in C++, glut for the interface and CUDA that works well. The CUDA interaction is all encapsulated in a DLL because there are easier to compile. Now I change the glut interface for a MFC interface and I extend the applications with other functionalities.

The problem is that the vertex buffer objects (VBO) I use in the application not work. First, the application throw an error when registering the VBO (cudaGLRegisterBufferObject), but updating the CUDA version from 2.1 to 2.3 the problem was solved. But now the error occurs when I map the VBO (cudaGLMapBufferObject).

I have checked the OpenGL initialization and all the includes, libraries, OpenGl version, etc.

Any idea?

Thank you.