flat assembler
Message board for the users of flat assembler.

Index > Windows > DirectWrite

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
Overclick



Joined: 11 Jul 2020
Posts: 587
Location: Ukraine
Overclick 24 Aug 2022, 22:38
Did someone use it by assembly?
I need any help. Begin from Factory creation. I cannot find it's methods sequence on SDK, seems that interfaces defined different way. Could you check it's correct?
Code:
interface               IWriteFactory,\
                        QueryInterface,\
                        AddRef,\
                        Release,\
                        GetSystemFontCollection,\
                        CreateCustomFontCollection,\
                        RegisterFontCollectionLoader,\
                        UnregisterFontCollectionLoader,\
                        CreateFontFileReference,\
                        CreateCustomFontFileReference,\
                        CreateFontFace,\
                        CreateRenderingParams,\
                        CreateMonitorRenderingParams,\
                        CreateCustomRenderingParams,\
                        RegisterFontFileLoader,\
                        UnregisterFontFileLoader,\
                        CreateTextFormat,\
                        CreateTypography,\
                        GetGdiInterop,\
                        CreateTextLayout,\
                        CreateGdiCompatibleTextLayout,\
                        CreateEllipsisTrimmingSign,\
                        CreateTextAnalyzer,\
                        CreateNumberSubstitution,\
                        CreateGlyphRunAnalysis    
Post 24 Aug 2022, 22:38
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 587
Location: Ukraine
Overclick 25 Aug 2022, 00:34
Code:
.data
        interface               IWriteFactory,\
                                QueryInterface,\
                                AddRef,\
                                Release,\
                                GetSystemFontCollection,\
                                CreateCustomFontCollection,\
                                RegisterFontCollectionLoader,\
                                UnregisterFontCollectionLoader,\
                                CreateFontFileReference,\
                                CreateCustomFontFileReference,\
                                CreateFontFace,\
                                CreateRenderingParams,\
                                CreateMonitorRenderingParams,\
                                CreateCustomRenderingParams,\
                                RegisterFontFileLoader,\
                                UnregisterFontFileLoader,\
                                CreateTextFormat,\
                                CreateTypography,\
                                GetGdiInterop,\
                                CreateTextLayout,\
                                CreateGdiCompatibleTextLayout,\
                                CreateEllipsisTrimmingSign,\
                                CreateTextAnalyzer,\
                                CreateNumberSubstitution,\
                                CreateGlyphRunAnalysis
                                        
        interface               IDWriteTextFormat,\
                                QueryInterface,\
                                AddRef,\
                                Release,\
                                SetTextAlignment,\
                                SetParagraphAlignment,\
                                SetWordWrapping,\
                                SetReadingDirection,\
                                SetFlowDirection,\
                                SetIncrementalTabStop,\
                                SetTrimming,\
                                SetLineSpacing,\
                                GetTextAlignment,\
                                GetParagraphAlignment,\
                                GetWordWrapping,\
                                GetReadingDirection,\
                                GetFlowDirection,\
                                GetIncrementalTabStop,\
                                GetTrimming,\
                                GetLineSpacing,\
                                GetFontCollection,\
                                GetFontFamilyNameLength,\
                                GetFontFamilyName,\
                                GetFontWeight,\
                                GetFontStyle,\
                                GetFontStretch,\
                                GetFontSize,\
                                GetLocaleNameLength,\
                                GetLocaleName
        
        IID_IWriteFactory                               GUID b859ee5a-d838-4b5b-a2e8-1adc7d93db48
        
        DWRITE_FACTORY_TYPE_SHARED                      = 0
        
        pIWriteFactory          IWriteFactory
        pIDWriteTextFormat      IDWriteTextFormat
.code
        ..idata library Dwrite,'Dwrite.dll'
        ..idata import Dwrite,DWriteCreateFactory,'DWriteCreateFactory'
        invoke  DWriteCreateFactory,DWRITE_FACTORY_TYPE_SHARED,\
                        IID_IWriteFactory,pIWriteFactory
        ..data  txtFont dw 0x61,0x69,0x72,0x62,0x6d,0x61,0x43,0
        ..data  txtFamily dw 0x53,0x55,0x2d,0x6e,0x65,0
        cominvk pIWriteFactory,CreateTextFormat,txtFont,0,500,0,5,\
                        float 12.0f,txtFamily,pIDWriteTextFormat    


E_INVALIDARG
Wrong Font and Family or what?
Post 25 Aug 2022, 00:34
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1286
Roman 25 Aug 2022, 04:16
txtFamily why 6 dw?
O. Its unicode name.


Last edited by Roman on 25 Aug 2022, 05:52; edited 1 time in total
Post 25 Aug 2022, 04:16
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 3515
Location: vpcmipstrm
bitRAKE 25 Aug 2022, 05:06
Why are your strings reversed?

You programming from a hex editor these days, lol. Rolling Eyes

Everything else looks fine to me.

