Implement DceErrorInqText

Dmitry Timoshkov dmitry at baikal.ru
Wed Dec 22 00:50:01 CST 2004


"Bill Medland" <billmedland at mercuryspeed.com> wrote:

> +RPC_STATUS RPC_ENTRY DceErrorInqTextW (unsigned long e, unsigned short *b)
> +{
> +    DWORD count;
> +    if (acceptable_rpc_code (e))

It would be much more natural to make FormatMessageW to decide whether a passed
error code is valid or not, i.e. if it exists in the system message table.

> +    {
> +        count = FormatMessageW (FORMAT_MESSAGE_FROM_SYSTEM | 
> +                FORMAT_MESSAGE_IGNORE_INSERTS,
> +                NULL, e, 0, b, /* I don't know!!! */ 65535, NULL);

256 (or 1024) is a reasonable margin I believe, at least messages in Wine are much
shorter of even 256.

> +    }
> +    else
> +        count = 0;
> +    if (!count)
> +    {
> +        MultiByteToWideChar(CP_ACP, 0, cszInvalidCode, -1, b, 65535 /* ??? */);

A message about invalid code should be localizable as well, so it should be
either loaded by LoadString or even by FormatMessage for consistency IMO.
winerror.h from PlatformSDK has the following definition which matches your
error text ("The error specified is not a valid Windows RPC error code.\r\n"):

//
// MessageId: RPC_S_NOT_RPC_ERROR
//
// MessageText:
//
//  The error specified is not a valid Windows RPC error code.
//
#define RPC_S_NOT_RPC_ERROR              1823L

-- 
Dmitry.




More information about the wine-devel mailing list