DIFXAPILOGCALLBACK (difxapi)
Last changed: Andriy Klyuchevskyy-131.107.0.103

.
Summary

C# Signature:

public delegate void DIFXAPILOGCALLBACK(DIFXAPI_LOG EventType, Int32 ErrorCode, [MarshalAs(UnmanagedType.LPTStr)] string EventDescription, IntPtr CallbackContext);

VB Signature:

Public Delegate Sub DIFXAPILOGCALLBACK(ByVal EventType As DIFXAPI_LOG, ByVal ErrorCode As Int32, <MarshalAs(UnmanagedType.LPTStr)> ByVal EventDescription As String, ByVal CallbackContext As IntPtr)

User-Defined Types:

DIFXAPI_LOG

Alternative Managed API:

Do you know one? Please contribute it!

Notes:

None.

Tips & Tricks:

To use this function you just need difxapi.dll of appropriate architecture from Windows Server 2008/Vista WDK. The DriverStore will be created automatically for you.

Sample Code:

C#:

public static void DIFxAPILogCallbackFunc(DIFXAPI_LOG EventType, Int32 ErrorCode, string EventDescription, IntPtr CallbackContext)
{
     switch (EventType)
     {
     case DIFXAPI_LOG.DIFXAPI_SUCCESS:
         Console.WriteLine("SUCCESS: {0}. Error code: {1}", EventDescription, ErrorCode);
         break;
     case DIFXAPI_LOG.DIFXAPI_INFO:
         Console.WriteLine("INFO: {0}. Error code: {1}", EventDescription, ErrorCode);
         break;
     case DIFXAPI_LOG.DIFXAPI_WARNING:
         Console.WriteLine("WARNING: {0}. Error code: {1}", EventDescription, ErrorCode);
         break;
     case DIFXAPI_LOG.DIFXAPI_ERROR:
         Console.WriteLine("ERROR: {0}. Error code: {1}", EventDescription, ErrorCode);
         break;
     }
}

VB:

Public Sub DIFxAPILogCallbackFunc(ByVal EventType As DIFXAPI_LOG, ByVal ErrorCode As Int32, ByVal EventDescription As String, ByVal CallbackContext As IntPtr)
     Select Case EventType
     Case DIFXAPI_LOG.DIFXAPI_SUCCESS
         Console.WriteLine("SUCCESS: {0}. Error code: {1}", EventDescription, ErrorCode)
         Exit Sub
     Case DIFXAPI_LOG.DIFXAPI_INFO
         Console.WriteLine("INFO: {0}. Error code: {1}", EventDescription, ErrorCode)
         Exit Sub
     Case DIFXAPI_LOG.DIFXAPI_WARNING
         Console.WriteLine("WARNING: {0}. Error code: {1}", EventDescription, ErrorCode)
         Exit Sub
     Case DIFXAPI_LOG.DIFXAPI_ERROR
         Console.WriteLine("ERROR: {0}. Error code: {1}", EventDescription, ErrorCode)
         Exit Sub
  End Select
End Sub

Documentation