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

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

Initial coding

File size: 3.2 KB
Line 
1/* $Id: libW32kHandleSystemEvent.c,v 1.1 2001-02-18 14:46:31 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
27
28/*******************************************************************************
29* Global Variables *
30*******************************************************************************/
31extern BOOL fInited;
32extern HFILE hWin32k;
33
34
35/**
36 * Override a system event.
37 * @returns NO_ERROR on success.
38 * ERROR_INVALID_PARAMETER If incorrect parameter specified.
39 * ERROR_ACCESS_DENIED If you tried to unset (fHandle=FALSE) an event specifying the wrong
40 * hev. Or you tried to handle (fHandle=TRUE) and event which is allready
41 * handled by someone else (which is alive and kicking - ie. !fBad).
42 * ERROR_INIT_ROUTINE_FAILED If the Win32k library isn't inited successfully.
43 * Any errorcode returned by DosDevIOCtl.
44 * @param ulEvent Event to override.
45 * In win32k.h the valid events are defined.
46 * @param hev Handle of shared event semaphore which is posted when
47 * the specified system event occures.
48 * If the value 0xFFFFFFFF is specified the system will handle the event.
49 * @param fHandle Action flag. <br>
50 * TRUE: Take control of the event.<br>
51 * FALSE: Give control back to the OS of this event. (hev must match the current handle!)
52 * @status partially implemented.
53 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
54 * @remark Not all events are implemented yet.
55 */
56APIRET APIENTRY W32kHandleSystemEvent(ULONG ulEvent, HEV hev, BOOL fHandle)
57{
58 APIRET rc;
59
60 if (fInited)
61 {
62 K32HANDLESYSTEMEVENT Param;
63 ULONG cbParam = sizeof(Param);
64 ULONG cbData = 0UL;
65
66 Param.ulEvent = ulEvent;
67 Param.hev = hev;
68 Param.fHandle = fHandle;
69 Param.rc = ERROR_INVALID_PARAMETER;
70
71 rc = DosDevIOCtl(hWin32k,
72 IOCTL_W32K_K32,
73 K32_HANDLESYSTEMEVENT,
74 &Param, sizeof(Param), &cbParam,
75 "", 1, &cbData);
76
77 if (rc == NO_ERROR)
78 rc = Param.rc;
79 }
80 else
81 rc = ERROR_INIT_ROUTINE_FAILED;
82
83 return rc;
84}
85
Note: See TracBrowser for help on using the repository browser.