Re: Set MAC address ...

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



What are you initializing len to (before the QueryValue call)?


--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--


<pre_pat@xxxxxxxxx> wrote in message
news:1162430591.926077.164110@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Thanks Paul & Chris.

I hvae access to wince4.2 only

In the process of dynamically changing MAC I am stuck at "reading a
registry" in the driver.

In order to update MAC address , the user application is writing to
a registry and whenever a queryInformation of NDIS driver is called , I
am reading this registry

Here are the steps in detail

1) Open registry
RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("Comm\\myethdriver\\Parms"), 0,
0, &RegistryKeyHandle) == ERROR_SUCCESS) && (RegistryKeyHandle))

2) Then
retval = RegQueryValueEx(RegistryKeyHandle, TEXT("MACParam"), NULL ,
&Type, (LPBYTE)&Val, &len);

The retval is 234 which is the code for ERROR_MORE_DATA,
I am not clear why this error occurs , I have allocated 1000 bytes to
Val and I see content of len is only 36



On Oct 27, 10:53 am, "Paul G. Tobey [eMVP]" <p space tobey no spam AT
no instrument no spam DOT com> wrote:
It's not a supported scenario, as far as I can tell, so who knows what
might
work or not. Take a look at the DP3815 driver in CE 5. It has aMAC
address override entry in the registry. I haven't looked to see if you
can
dynamically change theMACaddress or not, but it's the best chance
provided
by the sample code. I think that the Cisco 350-series card driver, which
you'll find in the PRIVATE code path under COMM (PCX500), also may allow
override.

Paul T.

<pre_...@xxxxxxxxx> wrote in
messagenews:1161966227.210744.64040@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx



Thanks Chris and Paul.

I want to be able to changeMAConce in a while.

I think the steps would be
1) Change NetworkAddress registry entry from an application
2) Use DeviceIOControl with OID_802_3_CURRENT_ADDRESS from an
application
3) In the SetInformationHandler function inside NDIS intermediate
driver when
OID == OID_802_3_CURRENT_ADDRESS, I check on the registry value
and
update theMACas you suggested.

I have a debug print statement in this SetInformationHandler
function whenever the function is invoked with OID
=(OID_802_3_CURRENT_ADDRESS),

I am invoking DeviceIOControl with OID_802_3_CURRENT_ADDRESS with
appropriate handle & adapter name
and I do not see the debug print statement from SetInformationHandler
function. I think the SetInformationHandler function is not being
invoked and hence theMACis not changing . Any ideas ...

I hope I have explained the problem clearly.

On Oct 26, 11:17 am, "Paul G. Tobey [eMVP]" <p space tobey no spam AT
no instrument no spam DOT com> wrote:
Several drivers that I've seen do this and it seems like a good way.
You'd
have to decide if, for some reason, you want to change it around
regularly,
how the application should trigger the latest registry value to be
loaded
(reboot is a good choice), but it's a clean solution.

Paul T.

"<ctacke/>" <ctacke[@]opennetcf[dot]com> wrote in
messagenews:e2gh5fQ%23GHA.3952@xxxxxxxxxxxxxxxxxxxxxxx

If you're modifying the driver then you can do anything you want.
One
strategy I've seen is that the driver first looks in the registry
for a
MAC(stored wherever you like). If it's there, then it returns that
address, otherwise it goes to the chip EEPROM and reads the actual
burned
MAC. That allows easyMACspoofing for things like routers.

--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--

<pre_...@xxxxxxxxx> wrote in message
news:1161868793.593511.279870@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Thanks Paul & Chris.
Can anyone please let me know how I can modify the driver to be
able
to
settheMAC

On Oct 25, 8:00 pm, "<ctacke/>" <ctacke[@]opennetcf[dot]com> wrote:
Setting the adapterMACaddress will be driver specific and many
OEMs
don't
expose it at all.

--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded Worldwww.opennetcf.com
--

<pre_...@xxxxxxxxx> wrote in
messagenews:1161819044.020679.178420@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

I am trying to setMACaddress on windows ce.net . I tried the
following but was not able to changeMAC

1st approach ) change registry entry& REBIND_ADAPTER using
DeviceIOCtl

2nd approach ) SetOID using OID_802_3_CURRENT_ADDRESS and
IOCTL_NDISUIO_SET_OID_VALUE in DeviceIOCtl ...this does not work
either..

Any ideas ....- Hide quoted text -- Show quoted text -- Hide
quoted
text -- Show quoted text -- Hide quoted text -- Show quoted
text -



.



Relevant Pages

  • Re: Set MAC address ...
    ... Chris Tacke ... Managed Code in the Embedded Worldwww.opennetcf.com ... a registry and whenever a queryInformation of NDIS driver is called, ...
    (microsoft.public.windowsce.embedded)
  • Re: implement Clean Boot on WM5
    ... it's not there, you have no recourse. ... Chris Tacke ... Managed Code in the Embedded World ... value in a registry and after a reboot i can call ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: implement Clean Boot on WM5
    ... it's not there, you have no recourse. ... Chris Tacke ... Managed Code in the Embedded World ... value in a registry and after a reboot i can call ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Build individual driver
    ... Chris Tacke ... Here are the steps I executed to get the individual driver rebuilt. ... Managed Code in the Embedded Worldwww.opennetcf.com ...
    (microsoft.public.windowsce.embedded)
  • Re: implement Clean Boot on WM5
    ... If you do much P/Invoke work, ... Chris Tacke ... Managed Code in the Embedded World ... The registry has nothing to do ...
    (microsoft.public.dotnet.framework.compactframework)