Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1.  
  2. ; Macroinstruction for making export section
  3.  
  4. macro export dllname,[label,string]
  5.  { common
  6.     local module,addresses,names,ordinal,count
  7.     count = 0
  8.    forward
  9.     count = count+1
  10.    common
  11.     dd 0,0,0,RVA module,1
  12.     dd count,count,RVA addresses,RVA names,RVA ordinal
  13.     addresses:
  14.    forward
  15.     dd RVA label
  16.    common
  17.     names:
  18.    forward
  19.     local name
  20.     dd RVA name
  21.    common
  22.     ordinal: count = 0
  23.    forward
  24.     dw count
  25.     count = count+1
  26.    common
  27.     module db dllname,0
  28.    forward
  29.     name db string,0
  30.    common
  31.     local x,y,z,str1,str2,v1,v2
  32.     x = count shr 1
  33.     while x > 0
  34.      y = x
  35.      while y < count
  36.       z = y
  37.       while z-x >= 0
  38.        load v1 dword from names+z*4
  39.        str1=($-RVA $)+v1
  40.        load v2 dword from names+(z-x)*4
  41.        str2=($-RVA $)+v2
  42.        while v1 > 0
  43.         load v1 from str1+%-1
  44.         load v2 from str2+%-1
  45.         if v1 <> v2
  46.          break
  47.         end if
  48.        end while
  49.        if v1<v2
  50.         load v1 dword from names+z*4
  51.         load v2 dword from names+(z-x)*4
  52.         store dword v1 at names+(z-x)*4
  53.         store dword v2 at names+z*4
  54.         load v1 word from ordinal+z*2
  55.         load v2 word from ordinal+(z-x)*2
  56.         store word v1 at ordinal+(z-x)*2
  57.         store word v2 at ordinal+z*2
  58.        else
  59.         break
  60.        end if
  61.        z = z-x
  62.       end while
  63.       y = y+1
  64.      end while
  65.      x = x shr 1
  66.     end while }
  67.