Jump to content
Sign in to follow this  
EWB

My evil program with Alpha 2.9.9.80 on WinXP

Recommended Posts

I just download the SMS Alpha 2.9.9.80 and created a hello world program to test on my old shoes the virtual WinXP (XP under Ubuntu). The new SMS compiler does not work on this environment, we've got some kind of silence error "run and exit". They're probably using some feature that is not supporting Windows XP. So, I'll stick with the old compiler version 2.2.2.4694 and test the alpha RTL.

When I first run SmartMS.exe I've got the Loading package failed message:

Quote

Hint: overloaded method “SetBounds” should be marked with the “overload” directive [line: 48, column 5, file: SmartCL.Controls.ToolBar]

Hint: overloaded method “SetBounds” should be marked with the “overload” directive [line: 42, column 5, file: SmartCL.Controls.Header]

Hint: Redundant specifier, visibility is already “PROTECTED” [line: 48, column: 3, file: SmartCL.Controls.Elements]

Hint: Redundant specifier, visibility is already “PROTECTED” [line: 53, column: 3, file: SmartCL.Controls.Elements]

Hint: Redundant specifier, visibility is already “PROTECTED” [line: 108, column: 3, file: SmartCL.DBGrid]

Hint: Redundant specifier, visibility is already “PROTECTED” [line: 162, column: 3, file: SmartCL.DBGrid]

Hint: Redundant specifier, visibility is already “PROTECTED” [line: 363, column: 3, file: SmartCL.DBGrid]

Hint: Redundant specifier, visibility is already “PROTECTED” [line: 373, column: 3, file: SmartCL.DBGrid]

Hint: Redundant specifier, visibility is already “PROTECTED” [line: 75, column: 3, file: SmartCL.DBGrid]

Hint: Redundant specifier, visibility is already “PROTECTED” [line: 80, column: 3, file: SmartCL.DBGrid]

Hint: Redundant specifier, visibility is already “PROTECTED” [line: 86, column: 3, file: SmartCL.DBGrid]

Hint: Redundant specifier, visibility is already “PROTECTED” [line: 108, column: 3, file: SmartCL.DBGrid]

Hint: Redundant specifier, visibility is already “PROTECTED” [line: 162, column: 3, file: SmartCL.DBGrid]

Hint: Redundant specifier, visibility is already “PROTECTED” [line: 363, column: 3, file: SmartCL.DBGrid]

Hint: Redundant specifier, visibility is already “PROTECTED” [line: 373, column: 3, file: SmartCL.DBGrid]

Syntax Error: No method “SupportAdjustment” found in class: “override” no applicable [line: 42, column: 20, file: SmartCL.Slider]

Warning: “OffsetY” has been deprecated: Use ScrollTop instead [line: 1210, column: 35, file: SmartCL.DBGrid]

Warning: “OffsetY” has been deprecated: Use ScrollTop instead [line: 1215, column: 30, file: SmartCL.DBGrid]

Warning: “OffsetY” has been deprecated: Use ScrollTop instead [line: 1243, column: 36, file: SmartCL.DBGrid]

Warning: “OffsetY” has been deprecated: Use ScrollTop instead [line: 1266, column: 61, file: SmartCL.DBGrid]

We have to edit some files to fix this entry message box.

a. edit SmartCL.Controls.ToolBar and SmartCL.Controls.Header units, this is very weird, I had to add "overload" to disappear the Hint.

48' procedure SetBounds(const NewLeft, NewTop, NewWidth, NewHeight: integer); overload; override;

b. about the Redundant specifier, visibility is already “PROTECTED”, is just duplicated Protected keyword used at the SmartCL.Controls.Elements and SmartCL.DBGrid units, we have to edit those units and comment duplicated protected keywords. They forgot to clean up those units.

In the SmartCL.DBGrid, we have to replace "OffsetY" to "ScrollTop".

c. The syntax Error: No method “SupportAdjustment” ???

The Slider component can be found at the C:\smart\RTL\SmartCL\SmartCL.Slider.pas, alright?

but this component was designed " as internal" this component and not made "external" as expected!

A quick fix, just edit C:\smart\Packages\SmartCL.Slider.spk and comment the SupportAdjustment (does not exist anymore)

public
    //class function SupportAdjustment: Boolean; override;

/*class function TW3Slider.SupportAdjustment: Boolean;
begin
  Result := False;
end;*/

d. OK. No message box anymore. Now, I'm going to create my Hello World program, it's just a evil

  WriteLn(
    FormatDateTime('dddd d of mmmm yyyy', now)
  );

When we try to execute this malicious code project, we've surprised got some unexpected error, dialog box, I suspect what would be :)

I had to edit C:\smart\Templates\default.html, hum my old compiler does not suppport this

<?pas=Project.WebFonts?>

So I just deleted this above line. I suspect the project will inject some web font at the project by default, and the actual compiler does not understand this keyword.

e. hum. no more unexpected error dialog. Now, I'll try to execute the project and then a Syntax Error:

Syntax Error: Unknown name "TW3ThemeBackground" [line: 1066, column: 30, file: SmartCL.Dialogs]

a nasty trick would go to the Project Options --> Compiler --> Custom conditionals defines: --> I must to define a directive here called: THEME_AUTOSTYLE;

f. and it was compiled! when I run the project I've got "ReferenceError, fmtLongMonthNames is not defined"

g. almost there. My evil program uses a function FormatDateTime('dddd d of mmmm yyyy', now) 

I would expect something like: "friday 22 of december 2017"

We have to edit the source code, the old compiler uses a registred function called function FormatDateTime(fmt, v, u) which there's a minor error

the codegen emit

case "mmmm": res+=fmtLongMonthNames[dt.getUTCMonth()]; break;

but the correct is:

case "mmmm": res+=$fmt.LongMonthNames[dt.getUTCMonth()]; break;

Now, it's working for me.

Share this post


Link to post
Share on other sites

Did you remember to run the update program? It seems to me like you have either been extremely unfortunate and hit every possible problem in existance, or that you have some old files lingering that were not updated.
Backup the RTL folder, run the update and make sure you get the fresh units.
There is no way that amount of errors can occur without something being terribly wrong with the installation

Share this post


Link to post
Share on other sites
On 22/12/2017 at 2:48 AM, lennart said:

Did you remember to run the update program? It seems to me like you have either been extremely unfortunate and hit every possible problem in existance, or that you have some old files lingering that were not updated.
Backup the RTL folder, run the update and make sure you get the fresh units.
There is no way that amount of errors can occur without something being terribly wrong with the installation

 

a. extract all files from SMS Alpha download link  to C:\Smart then launch SmartUpdate.exe, now we SMS version 2.9.9.90.

b. Since I'm using the deprecated OS System (Windows XP SP3), the new SmartMS.exe does not run on this system. I've replaced to an old version 2.2.2.4694. I using this OS under UBUNTU.  I've used the above steps and now is working for me.

loadingpackage.jpg

Share this post


Link to post
Share on other sites

See the above picture, there's also Syntax error at SmartCL.System unit when using the old SmartMS.exe ver 2.2.2.4694

I have to edit C:\Smart\RTL\SmartCL\SmartCL.System.pas and fix the lines 1108 and 1154.

function w3_getIsChrome: Boolean;
begin
  var LUserAgent := TVariant.AsString(BrowserAPI.Navigator.userAgent).ToLower();
  if LUserAgent.Contains('chrome') then
    result := if Boolean(BrowserAPI.window.chrome) then true else false;
end;

function w3_getIsOpera: Boolean;
begin
  result := if Boolean(BrowserAPI.window.opera) then true else false;
end;

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×