Range check error in dwsComConnector.RaiseOleError()

Issue #86 resolved
Anders Melander created an issue

If a negative HResult value (bit 0x80000000 is set) is passed to RaiseOleError() then the call to SysErrorMessage() within RaiseOleError fails with an ERangeCheck exception.

RaiseOleError and SysErrorMessage are declared as:

procedure RaiseOleError(err : HResult; const excepInfo : TExcepInfo);
function SysErrorMessage(ErrorCode: Cardinal): string;

A HResult is a signed 32-bit integer with the range -2147483648..2147483647.


The solution is to hard cast the HResult to an unsigned value as it's done in DwsOleCheck and the EOleSysError constructor.

Environment: Delphi XE, Range checking enabled.

Comments (2)

  1. Log in to comment