Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

GetFileAttributes() does not reset the last error value

9 views
Skip to first unread message

Max Motovilov

unread,
Oct 23, 2009, 6:05:24 PM10/23/09
to
WinMo5 emulator: another major weirdness observed. A call to
GetFileAttributes() tends to not reset the last error value (i.e. I can
SetLastError( 12345 ) before the call and get 12345 back afterwards). On
storage card files it NEVER resets the error value whether the target
file exists or not. On memory files it sometimes resets it to either 0
or relevant error code and sometimes leaves it be -- I have found no
firm rule.

Did anyone see this behavior on real devices? I very much suspect that
the quality of the emulator is rather poor...

Regards,
...Max...

Paul G. Tobey [eMVP]

unread,
Oct 23, 2009, 9:21:24 PM10/23/09
to
What did GetFileAttributes() return itself in each case?

Paul T.

"Max Motovilov" <m...@motovilov.net> wrote in message
news:ulE9szCV...@TK2MSFTNGP02.phx.gbl...

Chris Tacke, MVP

unread,
Oct 24, 2009, 12:15:47 PM10/24/09
to
GetLastError is meaningles unless *you know an error has occurred*. That
means that if GetFileAttributes did not fail, I wouldn't expect it to affect
the result of GetLastError anyway. GetLastError, as the name implies, gets
the last error that occurred, not the result of the last API call.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com


"Max Motovilov" <m...@motovilov.net> wrote in message
news:ulE9szCV...@TK2MSFTNGP02.phx.gbl...

Max Motovilov

unread,
Oct 30, 2009, 9:49:42 AM10/30/09
to
> GetLastError is meaningles unless *you know an error has occurred*.
> That means that if GetFileAttributes did not fail, I wouldn't expect it
> to affect the result of GetLastError anyway. GetLastError, as the name
> implies, gets the last error that occurred, not the result of the last
> API call.

Even when the GetFileAttributes() is called on a clearly missing file
(and, naturally, returns DWORD(-1)) the last error value does not get
reset. On emulator + storage card paths I am seeing this reproduced 100%.

Paul G. Tobey [ eMVP ]

unread,
Oct 30, 2009, 4:58:01 PM10/30/09
to
Definite bug. Sounds like it's a bug in the emulator filesystem. I presume
that you don't see this with a real device; I think I would have run into it
previously if there was a serious problem with the call itself.

As you can probably guess, this isn't likely to get fixed. You could start
a support incident with MS on the WM5 emulator, but you don't really have
much else you can do about it.

Paul T.

"Max Motovilov" wrote:

> .
>

0 new messages