werror.h enriched with few more error code (DRSUAPI related)

Kamen Mazdrashki kamen.mazdrashki at postpath.com
Fri Sep 18 07:35:10 MDT 2009

On Fri, Sep 18, 2009 at 02:20, Kamen Mazdrashki <kamen.mazdrashki at postpath.com> wrote:
> Guenther, Jelmer,
> On Thu, Sep 17, 2009 at 08:25, Guenther Deschner <gd at samba.org> wrote:
>> Hi Kamen,
>> On Thu, Sep 17, 2009 at 06:10:41AM +0300, Kamen Mazdrashki wrote:
>>> Hi,
>>> Attached is a list of patches to reformat werror.h file a little bit.
>>> I've completed first part of my plan, which is (in short):
>>> 1. Use only numeric values for error codes
>>> 2. Use values in hex format (there are few exceptions) though
>>> 3. Fix ambiguous error names
>>> What I plan to do next is:
>>> 4. using a python script - extract all error codes published by MS
>>> 5. Add errors that does not exist in werror.h to the file
>>> Next is code refactoring:
>>> 6. Find out duplicate errors with different name. Refactor code base
>>> to use the Generated WERR_ name.
>> Ok, you should be able to proceed with 4.) now :-)
> Here a list of patches to:
> 1. fix werror.h file - there were few errors with mistaken names
>  Please look at comments in every patch for clarification
> 2. Generated error codes and their descriptions are merged into
> werror.h and doserr.c files between placeholders (for future use)
> Also, the python script was mainly rewritten - suddenly I realized
> I am doing not so smart processing in the script, as I was
> trying to replace error codes directly in werror.h and doserr.c
> It is much more convenient just not to generate codes that already
> exists, right :). So I did it.
> Another good think about the script is now it is doing a lot
> more verifications.
> Verify new error codes generated do not collide with
> previously defined error with same name, but different value
> (this is reported as critical error).
> Verify also if there are error codes with same name,
> but different value - this led to patches to rename few errors.
> Not so important verifications are also implemented.
> Oh, one think I almost forgot about - currently the python
> script extracts all error which names begin with:
> ['ERROR_', 'NERR_', 'FRS_', 'RPC_', 'EPT_', 'OR_', 'WAIT_TIMEOUT']
> But only the 'ERROR_' prefix is replaced with 'WERR_' prefix.
> The rest of errors are just prefixed with 'WERR_' and capitalized.
> This leads to errors like: WERR_NERR_DCNOTFOUND (my favorite)
> I know lots of people don’t think this is a good idea, but
> I really do think it is the right thing to be done (mostly for
> creating more clear code and for usability)
> So, here is my favorite error - DC_NOT_FOUND error.
> There are two erros:
> If we just merge them, we shall get:
> If someone happens to need to return DCNotFound error,
> which one should he/she use?
> But in case we have:
> I think there should be much less confusion which one is to be used
> (and again, this improve autocompletion feature usability a lot)

I found out generated error codes are with decimal values.
Sorry, here is the updated python script and correct patches.

Kamen Mazdrashki
kamen.mazdrashki at postpath.com
18 Macedonia Blvd. Sofia 1606

-------------- next part --------------
A non-text attachment was scrubbed...
Name: win32_errors.tar.bz2
Type: application/octet-stream
Size: 85122 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20090918/eb765225/attachment.obj>

More information about the samba-technical mailing list