The MASM Forum

Projects => ObjAsm => Topic started by: HSE on April 07, 2021, 04:04:54 AM

Title: Testing RichEditBib (Highlight Syntax Richedit)
Post by: HSE on April 07, 2021, 04:04:54 AM
Hi all!

This a test of a Richedit subclass using a modification of Iczelion's Syntax Highlighting. Only symbols are colored here, exactly what Iczelion omitted.

For dual code freg macro system (http://masm32.com/board/index.php?topic=9267.0) is used. In 32 bits registers are pushed/poped and in 64 bits registers are pseudo pushed/poped (that means storing them as local variables).  That make a lot more easy to adapt 32 bits code to 64 bits code.

Regards, HSE.

Now must work.
Title: Re: Testing RichEditBib (Highlight Syntax Richedit)
Post by: Biterider on April 07, 2021, 04:32:53 AM
Hi HSE
The binary works fine and I was able to recompile the app right out of the box.
For some strange reason, Windows Defender detected the binary as a dangerous file...
Perhaps you've optimized the colors for high contrast. Yellow on a white background (SymbolColor1) is a little difficult to read on regular displays.

Biterider
Title: Re: Testing RichEditBib (Highlight Syntax Richedit)
Post by: HSE on April 07, 2021, 06:42:14 AM
Hi Biterider!

Quote from: Biterider on April 07, 2021, 04:32:53 AM
For some strange reason, Windows Defender detected the binary as a dangerous file...

I erased previous  :biggrin:. Jotti don't found nothing now.

Quote from: Biterider on April 07, 2021, 04:32:53 AM
Perhaps you've optimized the colors for high contrast.
No optimization, just black background. Changed that  :thumbsup:

Thanks, HSE.
Title: Re: Testing RichEditBib (Highlight Syntax Richedit)
Post by: LiaoMi on April 07, 2021, 07:08:17 AM
Quote from: HSE on April 07, 2021, 06:42:14 AM
Hi Biterider!

Quote from: Biterider on April 07, 2021, 04:32:53 AM
For some strange reason, Windows Defender detected the binary as a dangerous file...

I erased previous  :biggrin:. Jotti don't found nothing now.

Quote from: Biterider on April 07, 2021, 04:32:53 AM
Perhaps you've optimized the colors for high contrast.
No optimization, just black background. Changed that  :thumbsup:

Thanks, HSE.

Hi HSE,

(https://i.ibb.co/9bp9BPT/2021-04-06-23-05-02-Test-Rich-Bib.png)
Title: Re: Testing RichEditBib (Highlight Syntax Richedit)
Post by: HSE on April 07, 2021, 07:31:21 AM
Hi LiaoMi!

That is an optimization to protect eyes!! :biggrin:

I think that was the file 1 (I forgot a line). Now file 2 have to work :thumbsup:
That don't work in this Richedit versiĆ³n, I have to see.

Thanks, HSE 
Title: Re: Testing RichEditBib (Highlight Syntax Richedit)
Post by: HSE on April 07, 2021, 08:02:01 AM
Thanks LioaMi. Apparently if OS support CHARFORMAT2 perhaps getformat have a problema with CHARFORMAT :cool:

Added a new Project in first post.
Title: Re: Testing RichEditBib (Highlight Syntax Richedit)
Post by: jj2007 on April 07, 2021, 08:47:53 AM
Quote from: HSE on April 07, 2021, 08:02:01 AM
Thanks LioaMi. Apparently if OS support CHARFORMAT2 perhaps getformat have a problema with CHARFORMAT :cool:

mov   [xsi].reRichBib.charF.cbSize, sizeof CHARFORMAT2
Title: Re: Testing RichEditBib (Highlight Syntax Richedit)
Post by: HSE on April 07, 2021, 09:22:30 AM
Quote from: jj2007 on April 07, 2021, 08:47:53 AM
mov   [xsi].reRichBib.charF.cbSize, sizeof CHARFORMAT2
No in Win7-32. Yes in Win7-64. Like in file 3 is working well in both  :thumbsup:.
Title: Re: Testing RichEditBib (Highlight Syntax Richedit)
Post by: jj2007 on April 07, 2021, 09:35:33 AM
See Murray's blog (https://docs.microsoft.com/en-us/archive/blogs/murrays/richedit-character-formatting). That was 2012...
Title: Re: Testing RichEditBib (Highlight Syntax Richedit)
Post by: HSE on April 07, 2021, 09:49:41 AM
Quote from: jj2007 on April 07, 2021, 09:35:33 AM
See Murray's blog (https://docs.microsoft.com/en-us/archive/blogs/murrays/richedit-character-formatting). That was 2012...

Office...
Title: Re: Testing RichEditBib (Highlight Syntax Richedit)
Post by: jj2007 on April 07, 2021, 10:11:30 AM
Quote from: HSE on April 07, 2021, 09:49:41 AMOffice...

See Making RichEdit work properly on Windows 10 (http://masm32.com/board/index.php?topic=5383.0). The System32\RichEd20.dll sucks, it's buggy and utterly slow. Use Office 11 or 12 versions, they sit in C:\Program Files (x86)\Common Files\Microsoft shared\Office1?\RICHED20.DLL; even if you don't have Office installed, you may find them there if you ever installed the free Word viewer (https://microsoft-office-word-viewer-2007.en.softonic.com/).

See also https://docs.microsoft.com/en-us/archive/blogs/murrays/richedit-versions
Title: Re: Testing RichEditBib (Highlight Syntax Richedit)
Post by: Biterider on April 07, 2021, 03:55:04 PM
Hi HSE
TestRichBib3 works fine under Win10 Enterprise 20H2/64.  :thumbsup:

Biterider
Title: Re: Testing RichEditBib (Highlight Syntax Richedit)
Post by: hutch-- on April 07, 2021, 04:01:00 PM
It worked OK on my Win10 64. Yellow punctuation but the text in white and on a black background scheme.
Title: Re: Testing RichEditBib (Highlight Syntax Richedit)
Post by: HSE on April 07, 2021, 11:18:55 PM
Thanks Hutch and Biterider  :thumbsup:

Quote from: jj2007 on April 07, 2021, 10:11:30 AM
System32\RichEd20.dll
Good point JJ! Could be a problem here. Thanks.
Title: Re: Testing RichEditBib (Highlight Syntax Richedit)
Post by: jj2007 on April 08, 2021, 12:22:47 AM
The "official" RichEdit DLL is \System32\msftedit.dll (but it's not popular - I don't know why, I never tried it); there is also a C:\Windows\System32\riched20.dll, but it's over 10 years old, and I doubt it has all the features of the office versions, at one third of their size...

From Murray's blog (https://docs.microsoft.com/en-us/archive/blogs/murrays/richedit-versions):
4.0 Office XP riched20.dll
4.1 Windows XP SP1, Tablet, Vista msftedit.dll
5.0 Office 2003 riched20.dll
5.1 Windows CE, Pocket Word riched20.dll
6.0 Office 2007, Encarta Math Calculator riched20.dll
Title: Re: Testing RichEditBib (Highlight Syntax Richedit)
Post by: HSE on May 30, 2021, 07:38:41 AM
Hi all!

Corrected Iczelion tut 35 mistake (http://masm32.com/board/index.php?topic=2379.msg102979#msg102979).

Also can open files to see better the effect.

Updated in first post.

Regards, HSE
Title: Re: Testing RichEditBib (Highlight Syntax Richedit)
Post by: Biterider on May 30, 2021, 02:22:01 PM
Hi HSE
Compiles right out of the box and runs perfectly  :thup:


Biterider
Title: Re: Testing RichEditBib (Highlight Syntax Richedit)
Post by: jj2007 on May 30, 2021, 06:52:06 PM
TestRichBib.rc(13) : fatal error RC1015: cannot open include file 'VER\Version.rc'.
TestRichBib.rc(14) : fatal error RC1015: cannot open include file 'MFT\Manifest_Invoker.rc'.
TestRichBib.rc (20): error RC2135 : file not found: ICO\OA.ico
TestRichBib.rc (24): error RC2135 : file not found: BMP\WndBkgnd.bmp
Title: Re: Testing RichEditBib (Highlight Syntax Richedit)
Post by: HSE on May 31, 2021, 04:27:01 AM
Quote from: Biterider on May 30, 2021, 02:22:01 PM
Compiles right out of the box and runs perfectly  :thup:
Fantastic. Thanks  :thumbsup:

Quote from: jj2007 on May 30, 2021, 06:52:06 PM
TestRichBib.rc(13) : fatal error RC1015: cannot open include file 'VER\Version.rc'.
TestRichBib.rc(14) : fatal error RC1015: cannot open include file 'MFT\Manifest_Invoker.rc'.
TestRichBib.rc (20): error RC2135 : file not found: ICO\OA.ico
TestRichBib.rc (24): error RC2135 : file not found: BMP\WndBkgnd.bmp

Yes, you have to use make.cmd for the easy way. Other way you must provide to RC the include path to ObjAsm\Resources.  :thumbsup:
Title: Re: Testing RichEditBib (Highlight Syntax Richedit)
Post by: jj2007 on May 31, 2021, 06:29:28 AM
Quote from: HSE on May 31, 2021, 04:27:01 AMYes, you have to use make.cmd for the easy way. Other way you must provide to RC the include path to ObjAsm\Resources.  :thumbsup:

C:\Masm32\Members\HSE\TestRichBib>make.cmd
Impossibile trovare il percorso specificato.

So I looked into the issue...:
C:\Masm32\Members\HSE\TestRichBib>set objasm_path=C:\ObjAsm

C:\Masm32\Members\HSE\TestRichBib>make
Building TestRichBib project ...

User Interface: WINDOW
Binary Format:  EXE
Bitness:        64
OOP support:    ENABLED
String Type:    ANSI
Mode:           RELEASE

BuildInfo is processing TestRichBib_Shared.inc ...
Inc2RC is converting TestRichBib_Shared.inc ...
Compiling TestRichBib.rc resources ...
Impossibile trovare il percorso specificato.

***************************
********** ERROR **********
***************************
Title: Re: Testing RichEditBib (Highlight Syntax Richedit)
Post by: HSE on May 31, 2021, 06:59:36 AM
Quote from: jj2007 on May 31, 2021, 06:29:28 AM
Impossibile trovare il percorso specificato.

Have you tested:
RC /i D:\ObjAsm\Resources testrichbib.rc

What version you have (release or GitHub)?
Title: Re: Testing RichEditBib (Highlight Syntax Richedit)
Post by: jj2007 on May 31, 2021, 07:23:04 AM
Quote from: HSE on May 31, 2021, 06:59:36 AMHave you tested:
RC /i D:\ObjAsm\Resources testrichbib.rc

C:\Masm32\Members\HSE\TestRichBib>\Masm32\bin\RC /i C:\ObjAsm\Resources testrichbib.rc
testrichbib.rc(14) : fatal error RC1015: cannot open include file 'MFT\Manifest_Invoker.rc'.


QuoteWhat version you have (release or GitHub)?

No idea. Are their two versions, and if yes, why?
Title: Re: Testing RichEditBib (Highlight Syntax Richedit)
Post by: HSE on May 31, 2021, 07:56:58 AM
Quote from: jj2007 on May 31, 2021, 07:23:04 AM
No idea.

:biggrin: Interesting. Perhaps a history file with version number is missing. In Object.inc you can see version.

Quote from: jj2007 on May 31, 2021, 07:23:04 AM
Are their two versions, and if yes, why?
I think there are C.1.0 to C.1.2 releases, and GitHub C1.3 in development version.

If you don't have 'MFT\Manifest_Invoker.rc', perhaps is an older version.

Title: Re: Testing RichEditBib (Highlight Syntax Richedit)
Post by: Biterider on June 01, 2021, 12:47:35 AM
Hi
I maintain 2 versions, one is the official stable version (C.1.0) from the ObjAsm homepage and the dev version from Github.
The last one contains files that will not be shared publicly and files that have been contributed and not fully tested.
There are obvious differences between them, but at the moment I don't plan an official release in the coming weeks.  :cool:

Biterider
Title: Re: Testing RichEditBib (Highlight Syntax Richedit)
Post by: HSE on June 01, 2021, 01:20:37 AM
Hi Biterider!

Quote from: Biterider on June 01, 2021, 12:47:35 AM
I maintain 2 versions, one is the official stable version (C.1.0) from the ObjAsm homepage and the dev version from Github.
:thumbsup:

:biggrin: I don't have a clue what I'm using like stable version in this machine, how you know version?

HSE.
Title: Re: Testing RichEditBib (Highlight Syntax Richedit)
Post by: Biterider on June 01, 2021, 01:35:49 AM
Hi HSE
If you have installed ObjAsm with the WebInstaller, you have at least C.1.0 as a base. If you've added or updated files from the repository, or added your own, then you've got something in between. Only with a fresh installation can you say with absolute certainty that I have version x.x.x.
The next version step using the installer will be C.2.0.
For each version I have marked the "created" and the "modified" attributes of all files of the release distribution so far. For version C.1.0 I used 11/01/2017 00:00 UTC. That way, if these dates are unchanged, then you haven't changed the file.

Biterider
Title: Re: Testing RichEditBib (Highlight Syntax Richedit)
Post by: HSE on June 01, 2021, 01:43:24 AM
Quote from: Biterider on June 01, 2021, 01:35:49 AM
Only with a fresh installation can you say with absolute certainty that I have version x.x.x.
I suspected that  :biggrin:

Thanks.
 
Title: Re: Testing RichEditBib (Highlight Syntax Richedit)
Post by: HSE on June 01, 2021, 11:38:52 PM
Now I remember a detail!!

In 64 bits I'm  using UASM 2.49 because a later version apparently is not fully compatible with code.

Regards.
Title: Re: Testing RichEditBib (Highlight Syntax Richedit)
Post by: Biterider on June 02, 2021, 02:28:07 AM
Hi
For each new version of UASM I recompile most of the code base and try to check the functionality of the binaries.
I keep some older version of UASM to check for new "features", but currently I'm using version 2.52 and all seems to be perfectly fine.

Biterider
Title: Re: Testing RichEditBib (Highlight Syntax Richedit)
Post by: HSE on June 02, 2021, 07:55:57 AM
Quote from: Biterider on June 02, 2021, 02:28:07 AM
currently I'm using version 2.52
:thumbsup:   

Perhaps JJ have same problem I have with UASM version 2.51.
Title: Re: Testing RichEditBib (Highlight Syntax Richedit)
Post by: jj2007 on June 02, 2021, 07:36:26 PM
make.cmd:
@echo off
REM Usage:
REM   1. copy this file to the destination folder.
REM   2. execute it to to start the build process.
set OBJASM_PATH=C:\ObjAsm\
call %OBJASM_PATH%\Build\OA_BUILD.cmd%*


output:
Building Tmp_File project ...

User Interface: WINDOW
Binary Format:  EXE
Bitness:        64
OOP support:    ENABLED
String Type:    ANSI
Mode:           RELEASE

Assembling Tmp_File.asm project ...
Linking object modules to EXE-file ...
""\link.exe"" is not recognised as an internal or external command,
an executable or a batch file.

***************************
********** ERROR **********
***************************


There is definitely a C:\Masm32\bin\link.exe :cool:
Title: Re: Testing RichEditBib (Highlight Syntax Richedit)
Post by: Biterider on June 02, 2021, 08:31:41 PM
Hi JJ
I think the problem is the path configuration. The webistaller should have done it for you. If not, you need to do 2 things:

Note: This has made testing easier when a new assembler or linker version was released and I wanted to check all projects at once.

Biterider
Title: Re: Testing RichEditBib (Highlight Syntax Richedit)
Post by: jj2007 on June 02, 2021, 09:02:20 PM
Hi Biterider,
I made modifications to OA_Set.cmd, see below, and that eliminated the linker error, but it still says "error" without specifying what kind of error.
REM Usual paths are:
REM OBJASM_PATH="D:\ObjAsm"
REM MSVS_PATH="%programfiles(x86)%\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\bin\Hostx64\x64"
REM WINKIT_PATH="%programfiles(x86)%\Windows Kits\10\bin\10.0.18362.0"

REM They are stored in the registry:
REM   - HKEY_CURRENT_USER\Environment
REM   - HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment

reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | find /i "x86" > NUL && set SYSTEM_BITNESS=32 || set SYSTEM_BITNESS=64

if %OS%==64BIT echo This is a 64bit operating system

set BldInf="%OBJASM_PATH%\Build\Tools\BuildInfo.cmd"
set Inc2RC="%OBJASM_PATH%\Build\Tools\Inc2RC.cmd"
set MidlCompiler="%WINKIT_PATH%\x64\midl.exe"
set UICCompiler="%WINKIT_PATH%\x86\UICC.exe"
set ResourceCompiler="%WINKIT_PATH%\x64\RC.EXE"

if %SYSTEM_BITNESS%==32 (
  set Assembler="%OBJASM_PATH%\Build\Tools\UASM32.EXE"
) else (
  set Assembler="%OBJASM_PATH%\Build\Tools\UASM64.EXE"
)
REM set Linker="%MSVS_PATH%\link.exe"
set Linker="\Masm32\bin\link.exe"
REM set LibraryCompiler="%MSVS_PATH%\lib.exe"
set LibraryCompiler="\Masm32\bin\lib.exe"
set Debugger="%programfiles(x86)%\Microsoft Visual Studio\2017\Community\Common7\IDE\devenv.exe"

exit /b 0

Building Tmp_File project ...

User Interface: WINDOW
Binary Format:  EXE
Bitness:        64
OOP support:    ENABLED
String Type:    ANSI
Mode:           RELEASE

Assembling Tmp_File.asm project ...
Linking object modules to EXE-file ...

***************************
********** ERROR **********
***************************
Title: Re: Testing RichEditBib (Highlight Syntax Richedit)
Post by: HSE on June 02, 2021, 10:43:37 PM
Hi JJ

Quote from: jj2007 on June 02, 2021, 09:02:20 PM
Bitness:        64

Quote from: jj2007 on June 02, 2021, 09:02:20 PM
set Linker="\Masm32\bin\link.exe"
set LibraryCompiler="\Masm32\bin\lib.exe"

I think you are trying to build a 64 bits with 32 bit tools.

Try at begin of *.asm file modify to :SysSetup OOP, WIN32, ANSI_STRING
Title: Re: Testing RichEditBib (Highlight Syntax Richedit)
Post by: jj2007 on June 02, 2021, 10:46:30 PM
Hector, I am trying desperately to assembly your original code... and it's too messy for my taste, I'll give up now, sorry.
Title: Re: Testing RichEditBib (Highlight Syntax Richedit)
Post by: HSE on June 02, 2021, 11:09:05 PM
Quote from: jj2007 on June 02, 2021, 10:46:30 PM
and it's too messy for my taste

:thumbsup: If I remember well, WinKit and VS not always have same structure. Can take a little effort but is only once time.

For example I have a little different setting in 32bit machine :set Linker="%MSVS_PATH%\bin\hostx86\x86\link.exe"
set LibraryCompiler="%MSVS_PATH%\\bin\Hostx86\x86\lib.exe"


At first I also give up and set ObjAsm to use only masm32 package  :biggrin: