Sample Code
Windows Driver Samples/ Toaster Sample (UMDF Version 2)/ C++/ exe/ notify/ notify.h/
/*++ Copyright (c) 1990-2000 Microsoft Corporation All Rights Reserved Module Name: notify.h Abstract: Author: Eliyas Yakub Nov 23, 1999 Environment: Revision History: --*/ #ifndef __NOTIFY_H #define __NOTIFY_H // // Copied Macros from ntddk.h // #define CONTAINING_RECORD(address, type, field) ((type *)( \ (PCHAR)(address) - \ (ULONG_PTR)(&((type *)0)->field))) #define InitializeListHead(ListHead) (\ (ListHead)->Flink = (ListHead)->Blink = (ListHead)) #define RemoveHeadList(ListHead) \ (ListHead)->Flink;\ {RemoveEntryList((ListHead)->Flink)} #define IsListEmpty(ListHead) \ ((ListHead)->Flink == (ListHead)) #define RemoveEntryList(Entry) {\ PLIST_ENTRY _EX_Blink;\ PLIST_ENTRY _EX_Flink;\ _EX_Flink = (Entry)->Flink;\ _EX_Blink = (Entry)->Blink;\ _EX_Blink->Flink = _EX_Flink;\ _EX_Flink->Blink = _EX_Blink;\ } #define InsertTailList(ListHead,Entry) {\ PLIST_ENTRY _EX_Blink;\ PLIST_ENTRY _EX_ListHead;\ _EX_ListHead = (ListHead);\ _EX_Blink = _EX_ListHead->Blink;\ (Entry)->Flink = _EX_ListHead;\ (Entry)->Blink = _EX_Blink;\ _EX_Blink->Flink = (Entry);\ _EX_ListHead->Blink = (Entry);\ } typedef struct _DEVICE_INFO { HANDLE hDevice; // file handle HDEVNOTIFY hHandleNotification; // notification handle TCHAR DeviceName[MAX_PATH];// friendly name of device description TCHAR DevicePath[MAX_PATH];// ULONG SerialNo; // Serial number of the device. LIST_ENTRY ListEntry; } DEVICE_INFO, *PDEVICE_INFO; typedef enum { PLUGIN = 1, UNPLUG, EJECT } USER_ACTION_TYPE; typedef struct _DIALOG_RESULT { ULONG SerialNo; PWCHAR DeviceId; } DIALOG_RESULT, *PDIALOG_RESULT; #define ID_EDIT 1 #define IDM_OPEN 100 #define IDM_CLOSE 101 #define IDM_EXIT 102 #define IDM_HIDE 103 #define IDM_PLUGIN 104 #define IDM_UNPLUG 105 #define IDM_EJECT 106 #define IDM_ENABLE 107 #define IDM_DISABLE 108 #define IDM_CLEAR 109 #define IDM_IOCTL 110 #define IDM_VERBOSE 111 #define IDD_DIALOG 115 #define IDD_DIALOG1 116 #define IDD_DIALOG2 117 #define ID_OK 118 #define ID_CANCEL 119 #define IDC_SERIALNO 1000 #define IDC_DEVICEID 1001 #define IDC_STATIC -1 #define IDI_CLASS_ICON 200 LRESULT FAR PASCAL WndProc ( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam ); BOOLEAN EnumExistingDevices( HWND hWnd ); BOOL HandleDeviceInterfaceChange( HWND hwnd, DWORD evtype, PDEV_BROADCAST_DEVICEINTERFACE dip ); BOOL HandleDeviceChange( HWND hwnd, DWORD evtype, PDEV_BROADCAST_HANDLE dhp ); LRESULT HandleCommands( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); BOOLEAN Cleanup( HWND hWnd ); BOOL GetDeviceDescription( _In_ LPTSTR DevPath, _Out_writes_bytes_(OutBufferLen) PBYTE OutBuffer, _In_ ULONG OutBufferLen, _In_ PULONG SerialNo ); BOOLEAN OpenBusInterface ( _In_ ULONG SerialNo, _When_ (Action == PLUGIN, _In_) LPWSTR DeviceId, _In_ USER_ACTION_TYPE Action ); INT_PTR CALLBACK DlgProc( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); void SendIoctlToFilterDevice(); #endif
Our Services
-
What our customers say about us?
Read our customer testimonials to find out why our clients keep returning for their projects.
View Testimonials