flat assembler
Message board for the users of flat assembler.

Index > Windows > Scintilla who try ?

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 1246
Roman
Exist old version SciLexer.dll and new 5.1

New version otherwise initialized.
And have two dll.
Lexilla.dll and Scintilla64.dll

I thinked Scintilla64.dll work as richedit50.
automatically get my window and started.
But not.

Hard finde good tutorials.
All tutorials have many classes and hard find how init Scintilla64.dll and Lexilla.dll
Code:
format PE64 GUI 5.0 on 'nul'
entry Start
;FMA work on AMD Ryzen 3500 i na Intel I5 8400 2017 god
macro PrintInt chTxt,chVal { cinvoke sprintf,Status22,chTxt,chVal
                             invoke  MessageBox, 0,Status22, 0, 0 }
return EQU ret
macro Msg chT { invoke MessageBox,0,chT,0,0 }
;macro dbMsg chT {  }



include 'C:\fasmw17316\include\win64a.inc'
include 'C:\fasmw17316\INCLUDE\MACRO\STRUCT.INC'
include '2.txt'

;winflgs        = WS_VISIBLE + WS_POPUP
;winflgs        = WS_VISIBLE + WS_OVERLAPPEDWINDOW
winflgs        = WS_CAPTION + WS_SYSMENU + WS_THICKFRAME + WS_MINIMIZEBOX + WS_MAXIMIZEBOX + WS_MAXIMIZE + WS_CLIPCHILDREN



section '.data' data readable writeable executable
        WinFlgMod      dd  winflgs
        IntWinParams   dd 700,500

        BackGroundClr  db 34,40,39,0         ;RGBA av 0x00000000 kak ABGR
        TextClr        db 151,190,255,0         ;RGBA

        FaceName         db "Arial",0     ;Courier New
                 dd 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
        msg        MSG
        hwnd       dq 0
        wc WNDCLASSEX sizeof.WNDCLASSEX,0,WindowProc,0,0,NULL,NULL,NULL,COLOR_BTNFACE+1,NULL,_class,NULL

        _class          db 'Scintilla',0
        _title          db 'Scintilla',0
     
        pu dq 0,SCI_GETDIRECTFUNCTION,0,0


section '.code' code readable writeable executable
            tmpfun     dq 0
            tmpAa      dq 4033
            ;GetLexerName      dq 0
            ;CreateLexer       dq 0
Start:
     sub     rsp,8
    
;create window
        invoke  GetModuleHandle,0
        mov     [wc.hInstance],rax
        invoke  LoadIcon,0,IDI_APPLICATION
        mov     [wc.style],CS_HREDRAW or CS_VREDRAW
        mov     [wc.hIcon],rax
        mov     [wc.hIconSm],rax
        invoke  LoadCursor,0,IDC_ARROW
        mov     [wc.hCursor],rax
        invoke  RegisterClassEx,wc
        test    rax,rax
        jz      error
;direct2D draw i v WS_EX_NOREDIRECTIONBITMAP = 0 !
        WS_EX_NOREDIRECTIONBITMAP = 0;x00200000    ;this only Win8.1\Win 10
        WS_EX_COMPOSITED          = 0x02000000    ;WS_EX_TRANSPARENT
        invoke  CreateWindowEx,WS_EX_NOREDIRECTIONBITMAP,_class,_title,dword [WinFlgMod],0,0,dword [IntWinParams],dword [IntWinParams+4],NULL,NULL,[wc.hInstance],NULL
        mov     [hwnd],rax

        test    rax,rax
        jz      error
        invoke  ShowWindow,rax,1
;init Scintilla
    
ziii2:

      SCI_SETILEXER = 4033      ;GetDirectFunction=2184
      invoke  CreateLexer,'cpp'                 ;ok  ret eax,rdx
      mov     [tmpAa],rax
      ;mov     rax,-2;SCI_SETILEXER
      ;add     rdx,rax
      mov     [tmpfun],rdx                      ;rdx ?
      mov     rcx,tmpAa
      invoke  tmpfun,4033,0,0               ;this crash
;Scintilla_DirectFunction show IDA pro function code:
;mov     rax, [rcx]
;jmp     qword ptr [rax+210h]
      invoke Scintilla_DirectFunction,tmpfun    ;this crash
   

Backzz1:
   
     invoke PeekMessage,msg, 0, 0, 0, PM_REMOVE
     test   eax,eax
     jz     .2
     invoke  TranslateMessage,  msg
     invoke  DispatchMessage,  msg

  
.2:  invoke Sleep,40

     cmp     byte [FocusWinLost],0
     jz      .render                   ;if no sleep,10 fps:35000 Ryzen 3500 !
     invoke  Sleep,40
     ;Msg 'lost'
     jmp     .norender
.render:

.norender:

.norenderZ:
     cmp            [CloseWin],1
     jnz      Backzz1

error:
     invoke  MessageBox,0,'End',0,0

     invoke  ExitProcess, 0

proc WindowProc uses rbx rsi rdi, hwnd,wmsg,wparam,lparam

; Note that first four parameters are passed in registers,
; while names given in the declaration of procedure refer to the stack
; space reserved for them - you may store them there to be later accessible
; if the contents of registers gets destroyed. This may look like:
       mov     [hwnd],rcx
       mov     [wmsg],rdx
       mov     [wparam],r8
       mov     [lparam],r9
        cmp edx,WM_CREATE
        jnz .rr
        ret
.rr:
        cmp edx,WM_KILLFOCUS
        jnz .0
        mov  byte [FocusWinLost],1
        ret
