src/SeeDll/Packet32.c
/*!
  \brief Sets the name of the file that will receive the packet when the adapter is in dump mode.
  \param AdapterObject Pointer to an _ADAPTER structure.
  \param name the file name, in ASCII or UNICODE.
  \param len the length of the buffer containing the name, in bytes.
  \return If the function succeeds, the return value is nonzero.

  This function defines the file name that the driver will open to store the packets on disk when 
  it works in dump mode. The adapter must be in dump mode, i.e. PacketSetMode() should have been
  called previously with mode = PACKET_MODE_DUMP. otherwise this function will fail.
  If PacketSetDumpName was already invoked on the adapter pointed by AdapterObject, the driver 
  closes the old file and opens the new one.
*/
\brief Sets the name of the file that will receive the packet when the adapter is in dump mode.
\param AdapterObject Pointer to an _ADAPTER structure.
\param name the file name, in ASCII or UNICODE.
\param len the length of the buffer containing the name, in bytes.
\return If the function succeeds, the return value is nonzero.

This function defines the file name that the driver will open to store the packets on disk when
it works in dump mode. The adapter must be in dump mode, i.e. PacketSetMode() should have been
called previously with mode = PACKET_MODE_DUMP. otherwise this function will fail.
If PacketSetDumpName was already invoked on the adapter pointed by AdapterObject, the driver
closes the old file and opens the new one.
\ brief Sets the name of the file that will receive the packet when the adapter is in dump mode . \ param AdapterObject Pointer to an _ADAPTER structure . \ param name the file name in ASCII or UNICODE . \ param len the length of the buffer containing the name in bytes . \ return If the function succeeds the return value is nonzero . This function defines the file name that the driver will open to store the packets on disk when it works in dump mode . The adapter must be in dump mode i . e . PacketSetMode () should have been called previously with mode = PACKET_MODE_DUMP . otherwise this function will fail . If PacketSetDumpName was already invoked on the adapter pointed by AdapterObject the driver closes the old file and opens the new one .
BOOLEAN PacketSetDumpName(LPADAPTER AdapterObject, void *name, int len)
{
	DWORD		BytesReturned;
	WCHAR	*FileName;
	BOOLEAN	res;
	WCHAR	NameWithPath[1024];
	int		TStrLen;
	WCHAR	*NamePos;
#ifndef _WINNT4
	if (AdapterObject->Flags != INFO_FLAG_NDIS_ADAPTER)
	{
		ODS("PacketSetDumpName: not allowed on wan adapters\n");
		return FALSE;
	}
#endif 
	if(((PUCHAR)name)[1]!=0 && len>1){ 
		FileName=SChar2WChar(name);
		len*=2;
	} 
	else {	
		FileName=name;
	}
	TStrLen=GetFullPathName(FileName,1024,NameWithPath,&NamePos);
	len=TStrLen*2+2;  
	if(len>2048){
		if(((PUCHAR)name)[1]!=0 && len>1) free(FileName);
		return FALSE;
	}
    res = DeviceIoControl(AdapterObject->hFile,pBIOCSETDUMPFILENAME,NameWithPath,len,NULL,0,&BytesReturned,NULL);
	free(FileName);
	return res;
}
BOOLEAN PacketSetDumpName ( LPADAPTER AdapterObject , void * name , int len ) { DWORD BytesReturned ; WCHAR * FileName ; BOOLEAN res ; WCHAR NameWithPath [ 1024 ] ; int TStrLen ; WCHAR * NamePos ; #ifndef _WINNT4 if ( AdapterObject -> Flags != INFO_FLAG_NDIS_ADAPTER ) { ODS ( " \n " ) ; return FALSE ; } #endif if ( ( ( PUCHAR ) name ) [ 1 ] != 0 && len > 1 ) { FileName = SChar2WChar ( name ) ; len *= 2 ; } else { FileName = name ; } TStrLen = GetFullPathName ( FileName , 1024 , NameWithPath , & NamePos ) ; len = TStrLen * 2 + 2 ; if ( len > 2048 ) { if ( ( ( PUCHAR ) name ) [ 1 ] != 0 && len > 1 ) free ( FileName ) ; return FALSE ; } res = DeviceIoControl ( AdapterObject -> hFile , pBIOCSETDUMPFILENAME , NameWithPath , len , NULL , 0 , & BytesReturned , NULL ) ; free ( FileName ) ; return res ; }
\brief Sets the name of the file that will receive the packet when the adapter is in dump mode.
\ brief Sets the name of the file that will receive the packet when the adapter is in dump mode .
// _WINNT4
 //ASCII
 //Unicode
 //add the terminating null character
 // Try to catch malformed strings
