HANDLE __stdcall OpenFilterDriver( const TCHAR* pszFileName );
Return Value:
This function opens driver object and returns handle to it.
Parameters:
pszFileName
Specifies driver object name.
Remarks:
The native SDK uses const TCHAR* for the driver name. Match the name encoding to the DLL build: a build with UNICODE/_UNICODE expects a null-terminated UTF-16 string; a MultiByte build expects a null-terminated ANSI string. The v3.6.2 ndisapi.dll/ndisapidll.vcxproj project uses Unicode; the legacy VS2012 project uses MultiByte. Export names do not distinguish these builds.
The C declaration above requires an explicit name, for example OpenFilterDriver(_T("NDISRD")) when the application’s character-mode macros match the DLL. Foreign-language callers must likewise pass a name with the DLL’s encoding. The C++ public header provides the following default argument:
HANDLE __stdcall OpenFilterDriver( const TCHAR* pszFileName = _T(DRIVER_NAME_A) );
The default is the SDK’s configured driver name, normally NDISRD. Internally, this function creates a CNdisApi object on the heap and returns an opaque pointer to it.
The result is an opaque pointer to a library object, not a Win32 device handle. A non-NULL object can exist even when the driver device could not be opened. Call IsDriverLoaded(hOpen) to check initialization and release the object with CloseFilterDriver.