flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Type Library

Author
Thread Post new topic Reply to topic
afw2004



Joined: 16 Jun 2005
Posts: 49
Location: Kharkov, Ukraine
afw2004
How can I include compiled type library (tlb file) in my resource section?

In microsoft resource script it look like this:
Code:
1 TYPELIB "typelib.tlb"
    
Post 24 Jan 2006, 09:22
View user's profile Send private message ICQ Number Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7802
Location: Kraków, Poland
Tomasz Grysztar
Unfortunately standard resource macros support only numbered types, while this "TYPELIB" is a string-named resource type. So you either have to compose the resource section manually, or use some external resource compiler (like Microsoft's one) and use "resource from" to include the .RES file into your program.
Post 24 Jan 2006, 10:17
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7802
Location: Kraków, Poland
Tomasz Grysztar
The hardcoded resource might look like this:
Code:
section '.rsrc' resource data readable

  macro resource type,address
   { dd type,address-resource_root }
  macro subdirectory type,address
   { dd type,80000000h+address-resource_root }

  resource_root:
    dd 0,0,0
    dw 1,2                              ; 1 Name, 3 ID items
    subdirectory 80000000h+(_typelib-resource_root),dir_typelib
    subdirectory RT_ICON,dir_icon
    subdirectory RT_GROUP_ICON,dir_groupicon

  _typelib du 7,'TYPELIB'
  align 4

  dir_typelib:
    dd 0,0,0
    dw 0,1                              ; 1 ID item
    subdirectory 1,typelib_1

  dir_icon:
    dd 0,0,0
    dw 0,1                              ; 1 ID item
    subdirectory 2,icon_2

  dir_groupicon:
    dd 0,0,0
    dw 0,1                              ; 1 ID item
    subdirectory 10,groupicon_10

  typelib_1:
    dd 0,0,0
    dw 0,1                              ; 1 item
    resource 0,resource_1               ; language 0

  icon_2:
    dd 0,0,0
    dw 0,1                              ; 1 item
    resource 0,resource_2               ; language 0

  groupicon_10:
    dd 0,0,0
    dw 0,1                              ; 1 item
    resource 0,resource_10              ; language 0

  resource_1:
    dd rva typelib,typelib_size,0,0

  resource_2:
    dd rva icon_data,icon_size,0,0

  resource_10:
    dd rva icon_header,icon_header_size,0,0

  typelib:
    file 'typelib.tlb'
    typelib_size = $ - typelib
  align 4

  icon_data:
    file 'myapp.ico':16h,744            ; icon data only
    icon_size = $ - icon_data
  align 4

  icon_header:
    file 'myapp.ico',12h                ; icon header only
    dw 1                                ; ID of icon data resource
    icon_header_size = $ - icon_header
  align 4    

it includes also an icon, to show better the overall resource structure.
Post 24 Jan 2006, 10:19
View user's profile Send private message Visit poster's website Reply with quote
afw2004



Joined: 16 Jun 2005
Posts: 49
Location: Kharkov, Ukraine
afw2004
Thanks Smile
Post 24 Jan 2006, 10:28
View user's profile Send private message ICQ Number 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.