Sample Code

Windows Driver Samples/ Change File System Minifilter Driver/ C++/ utility.h/

/*++

Copyright (c) Microsoft Corporation.  All Rights Reserved

Module Name:

    utility.h

Abstract:

    Header file which contains the structures, type definitions,
    constants, global variables and function prototypes that are
    only visible within the kernel. The functions include 
	generic table routines. 

Environment:

    Kernel mode

--*/
#ifndef __UTILITY_H__
#define __UTILITY_H__

#define CG_MUTEX_TAG                         'tMgC'

FORCEINLINE
PFAST_MUTEX
CgAllocateMutex (
    VOID
    )
{
    //
    //  Fast mutex by its rule has to be in the non-paged pool
    //
    
    return ExAllocatePoolWithTag( NonPagedPoolNx,
                                  sizeof( FAST_MUTEX ),
                                  CG_MUTEX_TAG );
}

FORCEINLINE
VOID
CgFreeMutex (
    _In_ PFAST_MUTEX Mutex
    )
{

    ExFreePoolWithTag( Mutex,
                       CG_MUTEX_TAG );
}

#define LIST_FOR_EACH_SAFE(curr, n, head) \
        for (curr = (head)->Flink , n = curr->Flink ; curr != (head); \
             curr = n, n = curr->Flink )


#endif

Our Services

  • What our customers say about us?

© 2011-2024 All Rights Reserved. Joya Systems. 4425 South Mopac Building II Suite 101 Austin, TX 78735 Tel: 800-DEV-KERNEL

Privacy Policy. Terms of use. Valid XHTML & CSS