Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8639873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:07:55+00:00 2026-06-12T11:07:55+00:00

Hi I am getting a Run time Error saying that the stack around szDeviceType

  • 0

Hi I am getting a Run time Error saying that the stack around szDeviceType is corrupted but I have no idea, i’m very new to c++ so I wouldn’t have the most knowledge. Any help would greatly be appreciated.

HRESULT hr = S_OK;
UINT er = ERROR_SUCCESS;
int szDeviceType = 0;
char lpszString[MAX_PATH];
LPWSTR szComport = NULL;
LPWSTR szNumChannels = NULL;
char szChannels[MAX_PATH];
char szPort[MAX_PATH];

hr = WcaInitialize(hInstall, "GetDatascanInfo");
ExitOnFailure(hr, "Failed to initialize");

WcaLog(LOGMSG_STANDARD, "Initialized.");

hr = WcaGetIntProperty(L"DEVICETYPE",&szDeviceType);
ExitOnFailure(hr, "failed to get Device Type");

hr = WcaGetFormattedProperty(L"COMPORT",&szComport);
ExitOnFailure(hr, "failed to get Com Port");

wcstombs(szPort, szComport, 500);

hr = WcaGetProperty(L"NUMCHANNELS",&szNumChannels);
ExitOnFailure(hr, "failed to get Com Port");

wcstombs(szChannels, szNumChannels, 500);

    if(szDeviceType == 2)
    {
        strcat(lpszString, "datascan");
        strcat(lpszString, szPort);
        strcat(lpszString, "DATASCAN 7000,DS:");
        strcat(lpszString, szChannels);

    }
    if (szDeviceType == 3)
    {
        strcat(lpszString, "solo");
        strcat(lpszString, szPort);
        strcat(lpszString, "DATASCAN SOLO,SA:");
        strcat(lpszString, szChannels);

    }
    if (szDeviceType == 4)
    {
        strcat(lpszString, "dataweb");
        strcat(lpszString, szPort);
        strcat(lpszString, "DATAWEB,DW:");
        strcat(lpszString, szChannels);
    }

    hr = MsiSetProperty(hInstall, "DATASCANINFO",  lpszString);
    ExitOnFailure(hr, "failed to set DATASCANINFO");


LExit:
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
return WcaFinalize(er);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T11:07:57+00:00Added an answer on June 12, 2026 at 11:07 am

    This looks suss:

    wcstombs(szPort, szComport, 500);
    

    The last parameter is the maximum number of characters to write, but your array is only MAX_PATH in size which is 260.

    You’re also using strcat to append to lpszString without checking whether that overflows. You should probably switch to using strcat_s which has bounds checking.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I keep getting a Run Time error that says I am having an Exception
Am getting Run-time error 13 . Type Mismatch. But i cant figure out why.
I am trying to embed arial bold font but getting run time error font
I'm trying this SQL statement but I keep getting an error Run-time error '3061':
I am getting this run time error when using IID_IWebBrowser2 interface of CLSID_InternetExplorer. Run-Time
I have been getting an error message that I can't resolve. It originates from
I'm getting the weirdest error when I run this on my device (but not
I'm getting this error when I try run DB:Rake : ** Invoke db:migrate (first_time)
I am getting this weird RunTime error. The classes compile easy on eclipse but
I am fairly new to the .NET scene and have run into a small

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.