Buffer overrun exception

A free API for the communication with control devices according to UDS (ISO 14229-1)
Post Reply
lingfors
Posts: 2
Joined: Fri 3. Jul 2015, 10:19

Buffer overrun exception

Post by lingfors » Fri 3. Jul 2015, 10:30

I try to use PCAN-UDS using MS Visual Studio 2013 on Windows. However, I get a buffer overrun exception after calling UDS_Initialize:
bufferoverrun.png
bufferoverrun.png (23.18 KiB) Viewed 7872 times
I have tried other versions of Visual Studio, with the same result.

I get the same buffer overrun exception if I try to run the PCUClient sample project.

I have successfully used PCAN-Basic and PCAN-ISO-TP.

Minimum application to trigger the exception (based on example code from the manual):

Code: Select all

#define WIN32_LEAN_AND_MEAN
#include <Windows.h>

#include "PCAN-UDS.h"

int main( void )
{
  UDS_Initialize(PUDS_USBBUS1, PUDS_BAUD_500K);

  while( true );

  return 0;
}
What am I doing wrong?

User avatar
PEAK-Support
Sales & Support
Sales & Support
Posts: 1646
Joined: Fri 10. Sep 2010, 19:34

Re: Buffer overrun exception

Post by PEAK-Support » Mon 6. Jul 2015, 08:46

Please use our Demo and study the Documentation.

Calling

Code: Select all

UDS_Initialize(PUDS_USBBUS1, PUDS_BAUD_500K);
is not the problem...
but

Code: Select all

  while( true );
mhhh..no comment....
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------

lingfors
Posts: 2
Joined: Fri 3. Jul 2015, 10:19

Re: Buffer overrun exception

Post by lingfors » Mon 6. Jul 2015, 09:28

U.Wilhelm wrote:Please use our Demo and study the Documentation.
If you are going to give an answer like this, at least take the time to read my entire post. Especially this part:
I get the same buffer overrun exception if I try to run the PCUClient sample project.
The code

So, tell me. What is the problem with the PCUClient project?

Or this code:

Code: Select all

#include <Windows.h>

#include "PCAN-UDS.h"

int main( void )
{
  TPUDSStatus result;
  // The Plug & Play Channel (PCAN-USB) is initialized
  result = UDS_Initialize(PUDS_USBBUS1, PUDS_BAUD_500K);

  if (result != PUDS_ERROR_OK)
  {
    MessageBox(NULL, "Initialization failed", "Error", MB_OK);
  }  
  else
  {
    MessageBox(NULL, "PCAN-USB (Ch-1) was initialized", "Success", MB_OK);
  }
  
  // All initialized channels are released
  UDS_Uninitialize(PUDS_NONEBUS);
}
Same problem.

User avatar
PEAK-Support
Sales & Support
Sales & Support
Posts: 1646
Joined: Fri 10. Sep 2010, 19:34

Re: Buffer overrun exception

Post by PEAK-Support » Mon 6. Jul 2015, 09:59

Are you sure you use the correct DLL? You know .Net Applications use the DLL depending of the used OS (32/64) if you did not change it in project workspace.
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------

K.Wagner
Software Development
Software Development
Posts: 1080
Joined: Wed 22. Sep 2010, 13:36

Re: Buffer overrun exception

Post by K.Wagner » Mon 6. Jul 2015, 10:11

Hello,

Using VS2008, VS2010, and VS2012 did not show any problems in our test system. Unfortunatelly we don't have VS2013.

Are you using the libraries in 64-Bit plattform? It is possible that one or more dlls are in the wrong place (System32 and/or SysWOW64).

We can check one plattform an see if the problem is there. Please try the following:
  • Open the project PCUClient and check its configuration (Visual Studio Menu/ Build/Configuration manager)
  • Check that the Project PCUClient plattform is set to Win32
  • Compile the project
  • Create a new folder, Test32, anywhere
  • Copy in Test32 the dlls PCANBasic.dll, PCAN-ISO-TP.dll, adn PCAN-UDS.dll from their respective Win32 folders (downloaded package of each API).
  • Copy in Test32 the compiled PCUClient.exe and start it. Do you see the problem there too?
If the problem persists please let us know the following information:
  • Operating System and plattform being used
  • Version of each API being used
  • A zip with a minimalistic project that shows the problem
Best regards,
Keneth

Post Reply