src/SeeDll/Packet32.c
/*! 
  \brief Retrieves the event associated in the driver with a capture instance and stores it in an 
   _ADAPTER structure.
  \param AdapterObject Handle to the service control manager.
  \return If the function succeeds, the return value is nonzero.

  This function is used by PacketOpenAdapter() to retrieve the read event from the driver by means of an ioctl
  call and set it in the _ADAPTER structure pointed by AdapterObject.
*/
\brief Retrieves the event associated in the driver with a capture instance and stores it in an
_ADAPTER structure.
\param AdapterObject Handle to the service control manager.
\return If the function succeeds, the return value is nonzero.

This function is used by PacketOpenAdapter() to retrieve the read event from the driver by means of an ioctl
call and set it in the _ADAPTER structure pointed by AdapterObject.
\ brief Retrieves the event associated in the driver with a capture instance and stores it in an _ADAPTER structure . \ param AdapterObject Handle to the service control manager . \ return If the function succeeds the return value is nonzero . This function is used by PacketOpenAdapter () to retrieve the read event from the driver by means of an ioctl call and set it in the _ADAPTER structure pointed by AdapterObject .
BOOLEAN PacketSetReadEvt(LPADAPTER AdapterObject)
{
	DWORD BytesReturned;
	TCHAR EventName[39];
 	if (LOWORD(GetVersion()) == 4)
	{
		if(DeviceIoControl(AdapterObject->hFile,pBIOCEVNAME,NULL,0,EventName,13*sizeof(TCHAR),&BytesReturned,NULL)==FALSE) 
			return FALSE;
		EventName[BytesReturned/sizeof(TCHAR)]=0; 
	}
	else
	{
		wcsncpy(EventName,L"Global\\",sizeof(L"Global\\"));
		if(DeviceIoControl(AdapterObject->hFile,pBIOCEVNAME,NULL,0,EventName + 7,13*sizeof(TCHAR),&BytesReturned,NULL)==FALSE) 
			return FALSE;
		EventName[BytesReturned/sizeof(TCHAR) + 7]=0; 
	}
	AdapterObject->ReadEvent=CreateEvent(NULL,
										 TRUE,
										 FALSE,
										 EventName);
	if(AdapterObject->ReadEvent==NULL || GetLastError()!=ERROR_ALREADY_EXISTS){
        ODS("PacketSetReadEvt: error retrieving the event from the kernel\n");
		return FALSE;
	}
	AdapterObject->ReadTimeOut=0;
	return TRUE;
}
BOOLEAN PacketSetReadEvt ( LPADAPTER AdapterObject ) { DWORD BytesReturned ; TCHAR EventName [ 39 ] ; if ( LOWORD ( GetVersion ( ) ) == 4 ) { if ( DeviceIoControl ( AdapterObject -> hFile , pBIOCEVNAME , NULL , 0 , EventName , 13 * sizeof ( TCHAR ) , & BytesReturned , NULL ) == FALSE ) return FALSE ; EventName [ BytesReturned / sizeof ( TCHAR ) ] = 0 ; } else { wcsncpy ( EventName , L" \\ " , sizeof ( L" \\ " ) ) ; if ( DeviceIoControl ( AdapterObject -> hFile , pBIOCEVNAME , NULL , 0 , EventName + 7 , 13 * sizeof ( TCHAR ) , & BytesReturned , NULL ) == FALSE ) return FALSE ; EventName [ BytesReturned / sizeof ( TCHAR ) + 7 ] = 0 ; } AdapterObject -> ReadEvent = CreateEvent ( NULL , TRUE , FALSE , EventName ) ; if ( AdapterObject -> ReadEvent == NULL || GetLastError ( ) != ERROR_ALREADY_EXISTS ) { ODS ( " \n " ) ; return FALSE ; } AdapterObject -> ReadTimeOut = 0 ; return TRUE ; }
\brief Retrieves the event associated in the driver with a capture instance and stores it in an
_ADAPTER structure.
\ brief Retrieves the event associated in the driver with a capture instance and stores it in an _ADAPTER structure .
// retrieve the name of the shared event from the driver without the "Global\\" prefix
 // terminate the string
 // this tells the terminal service to retrieve the event from the global namespace
 // retrieve the name of the shared event from the driver with the "Global\\" prefix
 // terminate the string
 // open the shared event
