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 6674921
In Process

The Archive Base Latest Questions

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

I have an application server (JBoss, but this also happens in Tomcat) running as

  • 0

I have an application server (JBoss, but this also happens in Tomcat) running as a service in Windows Server 2003. It is running with the -Xrs flag.

The Java application running under the application server calls a customizable interface written in C++ via JNI (meaning we can alter this code), referencing a third-party DLL file for processing images (Lincoln for converting PostScript).

When we log into the server via Remote Desktop Connection in either console (mstsc /console) or administrator (mstsc /admin) mode, when we logout, if the Lincoln DLL file has been loaded, the application server will acknowledge the logoff signal and the service process will immediately terminate without prejudice.

I believe the signal is CTRL_LOGOFF, but I could be incorrect.

After JavaJiggle Article on Signal Handling, apparently signal handlers are passed to the DLL file when the DLL file is processing. This means the third-party DLL file (Lincoln in this case) listens to and responds to the CTRL_LOGOFF signal by logging off.

I believe, I should be able to code a signal catcher in my C++ interface to the DLL to intercept the CTRL_LOGOFF before it reaches the DLL and if so, then we won’t constantly die when someone logs off of a console/admin RDP.

Here is what I need:

  1. Am I correct that the signal that I am getting on console/admin logoff/logout is CTRL_LOGOFF?

  2. Can I write a signal interceptor in the C++ interface?

  3. How do I code that signal interceptor, or is there pre-existing code? I am using a 32-bit DLL.

I have found Microsoft article Registering a Control Handler Function, which may help answer this question.

  • 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-26T03:47:21+00:00Added an answer on May 26, 2026 at 3:47 am

    I seem to have resolved it by adding an ignore handler to the stack every time the third-party DLL is called, but I fear each time I call my method, we keep adding handlers to the stack and obviously the third-party DLL does not remove its handlers. I do not know whether this is creating a memory leak.

    Is there is a way to prevent a third-party handler from being placed in the first place? I have asked a follow-up question to answer this: How can I prevent my Console Control Handler from being overridden?.

    Here is my custom JNI class method, which calls the third-party DLL file:

    JNIEXPORT jint JNICALL Java_com_company_ConvertProxy_convertToImageType(JNIEnv *env, jclass cls, jstring input, jstring output) {
    
        jboolean isCopy;
        inFilename = env->GetStringUTFChars(input, &isCopy);
        outFilename = env->GetStringUTFChars(output, &isCopy);
    
        // I tried to call SetConsoleCtrlHandler() here, but failed;
        // it turns out third-party code in ConvertImage() also
        // calls SetConsoleCtrlHandler and overrides it if placed here.
    
        int value = ConvertImage();
    
        // Deafen Control Logoffs set by third-party ConvertImage.
        // SetConsoleCtrlHandler( NULL, TRUE ); // DOES NOT WORK, must use custom CtrlHandler.
        SetConsoleCtrlHandler( (PHANDLER_ROUTINE) CtrlHandler, TRUE );
    
        return value;
    }
    
    BOOL CtrlHandler( DWORD fdwCtrlType ) {
        switch( fdwCtrlType )
        {
            // Handle the CTRL-C signal.
            case CTRL_C_EVENT:
              return( TRUE );
    
            // CTRL-CLOSE: confirm that the user wants to exit.
            case CTRL_CLOSE_EVENT:
              return( TRUE );
    
            case CTRL_BREAK_EVENT:
              return( TRUE );
    
            case CTRL_LOGOFF_EVENT:
              return( TRUE );
    
            case CTRL_SHUTDOWN_EVENT:
              return( TRUE );
    
            default:
              return FALSE;
          }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web application running in a jboss application server (But it is
I have a web application deployed on a jboss server running on a unix
I have JBoss running as application server and somewhere on my HD there is
I have a Spring application deployed in JBoss EAP server, using the following settings:
We have Tomcat application server set up at port 8080 and Apache Http Server
I have an application running on Websphere Application Server 6.0 and it crashes nearly
I have this senario. We have an application server that contains a few web
I have a J2EE application running on an IBM Websphere Application Server on a
This question came to me when developing using Eclipse. I use JBoss Application Server
I am trying to following this http://www.mastertheboss.com/jboss-application-server/287-jboss-jms.html?start=1 article to try a simple JMS client

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.