EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Having to throw an exception for "GetFileSecurity" in .Net is messy

Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.
Posted: 07/13/2014 07:06:28
by VoxPopuli Robot  (EldoS Corp.)

The first request to "GetFileSecurity" is normally to ascertain the size of the structure to be created.
Having to throw a CBFSWinError Exception of
"The data area passed to a system call is too small"
is rather a messy way to just return that state and is very slow, i.e. the internal .Net code has to generate a call stack etc. which ultimately is thrown away.

Can the API through .Net have return Win32 error codes rather than
exceptions ?>
Still keep the exception handling, but if a call can be translated to a normal Win32 error code, then use that.

If this is the same in the Cpp (And other libraries) then use in there as well. This will give a significant speed improvement for _all_ of your customers.

If you like the idea, vote for it on https://www.eldos.com/cbfs/wishlist.php
Posted: 07/13/2014 07:10:13
by Eugene Mayevski (EldoS Corp.)

VoxPopuli Robot wrote:
Can the API through .Net have return Win32 error codes rather than exceptions ?>

The API can't return error codes at the moment and remaking all interfaces doesn't make much sense. Errors are *exceptional* situations, not normal. So the benefit of not throwing the exception doesn't overweight the cost of making the API more complicated.

The problem you've described (small buffer in OnGetFileSecurity) is probably the only exception, so it's possible to add some in/out parameter to the callback to indicate if the buffer size was sufficient.

Now only a small fraction of developers makes use of On*FileSecurity events, so the benefit is not for all customers as you think but maybe for 5-10% of them.

Still we'll consider adding a parameter in the next major release (version 6) when we start working on it.

Sincerely yours
Eugene Mayevski



Topic viewed 1041 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!