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

  • Home
  • SEARCH
  • 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 7619579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:43:21+00:00 2026-05-31T03:43:21+00:00

I am using _set_invalid_parameter_handler to override the default behaviour of the program when a

  • 0

I am using _set_invalid_parameter_handler to override the default behaviour of the program when a CRT function gets an invalid parameter, which is to crash with 0xc0000417 (STATUS_INVALID_CRUNTIME_PARAMETER).

This is my handler:

void my_invalid_parameter_handler(
    const wchar_t * expression,
    const wchar_t * function, 
    const wchar_t * file, 
    unsigned int line,
    uintptr_t pReserved
    )
{
    Log(L"Invalid parameter detected");
    Log(L"expression= %s", expression);
    Log(L"function= %s", function);
    Log(L"file= %s", file);
    Log(L"line= %d", line);
    Log(L"pReserved= %p", pReserved);
}

I want to log the information and send an error report. In the Debug build I get useful information with the parameters, but in the Release build all the parameters are NULL, which is not very useful. Is there any way to add useful information in the Release builds as well?

  • 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-05-31T03:43:22+00:00Added an answer on May 31, 2026 at 3:43 am

    It is explicitly mentioned in the Remarks section of the MSDN Library article:

    The parameters all have the value NULL unless a debug version of the CRT library is used

    The reason is visible from the crtdefs.h header file, edited for readability:

    #ifdef _DEBUG
    #  ifndef _CRT_SECURE_INVALID_PARAMETER
    #    define _CRT_SECURE_INVALID_PARAMETER(expr) \
           ::_invalid_parameter(__STR2WSTR(#expr), _FUNCTIONW__, __FILEW__, __LINE__, 0)
    #  endif
    
    #else
    
     /* By default, _CRT_SECURE_INVALID_PARAMETER in retail invokes_invalid_parameter_noinfo_noreturn(),
      * which is marked __declspec(noreturn) and does not return control to the application. Even if
      * _set_invalid_parameter_handler() is used to set a new invalid parameter handler which does return
      * control to the application, _invalid_parameter_noinfo_noreturn() will terminate the application and
      * invoke Watson. You can overwrite the definition of _CRT_SECURE_INVALID_PARAMETER if you need.
      *
      * _CRT_SECURE_INVALID_PARAMETER is used in the Standard C++ Libraries and the SafeInt library.
      */
    #  ifndef _CRT_SECURE_INVALID_PARAMETER
    #    define _CRT_SECURE_INVALID_PARAMETER(expr) ::_invalid_parameter_noinfo_noreturn()
    #  endif  /* _CRT_SECURE_INVALID_PARAMETER */
    #endif  /* _DEBUG */
    

    One optimization too many, I’d say. Being able to #define _CRT_SECURE_INVALID_PARAMETER yourself looks appealing but does not work unless you rebuild the CRT yourself. That’s not exactly practical.

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

Sidebar

Related Questions

thanks now I have a error code HY093 Invalid parameter number after using the
I have a parent class which contains a child object. I am using set
I used the following code to invoke an invalid parameter handler if the user
I am using SSMS 2008 and I have the following Scalar function to take
I'm using tkinter with Python to create a user interface for a program that
I am using: set constraints all deferred; (lots of deletes and inserts) commit; This
I'm using set_cookie() on a site. After adding some functionality, I'm getting Warning: Cannot
I'm executing stored procedures using SET FMTONLY ON, in order to emulate what our
What is the benefit of using SET XACT_ABORT ON in a stored procedure?
In our application we are using set of images as slides. If we click

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.