Re: Where to find the PKTOpenAdapter (PNDIS_STRING) parameter
- From: voidcoder <voidcoder@xxxxxxxxx>
- Date: Mon, 04 Feb 2008 09:31:26 +0000
It probably has to to with the packet driver
loading order. As fas as I remember, the driver
scans registry at load time looking for the
\COMM\* entries. Just make sure it is happening
before the RTL81391 entries are there. But a
breakpoint at xxx_Init() in the driver and
step through to see if the RTL81391 is picked
up...
--
Oleg
Cri++ wrote:
In particular the GetLastError() function return the code:.
2404 ERROR_DEVICE_IN_USE The device is in use by an active process and cannot be disconnected. This happens when function PacketOpenAdapter calls the follow:
// open the specified adapter
if (DeviceIoControl (lpAdapter->hFile, PIOC_OPEN_ADAPTER, (LPVOID)AdapterName, wcslen (AdapterName)*sizeof (TCHAR), NULL, 0, &dwRet, NULL) == FALSE)
So, the device seems to be busy,
maybe the winCE OS keep it busy? Or What?
Thanks again
"Cri++" wrote:
The problem is that the follow function PacketOpenAdapter return a NULL pointer
when I try to open the RTL81391 adapter:
strName = L"RTL81391";
printf("Try to open adapter %20ls...\n", strName);
if ((m_lpAdapter = PacketOpenAdapter(strName)) == NULL){
printf("ERROR during open adapter!\n");
return FALSE;
}
printf("Adapter opened\n");
If I try with others adapters (like L"USB80231", L"NE20001", L"AsyncMac1", L"PPTP1", L"L2TP1", L"PPPOE1") it's OK, the adapter is opened.
PacketOpenAdapter is a function present into Winpcap packet for winCE where there mainly the follow istructions:
{
// Allocate memory for adapter object
lpAdapter = (LPADAPTER)HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof (ADAPTER));
// Create file handle for the driver
lpAdapter->hFile = CreateFile (DRIVER_OPEN_STRING, 0, 0, NULL, OPEN_EXISTING, 0, NULL);
// open the specified adapter
if (DeviceIoControl (lpAdapter->hFile, PIOC_OPEN_ADAPTER, (LPVOID)AdapterName, wcslen (AdapterName)*sizeof (TCHAR), NULL, 0, &dwRet, NULL) == FALSE) // get the event name from the driver
DeviceIoControl (lpAdapter->hFile, PIOC_EVNAME, NULL, 0, wchEvName, sizeof (wchEvName), &dwRet, NULL);
// create the read event
lpAdapter->ReadEvent = CreateEvent (NULL, FALSE, FALSE, wchEvName);
// Set the number of writes
PacketSetNumWrites (lpAdapter, 1);
// set the minimum bytes to copy
PacketSetMinToCopy (lpAdapter, ETHERNET_HEADER_LENGTH);
return lpAdapter;
}
Thanks
"voidcoder" wrote:
What do you mean when say it doesn't work? Does it return
an error code? Does it crash? Does it debug print something?
Post some code.
> I was thinking to open directly the NDS driver with hDev =
> CreateFile(L"NDS1:", ....)
> and read and write with ReadFile(hDev, ....) and WriteFile(hDev, ....).
> What do you think?
I think that CreateFile will likely succeed but I doubt
it is possible to receive/send frames using Write/ReadFile.
--
Oleg
Cri++ wrote:I tryed but it not work...
I was thinking to open directly the NDS driver with hDev = CreateFile(L"NDS1:", ....)
and read and write with ReadFile(hDev, ....) and WriteFile(hDev, ....).
What do you think?
Thanks
"voidcoder" wrote:
Try "RTL81391" (or "PCI\\RTL81391") as adapter name.
--
Oleg
Cri++ wrote:Sorry for late answer, yesterday I was busy.
Yes,
you are right, I'm using winpcap ce version.
Under HKLM\Comm\ I found folder RTL8139 and under this folder
there are 3 Keys:
DysplayName Realteck RTL8139 based Fast Ethernet Driver
Group NDIS
ImagePath RTL8139.dll
So, adapter name seems to be absent.
I found also the folder HKLM\Comm\PCI\RTL81391\Parms with many keys:
BusNumber 0
BusType 5
Class 2
DeviceID 33081
DeviceNumber 11
Dll NDIS.dll
DuplexMode 1
EarlyTxThreshold 65536
FunctionNumber 0
InstanceIndex 1
InterfaceType 5
IoBase 57344
IoLen 256
Irq 15
IsrDll gisr.dll
IsrHandler ISRHandler
MACAddress ...
MaskOffset 60
MemBase 3489...
MemLen 256
PortIsIO 1 PortMask 49279
PortOffset 62
PortSize 2 Prefix NDS
ProgIF 0
RevisionID 16
SubClass 0
SubSystemID 33081
SubVendorID 4332
SysIntr 16
Tranceiver 3
UseMaskReg 1
VendorID 4332
You have advice regarding witch key use for adapter name?
Bye and thanks
"voidcoder" wrote:
> BOOL PKTOpenAdapter (PNDIS_STRING);
Sounds like you are trying to use winpcap ce version,
which btw has a lot of issues in it. I suspect adapter
should be the same you would use for NdisOpenAdapter()
http://msdn2.microsoft.com/en-us/library/aa930529.aspx
Basically it is a counted adapter instance name, you
should be able to find it in registry under
"HKLM\Comm\<AdapterNameN>", where N normally == 1.
In your case probably "RTL81391".
--
Oleg
Kri wrote:Hi to all,
I need to send packets via Ethernet using the link level ISO/OSI.
So, I cannot use "sokets" but I've to go to lower level.
PC is an embedded WinCE device mounting WinCE4.2 OS and I develop the sw with environment eVc++4.0.
My WinCE pc mount the Relatek PCI-RTL81391 ethernet adapter working with NDIS.dll.
For send packet it is necessary to open the Relatek PCI-RTL81391 ethernet adapter.
There is the follow code istruction for do this:
BOOL PKTOpenAdapter (PNDIS_STRING);
where the input parameter "PNDIS_STRING" is the name of the Relatek PCI-RTL81391 adapter.
My problem is where find this parameter?
Somebody know where find it?
For many drivers this parameter is the value of the registry key
"HKEY_LOCAL_MACHINE\Comm\...\Linkage\Route", but,
for the Relatek PCI-RTL81391 adapter there is not a similar registry.
Thanks in advance for the precious help
- Next by Date: Re: Winsock connection
- Next by thread: Re: Winsock connection
- Index(es):
Relevant Pages
|