summaryrefslogtreecommitdiff
path: root/miniport/wdmhelper.c
blob: 344a49b5c425ba9edca75c33967067d8481e6072 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
   Copyright (C) 2009 Red Hat, Inc.

   This program is free software; you can redistribute it and/or
   modify it under the terms of the GNU General Public License as
   published by the Free Software Foundation; either version 2 of
   the License, or (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#if (WINVER < 0x0501)
#include <ntddk.h>
#include "wdmhelper.h"

void QXLDeleteEvent(PVOID pEvent)
{
    if(pEvent) {
        ExFreePool(pEvent);
    }
}

LONG QXLInitializeEvent(PVOID * pEvent)
{
    if(pEvent) {
        *pEvent = ExAllocatePoolWithTag(NonPagedPool, sizeof(KEVENT), '_lxq');

        if(*pEvent) {
            KeInitializeEvent((PRKEVENT)*pEvent, SynchronizationEvent, FALSE);
        }
    }

    return 0;
}

void QXLSetEvent(PVOID pEvent)
{
    //Pririty boost can be switched to IO_NO_INCREMENT
    if(pEvent) {
        KeSetEvent((PRKEVENT)pEvent, IO_VIDEO_INCREMENT, FALSE);
    }
}

ULONG QXLWaitForEvent(PVOID pEvent, PLARGE_INTEGER Timeout)
{
    if(pEvent) {
        return NT_SUCCESS(KeWaitForSingleObject(pEvent, Executive, KernelMode, TRUE, Timeout));
    }

    return FALSE;
}

#endif