|
From: Leif M. <le...@ta...> - 2004-02-29 13:17:39
|
Richard,
The wrapperConsoleHandler function is simply a callback registered
with the
Windows SetConsoleCtrlHandler function. The handler actually returns a
BOOL.
Even if the code allowed you to return a custom code, the Windows API would
not know what to do with it. Am I missing something?
| |
Cheers,
Leif
Richard Luong wrote:
> Leif,
>
> Thanks for your response. Sorry my response is somewhat late, however
> this project's priority was shifted around for me.
>
> You are correct in that Windows doesn't throw any signal for a use
> login. What I have is a dll, that hooks onto the windows login
> service and basically sends my java thread custom signals. My thread
> will then return an integer as a response. At least that's the plan.
>
> My question is, how do I reply to a system event? I see from your
> code sample below, that your wrapperConsoleHandler returns an int.
> And that int is true. That method then passes it to the JVM's
> controlEvent method, which returns void. Is there anyway that I can
> return my own custom code? Thanks.
>
> Richard.
>
>> Subject:
>> Re: [Wrapper-user] How to catch other system events
>> From:
>> Leif Mortenson <le...@ta...>
>> Date:
>> Thu, 08 Jan 2004 18:59:21 +0900
>> To:
>> wra...@li...
>>
>> To:
>> wra...@li...
>>
>>
>> Richard,
>> Sorry I never answered you did I.
>>
>> The Wrapper currently catches system events in the native code,
>> Wrapper.DLL. It is taking any signal except the CTRL_BREAK_EVENT, which
>> is used to generate thread dumps.
>> What is the actual system signal that your card is throwing? Normally
>> windows does not throw any signals that I know of when a user logs
>> in. I am
>> interesting in finding out how your card works because I have been
>> looking
>> for a nice clean way of telling when a user logs on for a while. The
>> next
>> version of the Wrapper allows you to poll for this information, but
>> there is
>> no signal that I could find that is fired when a user logs on to a
>> Windows system.
>>
>> Here is the native code that parses the signals. Note that I am
>> passing any
>> unknown signals off to the JVM as well so the controlEvent method of
>> your
>> WrapperListener should get them if they are thrown.
>>
>> ---
>> int wrapperConsoleHandler(int key) {
>> int event;
>>
>> /* Call the control callback in the java code */
>> switch(key) {
>> case CTRL_C_EVENT:
>> event = org_tanukisoftware_wrapper_WrapperManager_WRAPPER_CTRL_C_EVENT;
>> break;
>> case CTRL_BREAK_EVENT:
>> /* This is a request to do a thread dump. Let the JVM handle this. */
>> return FALSE;
>> case CTRL_CLOSE_EVENT:
>> event =
>> org_tanukisoftware_wrapper_WrapperManager_WRAPPER_CTRL_CLOSE_EVENT;
>> break;
>> case CTRL_LOGOFF_EVENT:
>> event =
>> org_tanukisoftware_wrapper_WrapperManager_WRAPPER_CTRL_LOGOFF_EVENT;
>> break;
>> case CTRL_SHUTDOWN_EVENT:
>> event =
>> org_tanukisoftware_wrapper_WrapperManager_WRAPPER_CTRL_SHUTDOWN_EVENT;
>> break;
>> default:
>> event = key;
>> }
>> if (wrapperJNIDebugging) {
>> printf("Got Control Signal %d->%d\n", key, event);
>> flushall();
>> }
>>
>> wrapperJNIHandleSignal(event);
>>
>> if (wrapperJNIDebugging) {
>> printf("Handled signal\n");
>> flushall();
>> }
>>
>> return TRUE; /* We handled the event. */
>> }
>> ---
>>
>> Please most back with as much info as you can make available even if you
>> get this working.
>>
>> Cheers,
>> Leif
>>
>> Richard Luong wrote:
>>
>>
>>> I want to hook onto the Windows Login (Gina.dll) so that I can login
>>> through an ID card. I can do the JNI stuff to talk from Java to the C
>>> dll. But I would like the C code to be able to talk back to the Java
>>> code through throwing events to my NT Service.
>>>
>>> My question is, does the Java Service Wrapper catch all events and
>>> pass them on? If that's so, then problem solved.
>>>
>>> If not, does it only pass on specific control events such as windows
>>> logoff, shutdown and ctr+C ?
>>>
>>> If so, can I modify the code to pass on all events? I know that I will
>>> have to use Integration Method #3, which is not a problem for me.
>>> However, any pointers to the code that is catching and possibly
>>> ignoring/passing on events would be helpful.
>>>
>>> Thanks.
>>
|