Re: Where to find the PKTOpenAdapter (PNDIS_STRING) parameter

Tech-Archive recommends: Fix windows errors by optimizing your registry




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


.



Relevant Pages

  • Re: MiniportSendPackets
    ... may fail on adapters that support task offload. ... make sure that your driver fails ... packet of more than one buffer to NDIS library ... thing - the same driver may work well with adapter X and fail with ...
    (microsoft.public.development.device.drivers)
  • Re: USB plug-n-play fails on Bluetooth dongle upgrade
    ... Tech support for Linksys says I need to clean the registry and ... > installing the new device. ... Check the installation instructions for the Linksys adapter. ... *require* that the driver be installed before connecting the adapter the ...
    (microsoft.public.windowsxp.hardware)
  • Re: More than one USB/Serial adapter problem
    ... open COM3 after I connected one device, ... I can't write my own driver, I'm not experienced and so this would take ... registry keys are ok? ... adapter connected, but I need to connect another one on the other USB ...
    (microsoft.public.windowsce.embedded)
  • Re: More than one USB/Serial adapter problem
    ... I get the driver from the Prolific disk I get with the adapter... ... With these settings I should be able to use more ... I think this is a registry setting problem, ...
    (microsoft.public.windowsce.embedded)
  • Re: NDIS - sending packets
    ... I need to send one packet throught more than one ... adapter. ... is my packet copyed by underlying miniport driver (or is it possible to ... allocated from a send packet pool on the adapter you are sending on. ...
    (microsoft.public.development.device.drivers)