.0:     cmp edx,WM_SETFOCUS
        jnz .0b
        mov  byte [FocusWinLost],0
        ret
.0b:
    rept 0 {
        cmp edx, WM_PAINT
            jnz .1
              invoke BeginPaint,[hwnd], ps ;*=mozno bez
              ;Win32Application.cpp bez BeginPaint
              ;v DX12 Win 7 delali tut OnRender();
              ;rizsovali kogda win resize\move\unhide
              invoke EndPaint,[hwnd], ps   ;*
              ret
          .1:
          }
;KeyPr
        cmp edx, WM_KEYDOWN
            cmp [wparam],VK_ESCAPE
            jz  .wmdestroy
            ;jnz .zznoescp
         jnz  .4
              mov eax,dword [wparam]
              mov dword [KeyPr],eax
         ret
    .4:
            cmp edx, WM_LBUTTONDOWN
            jnz .02
            mov [mous_btn],1
            ;invoke  MessageBox,0,'ok',0,0
            ret
.02:        cmp edx, WM_LBUTTONUP
            jnz .03
            mov [mous_btn],0
            ret
.03:         cmp edx, WM_RBUTTONDOWN
            jnz .02b
            mov [mous_rbtn],1
            ;invoke  MessageBox,0,'ok',0,0
            ret
.02b:       cmp edx, WM_RBUTTONUP
            jnz .03b
            mov [mous_rbtn],0
            ret
.03b:
;mouse wheel
        cmp edx, WM_MOUSEWHEEL
            jnz .2
            mov ax,word [wparam+2]
            test ax,ax
            jl .WheelDwn
            mov     byte [MousWheel], 1     ;Mous koleso krutili v pered
            ret
      .WheelDwn:
            mov     byte [MousWheel], 2     ;Mous koleso krutili nazad
            ret
  .2:
        cmp     edx,WM_DESTROY
        je      .wmdestroy
  .defwndproc:
        invoke  DefWindowProc,[hwnd],[wmsg],[wparam],[lparam]
        jmp     .finish
  .wmdestroy:
        ;invoke  PostQuitMessage,dword 0    ;bugi i net exit Msg-a !
        mov     [CloseWin],1
        xor     eax,eax
  .finish:
        ret
         mous_btn       db 0
         mous_rbtn      db 0
         FocusWinLost   db 0
         KeyPr          dd 0
         ps             dq 0,0,0,0
         CloseWin       db 0
         MousWheel      db 0
endp


section '.bss' readable writeable
        Status22            rb 10000


section '.idata' import data readable writeable executable

  library msvcrt,'MSVCRT.DLL',\
          kernel32,'KERNEL32.DLL',\
          user32,'USER32.DLL',\
          gdi32,'GDI32.DLL',\
          comctl32,'COMCTL32.DLL',\
          D2gui,    'D2GUI.DLL',\
          MFPlay,   'MFPlay.DLL',\
          lexer,    'Lexilla.dll',\
          Scintilla, 'Scintilla64.dll',\
          winmm,    'WINMM.DLL'

 import Scintilla,\
        GetStringTypeW,'GetStringTypeW',\
        Scintilla_DirectFunction,'Scintilla_DirectFunction'

 import lexer,\
        LexerNameFromID,        'LexerNameFromID',\
        GetLexerFactory,        'GetLexerFactory',\
        GetLibraryPropertyNames,'GetLibraryPropertyNames',\
        SetLibraryProperty,     'SetLibraryProperty',\
        GetNameSpace,           'GetNameSpace',\
        GetLexerCount,          'GetLexerCount',\
        GetLexerName,           'GetLexerName',\
        CreateLexer,            'CreateLexer'

  include 'c:\fasmAPI\msvcrt.inc'
  include 'c:\fasmAPI\kernel32.inc'
  include 'c:\fasmAPI\gdi32.inc'
  include 'c:\fasmAPI\user32.inc'
  include 'c:\fasmAPI\comctl32.inc'
  include 'C:\FasmAPI\winmm.inc'

    
Post 17 Jul 2022, 17:42
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1246
Roman
QFunctionPointer fn = QLibrary::resolve("lexilla", "CreateLexer");
void *lexCpp = ((CreateLexerFn)fn)("cpp");
Call(SCI_SETILEXER, 0, (sptr_t)(void *)lexCpp);

https://www.scintilla.org/LexillaDoc.html
Post 17 Jul 2022, 18:17
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 3480
Location: vpcmipstrm
bitRAKE
https://github.com/8l/x64lab
... uses an old version of Scintilla64.dll

Might be useful to review working x64 example.

Maybe start here:
https://github.com/8l/x64lab/blob/master/develop/ide/sciwrap.asm

Hopcode was on the board, but (s)he had health problems and no information for 8+ years. HERE is the last postings on this board regarding x64lab. I like to imagine (s)he is coding still - wherever (s)he may be.

_________________
¯\(°_o)/¯ unlicense.org
Post 18 Jul 2022, 16:03
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1246
Roman
On GitHub in example not found apiw.sms.
Many jmp apiw.sms and call apiw.sms

But proc or label apiw.sms not found in sources.
Post 20 Jul 2022, 04:01
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 3480
Location: vpcmipstrm
bitRAKE
Yeah, he has a strange wrapper thing for all the API functions. Not too difficult to understand though.

api.sms is at /develop/shared/api.asm, Line 1057 Smile

I prefer to just see: SendMessageW

Hopcode also has videos on Youtube, if you would like to get a feel for the interface/workflow.
Post 20 Jul 2022, 12:35
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1246
Roman
Thanks.
I try find api.sms
But its
api:
.sms:
Post 20 Jul 2022, 13:44
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.