flat assembler
Message board for the users of flat assembler.

Index > Windows > library for windows

Author
Thread Post new topic Reply to topic
CandyMan



Joined: 04 Sep 2009
Posts: 414
Location: film "CandyMan" directed through Bernard Rose OR Candy Shop
CandyMan 31 Jan 2015, 18:46
whether somebody could show me how to create the library from scratch for windows in particular section export.
thanks!

_________________
smaller is better
Post 31 Jan 2015, 18:46
View user's profile Send private message Reply with quote
RIxRIpt



Joined: 18 Apr 2013
Posts: 50
RIxRIpt 31 Jan 2015, 20:15
I'm not sure about static library, but you can find dynamic-link library example in FASM\EXAMPLES\DLL
Post 31 Jan 2015, 20:15
View user's profile Send private message Visit poster's website Reply with quote
CandyMan



Joined: 04 Sep 2009
Posts: 414
Location: film "CandyMan" directed through Bernard Rose OR Candy Shop
CandyMan 31 Jan 2015, 20:48
this way a import section looks.
Code:
; *** Import table just follows code & data ***
dd 0,0,0,KernelName-CCBase,KernelTable-CCBase
dd 0,0,0,User32Name-CCBase,User32Table-CCBase
dd 0,0,0,0,0

KernelTable:
ExitProcess     dq _ExitProcess-CCBase
dq 0
KernelName      db 'KERNEL32.DLL'
_ExitProcess:   db 0,0,'ExitProcess',0

User32Table:
MessageBox      dq _MessageBox-CCBase
dq 0
User32Name      db 'USER32.DLL'
_MessageBox:    db 0,0,'MessageBoxA',0
    

how the export section looks like?

_________________
smaller is better
Post 31 Jan 2015, 20:48
View user's profile Send private message Reply with quote
tthsqe



Joined: 20 May 2009
Posts: 767
tthsqe 31 Jan 2015, 23:06
candyman, here is what the imports/exports looks like from one of my libraries. W8 seems to need reloc section to be readable and any windows seems to not like empty reloc section.
Code:
section '.idata' import data readable writeable

  library kernel32,'KERNEL32.DLL',\
          user32,'USER32.DLL',\
          gdi32,'GDI32.DLL',\
          gmp,'GMP.DLL'

include 'api\kernel32.inc'
include 'api\user32.inc'
include 'api\gdi32.inc'

  import gmp,\
           mpf_abs,'__gmpf_abs',\
           mpf_add,'__gmpf_add',\
           mpf_add_ui,'__gmpf_add_ui',\
           mpf_clear,'__gmpf_clear',\
           mpf_cmp,'__gmpf_cmp',\
           mpf_div,'__gmpf_div',\
           mpf_div_2exp,'__gmpf_div_2exp',\
           mpf_div_ui,'__gmpf_div_ui',\
           mpf_init2,'__gmpf_init2',\
           mpf_mul,'__gmpf_mul',\
           mpf_mul_2exp,'__gmpf_mul_2exp',\
           mpf_mul_ui,'__gmpf_mul_ui',\
           mpf_neg,'__gmpf_neg',\
           mpf_pow_ui,'__gmpf_pow_ui',\
           mpf_set,'__gmpf_set',\
           mpf_set_str,'__gmpf_set_str',\
           mpf_set_ui,'__gmpf_set_ui',\
           mpf_set_si,'__gmpf_set_si',\
           mpf_set_z,'__gmpf_set_z',\
           mpf_sqrt,'__gmpf_sqrt',\
           mpf_sqrt_ui,'__gmpf_sqrt_ui',\
           mpf_sub,'__gmpf_sub',\
           mpf_sub_ui,'__gmpf_sub_ui',\
           mpf_ui_div,'__gmpf_ui_div',\
           mpf_ui_sub,'__gmpf_ui_sub',\
           mpz_abs,'__gmpz_abs',\
           mpz_add,'__gmpz_add',\
           mpz_addmul,'__gmpz_addmul',\
           mpz_addmul_ui,'__gmpz_addmul_ui',\
           mpz_add_ui,'__gmpz_add_ui',\
           mpz_and,'__gmpz_and',\
           mpz_clear,'__gmpz_clear',\
           mpz_cmp,'__gmpz_cmp',\
           mpz_com,'__gmpz_com',\
           mpz_divexact,'__gmpz_divexact',\
           mpz_divisible_p,'__gmpz_divisible_p',\
           mpz_fac_ui,'__gmpz_fac_ui',\
           mpz_fdiv_qr,'__gmpz_fdiv_qr',\
           mpz_fdiv_q,'__gmpz_fdiv_q',\
           mpz_fdiv_r,'__gmpz_fdiv_r',\
           mpz_fib_ui,'__gmpz_fib_ui',\
           mpz_gcd,'__gmpz_gcd',\
           mpz_init,'__gmpz_init',\
           mpz_init2,'__gmpz_init2',\
           mpz_init_set,'__gmpz_init_set',\
           mpz_init_set_str,'__gmpz_init_set_str',\
           mpz_init_set_ui,'__gmpz_init_set_ui',\
           mpz_ior,'__gmpz_ior',\
           mpz_lcm,'__gmpz_lcm',\
           mpz_mul,'__gmpz_mul',\
           mpz_mul_2exp,'__gmpz_mul_2exp',\
           mpz_mul_ui,'__gmpz_mul_ui',\
           mpz_neg,'__gmpz_neg',\
           mpz_perfect_square_p,'__gmpz_perfect_square_p',\
           mpz_pow_ui,'__gmpz_pow_ui',\
           mpz_set,'__gmpz_set',\
           mpz_set_ui,'__gmpz_set_ui',\
           mpz_sqrt,'__gmpz_sqrt',\
           mpz_sub,'__gmpz_sub',\
           mpz_tdiv_q_2exp,'__gmpz_tdiv_q_2exp',\
           mpz_ui_pow_ui,'__gmpz_ui_pow_ui',\
           mpz_xor,'__gmpz_xor',\
           gmp_sprintf,'__gmp_sprintf',\
           gmp_version,'__gmp_version'

