Main Site Documentation

G120 MF 4.3.8.1 Access Network folder

Good evening everyone,
I’m trying to access an image file located into a shared network folder without success…

The code to open the file image i use is:

var stream = new FileStream("\\\\192.168.0.1\\Firmware\\logo.gif", FileMode.Open);

but when the above line is executed, i get this error:

#### Exception System.IO.IOException - CLR_E_INVALID_DRIVER (4) ####
#### Message: 
#### Microsoft.SPOT.IO.NativeIO::GetAttributes [IP: 0000] ####
#### System.IO.FileStream::.ctor [IP: 005c] ####
#### System.IO.FileStream::.ctor [IP: 0010] ####
A first chance exception of type 'System.IO.IOException' occurred in Microsoft.SPOT.IO.dll
A first chance exception of type 'System.IO.IOException' occurred in System.IO.dll

What is wrong ?
Do I have to use a different way to access a shared network folder ?

Thank you!
Matteo.

SMB is not supported in NETMF?

1 Like

Hi Mike,
mmm, how can use SMB ?

I don’t think I have ever seen an implementation of SMB on NETMF.

I think you are going to have to look for another solution…

mmm, ok.
Thank you anyway for your time.

Not sure how far they got with this, but just out of interest

https://old.ghielectronics.com/community/codeshare/entry/817

I’d suggest that the above implementation may well rely on LM compatibility which is a bad (Security) idea and not turned on in many environments these days, so buyer beware

1 Like

Thank you everyone for your precious suggestions!
I will try the implementation suggested by PTSS, security for me is not a big issue, as my network is private and no one can access it from outside.

Matteo.

well that’s a false sense of security you have there. Please don’t re-enable things that are disabled just because you can. The world is a scary place, and it only takes one piece of malware to really ruin your day - no matter how careful you are !

You are completely right in 100% of the cases, but, really, in this case the risk is very minimal, I only share a network folder in read-only mode to share this only file, and the pc is completely segregated form the network, not accessible form outside, and is only connected to the devices.
Anyway, thanks everyone for the suggestions and warns, obviously…

BTW: tested the implementation above and it works for my purposes… Now It’s time to carefully investigate all the possible side effects, as Brett suggests.

Matteo.

2 Likes

if you haven’t had to change “LM compatibility” settings, or any non-standard Windows defaults, then you haven’t made a change I’d consider “bad”, so you sound like things aren’t too compromised

Good call Brett
Had a quick look and seems it supports NTLMv2 Encrypted credentials exchange
But I agree if you needed to lower security on the SMB share, that wouldnt be a good thing.
But sounds like the risk has been thought about…