• Welcome to Forum.Deepsoftware.Com. Please login or sign up.
 

Bug in nrwin32di.pas - GetSetupError

Started by moelski, September 11, 2010, 02:34:06 am

Previous topic - Next topic

moelski

Hi Roman,

I think there is a bug in the nrwin32di.pas file. GetSetupError uses Integer as Input type. But if i try to compile my app in D2010 I got Error like this: "W1012 Constant expression violates subrange bounds".

If I change the function to this all works fine:
function GetSetupError(code:Cardinal):string;

ERROR_NO_SUCH_DEVINST is defined as this:
ERROR_NO_SUCH_DEVINST                    = APPLICATION_ERROR_MASK or ERROR_SEVERITY_ERROR or $20B;

ERROR_SEVERITY_ERROR          = $C0000000;

C0000000 = 3221225472 decimal ....

And integer is from -2147483648 to 2147483647 ...

That wont work ....

Roman Novgorodov

Hello

We keep error code as signed integer because in some cases it is suitable to check result on negative value.

Anyway you can always call this function like below:

s := GetSetupError(Integer(ERROR_NO_SUCH_DEVINST));

Roman Novgorodov
DeepSoftware.Com
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

moelski

Hi Roman,

Quoteyou can always call this function like below:

I never use the function. This was a compilation error in Delphi 2010!

Without my "fix" I wasn´t able to compile my app.

Roman Novgorodov

Hello

You confused me :-(

All Delphi versions compile nrComm Lib packages without any errors.
You show me warning. It is not error.

Roman Novgorodov
DeepSoftware.Com
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

moelski

Hi Roman,

QuoteYou confused me :-(

I´m really sorry for that.

QuoteYou show me warning. It is not error.

Oh I got errors, too:
Quote[DCC Fehler] nrwin32di.pas(961): E2026 Konstantenausdruck erwartet
[DCC Warnung] nrwin32di.pas(963): W1012 Konstantenausdruck verletzt untere Grenzen
[DCC Fehler] nrwin32di.pas(963): E2026 Konstantenausdruck erwartet
[DCC Warnung] nrwin32di.pas(964): W1012 Konstantenausdruck verletzt untere Grenzen
[DCC Fehler] nrwin32di.pas(964): E2026 Konstantenausdruck erwartet
[DCC Warnung] nrwin32di.pas(965): W1012 Konstantenausdruck verletzt untere Grenzen
[DCC Fehler] nrwin32di.pas(965): E2026 Konstantenausdruck erwartet
[DCC Warnung] nrwin32di.pas(966): W1012 Konstantenausdruck verletzt untere Grenzen
[DCC Fehler] nrwin32di.pas(966): E2026 Konstantenausdruck erwartet
[DCC Warnung] nrwin32di.pas(967): W1012 Konstantenausdruck verletzt untere Grenzen
[DCC Fehler] nrwin32di.pas(967): E2026 Konstantenausdruck erwartet
[DCC Warnung] nrwin32di.pas(968): W1012 Konstantenausdruck verletzt untere Grenzen
[DCC Fehler] nrwin32di.pas(968): E2026 Konstantenausdruck erwartet
[DCC Warnung] nrwin32di.pas(969): W1012 Konstantenausdruck verletzt untere Grenzen
[DCC Fehler] nrwin32di.pas(969): E2026 Konstantenausdruck erwartet
[DCC Fataler Fehler] MainUnit.pas(11): F2063 Verwendete Unit 'nrwin32di.pas' kann nicht compiliert werden


These are the Errors and Warnings I got.

Could this be any Compiler Setting in Delphi 2010?

Greetz Dominik

Roman Novgorodov

September 13, 2010, 04:31:09 am #5 Last Edit: September 13, 2010, 04:42:40 am by Roman Novgorodov
Hello

Range checking option in Delphi compiler options.

Roman Novgorodov
DeepSoftware.Com
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.