source: trunk/src/win32k/lib/libW32kHandleSystemEvent.c@ 5224

Last change on this file since 5224 was 5224, checked in by bird, 25 years ago

CallGate changes.

File size: 3.1 KB
Line 
1/* $Id: libW32kHandleSystemEvent.c,v 1.2 2001-02-21 07:47:58 bird Exp $
2 *
3 * libW32kHandleSystemEvent - Override system events like Ctrl-Alt-Delete
4 * and Ctrl-Alt-2xNumLock.
5 *
6 * Copyright (c) 2000-2001 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
7 *
8 * Project Odin Software License can be found in LICENSE.TXT
9 *
10 */
11
12
13/*******************************************************************************
14* Header Files *
15*******************************************************************************/
16#define INCL_DOSERRORS
17#define INCL_DOSFILEMGR
18#define INCL_DOSDEVICES
19
20
21/*******************************************************************************
22* Internal Functions *
23*******************************************************************************/
24#include <os2.h>
25#include "win32k.h"
26#include "libPrivate.h"
27
28
29/**
30 * Override a system event.
31 * @returns NO_ERROR on success.
32 * ERROR_INVALID_PARAMETER If incorrect parameter specified.
33 * ERROR_ACCESS_DENIED If you tried to unset (fHandle=FALSE) an event specifying the wrong
34 * hev. Or you tried to handle (fHandle=TRUE) and event which is allready
35 * handled by someone else (which is alive and kicking - ie. !fBad).
36 * ERROR_INIT_ROUTINE_FAILED If the Win32k library isn't inited successfully.
37 * Any errorcode returned by DosDevIOCtl.
38 * @param ulEvent Event to override.
39 * In win32k.h the valid events are defined.
40 * @param hev Handle of shared event semaphore which is posted when
41 * the specified system event occures.
42 * If the value 0xFFFFFFFF is specified the system will handle the event.
43 * @param fHandle Action flag. <br>
44 * TRUE: Take control of the event.<br>
45 * FALSE: Give control back to the OS of this event. (hev must match the current handle!)
46 * @status partially implemented.
47 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
48 * @remark Not all events are implemented yet.
49 */
50APIRET APIENTRY W32kHandleSystemEvent(ULONG ulEvent, HEV hev, BOOL fHandle)
51{
52 APIRET rc;
53
54 if (fInited)
55 {
56 K32HANDLESYSTEMEVENT Param;
57 ULONG cbParam = sizeof(Param);
58 ULONG cbData = 0UL;
59
60 Param.hdr.cb = sizeof(Param);
61 Param.hdr.rc = ERROR_NOT_SUPPORTED;
62 Param.ulEvent = ulEvent;
63 Param.hev = hev;
64 Param.fHandle = fHandle;
65
66 if (usCGSelector)
67 return libCallThruCallGate(K32_HANDLESYSTEMEVENT, &Param);
68 rc = DosDevIOCtl(hWin32k,
69 IOCTL_W32K_K32,
70 K32_HANDLESYSTEMEVENT,
71 &Param, sizeof(Param), &cbParam,
72 "", 1, &cbData);
73
74 if (rc == NO_ERROR)
75 rc = Param.hdr.rc;
76 }
77 else
78 rc = ERROR_INIT_ROUTINE_FAILED;
79
80 return rc;
81}
82
Note: See TracBrowser for help on using the repository browser.