_________________
¯\(°_o)/¯ unlicense.org
Post 25 Aug 2022, 05:06
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 18960
Location: In your JS exploiting you and your system
revolution 25 Aug 2022, 05:21
You can also use
Code:
du 'Wide chars go here'    
Post 25 Aug 2022, 05:21
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 587
Location: Ukraine
Overclick 25 Aug 2022, 05:58
Still the same error
Code:
        ..data  txtFont du 'Cambria'
        ..data  txtLanguage du 'en-US'
        cominvk pIWriteFactory,CreateTextFormat,txtFont,0,500,0,5,\
                        float 12.0f,txtLanguage,pIDWriteTextFormat    
Post 25 Aug 2022, 05:58
View user's profile Send private message Visit poster's website Reply with quote
Hrstka



Joined: 05 May 2008
Posts: 35
Location: Czech republic
Hrstka 25 Aug 2022, 07:33
You forgot the null character.
Code:
        ..data  txtFont du 'Cambria',0
        ..data  txtLanguage du 'en-us',0    
Post 25 Aug 2022, 07:33
View user's profile Send private message Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 587
Location: Ukraine
Overclick 25 Aug 2022, 08:36
Quote:

You forgot the null character.

I tried almost everything. Seems it is wrong method or something.
Post 25 Aug 2022, 08:36
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1286
Roman 25 Aug 2022, 09:21
64 bits ?
On my Windows 10 work this code.

Code:
ID_IDWriteFactory GUID b859ee5a-d838-4b5b-a2e8-1adc7d93db48
txtFont   du 'Arial',0
hpUn      du "en-us",0

invoke  DWriteCreateFactory,0,ID_IDWriteFactory,DWriteFactory

              DWRITE_FONT_WEIGHT_NORMAL  = 400
              DWRITE_FONT_WEIGHT_REGULAR = 400
              DWRITE_FONT_STRETCH_NORMAL = 5
              DWRITE_FONT_STYLE_NORMAL   = 0
cominvk  DWriteFactory, CreateTextFormat, txtFont, 0, DWRITE_FONT_WEIGHT_REGULAR, DWRITE_FONT_STYLE_NORMAL,\
              DWRITE_FONT_STRETCH_NORMAL,dword 20.0, hpUn, CompsTextFormat2
    
Post 25 Aug 2022, 09:21
View user's profile Send private message Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 587
Location: Ukraine
Overclick 25 Aug 2022, 09:43
I changed 'float' to 'dword' in my example and no more error. Why?
Post 25 Aug 2022, 09:43
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 18960
Location: In your JS exploiting you and your system
revolution 25 Aug 2022, 09:53
Float vs dword
Code:
dd 12.0, 12    
Code:
00 00 40 41, 0c 00 00 00    
Those are not the same values.
Post 25 Aug 2022, 09:53
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 587
Location: Ukraine
Overclick 25 Aug 2022, 10:01
dword 12.0f
vs
float 12.0f
Post 25 Aug 2022, 10:01
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 18960
Location: In your JS exploiting you and your system
revolution 25 Aug 2022, 10:07
Does 64-bit code make float into a double?

You can look at the output to see what changes.
Post 25 Aug 2022, 10:07
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 587
Location: Ukraine
Overclick 25 Aug 2022, 10:21
Quote:

Does 64-bit code make float into a double?

Think so. Have it to be like that?
Post 25 Aug 2022, 10:21
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 18960
Location: In your JS exploiting you and your system
revolution 25 Aug 2022, 11:24
Perhaps in fasm, unlike C, float means a variable sized value to match the container.

So if you need a particular size use dword or qword. Problem solved.
Post 25 Aug 2022, 11:24
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 587
Location: Ukraine
Overclick 25 Aug 2022, 12:39
What is a point to use 'float' then if it's useless?
Why don't Tomasz write 'double' for such reason?
Post 25 Aug 2022, 12:39
View user's profile Send private message Visit poster's website Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 675
Location: Russia
macomics 25 Aug 2022, 12:42
Or maybe it's better to look at the source text of the cominvk macro without these questions
Post 25 Aug 2022, 12:42
View user's profile Send private message Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 587
Location: Ukraine
Overclick 25 Aug 2022, 12:54
Where we get documentation from? Microsoft? It developed for cominvk or what? No it's not. Such macro have to cover the real needs and not define some new rules
Post 25 Aug 2022, 12:54
View user's profile Send private message Visit poster's website Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 675
Location: Russia
macomics 25 Aug 2022, 13:06
Code:
macro cominvk object,proc,[arg]
 { common
    assert defined object#.com.object ; must be a COM object
    macro call dummy
    \{ mov rax,[rcx]
       call [rax+object#.#proc] \}
    fastcall ,[object],arg
    purge call }    


next, fastcall

Code:
macro fastcall proc,[arg]
 { common local stackspace,argscount,counter
...
       if counter = 1
        if type@param eq float
...
       else if counter = 2
        if type@param eq float
...
       else if counter = 3
        if type@param eq float
...
       else if counter = 4
        if type@param eq float
...
    end if }    
Post 25 Aug 2022, 13:06
View user's profile Send private message Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 587
Location: Ukraine
Overclick 25 Aug 2022, 13:09
Big deal to fix it?

float fix dword float
double fix qword float
Post 25 Aug 2022, 13:09
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< 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.