section '.edata' export data readable

  export 'MathEngine.dll',\
        meClearEvalStack,'meClearEvalStack',\
        meCreateState,'meCreateState',\
        meDeleteState,'meDeleteState',\
        meLoadLibraryFunctions,'meLoadLibraryFunctions',\
        mePrintFloat,'mePrintFloat',\
        mePrintFunctionsString,'mePrintFunctionsString',\
        meProcessString,'meProcessString',\
        \
           Convert_M_INT_to_M_FP,'meConvert_M_INT_to_M_FP',\
           EvalError_Fxn,'meEvalError_Fxn',\
           Get_M_INT_abs_and_sign,'meGet_M_INT_abs_and_sign',\
           SinCos_B_REAL,'meSinCos_B_REAL',\
           SinCos_ui,'meSinCos_ui',\
           Store_B_REAL,'meStore_B_REAL',\
           Store_M_FP,'meStore_M_FP',\
           Convert_to_M_FP,'meConvert_to_M_FP'


section '.reloc' data readable discardable

data fixups 
        if ~ $-$$ 
                dd      0,8 ;empty fixups section iff no other fixups 
        end if 
end data
    
Post 31 Jan 2015, 23:06
View user's profile Send private message Reply with quote
badc0de02



Joined: 25 Nov 2013
Posts: 215
Location: %x
badc0de02 31 Jan 2015, 23:10
File: ERRORMSG.DLL
Function: ShowErrorMessage,ShowLastError

rest will you find in the export macro

Code:
format pe gui 4.0 dll
include 'win32a.inc'
section '.edata' export data readable

  export 'ERRORMSG.DLL',\
         ShowErrorMessage,'ShowErrorMessage',\
         ShowLastError,'ShowLastError'       
Post 31 Jan 2015, 23:10
View user's profile Send private message Reply with quote
CandyMan



Joined: 04 Sep 2009
Posts: 414
Location: film "CandyMan" directed through Bernard Rose OR Candy Shop
CandyMan 01 Feb 2015, 12:45
I meant something like that, but the thanks guys.
Code:
struct  tExportDirectory
  Characteristics               dd ?
  TimeDateStamp                 dd ?
  MajorVersion                  dw ?
  MinorVersion                  dw ?
  Name                          dd ?
  Base                          dd ?
  NumberOfFunctions             dd ?
  NumberOfNames                 dd ?
  AddressOfFunctions            dd ?
  AddressOfNames                dd ?
  AddressOfNameOrdinals         dd ?
ends    

_________________
smaller is better
Post 01 Feb 2015, 12:45
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.