added fasm2 as well

This commit is contained in:
Edward R. Gonzalez 2024-11-25 00:04:53 -05:00
parent 8a974e9c89
commit dceb330571
165 changed files with 78512 additions and 0 deletions

View File

@ -0,0 +1,47 @@
; Global strings demonstration for Linux.
format ELF64 executable 3
entry start
include 'globstr.inc'
include 'macro/inline.inc'
inlinemacro GLOB(value&)
local data
data GLOBSTR value,0
return equ data
end inlinemacro
segment readable executable
start:
lea rsi,[GLOB("Hello, it's ")]
call display_string
mov rsi,[rsp+8] ; argv
call display_string
lea rsi,[GLOB(' speaking.',10)]
call display_string
xor edi,edi ; exit code 0
mov eax,60 ; sys_exit
syscall
display_string: ; rsi = address of ASCIIZ string
xor al,al
mov rdi,rsi
or rcx,-1
repne scasb
neg rcx
sub rcx,2
mov edi,1
mov eax,1 ; sys_write
mov rdx,rcx
syscall
retn
segment readable
GLOBSTR.here

View File

@ -0,0 +1,44 @@
; Global strings demonstration for Windows.
include 'win64ax.inc'
include 'globstr.inc'
GLOBSTR.reuse := 1
.data
GLOBSTR.here
.code
start:
; Inline macro allows to put string data in any expression
; (getting the address in return):
inlinemacro GLOB(value)
local data
data GLOBSTR value,0
return equ data
end inlinemacro
lea rdx,[GLOB('Hello!')]
invoke MessageBox, HWND_DESKTOP, rdx, GLOB('Example'), MB_OK
; Alternatively, replacing the "fastcall?.inline_string" macro changes
; how the string arguments to "fastcall" and "invoke" are handled:
macro fastcall?.inline_string var
local data
data GLOBSTR var,0
redefine var data
end macro
; For 32-bit case it would be the "stdcall?.push_string" macro,
; provided here for completness:
macro stdcall?.push_string value&
local data
data GLOBSTR value,0
push data
end macro
invoke MessageBox, HWND_DESKTOP, 'And bye!', 'Example', MB_OK
invoke ExitProcess,0
.end start

View File

@ -0,0 +1,82 @@
define GLOBSTR GLOBSTR
virtual at GLOBSTR.baseaddr
GLOBSTR.buffer::
end virtual
postpone
virtual GLOBSTR.buffer
load GLOBSTR.data:$-$$ from $$
end virtual
if ~ defined GLOBSTR.where
display 'Global string data has been placed automatically at the end of the executable.',13,10
display 'To place it elsewhere, use "GLOBSTR.here" macro in the intended location.',13,10
GLOBSTR.baseaddr db GLOBSTR.data
end if
end postpone
macro GLOBSTR.here
GLOBSTR.baseaddr db GLOBSTR.data
GLOBSTR.where := GLOBSTR.baseaddr
end macro
if defined GLOBSTR.reuse & GLOBSTR.reuse
virtual at 0
GLOBSTR.chr_skips:: dd 256 dup ?
end virtual
struc GLOBSTR data&
local buffer,size,a,b,c,p,skip,found
virtual at 0
buffer:: db data
size := $
end virtual
repeat 256
store size:dword at GLOBSTR.chr_skips:(%-1)*4
end repeat
repeat size-1
load a:byte from buffer:%-1
store size-%:dword at GLOBSTR.chr_skips:a*4
end repeat
virtual GLOBSTR.buffer
found = -1
p = 0
while p + size <= $-$$
c = size
while c > 0
load a:byte from $$+p+c-1
load b:byte from buffer:c-1
if a <> b
c = -1
break
end if
c = c - 1
end while
if c = 0
found = p
break
else
load a:byte from $$+p+size-1
load skip:dword from GLOBSTR.chr_skips:a*4
p = p + skip
end if
end while
if found >= 0
label . at $$+found
else
. db data
end if
end virtual
end struc
else
struc GLOBSTR data&
virtual GLOBSTR.buffer
. db data
end virtual
end struc
end if

View File

@ -0,0 +1,340 @@
; TetrOS version 1.05
; Requires VGA and 80386 CPU or higher.
; Can be run under DOSBox with the BOOT command.
; Version 1.01 was submitted in 2004 for a 512-byte OS contest
; (https://web.archive.org/web/20040930044834/http://512.decard.net/)
; For your playing pleasure, it's a boot-sector Tetris game.
; Keys:
; Left - move left
; Right - move right
; Up - rotate
; Down - drop
; Esc - new game at any time
format binary as 'img'
org 7C00h
use i386
ROWS = 23
COLUMNS = 12
BACKGROUND = 0 ; background color, 0 for randomized
virtual at 46Ch
clock dw ?
end virtual
virtual at bp
current dw ?
current_column db ?
current_row dw ?
filler db ?
next dw ?
score dw ?
last_tick dw ?
random dw ?
pics_wrt_bp:
end virtual
label well at 8000h
label pics at well-2*64
label origin at pics-(pics_wrt_bp-bp)
assert origin and 1 = 0
ORIGIN_PARITY = origin and 0FFh
while ORIGIN_PARITY and not 1
ORIGIN_PARITY = (ORIGIN_PARITY shr 1) xor (ORIGIN_PARITY and 1)
end while
include 'listing.inc'
xor ax,ax
mov ss,ax
mov sp,origin
mov ds,ax
mov es,ax
push ax
push start
retf
start:
mov al,13h
int 10h
restart:
mov bp,sp
xor ax,ax
cld
lea di,[next]
stosw ; [next]
stosw ; [score]
mov ax,[clock]
stosw ; [last_tick]
stosw ; [random]
mov cx,64
if BACKGROUND
mov ax,0F00h + BACKGROUND
else
mov ah,15
end if
rep stosb
mov dx,7
@@:
mov al,15
stosb
mov al,ah
mov cl,6
rep stosb
mov ax,0708h
stosb
dec dx
jnz @b
mov cl,8
rep stosb
or ax,-1
stosw
stosw
stosw
mov cl,ROWS+4
mov ax,not ( (1 shl COLUMNS - 1) shl ((16-COLUMNS)/2) )
rep stosw
new_piece:
mov bx,[random]
mov ax,257
mul bx
inc ax
mov cx,43243
div cx
mov [random],dx
and bx,7
jz new_piece
shl bx,1
mov ax,[pieces+bx-2]
xchg ax,[next]
or ax,ax
jz new_piece
lea di,[current]
stosw ; [current]
mov al,6
stosb ; [current_column]
mov ax,well+(3+ROWS-4)*2
stosw ; [current_row]
mov si,no_move
call first_move
jz update_screen
inc bp ; game over
process_key:
xor ah,ah
int 16h
mov al,ah
dec ah
jz restart
test bp,bp
if ORIGIN_PARITY
jp process_key
else
jnp process_key
end if
mov si,rotate
cmp al,48h
je action
mov si,left
cmp al,4Bh
je action
mov si,right
cmp al,4Dh
je action
cmp al,50h
jne main_loop
drop_down:
call do_move_down
jz drop_down
action:
call do_move
update_screen:
mov bx,15
mov dx,12h
mov ah,2
int 10h
mov cl,84h
print_score:
mov ax,[score]
rol ax,cl
and al,0Fh
cmp al,10
sbb al,69h
das
mov ah,0Eh
int 10h
add cl,84h
jns print_score
xor bl,15 xor 7
jnp print_score
push es
push 0A000h
pop es
mov si,well+3*2
mov di,320*184+160-(COLUMNS*8)/2
draw_well:
lodsw
push si
mov dl,COLUMNS
xchg bx,ax
shr bx,(16-COLUMNS)/2
call draw_row
pop si
cmp si,well+(3+ROWS)*2
jb draw_well
mov di,320*100+250
mov bx,[next]
draw_preview:
mov dl,4
call draw_row
cmp di,320*68
ja draw_preview
pop es
main_loop:
mov ah,1
int 16h
jnz process_key
mov al,-1
xor al,byte [score+1]
and al,11b
mov cx,[clock]
sub cx,[last_tick]
cmp cl,al
jbe main_loop
add [last_tick],cx
call do_move_down
jz update_screen
movzx dx,byte [current_row]
shr dx,2
mov si,well+3*2
mov di,si
check_row:
lodsw
inc ax
jz remove_row
dec ax
stosw
jmp check_next_row
remove_row:
shl dx,1
check_next_row:
cmp di,well+(3+ROWS)*2
jb check_row
add [score],dx
jmp new_piece
draw_row:
push di
blit_row:
shr bx,1
mov si,pics
jnc blit_block
add si,64
blit_block:
mov cx,8
rep movsb
add di,320-8
test si,111111b
jnz blit_block
sub di,320*8-8
dec dx
jnz blit_row
pop di
sub di,320*8
ret
do_move_down:
mov si,down
do_move:
mov al,1
call on_piece
first_move:
push dword [current]
call si
xor ax,ax
call on_piece
inc ax
pop edx
test ah,ah
jz @f
mov dword [current],edx
@@:
jmp on_piece
down:
sub byte [current_row],2
ret
left:
dec [current_column]
ret
right:
inc [current_column]
no_move:
ret
rotate:
mov cx,3
@@:
bt [current],cx
rcl dx,1
add cl,4
cmp cl,16
jb @b
sub cl,17
jnc @b
mov [current],dx
ret
on_piece:
pushf
mov di,[current_row]
mov bx,4
on_piece_row:
mov dx,[current]
mov cl,bh
shr dx,cl
and dx,1111b
mov cl,[current_column]
add cl,4
shl edx,cl
shr edx,4
test al,al
jz @f
xor [di],dx
@@:
test [di],dx
jz @f
inc ah
@@:
add bh,4
scasw
dec bl
jnz on_piece_row
popf
ret
rb 510 - ($% + signature - pieces)
pieces dw 0010001000100010b
dw 0010011000100000b
dw 0010001001100000b
dw 0100010001100000b
dw 0000011001100000b
dw 0100011000100000b
dw 0010011001000000b
signature dw 0AA55h

3
toolchain/fasm2/fasm2 Normal file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
DIR="$( dirname -- "$( readlink -f -- "$0"; )"; )"
INCLUDE="$DIR/include;$INCLUDE" "$DIR/fasmg.x64" -iInclude\ \'fasm2.inc\' "$@"

View File

@ -0,0 +1,5 @@
@echo off
setlocal
set include=%~dp0include;%include%
"%~dp0fasmg" -iInclude('fasm2.inc') %*
endlocal

BIN
toolchain/fasm2/fasmg.exe Normal file

Binary file not shown.

BIN
toolchain/fasm2/fasmg.x64 Normal file

Binary file not shown.

BIN
toolchain/fasm2/fasmgw.exe Normal file

Binary file not shown.

View File

@ -0,0 +1,40 @@
[Environment]
Include=C:\projects\asm_dip\toolchain\fasm2\include
[Compiler]
SourceHeader=include 'fasm2.inc'
MaxPasses=100
MaxRecursion=10000
Priority=0
[Options]
SecureSelection=0
AutoBrackets=0
AutoIndent=1
SmartTabs=1
OptimalFill=0
ReviveDeadKeys=0
ConsoleCaret=1
TimeScroll=0
[Colors]
Text=0,0,0
Background=255,255,255
SelectionText=255,255,255
SelectionBackground=0,120,215
Symbols=48,48,240
Numbers=0,144,0
Strings=176,0,0
Comments=128,128,128
[Font]
Face=Courier New
Height=16
Width=0
Weight=0
Italic=0
CharSet=1
[Window]
Top=64
Left=64
Right=564
Bottom=564
Maximized=0
[Help]
Path=

View File

@ -0,0 +1,40 @@
; Extended implementation of anonymous labels.
; Classic use like:
; @@: ; A
; je @f ; -> B
; loop @b ; -> A
; @@: ; B
; Additional sets of labels are available for more flexibility:
; @1: ; A
; je @1f ; -> C
; jg @2f ; -> B
; loop @1b ; -> A
; @2: ; B
; loop @2b ; -> B
; @1: ; C
macro @INIT name,prefix
macro name tail&
match label, prefix#f?
label tail
prefix#b? equ prefix#f?
prefix#r? equ prefix#f?
end match
local anonymous
prefix#f? equ anonymous
end macro
define prefix#f?
name
end macro
@INIT @@,@
repeat 10, i:0
@INIT @#i,@#i
end repeat

View File

@ -0,0 +1,97 @@
; Universal implementation of ALIGN.
; Basic use:
; align 4
; Ensure specific offset relative to an aligned address:
; align 4 | 1
; Provide information for the alignment of relocatable symbols:
; align.assume rbp, 16
; element RELOCATABLE_BASE
; org RELOCATABLE_BASE
; align.assume RELOCATABLE_BASE, 10000h
; Pad with value:
; align 16, 90h
; Use a custom command to pad:
; align 16, db # dup ($ and 0FFh)
define align? align
align?.count = 0
calminstruction align?.assume? address*, alignment*
local index, symbol
compute address, address
compute alignment, alignment
check address relativeto 0
jyes absolute
compute index, 0
find:
check index = align.count
jyes update
arrange symbol, align.=address#index
check address relativeto symbol
jyes update
compute index, index + 1
jump find
update:
arrange symbol, align.=address#index
publish symbol, address
arrange symbol, align.=alignment#index
publish symbol, alignment
compute align.count, align.count + 1
exit
absolute:
check address mod alignment = 0
jyes ok
err 'false assumption about absolute address'
ok:
end calminstruction
calminstruction align? alignment*, filler:rb #
local index, address, offset, symbol
compute offset, 0
match alignment | offset, alignment
compute alignment, alignment
check alignment >= 0
jyes alignment_ok
err 'invalid alignment value'
exit
alignment_ok:
compute address, $
check address relativeto 0
jyes align
compute index, 0
find:
check index = align.count
jyes fail
arrange symbol, align.=address#index
check address relativeto symbol
jyes found
compute index, index + 1
jump find
found:
compute address, address - symbol
arrange symbol, align.=alignment#index
check symbol > 0 & symbol mod alignment = 0
jyes align
fail:
err 'variable portion of the address is not aligned enough'
exit
align:
compute alignment, (alignment-1) - (address-offset+alignment-1) mod alignment
local prefix, suffix
match prefix? # suffix?, filler
jyes custom
arrange alignment, =db alignment =dup (filler)
assemble alignment
exit
custom:
arrange alignment, prefix alignment suffix
assemble alignment
end calminstruction

View File

@ -0,0 +1,535 @@
; ADVAPI32 API calls
import advapi32,\
AbortSystemShutdownA,'AbortSystemShutdownA',\
AbortSystemShutdownW,'AbortSystemShutdownW',\
AccessCheck,'AccessCheck',\
AccessCheckAndAuditAlarmA,'AccessCheckAndAuditAlarmA',\
AccessCheckAndAuditAlarmW,'AccessCheckAndAuditAlarmW',\
AccessCheckByType,'AccessCheckByType',\
AccessCheckByTypeAndAuditAlarmA,'AccessCheckByTypeAndAuditAlarmA',\
AccessCheckByTypeAndAuditAlarmW,'AccessCheckByTypeAndAuditAlarmW',\
AccessCheckByTypeResultList,'AccessCheckByTypeResultList',\
AccessCheckByTypeResultListAndAuditAlarmA,'AccessCheckByTypeResultListAndAuditAlarmA',\
AccessCheckByTypeResultListAndAuditAlarmW,'AccessCheckByTypeResultListAndAuditAlarmW',\
AddAccessAllowedAce,'AddAccessAllowedAce',\
AddAccessAllowedAceEx,'AddAccessAllowedAceEx',\
AddAccessAllowedObjectAce,'AddAccessAllowedObjectAce',\
AddAccessDeniedAce,'AddAccessDeniedAce',\
AddAccessDeniedAceEx,'AddAccessDeniedAceEx',\
AddAccessDeniedObjectAce,'AddAccessDeniedObjectAce',\
AddAce,'AddAce',\
AddAuditAccessAce,'AddAuditAccessAce',\
AddAuditAccessAceEx,'AddAuditAccessAceEx',\
AddAuditAccessObjectAce,'AddAuditAccessObjectAce',\
AdjustTokenGroups,'AdjustTokenGroups',\
AdjustTokenPrivileges,'AdjustTokenPrivileges',\
AllocateAndInitializeSid,'AllocateAndInitializeSid',\
AllocateLocallyUniqueId,'AllocateLocallyUniqueId',\
AreAllAccessesGranted,'AreAllAccessesGranted',\
AreAnyAccessesGranted,'AreAnyAccessesGranted',\
BackupEventLogA,'BackupEventLogA',\
BackupEventLogW,'BackupEventLogW',\
BuildExplicitAccessWithNameA,'BuildExplicitAccessWithNameA',\
BuildExplicitAccessWithNameW,'BuildExplicitAccessWithNameW',\
BuildImpersonateExplicitAccessWithNameA,'BuildImpersonateExplicitAccessWithNameA',\
BuildImpersonateExplicitAccessWithNameW,'BuildImpersonateExplicitAccessWithNameW',\
BuildImpersonateTrusteeA,'BuildImpersonateTrusteeA',\
BuildImpersonateTrusteeW,'BuildImpersonateTrusteeW',\
BuildSecurityDescriptorA,'BuildSecurityDescriptorA',\
BuildSecurityDescriptorW,'BuildSecurityDescriptorW',\
BuildTrusteeWithNameA,'BuildTrusteeWithNameA',\
BuildTrusteeWithNameW,'BuildTrusteeWithNameW',\
BuildTrusteeWithSidA,'BuildTrusteeWithSidA',\
BuildTrusteeWithSidW,'BuildTrusteeWithSidW',\
CancelOverlappedAccess,'CancelOverlappedAccess',\
ChangeServiceConfig2A,'ChangeServiceConfig2A',\
ChangeServiceConfig2W,'ChangeServiceConfig2W',\
ChangeServiceConfigA,'ChangeServiceConfigA',\
ChangeServiceConfigW,'ChangeServiceConfigW',\
ClearEventLogA,'ClearEventLogA',\
ClearEventLogW,'ClearEventLogW',\
CloseEventLog,'CloseEventLog',\
CloseRaw,'CloseRaw',\
CloseServiceHandle,'CloseServiceHandle',\
ControlService,'ControlService',\
ConvertAccessToSecurityDescriptorA,'ConvertAccessToSecurityDescriptorA',\
ConvertAccessToSecurityDescriptorW,'ConvertAccessToSecurityDescriptorW',\
ConvertSecurityDescriptorToAccessA,'ConvertSecurityDescriptorToAccessA',\
ConvertSecurityDescriptorToAccessW,'ConvertSecurityDescriptorToAccessW',\
ConvertSecurityDescriptorToAccessNamedA,'ConvertSecurityDescriptorToAccessNamedA',\
ConvertSecurityDescriptorToAccessNamedW,'ConvertSecurityDescriptorToAccessNamedW',\
ConvertToAutoInheritPrivateObjectSecurity,'ConvertToAutoInheritPrivateObjectSecurity',\
CopySid,'CopySid',\
CreatePrivateObjectSecurity,'CreatePrivateObjectSecurity',\
CreatePrivateObjectSecurityEx,'CreatePrivateObjectSecurityEx',\
CreateProcessAsUserA,'CreateProcessAsUserA',\
CreateProcessAsUserW,'CreateProcessAsUserW',\
CreateRestrictedToken,'CreateRestrictedToken',\
CreateServiceA,'CreateServiceA',\
CreateServiceW,'CreateServiceW',\
CryptAcquireContextA,'CryptAcquireContextA',\
CryptAcquireContextW,'CryptAcquireContextW',\
CryptContextAddRef,'CryptContextAddRef',\
CryptCreateHash,'CryptCreateHash',\
CryptDecrypt,'CryptDecrypt',\
CryptDeriveKey,'CryptDeriveKey',\
CryptDestroyHash,'CryptDestroyHash',\
CryptDestroyKey,'CryptDestroyKey',\
CryptDuplicateHash,'CryptDuplicateHash',\
CryptDuplicateKey,'CryptDuplicateKey',\
CryptEncrypt,'CryptEncrypt',\
CryptEnumProviderTypesA,'CryptEnumProviderTypesA',\
CryptEnumProviderTypesW,'CryptEnumProviderTypesW',\
CryptEnumProvidersA,'CryptEnumProvidersA',\
CryptEnumProvidersW,'CryptEnumProvidersW',\
CryptExportKey,'CryptExportKey',\
CryptGenKey,'CryptGenKey',\
CryptGenRandom,'CryptGenRandom',\
CryptGetDefaultProviderA,'CryptGetDefaultProviderA',\
CryptGetDefaultProviderW,'CryptGetDefaultProviderW',\
CryptGetHashParam,'CryptGetHashParam',\
CryptGetKeyParam,'CryptGetKeyParam',\
CryptGetProvParam,'CryptGetProvParam',\
CryptGetUserKey,'CryptGetUserKey',\
CryptHashData,'CryptHashData',\
CryptHashSessionKey,'CryptHashSessionKey',\
CryptImportKey,'CryptImportKey',\
CryptReleaseContext,'CryptReleaseContext',\
CryptSetHashParam,'CryptSetHashParam',\
CryptSetKeyParam,'CryptSetKeyParam',\
CryptSetProvParam,'CryptSetProvParam',\
CryptSetProviderA,'CryptSetProviderA',\
CryptSetProviderW,'CryptSetProviderW',\
CryptSetProviderExA,'CryptSetProviderExA',\
CryptSetProviderExW,'CryptSetProviderExW',\
CryptSignHashA,'CryptSignHashA',\
CryptSignHashW,'CryptSignHashW',\
CryptVerifySignatureA,'CryptVerifySignatureA',\
CryptVerifySignatureW,'CryptVerifySignatureW',\
DecryptFileA,'DecryptFileA',\
DecryptFileW,'DecryptFileW',\
DeleteAce,'DeleteAce',\
DeleteService,'DeleteService',\
DeregisterEventSource,'DeregisterEventSource',\
DestroyPrivateObjectSecurity,'DestroyPrivateObjectSecurity',\
DuplicateToken,'DuplicateToken',\
DuplicateTokenEx,'DuplicateTokenEx',\
ElfBackupEventLogFileA,'ElfBackupEventLogFileA',\
ElfBackupEventLogFileW,'ElfBackupEventLogFileW',\
ElfChangeNotify,'ElfChangeNotify',\
ElfClearEventLogFileA,'ElfClearEventLogFileA',\
ElfClearEventLogFileW,'ElfClearEventLogFileW',\
ElfCloseEventLog,'ElfCloseEventLog',\
ElfDeregisterEventSource,'ElfDeregisterEventSource',\
ElfNumberOfRecords,'ElfNumberOfRecords',\
ElfOldestRecord,'ElfOldestRecord',\
ElfOpenBackupEventLogA,'ElfOpenBackupEventLogA',\
ElfOpenBackupEventLogW,'ElfOpenBackupEventLogW',\
ElfOpenEventLogA,'ElfOpenEventLogA',\
ElfOpenEventLogW,'ElfOpenEventLogW',\
ElfReadEventLogA,'ElfReadEventLogA',\
ElfReadEventLogW,'ElfReadEventLogW',\
ElfRegisterEventSourceA,'ElfRegisterEventSourceA',\
ElfRegisterEventSourceW,'ElfRegisterEventSourceW',\
ElfReportEventA,'ElfReportEventA',\
ElfReportEventW,'ElfReportEventW',\
EncryptFileA,'EncryptFileA',\
EncryptFileW,'EncryptFileW',\
EnumDependentServicesA,'EnumDependentServicesA',\
EnumDependentServicesW,'EnumDependentServicesW',\
EnumServicesStatusA,'EnumServicesStatusA',\
EnumServicesStatusW,'EnumServicesStatusW',\
EqualPrefixSid,'EqualPrefixSid',\
EqualSid,'EqualSid',\
FindFirstFreeAce,'FindFirstFreeAce',\
FreeSid,'FreeSid',\
GetAccessPermissionsForObjectA,'GetAccessPermissionsForObjectA',\
GetAccessPermissionsForObjectW,'GetAccessPermissionsForObjectW',\
GetAce,'GetAce',\
GetAclInformation,'GetAclInformation',\
GetAuditedPermissionsFromAclA,'GetAuditedPermissionsFromAclA',\
GetAuditedPermissionsFromAclW,'GetAuditedPermissionsFromAclW',\
GetCurrentHwProfileA,'GetCurrentHwProfileA',\
GetCurrentHwProfileW,'GetCurrentHwProfileW',\
GetEffectiveRightsFromAclA,'GetEffectiveRightsFromAclA',\
GetEffectiveRightsFromAclW,'GetEffectiveRightsFromAclW',\
GetExplicitEntriesFromAclA,'GetExplicitEntriesFromAclA',\
GetExplicitEntriesFromAclW,'GetExplicitEntriesFromAclW',\
GetFileSecurityA,'GetFileSecurityA',\
GetFileSecurityW,'GetFileSecurityW',\
GetKernelObjectSecurity,'GetKernelObjectSecurity',\
GetLengthSid,'GetLengthSid',\
GetMultipleTrusteeA,'GetMultipleTrusteeA',\
GetMultipleTrusteeW,'GetMultipleTrusteeW',\
GetMultipleTrusteeOperationA,'GetMultipleTrusteeOperationA',\
GetMultipleTrusteeOperationW,'GetMultipleTrusteeOperationW',\
GetNamedSecurityInfoA,'GetNamedSecurityInfoA',\
GetNamedSecurityInfoW,'GetNamedSecurityInfoW',\
GetNamedSecurityInfoExA,'GetNamedSecurityInfoExA',\
GetNamedSecurityInfoExW,'GetNamedSecurityInfoExW',\
GetNumberOfEventLogRecords,'GetNumberOfEventLogRecords',\
GetOldestEventLogRecord,'GetOldestEventLogRecord',\
GetOverlappedAccessResults,'GetOverlappedAccessResults',\
GetPrivateObjectSecurity,'GetPrivateObjectSecurity',\
GetSecurityDescriptorControl,'GetSecurityDescriptorControl',\
GetSecurityDescriptorDacl,'GetSecurityDescriptorDacl',\
GetSecurityDescriptorGroup,'GetSecurityDescriptorGroup',\
GetSecurityDescriptorLength,'GetSecurityDescriptorLength',\
GetSecurityDescriptorOwner,'GetSecurityDescriptorOwner',\
GetSecurityDescriptorSacl,'GetSecurityDescriptorSacl',\
GetSecurityInfo,'GetSecurityInfo',\
GetSecurityInfoExA,'GetSecurityInfoExA',\
GetSecurityInfoExW,'GetSecurityInfoExW',\
GetServiceDisplayNameA,'GetServiceDisplayNameA',\
GetServiceDisplayNameW,'GetServiceDisplayNameW',\
GetServiceKeyNameA,'GetServiceKeyNameA',\
GetServiceKeyNameW,'GetServiceKeyNameW',\
GetSidLengthRequiredA,'GetSidLengthRequiredA',\
GetSidLengthRequiredW,'GetSidLengthRequiredW',\
GetSidSubAuthority,'GetSidSubAuthority',\
GetSidSubAuthorityCount,'GetSidSubAuthorityCount',\
GetTokenInformation,'GetTokenInformation',\
GetTrusteeNameA,'GetTrusteeNameA',\
GetTrusteeNameW,'GetTrusteeNameW',\
GetTrusteeTypeA,'GetTrusteeTypeA',\
GetTrusteeTypeW,'GetTrusteeTypeW',\
GetUserNameA,'GetUserNameA',\
GetUserNameW,'GetUserNameW',\
I_ScSetServiceBitsA,'I_ScSetServiceBitsA',\
I_ScSetServiceBitsW,'I_ScSetServiceBitsW',\
ImpersonateLoggedOnUser,'ImpersonateLoggedOnUser',\
ImpersonateNamedPipeClient,'ImpersonateNamedPipeClient',\
ImpersonateSelf,'ImpersonateSelf',\
InitializeAcl,'InitializeAcl',\
InitializeSecurityDescriptor,'InitializeSecurityDescriptor',\
InitializeSid,'InitializeSid',\
InitiateSystemShutdownA,'InitiateSystemShutdownA',\
InitiateSystemShutdownW,'InitiateSystemShutdownW',\
IsTextUnicode,'IsTextUnicode',\
IsTokenRestricted,'IsTokenRestricted',\
IsValidAcl,'IsValidAcl',\
IsValidSecurityDescriptor,'IsValidSecurityDescriptor',\
IsValidSid,'IsValidSid',\
LockServiceDatabase,'LockServiceDatabase',\
LogonUserA,'LogonUserA',\
LogonUserW,'LogonUserW',\
LookupAccountNameA,'LookupAccountNameA',\
LookupAccountNameW,'LookupAccountNameW',\
LookupAccountSidA,'LookupAccountSidA',\
LookupAccountSidW,'LookupAccountSidW',\
LookupPrivilegeDisplayNameA,'LookupPrivilegeDisplayNameA',\
LookupPrivilegeDisplayNameW,'LookupPrivilegeDisplayNameW',\
LookupPrivilegeNameA,'LookupPrivilegeNameA',\
LookupPrivilegeNameW,'LookupPrivilegeNameW',\
LookupPrivilegeValueA,'LookupPrivilegeValueA',\
LookupPrivilegeValueW,'LookupPrivilegeValueW',\
LookupSecurityDescriptorPartsA,'LookupSecurityDescriptorPartsA',\
LookupSecurityDescriptorPartsW,'LookupSecurityDescriptorPartsW',\
LsaAddAccountRights,'LsaAddAccountRights',\
LsaAddPrivilegesToAccount,'LsaAddPrivilegesToAccount',\
LsaClearAuditLog,'LsaClearAuditLog',\
LsaClose,'LsaClose',\
LsaCreateAccount,'LsaCreateAccount',\
LsaCreateSecret,'LsaCreateSecret',\
LsaCreateTrustedDomain,'LsaCreateTrustedDomain',\
LsaCreateTrustedDomainEx,'LsaCreateTrustedDomainEx',\
LsaDelete,'LsaDelete',\
LsaDeleteTrustedDomain,'LsaDeleteTrustedDomain',\
LsaEnumerateAccountRights,'LsaEnumerateAccountRights',\
LsaEnumerateAccounts,'LsaEnumerateAccounts',\
LsaEnumerateAccountsWithUserRight,'LsaEnumerateAccountsWithUserRight',\
LsaEnumeratePrivileges,'LsaEnumeratePrivileges',\
LsaEnumeratePrivilegesOfAccount,'LsaEnumeratePrivilegesOfAccount',\
LsaEnumerateTrustedDomains,'LsaEnumerateTrustedDomains',\
LsaEnumerateTrustedDomainsEx,'LsaEnumerateTrustedDomainsEx',\
LsaFreeMemory,'LsaFreeMemory',\
LsaGetQuotasForAccount,'LsaGetQuotasForAccount',\
LsaGetSystemAccessAccount,'LsaGetSystemAccessAccount',\
LsaGetUserName,'LsaGetUserName',\
LsaICLookupNames,'LsaICLookupNames',\
LsaICLookupSids,'LsaICLookupSids',\
LsaIGetTrustedDomainAuthInfoBlobs,'LsaIGetTrustedDomainAuthInfoBlobs',\
LsaISetTrustedDomainAuthInfoBlobs,'LsaISetTrustedDomainAuthInfoBlobs',\
LsaLookupNames,'LsaLookupNames',\
LsaLookupPrivilegeDisplayName,'LsaLookupPrivilegeDisplayName',\
LsaLookupPrivilegeName,'LsaLookupPrivilegeName',\
LsaLookupPrivilegeValue,'LsaLookupPrivilegeValue',\
LsaLookupSids,'LsaLookupSids',\
LsaNtStatusToWinError,'LsaNtStatusToWinError',\
LsaOpenAccount,'LsaOpenAccount',\
LsaOpenPolicy,'LsaOpenPolicy',\
LsaOpenSecret,'LsaOpenSecret',\
LsaOpenTrustedDomain,'LsaOpenTrustedDomain',\
LsaQueryDomainInformationPolicy,'LsaQueryDomainInformationPolicy',\
LsaQueryInfoTrustedDomain,'LsaQueryInfoTrustedDomain',\
LsaQueryInformationPolicy,'LsaQueryInformationPolicy',\
LsaQueryLocalInformationPolicy,'LsaQueryLocalInformationPolicy',\
LsaQuerySecret,'LsaQuerySecret',\
LsaQuerySecurityObject,'LsaQuerySecurityObject',\
LsaQueryTrustedDomainInfo,'LsaQueryTrustedDomainInfo',\
LsaQueryTrustedDomainInfoByName,'LsaQueryTrustedDomainInfoByName',\
LsaRemoveAccountRights,'LsaRemoveAccountRights',\
LsaRemovePrivilegesFromAccount,'LsaRemovePrivilegesFromAccount',\
LsaRetrievePrivateData,'LsaRetrievePrivateData',\
LsaSetDomainInformationPolicy,'LsaSetDomainInformationPolicy',\
LsaSetInformationPolicy,'LsaSetInformationPolicy',\
LsaSetInformationTrustedDomain,'LsaSetInformationTrustedDomain',\
LsaSetLocalInformationPolicy,'LsaSetLocalInformationPolicy',\
LsaSetQuotasForAccount,'LsaSetQuotasForAccount',\
LsaSetSecret,'LsaSetSecret',\
LsaSetSecurityObject,'LsaSetSecurityObject',\
LsaSetSystemAccessAccount,'LsaSetSystemAccessAccount',\
LsaSetTrustedDomainInfoByName,'LsaSetTrustedDomainInfoByName',\
LsaSetTrustedDomainInformation,'LsaSetTrustedDomainInformation',\
LsaStorePrivateData,'LsaStorePrivateData',\
MakeAbsoluteSD,'MakeAbsoluteSD',\
MakeSelfRelativeSD,'MakeSelfRelativeSD',\
MapGenericMask,'MapGenericMask',\
NotifyBootConfigStatus,'NotifyBootConfigStatus',\
NotifyChangeEventLog,'NotifyChangeEventLog',\
ObjectCloseAuditAlarmA,'ObjectCloseAuditAlarmA',\
ObjectCloseAuditAlarmW,'ObjectCloseAuditAlarmW',\
ObjectDeleteAuditAlarmA,'ObjectDeleteAuditAlarmA',\
ObjectDeleteAuditAlarmW,'ObjectDeleteAuditAlarmW',\
ObjectOpenAuditAlarmA,'ObjectOpenAuditAlarmA',\
ObjectOpenAuditAlarmW,'ObjectOpenAuditAlarmW',\
ObjectPrivilegeAuditAlarmA,'ObjectPrivilegeAuditAlarmA',\
ObjectPrivilegeAuditAlarmW,'ObjectPrivilegeAuditAlarmW',\
OpenBackupEventLogA,'OpenBackupEventLogA',\
OpenBackupEventLogW,'OpenBackupEventLogW',\
OpenEventLogA,'OpenEventLogA',\
OpenEventLogW,'OpenEventLogW',\
OpenProcessToken,'OpenProcessToken',\
OpenRawA,'OpenRawA',\
OpenRawW,'OpenRawW',\
OpenSCManagerA,'OpenSCManagerA',\
OpenSCManagerW,'OpenSCManagerW',\
OpenServiceA,'OpenServiceA',\
OpenServiceW,'OpenServiceW',\
OpenThreadToken,'OpenThreadToken',\
PrivilegeCheck,'PrivilegeCheck',\
PrivilegedServiceAuditAlarmA,'PrivilegedServiceAuditAlarmA',\
PrivilegedServiceAuditAlarmW,'PrivilegedServiceAuditAlarmW',\
QueryRecoveryAgentsA,'QueryRecoveryAgentsA',\
QueryRecoveryAgentsW,'QueryRecoveryAgentsW',\
QueryServiceConfig2A,'QueryServiceConfig2A',\
QueryServiceConfig2W,'QueryServiceConfig2W',\
QueryServiceConfigA,'QueryServiceConfigA',\
QueryServiceConfigW,'QueryServiceConfigW',\
QueryServiceLockStatusA,'QueryServiceLockStatusA',\
QueryServiceLockStatusW,'QueryServiceLockStatusW',\
QueryServiceObjectSecurity,'QueryServiceObjectSecurity',\
QueryServiceStatus,'QueryServiceStatus',\
QueryWindows31FilesMigration,'QueryWindows31FilesMigration',\
ReadEventLogA,'ReadEventLogA',\
ReadEventLogW,'ReadEventLogW',\
ReadRaw,'ReadRaw',\
RegCloseKey,'RegCloseKey',\
RegConnectRegistryA,'RegConnectRegistryA',\
RegConnectRegistryW,'RegConnectRegistryW',\
RegCreateKeyA,'RegCreateKeyA',\
RegCreateKeyW,'RegCreateKeyW',\
RegCreateKeyExA,'RegCreateKeyExA',\
RegCreateKeyExW,'RegCreateKeyExW',\
RegDeleteKeyA,'RegDeleteKeyA',\
RegDeleteKeyW,'RegDeleteKeyW',\
RegDeleteValueA,'RegDeleteValueA',\
RegDeleteValueW,'RegDeleteValueW',\
RegEnumKeyA,'RegEnumKeyA',\
RegEnumKeyW,'RegEnumKeyW',\
RegEnumKeyExA,'RegEnumKeyExA',\
RegEnumKeyExW,'RegEnumKeyExW',\
RegEnumValueA,'RegEnumValueA',\
RegEnumValueW,'RegEnumValueW',\
RegFlushKey,'RegFlushKey',\
RegGetKeySecurity,'RegGetKeySecurity',\
RegLoadKeyA,'RegLoadKeyA',\
RegLoadKeyW,'RegLoadKeyW',\
RegNotifyChangeKeyValue,'RegNotifyChangeKeyValue',\
RegOpenKeyA,'RegOpenKeyA',\
RegOpenKeyW,'RegOpenKeyW',\
RegOpenKeyExA,'RegOpenKeyExA',\
RegOpenKeyExW,'RegOpenKeyExW',\
RegOverridePredefKey,'RegOverridePredefKey',\
RegQueryInfoKeyA,'RegQueryInfoKeyA',\
RegQueryInfoKeyW,'RegQueryInfoKeyW',\
RegQueryMultipleValuesA,'RegQueryMultipleValuesA',\
RegQueryMultipleValuesW,'RegQueryMultipleValuesW',\
RegQueryValueA,'RegQueryValueA',\
RegQueryValueW,'RegQueryValueW',\
RegQueryValueExA,'RegQueryValueExA',\
RegQueryValueExW,'RegQueryValueExW',\
RegReplaceKeyA,'RegReplaceKeyA',\
RegReplaceKeyW,'RegReplaceKeyW',\
RegRestoreKeyA,'RegRestoreKeyA',\
RegRestoreKeyW,'RegRestoreKeyW',\
RegSaveKeyA,'RegSaveKeyA',\
RegSaveKeyW,'RegSaveKeyW',\
RegSetKeySecurity,'RegSetKeySecurity',\
RegSetValueA,'RegSetValueA',\
RegSetValueW,'RegSetValueW',\
RegSetValueExA,'RegSetValueExA',\
RegSetValueExW,'RegSetValueExW',\
RegUnLoadKeyA,'RegUnLoadKeyA',\
RegUnLoadKeyW,'RegUnLoadKeyW',\
RegisterEventSourceA,'RegisterEventSourceA',\
RegisterEventSourceW,'RegisterEventSourceW',\
RegisterServiceCtrlHandlerA,'RegisterServiceCtrlHandlerA',\
RegisterServiceCtrlHandlerW,'RegisterServiceCtrlHandlerW',\
ReportEventA,'ReportEventA',\
ReportEventW,'ReportEventW',\
RevertToSelf,'RevertToSelf',\
SetAclInformation,'SetAclInformation',\
SetEntriesInAccessListA,'SetEntriesInAccessListA',\
SetEntriesInAccessListW,'SetEntriesInAccessListW',\
SetEntriesInAclA,'SetEntriesInAclA',\
SetEntriesInAclW,'SetEntriesInAclW',\
SetEntriesInAuditListA,'SetEntriesInAuditListA',\
SetEntriesInAuditListW,'SetEntriesInAuditListW',\
SetFileSecurityA,'SetFileSecurityA',\
SetFileSecurityW,'SetFileSecurityW',\
SetKernelObjectSecurity,'SetKernelObjectSecurity',\
SetNamedSecurityInfoA,'SetNamedSecurityInfoA',\
SetNamedSecurityInfoW,'SetNamedSecurityInfoW',\
SetNamedSecurityInfoExA,'SetNamedSecurityInfoExA',\
SetNamedSecurityInfoExW,'SetNamedSecurityInfoExW',\
SetPrivateObjectSecurity,'SetPrivateObjectSecurity',\
SetPrivateObjectSecurityEx,'SetPrivateObjectSecurityEx',\
SetSecurityDescriptorControl,'SetSecurityDescriptorControl',\
SetSecurityDescriptorDacl,'SetSecurityDescriptorDacl',\
SetSecurityDescriptorGroup,'SetSecurityDescriptorGroup',\
SetSecurityDescriptorOwner,'SetSecurityDescriptorOwner',\
SetSecurityDescriptorSacl,'SetSecurityDescriptorSacl',\
SetSecurityInfo,'SetSecurityInfo',\
SetSecurityInfoExA,'SetSecurityInfoExA',\
SetSecurityInfoExW,'SetSecurityInfoExW',\
SetServiceBits,'SetServiceBits',\
SetServiceObjectSecurity,'SetServiceObjectSecurity',\
SetServiceStatus,'SetServiceStatus',\
SetThreadToken,'SetThreadToken',\
SetTokenInformation,'SetTokenInformation',\
StartServiceA,'StartServiceA',\
StartServiceW,'StartServiceW',\
StartServiceCtrlDispatcherA,'StartServiceCtrlDispatcherA',\
StartServiceCtrlDispatcherW,'StartServiceCtrlDispatcherW',\
SynchronizeWindows31FilesAndWindowsNTRegistry,'SynchronizeWindows31FilesAndWindowsNTRegistry',\
TrusteeAccessToObjectA,'TrusteeAccessToObjectA',\
TrusteeAccessToObjectW,'TrusteeAccessToObjectW',\
UnlockServiceDatabase,'UnlockServiceDatabase',\
WriteRaw,'WriteRaw'
api AbortSystemShutdown,\
AccessCheckAndAuditAlarm,\
AccessCheckByTypeAndAuditAlarm,\
AccessCheckByTypeResultListAndAuditAlarm,\
BackupEventLog,\
BuildExplicitAccessWithName,\
BuildImpersonateExplicitAccessWithName,\
BuildImpersonateTrustee,\
BuildSecurityDescriptor,\
BuildTrusteeWithName,\
BuildTrusteeWithSid,\
ChangeServiceConfig2,\
ChangeServiceConfig,\
ClearEventLog,\
ConvertAccessToSecurityDescriptor,\
ConvertSecurityDescriptorToAccess,\
ConvertSecurityDescriptorToAccessNamed,\
CreateProcessAsUser,\
CreateService,\
CryptAcquireContext,\
CryptEnumProviderTypes,\
CryptEnumProviders,\
CryptGetDefaultProvider,\
CryptSetProvider,\
CryptSetProviderEx,\
CryptSignHash,\
CryptVerifySignature,\
DecryptFile,\
ElfBackupEventLogFile,\
ElfClearEventLogFile,\
ElfOpenBackupEventLog,\
ElfOpenEventLog,\
ElfReadEventLog,\
ElfRegisterEventSource,\
ElfReportEvent,\
EncryptFile,\
EnumDependentServices,\
EnumServicesStatus,\
GetAccessPermissionsForObject,\
GetAuditedPermissionsFromAcl,\
GetCurrentHwProfile,\
GetEffectiveRightsFromAcl,\
GetExplicitEntriesFromAcl,\
GetFileSecurity,\
GetMultipleTrustee,\
GetMultipleTrusteeOperation,\
GetNamedSecurityInfo,\
GetNamedSecurityInfoEx,\
GetSecurityInfoEx,\
GetServiceDisplayName,\
GetServiceKeyName,\
GetSidLengthRequired,\
GetTrusteeName,\
GetTrusteeType,\
GetUserName,\
I_ScSetServiceBits,\
InitiateSystemShutdown,\
LogonUser,\
LookupAccountName,\
LookupAccountSid,\
LookupPrivilegeDisplayName,\
LookupPrivilegeName,\
LookupPrivilegeValue,\
LookupSecurityDescriptorParts,\
ObjectCloseAuditAlarm,\
ObjectDeleteAuditAlarm,\
ObjectOpenAuditAlarm,\
ObjectPrivilegeAuditAlarm,\
OpenBackupEventLog,\
OpenEventLog,\
OpenRaw,\
OpenSCManager,\
OpenService,\
PrivilegedServiceAuditAlarm,\
QueryRecoveryAgents,\
QueryServiceConfig2,\
QueryServiceConfig,\
QueryServiceLockStatus,\
ReadEventLog,\
RegConnectRegistry,\
RegCreateKey,\
RegCreateKeyEx,\
RegDeleteKey,\
RegDeleteValue,\
RegEnumKey,\
RegEnumKeyEx,\
RegEnumValue,\
RegLoadKey,\
RegOpenKey,\
RegOpenKeyEx,\
RegQueryInfoKey,\
RegQueryMultipleValues,\
RegQueryValue,\
RegQueryValueEx,\
RegReplaceKey,\
RegRestoreKey,\
RegSaveKey,\
RegSetValue,\
RegSetValueEx,\
RegUnLoadKey,\
RegisterEventSource,\
RegisterServiceCtrlHandler,\
ReportEvent,\
SetEntriesInAccessList,\
SetEntriesInAcl,\
SetEntriesInAuditList,\
SetFileSecurity,\
SetNamedSecurityInfo,\
SetNamedSecurityInfoEx,\
SetSecurityInfoEx,\
StartService,\
StartServiceCtrlDispatcher,\
TrusteeAccessToObject

View File

@ -0,0 +1,81 @@
; COMCTL32 API calls
import comctl32,\
CreateMappedBitmap,'CreateMappedBitmap',\
CreatePropertySheetPageA,'CreatePropertySheetPageA',\
CreatePropertySheetPageW,'CreatePropertySheetPageW',\
CreateStatusWindowA,'CreateStatusWindowA',\
CreateStatusWindowW,'CreateStatusWindowW',\
CreateToolbar,'CreateToolbar',\
CreateToolbarEx,'CreateToolbarEx',\
CreateUpDownControl,'CreateUpDownControl',\
DestroyPropertySheetPage,'DestroyPropertySheetPage',\
DrawInsert,'DrawInsert',\
DrawStatusTextA,'DrawStatusTextA',\
DrawStatusTextW,'DrawStatusTextW',\
FlatSB_EnableScrollBar,'FlatSB_EnableScrollBar',\
FlatSB_GetScrollInfo,'FlatSB_GetScrollInfo',\
FlatSB_GetScrollPos,'FlatSB_GetScrollPos',\
FlatSB_GetScrollProp,'FlatSB_GetScrollProp',\
FlatSB_GetScrollRange,'FlatSB_GetScrollRange',\
FlatSB_SetScrollInfo,'FlatSB_SetScrollInfo',\
FlatSB_SetScrollPos,'FlatSB_SetScrollPos',\
FlatSB_SetScrollProp,'FlatSB_SetScrollProp',\
FlatSB_SetScrollRange,'FlatSB_SetScrollRange',\
FlatSB_ShowScrollBar,'FlatSB_ShowScrollBar',\
GetEffectiveClientRect,'GetEffectiveClientRect',\
ImageList_Add,'ImageList_Add',\
ImageList_AddIcon,'ImageList_AddIcon',\
ImageList_AddMasked,'ImageList_AddMasked',\
ImageList_BeginDrag,'ImageList_BeginDrag',\
ImageList_Copy,'ImageList_Copy',\
ImageList_Create,'ImageList_Create',\
ImageList_Destroy,'ImageList_Destroy',\
ImageList_DragEnter,'ImageList_DragEnter',\
ImageList_DragLeave,'ImageList_DragLeave',\
ImageList_DragMove,'ImageList_DragMove',\
ImageList_DragShowNolock,'ImageList_DragShowNolock',\
ImageList_Draw,'ImageList_Draw',\
ImageList_DrawEx,'ImageList_DrawEx',\
ImageList_DrawIndirect,'ImageList_DrawIndirect',\
ImageList_Duplicate,'ImageList_Duplicate',\
ImageList_EndDrag,'ImageList_EndDrag',\
ImageList_GetBkColor,'ImageList_GetBkColor',\
ImageList_GetDragImage,'ImageList_GetDragImage',\
ImageList_GetIcon,'ImageList_GetIcon',\
ImageList_GetIconSize,'ImageList_GetIconSize',\
ImageList_GetImageCount,'ImageList_GetImageCount',\
ImageList_GetImageInfo,'ImageList_GetImageInfo',\
ImageList_GetImageRect,'ImageList_GetImageRect',\
ImageList_LoadImageA,'ImageList_LoadImageA',\
ImageList_LoadImageW,'ImageList_LoadImageW',\
ImageList_Merge,'ImageList_Merge',\
ImageList_Read,'ImageList_Read',\
ImageList_Remove,'ImageList_Remove',\
ImageList_Replace,'ImageList_Replace',\
ImageList_ReplaceIcon,'ImageList_ReplaceIcon',\
ImageList_SetBkColor,'ImageList_SetBkColor',\
ImageList_SetDragCursorImage,'ImageList_SetDragCursorImage',\
ImageList_SetFilter,'ImageList_SetFilter',\
ImageList_SetIconSize,'ImageList_SetIconSize',\
ImageList_SetImageCount,'ImageList_SetImageCount',\
ImageList_SetOverlayImage,'ImageList_SetOverlayImage',\
ImageList_Write,'ImageList_Write',\
InitCommonControls,'InitCommonControls',\
InitCommonControlsEx,'InitCommonControlsEx',\
InitializeFlatSB,'InitializeFlatSB',\
LBItemFromPt,'LBItemFromPt',\
MakeDragList,'MakeDragList',\
MenuHelp,'MenuHelp',\
PropertySheetA,'PropertySheetA',\
PropertySheetW,'PropertySheetW',\
ShowHideMenuCtl,'ShowHideMenuCtl',\
UninitializeFlatSB,'UninitializeFlatSB',\
_TrackMouseEvent,'_TrackMouseEvent'
api CreatePropertySheetPage,\
CreateStatusWindow,\
DrawStatusText,\
ImageList_LoadImage,\
PropertySheet

View File

@ -0,0 +1,38 @@
; COMDLG32 API calls
import comdlg32,\
ChooseColorA,'ChooseColorA',\
ChooseColorW,'ChooseColorW',\
ChooseFontA,'ChooseFontA',\
ChooseFontW,'ChooseFontW',\
CommDlgExtendedError,'CommDlgExtendedError',\
FindTextA,'FindTextA',\
FindTextW,'FindTextW',\
FormatCharDlgProc,'FormatCharDlgProc',\
GetFileTitleA,'GetFileTitleA',\
GetFileTitleW,'GetFileTitleW',\
GetOpenFileNameA,'GetOpenFileNameA',\
GetOpenFileNameW,'GetOpenFileNameW',\
GetSaveFileNameA,'GetSaveFileNameA',\
GetSaveFileNameW,'GetSaveFileNameW',\
LoadAlterBitmap,'LoadAlterBitmap',\
PageSetupDlgA,'PageSetupDlgA',\
PageSetupDlgW,'PageSetupDlgW',\
PrintDlgA,'PrintDlgA',\
PrintDlgW,'PrintDlgW',\
ReplaceTextA,'ReplaceTextA',\
ReplaceTextW,'ReplaceTextW',\
WantArrows,'WantArrows',\
dwLBSubclass,'dwLBSubclass',\
dwOKSubclass,'dwOKSubclass'
api ChooseColor,\
ChooseFont,\
FindText,\
GetFileTitle,\
GetOpenFileName,\
GetSaveFileName,\
PageSetupDlg,\
PrintDlg,\
ReplaceText

View File

@ -0,0 +1,419 @@
; GDI32 API calls
import gdi32,\
AbortDoc,'AbortDoc',\
AbortPath,'AbortPath',\
AddFontMemResourceEx,'AddFontMemResourceEx',\
AddFontResourceA,'AddFontResourceA',\
AddFontResourceW,'AddFontResourceW',\
AddFontResourceExA,'AddFontResourceExA',\
AddFontResourceExW,'AddFontResourceExW',\
AngleArc,'AngleArc',\
AnimatePalette,'AnimatePalette',\
Arc,'Arc',\
ArcTo,'ArcTo',\
BeginPath,'BeginPath',\
BitBlt,'BitBlt',\
CancelDC,'CancelDC',\
CheckColorsInGamut,'CheckColorsInGamut',\
ChoosePixelFormat,'ChoosePixelFormat',\
Chord,'Chord',\
CloseEnhMetaFile,'CloseEnhMetaFile',\
CloseFigure,'CloseFigure',\
CloseMetaFile,'CloseMetaFile',\
ColorCorrectPalette,'ColorCorrectPalette',\
ColorMatchToTarget,'ColorMatchToTarget',\
CombineRgn,'CombineRgn',\
CombineTransform,'CombineTransform',\
CopyEnhMetaFileA,'CopyEnhMetaFileA',\
CopyEnhMetaFileW,'CopyEnhMetaFileW',\
CopyMetaFileA,'CopyMetaFileA',\
CopyMetaFileW,'CopyMetaFileW',\
CreateBitmap,'CreateBitmap',\
CreateBitmapIndirect,'CreateBitmapIndirect',\
CreateBrushIndirect,'CreateBrushIndirect',\
CreateColorSpaceA,'CreateColorSpaceA',\
CreateColorSpaceW,'CreateColorSpaceW',\
CreateCompatibleBitmap,'CreateCompatibleBitmap',\
CreateCompatibleDC,'CreateCompatibleDC',\
CreateDCA,'CreateDCA',\
CreateDCW,'CreateDCW',\
CreateDIBPatternBrush,'CreateDIBPatternBrush',\
CreateDIBPatternBrushPt,'CreateDIBPatternBrushPt',\
CreateDIBSection,'CreateDIBSection',\
CreateDIBitmap,'CreateDIBitmap',\
CreateDiscardableBitmap,'CreateDiscardableBitmap',\
CreateEllipticRgn,'CreateEllipticRgn',\
CreateEllipticRgnIndirect,'CreateEllipticRgnIndirect',\
CreateEnhMetaFileA,'CreateEnhMetaFileA',\
CreateEnhMetaFileW,'CreateEnhMetaFileW',\
CreateFontA,'CreateFontA',\
CreateFontW,'CreateFontW',\
CreateFontIndirectA,'CreateFontIndirectA',\
CreateFontIndirectW,'CreateFontIndirectW',\
CreateFontIndirectExA,'CreateFontIndirectExA',\
CreateFontIndirectExW,'CreateFontIndirectExW',\
CreateHalftonePalette,'CreateHalftonePalette',\
CreateHatchBrush,'CreateHatchBrush',\
CreateICA,'CreateICA',\
CreateICW,'CreateICW',\
CreateMetaFileA,'CreateMetaFileA',\
CreateMetaFileW,'CreateMetaFileW',\
CreatePalette,'CreatePalette',\
CreatePatternBrush,'CreatePatternBrush',\
CreatePen,'CreatePen',\
CreatePenIndirect,'CreatePenIndirect',\
CreatePolyPolygonRgn,'CreatePolyPolygonRgn',\
CreatePolygonRgn,'CreatePolygonRgn',\
CreateRectRgn,'CreateRectRgn',\
CreateRectRgnIndirect,'CreateRectRgnIndirect',\
CreateRoundRectRgn,'CreateRoundRectRgn',\
CreateScalableFontResourceA,'CreateScalableFontResourceA',\
CreateScalableFontResourceW,'CreateScalableFontResourceW',\
CreateSolidBrush,'CreateSolidBrush',\
DPtoLP,'DPtoLP',\
DeleteColorSpace,'DeleteColorSpace',\
DeleteDC,'DeleteDC',\
DeleteEnhMetaFile,'DeleteEnhMetaFile',\
DeleteMetaFile,'DeleteMetaFile',\
DeleteObject,'DeleteObject',\
DescribePixelFormat,'DescribePixelFormat',\
DeviceCapabilitiesExA,'DeviceCapabilitiesExA',\
DeviceCapabilitiesExW,'DeviceCapabilitiesExW',\
DrawEscape,'DrawEscape',\
Ellipse,'Ellipse',\
EnableEUDC,'EnableEUDC',\
EndDoc,'EndDoc',\
EndPage,'EndPage',\
EndPath,'EndPath',\
EnumEnhMetaFile,'EnumEnhMetaFile',\
EnumFontFamiliesA,'EnumFontFamiliesA',\
EnumFontFamiliesW,'EnumFontFamiliesW',\
EnumFontFamiliesExA,'EnumFontFamiliesExA',\
EnumFontFamiliesExW,'EnumFontFamiliesExW',\
EnumFontsA,'EnumFontsA',\
EnumFontsW,'EnumFontsW',\
EnumICMProfilesA,'EnumICMProfilesA',\
EnumICMProfilesW,'EnumICMProfilesW',\
EnumMetaFile,'EnumMetaFile',\
EnumObjects,'EnumObjects',\
EqualRgn,'EqualRgn',\
Escape,'Escape',\
ExcludeClipRect,'ExcludeClipRect',\
ExtCreatePen,'ExtCreatePen',\
ExtCreateRegion,'ExtCreateRegion',\
ExtEscape,'ExtEscape',\
ExtFloodFill,'ExtFloodFill',\
ExtSelectClipRgn,'ExtSelectClipRgn',\
ExtTextOutA,'ExtTextOutA',\
ExtTextOutW,'ExtTextOutW',\
FillPath,'FillPath',\
FillRgn,'FillRgn',\
FixBrushOrgEx,'FixBrushOrgEx',\
FlattenPath,'FlattenPath',\
FloodFill,'FloodFill',\
FrameRgn,'FrameRgn',\
GdiComment,'GdiComment',\
GdiDeleteSpoolFileHandle,'GdiDeleteSpoolFileHandle',\
GdiEndDocEMF,'GdiEndDocEMF',\
GdiEndPageEMF,'GdiEndPageEMF',\
GdiFlush,'GdiFlush',\
GdiGetBatchLimit,'GdiGetBatchLimit',\
GdiGetDC,'GdiGetDC',\
GdiGetDevmodeForPage,'GdiGetDevmodeForPage',\
GdiGetPageCount,'GdiGetPageCount',\
GdiGetPageHandle,'GdiGetPageHandle',\
GdiGetSpoolFileHandle,'GdiGetSpoolFileHandle',\
GdiPlayDCScript,'GdiPlayDCScript',\
GdiPlayEMF,'GdiPlayEMF',\
GdiPlayJournal,'GdiPlayJournal',\
GdiPlayPageEMF,'GdiPlayPageEMF',\
GdiPlayPrivatePageEMF,'GdiPlayPrivatePageEMF',\
GdiPlayScript,'GdiPlayScript',\
GdiResetDCEMF,'GdiResetDCEMF',\
GdiSetBatchLimit,'GdiSetBatchLimit',\
GdiStartDocEMF,'GdiStartDocEMF',\
GdiStartPageEMF,'GdiStartPageEMF',\
GetArcDirection,'GetArcDirection',\
GetAspectRatioFilterEx,'GetAspectRatioFilterEx',\
GetBitmapBits,'GetBitmapBits',\
GetBitmapDimensionEx,'GetBitmapDimensionEx',\
GetBkColor,'GetBkColor',\
GetBkMode,'GetBkMode',\
GetBoundsRect,'GetBoundsRect',\
GetBrushOrgEx,'GetBrushOrgEx',\
GetCharABCWidthsA,'GetCharABCWidthsA',\
GetCharABCWidthsW,'GetCharABCWidthsW',\
GetCharABCWidthsFloatA,'GetCharABCWidthsFloatA',\
GetCharABCWidthsFloatW,'GetCharABCWidthsFloatW',\
GetCharABCWidthsI,'GetCharABCWidthsI',\
GetCharWidth32A,'GetCharWidth32A',\
GetCharWidth32W,'GetCharWidth32W',\
GetCharWidthA,'GetCharWidthA',\
GetCharWidthW,'GetCharWidthW',\
GetCharWidthFloatA,'GetCharWidthFloatA',\
GetCharWidthFloatW,'GetCharWidthFloatW',\
GetCharWidthI,'GetCharWidthI',\
GetCharacterPlacementA,'GetCharacterPlacementA',\
GetCharacterPlacementW,'GetCharacterPlacementW',\
GetClipBox,'GetClipBox',\
GetClipRgn,'GetClipRgn',\
GetColorAdjustment,'GetColorAdjustment',\
GetColorSpace,'GetColorSpace',\
GetCurrentObject,'GetCurrentObject',\
GetCurrentPositionEx,'GetCurrentPositionEx',\
GetDCBrushColor,'GetDCBrushColor',\
GetDCOrgEx,'GetDCOrgEx',\
GetDCPenColor,'GetDCPenColor',\
GetDIBColorTable,'GetDIBColorTable',\
GetDIBits,'GetDIBits',\
GetDeviceCaps,'GetDeviceCaps',\
GetDeviceGammaRamp,'GetDeviceGammaRamp',\
GetEnhMetaFileA,'GetEnhMetaFileA',\
GetEnhMetaFileW,'GetEnhMetaFileW',\
GetEnhMetaFileBits,'GetEnhMetaFileBits',\
GetEnhMetaFileDescriptionA,'GetEnhMetaFileDescriptionA',\
GetEnhMetaFileDescriptionW,'GetEnhMetaFileDescriptionW',\
GetEnhMetaFileHeader,'GetEnhMetaFileHeader',\
GetEnhMetaFilePaletteEntries,'GetEnhMetaFilePaletteEntries',\
GetEnhMetaFilePixelFormat,'GetEnhMetaFilePixelFormat',\
GetFontAssocStatus,'GetFontAssocStatus',\
GetFontData,'GetFontData',\
GetFontLanguageInfo,'GetFontLanguageInfo',\
GetFontUnicodeRanges,'GetFontUnicodeRanges',\
GetGlyphIndicesA,'GetGlyphIndicesA',\
GetGlyphIndicesW,'GetGlyphIndicesW',\
GetGlyphOutlineA,'GetGlyphOutlineA',\
GetGlyphOutlineW,'GetGlyphOutlineW',\
GetGraphicsMode,'GetGraphicsMode',\
GetICMProfileA,'GetICMProfileA',\
GetICMProfileW,'GetICMProfileW',\
GetKerningPairsA,'GetKerningPairsA',\
GetKerningPairsW,'GetKerningPairsW',\
GetLogColorSpaceA,'GetLogColorSpaceA',\
GetLogColorSpaceW,'GetLogColorSpaceW',\
GetMapMode,'GetMapMode',\
GetMetaFileA,'GetMetaFileA',\
GetMetaFileW,'GetMetaFileW',\
GetMetaFileBitsEx,'GetMetaFileBitsEx',\
GetMetaRgn,'GetMetaRgn',\
GetMiterLimit,'GetMiterLimit',\
GetNearestColor,'GetNearestColor',\
GetNearestPaletteIndex,'GetNearestPaletteIndex',\
GetObjectA,'GetObjectA',\
GetObjectW,'GetObjectW',\
GetObjectType,'GetObjectType',\
GetOutlineTextMetricsA,'GetOutlineTextMetricsA',\
GetOutlineTextMetricsW,'GetOutlineTextMetricsW',\
GetPaletteEntries,'GetPaletteEntries',\
GetPath,'GetPath',\
GetPixel,'GetPixel',\
GetPixelFormat,'GetPixelFormat',\
GetPolyFillMode,'GetPolyFillMode',\
GetROP2,'GetROP2',\
GetRandomRgn,'GetRandomRgn',\
GetRasterizerCaps,'GetRasterizerCaps',\
GetRegionData,'GetRegionData',\
GetRelAbs,'GetRelAbs',\
GetRgnBox,'GetRgnBox',\
GetStockObject,'GetStockObject',\
GetStretchBltMode,'GetStretchBltMode',\
GetSystemPaletteEntries,'GetSystemPaletteEntries',\
GetSystemPaletteUse,'GetSystemPaletteUse',\
GetTextAlign,'GetTextAlign',\
GetTextCharacterExtra,'GetTextCharacterExtra',\
GetTextCharset,'GetTextCharset',\
GetTextCharsetInfo,'GetTextCharsetInfo',\
GetTextColor,'GetTextColor',\
GetTextExtentExPointA,'GetTextExtentExPointA',\
GetTextExtentExPointW,'GetTextExtentExPointW',\
GetTextExtentExPointI,'GetTextExtentExPointI',\
GetTextExtentPoint32A,'GetTextExtentPoint32A',\
GetTextExtentPoint32W,'GetTextExtentPoint32W',\
GetTextExtentPointA,'GetTextExtentPointA',\
GetTextExtentPointW,'GetTextExtentPointW',\
GetTextExtentPointI,'GetTextExtentPointI',\
GetTextFaceA,'GetTextFaceA',\
GetTextFaceW,'GetTextFaceW',\
GetTextMetricsA,'GetTextMetricsA',\
GetTextMetricsW,'GetTextMetricsW',\
GetViewportExtEx,'GetViewportExtEx',\
GetViewportOrgEx,'GetViewportOrgEx',\
GetWinMetaFileBits,'GetWinMetaFileBits',\
GetWindowExtEx,'GetWindowExtEx',\
GetWindowOrgEx,'GetWindowOrgEx',\
GetWorldTransform,'GetWorldTransform',\
IntersectClipRect,'IntersectClipRect',\
InvertRgn,'InvertRgn',\
LPtoDP,'LPtoDP',\
LineDDA,'LineDDA',\
LineDDW,'LineDDW',\
LineTo,'LineTo',\
MaskBlt,'MaskBlt',\
ModifyWorldTransform,'ModifyWorldTransform',\
MoveToEx,'MoveToEx',\
OffsetClipRgn,'OffsetClipRgn',\
OffsetRgn,'OffsetRgn',\
OffsetViewportOrgEx,'OffsetViewportOrgEx',\
OffsetWindowOrgEx,'OffsetWindowOrgEx',\
PaintRgn,'PaintRgn',\
PatBlt,'PatBlt',\
PathToRegion,'PathToRegion',\
Pie,'Pie',\
PlayEnhMetaFile,'PlayEnhMetaFile',\
PlayEnhMetaFileRecord,'PlayEnhMetaFileRecord',\
PlayMetaFile,'PlayMetaFile',\
PlayMetaFileRecord,'PlayMetaFileRecord',\
PlgBlt,'PlgBlt',\
PolyBezier,'PolyBezier',\
PolyBezierTo,'PolyBezierTo',\
PolyDraw,'PolyDraw',\
PolyPatBlt,'PolyPatBlt',\
PolyPolygon,'PolyPolygon',\
PolyPolyline,'PolyPolyline',\
PolyTextOutA,'PolyTextOutA',\
PolyTextOutW,'PolyTextOutW',\
Polygon,'Polygon',\
Polyline,'Polyline',\
PolylineTo,'PolylineTo',\
PtInRegion,'PtInRegion',\
PtVisible,'PtVisible',\
RealizePalette,'RealizePalette',\
RectInRegion,'RectInRegion',\
RectVisible,'RectVisible',\
Rectangle,'Rectangle',\
RemoveFontMemResourceEx,'RemoveFontMemResourceEx',\
RemoveFontResourceA,'RemoveFontResourceA',\
RemoveFontResourceW,'RemoveFontResourceW',\
RemoveFontResourceExA,'RemoveFontResourceExA',\
RemoveFontResourceExW,'RemoveFontResourceExW',\
ResetDCA,'ResetDCA',\
ResetDCW,'ResetDCW',\
ResizePalette,'ResizePalette',\
RestoreDC,'RestoreDC',\
RoundRect,'RoundRect',\
SaveDC,'SaveDC',\
ScaleViewportExtEx,'ScaleViewportExtEx',\
ScaleWindowExtEx,'ScaleWindowExtEx',\
SelectBrushLocal,'SelectBrushLocal',\
SelectClipPath,'SelectClipPath',\
SelectClipRgn,'SelectClipRgn',\
SelectFontLocal,'SelectFontLocal',\
SelectObject,'SelectObject',\
SelectPalette,'SelectPalette',\
SetAbortProc,'SetAbortProc',\
SetArcDirection,'SetArcDirection',\
SetBitmapBits,'SetBitmapBits',\
SetBitmapDimensionEx,'SetBitmapDimensionEx',\
SetBkColor,'SetBkColor',\
SetBkMode,'SetBkMode',\
SetBoundsRect,'SetBoundsRect',\
SetBrushOrgEx,'SetBrushOrgEx',\
SetColorAdjustment,'SetColorAdjustment',\
SetColorSpace,'SetColorSpace',\
SetDCBrushColor,'SetDCBrushColor',\
SetDCPenColor,'SetDCPenColor',\
SetDIBColorTable,'SetDIBColorTable',\
SetDIBits,'SetDIBits',\
SetDIBitsToDevice,'SetDIBitsToDevice',\
SetDeviceGammaRamp,'SetDeviceGammaRamp',\
SetEnhMetaFileBits,'SetEnhMetaFileBits',\
SetFontEnumeration,'SetFontEnumeration',\
SetGraphicsMode,'SetGraphicsMode',\
SetICMMode,'SetICMMode',\
SetICMProfileA,'SetICMProfileA',\
SetICMProfileW,'SetICMProfileW',\
SetMagicColors,'SetMagicColors',\
SetMapMode,'SetMapMode',\
SetMapperFlags,'SetMapperFlags',\
SetMetaFileBitsEx,'SetMetaFileBitsEx',\
SetMetaRgn,'SetMetaRgn',\
SetMiterLimit,'SetMiterLimit',\
SetPaletteEntries,'SetPaletteEntries',\
SetPixel,'SetPixel',\
SetPixelFormat,'SetPixelFormat',\
SetPixelV,'SetPixelV',\
SetPolyFillMode,'SetPolyFillMode',\
SetROP2,'SetROP2',\
SetRectRgn,'SetRectRgn',\
SetRelAbs,'SetRelAbs',\
SetStretchBltMode,'SetStretchBltMode',\
SetSystemPaletteUse,'SetSystemPaletteUse',\
SetTextAlign,'SetTextAlign',\
SetTextCharacterExtra,'SetTextCharacterExtra',\
SetTextColor,'SetTextColor',\
SetTextJustification,'SetTextJustification',\
SetViewportExtEx,'SetViewportExtEx',\
SetViewportOrgEx,'SetViewportOrgEx',\
SetWinMetaFileBits,'SetWinMetaFileBits',\
SetWindowExtEx,'SetWindowExtEx',\
SetWindowOrgEx,'SetWindowOrgEx',\
SetWorldTransform,'SetWorldTransform',\
StartDocA,'StartDocA',\
StartDocW,'StartDocW',\
StartPage,'StartPage',\
StretchBlt,'StretchBlt',\
StretchDIBits,'StretchDIBits',\
StrokeAndFillPath,'StrokeAndFillPath',\
StrokePath,'StrokePath',\
SwapBuffers,'SwapBuffers',\
TextOutA,'TextOutA',\
TextOutW,'TextOutW',\
TranslateCharsetInfo,'TranslateCharsetInfo',\
UnrealizeObject,'UnrealizeObject',\
UpdateColors,'UpdateColors',\
UpdateICMRegKeyA,'UpdateICMRegKeyA',\
UpdateICMRegKeyW,'UpdateICMRegKeyW',\
WidenPath,'WidenPath',\
gdiPlaySpoolStream,'gdiPlaySpoolStream'
api AddFontResource,\
AddFontResourceEx,\
CopyEnhMetaFile,\
CopyMetaFile,\
CreateColorSpace,\
CreateDC,\
CreateEnhMetaFile,\
CreateFont,\
CreateFontIndirect,\
CreateFontIndirectEx,\
CreateIC,\
CreateMetaFile,\
CreateScalableFontResource,\
DeviceCapabilitiesEx,\
EnumFontFamilies,\
EnumFontFamiliesEx,\
EnumFonts,\
EnumICMProfiles,\
ExtTextOut,\
GetCharABCWidths,\
GetCharABCWidthsFloat,\
GetCharWidth32,\
GetCharWidth,\
GetCharWidthFloat,\
GetCharacterPlacement,\
GetEnhMetaFile,\
GetEnhMetaFileDescription,\
GetGlyphIndices,\
GetGlyphOutline,\
GetICMProfile,\
GetKerningPairs,\
GetLogColorSpace,\
GetMetaFile,\
GetObject,\
GetOutlineTextMetrics,\
GetTextExtentExPoint,\
GetTextExtentPoint32,\
GetTextExtentPoint,\
GetTextFace,\
GetTextMetrics,\
LineDD,\
PolyTextOut,\
RemoveFontResource,\
RemoveFontResourceEx,\
ResetDC,\
SetICMProfile,\
StartDoc,\
TextOut,\
UpdateICMRegKey

View File

@ -0,0 +1,881 @@
; KERNEL32 API calls
import kernel32,\
AddAtomA,'AddAtomA',\
AddAtomW,'AddAtomW',\
AddConsoleAliasA,'AddConsoleAliasA',\
AddConsoleAliasW,'AddConsoleAliasW',\
AllocConsole,'AllocConsole',\
AreFileApisANSI,'AreFileApisANSI',\
AssignProcessToJobObject,'AssignProcessToJobObject',\
BackupRead,'BackupRead',\
BackupSeek,'BackupSeek',\
BackupWrite,'BackupWrite',\
BaseAttachCompleteThunk,'BaseAttachCompleteThunk',\
Beep,'Beep',\
BeginUpdateResourceA,'BeginUpdateResourceA',\
BeginUpdateResourceW,'BeginUpdateResourceW',\
BuildCommDCBA,'BuildCommDCBA',\
BuildCommDCBW,'BuildCommDCBW',\
BuildCommDCBAndTimeoutsA,'BuildCommDCBAndTimeoutsA',\
BuildCommDCBAndTimeoutsW,'BuildCommDCBAndTimeoutsW',\
CallNamedPipeA,'CallNamedPipeA',\
CallNamedPipeW,'CallNamedPipeW',\
CancelIo,'CancelIo',\
CancelWaitableTimer,'CancelWaitableTimer',\
ClearCommBreak,'ClearCommBreak',\
ClearCommError,'ClearCommError',\
CloseConsoleHandle,'CloseConsoleHandle',\
CloseHandle,'CloseHandle',\
CloseProfileUserMapping,'CloseProfileUserMapping',\
CmdBatNotification,'CmdBatNotification',\
CommConfigDialogA,'CommConfigDialogA',\
CommConfigDialogW,'CommConfigDialogW',\
CompareFileTime,'CompareFileTime',\
CompareStringA,'CompareStringA',\
CompareStringW,'CompareStringW',\
ConnectNamedPipe,'ConnectNamedPipe',\
ConsoleMenuControl,'ConsoleMenuControl',\
ContinueDebugEvent,'ContinueDebugEvent',\
ConvertDefaultLocale,'ConvertDefaultLocale',\
ConvertThreadToFiber,'ConvertThreadToFiber',\
CopyFileA,'CopyFileA',\
CopyFileW,'CopyFileW',\
CopyFileExA,'CopyFileExA',\
CopyFileExW,'CopyFileExW',\
CreateConsoleScreenBuffer,'CreateConsoleScreenBuffer',\
CreateDirectoryA,'CreateDirectoryA',\
CreateDirectoryW,'CreateDirectoryW',\
CreateDirectoryExA,'CreateDirectoryExA',\
CreateDirectoryExW,'CreateDirectoryExW',\
CreateEventA,'CreateEventA',\
CreateEventW,'CreateEventW',\
CreateFiber,'CreateFiber',\
CreateFileA,'CreateFileA',\
CreateFileW,'CreateFileW',\
CreateFileMappingA,'CreateFileMappingA',\
CreateFileMappingW,'CreateFileMappingW',\
CreateHardLinkA,'CreateHardLinkA',\
CreateHardLinkW,'CreateHardLinkW',\
CreateIoCompletionPort,'CreateIoCompletionPort',\
CreateJobObjectA,'CreateJobObjectA',\
CreateJobObjectW,'CreateJobObjectW',\
CreateMailslotA,'CreateMailslotA',\
CreateMailslotW,'CreateMailslotW',\
CreateMutexA,'CreateMutexA',\
CreateMutexW,'CreateMutexW',\
CreateNamedPipeA,'CreateNamedPipeA',\
CreateNamedPipeW,'CreateNamedPipeW',\
CreatePipe,'CreatePipe',\
CreateProcessA,'CreateProcessA',\
CreateProcessW,'CreateProcessW',\
CreateRemoteThread,'CreateRemoteThread',\
CreateSemaphoreA,'CreateSemaphoreA',\
CreateSemaphoreW,'CreateSemaphoreW',\
CreateTapePartition,'CreateTapePartition',\
CreateThread,'CreateThread',\
CreateToolhelp32Snapshot,'CreateToolhelp32Snapshot',\
CreateVirtualBuffer,'CreateVirtualBuffer',\
CreateWaitableTimerA,'CreateWaitableTimerA',\
CreateWaitableTimerW,'CreateWaitableTimerW',\
DebugActiveProcess,'DebugActiveProcess',\
DebugBreak,'DebugBreak',\
DefineDosDeviceA,'DefineDosDeviceA',\
DefineDosDeviceW,'DefineDosDeviceW',\
DeleteAtom,'DeleteAtom',\
DeleteCriticalSection,'DeleteCriticalSection',\
DeleteFiber,'DeleteFiber',\
DeleteFileA,'DeleteFileA',\
DeleteFileW,'DeleteFileW',\
DeviceIoControl,'DeviceIoControl',\
DisableThreadLibraryCalls,'DisableThreadLibraryCalls',\
DisconnectNamedPipe,'DisconnectNamedPipe',\
DosDateTimeToFileTime,'DosDateTimeToFileTime',\
DuplicateConsoleHandle,'DuplicateConsoleHandle',\
DuplicateHandle,'DuplicateHandle',\
EndUpdateResourceA,'EndUpdateResourceA',\
EndUpdateResourceW,'EndUpdateResourceW',\
EnterCriticalSection,'EnterCriticalSection',\
EnumCalendarInfoA,'EnumCalendarInfoA',\
EnumCalendarInfoW,'EnumCalendarInfoW',\
EnumCalendarInfoExA,'EnumCalendarInfoExA',\
EnumCalendarInfoExW,'EnumCalendarInfoExW',\
EnumDateFormatsA,'EnumDateFormatsA',\
EnumDateFormatsW,'EnumDateFormatsW',\
EnumDateFormatsExA,'EnumDateFormatsExA',\
EnumDateFormatsExW,'EnumDateFormatsExW',\
EnumResourceLanguagesA,'EnumResourceLanguagesA',\
EnumResourceLanguagesW,'EnumResourceLanguagesW',\
EnumResourceNamesA,'EnumResourceNamesA',\
EnumResourceNamesW,'EnumResourceNamesW',\
EnumResourceTypesA,'EnumResourceTypesA',\
EnumResourceTypesW,'EnumResourceTypesW',\
EnumSystemCodePagesA,'EnumSystemCodePagesA',\
EnumSystemCodePagesW,'EnumSystemCodePagesW',\
EnumSystemLocalesA,'EnumSystemLocalesA',\
EnumSystemLocalesW,'EnumSystemLocalesW',\
EnumTimeFormatsA,'EnumTimeFormatsA',\
EnumTimeFormatsW,'EnumTimeFormatsW',\
EraseTape,'EraseTape',\
EscapeCommFunction,'EscapeCommFunction',\
ExitProcess,'ExitProcess',\
ExitThread,'ExitThread',\
ExitVDM,'ExitVDM',\
ExpandEnvironmentStringsA,'ExpandEnvironmentStringsA',\
ExpandEnvironmentStringsW,'ExpandEnvironmentStringsW',\
ExpungeConsoleCommandHistoryA,'ExpungeConsoleCommandHistoryA',\
ExpungeConsoleCommandHistoryW,'ExpungeConsoleCommandHistoryW',\
ExtendVirtualBuffer,'ExtendVirtualBuffer',\
FatalAppExitA,'FatalAppExitA',\
FatalAppExitW,'FatalAppExitW',\
FatalExit,'FatalExit',\
FileTimeToDosDateTime,'FileTimeToDosDateTime',\
FileTimeToLocalFileTime,'FileTimeToLocalFileTime',\
FileTimeToSystemTime,'FileTimeToSystemTime',\
FillConsoleOutputAttribute,'FillConsoleOutputAttribute',\
FillConsoleOutputCharacterA,'FillConsoleOutputCharacterA',\
FillConsoleOutputCharacterW,'FillConsoleOutputCharacterW',\
FindAtomA,'FindAtomA',\
FindAtomW,'FindAtomW',\
FindClose,'FindClose',\
FindCloseChangeNotification,'FindCloseChangeNotification',\
FindFirstChangeNotificationA,'FindFirstChangeNotificationA',\
FindFirstChangeNotificationW,'FindFirstChangeNotificationW',\
FindFirstFileA,'FindFirstFileA',\
FindFirstFileW,'FindFirstFileW',\
FindFirstFileExA,'FindFirstFileExA',\
FindFirstFileExW,'FindFirstFileExW',\
FindNextChangeNotification,'FindNextChangeNotification',\
FindNextFileA,'FindNextFileA',\
FindNextFileW,'FindNextFileW',\
FindResourceA,'FindResourceA',\
FindResourceW,'FindResourceW',\
FindResourceExA,'FindResourceExA',\
FindResourceExW,'FindResourceExW',\
FlushConsoleInputBuffer,'FlushConsoleInputBuffer',\
FlushFileBuffers,'FlushFileBuffers',\
FlushInstructionCache,'FlushInstructionCache',\
FlushViewOfFile,'FlushViewOfFile',\
FoldStringA,'FoldStringA',\
FoldStringW,'FoldStringW',\
FormatMessageA,'FormatMessageA',\
FormatMessageW,'FormatMessageW',\
FreeConsole,'FreeConsole',\
FreeEnvironmentStringsA,'FreeEnvironmentStringsA',\
FreeEnvironmentStringsW,'FreeEnvironmentStringsW',\
FreeLibrary,'FreeLibrary',\
FreeLibraryAndExitThread,'FreeLibraryAndExitThread',\
FreeResource,'FreeResource',\
FreeVirtualBuffer,'FreeVirtualBuffer',\
GenerateConsoleCtrlEvent,'GenerateConsoleCtrlEvent',\
GetACP,'GetACP',\
GetAtomNameA,'GetAtomNameA',\
GetAtomNameW,'GetAtomNameW',\
GetBinaryTypeA,'GetBinaryTypeA',\
GetBinaryTypeW,'GetBinaryTypeW',\
GetCPInfo,'GetCPInfo',\
GetCPInfoExA,'GetCPInfoExA',\
GetCPInfoExW,'GetCPInfoExW',\
GetCommConfig,'GetCommConfig',\
GetCommMask,'GetCommMask',\
GetCommModemStatus,'GetCommModemStatus',\
GetCommProperties,'GetCommProperties',\
GetCommState,'GetCommState',\
GetCommTimeouts,'GetCommTimeouts',\
GetCommandLineA,'GetCommandLineA',\
GetCommandLineW,'GetCommandLineW',\
GetCompressedFileSizeA,'GetCompressedFileSizeA',\
GetCompressedFileSizeW,'GetCompressedFileSizeW',\
GetComputerNameA,'GetComputerNameA',\
GetComputerNameW,'GetComputerNameW',\
GetConsoleAliasA,'GetConsoleAliasA',\
GetConsoleAliasW,'GetConsoleAliasW',\
GetConsoleAliasExesA,'GetConsoleAliasExesA',\
GetConsoleAliasExesW,'GetConsoleAliasExesW',\
GetConsoleAliasExesLengthA,'GetConsoleAliasExesLengthA',\
GetConsoleAliasExesLengthW,'GetConsoleAliasExesLengthW',\
GetConsoleAliasesA,'GetConsoleAliasesA',\
GetConsoleAliasesW,'GetConsoleAliasesW',\
GetConsoleAliasesLengthA,'GetConsoleAliasesLengthA',\
GetConsoleAliasesLengthW,'GetConsoleAliasesLengthW',\
GetConsoleCP,'GetConsoleCP',\
GetConsoleCommandHistoryA,'GetConsoleCommandHistoryA',\
GetConsoleCommandHistoryW,'GetConsoleCommandHistoryW',\
GetConsoleCommandHistoryLengthA,'GetConsoleCommandHistoryLengthA',\
GetConsoleCommandHistoryLengthW,'GetConsoleCommandHistoryLengthW',\
GetConsoleCursorInfo,'GetConsoleCursorInfo',\
GetConsoleDisplayMode,'GetConsoleDisplayMode',\
GetConsoleFontInfo,'GetConsoleFontInfo',\
GetConsoleFontSize,'GetConsoleFontSize',\
GetConsoleHardwareState,'GetConsoleHardwareState',\
GetConsoleInputExeNameA,'GetConsoleInputExeNameA',\
GetConsoleInputExeNameW,'GetConsoleInputExeNameW',\
GetConsoleInputWaitHandle,'GetConsoleInputWaitHandle',\
GetConsoleKeyboardLayoutNameA,'GetConsoleKeyboardLayoutNameA',\
GetConsoleKeyboardLayoutNameW,'GetConsoleKeyboardLayoutNameW',\
GetConsoleMode,'GetConsoleMode',\
GetConsoleOutputCP,'GetConsoleOutputCP',\
GetConsoleScreenBufferInfo,'GetConsoleScreenBufferInfo',\
GetConsoleTitleA,'GetConsoleTitleA',\
GetConsoleTitleW,'GetConsoleTitleW',\
GetConsoleWindow,'GetConsoleWindow',\
GetCurrencyFormatA,'GetCurrencyFormatA',\
GetCurrencyFormatW,'GetCurrencyFormatW',\
GetCurrentConsoleFont,'GetCurrentConsoleFont',\
GetCurrentDirectoryA,'GetCurrentDirectoryA',\
GetCurrentDirectoryW,'GetCurrentDirectoryW',\
GetCurrentProcess,'GetCurrentProcess',\
GetCurrentProcessId,'GetCurrentProcessId',\
GetCurrentThread,'GetCurrentThread',\
GetCurrentThreadId,'GetCurrentThreadId',\
GetDateFormatA,'GetDateFormatA',\
GetDateFormatW,'GetDateFormatW',\
GetDefaultCommConfigA,'GetDefaultCommConfigA',\
GetDefaultCommConfigW,'GetDefaultCommConfigW',\
GetDevicePowerState,'GetDevicePowerState',\
GetDiskFreeSpaceA,'GetDiskFreeSpaceA',\
GetDiskFreeSpaceW,'GetDiskFreeSpaceW',\
GetDiskFreeSpaceExA,'GetDiskFreeSpaceExA',\
GetDiskFreeSpaceExW,'GetDiskFreeSpaceExW',\
GetDriveTypeA,'GetDriveTypeA',\
GetDriveTypeW,'GetDriveTypeW',\
GetEnvironmentStringsA,'GetEnvironmentStringsA',\
GetEnvironmentStringsW,'GetEnvironmentStringsW',\
GetEnvironmentVariableA,'GetEnvironmentVariableA',\
GetEnvironmentVariableW,'GetEnvironmentVariableW',\
GetExitCodeProcess,'GetExitCodeProcess',\
GetExitCodeThread,'GetExitCodeThread',\
GetFileAttributesA,'GetFileAttributesA',\
GetFileAttributesW,'GetFileAttributesW',\
GetFileAttributesExA,'GetFileAttributesExA',\
GetFileAttributesExW,'GetFileAttributesExW',\
GetFileInformationByHandle,'GetFileInformationByHandle',\
GetFileSize,'GetFileSize',\
GetFileSizeEx,'GetFileSizeEx',\
GetFileTime,'GetFileTime',\
GetFileType,'GetFileType',\
GetFullPathNameA,'GetFullPathNameA',\
GetFullPathNameW,'GetFullPathNameW',\
GetHandleInformation,'GetHandleInformation',\
GetLargestConsoleWindowSize,'GetLargestConsoleWindowSize',\
GetLastError,'GetLastError',\
GetLocalTime,'GetLocalTime',\
GetLocaleInfoA,'GetLocaleInfoA',\
GetLocaleInfoW,'GetLocaleInfoW',\
GetLogicalDriveStringsA,'GetLogicalDriveStringsA',\
GetLogicalDriveStringsW,'GetLogicalDriveStringsW',\
GetLogicalDrives,'GetLogicalDrives',\
GetLongPathNameA,'GetLongPathNameA',\
GetLongPathNameW,'GetLongPathNameW',\
GetMailslotInfo,'GetMailslotInfo',\
GetModuleFileNameA,'GetModuleFileNameA',\
GetModuleFileNameW,'GetModuleFileNameW',\
GetModuleHandleA,'GetModuleHandleA',\
GetModuleHandleW,'GetModuleHandleW',\
GetNamedPipeHandleStateA,'GetNamedPipeHandleStateA',\
GetNamedPipeHandleStateW,'GetNamedPipeHandleStateW',\
GetNamedPipeInfo,'GetNamedPipeInfo',\
GetNextVDMCommand,'GetNextVDMCommand',\
GetNumberFormatA,'GetNumberFormatA',\
GetNumberFormatW,'GetNumberFormatW',\
GetNumberOfConsoleFonts,'GetNumberOfConsoleFonts',\
GetNumberOfConsoleInputEvents,'GetNumberOfConsoleInputEvents',\
GetNumberOfConsoleMouseButtons,'GetNumberOfConsoleMouseButtons',\
GetOEMCP,'GetOEMCP',\
GetOverlappedResult,'GetOverlappedResult',\
GetPriorityClass,'GetPriorityClass',\
GetPrivateProfileIntA,'GetPrivateProfileIntA',\
GetPrivateProfileIntW,'GetPrivateProfileIntW',\
GetPrivateProfileSectionA,'GetPrivateProfileSectionA',\
GetPrivateProfileSectionW,'GetPrivateProfileSectionW',\
GetPrivateProfileSectionNamesA,'GetPrivateProfileSectionNamesA',\
GetPrivateProfileSectionNamesW,'GetPrivateProfileSectionNamesW',\
GetPrivateProfileStringA,'GetPrivateProfileStringA',\
GetPrivateProfileStringW,'GetPrivateProfileStringW',\
GetPrivateProfileStructA,'GetPrivateProfileStructA',\
GetPrivateProfileStructW,'GetPrivateProfileStructW',\
GetProcAddress,'GetProcAddress',\
GetProcessAffinityMask,'GetProcessAffinityMask',\
GetProcessHeap,'GetProcessHeap',\
GetProcessHeaps,'GetProcessHeaps',\
GetProcessPriorityBoost,'GetProcessPriorityBoost',\
GetProcessShutdownParameters,'GetProcessShutdownParameters',\
GetProcessTimes,'GetProcessTimes',\
GetProcessVersion,'GetProcessVersion',\
GetProcessWorkingSetSize,'GetProcessWorkingSetSize',\
GetProfileIntA,'GetProfileIntA',\
GetProfileIntW,'GetProfileIntW',\
GetProfileSectionA,'GetProfileSectionA',\
GetProfileSectionW,'GetProfileSectionW',\
GetProfileStringA,'GetProfileStringA',\
GetProfileStringW,'GetProfileStringW',\
GetQueuedCompletionStatus,'GetQueuedCompletionStatus',\
GetShortPathNameA,'GetShortPathNameA',\
GetShortPathNameW,'GetShortPathNameW',\
GetStartupInfoA,'GetStartupInfoA',\
GetStartupInfoW,'GetStartupInfoW',\
GetStdHandle,'GetStdHandle',\
GetStringTypeA,'GetStringTypeA',\
GetStringTypeW,'GetStringTypeW',\
GetStringTypeExA,'GetStringTypeExA',\
GetStringTypeExW,'GetStringTypeExW',\
GetSystemDefaultLCID,'GetSystemDefaultLCID',\
GetSystemDefaultLangID,'GetSystemDefaultLangID',\
GetSystemDirectoryA,'GetSystemDirectoryA',\
GetSystemDirectoryW,'GetSystemDirectoryW',\
GetSystemInfo,'GetSystemInfo',\
GetSystemPowerStatus,'GetSystemPowerStatus',\
GetSystemTime,'GetSystemTime',\
GetSystemTimeAdjustment,'GetSystemTimeAdjustment',\
GetSystemTimeAsFileTime,'GetSystemTimeAsFileTime',\
GetTapeParameters,'GetTapeParameters',\
GetTapePosition,'GetTapePosition',\
GetTapeStatus,'GetTapeStatus',\
GetTempFileNameA,'GetTempFileNameA',\
GetTempFileNameW,'GetTempFileNameW',\
GetTempPathA,'GetTempPathA',\
GetTempPathW,'GetTempPathW',\
GetThreadContext,'GetThreadContext',\
GetThreadLocale,'GetThreadLocale',\
GetThreadPriority,'GetThreadPriority',\
GetThreadPriorityBoost,'GetThreadPriorityBoost',\
GetThreadSelectorEntry,'GetThreadSelectorEntry',\
GetThreadTimes,'GetThreadTimes',\
GetTickCount,'GetTickCount',\
GetTimeFormatA,'GetTimeFormatA',\
GetTimeFormatW,'GetTimeFormatW',\
GetTimeZoneInformation,'GetTimeZoneInformation',\
GetUserDefaultLCID,'GetUserDefaultLCID',\
GetUserDefaultLangID,'GetUserDefaultLangID',\
GetVDMCurrentDirectories,'GetVDMCurrentDirectories',\
GetVersion,'GetVersion',\
GetVersionExA,'GetVersionExA',\
GetVersionExW,'GetVersionExW',\
GetVolumeInformationA,'GetVolumeInformationA',\
GetVolumeInformationW,'GetVolumeInformationW',\
GetWindowsDirectoryA,'GetWindowsDirectoryA',\
GetWindowsDirectoryW,'GetWindowsDirectoryW',\
GlobalAddAtomA,'GlobalAddAtomA',\
GlobalAddAtomW,'GlobalAddAtomW',\
GlobalAlloc,'GlobalAlloc',\
GlobalCompact,'GlobalCompact',\
GlobalDeleteAtom,'GlobalDeleteAtom',\
GlobalFindAtomA,'GlobalFindAtomA',\
GlobalFindAtomW,'GlobalFindAtomW',\
GlobalFix,'GlobalFix',\
GlobalFlags,'GlobalFlags',\
GlobalFree,'GlobalFree',\
GlobalGetAtomNameA,'GlobalGetAtomNameA',\
GlobalGetAtomNameW,'GlobalGetAtomNameW',\
GlobalHandle,'GlobalHandle',\
GlobalLock,'GlobalLock',\
GlobalMemoryStatus,'GlobalMemoryStatus',\
GlobalMemoryStatusVlm,'GlobalMemoryStatusVlm',\
GlobalReAlloc,'GlobalReAlloc',\
GlobalSize,'GlobalSize',\
GlobalUnWire,'GlobalUnWire',\
GlobalUnfix,'GlobalUnfix',\
GlobalUnlock,'GlobalUnlock',\
GlobalWire,'GlobalWire',\
Heap32First,'Heap32First',\
Heap32ListFirst,'Heap32ListFirst',\
Heap32ListNext,'Heap32ListNext',\
Heap32Next,'Heap32Next',\
HeapAlloc,'HeapAlloc',\
HeapCompact,'HeapCompact',\
HeapCreate,'HeapCreate',\
HeapDestroy,'HeapDestroy',\
HeapExtend,'HeapExtend',\
HeapFree,'HeapFree',\
HeapLock,'HeapLock',\
HeapReAlloc,'HeapReAlloc',\
HeapSize,'HeapSize',\
HeapSummary,'HeapSummary',\
HeapUnlock,'HeapUnlock',\
HeapUsage,'HeapUsage',\
HeapValidate,'HeapValidate',\
HeapWalk,'HeapWalk',\
InitAtomTable,'InitAtomTable',\
InitializeCriticalSection,'InitializeCriticalSection',\
InitializeCriticalSectionAndSpinCount,'InitializeCriticalSectionAndSpinCount',\
InterlockedCompareExchange,'InterlockedCompareExchange',\
InterlockedDecrement,'InterlockedDecrement',\
InterlockedExchange,'InterlockedExchange',\
InterlockedExchangeAdd,'InterlockedExchangeAdd',\
InterlockedIncrement,'InterlockedIncrement',\
InvalidateConsoleDIBits,'InvalidateConsoleDIBits',\
IsBadCodePtr,'IsBadCodePtr',\
IsBadHugeReadPtr,'IsBadHugeReadPtr',\
IsBadHugeWritePtr,'IsBadHugeWritePtr',\
IsBadReadPtr,'IsBadReadPtr',\
IsBadStringPtrA,'IsBadStringPtrA',\
IsBadStringPtrW,'IsBadStringPtrW',\
IsBadWritePtr,'IsBadWritePtr',\
IsDBCSLeadByte,'IsDBCSLeadByte',\
IsDBCSLeadByteEx,'IsDBCSLeadByteEx',\
IsDebuggerPresent,'IsDebuggerPresent',\
IsProcessorFeaturePresent,'IsProcessorFeaturePresent',\
IsValidCodePage,'IsValidCodePage',\
IsValidLocale,'IsValidLocale',\
LCMapStringA,'LCMapStringA',\
LCMapStringW,'LCMapStringW',\
LeaveCriticalSection,'LeaveCriticalSection',\
LoadLibraryA,'LoadLibraryA',\
LoadLibraryW,'LoadLibraryW',\
LoadLibraryExA,'LoadLibraryExA',\
LoadLibraryExW,'LoadLibraryExW',\
LoadModule,'LoadModule',\
LoadResource,'LoadResource',\
LocalAlloc,'LocalAlloc',\
LocalCompact,'LocalCompact',\
LocalFileTimeToFileTime,'LocalFileTimeToFileTime',\
LocalFlags,'LocalFlags',\
LocalFree,'LocalFree',\
LocalHandle,'LocalHandle',\
LocalLock,'LocalLock',\
LocalReAlloc,'LocalReAlloc',\
LocalShrink,'LocalShrink',\
LocalSize,'LocalSize',\
LocalUnlock,'LocalUnlock',\
LockFile,'LockFile',\
LockFileEx,'LockFileEx',\
LockResource,'LockResource',\
MapViewOfFile,'MapViewOfFile',\
MapViewOfFileEx,'MapViewOfFileEx',\
MapViewOfFileVlm,'MapViewOfFileVlm',\
Module32First,'Module32First',\
Module32Next,'Module32Next',\
MoveFileA,'MoveFileA',\
MoveFileW,'MoveFileW',\
MoveFileExA,'MoveFileExA',\
MoveFileExW,'MoveFileExW',\
MoveFileWithProgressA,'MoveFileWithProgressA',\
MoveFileWithProgressW,'MoveFileWithProgressW',\
MulDiv,'MulDiv',\
MultiByteToWideChar,'MultiByteToWideChar',\
OpenEventA,'OpenEventA',\
OpenEventW,'OpenEventW',\
OpenFile,'OpenFile',\
OpenFileMappingA,'OpenFileMappingA',\
OpenFileMappingW,'OpenFileMappingW',\
OpenJobObjectA,'OpenJobObjectA',\
OpenJobObjectW,'OpenJobObjectW',\
OpenMutexA,'OpenMutexA',\
OpenMutexW,'OpenMutexW',\
OpenProcess,'OpenProcess',\
OpenProfileUserMapping,'OpenProfileUserMapping',\
OpenSemaphoreA,'OpenSemaphoreA',\
OpenSemaphoreW,'OpenSemaphoreW',\
OpenWaitableTimerA,'OpenWaitableTimerA',\
OpenWaitableTimerW,'OpenWaitableTimerW',\
OutputDebugStringA,'OutputDebugStringA',\
OutputDebugStringW,'OutputDebugStringW',\
PeekConsoleInputA,'PeekConsoleInputA',\
PeekConsoleInputW,'PeekConsoleInputW',\
PeekNamedPipe,'PeekNamedPipe',\
PostQueuedCompletionStatus,'PostQueuedCompletionStatus',\
PrepareTape,'PrepareTape',\
Process32First,'Process32First',\
Process32Next,'Process32Next',\
PulseEvent,'PulseEvent',\
PurgeComm,'PurgeComm',\
QueryDosDeviceA,'QueryDosDeviceA',\
QueryDosDeviceW,'QueryDosDeviceW',\
QueryInformationJobObject,'QueryInformationJobObject',\
QueryPerformanceCounter,'QueryPerformanceCounter',\
QueryPerformanceFrequency,'QueryPerformanceFrequency',\
QueryWin31IniFilesMappedToRegistry,'QueryWin31IniFilesMappedToRegistry',\
QueueUserAPC,'QueueUserAPC',\
RaiseException,'RaiseException',\
ReadConsoleA,'ReadConsoleA',\
ReadConsoleW,'ReadConsoleW',\
ReadConsoleInputA,'ReadConsoleInputA',\
ReadConsoleInputW,'ReadConsoleInputW',\
ReadConsoleInputExA,'ReadConsoleInputExA',\
ReadConsoleInputExW,'ReadConsoleInputExW',\
ReadConsoleOutputA,'ReadConsoleOutputA',\
ReadConsoleOutputW,'ReadConsoleOutputW',\
ReadConsoleOutputAttribute,'ReadConsoleOutputAttribute',\
ReadConsoleOutputCharacterA,'ReadConsoleOutputCharacterA',\
ReadConsoleOutputCharacterW,'ReadConsoleOutputCharacterW',\
ReadFile,'ReadFile',\
ReadFileEx,'ReadFileEx',\
ReadFileScatter,'ReadFileScatter',\
ReadFileVlm,'ReadFileVlm',\
ReadProcessMemory,'ReadProcessMemory',\
ReadProcessMemoryVlm,'ReadProcessMemoryVlm',\
RegisterConsoleVDM,'RegisterConsoleVDM',\
RegisterWaitForInputIdle,'RegisterWaitForInputIdle',\
RegisterWowBaseHandlers,'RegisterWowBaseHandlers',\
RegisterWowExec,'RegisterWowExec',\
ReleaseMutex,'ReleaseMutex',\
ReleaseSemaphore,'ReleaseSemaphore',\
RemoveDirectoryA,'RemoveDirectoryA',\
RemoveDirectoryW,'RemoveDirectoryW',\
RequestWakeupLatency,'RequestWakeupLatency',\
ResetEvent,'ResetEvent',\
ResumeThread,'ResumeThread',\
RtlFillMemory,'RtlFillMemory',\
RtlMoveMemory,'RtlMoveMemory',\
RtlUnwind,'RtlUnwind',\
RtlZeroMemory,'RtlZeroMemory',\
ScrollConsoleScreenBufferA,'ScrollConsoleScreenBufferA',\
ScrollConsoleScreenBufferW,'ScrollConsoleScreenBufferW',\
SearchPathA,'SearchPathA',\
SearchPathW,'SearchPathW',\
SetCommBreak,'SetCommBreak',\
SetCommConfig,'SetCommConfig',\
SetCommMask,'SetCommMask',\
SetCommState,'SetCommState',\
SetCommTimeouts,'SetCommTimeouts',\
SetComputerNameA,'SetComputerNameA',\
SetComputerNameW,'SetComputerNameW',\
SetConsoleActiveScreenBuffer,'SetConsoleActiveScreenBuffer',\
SetConsoleCP,'SetConsoleCP',\
SetConsoleCommandHistoryMode,'SetConsoleCommandHistoryMode',\
SetConsoleCtrlHandler,'SetConsoleCtrlHandler',\
SetConsoleCursor,'SetConsoleCursor',\
SetConsoleCursorInfo,'SetConsoleCursorInfo',\
SetConsoleCursorPosition,'SetConsoleCursorPosition',\
SetConsoleDisplayMode,'SetConsoleDisplayMode',\
SetConsoleFont,'SetConsoleFont',\
SetConsoleHardwareState,'SetConsoleHardwareState',\
SetConsoleIcon,'SetConsoleIcon',\
SetConsoleInputExeNameA,'SetConsoleInputExeNameA',\
SetConsoleInputExeNameW,'SetConsoleInputExeNameW',\
SetConsoleKeyShortcuts,'SetConsoleKeyShortcuts',\
SetConsoleMaximumWindowSize,'SetConsoleMaximumWindowSize',\
SetConsoleMenuClose,'SetConsoleMenuClose',\
SetConsoleMode,'SetConsoleMode',\
SetConsoleNumberOfCommandsA,'SetConsoleNumberOfCommandsA',\
SetConsoleNumberOfCommandsW,'SetConsoleNumberOfCommandsW',\
SetConsoleOutputCP,'SetConsoleOutputCP',\
SetConsolePalette,'SetConsolePalette',\
SetConsoleScreenBufferSize,'SetConsoleScreenBufferSize',\
SetConsoleTextAttribute,'SetConsoleTextAttribute',\
SetConsoleTitleA,'SetConsoleTitleA',\
SetConsoleTitleW,'SetConsoleTitleW',\
SetConsoleWindowInfo,'SetConsoleWindowInfo',\
SetCriticalSectionSpinCount,'SetCriticalSectionSpinCount',\
SetCurrentDirectoryA,'SetCurrentDirectoryA',\
SetCurrentDirectoryW,'SetCurrentDirectoryW',\
SetDefaultCommConfigA,'SetDefaultCommConfigA',\
SetDefaultCommConfigW,'SetDefaultCommConfigW',\
SetEndOfFile,'SetEndOfFile',\
SetEnvironmentVariableA,'SetEnvironmentVariableA',\
SetEnvironmentVariableW,'SetEnvironmentVariableW',\
SetErrorMode,'SetErrorMode',\
SetEvent,'SetEvent',\
SetFileApisToANSI,'SetFileApisToANSI',\
SetFileApisToOEM,'SetFileApisToOEM',\
SetFileAttributesA,'SetFileAttributesA',\
SetFileAttributesW,'SetFileAttributesW',\
SetFilePointer,'SetFilePointer',\
SetFilePointerEx,'SetFilePointerEx',\
SetFileTime,'SetFileTime',\
SetHandleCount,'SetHandleCount',\
SetHandleInformation,'SetHandleInformation',\
SetInformationJobObject,'SetInformationJobObject',\
SetLastConsoleEventActive,'SetLastConsoleEventActive',\
SetLastError,'SetLastError',\
SetLocalTime,'SetLocalTime',\
SetLocaleInfoA,'SetLocaleInfoA',\
SetLocaleInfoW,'SetLocaleInfoW',\
SetMailslotInfo,'SetMailslotInfo',\
SetNamedPipeHandleState,'SetNamedPipeHandleState',\
SetPriorityClass,'SetPriorityClass',\
SetProcessAffinityMask,'SetProcessAffinityMask',\
SetProcessPriorityBoost,'SetProcessPriorityBoost',\
SetProcessShutdownParameters,'SetProcessShutdownParameters',\
SetProcessWorkingSetSize,'SetProcessWorkingSetSize',\
SetStdHandle,'SetStdHandle',\
SetSystemPowerState,'SetSystemPowerState',\
SetSystemTime,'SetSystemTime',\
SetSystemTimeAdjustment,'SetSystemTimeAdjustment',\
SetTapeParameters,'SetTapeParameters',\
SetTapePosition,'SetTapePosition',\
SetThreadAffinityMask,'SetThreadAffinityMask',\
SetThreadContext,'SetThreadContext',\
SetThreadExecutionState,'SetThreadExecutionState',\
SetThreadIdealProcessor,'SetThreadIdealProcessor',\
SetThreadLocale,'SetThreadLocale',\
SetThreadPriority,'SetThreadPriority',\
SetThreadPriorityBoost,'SetThreadPriorityBoost',\
SetTimeZoneInformation,'SetTimeZoneInformation',\
SetUnhandledExceptionFilter,'SetUnhandledExceptionFilter',\
SetVDMCurrentDirectories,'SetVDMCurrentDirectories',\
SetVolumeLabelA,'SetVolumeLabelA',\
SetVolumeLabelW,'SetVolumeLabelW',\
SetWaitableTimer,'SetWaitableTimer',\
SetupComm,'SetupComm',\
ShowConsoleCursor,'ShowConsoleCursor',\
SignalObjectAndWait,'SignalObjectAndWait',\
SizeofResource,'SizeofResource',\
Sleep,'Sleep',\
SleepEx,'SleepEx',\
SuspendThread,'SuspendThread',\
SwitchToFiber,'SwitchToFiber',\
SwitchToThread,'SwitchToThread',\
SystemTimeToFileTime,'SystemTimeToFileTime',\
SystemTimeToTzSpecificLocalTime,'SystemTimeToTzSpecificLocalTime',\
TerminateJobObject,'TerminateJobObject',\
TerminateProcess,'TerminateProcess',\
TerminateThread,'TerminateThread',\
Thread32First,'Thread32First',\
Thread32Next,'Thread32Next',\
TlsAlloc,'TlsAlloc',\
TlsFree,'TlsFree',\
TlsGetValue,'TlsGetValue',\
TlsSetValue,'TlsSetValue',\
Toolhelp32ReadProcessMemory,'Toolhelp32ReadProcessMemory',\
TransactNamedPipe,'TransactNamedPipe',\
TransmitCommChar,'TransmitCommChar',\
TrimVirtualBuffer,'TrimVirtualBuffer',\
TryEnterCriticalSection,'TryEnterCriticalSection',\
UnhandledExceptionFilter,'UnhandledExceptionFilter',\
UnlockFile,'UnlockFile',\
UnlockFileEx,'UnlockFileEx',\
UnmapViewOfFile,'UnmapViewOfFile',\
UnmapViewOfFileVlm,'UnmapViewOfFileVlm',\
UpdateResourceA,'UpdateResourceA',\
UpdateResourceW,'UpdateResourceW',\
VDMConsoleOperation,'VDMConsoleOperation',\
VDMOperationStarted,'VDMOperationStarted',\
VerLanguageNameA,'VerLanguageNameA',\
VerLanguageNameW,'VerLanguageNameW',\
VerifyConsoleIoHandle,'VerifyConsoleIoHandle',\
VirtualAlloc,'VirtualAlloc',\
VirtualAllocEx,'VirtualAllocEx',\
VirtualAllocVlm,'VirtualAllocVlm',\
VirtualBufferExceptionHandler,'VirtualBufferExceptionHandler',\
VirtualFree,'VirtualFree',\
VirtualFreeEx,'VirtualFreeEx',\
VirtualFreeVlm,'VirtualFreeVlm',\
VirtualLock,'VirtualLock',\
VirtualProtect,'VirtualProtect',\
VirtualProtectEx,'VirtualProtectEx',\
VirtualProtectVlm,'VirtualProtectVlm',\
VirtualQuery,'VirtualQuery',\
VirtualQueryEx,'VirtualQueryEx',\
VirtualQueryVlm,'VirtualQueryVlm',\
VirtualUnlock,'VirtualUnlock',\
WaitCommEvent,'WaitCommEvent',\
WaitForDebugEvent,'WaitForDebugEvent',\
WaitForMultipleObjects,'WaitForMultipleObjects',\
WaitForMultipleObjectsEx,'WaitForMultipleObjectsEx',\
WaitForSingleObject,'WaitForSingleObject',\
WaitForSingleObjectEx,'WaitForSingleObjectEx',\
WaitNamedPipeA,'WaitNamedPipeA',\
WaitNamedPipeW,'WaitNamedPipeW',\
WideCharToMultiByte,'WideCharToMultiByte',\
WinExec,'WinExec',\
WriteConsoleA,'WriteConsoleA',\
WriteConsoleW,'WriteConsoleW',\
WriteConsoleInputA,'WriteConsoleInputA',\
WriteConsoleInputW,'WriteConsoleInputW',\
WriteConsoleInputVDMA,'WriteConsoleInputVDMA',\
WriteConsoleInputVDMW,'WriteConsoleInputVDMW',\
WriteConsoleOutputA,'WriteConsoleOutputA',\
WriteConsoleOutputW,'WriteConsoleOutputW',\
WriteConsoleOutputAttribute,'WriteConsoleOutputAttribute',\
WriteConsoleOutputCharacterA,'WriteConsoleOutputCharacterA',\
WriteConsoleOutputCharacterW,'WriteConsoleOutputCharacterW',\
WriteFile,'WriteFile',\
WriteFileEx,'WriteFileEx',\
WriteFileGather,'WriteFileGather',\
WriteFileVlm,'WriteFileVlm',\
WritePrivateProfileSectionA,'WritePrivateProfileSectionA',\
WritePrivateProfileSectionW,'WritePrivateProfileSectionW',\
WritePrivateProfileStringA,'WritePrivateProfileStringA',\
WritePrivateProfileStringW,'WritePrivateProfileStringW',\
WritePrivateProfileStructA,'WritePrivateProfileStructA',\
WritePrivateProfileStructW,'WritePrivateProfileStructW',\
WriteProcessMemory,'WriteProcessMemory',\
WriteProcessMemoryVlm,'WriteProcessMemoryVlm',\
WriteProfileSectionA,'WriteProfileSectionA',\
WriteProfileSectionW,'WriteProfileSectionW',\
WriteProfileStringA,'WriteProfileStringA',\
WriteProfileStringW,'WriteProfileStringW',\
WriteTapemark,'WriteTapemark',\
_hread,'_hread',\
_hwrite,'_hwrite',\
_lclose,'_lclose',\
_lcreat,'_lcreat',\
_llseek,'_llseek',\
_lopen,'_lopen',\
_lread,'_lread',\
_lwrite,'_lwrite',\
lstrcatA,'lstrcatA',\
lstrcatW,'lstrcatW',\
lstrcmpA,'lstrcmpA',\
lstrcmpW,'lstrcmpW',\
lstrcmpiA,'lstrcmpiA',\
lstrcmpiW,'lstrcmpiW',\
lstrcpyA,'lstrcpyA',\
lstrcpyW,'lstrcpyW',\
lstrcpynA,'lstrcpynA',\
lstrcpynW,'lstrcpynW',\
lstrlenA,'lstrlenA',\
lstrlenW,'lstrlenW'
api AddAtom,\
AddConsoleAlias,\
BeginUpdateResource,\
BuildCommDCB,\
BuildCommDCBAndTimeouts,\
CallNamedPipe,\
CommConfigDialog,\
CompareString,\
CopyFile,\
CopyFileEx,\
CreateDirectory,\
CreateDirectoryEx,\
CreateEvent,\
CreateFile,\
CreateFileMapping,\
CreateHardLink,\
CreateJobObject,\
CreateMailslot,\
CreateMutex,\
CreateNamedPipe,\
CreateProcess,\
CreateSemaphore,\
CreateWaitableTimer,\
DefineDosDevice,\
DeleteFile,\
EndUpdateResource,\
EnumCalendarInfo,\
EnumCalendarInfoEx,\
EnumDateFormats,\
EnumDateFormatsEx,\
EnumResourceLanguages,\
EnumResourceNames,\
EnumResourceTypes,\
EnumSystemCodePages,\
EnumSystemLocales,\
EnumTimeFormats,\
ExpandEnvironmentStrings,\
ExpungeConsoleCommandHistory,\
FatalAppExit,\
FillConsoleOutputCharacter,\
FindAtom,\
FindFirstChangeNotification,\
FindFirstFile,\
FindFirstFileEx,\
FindNextFile,\
FindResource,\
FindResourceEx,\
FoldString,\
FormatMessage,\
FreeEnvironmentStrings,\
GetAtomName,\
GetBinaryType,\
GetCPInfoEx,\
GetCommandLine,\
GetCompressedFileSize,\
GetComputerName,\
GetConsoleAlias,\
GetConsoleAliasExes,\
GetConsoleAliasExesLength,\
GetConsoleAliases,\
GetConsoleAliasesLength,\
GetConsoleCommandHistory,\
GetConsoleCommandHistoryLength,\
GetConsoleInputExeName,\
GetConsoleKeyboardLayoutName,\
GetConsoleTitle,\
GetCurrencyFormat,\
GetCurrentDirectory,\
GetDateFormat,\
GetDefaultCommConfig,\
GetDiskFreeSpace,\
GetDiskFreeSpaceEx,\
GetDriveType,\
GetEnvironmentStrings,\
GetEnvironmentVariable,\
GetFileAttributes,\
GetFileAttributesEx,\
GetFullPathName,\
GetLocaleInfo,\
GetLogicalDriveStrings,\
GetLongPathName,\
GetModuleFileName,\
GetModuleHandle,\
GetNamedPipeHandleState,\
GetNumberFormat,\
GetPrivateProfileInt,\
GetPrivateProfileSection,\
GetPrivateProfileSectionNames,\
GetPrivateProfileString,\
GetPrivateProfileStruct,\
GetProfileInt,\
GetProfileSection,\
GetProfileString,\
GetShortPathName,\
GetStartupInfo,\
GetStringType,\
GetStringTypeEx,\
GetSystemDirectory,\
GetTempFileName,\
GetTempPath,\
GetTimeFormat,\
GetVersionEx,\
GetVolumeInformation,\
GetWindowsDirectory,\
GlobalAddAtom,\
GlobalFindAtom,\
GlobalGetAtomName,\
IsBadStringPtr,\
LCMapString,\
LoadLibrary,\
LoadLibraryEx,\
MoveFile,\
MoveFileEx,\
MoveFileWithProgress,\
OpenEvent,\
OpenFileMapping,\
OpenJobObject,\
OpenMutex,\
OpenSemaphore,\
OpenWaitableTimer,\
OutputDebugString,\
PeekConsoleInput,\
QueryDosDevice,\
ReadConsole,\
ReadConsoleInput,\
ReadConsoleInputEx,\
ReadConsoleOutput,\
ReadConsoleOutputCharacter,\
RemoveDirectory,\
ScrollConsoleScreenBuffer,\
SearchPath,\
SetComputerName,\
SetConsoleInputExeName,\
SetConsoleNumberOfCommands,\
SetConsoleTitle,\
SetCurrentDirectory,\
SetDefaultCommConfig,\
SetEnvironmentVariable,\
SetFileAttributes,\
SetLocaleInfo,\
SetVolumeLabel,\
UpdateResource,\
VerLanguageName,\
WaitNamedPipe,\
WriteConsole,\
WriteConsoleInput,\
WriteConsoleInputVDM,\
WriteConsoleOutput,\
WriteConsoleOutputCharacter,\
WritePrivateProfileSection,\
WritePrivateProfileString,\
WritePrivateProfileStruct,\
WriteProfileSection,\
WriteProfileString,\
lstrcat,\
lstrcmp,\
lstrcmpi,\
lstrcpy,\
lstrcpyn,\
lstrlen

View File

@ -0,0 +1,167 @@
; SHELL32 API calls
import shell32,\
CheckEscapesA,'CheckEscapesA',\
CheckEscapesW,'CheckEscapesW',\
DoEnvironmentSubstA,'DoEnvironmentSubstA',\
DoEnvironmentSubstW,'DoEnvironmentSubstW',\
DragAcceptFiles,'DragAcceptFiles',\
DragFinish,'DragFinish',\
DragQueryFileA,'DragQueryFileA',\
DragQueryFileW,'DragQueryFileW',\
DragQueryPoint,'DragQueryPoint',\
DuplicateIcon,'DuplicateIcon',\
ExtractAssociatedIconA,'ExtractAssociatedIconA',\
ExtractAssociatedIconW,'ExtractAssociatedIconW',\
ExtractAssociatedIconExA,'ExtractAssociatedIconExA',\
ExtractAssociatedIconExW,'ExtractAssociatedIconExW',\
ExtractIconA,'ExtractIconA',\
ExtractIconW,'ExtractIconW',\
ExtractIconExA,'ExtractIconExA',\
ExtractIconExW,'ExtractIconExW',\
ExtractIconResInfoA,'ExtractIconResInfoA',\
ExtractIconResInfoW,'ExtractIconResInfoW',\
FindExeDlgProc,'FindExeDlgProc',\
FindExecutableA,'FindExecutableA',\
FindExecutableW,'FindExecutableW',\
FreeIconList,'FreeIconList',\
InternalExtractIconListA,'InternalExtractIconListA',\
InternalExtractIconListW,'InternalExtractIconListW',\
RealShellExecuteA,'RealShellExecuteA',\
RealShellExecuteW,'RealShellExecuteW',\
RealShellExecuteExA,'RealShellExecuteExA',\
RealShellExecuteExW,'RealShellExecuteExW',\
RegenerateUserEnvironment,'RegenerateUserEnvironment',\
SHAddToRecentDocs,'SHAddToRecentDocs',\
SHAppBarMessage,'SHAppBarMessage',\
SHBrowseForFolderA,'SHBrowseForFolderA',\
SHBrowseForFolderW,'SHBrowseForFolderW',\
SHChangeNotify,'SHChangeNotify',\
SHEmptyRecycleBinA,'SHEmptyRecycleBinA',\
SHEmptyRecycleBinW,'SHEmptyRecycleBinW',\
SHFileOperationA,'SHFileOperationA',\
SHFileOperationW,'SHFileOperationW',\
SHFormatDrive,'SHFormatDrive',\
SHFreeNameMappings,'SHFreeNameMappings',\
SHGetDataFromIDListA,'SHGetDataFromIDListA',\
SHGetDataFromIDListW,'SHGetDataFromIDListW',\
SHGetDesktopFolder,'SHGetDesktopFolder',\
SHGetDiskFreeSpaceA,'SHGetDiskFreeSpaceA',\
SHGetDiskFreeSpaceW,'SHGetDiskFreeSpaceW',\
SHGetFileInfoA,'SHGetFileInfoA',\
SHGetFileInfoW,'SHGetFileInfoW',\
SHGetInstanceExplorer,'SHGetInstanceExplorer',\
SHGetMalloc,'SHGetMalloc',\
SHGetNewLinkInfo,'SHGetNewLinkInfo',\
SHGetPathFromIDListA,'SHGetPathFromIDListA',\
SHGetPathFromIDListW,'SHGetPathFromIDListW',\
SHGetSettings,'SHGetSettings',\
SHGetSpecialFolderLocation,'SHGetSpecialFolderLocation',\
SHGetSpecialFolderPathA,'SHGetSpecialFolderPathA',\
SHGetSpecialFolderPathW,'SHGetSpecialFolderPathW',\
SHInvokePrinterCommandA,'SHInvokePrinterCommandA',\
SHInvokePrinterCommandW,'SHInvokePrinterCommandW',\
SHLoadInProc,'SHLoadInProc',\
SHQueryRecycleBinA,'SHQueryRecycleBinA',\
SHQueryRecycleBinW,'SHQueryRecycleBinW',\
SHUpdateRecycleBinIcon,'SHUpdateRecycleBinIcon',\
SheChangeDirA,'SheChangeDirA',\
SheChangeDirW,'SheChangeDirW',\
SheChangeDirExA,'SheChangeDirExA',\
SheChangeDirExW,'SheChangeDirExW',\
SheFullPathA,'SheFullPathA',\
SheFullPathW,'SheFullPathW',\
SheGetCurDrive,'SheGetCurDrive',\
SheGetDirA,'SheGetDirA',\
SheGetDirW,'SheGetDirW',\
SheRemoveQuotesA,'SheRemoveQuotesA',\
SheRemoveQuotesW,'SheRemoveQuotesW',\
SheSetCurDrive,'SheSetCurDrive',\
SheShortenPathA,'SheShortenPathA',\
SheShortenPathW,'SheShortenPathW',\
ShellAboutA,'ShellAboutA',\
ShellAboutW,'ShellAboutW',\
ShellExecuteA,'ShellExecuteA',\
ShellExecuteW,'ShellExecuteW',\
ShellExecuteExA,'ShellExecuteExA',\
ShellExecuteExW,'ShellExecuteExW',\
ShellHookProc,'ShellHookProc',\
Shell_NotifyIconA,'Shell_NotifyIconA',\
Shell_NotifyIconW,'Shell_NotifyIconW',\
StrChrA,'StrChrA',\
StrChrW,'StrChrW',\
StrChrIA,'StrChrIA',\
StrChrIW,'StrChrIW',\
StrCmpNA,'StrCmpNA',\
StrCmpNW,'StrCmpNW',\
StrCmpNIA,'StrCmpNIA',\
StrCmpNIW,'StrCmpNIW',\
StrCpyNA,'StrCpyNA',\
StrCpyNW,'StrCpyNW',\
StrNCmpA,'StrNCmpA',\
StrNCmpW,'StrNCmpW',\
StrNCmpIA,'StrNCmpIA',\
StrNCmpIW,'StrNCmpIW',\
StrNCpyA,'StrNCpyA',\
StrNCpyW,'StrNCpyW',\
StrRChrA,'StrRChrA',\
StrRChrW,'StrRChrW',\
StrRChrIA,'StrRChrIA',\
StrRChrIW,'StrRChrIW',\
StrRStrA,'StrRStrA',\
StrRStrW,'StrRStrW',\
StrRStrIA,'StrRStrIA',\
StrRStrIW,'StrRStrIW',\
StrStrA,'StrStrA',\
StrStrW,'StrStrW',\
StrStrIA,'StrStrIA',\
StrStrIW,'StrStrIW',\
WOWShellExecute,'WOWShellExecute'
api CheckEscapes,\
DoEnvironmentSubst,\
DragQueryFile,\
ExtractAssociatedIcon,\
ExtractAssociatedIconEx,\
ExtractIcon,\
ExtractIconEx,\
ExtractIconResInfo,\
FindExecutable,\
InternalExtractIconList,\
RealShellExecute,\
RealShellExecuteEx,\
SHBrowseForFolder,\
SHEmptyRecycleBin,\
SHFileOperation,\
SHGetDataFromIDList,\
SHGetDiskFreeSpace,\
SHGetFileInfo,\
SHGetPathFromIDList,\
SHGetSpecialFolderPath,\
SHInvokePrinterCommand,\
SHQueryRecycleBin,\
SheChangeDir,\
SheChangeDirEx,\
SheFullPath,\
SheGetDir,\
SheRemoveQuotes,\
SheShortenPath,\
ShellAbout,\
ShellExecute,\
ShellExecuteEx,\
Shell_NotifyIcon,\
StrChr,\
StrChrI,\
StrCmpN,\
StrCmpNI,\
StrCpyN,\
StrNCmp,\
StrNCmpI,\
StrNCpy,\
StrRChr,\
StrRChrI,\
StrRStr,\
StrRStrI,\
StrStr,\
StrStrI

View File

@ -0,0 +1,756 @@
; USER32 API calls
import user32,\
ActivateKeyboardLayout,'ActivateKeyboardLayout',\
AdjustWindowRect,'AdjustWindowRect',\
AdjustWindowRectEx,'AdjustWindowRectEx',\
AnimateWindow,'AnimateWindow',\
AnyPopup,'AnyPopup',\
AppendMenuA,'AppendMenuA',\
AppendMenuW,'AppendMenuW',\
ArrangeIconicWindows,'ArrangeIconicWindows',\
AttachThreadInput,'AttachThreadInput',\
BeginDeferWindowPos,'BeginDeferWindowPos',\
BeginPaint,'BeginPaint',\
BlockInput,'BlockInput',\
BringWindowToTop,'BringWindowToTop',\
BroadcastSystemMessageA,'BroadcastSystemMessageA',\
BroadcastSystemMessageW,'BroadcastSystemMessageW',\
CallMsgFilterA,'CallMsgFilterA',\
CallMsgFilterW,'CallMsgFilterW',\
CallNextHookEx,'CallNextHookEx',\
CallWindowProcA,'CallWindowProcA',\
CallWindowProcW,'CallWindowProcW',\
CascadeChildWindows,'CascadeChildWindows',\
CascadeWindows,'CascadeWindows',\
ChangeClipboardChain,'ChangeClipboardChain',\
ChangeDisplaySettingsA,'ChangeDisplaySettingsA',\
ChangeDisplaySettingsW,'ChangeDisplaySettingsW',\
ChangeDisplaySettingsExA,'ChangeDisplaySettingsExA',\
ChangeDisplaySettingsExW,'ChangeDisplaySettingsExW',\
ChangeMenuA,'ChangeMenuA',\
ChangeMenuW,'ChangeMenuW',\
CharLowerA,'CharLowerA',\
CharLowerW,'CharLowerW',\
CharLowerBuffA,'CharLowerBuffA',\
CharLowerBuffW,'CharLowerBuffW',\
CharNextA,'CharNextA',\
CharNextW,'CharNextW',\
CharNextExA,'CharNextExA',\
CharNextExW,'CharNextExW',\
CharPrevA,'CharPrevA',\
CharPrevW,'CharPrevW',\
CharPrevExA,'CharPrevExA',\
CharPrevExW,'CharPrevExW',\
CharToOemA,'CharToOemA',\
CharToOemW,'CharToOemW',\
CharToOemBuffA,'CharToOemBuffA',\
CharToOemBuffW,'CharToOemBuffW',\
CharUpperA,'CharUpperA',\
CharUpperW,'CharUpperW',\
CharUpperBuffA,'CharUpperBuffA',\
CharUpperBuffW,'CharUpperBuffW',\
CheckDlgButton,'CheckDlgButton',\
CheckMenuItem,'CheckMenuItem',\
CheckMenuRadioItem,'CheckMenuRadioItem',\
CheckRadioButton,'CheckRadioButton',\
ChildWindowFromPoint,'ChildWindowFromPoint',\
ChildWindowFromPointEx,'ChildWindowFromPointEx',\
ClientToScreen,'ClientToScreen',\
ClipCursor,'ClipCursor',\
CloseClipboard,'CloseClipboard',\
CloseDesktop,'CloseDesktop',\
CloseWindow,'CloseWindow',\
CloseWindowStation,'CloseWindowStation',\
CopyAcceleratorTableA,'CopyAcceleratorTableA',\
CopyAcceleratorTableW,'CopyAcceleratorTableW',\
CopyIcon,'CopyIcon',\
CopyImage,'CopyImage',\
CopyRect,'CopyRect',\
CountClipboardFormats,'CountClipboardFormats',\
CreateAcceleratorTableA,'CreateAcceleratorTableA',\
CreateAcceleratorTableW,'CreateAcceleratorTableW',\
CreateCaret,'CreateCaret',\
CreateCursor,'CreateCursor',\
CreateDesktopA,'CreateDesktopA',\
CreateDesktopW,'CreateDesktopW',\
CreateDialogIndirectParamA,'CreateDialogIndirectParamA',\
CreateDialogIndirectParamW,'CreateDialogIndirectParamW',\
CreateDialogParamA,'CreateDialogParamA',\
CreateDialogParamW,'CreateDialogParamW',\
CreateIcon,'CreateIcon',\
CreateIconFromResource,'CreateIconFromResource',\
CreateIconFromResourceEx,'CreateIconFromResourceEx',\
CreateIconIndirect,'CreateIconIndirect',\
CreateMDIWindowA,'CreateMDIWindowA',\
CreateMDIWindowW,'CreateMDIWindowW',\
CreateMenu,'CreateMenu',\
CreatePopupMenu,'CreatePopupMenu',\
CreateWindowExA,'CreateWindowExA',\
CreateWindowExW,'CreateWindowExW',\
CreateWindowStationA,'CreateWindowStationA',\
CreateWindowStationW,'CreateWindowStationW',\
DdeAbandonTransaction,'DdeAbandonTransaction',\
DdeAccessData,'DdeAccessData',\
DdeAddData,'DdeAddData',\
DdeClientTransaction,'DdeClientTransaction',\
DdeCmpStringHandles,'DdeCmpStringHandles',\
DdeConnect,'DdeConnect',\
DdeConnectList,'DdeConnectList',\
DdeCreateDataHandle,'DdeCreateDataHandle',\
DdeCreateStringHandleA,'DdeCreateStringHandleA',\
DdeCreateStringHandleW,'DdeCreateStringHandleW',\
DdeDisconnect,'DdeDisconnect',\
DdeDisconnectList,'DdeDisconnectList',\
DdeEnableCallback,'DdeEnableCallback',\
DdeFreeDataHandle,'DdeFreeDataHandle',\
DdeFreeStringHandle,'DdeFreeStringHandle',\
DdeGetData,'DdeGetData',\
DdeGetLastError,'DdeGetLastError',\
DdeGetQualityOfService,'DdeGetQualityOfService',\
DdeImpersonateClient,'DdeImpersonateClient',\
DdeInitializeA,'DdeInitializeA',\
DdeInitializeW,'DdeInitializeW',\
DdeKeepStringHandle,'DdeKeepStringHandle',\
DdeNameService,'DdeNameService',\
DdePostAdvise,'DdePostAdvise',\
DdeQueryConvInfo,'DdeQueryConvInfo',\
DdeQueryNextServer,'DdeQueryNextServer',\
DdeQueryStringA,'DdeQueryStringA',\
DdeQueryStringW,'DdeQueryStringW',\
DdeReconnect,'DdeReconnect',\
DdeSetQualityOfService,'DdeSetQualityOfService',\
DdeSetUserHandle,'DdeSetUserHandle',\
DdeUnaccessData,'DdeUnaccessData',\
DdeUninitialize,'DdeUninitialize',\
DefDlgProcA,'DefDlgProcA',\
DefDlgProcW,'DefDlgProcW',\
DefFrameProcA,'DefFrameProcA',\
DefFrameProcW,'DefFrameProcW',\
DefMDIChildProcA,'DefMDIChildProcA',\
DefMDIChildProcW,'DefMDIChildProcW',\
DefWindowProcA,'DefWindowProcA',\
DefWindowProcW,'DefWindowProcW',\
DeferWindowPos,'DeferWindowPos',\
DeleteMenu,'DeleteMenu',\
DestroyAcceleratorTable,'DestroyAcceleratorTable',\
DestroyCaret,'DestroyCaret',\
DestroyCursor,'DestroyCursor',\
DestroyIcon,'DestroyIcon',\
DestroyMenu,'DestroyMenu',\
DestroyWindow,'DestroyWindow',\
DialogBoxIndirectParamA,'DialogBoxIndirectParamA',\
DialogBoxIndirectParamW,'DialogBoxIndirectParamW',\
DialogBoxParamA,'DialogBoxParamA',\
DialogBoxParamW,'DialogBoxParamW',\
DispatchMessageA,'DispatchMessageA',\
DispatchMessageW,'DispatchMessageW',\
DlgDirListA,'DlgDirListA',\
DlgDirListW,'DlgDirListW',\
DlgDirListComboBoxA,'DlgDirListComboBoxA',\
DlgDirListComboBoxW,'DlgDirListComboBoxW',\
DlgDirSelectComboBoxExA,'DlgDirSelectComboBoxExA',\
DlgDirSelectComboBoxExW,'DlgDirSelectComboBoxExW',\
DlgDirSelectExA,'DlgDirSelectExA',\
DlgDirSelectExW,'DlgDirSelectExW',\
DragDetect,'DragDetect',\
DragObject,'DragObject',\
DrawAnimatedRects,'DrawAnimatedRects',\
DrawCaption,'DrawCaption',\
DrawEdge,'DrawEdge',\
DrawFocusRect,'DrawFocusRect',\
DrawFrame,'DrawFrame',\
DrawFrameControl,'DrawFrameControl',\
DrawIcon,'DrawIcon',\
DrawIconEx,'DrawIconEx',\
DrawMenuBar,'DrawMenuBar',\
DrawStateA,'DrawStateA',\
DrawStateW,'DrawStateW',\
DrawTextA,'DrawTextA',\
DrawTextW,'DrawTextW',\
DrawTextExA,'DrawTextExA',\
DrawTextExW,'DrawTextExW',\
EditWndProc,'EditWndProc',\
EmptyClipboard,'EmptyClipboard',\
EnableMenuItem,'EnableMenuItem',\
EnableScrollBar,'EnableScrollBar',\
EnableWindow,'EnableWindow',\
EndDeferWindowPos,'EndDeferWindowPos',\
EndDialog,'EndDialog',\
EndMenu,'EndMenu',\
EndPaint,'EndPaint',\
EnumChildWindows,'EnumChildWindows',\
EnumClipboardFormats,'EnumClipboardFormats',\
EnumDesktopWindows,'EnumDesktopWindows',\
EnumDesktopsA,'EnumDesktopsA',\
EnumDesktopsW,'EnumDesktopsW',\
EnumDisplayMonitors,'EnumDisplayMonitors',\
EnumDisplaySettingsA,'EnumDisplaySettingsA',\
EnumDisplaySettingsW,'EnumDisplaySettingsW',\
EnumDisplaySettingsExA,'EnumDisplaySettingsExA',\
EnumDisplaySettingsExW,'EnumDisplaySettingsExW',\
EnumPropsA,'EnumPropsA',\
EnumPropsW,'EnumPropsW',\
EnumPropsExA,'EnumPropsExA',\
EnumPropsExW,'EnumPropsExW',\
EnumThreadWindows,'EnumThreadWindows',\
EnumWindowStationsA,'EnumWindowStationsA',\
EnumWindowStationsW,'EnumWindowStationsW',\
EnumWindows,'EnumWindows',\
EqualRect,'EqualRect',\
ExcludeUpdateRgn,'ExcludeUpdateRgn',\
ExitWindowsEx,'ExitWindowsEx',\
FillRect,'FillRect',\
FindWindowA,'FindWindowA',\
FindWindowW,'FindWindowW',\
FindWindowExA,'FindWindowExA',\
FindWindowExW,'FindWindowExW',\
FlashWindow,'FlashWindow',\
FrameRect,'FrameRect',\
FreeDDElParam,'FreeDDElParam',\
GetActiveWindow,'GetActiveWindow',\
GetAltTabInfoA,'GetAltTabInfoA',\
GetAltTabInfoW,'GetAltTabInfoW',\
GetAncestor,'GetAncestor',\
GetAsyncKeyState,'GetAsyncKeyState',\
GetCapture,'GetCapture',\
GetCaretBlinkTime,'GetCaretBlinkTime',\
GetCaretPos,'GetCaretPos',\
GetClassInfoA,'GetClassInfoA',\
GetClassInfoW,'GetClassInfoW',\
GetClassInfoExA,'GetClassInfoExA',\
GetClassInfoExW,'GetClassInfoExW',\
GetClassLongA,'GetClassLongA',\
GetClassLongW,'GetClassLongW',\
GetClassNameA,'GetClassNameA',\
GetClassNameW,'GetClassNameW',\
GetClassWord,'GetClassWord',\
GetClientRect,'GetClientRect',\
GetClipCursor,'GetClipCursor',\
GetClipboardData,'GetClipboardData',\
GetClipboardFormatNameA,'GetClipboardFormatNameA',\
GetClipboardFormatNameW,'GetClipboardFormatNameW',\
GetClipboardSequenceNumberA,'GetClipboardSequenceNumberA',\
GetClipboardSequenceNumberW,'GetClipboardSequenceNumberW',\
GetClipboardViewer,'GetClipboardViewer',\
GetComboBoxInfo,'GetComboBoxInfo',\
GetCursor,'GetCursor',\
GetCursorInfo,'GetCursorInfo',\
GetCursorPos,'GetCursorPos',\
GetDC,'GetDC',\
GetDCEx,'GetDCEx',\
GetDesktopWindow,'GetDesktopWindow',\
GetDialogBaseUnits,'GetDialogBaseUnits',\
GetDlgCtrlID,'GetDlgCtrlID',\
GetDlgItem,'GetDlgItem',\
GetDlgItemInt,'GetDlgItemInt',\
GetDlgItemTextA,'GetDlgItemTextA',\
GetDlgItemTextW,'GetDlgItemTextW',\
GetDoubleClickTime,'GetDoubleClickTime',\
GetFocus,'GetFocus',\
GetForegroundWindow,'GetForegroundWindow',\
GetGUIThreadInfo,'GetGUIThreadInfo',\
GetGuiResources,'GetGuiResources',\
GetIconInfo,'GetIconInfo',\
GetInputDesktop,'GetInputDesktop',\
GetInputState,'GetInputState',\
GetKBCodePage,'GetKBCodePage',\
GetKeyNameTextA,'GetKeyNameTextA',\
GetKeyNameTextW,'GetKeyNameTextW',\
GetKeyState,'GetKeyState',\
GetKeyboardLayout,'GetKeyboardLayout',\
GetKeyboardLayoutList,'GetKeyboardLayoutList',\
GetKeyboardLayoutNameA,'GetKeyboardLayoutNameA',\
GetKeyboardLayoutNameW,'GetKeyboardLayoutNameW',\
GetKeyboardState,'GetKeyboardState',\
GetKeyboardType,'GetKeyboardType',\
GetLastActivePopup,'GetLastActivePopup',\
GetLastInputInfo,'GetLastInputInfo',\
GetLayeredWindowAttributes,'GetLayeredWindowAttributes',\
GetListBoxInfo,'GetListBoxInfo',\
GetMenu,'GetMenu',\
GetMenuBarInfo,'GetMenuBarInfo',\
GetMenuCheckMarkDimensions,'GetMenuCheckMarkDimensions',\
GetMenuContextHelpId,'GetMenuContextHelpId',\
GetMenuDefaultItem,'GetMenuDefaultItem',\
GetMenuInfo,'GetMenuInfo',\
GetMenuItemCount,'GetMenuItemCount',\
GetMenuItemID,'GetMenuItemID',\
GetMenuItemInfoA,'GetMenuItemInfoA',\
GetMenuItemInfoW,'GetMenuItemInfoW',\
GetMenuItemRect,'GetMenuItemRect',\
GetMenuState,'GetMenuState',\
GetMenuStringA,'GetMenuStringA',\
GetMenuStringW,'GetMenuStringW',\
GetMessageA,'GetMessageA',\
GetMessageW,'GetMessageW',\
GetMessageExtraInfo,'GetMessageExtraInfo',\
GetMessagePos,'GetMessagePos',\
GetMessageTime,'GetMessageTime',\
GetMonitorInfoA,'GetMonitorInfoA',\
GetMonitorInfoW,'GetMonitorInfoW',\
GetMouseMovePoints,'GetMouseMovePoints',\
GetNextDlgGroupItem,'GetNextDlgGroupItem',\
GetNextDlgTabItem,'GetNextDlgTabItem',\
GetOpenClipboardWindow,'GetOpenClipboardWindow',\
GetParent,'GetParent',\
GetPriorityClipboardFormat,'GetPriorityClipboardFormat',\
GetProcessWindowStation,'GetProcessWindowStation',\
GetPropA,'GetPropA',\
GetPropW,'GetPropW',\
GetQueueStatus,'GetQueueStatus',\
GetScrollBarInfo,'GetScrollBarInfo',\
GetScrollInfo,'GetScrollInfo',\
GetScrollPos,'GetScrollPos',\
GetScrollRange,'GetScrollRange',\
GetShellWindow,'GetShellWindow',\
GetSubMenu,'GetSubMenu',\
GetSysColor,'GetSysColor',\
GetSysColorBrush,'GetSysColorBrush',\
GetSystemMenu,'GetSystemMenu',\
GetSystemMetrics,'GetSystemMetrics',\
GetTabbedTextExtentA,'GetTabbedTextExtentA',\
GetTabbedTextExtentW,'GetTabbedTextExtentW',\
GetThreadDesktop,'GetThreadDesktop',\
GetTitleBarInfo,'GetTitleBarInfo',\
GetTopWindow,'GetTopWindow',\
GetUpdateRect,'GetUpdateRect',\
GetUpdateRgn,'GetUpdateRgn',\
GetUserObjectInformationA,'GetUserObjectInformationA',\
GetUserObjectInformationW,'GetUserObjectInformationW',\
GetUserObjectSecurity,'GetUserObjectSecurity',\
GetWindow,'GetWindow',\
GetWindowContextHelpId,'GetWindowContextHelpId',\
GetWindowDC,'GetWindowDC',\
GetWindowInfo,'GetWindowInfo',\
GetWindowLongA,'GetWindowLongA',\
GetWindowLongW,'GetWindowLongW',\
GetWindowLongPtrA,'GetWindowLongPtrA',\
GetWindowLongPtrW,'GetWindowLongPtrW',\
GetWindowModuleFileNameA,'GetWindowModuleFileNameA',\
GetWindowModuleFileNameW,'GetWindowModuleFileNameW',\
GetWindowPlacement,'GetWindowPlacement',\
GetWindowRect,'GetWindowRect',\
GetWindowRgn,'GetWindowRgn',\
GetWindowTextA,'GetWindowTextA',\
GetWindowTextW,'GetWindowTextW',\
GetWindowTextLengthA,'GetWindowTextLengthA',\
GetWindowTextLengthW,'GetWindowTextLengthW',\
GetWindowThreadProcessId,'GetWindowThreadProcessId',\
GetWindowWord,'GetWindowWord',\
GrayStringA,'GrayStringA',\
GrayStringW,'GrayStringW',\
HideCaret,'HideCaret',\
HiliteMenuItem,'HiliteMenuItem',\
IMPGetIMEA,'IMPGetIMEA',\
IMPGetIMEW,'IMPGetIMEW',\
IMPQueryIMEA,'IMPQueryIMEA',\
IMPQueryIMEW,'IMPQueryIMEW',\
IMPSetIMEA,'IMPSetIMEA',\
IMPSetIMEW,'IMPSetIMEW',\
ImpersonateDdeClientWindow,'ImpersonateDdeClientWindow',\
InSendMessage,'InSendMessage',\
InSendMessageEx,'InSendMessageEx',\
InflateRect,'InflateRect',\
InsertMenuA,'InsertMenuA',\
InsertMenuW,'InsertMenuW',\
InsertMenuItemA,'InsertMenuItemA',\
InsertMenuItemW,'InsertMenuItemW',\
IntersectRect,'IntersectRect',\
InvalidateRect,'InvalidateRect',\
InvalidateRgn,'InvalidateRgn',\
InvertRect,'InvertRect',\
IsCharAlphaA,'IsCharAlphaA',\
IsCharAlphaW,'IsCharAlphaW',\
IsCharAlphaNumericA,'IsCharAlphaNumericA',\
IsCharAlphaNumericW,'IsCharAlphaNumericW',\
IsCharLowerA,'IsCharLowerA',\
IsCharLowerW,'IsCharLowerW',\
IsCharUpperA,'IsCharUpperA',\
IsCharUpperW,'IsCharUpperW',\
IsChild,'IsChild',\
IsClipboardFormatAvailable,'IsClipboardFormatAvailable',\
IsDialogMessageA,'IsDialogMessageA',\
IsDialogMessageW,'IsDialogMessageW',\
IsDlgButtonChecked,'IsDlgButtonChecked',\
IsIconic,'IsIconic',\
IsMenu,'IsMenu',\
IsRectEmpty,'IsRectEmpty',\
IsWindow,'IsWindow',\
IsWindowEnabled,'IsWindowEnabled',\
IsWindowUnicode,'IsWindowUnicode',\
IsWindowVisible,'IsWindowVisible',\
IsZoomed,'IsZoomed',\
KillSystemTimer,'KillSystemTimer',\
KillTimer,'KillTimer',\
LoadAcceleratorsA,'LoadAcceleratorsA',\
LoadAcceleratorsW,'LoadAcceleratorsW',\
LoadBitmapA,'LoadBitmapA',\
LoadBitmapW,'LoadBitmapW',\
LoadCursorA,'LoadCursorA',\
LoadCursorW,'LoadCursorW',\
LoadCursorFromFileA,'LoadCursorFromFileA',\
LoadCursorFromFileW,'LoadCursorFromFileW',\
LoadIconA,'LoadIconA',\
LoadIconW,'LoadIconW',\
LoadImageA,'LoadImageA',\
LoadImageW,'LoadImageW',\
LoadKeyboardLayoutA,'LoadKeyboardLayoutA',\
LoadKeyboardLayoutW,'LoadKeyboardLayoutW',\
LoadMenuA,'LoadMenuA',\
LoadMenuW,'LoadMenuW',\
LoadMenuIndirectA,'LoadMenuIndirectA',\
LoadMenuIndirectW,'LoadMenuIndirectW',\
LoadStringA,'LoadStringA',\
LoadStringW,'LoadStringW',\
LockWindowUpdate,'LockWindowUpdate',\
LockWorkStation,'LockWorkStation',\
LookupIconIdFromDirectory,'LookupIconIdFromDirectory',\
LookupIconIdFromDirectoryEx,'LookupIconIdFromDirectoryEx',\
MapDialogRect,'MapDialogRect',\
MapVirtualKeyA,'MapVirtualKeyA',\
MapVirtualKeyW,'MapVirtualKeyW',\
MapVirtualKeyExA,'MapVirtualKeyExA',\
MapVirtualKeyExW,'MapVirtualKeyExW',\
MapWindowPoints,'MapWindowPoints',\
MenuItemFromPoint,'MenuItemFromPoint',\
MessageBeep,'MessageBeep',\
MessageBoxA,'MessageBoxA',\
MessageBoxW,'MessageBoxW',\
MessageBoxExA,'MessageBoxExA',\
MessageBoxExW,'MessageBoxExW',\
MessageBoxIndirectA,'MessageBoxIndirectA',\
MessageBoxIndirectW,'MessageBoxIndirectW',\
ModifyMenuA,'ModifyMenuA',\
ModifyMenuW,'ModifyMenuW',\
MonitorFromPoint,'MonitorFromPoint',\
MonitorFromRect,'MonitorFromRect',\
MonitorFromWindow,'MonitorFromWindow',\
MoveWindow,'MoveWindow',\
MsgWaitForMultipleObjects,'MsgWaitForMultipleObjects',\
MsgWaitForMultipleObjectsEx,'MsgWaitForMultipleObjectsEx',\
NotifyWinEvent,'NotifyWinEvent',\
OemKeyScan,'OemKeyScan',\
OemToCharA,'OemToCharA',\
OemToCharW,'OemToCharW',\
OemToCharBuffA,'OemToCharBuffA',\
OemToCharBuffW,'OemToCharBuffW',\
OffsetRect,'OffsetRect',\
OpenClipboard,'OpenClipboard',\
OpenDesktopA,'OpenDesktopA',\
OpenDesktopW,'OpenDesktopW',\
OpenIcon,'OpenIcon',\
OpenInputDesktop,'OpenInputDesktop',\
OpenWindowStationA,'OpenWindowStationA',\
OpenWindowStationW,'OpenWindowStationW',\
PackDDElParam,'PackDDElParam',\
PaintDesktop,'PaintDesktop',\
PeekMessageA,'PeekMessageA',\
PeekMessageW,'PeekMessageW',\
PostMessageA,'PostMessageA',\
PostMessageW,'PostMessageW',\
PostQuitMessage,'PostQuitMessage',\
PostThreadMessageA,'PostThreadMessageA',\
PostThreadMessageW,'PostThreadMessageW',\
PtInRect,'PtInRect',\
RealChildWindowFromPoint,'RealChildWindowFromPoint',\
RealGetWindowClassA,'RealGetWindowClassA',\
RealGetWindowClassW,'RealGetWindowClassW',\
RedrawWindow,'RedrawWindow',\
RegisterClassA,'RegisterClassA',\
RegisterClassW,'RegisterClassW',\
RegisterClassExA,'RegisterClassExA',\
RegisterClassExW,'RegisterClassExW',\
RegisterClipboardFormatA,'RegisterClipboardFormatA',\
RegisterClipboardFormatW,'RegisterClipboardFormatW',\
RegisterDeviceNotificationA,'RegisterDeviceNotificationA',\
RegisterDeviceNotificationW,'RegisterDeviceNotificationW',\
RegisterHotKey,'RegisterHotKey',\
RegisterWindowMessageA,'RegisterWindowMessageA',\
RegisterWindowMessageW,'RegisterWindowMessageW',\
ReleaseCapture,'ReleaseCapture',\
ReleaseDC,'ReleaseDC',\
RemoveMenu,'RemoveMenu',\
RemovePropA,'RemovePropA',\
RemovePropW,'RemovePropW',\
ReplyMessage,'ReplyMessage',\
ReuseDDElParam,'ReuseDDElParam',\
ScreenToClient,'ScreenToClient',\
ScrollChildren,'ScrollChildren',\
ScrollDC,'ScrollDC',\
ScrollWindow,'ScrollWindow',\
ScrollWindowEx,'ScrollWindowEx',\
SendDlgItemMessageA,'SendDlgItemMessageA',\
SendDlgItemMessageW,'SendDlgItemMessageW',\
SendIMEMessageExA,'SendIMEMessageExA',\
SendIMEMessageExW,'SendIMEMessageExW',\
SendInput,'SendInput',\
SendMessageA,'SendMessageA',\
SendMessageW,'SendMessageW',\
SendMessageCallbackA,'SendMessageCallbackA',\
SendMessageCallbackW,'SendMessageCallbackW',\
SendMessageTimeoutA,'SendMessageTimeoutA',\
SendMessageTimeoutW,'SendMessageTimeoutW',\
SendNotifyMessageA,'SendNotifyMessageA',\
SendNotifyMessageW,'SendNotifyMessageW',\
SetActiveWindow,'SetActiveWindow',\
SetCapture,'SetCapture',\
SetCaretBlinkTime,'SetCaretBlinkTime',\
SetCaretPos,'SetCaretPos',\
SetClassLongA,'SetClassLongA',\
SetClassLongW,'SetClassLongW',\
SetClassWord,'SetClassWord',\
SetClipboardData,'SetClipboardData',\
SetClipboardViewer,'SetClipboardViewer',\
SetCursor,'SetCursor',\
SetCursorPos,'SetCursorPos',\
SetDebugErrorLevel,'SetDebugErrorLevel',\
SetDeskWallpaper,'SetDeskWallpaper',\
SetDlgItemInt,'SetDlgItemInt',\
SetDlgItemTextA,'SetDlgItemTextA',\
SetDlgItemTextW,'SetDlgItemTextW',\
SetDoubleClickTime,'SetDoubleClickTime',\
SetFocus,'SetFocus',\
SetForegroundWindow,'SetForegroundWindow',\
SetKeyboardState,'SetKeyboardState',\
SetLastErrorEx,'SetLastErrorEx',\
SetLayeredWindowAttributes,'SetLayeredWindowAttributes',\
SetMenu,'SetMenu',\
SetMenuContextHelpId,'SetMenuContextHelpId',\
SetMenuDefaultItem,'SetMenuDefaultItem',\
SetMenuInfo,'SetMenuInfo',\
SetMenuItemBitmaps,'SetMenuItemBitmaps',\
SetMenuItemInfoA,'SetMenuItemInfoA',\
SetMenuItemInfoW,'SetMenuItemInfoW',\
SetMessageExtraInfo,'SetMessageExtraInfo',\
SetMessageQueue,'SetMessageQueue',\
SetParent,'SetParent',\
SetProcessWindowStation,'SetProcessWindowStation',\
SetPropA,'SetPropA',\
SetPropW,'SetPropW',\
SetRect,'SetRect',\
SetRectEmpty,'SetRectEmpty',\
SetScrollInfo,'SetScrollInfo',\
SetScrollPos,'SetScrollPos',\
SetScrollRange,'SetScrollRange',\
SetShellWindow,'SetShellWindow',\
SetSysColors,'SetSysColors',\
SetSystemCursor,'SetSystemCursor',\
SetSystemMenu,'SetSystemMenu',\
SetSystemTimer,'SetSystemTimer',\
SetThreadDesktop,'SetThreadDesktop',\
SetTimer,'SetTimer',\
SetUserObjectInformationA,'SetUserObjectInformationA',\
SetUserObjectInformationW,'SetUserObjectInformationW',\
SetUserObjectSecurity,'SetUserObjectSecurity',\
SetWinEventHook,'SetWinEventHook',\
SetWindowContextHelpId,'SetWindowContextHelpId',\
SetWindowLongA,'SetWindowLongA',\
SetWindowLongW,'SetWindowLongW',\
SetWindowPlacement,'SetWindowPlacement',\
SetWindowPos,'SetWindowPos',\
SetWindowRgn,'SetWindowRgn',\
SetWindowTextA,'SetWindowTextA',\
SetWindowTextW,'SetWindowTextW',\
SetWindowWord,'SetWindowWord',\
SetWindowsHookA,'SetWindowsHookA',\
SetWindowsHookW,'SetWindowsHookW',\
SetWindowsHookExA,'SetWindowsHookExA',\
SetWindowsHookExW,'SetWindowsHookExW',\
ShowCaret,'ShowCaret',\
ShowCursor,'ShowCursor',\
ShowOwnedPopups,'ShowOwnedPopups',\
ShowScrollBar,'ShowScrollBar',\
ShowWindow,'ShowWindow',\
ShowWindowAsync,'ShowWindowAsync',\
SubtractRect,'SubtractRect',\
SwapMouseButton,'SwapMouseButton',\
SwitchDesktop,'SwitchDesktop',\
SystemParametersInfoA,'SystemParametersInfoA',\
SystemParametersInfoW,'SystemParametersInfoW',\
TabbedTextOutA,'TabbedTextOutA',\
TabbedTextOutW,'TabbedTextOutW',\
TileChildWindows,'TileChildWindows',\
TileWindows,'TileWindows',\
ToAscii,'ToAscii',\
ToAsciiEx,'ToAsciiEx',\
ToUnicode,'ToUnicode',\
ToUnicodeEx,'ToUnicodeEx',\
TrackMouseEvent,'TrackMouseEvent',\
TrackPopupMenu,'TrackPopupMenu',\
TrackPopupMenuEx,'TrackPopupMenuEx',\
TranslateAcceleratorA,'TranslateAcceleratorA',\
TranslateAcceleratorW,'TranslateAcceleratorW',\
TranslateMDISysAccel,'TranslateMDISysAccel',\
TranslateMessage,'TranslateMessage',\
UnhookWinEvent,'UnhookWinEvent',\
UnhookWindowsHook,'UnhookWindowsHook',\
UnhookWindowsHookEx,'UnhookWindowsHookEx',\
UnionRect,'UnionRect',\
UnloadKeyboardLayout,'UnloadKeyboardLayout',\
UnpackDDElParam,'UnpackDDElParam',\
UnregisterClassA,'UnregisterClassA',\
UnregisterClassW,'UnregisterClassW',\
UnregisterDeviceNotification,'UnregisterDeviceNotification',\
UnregisterHotKey,'UnregisterHotKey',\
UpdateWindow,'UpdateWindow',\
UserHandleGrantAccess,'UserHandleGrantAccess',\
ValidateRect,'ValidateRect',\
ValidateRgn,'ValidateRgn',\
VkKeyScanA,'VkKeyScanA',\
VkKeyScanW,'VkKeyScanW',\
VkKeyScanExA,'VkKeyScanExA',\
VkKeyScanExW,'VkKeyScanExW',\
WINNLSEnableIME,'WINNLSEnableIME',\
WINNLSGetEnableStatus,'WINNLSGetEnableStatus',\
WINNLSGetIMEHotkey,'WINNLSGetIMEHotkey',\
WaitForInputIdle,'WaitForInputIdle',\
WaitMessage,'WaitMessage',\
WinHelpA,'WinHelpA',\
WinHelpW,'WinHelpW',\
WindowFromDC,'WindowFromDC',\
WindowFromPoint,'WindowFromPoint',\
keybd_event,'keybd_event',\
mouse_event,'mouse_event',\
wsprintfA,'wsprintfA',\
wsprintfW,'wsprintfW',\
wvsprintfA,'wvsprintfA',\
wvsprintfW,'wvsprintfW'
api AppendMenu,\
BroadcastSystemMessage,\
CallMsgFilter,\
CallWindowProc,\
ChangeDisplaySettings,\
ChangeDisplaySettingsEx,\
ChangeMenu,\
CharLower,\
CharLowerBuff,\
CharNext,\
CharNextEx,\
CharPrev,\
CharPrevEx,\
CharToOem,\
CharToOemBuff,\
CharUpper,\
CharUpperBuff,\
CopyAcceleratorTable,\
CreateAcceleratorTable,\
CreateDesktop,\
CreateDialogIndirectParam,\
CreateDialogParam,\
CreateMDIWindow,\
CreateWindowEx,\
CreateWindowStation,\
DdeCreateStringHandle,\
DdeInitialize,\
DdeQueryString,\
DefDlgProc,\
DefFrameProc,\
DefMDIChildProc,\
DefWindowProc,\
DialogBoxIndirectParam,\
DialogBoxParam,\
DispatchMessage,\
DlgDirList,\
DlgDirListComboBox,\
DlgDirSelectComboBoxEx,\
DlgDirSelectEx,\
DrawState,\
DrawText,\
DrawTextEx,\
EnumDesktops,\
EnumDisplaySettings,\
EnumDisplaySettingsEx,\
EnumProps,\
EnumPropsEx,\
EnumWindowStations,\
FindWindow,\
FindWindowEx,\
GetAltTabInfo,\
GetClassInfo,\
GetClassInfoEx,\
GetClassLong,\
GetClassName,\
GetClipboardFormatName,\
GetClipboardSequenceNumber,\
GetDlgItemText,\
GetKeyNameText,\
GetKeyboardLayoutName,\
GetMenuItemInfo,\
GetMenuString,\
GetMessage,\
GetMonitorInfo,\
GetProp,\
GetTabbedTextExtent,\
GetUserObjectInformation,\
GetWindowLong,\
GetWindowModuleFileName,\
GetWindowText,\
GetWindowTextLength,\
GrayString,\
IMPGetIME,\
IMPQueryIME,\
IMPSetIME,\
InsertMenu,\
InsertMenuItem,\
IsCharAlpha,\
IsCharAlphaNumeric,\
IsCharLower,\
IsCharUpper,\
IsDialogMessage,\
LoadAccelerators,\
LoadBitmap,\
LoadCursor,\
LoadCursorFromFile,\
LoadIcon,\
LoadImage,\
LoadKeyboardLayout,\
LoadMenu,\
LoadMenuIndirect,\
LoadString,\
MapVirtualKey,\
MapVirtualKeyEx,\
MessageBox,\
MessageBoxEx,\
MessageBoxIndirect,\
ModifyMenu,\
OemToChar,\
OemToCharBuff,\
OpenDesktop,\
OpenWindowStation,\
PeekMessage,\
PostMessage,\
PostThreadMessage,\
RealGetWindowClass,\
RegisterClass,\
RegisterClassEx,\
RegisterClipboardFormat,\
RegisterDeviceNotification,\
RegisterWindowMessage,\
RemoveProp,\
SendDlgItemMessage,\
SendIMEMessageEx,\
SendMessage,\
SendMessageCallback,\
SendMessageTimeout,\
SendNotifyMessage,\
SetClassLong,\
SetDlgItemText,\
SetMenuItemInfo,\
SetProp,\
SetUserObjectInformation,\
SetWindowLong,\
SetWindowText,\
SetWindowsHook,\
SetWindowsHookEx,\
SystemParametersInfo,\
TabbedTextOut,\
TranslateAccelerator,\
UnregisterClass,\
VkKeyScan,\
VkKeyScanEx,\
WinHelp,\
wsprintf,\
wvsprintf

View File

@ -0,0 +1,85 @@
; WSOCK32 API calls
import wsock32,\
AcceptEx,'AcceptEx',\
EnumProtocolsA,'EnumProtocolsA',\
EnumProtocolsW,'EnumProtocolsW',\
GetAcceptExSockaddrs,'GetAcceptExSockaddrs',\
GetAddressByNameA,'GetAddressByNameA',\
GetAddressByNameW,'GetAddressByNameW',\
GetNameByTypeA,'GetNameByTypeA',\
GetNameByTypeW,'GetNameByTypeW',\
GetServiceA,'GetServiceA',\
GetServiceW,'GetServiceW',\
GetTypeByNameA,'GetTypeByNameA',\
GetTypeByNameW,'GetTypeByNameW',\
MigrateWinsockConfiguration,'MigrateWinsockConfiguration',\
NPLoadNameSpaces,'NPLoadNameSpaces',\
SetServiceA,'SetServiceA',\
SetServiceW,'SetServiceW',\
TransmitFile,'TransmitFile',\
WEP,'WEP',\
WSAAsyncGetHostByAddr,'WSAAsyncGetHostByAddr',\
WSAAsyncGetHostByName,'WSAAsyncGetHostByName',\
WSAAsyncGetProtoByName,'WSAAsyncGetProtoByName',\
WSAAsyncGetProtoByNumber,'WSAAsyncGetProtoByNumber',\
WSAAsyncGetServByName,'WSAAsyncGetServByName',\
WSAAsyncGetServByPort,'WSAAsyncGetServByPort',\
WSAAsyncSelect,'WSAAsyncSelect',\
WSACancelAsyncRequest,'WSACancelAsyncRequest',\
WSACancelBlockingCall,'WSACancelBlockingCall',\
WSACleanup,'WSACleanup',\
WSAGetLastError,'WSAGetLastError',\
WSAIsBlocking,'WSAIsBlocking',\
WSARecvEx,'WSARecvEx',\
WSASetBlockingHook,'WSASetBlockingHook',\
WSASetLastError,'WSASetLastError',\
WSAStartup,'WSAStartup',\
WSAUnhookBlockingHook,'WSAUnhookBlockingHook',\
__WSAFDIsSet,'__WSAFDIsSet',\
accept,'accept',\
bind,'bind',\
closesocket,'closesocket',\
connect,'connect',\
dn_expand,'dn_expand',\
gethostbyaddr,'gethostbyaddr',\
gethostbyname,'gethostbyname',\
gethostname,'gethostname',\
getnetbyname,'getnetbyname',\
getpeername,'getpeername',\
getprotobyname,'getprotobyname',\
getprotobynumber,'getprotobynumber',\
getservbyname,'getservbyname',\
getservbyport,'getservbyport',\
getsockname,'getsockname',\
getsockopt,'getsockopt',\
htonl,'htonl',\
htons,'htons',\
inet_addr,'inet_addr',\
inet_network,'inet_network',\
inet_ntoa,'inet_ntoa',\
ioctlsocket,'ioctlsocket',\
listen,'listen',\
ntohl,'ntohl',\
ntohs,'ntohs',\
rcmd,'rcmd',\
recv,'recv',\
recvfrom,'recvfrom',\
rexec,'rexec',\
rresvport,'rresvport',\
s_perror,'s_perror',\
select,'select',\
send,'send',\
sendto,'sendto',\
sethostname,'sethostname',\
setsockopt,'setsockopt',\
shutdown,'shutdown',\
socket,'socket'
api EnumProtocols,\
GetAddressByName,\
GetNameByType,\
GetService,\
GetTypeByName,\
SetService

View File

@ -0,0 +1,125 @@
; x86 data directives with customizable backend.
iterate <word>, word, qword
calminstruction word? value*
emit word, value
end calminstruction
macro calminstruction?.word? var*
call word, var
end macro
end iterate
iterate <fword,dword>, dword,word, pword,dword, tword,qword
calminstruction fword? value*
emit fword, value
end calminstruction
macro calminstruction?.fword? var*
local seg, off
match seg:off, var
jyes far
plain:
call fword, var
jump ok
far:
call dword, off
call word, seg
ok:
end macro
end iterate
macro calminstruction?.byte? var*
compute var, var
check var eqtype ''
jyes string
emit byte, var
jump ok
string:
emit lengthof var, var
ok:
end macro
define WCHAR? 2
calminstruction wchar? value*
compute value, value
check value eqtype ''
jno plain
local n
compute n, lengthof value
string:
check n
jno done
emit WCHAR, value and 0FFh
compute value, value shr 8
compute n, n - 1
jump string
plain:
emit WCHAR, value
done:
end calminstruction
macro calminstruction?.wchar? var*
arrange var, =WCHAR var
assemble var
end macro
iterate <dw,word>, db,byte, dw,word, du,wchar, dd,dword, dp,pword, df,pword, dq,qword, dt,tword
calminstruction dw? definitions*&
local value, n
unroll:
transform definitions
jyes unroll
start:
match value=,definitions, definitions, ()
jyes recognize
match value, definitions
arrange definitions,
recognize:
match n =dup? value, value, ()
jyes duplicate
match ?, value
jyes reserve
word value
next:
match , definitions
jno start
take , definitions
take definitions, definitions
jyes next
exit
reserve:
emit word
jump next
duplicate:
match (value), value
check n < 0
jyes negative
stack:
check n
jno next
take definitions, value
arrange value, definitions
compute n, n - 1
jump stack
negative:
err 'the number of copies must be positive'
jump next
end calminstruction
calminstruction (label) dw? &definitions*&
local cmd
arrange cmd, =label label : word
assemble cmd
arrange cmd, =dw definitions
assemble cmd
end calminstruction
end iterate

View File

@ -0,0 +1,79 @@
; UTF-8
macro WCHAR arg
local count,current,__input,char,wide
if arg eqtype ''
virtual at 0
__input::
db arg
count = $
end virtual
current = 0
while current < count
load char byte from __input:current
wide = char
current = current + 1
if char > 0C0h
if char < 0E0h
wide = char and 11111b
load char byte from __input:current
wide = wide shl 6 + (char and 111111b)
current = current + 1
else if char < 0F0h
wide = char and 1111b
load char byte from __input:current
wide = wide shl 6 + (char and 111111b)
load char byte from __input:current+1
wide = wide shl 6 + (char and 111111b)
current = current + 2
else if char < 0F8h
wide = char and 111b
load char byte from __input:current
wide = wide shl 6 + (char and 111111b)
load char byte from __input:current+1
wide = wide shl 6 + (char and 111111b)
load char byte from __input:current+2
wide = wide shl 6 + (char and 111111b)
current = current + 3
else if char < 0FCh
wide = char and 11b
load char byte from __input:current
wide = wide shl 6 + (char and 111111b)
load char byte from __input:current+1
wide = wide shl 6 + (char and 111111b)
load char byte from __input:current+2
wide = wide shl 6 + (char and 111111b)
load char byte from __input:current+3
wide = wide shl 6 + (char and 111111b)
current = current + 4
else
wide = char and 1
load char byte from __input:current
wide = wide shl 6 + (char and 111111b)
load char byte from __input:current+1
wide = wide shl 6 + (char and 111111b)
load char byte from __input:current+2
wide = wide shl 6 + (char and 111111b)
load char byte from __input:current+3
wide = wide shl 6 + (char and 111111b)
load char byte from __input:current+4
wide = wide shl 6 + (char and 111111b)
current = current + 5
end if
end if
if wide < 10000h
dw wide
else
dw 0D7C0h + wide shr 10,0DC00h or (wide and 3FFh)
end if
end while
else
wide = arg
if wide < 10000h
dw wide
else
dw 0D7C0h + wide shr 10,0DC00h or (wide and 3FFh)
end if
end if
end macro

View File

@ -0,0 +1,37 @@
; Windows 1250
macro define
local encoding
virtual at 0
encoding::
repeat 80h
dw %-1
end repeat
dw 20ACh,?,201Ah,?,201Eh,2026h,2020h,2021h,?,2030h,160h,2039h,15Ah,164h,17Dh,179h
dw ?,2018h,2019h,201Ch,201Dh,2022h,2013h,2014h,?,2122h,161h,203Ah,15Bh,165h,17Eh,17Ah
dw 0A0h,2C7h,2D8h,141h,0A4h,104h,0A6h,0A7h,0A8h,0A9h,15Eh,0ABh,0ACh,0ADh,0AEh,17Bh
dw 0B0h,0B1h,2DBh,142h,0B4h,0B5h,0B6h,0B7h,0B8h,105h,15Fh,0BBh,13Dh,2DDh,13Eh,17Ch
dw 154h,0C1h,0C2h,102h,0C4h,139h,106h,0C7h,10Ch,0C9h,118h,0CBh,11Ah,0CDh,0CEh,10Eh
dw 110h,143h,147h,0D3h,0D4h,150h,0D6h,0D7h,158h,16Eh,0DAh,170h,0DCh,0DDh,162h,0DFh
dw 155h,0E1h,0E2h,103h,0E4h,13Ah,107h,0E7h,10Dh,0E9h,119h,0EBh,11Bh,0EDh,0EEh,10Fh
dw 111h,144h,148h,0F3h,0F4h,151h,0F6h,0F7h,159h,16Fh,0FAh,171h,0FCh,0FDh,163h,2D9h
end virtual
macro WCHAR arg
if arg eqtype ''
local data,char
data db arg
rb ($-data)
repeat ($-data)/2
load char:byte from data+%%-%
load char:word from encoding:char*2
store char:word at data+(%%-%)*2
end repeat
else
dw arg
end if
end macro
end macro
define
purge define

View File

@ -0,0 +1,36 @@
; Windows 1251
macro define
local encoding
virtual at 0
encoding::
repeat 80h
dw %-1
end repeat
dw 401h,403h,201Ah,453h,201Eh,2026h,2020h,2021h,20ACh,2030h,409h,2039h,40Ah,40Ch,40Bh,40Fh
dw 452h,2018h,2019h,201Ch,201Dh,2022h,2013h,2014h,?,2122h,459h,203Ah,45Ah,45Ch,45Bh,45Fh
dw 0A0h,40Eh,45Eh,408h,0A4h,490h,0A6h,0A7h,401h,0A9h,404h,0ABh,0ACh,0ADh,0AEh,407h
dw 0B0h,0B1h,406h,456h,491h,0B5h,0B6h,0B7h,451h,2116h,454h,0BBh,458h,405h,455h,457h
repeat 40h
dw 410h+%-1
end repeat
end virtual
macro WCHAR arg
if arg eqtype ''
local data,char
data db arg
rb ($-data)
repeat ($-data)/2
load char:byte from data+%%-%
load char:word from encoding:char*2
store char:word at data+(%%-%)*2
end repeat
else
dw arg
end if
end macro
end macro
define
purge define

View File

@ -0,0 +1,34 @@
; Windows 1252
macro define
local encoding
virtual at 0
encoding::
repeat 80h
dw %-1
end repeat
dw 20ACh,?,201Ah,192h,201Eh,2026h,2020h,2021h,2C6h,2030h,160h,2039h,152h,?,17D,?
dw ?,2018h,2019h,201Ch,201Dh,2022h,2013h,2014h,2DCh,2122h,161h,203Ah,153h,?,17Eh,178h
repeat 60h
dw 0A0h+%-1
end repeat
end virtual
macro WCHAR arg
if arg eqtype ''
local data,char
data db arg
rb ($-data)
repeat ($-data)/2
load char:byte from data+%%-%
load char:word from encoding:char*2
store char:word at data+(%%-%)*2
end repeat
else
dw arg
end if
end macro
end macro
define
purge define

View File

@ -0,0 +1,36 @@
; Windows 1253
macro define
local encoding
virtual at 0
encoding::
repeat 80h
dw %-1
end repeat
dw 20ACh,?,201Ah,192h,201Eh,2026h,2020h,2021h,?,2030h,?,2039h,?,?,?,?
dw ?,2018h,2019h,201Ch,201Dh,2022h,2013h,2014h,?,2122h,?,203Ah,?,?,?,?
dw 0A0h,385h,386h,0A3h,0A4h,0A5h,0A6h,0A7h,0A8h,0A9h,?,0ABh,0ACh,0ADh,0AEh,2015h
dw 0B0h,0B1h,0B2h,0B3h,384h,0B5h,0B6h,0B7h,288h,389h,38Ah,0BBh,38Ch,0BDh,38Eh,38Fh
repeat 40h
dw 390h+%-1
end repeat
end virtual
macro WCHAR arg
if arg eqtype ''
local data,char
data db arg
rb ($-data)
repeat ($-data)/2
load char:byte from data+%%-%
load char:word from encoding:char*2
store char:word at data+(%%-%)*2
end repeat
else
dw arg
end if
end macro
end macro
define
purge define

View File

@ -0,0 +1,39 @@
; Windows 1254
macro define
local encoding
virtual at 0
encoding::
repeat 80h
dw %-1
end repeat
dw 20ACh,?,201Ah,192h,201Eh,2026h,2020h,2021h,2C6h,2030h,160h,2039h,152h,?,?,?
dw ?,2018h,2019h,201Ch,201Dh,2022h,2013h,2014h,2DCh,2122h,161h,203Ah,153h,?,?,178h
repeat 30h
dw 0A0h+%-1
end repeat
dw 11Eh,0D1h,0D2h,0D3h,0D4h,0D5h,0D6h,0D7h,0D8h,0D9h,0DAh,0DBh,0DCh,130h,15Eh,0DFh
repeat 10h
dw 0E0h+%-1
end repeat
dw 11Fh,0F1h,0F2h,0F3h,0F4h,0F5h,0F6h,0F7h,0F8h,0F9h,0FAh,0FBh,0FCh,131h,15Fh,0FFh
end virtual
macro WCHAR arg
if arg eqtype ''
local data,char
data db arg
rb ($-data)
repeat ($-data)/2
load char:byte from data+%%-%
load char:word from encoding:char*2
store char:word at data+(%%-%)*2
end repeat
else
dw arg
end if
end macro
end macro
define
purge define

View File

@ -0,0 +1,37 @@
; Windows 1255
macro define
local encoding
virtual at 0
encoding::
repeat 80h
dw %-1
end repeat
dw 20ACh,?,201Ah,192h,201Eh,2026h,2020h,2021h,2C6h,2030h,?,2039h,?,?,?,?
dw ?,2018h,2019h,201Ch,201Dh,2022h,2013h,2014h,2DCh,2122h,?,203Ah,?,?,?,?
dw 0A0h,0A1h,0A2h,0A3h,20AAh,0A5h,0A6h,0A7h,0A8h,0A9h,0D7h,0ABh,0ACh,0ADh,0AEh,0AFh
dw 0B0h,0B1h,0B2h,0B3h,0B4h,0B5h,0B6h,0B7h,0B8h,0B9h,0F7h,0BBh,0BCh,0BDh,0BEh,0BFh
dw 5B0h,5B1h,5B2h,5B3h,5B4h,5B5h,5B6h,5B7h,5B8h,5B9h,?,5BBh,5BCh,5BDh,5BEh,5BFh
dw 5C0h,5C1h,5C2h,5C3h,5F0h,5F1h,5F2h,5F3h,5F4h,?,?,?,?,?,?,?
dw 5D0h,5D1h,5D2h,5D3h,5D4h,5D5h,5D6h,5D7h,5D8h,5D9h,5DAh,5DBh,5DCh,5DDh,5DEh,5DFh
dw 5E0h,5E1h,5E2h,5E3h,5E4h,5E5h,5E6h,5E7h,5E8h,5E9h,5EAh,?,?,200Eh,200Fh,?
end virtual
macro WCHAR arg
if arg eqtype ''
local data,char
data db arg
rb ($-data)
repeat ($-data)/2
load char:byte from data+%%-%
load char:word from encoding:char*2
store char:word at data+(%%-%)*2
end repeat
else
dw arg
end if
end macro
end macro
define
purge define

View File

@ -0,0 +1,37 @@
; Windows 1256
macro define
local encoding
virtual at 0
encoding::
repeat 80h
dw %-1
end repeat
dw 20ACh,67Eh,201Ah,192h,201Eh,2026h,2020h,2021h,2C6h,2030h,679h,2039h,152h,686h,698h,688h
dw 6AFh,2018h,2019h,201Ch,201Dh,2022h,2013h,2014h,6A9h,2122h,691h,203Ah,153h,200Ch,200Dh,6BAh
dw 0A0h,60Ch,0A2h,0A3h,0A4h,0A5h,0A6h,0A7h,0A8h,0A9h,6BEh,0ABh,0ACh,0ADh,0AEh,0AFh
dw 0B0h,0B1h,0B2h,0B3h,0B4h,0B5h,0B6h,0B7h,0B8h,0B9h,0BAh,0BBh,0BCh,0BDh,0BEh,0BFh
dw 6C1h,621h,622h,623h,624h,625h,626h,627h,628h,629h,62Ah,62Bh,62Ch,62Dh,62Eh,62Fh
dw 630h,631h,632h,633h,634h,635h,636h,0D7h,637h,638h,639h,63Ah,640h,641h,642h,643h
dw 0E0h,644h,0E2h,645h,646h,647h,648h,0E7h,0E8h,0E9h,0EAh,0EBh,649h,64Ah,0EEh,0EFh
dw 64Bh,64Ch,64Dh,64Eh,0F4h,64Fh,650h,0F7h,651h,0F9h,652h,0FBh,0FCh,200Eh,200Fh,6D2h
end virtual
macro WCHAR arg
if arg eqtype ''
local data,char
data db arg
rb ($-data)
repeat ($-data)/2
load char:byte from data+%%-%
load char:word from encoding:char*2
store char:word at data+(%%-%)*2
end repeat
else
dw arg
end if
end macro
end macro
define
purge define

View File

@ -0,0 +1,37 @@
; Windows 1257
macro define
local encoding
virtual at 0
encoding::
repeat 80h
dw %-1
end repeat
dw 20ACh,?,201Ah,?,201Eh,2026h,2020h,2021h,?,2030h,?,2039h,?,0A8h,2C7h,0B8h
dw ?,2018h,2019h,201Ch,201Dh,2022h,2013h,2014h,?,2122h,?,203Ah,?,0AFh,2DBh,?
dw 0A0h,?,0A2h,0A3h,0A4h,?,0A6h,0A7h,0D8h,0A9h,156h,0ABh,0ACh,0ADh,0AEh,0C6h
dw 0B0h,0B1h,0B2h,0B3h,0B4h,0B5h,0B6h,0B7h,0F8h,0B9h,157h,0BBh,0BCh,0BDh,0BEh,0E6h
dw 104h,12Eh,100h,106h,0C4h,0C5h,118h,112h,10Ch,0C9h,179h,116h,122h,136h,12Ah,13Bh
dw 160h,143h,145h,0D3h,14Ch,0D5h,0D6h,0D7h,172h,141h,15Ah,16Ah,0DCh,17Bh,17Dh,0DFh
dw 105h,12Fh,101h,107h,0E4h,0E5h,119h,113h,10Dh,0E9h,17Ah,117h,123h,137h,12Bh,13Ch
dw 161h,144h,146h,0F3h,14Dh,0F5h,0F6h,0F7h,173h,142h,15Bh,16Bh,0FCh,17Ch,17Eh,2D9h
end virtual
macro WCHAR arg
if arg eqtype ''
local data,char
data db arg
rb ($-data)
repeat ($-data)/2
load char:byte from data+%%-%
load char:word from encoding:char*2
store char:word at data+(%%-%)*2
end repeat
else
dw arg
end if
end macro
end macro
define
purge define

View File

@ -0,0 +1,37 @@
; Windows 1258
macro define
local encoding
virtual at 0
encoding::
repeat 80h
dw %-1
end repeat
dw 20ACh,?,201Ah,192h,201Eh,2026h,2020h,2021h,2C6h,2030h,?,2039h,152h,?,?,?
dw ?,2018h,2019h,201Ch,201Dh,2022h,2013h,2014h,2DCh,2122h,?,203Ah,153h,?,?,178h
dw 0A0h,0A1h,0A2h,0A3h,0A4h,0A5h,0A6h,0A7h,0A8h,0A9h,0AAh,0ABh,0ACh,0ADh,0AEh,0AFh
dw 0B0h,0B1h,0B2h,0B3h,0B4h,0B5h,0B6h,0B7h,0B8h,0B9h,0BAh,0BBh,0BCh,0BDh,0BEh,0BFh
dw 0C0h,0C1h,0C2h,102h,0C4h,0C5h,0C6h,0C7h,0C8h,0C9h,0CAh,0CBh,300h,0CDh,0CEh,0CFh
dw 110h,0D1h,309h,0D3h,0D4h,1A0h,0D6h,0D7h,0D8h,0D9h,0DAh,0DBh,0DCh,1AFh,303h,0DFh
dw 0E0h,0E1h,0E2h,103h,0E4h,0E5h,0E6h,0E7h,0E8h,0E9h,0EAh,0EBh,301h,0EDh,0EEh,0EFh
dw 111h,0F1h,323h,0F3h,0F4h,1A1h,0F6h,0F7h,0F8h,0F9h,0FAh,0FBh,0FCh,1B0h,20ABh,0FFh
end virtual
macro WCHAR arg
if arg eqtype ''
local data,char
data db arg
rb ($-data)
repeat ($-data)/2
load char:byte from data+%%-%
load char:word from encoding:char*2
store char:word at data+(%%-%)*2
end repeat
else
dw arg
end if
end macro
end macro
define
purge define

View File

@ -0,0 +1,34 @@
; Windows 874
macro define
local encoding
virtual at 0
encoding::
repeat 80h
dw %-1
end repeat
dw 20ACh,?,?,?,?,2026h,?,?,?,?,?,?,?,?,?,?
dw ?,2018h,2019h,201Ch,201Dh,2022h,2013h,2014h,?,?,?,?,?,?,?,?
repeat 60h
dw 0E00h+%-1
end repeat
end virtual
macro WCHAR arg
if arg eqtype ''
local data,char
data db arg
rb ($-data)
repeat ($-data)/2
load char:byte from data+%%-%
load char:word from encoding:char*2
store char:word at data+(%%-%)*2
end repeat
else
dw arg
end if
end macro
end macro
define
purge define

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,333 @@
; COMDLG32.DLL structures and constants
struct OPENFILENAME
lStructSize dd ?
hwndOwner dd ?
hInstance dd ?
lpstrFilter dd ?
lpstrCustomFilter dd ?
nMaxCustFilter dd ?
nFilterIndex dd ?
lpstrFile dd ?
nMaxFile dd ?
lpstrFileTitle dd ?
nMaxFileTitle dd ?
lpstrInitialDir dd ?
lpstrTitle dd ?
Flags dd ?
nFileOffset dw ?
nFileExtension dw ?
lpstrDefExt dd ?
lCustData dd ?
lpfnHook dd ?
lpTemplateName dd ?
ends
struct CHOOSECOLOR
lStructSize dd ?
hwndOwner dd ?
hInstance dd ?
rgbResult dd ?
lpCustColors dd ?
Flags dd ?
lCustData dd ?
lpfnHook dd ?
lpTemplateName dd ?
ends
struct FINDREPLACE
lStructSize dd ?
hwndOwner dd ?
hInstance dd ?
Flags dd ?
lpstrFindWhat dd ?
lpstrReplaceWith dd ?
wFindWhatLen dw ?
wReplaceWithLen dw ?
lCustData dd ?
lpfnHook dd ?
lpTemplateName dd ?
ends
struct CHOOSEFONT
lStructSize dd ?
hwndOwner dd ?
hDC dd ?
lpLogFont dd ?
iPointSize dd ?
Flags dd ?
rgbColors dd ?
lCustData dd ?
lpfnHook dd ?
lpTemplateName dd ?
hInstance dd ?
lpszStyle dd ?
nFontType dw ?
wReserved dw ?
nSizeMin dd ?
nSizeMax dd ?
ends
struct PRINTDLG
lStructSize dd ?
hwndOwner dd ?
hDevMode dd ?
hDevNames dd ?
hDC dd ?
Flags dd ?
nFromPage dw ?
nToPage dw ?
nMinPage dw ?
nMaxPage dw ?
nCopies dw ?
hInstance dd ?
lCustData dd ?
lpfnPrintHook dd ?
lpfnSetupHook dd ?
lpPrintTemplateName dd ?
lpSetupTemplateName dd ?
hPrintTemplate dd ?
hSetupTemplate dd ?
ends
struct DEVNAMES
wDriverOffset dw ?
wDeviceOffset dw ?
wOutputOffset dw ?
wDefault dw ?
ends
struct PAGESETUPDLG
lStructSize dd ?
hwndOwner dd ?
hDevMode dd ?
hDevNames dd ?
Flags dd ?
ptPaperSize POINT
rtMinMargin RECT
rtMargin RECT
hInstance dd ?
lCustData dd ?
lpfnPageSetupHook dd ?
lpfnPagePaintHook dd ?
lpPageSetupTemplateName dd ?
hPageSetupTemplate dd ?
ends
; OPENFILENAME flags
OFN_READONLY = 000001h
OFN_OVERWRITEPROMPT = 000002h
OFN_HIDEREADONLY = 000004h
OFN_NOCHANGEDIR = 000008h
OFN_SHOWHELP = 000010h
OFN_ENABLEHOOK = 000020h
OFN_ENABLETEMPLATE = 000040h
OFN_ENABLETEMPLATEHANDLE = 000080h
OFN_NOVALIDATE = 000100h
OFN_ALLOWMULTISELECT = 000200h
OFN_EXTENSIONDIFFERENT = 000400h
OFN_PATHMUSTEXIST = 000800h
OFN_FILEMUSTEXIST = 001000h
OFN_CREATEPROMPT = 002000h
OFN_SHAREAWARE = 004000h
OFN_NOREADONLYRETURN = 008000h
OFN_NOTESTFILECREATE = 010000h
OFN_NONETWORKBUTTON = 020000h
OFN_NOLONGNAMES = 040000h
OFN_EXPLORER = 080000h
OFN_NODEREFERENCELINKS = 100000h
OFN_LONGNAMES = 200000h
; Common dialog notifications
CDN_FIRST = -601
CDN_LAST = -699
CDN_INITDONE = CDN_FIRST - 0
CDN_SELCHANGE = CDN_FIRST - 1
CDN_FOLDERCHANGE = CDN_FIRST - 2
CDN_SHAREVIOLATION = CDN_FIRST - 3
CDN_HELP = CDN_FIRST - 4
CDN_FILEOK = CDN_FIRST - 5
CDN_TYPECHANGE = CDN_FIRST - 6
; Common dialog messages
CDM_FIRST = WM_USER + 100
CDM_LAST = WM_USER + 200
CDM_GETSPEC = CDM_FIRST + 0
CDM_GETFILEPATH = CDM_FIRST + 1
CDM_GETFOLDERPATH = CDM_FIRST + 2
CDM_GETFOLDERIDLIST = CDM_FIRST + 3
CDM_SETCONTROLTEXT = CDM_FIRST + 4
CDM_HIDECONTROL = CDM_FIRST + 5
CDM_SETDEFEXT = CDM_FIRST + 6
; CHOOSECOLOR flags
CC_RGBINIT = 001h
CC_FULLOPEN = 002h
CC_PREVENTFULLOPEN = 004h
CC_SHOWHELP = 008h
CC_ENABLEHOOK = 010h
CC_ENABLETEMPLATE = 020h
CC_ENABLETEMPLATEHANDLE = 040h
CC_SOLIDCOLOR = 080h
CC_ANYCOLOR = 100h
; FINDREPLACE flags
FR_DOWN = 00001h
FR_WHOLEWORD = 00002h
FR_MATCHCASE = 00004h
FR_FINDNEXT = 00008h
FR_REPLACE = 00010h
FR_REPLACEALL = 00020h
FR_DIALOGTERM = 00040h
FR_SHOWHELP = 00080h
FR_ENABLEHOOK = 00100h
FR_ENABLETEMPLATE = 00200h
FR_NOUPDOWN = 00400h
FR_NOMATCHCASE = 00800h
FR_NOWHOLEWORD = 01000h
FR_ENABLETEMPLATEHANDLE = 02000h
FR_HIDEUPDOWN = 04000h
FR_HIDEMATCHCASE = 08000h
FR_HIDEWHOLEWORD = 10000h
; CHOOSEFONT flags
CF_SCREENFONTS = 0000001h
CF_PRINTERFONTS = 0000002h
CF_BOTH = CF_SCREENFONTS or CF_PRINTERFONTS
CF_SHOWHELP = 0000004h
CF_ENABLEHOOK = 0000008h
CF_ENABLETEMPLATE = 0000010h
CF_ENABLETEMPLATEHANDLE = 0000020h
CF_INITTOLOGFONTSTRUCT = 0000040h
CF_USESTYLE = 0000080h
CF_EFFECTS = 0000100h
CF_APPLY = 0000200h
CF_ANSIONLY = 0000400h
CF_SCRIPTSONLY = CF_ANSIONLY
CF_NOVECTORFONTS = 0000800h
CF_NOOEMFONTS = CF_NOVECTORFONTS
CF_NOSIMULATIONS = 0001000h
CF_LIMITSIZE = 0002000h
CF_FIXEDPITCHONLY = 0004000h
CF_WYSIWYG = 0008000h
CF_FORCEFONTEXIST = 0010000h
CF_SCALABLEONLY = 0020000h
CF_TTONLY = 0040000h
CF_NOFACESEL = 0080000h
CF_NOSTYLESEL = 0100000h
CF_NOSIZESEL = 0200000h
CF_SELECTSCRIPT = 0400000h
CF_NOSCRIPTSEL = 0800000h
CF_NOVERTFONTS = 1000000h
; ChooseFont messages
WM_CHOOSEFONT_GETLOGFONT = WM_USER + 1
WM_CHOOSEFONT_SETLOGFONT = WM_USER + 101
WM_CHOOSEFONT_SETFLAGS = WM_USER + 102
; PRINTDLG flags
PD_ALLPAGES = 000000h
PD_SELECTION = 000001h
PD_PAGENUMS = 000002h
PD_NOSELECTION = 000004h
PD_NOPAGENUMS = 000008h
PD_COLLATE = 000010h
PD_PRINTTOFILE = 000020h
PD_PRINTSETUP = 000040h
PD_NOWARNING = 000080h
PD_RETURNDC = 000100h
PD_RETURNIC = 000200h
PD_RETURNDEFAULT = 000400h
PD_SHOWHELP = 000800h
PD_ENABLEPRINTHOOK = 001000h
PD_ENABLESETUPHOOK = 002000h
PD_ENABLEPRINTTEMPLATE = 004000h
PD_ENABLESETUPTEMPLATE = 008000h
PD_ENABLEPRINTTEMPLATEHANDLE = 010000h
PD_ENABLESETUPTEMPLATEHANDLE = 020000h
PD_USEDEVMODECOPIES = 040000h
PD_USEDEVMODECOPIESANDCOLLATE = 040000h
PD_DISABLEPRINTTOFILE = 080000h
PD_HIDEPRINTTOFILE = 100000h
PD_NONETWORKBUTTON = 200000h
; PAGESETUPDLG flags
PSD_DEFAULTMINMARGINS = 000000h
PSD_INWININIINTLMEASURE = 000000h
PSD_MINMARGINS = 000001h
PSD_MARGINS = 000002h
PSD_INTHOUSANDTHSOFINCHES = 000004h
PSD_INHUNDREDTHSOFMILLIMETERS = 000008h
PSD_DISABLEMARGINS = 000010h
PSD_DISABLEPRINTER = 000020h
PSD_NOWARNING = 000080h
PSD_DISABLEORIENTATION = 000100h
PSD_RETURNDEFAULT = 000400h
PSD_DISABLEPAPER = 000200h
PSD_SHOWHELP = 000800h
PSD_ENABLEPAGESETUPHOOK = 002000h
PSD_ENABLEPAGESETUPTEMPLATE = 008000h
PSD_ENABLEPAGESETUPTEMPLATEHANDLE = 020000h
PSD_ENABLEPAGEPAINTHOOK = 040000h
PSD_DISABLEPAGEPAINTING = 080000h
PSD_NONETWORKBUTTON = 200000h
; PageSetupDlg messages
WM_PSD_PAGESETUPDLG = WM_USER
WM_PSD_FULLPAGERECT = WM_USER + 1
WM_PSD_MINMARGINRECT = WM_USER + 2
WM_PSD_MARGINRECT = WM_USER + 3
WM_PSD_GREEKTEXTRECT = WM_USER + 4
WM_PSD_ENVSTAMPRECT = WM_USER + 5
WM_PSD_YAFULLPAGERECT = WM_USER + 6
; Common dialog error codes
CDERR_DIALOGFAILURE = 0FFFFh
CDERR_GENERALCODES = 00000h
CDERR_STRUCTSIZE = 00001h
CDERR_INITIALIZATION = 00002h
CDERR_NOTEMPLATE = 00003h
CDERR_NOHINSTANCE = 00004h
CDERR_LOADSTRFAILURE = 00005h
CDERR_FINDRESFAILURE = 00006h
CDERR_LOADRESFAILURE = 00007h
CDERR_LOCKRESFAILURE = 00008h
CDERR_MEMALLOCFAILURE = 00009h
CDERR_MEMLOCKFAILURE = 0000Ah
CDERR_NOHOOK = 0000Bh
CDERR_REGISTERMSGFAIL = 0000Ch
PDERR_PRINTERCODES = 01000h
PDERR_SETUPFAILURE = 01001h
PDERR_PARSEFAILURE = 01002h
PDERR_RETDEFFAILURE = 01003h
PDERR_LOADDRVFAILURE = 01004h
PDERR_GETDEVMODEFAIL = 01005h
PDERR_INITFAILURE = 01006h
PDERR_NODEVICES = 01007h
PDERR_NODEFAULTPRN = 01008h
PDERR_DNDMMISMATCH = 01009h
PDERR_CREATEICFAILURE = 0100Ah
PDERR_PRINTERNOTFOUND = 0100Bh
PDERR_DEFAULTDIFFERENT = 0100Ch
CFERR_CHOOSEFONTCODES = 02000h
CFERR_NOFONTS = 02001h
CFERR_MAXLESSTHANMIN = 02002h
FNERR_FILENAMECODES = 03000h
FNERR_SUBCLASSFAILURE = 03001h
FNERR_INVALIDFILENAME = 03002h
FNERR_BUFFERTOOSMALL = 03003h
FRERR_FINDREPLACECODES = 04000h
FRERR_BUFFERLENGTHZERO = 04001h
CCERR_CHOOSECOLORCODES = 05000h

View File

@ -0,0 +1,343 @@
; COMDLG32.DLL structures and constants
struct OPENFILENAME
lStructSize dq ?
hwndOwner dq ?
hInstance dq ?
lpstrFilter dq ?
lpstrCustomFilter dq ?
nMaxCustFilter dd ?
nFilterIndex dd ?
lpstrFile dq ?
nMaxFile dd ?
dd ?
lpstrFileTitle dq ?
nMaxFileTitle dd ?
dd ?
lpstrInitialDir dq ?
lpstrTitle dq ?
Flags dd ?
nFileOffset dw ?
nFileExtension dw ?
lpstrDefExt dq ?
lCustData dq ?
lpfnHook dq ?
lpTemplateName dq ?
ends
struct CHOOSECOLOR
lStructSize dq ?
hwndOwner dq ?
hInstance dq ?
rgbResult dd ?
dd ?
lpCustColors dq ?
Flags dd ?
dd ?
lCustData dq ?
lpfnHook dq ?
lpTemplateName dq ?
ends
struct FINDREPLACE
lStructSize dq ?
hwndOwner dq ?
hInstance dq ?
Flags dd ?
dd ?
lpstrFindWhat dq ?
lpstrReplaceWith dq ?
wFindWhatLen dw ?
wReplaceWithLen dw ?
dd ?
lCustData dq ?
lpfnHook dq ?
lpTemplateName dq ?
ends
struct CHOOSEFONT
lStructSize dq ?
hwndOwner dq ?
hDC dq ?
lpLogFont dq ?
iPointSize dd ?
Flags dd ?
rgbColors dd ?
dd ?
lCustData dq ?
lpfnHook dq ?
lpTemplateName dq ?
hInstance dq ?
lpszStyle dq ?
nFontType dw ?
wReserved dw ?
nSizeMin dd ?
nSizeMax dd ?
dd ?
ends
struct PRINTDLG
lStructSize dq ?
hwndOwner dq ?
hDevMode dq ?
hDevNames dq ?
hDC dq ?
Flags dd ?
nFromPage dw ?
nToPage dw ?
nMinPage dw ?
nMaxPage dw ?
nCopies dw ?
dw ?
hInstance dq ?
lCustData dq ?
lpfnPrintHook dq ?
lpfnSetupHook dq ?
lpPrintTemplateName dq ?
lpSetupTemplateName dq ?
hPrintTemplate dq ?
hSetupTemplate dq ?
ends
struct DEVNAMES
wDriverOffset dw ?
wDeviceOffset dw ?
wOutputOffset dw ?
wDefault dw ?
ends
struct PAGESETUPDLG
lStructSize dq ?
hwndOwner dq ?
hDevMode dq ?
hDevNames dq ?
Flags dd ?
ptPaperSize POINT
rtMinMargin RECT
rtMargin RECT
dd ?
hInstance dq ?
lCustData dq ?
lpfnPageSetupHook dq ?
lpfnPagePaintHook dq ?
lpPageSetupTemplateName dq ?
hPageSetupTemplate dq ?
ends
; OPENFILENAME flags
OFN_READONLY = 000001h
OFN_OVERWRITEPROMPT = 000002h
OFN_HIDEREADONLY = 000004h
OFN_NOCHANGEDIR = 000008h
OFN_SHOWHELP = 000010h
OFN_ENABLEHOOK = 000020h
OFN_ENABLETEMPLATE = 000040h
OFN_ENABLETEMPLATEHANDLE = 000080h
OFN_NOVALIDATE = 000100h
OFN_ALLOWMULTISELECT = 000200h
OFN_EXTENSIONDIFFERENT = 000400h
OFN_PATHMUSTEXIST = 000800h
OFN_FILEMUSTEXIST = 001000h
OFN_CREATEPROMPT = 002000h
OFN_SHAREAWARE = 004000h
OFN_NOREADONLYRETURN = 008000h
OFN_NOTESTFILECREATE = 010000h
OFN_NONETWORKBUTTON = 020000h
OFN_NOLONGNAMES = 040000h
OFN_EXPLORER = 080000h
OFN_NODEREFERENCELINKS = 100000h
OFN_LONGNAMES = 200000h
; Common dialog notifications
CDN_FIRST = -601
CDN_LAST = -699
CDN_INITDONE = CDN_FIRST - 0
CDN_SELCHANGE = CDN_FIRST - 1
CDN_FOLDERCHANGE = CDN_FIRST - 2
CDN_SHAREVIOLATION = CDN_FIRST - 3
CDN_HELP = CDN_FIRST - 4
CDN_FILEOK = CDN_FIRST - 5
CDN_TYPECHANGE = CDN_FIRST - 6
; Common dialog messages
CDM_FIRST = WM_USER + 100
CDM_LAST = WM_USER + 200
CDM_GETSPEC = CDM_FIRST + 0
CDM_GETFILEPATH = CDM_FIRST + 1
CDM_GETFOLDERPATH = CDM_FIRST + 2
CDM_GETFOLDERIDLIST = CDM_FIRST + 3
CDM_SETCONTROLTEXT = CDM_FIRST + 4
CDM_HIDECONTROL = CDM_FIRST + 5
CDM_SETDEFEXT = CDM_FIRST + 6
; CHOOSECOLOR flags
CC_RGBINIT = 001h
CC_FULLOPEN = 002h
CC_PREVENTFULLOPEN = 004h
CC_SHOWHELP = 008h
CC_ENABLEHOOK = 010h
CC_ENABLETEMPLATE = 020h
CC_ENABLETEMPLATEHANDLE = 040h
CC_SOLIDCOLOR = 080h
CC_ANYCOLOR = 100h
; FINDREPLACE flags
FR_DOWN = 00001h
FR_WHOLEWORD = 00002h
FR_MATCHCASE = 00004h
FR_FINDNEXT = 00008h
FR_REPLACE = 00010h
FR_REPLACEALL = 00020h
FR_DIALOGTERM = 00040h
FR_SHOWHELP = 00080h
FR_ENABLEHOOK = 00100h
FR_ENABLETEMPLATE = 00200h
FR_NOUPDOWN = 00400h
FR_NOMATCHCASE = 00800h
FR_NOWHOLEWORD = 01000h
FR_ENABLETEMPLATEHANDLE = 02000h
FR_HIDEUPDOWN = 04000h
FR_HIDEMATCHCASE = 08000h
FR_HIDEWHOLEWORD = 10000h
; CHOOSEFONT flags
CF_SCREENFONTS = 0000001h
CF_PRINTERFONTS = 0000002h
CF_BOTH = CF_SCREENFONTS or CF_PRINTERFONTS
CF_SHOWHELP = 0000004h
CF_ENABLEHOOK = 0000008h
CF_ENABLETEMPLATE = 0000010h
CF_ENABLETEMPLATEHANDLE = 0000020h
CF_INITTOLOGFONTSTRUCT = 0000040h
CF_USESTYLE = 0000080h
CF_EFFECTS = 0000100h
CF_APPLY = 0000200h
CF_ANSIONLY = 0000400h
CF_SCRIPTSONLY = CF_ANSIONLY
CF_NOVECTORFONTS = 0000800h
CF_NOOEMFONTS = CF_NOVECTORFONTS
CF_NOSIMULATIONS = 0001000h
CF_LIMITSIZE = 0002000h
CF_FIXEDPITCHONLY = 0004000h
CF_WYSIWYG = 0008000h
CF_FORCEFONTEXIST = 0010000h
CF_SCALABLEONLY = 0020000h
CF_TTONLY = 0040000h
CF_NOFACESEL = 0080000h
CF_NOSTYLESEL = 0100000h
CF_NOSIZESEL = 0200000h
CF_SELECTSCRIPT = 0400000h
CF_NOSCRIPTSEL = 0800000h
CF_NOVERTFONTS = 1000000h
; ChooseFont messages
WM_CHOOSEFONT_GETLOGFONT = WM_USER + 1
WM_CHOOSEFONT_SETLOGFONT = WM_USER + 101
WM_CHOOSEFONT_SETFLAGS = WM_USER + 102
; PRINTDLG flags
PD_ALLPAGES = 000000h
PD_SELECTION = 000001h
PD_PAGENUMS = 000002h
PD_NOSELECTION = 000004h
PD_NOPAGENUMS = 000008h
PD_COLLATE = 000010h
PD_PRINTTOFILE = 000020h
PD_PRINTSETUP = 000040h
PD_NOWARNING = 000080h
PD_RETURNDC = 000100h
PD_RETURNIC = 000200h
PD_RETURNDEFAULT = 000400h
PD_SHOWHELP = 000800h
PD_ENABLEPRINTHOOK = 001000h
PD_ENABLESETUPHOOK = 002000h
PD_ENABLEPRINTTEMPLATE = 004000h
PD_ENABLESETUPTEMPLATE = 008000h
PD_ENABLEPRINTTEMPLATEHANDLE = 010000h
PD_ENABLESETUPTEMPLATEHANDLE = 020000h
PD_USEDEVMODECOPIES = 040000h
PD_USEDEVMODECOPIESANDCOLLATE = 040000h
PD_DISABLEPRINTTOFILE = 080000h
PD_HIDEPRINTTOFILE = 100000h
PD_NONETWORKBUTTON = 200000h
; PAGESETUPDLG flags
PSD_DEFAULTMINMARGINS = 000000h
PSD_INWININIINTLMEASURE = 000000h
PSD_MINMARGINS = 000001h
PSD_MARGINS = 000002h
PSD_INTHOUSANDTHSOFINCHES = 000004h
PSD_INHUNDREDTHSOFMILLIMETERS = 000008h
PSD_DISABLEMARGINS = 000010h
PSD_DISABLEPRINTER = 000020h
PSD_NOWARNING = 000080h
PSD_DISABLEORIENTATION = 000100h
PSD_RETURNDEFAULT = 000400h
PSD_DISABLEPAPER = 000200h
PSD_SHOWHELP = 000800h
PSD_ENABLEPAGESETUPHOOK = 002000h
PSD_ENABLEPAGESETUPTEMPLATE = 008000h
PSD_ENABLEPAGESETUPTEMPLATEHANDLE = 020000h
PSD_ENABLEPAGEPAINTHOOK = 040000h
PSD_DISABLEPAGEPAINTING = 080000h
PSD_NONETWORKBUTTON = 200000h
; PageSetupDlg messages
WM_PSD_PAGESETUPDLG = WM_USER
WM_PSD_FULLPAGERECT = WM_USER + 1
WM_PSD_MINMARGINRECT = WM_USER + 2
WM_PSD_MARGINRECT = WM_USER + 3
WM_PSD_GREEKTEXTRECT = WM_USER + 4
WM_PSD_ENVSTAMPRECT = WM_USER + 5
WM_PSD_YAFULLPAGERECT = WM_USER + 6
; Common dialog error codes
CDERR_DIALOGFAILURE = 0FFFFh
CDERR_GENERALCODES = 00000h
CDERR_STRUCTSIZE = 00001h
CDERR_INITIALIZATION = 00002h
CDERR_NOTEMPLATE = 00003h
CDERR_NOHINSTANCE = 00004h
CDERR_LOADSTRFAILURE = 00005h
CDERR_FINDRESFAILURE = 00006h
CDERR_LOADRESFAILURE = 00007h
CDERR_LOCKRESFAILURE = 00008h
CDERR_MEMALLOCFAILURE = 00009h
CDERR_MEMLOCKFAILURE = 0000Ah
CDERR_NOHOOK = 0000Bh
CDERR_REGISTERMSGFAIL = 0000Ch
PDERR_PRINTERCODES = 01000h
PDERR_SETUPFAILURE = 01001h
PDERR_PARSEFAILURE = 01002h
PDERR_RETDEFFAILURE = 01003h
PDERR_LOADDRVFAILURE = 01004h
PDERR_GETDEVMODEFAIL = 01005h
PDERR_INITFAILURE = 01006h
PDERR_NODEVICES = 01007h
PDERR_NODEFAULTPRN = 01008h
PDERR_DNDMMISMATCH = 01009h
PDERR_CREATEICFAILURE = 0100Ah
PDERR_PRINTERNOTFOUND = 0100Bh
PDERR_DEFAULTDIFFERENT = 0100Ch
CFERR_CHOOSEFONTCODES = 02000h
CFERR_NOFONTS = 02001h
CFERR_MAXLESSTHANMIN = 02002h
FNERR_FILENAMECODES = 03000h
FNERR_SUBCLASSFAILURE = 03001h
FNERR_INVALIDFILENAME = 03002h
FNERR_BUFFERTOOSMALL = 03003h
FRERR_FINDREPLACECODES = 04000h
FRERR_BUFFERLENGTHZERO = 04001h
CCERR_CHOOSECOLORCODES = 05000h

View File

@ -0,0 +1,480 @@
; GDI32.DLL structures and constants
struct SIZE
cx dd ?
cy dd ?
ends
struct BITMAP
bmType dd ?
bmWidth dd ?
bmHeight dd ?
bmWidthBytes dd ?
bmPlanes dw ?
bmBitsPixel dw ?
bmBits dd ?
ends
struct BITMAPCOREHEADER
bcSize dd ?
bcWidth dw ?
bcHeight dw ?
bcPlanes dw ?
bcBitCount dw ?
ends
struct BITMAPINFOHEADER
biSize dd ?
biWidth dd ?
biHeight dd ?
biPlanes dw ?
biBitCount dw ?
biCompression dd ?
biSizeImage dd ?
biXPelsPerMeter dd ?
biYPelsPerMeter dd ?
biClrUsed dd ?
biClrImportant dd ?
ends
struct BITMAPFILEHEADER
bfType dw ?
bfSize dd ?
bfReserved1 dw ?
bfReserved2 dw ?
bfOffBits dd ?
ends
struct TEXTMETRIC
tmHeight dd ?
tmAscent dd ?
tmDescent dd ?
tmInternalLeading dd ?
tmExternalLeading dd ?
tmAveCharWidth dd ?
tmMaxCharWidth dd ?
tmWeight dd ?
tmOverhang dd ?
tmDigitizedAspectX dd ?
tmDigitizedAspectY dd ?
tmFirstChar TCHAR ?
tmLastChar TCHAR ?
tmDefaultChar TCHAR ?
tmBreakChar TCHAR ?
tmItalic db ?
tmUnderlined db ?
tmStruckOut db ?
tmPitchAndFamily db ?
tmCharSet db ?
ends
struct LOGBRUSH
lbStyle dd ?
lbColor dd ?
lbHatch dd ?
ends
struct LOGPEN
lopnStyle dd ?
lopnWidth POINT
lopnColor dd ?
ends
struct EXTLOGPEN
elpPenStyle dd ?
elpWidth dd ?
elpBrushStyle dd ?
elpColor dd ?
elpHatch dd ?
elpNumEntries dd ?
elpStyleEntry dd ?
ends
struct LOGFONT
lfHeight dd ?
lfWidth dd ?
lfEscapement dd ?
lfOrientation dd ?
lfWeight dd ?
lfItalic db ?
lfUnderline db ?
lfStrikeOut db ?
lfCharSet db ?
lfOutPrecision db ?
lfClipPrecision db ?
lfQuality db ?
lfPitchAndFamily db ?
lfFaceName TCHAR 32 dup (?)
ends
struct ENUMLOGFONT
elfLogFont LOGFONT
elfFullName TCHAR 64 dup (?)
elfStyle TCHAR 32 dup (?)
ends
struct ENUMLOGFONTEX
elfLogFont LOGFONT
elfFullName TCHAR 64 dup (?)
elfStyle TCHAR 32 dup (?)
elfScript TCHAR 32 dup (?)
ends
struct PIXELFORMATDESCRIPTOR
nSize dw ?
nVersion dw ?
dwFlags dd ?
iPixelType db ?
cColorBits db ?
cRedBits db ?
cRedShift db ?
cGreenBits db ?
cGreenShift db ?
cBlueBits db ?
cBlueShift db ?
cAlphaBits db ?
cAlphaShift db ?
cAccumBits db ?
cAccumRedBits db ?
cAccumGreenBits db ?
cAccumBlueBits db ?
cAccumAlphaBits db ?
cDepthBits db ?
cStencilBits db ?
cAuxBuffers db ?
iLayerType db ?
bReserved db ?
dwLayerMask dd ?
dwVisibleMask dd ?
dwDamageMask dd ?
ends
struct TRIVERTEX
x dd ?
y dd ?
Red dw ?
Green dw ?
Blue dw ?
Alpha dw ?
ends
; General constants
GDI_ERROR = 0FFFFFFFFh
HGDI_ERROR = 0FFFFFFFFh
; Binary raster operations
R2_BLACK = 1
R2_NOTMERGEPEN = 2
R2_MASKNOTPEN = 3
R2_NOTCOPYPEN = 4
R2_MASKPENNOT = 5
R2_NOT = 6
R2_XORPEN = 7
R2_NOTMASKPEN = 8
R2_MASKPEN = 9
R2_NOTXORPEN = 10
R2_NOP = 11
R2_MERGENOTPEN = 12
R2_COPYPEN = 13
R2_MERGEPENNOT = 14
R2_MERGEPEN = 15
R2_WHITE = 16
; Raster operations
SRCCOPY = 00CC0020h
SRCPAINT = 00EE0086h
SRCAND = 008800C6h
SRCINVERT = 00660046h
SRCERASE = 00440328h
NOTSRCCOPY = 00330008h
NOTSRCERASE = 001100A6h
MERGECOPY = 00C000CAh
MERGEPAINT = 00BB0226h
PATCOPY = 00F00021h
PATPAINT = 00FB0A09h
PATINVERT = 005A0049h
DSTINVERT = 00550009h
BLACKNESS = 00000042h
WHITENESS = 00FF0062h
; Region flags
ERROR = 0
NULLREGION = 1
SIMPLEREGION = 2
COMPLEXREGION = 3
; CombineRgn styles
RGN_AND = 1
RGN_OR = 2
RGN_XOR = 3
RGN_DIFF = 4
RGN_COPY = 5
; StretchBlt modes
BLACKONWHITE = 1
WHITEONBLACK = 2
COLORONCOLOR = 3
HALFTONE = 4
STRETCH_ANDSCANS = BLACKONWHITE
STRETCH_ORSCANS = WHITEONBLACK
STRETCH_DELETESCANS = COLORONCOLOR
STRETCH_HALFTONE = HALFTONE
; PolyFill modes
ALTERNATE = 1
WINDING = 2
; Background modes
TRANSPARENT = 1
OPAQUE = 2
; Point types
PT_CLOSEFIGURE = 1
PT_LINETO = 2
PT_BEZIERTO = 4
PT_MOVETO = 6
; Mapping modes
MM_TEXT = 1
MM_LOMETRIC = 2
MM_HIMETRIC = 3
MM_LOENGLISH = 4
MM_HIENGLISH = 5
MM_TWIPS = 6
MM_ISOTROPIC = 7
MM_ANISOTROPIC = 8
; Coordinate modes
ABSOLUTE = 1
RELATIVE = 2
; Stock logical objects
WHITE_BRUSH = 0
LTGRAY_BRUSH = 1
GRAY_BRUSH = 2
DKGRAY_BRUSH = 3
BLACK_BRUSH = 4
NULL_BRUSH = 5
HOLLOW_BRUSH = NULL_BRUSH
WHITE_PEN = 6
BLACK_PEN = 7
NULL_PEN = 8
OEM_FIXED_FONT = 10
ANSI_FIXED_FONT = 11
ANSI_VAR_FONT = 12
SYSTEM_FONT = 13
DEVICE_DEFAULT_FONT = 14
DEFAULT_PALETTE = 15
SYSTEM_FIXED_FONT = 16
DEFAULT_GUI_FONT = 17
; Brush styles
BS_SOLID = 0
BS_NULL = 1
BS_HOLLOW = BS_NULL
BS_HATCHED = 2
BS_PATTERN = 3
BS_INDEXED = 4
BS_DIBPATTERN = 5
BS_DIBPATTERNPT = 6
BS_PATTERN8X8 = 7
BS_DIBPATTERN8X8 = 8
BS_MONOPATTERN = 9
; Hatch styles
HS_HORIZONTAL = 0
HS_VERTICAL = 1
HS_FDIAGONAL = 2
HS_BDIAGONAL = 3
HS_CROSS = 4
HS_DIAGCROSS = 5
; Pen styles
PS_SOLID = 0
PS_DASH = 1
PS_DOT = 2
PS_DASHDOT = 3
PS_DASHDOTDOT = 4
PS_NULL = 5
PS_INSIDEFRAME = 6
PS_USERSTYLE = 7
PS_ALTERNATE = 8
PS_ENDCAP_ROUND = 0
PS_ENDCAP_SQUARE = 100h
PS_ENDCAP_FLAT = 200h
PS_JOIN_ROUND = 0
PS_JOIN_BEVEL = 1000h
PS_JOIN_MITER = 2000h
PS_COSMETIC = 0
PS_GEOMETRIC = 010000h
; Arc directions
AD_COUNTERCLOCKWISE = 1
AD_CLOCKWISE = 2
; Text alignment options
TA_NOUPDATECP = 0
TA_UPDATECP = 1
TA_LEFT = 0
TA_RIGHT = 2
TA_CENTER = 6
TA_TOP = 0
TA_BOTTOM = 8
TA_BASELINE = 24
TA_RTLREADING = 100h
VTA_BASELINE = TA_BASELINE
VTA_LEFT = TA_BOTTOM
VTA_RIGHT = TA_TOP
VTA_CENTER = TA_CENTER
VTA_BOTTOM = TA_RIGHT
VTA_TOP = TA_LEFT
; ExtTextOut options
ETO_OPAQUE = 0002h
ETO_CLIPPED = 0004h
ETO_GLYPH_INDEX = 0010h
ETO_RTLREADING = 0080h
ETO_IGNORELANGUAGE = 1000h
; Bitmap compression types
BI_RGB = 0
BI_RLE8 = 1
BI_RLE4 = 2
BI_BITFIELDS = 3
; tmPitchAndFamily flags
TMPF_FIXED_PITCH = 1
TMPF_VECTOR = 2
TMPF_TRUETYPE = 4
TMPF_DEVICE = 8
; Font output precision values
OUT_DEFAULT_PRECIS = 0
OUT_STRING_PRECIS = 1
OUT_CHARACTER_PRECIS = 2
OUT_STROKE_PRECIS = 3
OUT_TT_PRECIS = 4
OUT_DEVICE_PRECIS = 5
OUT_RASTER_PRECIS = 6
OUT_TT_ONLY_PRECIS = 7
OUT_OUTLINE_PRECIS = 8
OUT_SCREEN_OUTLINE_PRECIS = 9
; Font clipping precision values
CLIP_DEFAULT_PRECIS = 0
CLIP_CHARACTER_PRECIS = 1
CLIP_STROKE_PRECIS = 2
CLIP_LH_ANGLES = 10h
CLIP_TT_ALWAYS = 20h
CLIP_EMBEDDED = 80h
; Font output quality values
DEFAULT_QUALITY = 0
DRAFT_QUALITY = 1
PROOF_QUALITY = 2
NONANTIALIASED_QUALITY = 3
ANTIALIASED_QUALITY = 4
; Font pitch values
DEFAULT_PITCH = 0
FIXED_PITCH = 1
VARIABLE_PITCH = 2
MONO_FONT = 8
; Font families
FF_DONTCARE = 00h
FF_ROMAN = 10h
FF_SWISS = 20h
FF_MODERN = 30h
FF_SCRIPT = 40h
FF_DECORATIVE = 50h
; Font weights
FW_DONTCARE = 0
FW_THIN = 100
FW_EXTRALIGHT = 200
FW_LIGHT = 300
FW_NORMAL = 400
FW_MEDIUM = 500
FW_SEMIBOLD = 600
FW_BOLD = 700
FW_EXTRABOLD = 800
FW_HEAVY = 900
FW_ULTRALIGHT = FW_EXTRALIGHT
FW_REGULAR = FW_NORMAL
FW_DEMIBOLD = FW_SEMIBOLD
FW_ULTRABOLD = FW_EXTRABOLD
FW_BLACK = FW_HEAVY
; Character set values
ANSI_CHARSET = 0
DEFAULT_CHARSET = 1
SYMBOL_CHARSET = 2
SHIFTJIS_CHARSET = 128
HANGEUL_CHARSET = 129
GB2312_CHARSET = 134
CHINESEBIG5_CHARSET = 136
OEM_CHARSET = 255
JOHAB_CHARSET = 130
HEBREW_CHARSET = 177
ARABIC_CHARSET = 178
GREEK_CHARSET = 161
TURKISH_CHARSET = 162
VIETNAMESE_CHARSET = 163
THAI_CHARSET = 222
EASTEUROPE_CHARSET = 238
RUSSIAN_CHARSET = 204
MAC_CHARSET = 77
BALTIC_CHARSET = 186
; Pixel format constants
PFD_TYPE_RGBA = 0
PFD_TYPE_COLORINDEX = 1
PFD_MAIN_PLANE = 0
PFD_OVERLAY_PLANE = 1
PFD_UNDERLAY_PLANE = -1
PFD_DOUBLEBUFFER = 1
PFD_STEREO = 2
PFD_DRAW_TO_WINDOW = 4
PFD_DRAW_TO_BITMAP = 8
PFD_SUPPORT_GDI = 10h
PFD_SUPPORT_OPENGL = 20h
PFD_GENERIC_FORMAT = 40h
PFD_NEED_PALETTE = 80h
PFD_NEED_SYSTEM_PALETTE = 100h
PFD_SWAP_EXCHANGE = 200h
PFD_SWAP_COPY = 400h
PFD_SWAP_LAYER_BUFFERS = 800h
PFD_GENERIC_ACCELERATED = 1000h
PFD_DEPTH_DONTCARE = 20000000h
PFD_DOUBLEBUFFER_DONTCARE = 40000000h
PFD_STEREO_DONTCARE = 80000000h

View File

@ -0,0 +1,482 @@
; GDI32.DLL structures and constants
struct SIZE
cx dd ?
cy dd ?
ends
struct BITMAP
bmType dd ?
bmWidth dd ?
bmHeight dd ?
bmWidthBytes dd ?
bmPlanes dw ?
bmBitsPixel dw ?
dd ?
bmBits dq ?
ends
struct BITMAPCOREHEADER
bcSize dd ?
bcWidth dw ?
bcHeight dw ?
bcPlanes dw ?
bcBitCount dw ?
ends
struct BITMAPINFOHEADER
biSize dd ?
biWidth dd ?
biHeight dd ?
biPlanes dw ?
biBitCount dw ?
biCompression dd ?
biSizeImage dd ?
biXPelsPerMeter dd ?
biYPelsPerMeter dd ?
biClrUsed dd ?
biClrImportant dd ?
ends
struct BITMAPFILEHEADER, packed
bfType dw ?
bfSize dd ?
bfReserved1 dw ?
bfReserved2 dw ?
bfOffBits dd ?
ends
struct TEXTMETRIC
tmHeight dd ?
tmAscent dd ?
tmDescent dd ?
tmInternalLeading dd ?
tmExternalLeading dd ?
tmAveCharWidth dd ?
tmMaxCharWidth dd ?
tmWeight dd ?
tmOverhang dd ?
tmDigitizedAspectX dd ?
tmDigitizedAspectY dd ?
tmFirstChar TCHAR ?
tmLastChar TCHAR ?
tmDefaultChar TCHAR ?
tmBreakChar TCHAR ?
tmItalic db ?
tmUnderlined db ?
tmStruckOut db ?
tmPitchAndFamily db ?
tmCharSet db ?
align 4
ends
struct LOGBRUSH
lbStyle dd ?
lbColor dd ?
lbHatch dd ?
ends
struct LOGPEN
lopnStyle dd ?
lopnWidth POINT
lopnColor dd ?
ends
struct EXTLOGPEN
elpPenStyle dd ?
elpWidth dd ?
elpBrushStyle dd ?
elpColor dd ?
elpHatch dd ?
elpNumEntries dd ?
elpStyleEntry dd ?
ends
struct LOGFONT
lfHeight dd ?
lfWidth dd ?
lfEscapement dd ?
lfOrientation dd ?
lfWeight dd ?
lfItalic db ?
lfUnderline db ?
lfStrikeOut db ?
lfCharSet db ?
lfOutPrecision db ?
lfClipPrecision db ?
lfQuality db ?
lfPitchAndFamily db ?
lfFaceName TCHAR 32 dup (?)
ends
struct ENUMLOGFONT
elfLogFont LOGFONT
elfFullName TCHAR 64 dup (?)
elfStyle TCHAR 32 dup (?)
ends
struct ENUMLOGFONTEX
elfLogFont LOGFONT
elfFullName TCHAR 64 dup (?)
elfStyle TCHAR 32 dup (?)
elfScript TCHAR 32 dup (?)
ends
struct PIXELFORMATDESCRIPTOR
nSize dw ?
nVersion dw ?
dwFlags dd ?
iPixelType db ?
cColorBits db ?
cRedBits db ?
cRedShift db ?
cGreenBits db ?
cGreenShift db ?
cBlueBits db ?
cBlueShift db ?
cAlphaBits db ?
cAlphaShift db ?
cAccumBits db ?
cAccumRedBits db ?
cAccumGreenBits db ?
cAccumBlueBits db ?
cAccumAlphaBits db ?
cDepthBits db ?
cStencilBits db ?
cAuxBuffers db ?
iLayerType db ?
bReserved db ?
dwLayerMask dd ?
dwVisibleMask dd ?
dwDamageMask dd ?
ends
struct TRIVERTEX
x dd ?
y dd ?
Red dw ?
Green dw ?
Blue dw ?
Alpha dw ?
ends
; General constants
GDI_ERROR = 0FFFFFFFFh
HGDI_ERROR = 0FFFFFFFFh
; Binary raster operations
R2_BLACK = 1
R2_NOTMERGEPEN = 2
R2_MASKNOTPEN = 3
R2_NOTCOPYPEN = 4
R2_MASKPENNOT = 5
R2_NOT = 6
R2_XORPEN = 7
R2_NOTMASKPEN = 8
R2_MASKPEN = 9
R2_NOTXORPEN = 10
R2_NOP = 11
R2_MERGENOTPEN = 12
R2_COPYPEN = 13
R2_MERGEPENNOT = 14
R2_MERGEPEN = 15
R2_WHITE = 16
; Raster operations
SRCCOPY = 00CC0020h
SRCPAINT = 00EE0086h
SRCAND = 008800C6h
SRCINVERT = 00660046h
SRCERASE = 00440328h
NOTSRCCOPY = 00330008h
NOTSRCERASE = 001100A6h
MERGECOPY = 00C000CAh
MERGEPAINT = 00BB0226h
PATCOPY = 00F00021h
PATPAINT = 00FB0A09h
PATINVERT = 005A0049h
DSTINVERT = 00550009h
BLACKNESS = 00000042h
WHITENESS = 00FF0062h
; Region flags
ERROR = 0
NULLREGION = 1
SIMPLEREGION = 2
COMPLEXREGION = 3
; CombineRgn styles
RGN_AND = 1
RGN_OR = 2
RGN_XOR = 3
RGN_DIFF = 4
RGN_COPY = 5
; StretchBlt modes
BLACKONWHITE = 1
WHITEONBLACK = 2
COLORONCOLOR = 3
HALFTONE = 4
STRETCH_ANDSCANS = BLACKONWHITE
STRETCH_ORSCANS = WHITEONBLACK
STRETCH_DELETESCANS = COLORONCOLOR
STRETCH_HALFTONE = HALFTONE
; PolyFill modes
ALTERNATE = 1
WINDING = 2
; Background modes
TRANSPARENT = 1
OPAQUE = 2
; Point types
PT_CLOSEFIGURE = 1
PT_LINETO = 2
PT_BEZIERTO = 4
PT_MOVETO = 6
; Mapping modes
MM_TEXT = 1
MM_LOMETRIC = 2
MM_HIMETRIC = 3
MM_LOENGLISH = 4
MM_HIENGLISH = 5
MM_TWIPS = 6
MM_ISOTROPIC = 7
MM_ANISOTROPIC = 8
; Coordinate modes
ABSOLUTE = 1
RELATIVE = 2
; Stock logical objects
WHITE_BRUSH = 0
LTGRAY_BRUSH = 1
GRAY_BRUSH = 2
DKGRAY_BRUSH = 3
BLACK_BRUSH = 4
NULL_BRUSH = 5
HOLLOW_BRUSH = NULL_BRUSH
WHITE_PEN = 6
BLACK_PEN = 7
NULL_PEN = 8
OEM_FIXED_FONT = 10
ANSI_FIXED_FONT = 11
ANSI_VAR_FONT = 12
SYSTEM_FONT = 13
DEVICE_DEFAULT_FONT = 14
DEFAULT_PALETTE = 15
SYSTEM_FIXED_FONT = 16
DEFAULT_GUI_FONT = 17
; Brush styles
BS_SOLID = 0
BS_NULL = 1
BS_HOLLOW = BS_NULL
BS_HATCHED = 2
BS_PATTERN = 3
BS_INDEXED = 4
BS_DIBPATTERN = 5
BS_DIBPATTERNPT = 6
BS_PATTERN8X8 = 7
BS_DIBPATTERN8X8 = 8
BS_MONOPATTERN = 9
; Hatch styles
HS_HORIZONTAL = 0
HS_VERTICAL = 1
HS_FDIAGONAL = 2
HS_BDIAGONAL = 3
HS_CROSS = 4
HS_DIAGCROSS = 5
; Pen styles
PS_SOLID = 0
PS_DASH = 1
PS_DOT = 2
PS_DASHDOT = 3
PS_DASHDOTDOT = 4
PS_NULL = 5
PS_INSIDEFRAME = 6
PS_USERSTYLE = 7
PS_ALTERNATE = 8
PS_ENDCAP_ROUND = 0
PS_ENDCAP_SQUARE = 100h
PS_ENDCAP_FLAT = 200h
PS_JOIN_ROUND = 0
PS_JOIN_BEVEL = 1000h
PS_JOIN_MITER = 2000h
PS_COSMETIC = 0
PS_GEOMETRIC = 010000h
; Arc directions
AD_COUNTERCLOCKWISE = 1
AD_CLOCKWISE = 2
; Text alignment options
TA_NOUPDATECP = 0
TA_UPDATECP = 1
TA_LEFT = 0
TA_RIGHT = 2
TA_CENTER = 6
TA_TOP = 0
TA_BOTTOM = 8
TA_BASELINE = 24
TA_RTLREADING = 100h
VTA_BASELINE = TA_BASELINE
VTA_LEFT = TA_BOTTOM
VTA_RIGHT = TA_TOP
VTA_CENTER = TA_CENTER
VTA_BOTTOM = TA_RIGHT
VTA_TOP = TA_LEFT
; ExtTextOut options
ETO_OPAQUE = 0002h
ETO_CLIPPED = 0004h
ETO_GLYPH_INDEX = 0010h
ETO_RTLREADING = 0080h
ETO_IGNORELANGUAGE = 1000h
; Bitmap compression types
BI_RGB = 0
BI_RLE8 = 1
BI_RLE4 = 2
BI_BITFIELDS = 3
; tmPitchAndFamily flags
TMPF_FIXED_PITCH = 1
TMPF_VECTOR = 2
TMPF_TRUETYPE = 4
TMPF_DEVICE = 8
; Font output precision values
OUT_DEFAULT_PRECIS = 0
OUT_STRING_PRECIS = 1
OUT_CHARACTER_PRECIS = 2
OUT_STROKE_PRECIS = 3
OUT_TT_PRECIS = 4
OUT_DEVICE_PRECIS = 5
OUT_RASTER_PRECIS = 6
OUT_TT_ONLY_PRECIS = 7
OUT_OUTLINE_PRECIS = 8
OUT_SCREEN_OUTLINE_PRECIS = 9
; Font clipping precision values
CLIP_DEFAULT_PRECIS = 0
CLIP_CHARACTER_PRECIS = 1
CLIP_STROKE_PRECIS = 2
CLIP_LH_ANGLES = 10h
CLIP_TT_ALWAYS = 20h
CLIP_EMBEDDED = 80h
; Font output quality values
DEFAULT_QUALITY = 0
DRAFT_QUALITY = 1
PROOF_QUALITY = 2
NONANTIALIASED_QUALITY = 3
ANTIALIASED_QUALITY = 4
; Font pitch values
DEFAULT_PITCH = 0
FIXED_PITCH = 1
VARIABLE_PITCH = 2
MONO_FONT = 8
; Font families
FF_DONTCARE = 00h
FF_ROMAN = 10h
FF_SWISS = 20h
FF_MODERN = 30h
FF_SCRIPT = 40h
FF_DECORATIVE = 50h
; Font weights
FW_DONTCARE = 0
FW_THIN = 100
FW_EXTRALIGHT = 200
FW_LIGHT = 300
FW_NORMAL = 400
FW_MEDIUM = 500
FW_SEMIBOLD = 600
FW_BOLD = 700
FW_EXTRABOLD = 800
FW_HEAVY = 900
FW_ULTRALIGHT = FW_EXTRALIGHT
FW_REGULAR = FW_NORMAL
FW_DEMIBOLD = FW_SEMIBOLD
FW_ULTRABOLD = FW_EXTRABOLD
FW_BLACK = FW_HEAVY
; Character set values
ANSI_CHARSET = 0
DEFAULT_CHARSET = 1
SYMBOL_CHARSET = 2
SHIFTJIS_CHARSET = 128
HANGEUL_CHARSET = 129
GB2312_CHARSET = 134
CHINESEBIG5_CHARSET = 136
OEM_CHARSET = 255
JOHAB_CHARSET = 130
HEBREW_CHARSET = 177
ARABIC_CHARSET = 178
GREEK_CHARSET = 161
TURKISH_CHARSET = 162
VIETNAMESE_CHARSET = 163
THAI_CHARSET = 222
EASTEUROPE_CHARSET = 238
RUSSIAN_CHARSET = 204
MAC_CHARSET = 77
BALTIC_CHARSET = 186
; Pixel format constants
PFD_TYPE_RGBA = 0
PFD_TYPE_COLORINDEX = 1
PFD_MAIN_PLANE = 0
PFD_OVERLAY_PLANE = 1
PFD_UNDERLAY_PLANE = -1
PFD_DOUBLEBUFFER = 1
PFD_STEREO = 2
PFD_DRAW_TO_WINDOW = 4
PFD_DRAW_TO_BITMAP = 8
PFD_SUPPORT_GDI = 10h
PFD_SUPPORT_OPENGL = 20h
PFD_GENERIC_FORMAT = 40h
PFD_NEED_PALETTE = 80h
PFD_NEED_SYSTEM_PALETTE = 100h
PFD_SWAP_EXCHANGE = 200h
PFD_SWAP_COPY = 400h
PFD_SWAP_LAYER_BUFFERS = 800h
PFD_GENERIC_ACCELERATED = 1000h
PFD_DEPTH_DONTCARE = 20000000h
PFD_DOUBLEBUFFER_DONTCARE = 40000000h
PFD_STEREO_DONTCARE = 80000000h

View File

@ -0,0 +1,812 @@
; KERNEL32.DLL structures and constants
struct SYSTEM_INFO
wProcessorArchitecture dw ?
wReserved dw ?
dwPageSize dd ?
lpMinimumApplicationAddress dd ?
lpMaximumApplicationAddress dd ?
dwActiveProcessorMask dd ?
dwNumberOfProcessors dd ?
dwProcessorType dd ?
dwAllocationGranularity dd ?
wProcessorLevel dw ?
wProcessorRevision dw ?
ends
struct OSVERSIONINFO
dwOSVersionInfoSize dd ?
dwMajorVersion dd ?
dwMinorVersion dd ?
dwBuildNumber dd ?
dwPlatformId dd ?
szCSDVersion TCHAR 128 dup (?)
ends
struct OSVERSIONINFOA
dwOSVersionInfoSize dd ?
dwMajorVersion dd ?
dwMinorVersion dd ?
dwBuildNumber dd ?
dwPlatformId dd ?
szCSDVersion db 128 dup (?)
ends
struct OSVERSIONINFOW
dwOSVersionInfoSize dd ?
dwMajorVersion dd ?
dwMinorVersion dd ?
dwBuildNumber dd ?
dwPlatformId dd ?
szCSDVersion du 128 dup (?)
ends
struct MEMORYSTATUS
dwLength dd ?
dwMemoryLoad dd ?
dwTotalPhys dd ?
dwAvailPhys dd ?
dwTotalPageFile dd ?
dwAvailPageFile dd ?
dwTotalVirtual dd ?
dwAvailVirtual dd ?
ends
struct STARTUPINFO
cb dd ?
lpReserved dd ?
lpDesktop dd ?
lpTitle dd ?
dwX dd ?
dwY dd ?
dwXSize dd ?
dwYSize dd ?
dwXCountChars dd ?
dwYCountChars dd ?
dwFillAttribute dd ?
dwFlags dd ?
wShowWindow dw ?
cbReserved2 dw ?
lpReserved2 dd ?
hStdInput dd ?
hStdOutput dd ?
hStdError dd ?
ends
struct PROCESS_INFORMATION
hProcess dd ?
hThread dd ?
dwProcessId dd ?
dwThreadId dd ?
ends
struct FILETIME
dwLowDateTime dd ?
dwHighDateTime dd ?
ends
struct SYSTEMTIME
wYear dw ?
wMonth dw ?
wDayOfWeek dw ?
wDay dw ?
wHour dw ?
wMinute dw ?
wSecond dw ?
wMilliseconds dw ?
ends
struct BY_HANDLE_FILE_INFORMATION
dwFileAttributes dd ?
ftCreationTime FILETIME
ftLastAccessTime FILETIME
ftLastWriteTime FILETIME
dwVolumeSerialNumber dd ?
nFileSizeHigh dd ?
nFileSizeLow dd ?
nNumberOfLinks dd ?
nFileIndexHigh dd ?
nFileIndexLow dd ?
ends
struct WIN32_FIND_DATA
dwFileAttributes dd ?
ftCreationTime FILETIME
ftLastAccessTime FILETIME
ftLastWriteTime FILETIME
nFileSizeHigh dd ?
nFileSizeLow dd ?
dwReserved0 dd ?
dwReserved1 dd ?
cFileName TCHAR MAX_PATH dup (?)
cAlternateFileName TCHAR 14 dup (?)
ends
struct WIN32_FIND_DATAA
dwFileAttributes dd ?
ftCreationTime FILETIME
ftLastAccessTime FILETIME
ftLastWriteTime FILETIME
nFileSizeHigh dd ?
nFileSizeLow dd ?
dwReserved0 dd ?
dwReserved1 dd ?
cFileName db MAX_PATH dup (?)
cAlternateFileName db 14 dup (?)
ends
struct WIN32_FIND_DATAW
dwFileAttributes dd ?
ftCreationTime FILETIME
ftLastAccessTime FILETIME
ftLastWriteTime FILETIME
nFileSizeHigh dd ?
nFileSizeLow dd ?
dwReserved0 dd ?
dwReserved1 dd ?
cFileName du MAX_PATH dup (?)
cAlternateFileName du 14 dup (?)
ends
; General constants
NULL = 0
TRUE = 1
FALSE = 0
; Maximum path length in characters
MAX_PATH = 260
; Access rights
DELETE_RIGHT = 00010000h
READ_CONTROL = 00020000h
WRITE_DAC = 00040000h
WRITE_OWNER = 00080000h
SYNCHRONIZE = 00100000h
STANDARD_RIGHTS_READ = READ_CONTROL
STANDARD_RIGHTS_WRITE = READ_CONTROL
STANDARD_RIGHTS_EXECUTE = READ_CONTROL
STANDARD_RIGHTS_REQUIRED = 000F0000h
STANDARD_RIGHTS_ALL = 001F0000h
SPECIFIC_RIGHTS_ALL = 0000FFFFh
ACCESS_SYSTEM_SECURITY = 01000000h
MAXIMUM_ALLOWED = 02000000h
GENERIC_READ = 80000000h
GENERIC_WRITE = 40000000h
GENERIC_EXECUTE = 20000000h
GENERIC_ALL = 10000000h
PROCESS_TERMINATE = 00000001h
PROCESS_CREATE_THREAD = 00000002h
PROCESS_VM_OPERATION = 00000008h
PROCESS_VM_READ = 00000010h
PROCESS_VM_WRITE = 00000020h
PROCESS_DUP_HANDLE = 00000040h
PROCESS_CREATE_PROCESS = 00000080h
PROCESS_SET_QUOTA = 00000100h
PROCESS_SET_INFORMATION = 00000200h
PROCESS_QUERY_INFORMATION = 00000400h
PROCESS_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED or SYNCHRONIZE or 0FFFh
FILE_SHARE_READ = 00000001h
FILE_SHARE_WRITE = 00000002h
FILE_SHARE_DELETE = 00000004h
; CreateFile actions
CREATE_NEW = 1
CREATE_ALWAYS = 2
OPEN_EXISTING = 3
OPEN_ALWAYS = 4
TRUNCATE_EXISTING = 5
; OpenFile modes
OF_READ = 0000h
OF_WRITE = 0001h
OF_READWRITE = 0002h
OF_SHARE_COMPAT = 0000h
OF_SHARE_EXCLUSIVE = 0010h
OF_SHARE_DENY_WRITE = 0020h
OF_SHARE_DENY_READ = 0030h
OF_SHARE_DENY_NONE = 0040h
OF_PARSE = 0100h
OF_DELETE = 0200h
OF_VERIFY = 0400h
OF_CANCEL = 0800h
OF_CREATE = 1000h
OF_PROMPT = 2000h
OF_EXIST = 4000h
OF_REOPEN = 8000h
; SetFilePointer methods
FILE_BEGIN = 0
FILE_CURRENT = 1
FILE_END = 2
; File attributes
FILE_ATTRIBUTE_READONLY = 001h
FILE_ATTRIBUTE_HIDDEN = 002h
FILE_ATTRIBUTE_SYSTEM = 004h
FILE_ATTRIBUTE_DIRECTORY = 010h
FILE_ATTRIBUTE_ARCHIVE = 020h
FILE_ATTRIBUTE_NORMAL = 080h
FILE_ATTRIBUTE_TEMPORARY = 100h
FILE_ATTRIBUTE_COMPRESSED = 800h
; File flags
FILE_FLAG_WRITE_THROUGH = 80000000h
FILE_FLAG_OVERLAPPED = 40000000h
FILE_FLAG_NO_BUFFERING = 20000000h
FILE_FLAG_RANDOM_ACCESS = 10000000h
FILE_FLAG_SEQUENTIAL_SCAN = 08000000h
FILE_FLAG_DELETE_ON_CLOSE = 04000000h
FILE_FLAG_BACKUP_SEMANTICS = 02000000h
FILE_FLAG_POSIX_SEMANTICS = 01000000h
; Notify filters
FILE_NOTIFY_CHANGE_FILE_NAME = 001h
FILE_NOTIFY_CHANGE_DIR_NAME = 002h
FILE_NOTIFY_CHANGE_ATTRIBUTES = 004h
FILE_NOTIFY_CHANGE_SIZE = 008h
FILE_NOTIFY_CHANGE_LAST_WRITE = 010h
FILE_NOTIFY_CHANGE_SECURITY = 100h
; File types
FILE_TYPE_UNKNOWN = 0
FILE_TYPE_DISK = 1
FILE_TYPE_CHAR = 2
FILE_TYPE_PIPE = 3
FILE_TYPE_REMOTE = 8000h
; LockFileEx flags
LOCKFILE_FAIL_IMMEDIATELY = 1
LOCKFILE_EXCLUSIVE_LOCK = 2
; MoveFileEx flags
MOVEFILE_REPLACE_EXISTING = 1
MOVEFILE_COPY_ALLOWED = 2
MOVEFILE_DELAY_UNTIL_REBOOT = 4
MOVEFILE_WRITE_THROUGH = 8
; FindFirstFileEx flags
FIND_FIRST_EX_CASE_SENSITIVE = 1
; Device handles
INVALID_HANDLE_VALUE = -1
STD_INPUT_HANDLE = -10
STD_OUTPUT_HANDLE = -11
STD_ERROR_HANDLE = -12
; DuplicateHandle options
DUPLICATE_CLOSE_SOURCE = 1
DUPLICATE_SAME_ACCESS = 2
; File mapping acccess rights
SECTION_QUERY = 01h
SECTION_MAP_WRITE = 02h
SECTION_MAP_READ = 04h
SECTION_MAP_EXECUTE = 08h
SECTION_EXTEND_SIZE = 10h
SECTION_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED or SECTION_QUERY or SECTION_MAP_WRITE or SECTION_MAP_READ or SECTION_MAP_EXECUTE or SECTION_EXTEND_SIZE
FILE_MAP_COPY = SECTION_QUERY
FILE_MAP_WRITE = SECTION_MAP_WRITE
FILE_MAP_READ = SECTION_MAP_READ
FILE_MAP_ALL_ACCESS = SECTION_ALL_ACCESS
; File system flags
FILE_CASE_SENSITIVE_SEARCH = 0001h
FILE_CASE_PRESERVED_NAMES = 0002h
FILE_UNICODE_ON_DISK = 0004h
FILE_PERSISTENT_ACLS = 0008h
FILE_FILE_COMPRESSION = 0010h
FILE_VOLUME_IS_COMPRESSED = 8000h
FS_CASE_IS_PRESERVED = FILE_CASE_PRESERVED_NAMES
FS_CASE_SENSITIVE = FILE_CASE_SENSITIVE_SEARCH
FS_UNICODE_STORED_ON_DISK = FILE_UNICODE_ON_DISK
FS_PERSISTENT_ACLS = FILE_PERSISTENT_ACLS
; Drive types
DRIVE_UNKNOWN = 0
DRIVE_NO_ROOT_DIR = 1
DRIVE_REMOVABLE = 2
DRIVE_FIXED = 3
DRIVE_REMOTE = 4
DRIVE_CDROM = 5
DRIVE_RAMDISK = 6
; Pipe modes
PIPE_ACCESS_INBOUND = 1
PIPE_ACCESS_OUTBOUND = 2
PIPE_ACCESS_DUPLEX = 3
PIPE_CLIENT_END = 0
PIPE_SERVER_END = 1
PIPE_WAIT = 0
PIPE_NOWAIT = 1
PIPE_READMODE_BYTE = 0
PIPE_READMODE_MESSAGE = 2
PIPE_TYPE_BYTE = 0
PIPE_TYPE_MESSAGE = 4
PIPE_UNLIMITED_INSTANCES = 255
; Global memory flags
GMEM_FIXED = 0000h
GMEM_MOVEABLE = 0002h
GMEM_NOCOMPACT = 0010h
GMEM_NODISCARD = 0020h
GMEM_ZEROINIT = 0040h
GMEM_MODIFY = 0080h
GMEM_DISCARDABLE = 0100h
GMEM_NOT_BANKED = 1000h
GMEM_SHARE = 2000h
GMEM_DDESHARE = 2000h
GMEM_NOTIFY = 4000h
GMEM_LOWER = GMEM_NOT_BANKED
GMEM_VALID_FLAGS = 7F72h
GMEM_INVALID_HANDLE = 8000h
GMEM_DISCARDED = 4000h
GMEM_LOCKCOUNT = 0FFh
GHND = GMEM_MOVEABLE + GMEM_ZEROINIT
GPTR = GMEM_FIXED + GMEM_ZEROINIT
; Local memory flags
LMEM_FIXED = 0000h
LMEM_MOVEABLE = 0002h
LMEM_NOCOMPACT = 0010h
LMEM_NODISCARD = 0020h
LMEM_ZEROINIT = 0040h
LMEM_MODIFY = 0080h
LMEM_DISCARDABLE = 0F00h
LMEM_VALID_FLAGS = 0F72h
LMEM_INVALID_HANDLE = 8000h
LHND = LMEM_MOVEABLE + LMEM_ZEROINIT
LPTR = LMEM_FIXED + LMEM_ZEROINIT
LMEM_DISCARDED = 4000h
LMEM_LOCKCOUNT = 00FFh
; Page access flags
PAGE_NOACCESS = 001h
PAGE_READONLY = 002h
PAGE_READWRITE = 004h
PAGE_WRITECOPY = 008h
PAGE_EXECUTE = 010h
PAGE_EXECUTE_READ = 020h
PAGE_EXECUTE_READWRITE = 040h
PAGE_EXECUTE_WRITECOPY = 080h
PAGE_GUARD = 100h
PAGE_NOCACHE = 200h
; Memory allocation flags
MEM_COMMIT = 001000h
MEM_RESERVE = 002000h
MEM_DECOMMIT = 004000h
MEM_RELEASE = 008000h
MEM_FREE = 010000h
MEM_PRIVATE = 020000h
MEM_MAPPED = 040000h
MEM_RESET = 080000h
MEM_TOP_DOWN = 100000h
; Heap allocation flags
HEAP_NO_SERIALIZE = 1
HEAP_GENERATE_EXCEPTIONS = 4
HEAP_ZERO_MEMORY = 8
; Platform identifiers
VER_PLATFORM_WIN32s = 0
VER_PLATFORM_WIN32_WINDOWS = 1
VER_PLATFORM_WIN32_NT = 2
; GetBinaryType return values
SCS_32BIT_BINARY = 0
SCS_DOS_BINARY = 1
SCS_WOW_BINARY = 2
SCS_PIF_BINARY = 3
SCS_POSIX_BINARY = 4
SCS_OS216_BINARY = 5
; CreateProcess flags
DEBUG_PROCESS = 001h
DEBUG_ONLY_THIS_PROCESS = 002h
CREATE_SUSPENDED = 004h
DETACHED_PROCESS = 008h
CREATE_NEW_CONSOLE = 010h
NORMAL_PRIORITY_CLASS = 020h
IDLE_PRIORITY_CLASS = 040h
HIGH_PRIORITY_CLASS = 080h
REALTIME_PRIORITY_CLASS = 100h
CREATE_NEW_PROCESS_GROUP = 200h
CREATE_SEPARATE_WOW_VDM = 800h
; Thread priority values
THREAD_BASE_PRIORITY_MIN = -2
THREAD_BASE_PRIORITY_MAX = 2
THREAD_BASE_PRIORITY_LOWRT = 15
THREAD_BASE_PRIORITY_IDLE = -15
THREAD_PRIORITY_LOWEST = THREAD_BASE_PRIORITY_MIN
THREAD_PRIORITY_BELOW_NORMAL = THREAD_PRIORITY_LOWEST + 1
THREAD_PRIORITY_NORMAL = 0
THREAD_PRIORITY_HIGHEST = THREAD_BASE_PRIORITY_MAX
THREAD_PRIORITY_ABOVE_NORMAL = THREAD_PRIORITY_HIGHEST - 1
THREAD_PRIORITY_ERROR_RETURN = 7FFFFFFFh
THREAD_PRIORITY_TIME_CRITICAL = THREAD_BASE_PRIORITY_LOWRT
THREAD_PRIORITY_IDLE = THREAD_BASE_PRIORITY_IDLE
; Startup flags
STARTF_USESHOWWINDOW = 001h
STARTF_USESIZE = 002h
STARTF_USEPOSITION = 004h
STARTF_USECOUNTCHARS = 008h
STARTF_USEFILLATTRIBUTE = 010h
STARTF_RUNFULLSCREEN = 020h
STARTF_FORCEONFEEDBACK = 040h
STARTF_FORCEOFFFEEDBACK = 080h
STARTF_USESTDHANDLES = 100h
; Shutdown flags
SHUTDOWN_NORETRY = 1h
; LoadLibraryEx flags
DONT_RESOLVE_DLL_REFERENCES = 1
LOAD_LIBRARY_AS_DATAFILE = 2
LOAD_WITH_ALTERED_SEARCH_PATH = 8
; DLL entry-point calls
DLL_PROCESS_DETACH = 0
DLL_PROCESS_ATTACH = 1
DLL_THREAD_ATTACH = 2
DLL_THREAD_DETACH = 3
; Status codes
STATUS_WAIT_0 = 000000000h
STATUS_ABANDONED_WAIT_0 = 000000080h
STATUS_USER_APC = 0000000C0h
STATUS_TIMEOUT = 000000102h
STATUS_PENDING = 000000103h
STATUS_DATATYPE_MISALIGNMENT = 080000002h
STATUS_BREAKPOINT = 080000003h
STATUS_SINGLE_STEP = 080000004h
STATUS_ACCESS_VIOLATION = 0C0000005h
STATUS_IN_PAGE_ERROR = 0C0000006h
STATUS_NO_MEMORY = 0C0000017h
STATUS_ILLEGAL_INSTRUCTION = 0C000001Dh
STATUS_NONCONTINUABLE_EXCEPTION = 0C0000025h
STATUS_INVALID_DISPOSITION = 0C0000026h
STATUS_ARRAY_BOUNDS_EXCEEDED = 0C000008Ch
STATUS_FLOAT_DENORMAL_OPERAND = 0C000008Dh
STATUS_FLOAT_DIVIDE_BY_ZERO = 0C000008Eh
STATUS_FLOAT_INEXACT_RESULT = 0C000008Fh
STATUS_FLOAT_INVALID_OPERATION = 0C0000090h
STATUS_FLOAT_OVERFLOW = 0C0000091h
STATUS_FLOAT_STACK_CHECK = 0C0000092h
STATUS_FLOAT_UNDERFLOW = 0C0000093h
STATUS_INTEGER_DIVIDE_BY_ZERO = 0C0000094h
STATUS_INTEGER_OVERFLOW = 0C0000095h
STATUS_PRIVILEGED_INSTRUCTION = 0C0000096h
STATUS_STACK_OVERFLOW = 0C00000FDh
STATUS_CONTROL_C_EXIT = 0C000013Ah
WAIT_FAILED = -1
WAIT_OBJECT_0 = STATUS_WAIT_0
WAIT_ABANDONED = STATUS_ABANDONED_WAIT_0
WAIT_ABANDONED_0 = STATUS_ABANDONED_WAIT_0
WAIT_TIMEOUT = STATUS_TIMEOUT
WAIT_IO_COMPLETION = STATUS_USER_APC
STILL_ACTIVE = STATUS_PENDING
; Exception codes
EXCEPTION_CONTINUABLE = 0
EXCEPTION_NONCONTINUABLE = 1
EXCEPTION_ACCESS_VIOLATION = STATUS_ACCESS_VIOLATION
EXCEPTION_DATATYPE_MISALIGNMENT = STATUS_DATATYPE_MISALIGNMENT
EXCEPTION_BREAKPOINT = STATUS_BREAKPOINT
EXCEPTION_SINGLE_STEP = STATUS_SINGLE_STEP
EXCEPTION_ARRAY_BOUNDS_EXCEEDED = STATUS_ARRAY_BOUNDS_EXCEEDED
EXCEPTION_FLT_DENORMAL_OPERAND = STATUS_FLOAT_DENORMAL_OPERAND
EXCEPTION_FLT_DIVIDE_BY_ZERO = STATUS_FLOAT_DIVIDE_BY_ZERO
EXCEPTION_FLT_INEXACT_RESULT = STATUS_FLOAT_INEXACT_RESULT
EXCEPTION_FLT_INVALID_OPERATION = STATUS_FLOAT_INVALID_OPERATION
EXCEPTION_FLT_OVERFLOW = STATUS_FLOAT_OVERFLOW
EXCEPTION_FLT_STACK_CHECK = STATUS_FLOAT_STACK_CHECK
EXCEPTION_FLT_UNDERFLOW = STATUS_FLOAT_UNDERFLOW
EXCEPTION_INT_DIVIDE_BY_ZERO = STATUS_INTEGER_DIVIDE_BY_ZERO
EXCEPTION_INT_OVERFLOW = STATUS_INTEGER_OVERFLOW
EXCEPTION_ILLEGAL_INSTRUCTION = STATUS_ILLEGAL_INSTRUCTION
EXCEPTION_PRIV_INSTRUCTION = STATUS_PRIVILEGED_INSTRUCTION
EXCEPTION_IN_PAGE_ERROR = STATUS_IN_PAGE_ERROR
; Registry options
REG_OPTION_RESERVED = 0
REG_OPTION_NON_VOLATILE = 0
REG_OPTION_VOLATILE = 1
REG_OPTION_CREATE_LINK = 2
REG_OPTION_BACKUP_RESTORE = 4
REG_CREATED_NEW_KEY = 1
REG_OPENED_EXISTING_KEY = 2
REG_WHOLE_HIVE_VOLATILE = 1
REG_REFRESH_HIVE = 2
REG_NOTIFY_CHANGE_NAME = 1
REG_NOTIFY_CHANGE_ATTRIBUTES = 2
REG_NOTIFY_CHANGE_LAST_SET = 4
REG_NOTIFY_CHANGE_SECURITY = 8
REG_LEGAL_CHANGE_FILTER = REG_NOTIFY_CHANGE_NAME or REG_NOTIFY_CHANGE_ATTRIBUTES or REG_NOTIFY_CHANGE_LAST_SET or REG_NOTIFY_CHANGE_SECURITY
REG_LEGAL_OPTION = REG_OPTION_RESERVED or REG_OPTION_NON_VOLATILE or REG_OPTION_VOLATILE or REG_OPTION_CREATE_LINK or REG_OPTION_BACKUP_RESTORE
REG_NONE = 0
REG_SZ = 1
REG_EXPAND_SZ = 2
REG_BINARY = 3
REG_DWORD = 4
REG_DWORD_LITTLE_ENDIAN = 4
REG_DWORD_BIG_ENDIAN = 5
REG_LINK = 6
REG_MULTI_SZ = 7
REG_RESOURCE_LIST = 8
REG_FULL_RESOURCE_DESCRIPTOR = 9
REG_RESOURCE_REQUIREMENTS_LIST = 10
; Registry access modes
KEY_QUERY_VALUE = 1
KEY_SET_VALUE = 2
KEY_CREATE_SUB_KEY = 4
KEY_ENUMERATE_SUB_KEYS = 8
KEY_NOTIFY = 10h
KEY_CREATE_LINK = 20h
KEY_READ = STANDARD_RIGHTS_READ or KEY_QUERY_VALUE or KEY_ENUMERATE_SUB_KEYS or KEY_NOTIFY and not SYNCHRONIZE
KEY_WRITE = STANDARD_RIGHTS_WRITE or KEY_SET_VALUE or KEY_CREATE_SUB_KEY and not SYNCHRONIZE
KEY_EXECUTE = KEY_READ
KEY_ALL_ACCESS = STANDARD_RIGHTS_ALL or KEY_QUERY_VALUE or KEY_SET_VALUE or KEY_CREATE_SUB_KEY or KEY_ENUMERATE_SUB_KEYS or KEY_NOTIFY or KEY_CREATE_LINK and not SYNCHRONIZE
; Predefined registry keys
HKEY_CLASSES_ROOT = 80000000h
HKEY_CURRENT_USER = 80000001h
HKEY_LOCAL_MACHINE = 80000002h
HKEY_USERS = 80000003h
HKEY_PERFORMANCE_DATA = 80000004h
HKEY_CURRENT_CONFIG = 80000005h
HKEY_DYN_DATA = 80000006h
; FormatMessage flags
FORMAT_MESSAGE_ALLOCATE_BUFFER = 0100h
FORMAT_MESSAGE_IGNORE_INSERTS = 0200h
FORMAT_MESSAGE_FROM_STRING = 0400h
FORMAT_MESSAGE_FROM_HMODULE = 0800h
FORMAT_MESSAGE_FROM_SYSTEM = 1000h
FORMAT_MESSAGE_ARGUMENT_ARRAY = 2000h
FORMAT_MESSAGE_MAX_WIDTH_MASK = 00FFh
; Language identifiers
LANG_NEUTRAL = 00h
LANG_BULGARIAN = 02h
LANG_CHINESE = 04h
LANG_CROATIAN = 1Ah
LANG_CZECH = 05h
LANG_DANISH = 06h
LANG_DUTCH = 13h
LANG_ENGLISH = 09h
LANG_FINNISH = 0Bh
LANG_FRENCH = 0Ch
LANG_GERMAN = 07h
LANG_GREEK = 08h
LANG_HUNGARIAN = 0Eh
LANG_ICELANDIC = 0Fh
LANG_ITALIAN = 10h
LANG_JAPANESE = 11h
LANG_KOREAN = 12h
LANG_NORWEGIAN = 14h
LANG_POLISH = 15h
LANG_PORTUGUESE = 16h
LANG_ROMANIAN = 18h
LANG_RUSSIAN = 19h
LANG_SLOVAK = 1Bh
LANG_SLOVENIAN = 24h
LANG_SPANISH = 0Ah
LANG_SWEDISH = 1Dh
LANG_THAI = 1Eh
LANG_TURKISH = 1Fh
; Sublanguage identifiers
SUBLANG_NEUTRAL = 00h shl 10
SUBLANG_DEFAULT = 01h shl 10
SUBLANG_SYS_DEFAULT = 02h shl 10
SUBLANG_CHINESE_TRADITIONAL = 01h shl 10
SUBLANG_CHINESE_SIMPLIFIED = 02h shl 10
SUBLANG_CHINESE_HONGKONG = 03h shl 10
SUBLANG_CHINESE_SINGAPORE = 04h shl 10
SUBLANG_DUTCH = 01h shl 10
SUBLANG_DUTCH_BELGIAN = 02h shl 10
SUBLANG_ENGLISH_US = 01h shl 10
SUBLANG_ENGLISH_UK = 02h shl 10
SUBLANG_ENGLISH_AUS = 03h shl 10
SUBLANG_ENGLISH_CAN = 04h shl 10
SUBLANG_ENGLISH_NZ = 05h shl 10
SUBLANG_ENGLISH_EIRE = 06h shl 10
SUBLANG_FRENCH = 01h shl 10
SUBLANG_FRENCH_BELGIAN = 02h shl 10
SUBLANG_FRENCH_CANADIAN = 03h shl 10
SUBLANG_FRENCH_SWISS = 04h shl 10
SUBLANG_GERMAN = 01h shl 10
SUBLANG_GERMAN_SWISS = 02h shl 10
SUBLANG_GERMAN_AUSTRIAN = 03h shl 10
SUBLANG_ITALIAN = 01h shl 10
SUBLANG_ITALIAN_SWISS = 02h shl 10
SUBLANG_NORWEGIAN_BOKMAL = 01h shl 10
SUBLANG_NORWEGIAN_NYNORSK = 02h shl 10
SUBLANG_PORTUGUESE = 02h shl 10
SUBLANG_PORTUGUESE_BRAZILIAN = 01h shl 10
SUBLANG_SPANISH = 01h shl 10
SUBLANG_SPANISH_MEXICAN = 02h shl 10
SUBLANG_SPANISH_MODERN = 03h shl 10
; Sorting identifiers
SORT_DEFAULT = 0 shl 16
SORT_JAPANESE_XJIS = 0 shl 16
SORT_JAPANESE_UNICODE = 1 shl 16
SORT_CHINESE_BIG5 = 0 shl 16
SORT_CHINESE_PRCP = 0 shl 16
SORT_CHINESE_UNICODE = 1 shl 16
SORT_CHINESE_PRC = 2 shl 16
SORT_CHINESE_BOPOMOFO = 3 shl 16
SORT_KOREAN_KSC = 0 shl 16
SORT_KOREAN_UNICODE = 1 shl 16
SORT_GERMAN_PHONE_BOOK = 1 shl 16
SORT_HUNGARIAN_DEFAULT = 0 shl 16
SORT_HUNGARIAN_TECHNICAL = 1 shl 16
; Code pages
CP_ACP = 0 ; default to ANSI code page
CP_OEMCP = 1 ; default to OEM code page
CP_MACCP = 2 ; default to MAC code page
CP_THREAD_ACP = 3 ; current thread's ANSI code page
CP_SYMBOL = 42 ; SYMBOL translations
CP_UTF7 = 65000 ; UTF-7 translation
CP_UTF8 = 65001 ; UTF-8 translation
; Resource types
RT_CURSOR = 1
RT_BITMAP = 2
RT_ICON = 3
RT_MENU = 4
RT_DIALOG = 5
RT_STRING = 6
RT_FONTDIR = 7
RT_FONT = 8
RT_ACCELERATOR = 9
RT_RCDATA = 10
RT_MESSAGETABLE = 11
RT_GROUP_CURSOR = 12
RT_GROUP_ICON = 14
RT_VERSION = 16
RT_DLGINCLUDE = 17
RT_PLUGPLAY = 19
RT_VXD = 20
RT_ANICURSOR = 21
RT_ANIICON = 22
RT_HTML = 23
RT_MANIFEST = 24
; Clipboard formats
CF_TEXT = 001h
CF_BITMAP = 002h
CF_METAFILEPICT = 003h
CF_SYLK = 004h
CF_DIF = 005h
CF_TIFF = 006h
CF_OEMTEXT = 007h
CF_DIB = 008h
CF_PALETTE = 009h
CF_PENDATA = 00Ah
CF_RIFF = 00Bh
CF_WAVE = 00Ch
CF_UNICODETEXT = 00Dh
CF_ENHMETAFILE = 00Eh
CF_HDROP = 00Fh
CF_LOCALE = 010h
CF_OWNERDISPLAY = 080h
CF_DSPTEXT = 081h
CF_DSPBITMAP = 082h
CF_DSPMETAFILEPICT = 083h
CF_DSPENHMETAFILE = 08Eh
CF_PRIVATEFIRST = 200h
CF_PRIVATELAST = 2FFh
CF_GDIOBJFIRST = 300h
CF_GDIOBJLAST = 3FFh
; OS types for version info
VOS_UNKNOWN = 00000000h
VOS_DOS = 00010000h
VOS_OS216 = 00020000h
VOS_OS232 = 00030000h
VOS_NT = 00040000h
VOS__BASE = 00000000h
VOS__WINDOWS16 = 00000001h
VOS__PM16 = 00000002h
VOS__PM32 = 00000003h
VOS__WINDOWS32 = 00000004h
VOS_DOS_WINDOWS16 = 00010001h
VOS_DOS_WINDOWS32 = 00010004h
VOS_OS216_PM16 = 00020002h
VOS_OS232_PM32 = 00030003h
VOS_NT_WINDOWS32 = 00040004h
; File types for version info
VFT_UNKNOWN = 00000000h
VFT_APP = 00000001h
VFT_DLL = 00000002h
VFT_DRV = 00000003h
VFT_FONT = 00000004h
VFT_VXD = 00000005h
VFT_STATIC_LIB = 00000007h
; File subtypes for version info
VFT2_UNKNOWN = 00000000h
VFT2_DRV_PRINTER = 00000001h
VFT2_DRV_KEYBOARD = 00000002h
VFT2_DRV_LANGUAGE = 00000003h
VFT2_DRV_DISPLAY = 00000004h
VFT2_DRV_MOUSE = 00000005h
VFT2_DRV_NETWORK = 00000006h
VFT2_DRV_SYSTEM = 00000007h
VFT2_DRV_INSTALLABLE = 00000008h
VFT2_DRV_SOUND = 00000009h
VFT2_DRV_COMM = 0000000Ah
VFT2_DRV_INPUTMETHOD = 0000000Bh
VFT2_DRV_VERSIONED_PRINTER = 0000000Ch
VFT2_FONT_RASTER = 00000001h
VFT2_FONT_VECTOR = 00000002h
VFT2_FONT_TRUETYPE = 00000003h
; Console control signals
CTRL_C_EVENT = 0
CTRL_BREAK_EVENT = 1
CTRL_CLOSE_EVENT = 2
CTRL_LOGOFF_EVENT = 5
CTRL_SHUTDOWN_EVENT = 6
; Standard file handles
STD_INPUT_HANDLE = 0FFFFFFF6h
STD_OUTPUT_HANDLE = 0FFFFFFF5h
STD_ERROR_HANDLE = 0FFFFFFF4h

View File

@ -0,0 +1,810 @@
; KERNEL32.DLL structures and constants
struct SYSTEM_INFO
wProcessorArchitecture dw ?
wReserved dw ?
dwPageSize dd ?
lpMinimumApplicationAddress dq ?
lpMaximumApplicationAddress dq ?
dwActiveProcessorMask dq ?
dwNumberOfProcessors dd ?
dwProcessorType dd ?
dwAllocationGranularity dd ?
wProcessorLevel dw ?
wProcessorRevision dw ?
ends
struct OSVERSIONINFO
dwOSVersionInfoSize dd ?
dwMajorVersion dd ?
dwMinorVersion dd ?
dwBuildNumber dd ?
dwPlatformId dd ?
szCSDVersion TCHAR 128 dup (?)
ends
struct OSVERSIONINFOA
dwOSVersionInfoSize dd ?
dwMajorVersion dd ?
dwMinorVersion dd ?
dwBuildNumber dd ?
dwPlatformId dd ?
szCSDVersion db 128 dup (?)
ends
struct OSVERSIONINFOW
dwOSVersionInfoSize dd ?
dwMajorVersion dd ?
dwMinorVersion dd ?
dwBuildNumber dd ?
dwPlatformId dd ?
szCSDVersion du 128 dup (?)
ends
struct MEMORYSTATUS
dwLength dd ?
dwMemoryLoad dd ?
dwTotalPhys dq ?
dwAvailPhys dq ?
dwTotalPageFile dq ?
dwAvailPageFile dq ?
dwTotalVirtual dq ?
dwAvailVirtual dq ?
ends
struct STARTUPINFO
cb dd ?
dd ?
lpReserved dq ?
lpDesktop dq ?
lpTitle dq ?
dwX dd ?
dwY dd ?
dwXSize dd ?
dwYSize dd ?
dwXCountChars dd ?
dwYCountChars dd ?
dwFillAttribute dd ?
dwFlags dd ?
wShowWindow dw ?
cbReserved2 dw ?
dd ?
lpReserved2 dq ?
hStdInput dq ?
hStdOutput dq ?
hStdError dq ?
ends
struct PROCESS_INFORMATION
hProcess dq ?
hThread dq ?
dwProcessId dd ?
dwThreadId dd ?
ends
struct FILETIME
dwLowDateTime dd ?
dwHighDateTime dd ?
ends
struct SYSTEMTIME
wYear dw ?
wMonth dw ?
wDayOfWeek dw ?
wDay dw ?
wHour dw ?
wMinute dw ?
wSecond dw ?
wMilliseconds dw ?
ends
struct BY_HANDLE_FILE_INFORMATION
dwFileAttributes dd ?
ftCreationTime FILETIME
ftLastAccessTime FILETIME
ftLastWriteTime FILETIME
dwVolumeSerialNumber dd ?
nFileSizeHigh dd ?
nFileSizeLow dd ?
nNumberOfLinks dd ?
nFileIndexHigh dd ?
nFileIndexLow dd ?
ends
struct WIN32_FIND_DATA
dwFileAttributes dd ?
ftCreationTime FILETIME
ftLastAccessTime FILETIME
ftLastWriteTime FILETIME
nFileSizeHigh dd ?
nFileSizeLow dd ?
dwReserved0 dd ?
dwReserved1 dd ?
cFileName TCHAR MAX_PATH dup (?)
cAlternateFileName TCHAR 14 dup (?)
align 4
ends
struct WIN32_FIND_DATAA
dwFileAttributes dd ?
ftCreationTime FILETIME
ftLastAccessTime FILETIME
ftLastWriteTime FILETIME
nFileSizeHigh dd ?
nFileSizeLow dd ?
dwReserved0 dd ?
dwReserved1 dd ?
cFileName db MAX_PATH dup (?)
cAlternateFileName db 14 dup (?)
align 4
ends
struct WIN32_FIND_DATAW
dwFileAttributes dd ?
ftCreationTime FILETIME
ftLastAccessTime FILETIME
ftLastWriteTime FILETIME
nFileSizeHigh dd ?
nFileSizeLow dd ?
dwReserved0 dd ?
dwReserved1 dd ?
cFileName du MAX_PATH dup (?)
cAlternateFileName du 14 dup (?)
ends
; General constants
NULL = 0
TRUE = 1
FALSE = 0
; Maximum path length in characters
MAX_PATH = 260
; Access rights
DELETE_RIGHT = 00010000h
READ_CONTROL = 00020000h
WRITE_DAC = 00040000h
WRITE_OWNER = 00080000h
SYNCHRONIZE = 00100000h
STANDARD_RIGHTS_READ = READ_CONTROL
STANDARD_RIGHTS_WRITE = READ_CONTROL
STANDARD_RIGHTS_EXECUTE = READ_CONTROL
STANDARD_RIGHTS_REQUIRED = 000F0000h
STANDARD_RIGHTS_ALL = 001F0000h
SPECIFIC_RIGHTS_ALL = 0000FFFFh
ACCESS_SYSTEM_SECURITY = 01000000h
MAXIMUM_ALLOWED = 02000000h
GENERIC_READ = 80000000h
GENERIC_WRITE = 40000000h
GENERIC_EXECUTE = 20000000h
GENERIC_ALL = 10000000h
PROCESS_TERMINATE = 00000001h
PROCESS_CREATE_THREAD = 00000002h
PROCESS_VM_OPERATION = 00000008h
PROCESS_VM_READ = 00000010h
PROCESS_VM_WRITE = 00000020h
PROCESS_DUP_HANDLE = 00000040h
PROCESS_CREATE_PROCESS = 00000080h
PROCESS_SET_QUOTA = 00000100h
PROCESS_SET_INFORMATION = 00000200h
PROCESS_QUERY_INFORMATION = 00000400h
PROCESS_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED or SYNCHRONIZE or 0FFFh
FILE_SHARE_READ = 00000001h
FILE_SHARE_WRITE = 00000002h
FILE_SHARE_DELETE = 00000004h
; CreateFile actions
CREATE_NEW = 1
CREATE_ALWAYS = 2
OPEN_EXISTING = 3
OPEN_ALWAYS = 4
TRUNCATE_EXISTING = 5
; OpenFile modes
OF_READ = 0000h
OF_WRITE = 0001h
OF_READWRITE = 0002h
OF_SHARE_COMPAT = 0000h
OF_SHARE_EXCLUSIVE = 0010h
OF_SHARE_DENY_WRITE = 0020h
OF_SHARE_DENY_READ = 0030h
OF_SHARE_DENY_NONE = 0040h
OF_PARSE = 0100h
OF_DELETE = 0200h
OF_VERIFY = 0400h
OF_CANCEL = 0800h
OF_CREATE = 1000h
OF_PROMPT = 2000h
OF_EXIST = 4000h
OF_REOPEN = 8000h
; SetFilePointer methods
FILE_BEGIN = 0
FILE_CURRENT = 1
FILE_END = 2
; File attributes
FILE_ATTRIBUTE_READONLY = 001h
FILE_ATTRIBUTE_HIDDEN = 002h
FILE_ATTRIBUTE_SYSTEM = 004h
FILE_ATTRIBUTE_DIRECTORY = 010h
FILE_ATTRIBUTE_ARCHIVE = 020h
FILE_ATTRIBUTE_NORMAL = 080h
FILE_ATTRIBUTE_TEMPORARY = 100h
FILE_ATTRIBUTE_COMPRESSED = 800h
; File flags
FILE_FLAG_WRITE_THROUGH = 80000000h
FILE_FLAG_OVERLAPPED = 40000000h
FILE_FLAG_NO_BUFFERING = 20000000h
FILE_FLAG_RANDOM_ACCESS = 10000000h
FILE_FLAG_SEQUENTIAL_SCAN = 08000000h
FILE_FLAG_DELETE_ON_CLOSE = 04000000h
FILE_FLAG_BACKUP_SEMANTICS = 02000000h
FILE_FLAG_POSIX_SEMANTICS = 01000000h
; Notify filters
FILE_NOTIFY_CHANGE_FILE_NAME = 001h
FILE_NOTIFY_CHANGE_DIR_NAME = 002h
FILE_NOTIFY_CHANGE_ATTRIBUTES = 004h
FILE_NOTIFY_CHANGE_SIZE = 008h
FILE_NOTIFY_CHANGE_LAST_WRITE = 010h
FILE_NOTIFY_CHANGE_SECURITY = 100h
; File types
FILE_TYPE_UNKNOWN = 0
FILE_TYPE_DISK = 1
FILE_TYPE_CHAR = 2
FILE_TYPE_PIPE = 3
FILE_TYPE_REMOTE = 8000h
; LockFileEx flags
LOCKFILE_FAIL_IMMEDIATELY = 1
LOCKFILE_EXCLUSIVE_LOCK = 2
; MoveFileEx flags
MOVEFILE_REPLACE_EXISTING = 1
MOVEFILE_COPY_ALLOWED = 2
MOVEFILE_DELAY_UNTIL_REBOOT = 4
MOVEFILE_WRITE_THROUGH = 8
; FindFirstFileEx flags
FIND_FIRST_EX_CASE_SENSITIVE = 1
; Device handles
INVALID_HANDLE_VALUE = -1
STD_INPUT_HANDLE = -10
STD_OUTPUT_HANDLE = -11
STD_ERROR_HANDLE = -12
; DuplicateHandle options
DUPLICATE_CLOSE_SOURCE = 1
DUPLICATE_SAME_ACCESS = 2
; File mapping acccess rights
SECTION_QUERY = 01h
SECTION_MAP_WRITE = 02h
SECTION_MAP_READ = 04h
SECTION_MAP_EXECUTE = 08h
SECTION_EXTEND_SIZE = 10h
SECTION_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED or SECTION_QUERY or SECTION_MAP_WRITE or SECTION_MAP_READ or SECTION_MAP_EXECUTE or SECTION_EXTEND_SIZE
FILE_MAP_COPY = SECTION_QUERY
FILE_MAP_WRITE = SECTION_MAP_WRITE
FILE_MAP_READ = SECTION_MAP_READ
FILE_MAP_ALL_ACCESS = SECTION_ALL_ACCESS
; File system flags
FILE_CASE_SENSITIVE_SEARCH = 0001h
FILE_CASE_PRESERVED_NAMES = 0002h
FILE_UNICODE_ON_DISK = 0004h
FILE_PERSISTENT_ACLS = 0008h
FILE_FILE_COMPRESSION = 0010h
FILE_VOLUME_IS_COMPRESSED = 8000h
FS_CASE_IS_PRESERVED = FILE_CASE_PRESERVED_NAMES
FS_CASE_SENSITIVE = FILE_CASE_SENSITIVE_SEARCH
FS_UNICODE_STORED_ON_DISK = FILE_UNICODE_ON_DISK
FS_PERSISTENT_ACLS = FILE_PERSISTENT_ACLS
; Drive types
DRIVE_UNKNOWN = 0
DRIVE_NO_ROOT_DIR = 1
DRIVE_REMOVABLE = 2
DRIVE_FIXED = 3
DRIVE_REMOTE = 4
DRIVE_CDROM = 5
DRIVE_RAMDISK = 6
; Pipe modes
PIPE_ACCESS_INBOUND = 1
PIPE_ACCESS_OUTBOUND = 2
PIPE_ACCESS_DUPLEX = 3
PIPE_CLIENT_END = 0
PIPE_SERVER_END = 1
PIPE_WAIT = 0
PIPE_NOWAIT = 1
PIPE_READMODE_BYTE = 0
PIPE_READMODE_MESSAGE = 2
PIPE_TYPE_BYTE = 0
PIPE_TYPE_MESSAGE = 4
PIPE_UNLIMITED_INSTANCES = 255
; Global memory flags
GMEM_FIXED = 0000h
GMEM_MOVEABLE = 0002h
GMEM_NOCOMPACT = 0010h
GMEM_NODISCARD = 0020h
GMEM_ZEROINIT = 0040h
GMEM_MODIFY = 0080h
GMEM_DISCARDABLE = 0100h
GMEM_NOT_BANKED = 1000h
GMEM_SHARE = 2000h
GMEM_DDESHARE = 2000h
GMEM_NOTIFY = 4000h
GMEM_LOWER = GMEM_NOT_BANKED
GMEM_VALID_FLAGS = 7F72h
GMEM_INVALID_HANDLE = 8000h
GMEM_DISCARDED = 4000h
GMEM_LOCKCOUNT = 0FFh
GHND = GMEM_MOVEABLE + GMEM_ZEROINIT
GPTR = GMEM_FIXED + GMEM_ZEROINIT
; Local memory flags
LMEM_FIXED = 0000h
LMEM_MOVEABLE = 0002h
LMEM_NOCOMPACT = 0010h
LMEM_NODISCARD = 0020h
LMEM_ZEROINIT = 0040h
LMEM_MODIFY = 0080h
LMEM_DISCARDABLE = 0F00h
LMEM_VALID_FLAGS = 0F72h
LMEM_INVALID_HANDLE = 8000h
LHND = LMEM_MOVEABLE + LMEM_ZEROINIT
LPTR = LMEM_FIXED + LMEM_ZEROINIT
LMEM_DISCARDED = 4000h
LMEM_LOCKCOUNT = 00FFh
; Page access flags
PAGE_NOACCESS = 001h
PAGE_READONLY = 002h
PAGE_READWRITE = 004h
PAGE_WRITECOPY = 008h
PAGE_EXECUTE = 010h
PAGE_EXECUTE_READ = 020h
PAGE_EXECUTE_READWRITE = 040h
PAGE_EXECUTE_WRITECOPY = 080h
PAGE_GUARD = 100h
PAGE_NOCACHE = 200h
; Memory allocation flags
MEM_COMMIT = 001000h
MEM_RESERVE = 002000h
MEM_DECOMMIT = 004000h
MEM_RELEASE = 008000h
MEM_FREE = 010000h
MEM_PRIVATE = 020000h
MEM_MAPPED = 040000h
MEM_RESET = 080000h
MEM_TOP_DOWN = 100000h
; Heap allocation flags
HEAP_NO_SERIALIZE = 1
HEAP_GENERATE_EXCEPTIONS = 4
HEAP_ZERO_MEMORY = 8
; Platform identifiers
VER_PLATFORM_WIN32s = 0
VER_PLATFORM_WIN32_WINDOWS = 1
VER_PLATFORM_WIN32_NT = 2
; GetBinaryType return values
SCS_32BIT_BINARY = 0
SCS_DOS_BINARY = 1
SCS_WOW_BINARY = 2
SCS_PIF_BINARY = 3
SCS_POSIX_BINARY = 4
SCS_OS216_BINARY = 5
; CreateProcess flags
DEBUG_PROCESS = 001h
DEBUG_ONLY_THIS_PROCESS = 002h
CREATE_SUSPENDED = 004h
DETACHED_PROCESS = 008h
CREATE_NEW_CONSOLE = 010h
NORMAL_PRIORITY_CLASS = 020h
IDLE_PRIORITY_CLASS = 040h
HIGH_PRIORITY_CLASS = 080h
REALTIME_PRIORITY_CLASS = 100h
CREATE_NEW_PROCESS_GROUP = 200h
CREATE_SEPARATE_WOW_VDM = 800h
; Thread priority values
THREAD_BASE_PRIORITY_MIN = -2
THREAD_BASE_PRIORITY_MAX = 2
THREAD_BASE_PRIORITY_LOWRT = 15
THREAD_BASE_PRIORITY_IDLE = -15
THREAD_PRIORITY_LOWEST = THREAD_BASE_PRIORITY_MIN
THREAD_PRIORITY_BELOW_NORMAL = THREAD_PRIORITY_LOWEST + 1
THREAD_PRIORITY_NORMAL = 0
THREAD_PRIORITY_HIGHEST = THREAD_BASE_PRIORITY_MAX
THREAD_PRIORITY_ABOVE_NORMAL = THREAD_PRIORITY_HIGHEST - 1
THREAD_PRIORITY_ERROR_RETURN = 7FFFFFFFh
THREAD_PRIORITY_TIME_CRITICAL = THREAD_BASE_PRIORITY_LOWRT
THREAD_PRIORITY_IDLE = THREAD_BASE_PRIORITY_IDLE
; Startup flags
STARTF_USESHOWWINDOW = 001h
STARTF_USESIZE = 002h
STARTF_USEPOSITION = 004h
STARTF_USECOUNTCHARS = 008h
STARTF_USEFILLATTRIBUTE = 010h
STARTF_RUNFULLSCREEN = 020h
STARTF_FORCEONFEEDBACK = 040h
STARTF_FORCEOFFFEEDBACK = 080h
STARTF_USESTDHANDLES = 100h
; Shutdown flags
SHUTDOWN_NORETRY = 1h
; LoadLibraryEx flags
DONT_RESOLVE_DLL_REFERENCES = 1
LOAD_LIBRARY_AS_DATAFILE = 2
LOAD_WITH_ALTERED_SEARCH_PATH = 8
; DLL entry-point calls
DLL_PROCESS_DETACH = 0
DLL_PROCESS_ATTACH = 1
DLL_THREAD_ATTACH = 2
DLL_THREAD_DETACH = 3
; Status codes
STATUS_WAIT_0 = 000000000h
STATUS_ABANDONED_WAIT_0 = 000000080h
STATUS_USER_APC = 0000000C0h
STATUS_TIMEOUT = 000000102h
STATUS_PENDING = 000000103h
STATUS_DATATYPE_MISALIGNMENT = 080000002h
STATUS_BREAKPOINT = 080000003h
STATUS_SINGLE_STEP = 080000004h
STATUS_ACCESS_VIOLATION = 0C0000005h
STATUS_IN_PAGE_ERROR = 0C0000006h
STATUS_NO_MEMORY = 0C0000017h
STATUS_ILLEGAL_INSTRUCTION = 0C000001Dh
STATUS_NONCONTINUABLE_EXCEPTION = 0C0000025h
STATUS_INVALID_DISPOSITION = 0C0000026h
STATUS_ARRAY_BOUNDS_EXCEEDED = 0C000008Ch
STATUS_FLOAT_DENORMAL_OPERAND = 0C000008Dh
STATUS_FLOAT_DIVIDE_BY_ZERO = 0C000008Eh
STATUS_FLOAT_INEXACT_RESULT = 0C000008Fh
STATUS_FLOAT_INVALID_OPERATION = 0C0000090h
STATUS_FLOAT_OVERFLOW = 0C0000091h
STATUS_FLOAT_STACK_CHECK = 0C0000092h
STATUS_FLOAT_UNDERFLOW = 0C0000093h
STATUS_INTEGER_DIVIDE_BY_ZERO = 0C0000094h
STATUS_INTEGER_OVERFLOW = 0C0000095h
STATUS_PRIVILEGED_INSTRUCTION = 0C0000096h
STATUS_STACK_OVERFLOW = 0C00000FDh
STATUS_CONTROL_C_EXIT = 0C000013Ah
WAIT_FAILED = -1
WAIT_OBJECT_0 = STATUS_WAIT_0
WAIT_ABANDONED = STATUS_ABANDONED_WAIT_0
WAIT_ABANDONED_0 = STATUS_ABANDONED_WAIT_0
WAIT_TIMEOUT = STATUS_TIMEOUT
WAIT_IO_COMPLETION = STATUS_USER_APC
STILL_ACTIVE = STATUS_PENDING
; Exception codes
EXCEPTION_CONTINUABLE = 0
EXCEPTION_NONCONTINUABLE = 1
EXCEPTION_ACCESS_VIOLATION = STATUS_ACCESS_VIOLATION
EXCEPTION_DATATYPE_MISALIGNMENT = STATUS_DATATYPE_MISALIGNMENT
EXCEPTION_BREAKPOINT = STATUS_BREAKPOINT
EXCEPTION_SINGLE_STEP = STATUS_SINGLE_STEP
EXCEPTION_ARRAY_BOUNDS_EXCEEDED = STATUS_ARRAY_BOUNDS_EXCEEDED
EXCEPTION_FLT_DENORMAL_OPERAND = STATUS_FLOAT_DENORMAL_OPERAND
EXCEPTION_FLT_DIVIDE_BY_ZERO = STATUS_FLOAT_DIVIDE_BY_ZERO
EXCEPTION_FLT_INEXACT_RESULT = STATUS_FLOAT_INEXACT_RESULT
EXCEPTION_FLT_INVALID_OPERATION = STATUS_FLOAT_INVALID_OPERATION
EXCEPTION_FLT_OVERFLOW = STATUS_FLOAT_OVERFLOW
EXCEPTION_FLT_STACK_CHECK = STATUS_FLOAT_STACK_CHECK
EXCEPTION_FLT_UNDERFLOW = STATUS_FLOAT_UNDERFLOW
EXCEPTION_INT_DIVIDE_BY_ZERO = STATUS_INTEGER_DIVIDE_BY_ZERO
EXCEPTION_INT_OVERFLOW = STATUS_INTEGER_OVERFLOW
EXCEPTION_ILLEGAL_INSTRUCTION = STATUS_ILLEGAL_INSTRUCTION
EXCEPTION_PRIV_INSTRUCTION = STATUS_PRIVILEGED_INSTRUCTION
EXCEPTION_IN_PAGE_ERROR = STATUS_IN_PAGE_ERROR
; Registry options
REG_OPTION_RESERVED = 0
REG_OPTION_NON_VOLATILE = 0
REG_OPTION_VOLATILE = 1
REG_OPTION_CREATE_LINK = 2
REG_OPTION_BACKUP_RESTORE = 4
REG_CREATED_NEW_KEY = 1
REG_OPENED_EXISTING_KEY = 2
REG_WHOLE_HIVE_VOLATILE = 1
REG_REFRESH_HIVE = 2
REG_NOTIFY_CHANGE_NAME = 1
REG_NOTIFY_CHANGE_ATTRIBUTES = 2
REG_NOTIFY_CHANGE_LAST_SET = 4
REG_NOTIFY_CHANGE_SECURITY = 8
REG_LEGAL_CHANGE_FILTER = REG_NOTIFY_CHANGE_NAME or REG_NOTIFY_CHANGE_ATTRIBUTES or REG_NOTIFY_CHANGE_LAST_SET or REG_NOTIFY_CHANGE_SECURITY
REG_LEGAL_OPTION = REG_OPTION_RESERVED or REG_OPTION_NON_VOLATILE or REG_OPTION_VOLATILE or REG_OPTION_CREATE_LINK or REG_OPTION_BACKUP_RESTORE
REG_NONE = 0
REG_SZ = 1
REG_EXPAND_SZ = 2
REG_BINARY = 3
REG_DWORD = 4
REG_DWORD_LITTLE_ENDIAN = 4
REG_DWORD_BIG_ENDIAN = 5
REG_LINK = 6
REG_MULTI_SZ = 7
REG_RESOURCE_LIST = 8
REG_FULL_RESOURCE_DESCRIPTOR = 9
REG_RESOURCE_REQUIREMENTS_LIST = 10
; Registry access modes
KEY_QUERY_VALUE = 1
KEY_SET_VALUE = 2
KEY_CREATE_SUB_KEY = 4
KEY_ENUMERATE_SUB_KEYS = 8
KEY_NOTIFY = 10h
KEY_CREATE_LINK = 20h
KEY_READ = STANDARD_RIGHTS_READ or KEY_QUERY_VALUE or KEY_ENUMERATE_SUB_KEYS or KEY_NOTIFY and not SYNCHRONIZE
KEY_WRITE = STANDARD_RIGHTS_WRITE or KEY_SET_VALUE or KEY_CREATE_SUB_KEY and not SYNCHRONIZE
KEY_EXECUTE = KEY_READ
KEY_ALL_ACCESS = STANDARD_RIGHTS_ALL or KEY_QUERY_VALUE or KEY_SET_VALUE or KEY_CREATE_SUB_KEY or KEY_ENUMERATE_SUB_KEYS or KEY_NOTIFY or KEY_CREATE_LINK and not SYNCHRONIZE
; Predefined registry keys
HKEY_CLASSES_ROOT = 80000000h
HKEY_CURRENT_USER = 80000001h
HKEY_LOCAL_MACHINE = 80000002h
HKEY_USERS = 80000003h
HKEY_PERFORMANCE_DATA = 80000004h
HKEY_CURRENT_CONFIG = 80000005h
HKEY_DYN_DATA = 80000006h
; FormatMessage flags
FORMAT_MESSAGE_ALLOCATE_BUFFER = 0100h
FORMAT_MESSAGE_IGNORE_INSERTS = 0200h
FORMAT_MESSAGE_FROM_STRING = 0400h
FORMAT_MESSAGE_FROM_HMODULE = 0800h
FORMAT_MESSAGE_FROM_SYSTEM = 1000h
FORMAT_MESSAGE_ARGUMENT_ARRAY = 2000h
FORMAT_MESSAGE_MAX_WIDTH_MASK = 00FFh
; Language identifiers
LANG_NEUTRAL = 00h
LANG_BULGARIAN = 02h
LANG_CHINESE = 04h
LANG_CROATIAN = 1Ah
LANG_CZECH = 05h
LANG_DANISH = 06h
LANG_DUTCH = 13h
LANG_ENGLISH = 09h
LANG_FINNISH = 0Bh
LANG_FRENCH = 0Ch
LANG_GERMAN = 07h
LANG_GREEK = 08h
LANG_HUNGARIAN = 0Eh
LANG_ICELANDIC = 0Fh
LANG_ITALIAN = 10h
LANG_JAPANESE = 11h
LANG_KOREAN = 12h
LANG_NORWEGIAN = 14h
LANG_POLISH = 15h
LANG_PORTUGUESE = 16h
LANG_ROMANIAN = 18h
LANG_RUSSIAN = 19h
LANG_SLOVAK = 1Bh
LANG_SLOVENIAN = 24h
LANG_SPANISH = 0Ah
LANG_SWEDISH = 1Dh
LANG_THAI = 1Eh
LANG_TURKISH = 1Fh
; Sublanguage identifiers
SUBLANG_NEUTRAL = 00h shl 10
SUBLANG_DEFAULT = 01h shl 10
SUBLANG_SYS_DEFAULT = 02h shl 10
SUBLANG_CHINESE_TRADITIONAL = 01h shl 10
SUBLANG_CHINESE_SIMPLIFIED = 02h shl 10
SUBLANG_CHINESE_HONGKONG = 03h shl 10
SUBLANG_CHINESE_SINGAPORE = 04h shl 10
SUBLANG_DUTCH = 01h shl 10
SUBLANG_DUTCH_BELGIAN = 02h shl 10
SUBLANG_ENGLISH_US = 01h shl 10
SUBLANG_ENGLISH_UK = 02h shl 10
SUBLANG_ENGLISH_AUS = 03h shl 10
SUBLANG_ENGLISH_CAN = 04h shl 10
SUBLANG_ENGLISH_NZ = 05h shl 10
SUBLANG_ENGLISH_EIRE = 06h shl 10
SUBLANG_FRENCH = 01h shl 10
SUBLANG_FRENCH_BELGIAN = 02h shl 10
SUBLANG_FRENCH_CANADIAN = 03h shl 10
SUBLANG_FRENCH_SWISS = 04h shl 10
SUBLANG_GERMAN = 01h shl 10
SUBLANG_GERMAN_SWISS = 02h shl 10
SUBLANG_GERMAN_AUSTRIAN = 03h shl 10
SUBLANG_ITALIAN = 01h shl 10
SUBLANG_ITALIAN_SWISS = 02h shl 10
SUBLANG_NORWEGIAN_BOKMAL = 01h shl 10
SUBLANG_NORWEGIAN_NYNORSK = 02h shl 10
SUBLANG_PORTUGUESE = 02h shl 10
SUBLANG_PORTUGUESE_BRAZILIAN = 01h shl 10
SUBLANG_SPANISH = 01h shl 10
SUBLANG_SPANISH_MEXICAN = 02h shl 10
SUBLANG_SPANISH_MODERN = 03h shl 10
; Sorting identifiers
SORT_DEFAULT = 0 shl 16
SORT_JAPANESE_XJIS = 0 shl 16
SORT_JAPANESE_UNICODE = 1 shl 16
SORT_CHINESE_BIG5 = 0 shl 16
SORT_CHINESE_PRCP = 0 shl 16
SORT_CHINESE_UNICODE = 1 shl 16
SORT_CHINESE_PRC = 2 shl 16
SORT_CHINESE_BOPOMOFO = 3 shl 16
SORT_KOREAN_KSC = 0 shl 16
SORT_KOREAN_UNICODE = 1 shl 16
SORT_GERMAN_PHONE_BOOK = 1 shl 16
SORT_HUNGARIAN_DEFAULT = 0 shl 16
SORT_HUNGARIAN_TECHNICAL = 1 shl 16
; Code pages
CP_ACP = 0 ; default to ANSI code page
CP_OEMCP = 1 ; default to OEM code page
CP_MACCP = 2 ; default to MAC code page
CP_THREAD_ACP = 3 ; current thread's ANSI code page
CP_SYMBOL = 42 ; SYMBOL translations
CP_UTF7 = 65000 ; UTF-7 translation
CP_UTF8 = 65001 ; UTF-8 translation
; Resource types
RT_CURSOR = 1
RT_BITMAP = 2
RT_ICON = 3
RT_MENU = 4
RT_DIALOG = 5
RT_STRING = 6
RT_FONTDIR = 7
RT_FONT = 8
RT_ACCELERATOR = 9
RT_RCDATA = 10
RT_MESSAGETABLE = 11
RT_GROUP_CURSOR = 12
RT_GROUP_ICON = 14
RT_VERSION = 16
RT_DLGINCLUDE = 17
RT_PLUGPLAY = 19
RT_VXD = 20
RT_ANICURSOR = 21
RT_ANIICON = 22
RT_HTML = 23
RT_MANIFEST = 24
; Clipboard formats
CF_TEXT = 001h
CF_BITMAP = 002h
CF_METAFILEPICT = 003h
CF_SYLK = 004h
CF_DIF = 005h
CF_TIFF = 006h
CF_OEMTEXT = 007h
CF_DIB = 008h
CF_PALETTE = 009h
CF_PENDATA = 00Ah
CF_RIFF = 00Bh
CF_WAVE = 00Ch
CF_UNICODETEXT = 00Dh
CF_ENHMETAFILE = 00Eh
CF_HDROP = 00Fh
CF_LOCALE = 010h
CF_OWNERDISPLAY = 080h
CF_DSPTEXT = 081h
CF_DSPBITMAP = 082h
CF_DSPMETAFILEPICT = 083h
CF_DSPENHMETAFILE = 08Eh
CF_PRIVATEFIRST = 200h
CF_PRIVATELAST = 2FFh
CF_GDIOBJFIRST = 300h
CF_GDIOBJLAST = 3FFh
; OS types for version info
VOS_UNKNOWN = 00000000h
VOS_DOS = 00010000h
VOS_OS216 = 00020000h
VOS_OS232 = 00030000h
VOS_NT = 00040000h
VOS__BASE = 00000000h
VOS__WINDOWS16 = 00000001h
VOS__PM16 = 00000002h
VOS__PM32 = 00000003h
VOS__WINDOWS32 = 00000004h
VOS_DOS_WINDOWS16 = 00010001h
VOS_DOS_WINDOWS32 = 00010004h
VOS_OS216_PM16 = 00020002h
VOS_OS232_PM32 = 00030003h
VOS_NT_WINDOWS32 = 00040004h
; File types for version info
VFT_UNKNOWN = 00000000h
VFT_APP = 00000001h
VFT_DLL = 00000002h
VFT_DRV = 00000003h
VFT_FONT = 00000004h
VFT_VXD = 00000005h
VFT_STATIC_LIB = 00000007h
; File subtypes for version info
VFT2_UNKNOWN = 00000000h
VFT2_DRV_PRINTER = 00000001h
VFT2_DRV_KEYBOARD = 00000002h
VFT2_DRV_LANGUAGE = 00000003h
VFT2_DRV_DISPLAY = 00000004h
VFT2_DRV_MOUSE = 00000005h
VFT2_DRV_NETWORK = 00000006h
VFT2_DRV_SYSTEM = 00000007h
VFT2_DRV_INSTALLABLE = 00000008h
VFT2_DRV_SOUND = 00000009h
VFT2_DRV_COMM = 0000000Ah
VFT2_DRV_INPUTMETHOD = 0000000Bh
VFT2_DRV_VERSIONED_PRINTER = 0000000Ch
VFT2_FONT_RASTER = 00000001h
VFT2_FONT_VECTOR = 00000002h
VFT2_FONT_TRUETYPE = 00000003h
; Console control signals
CTRL_C_EVENT = 0
CTRL_BREAK_EVENT = 1
CTRL_CLOSE_EVENT = 2
CTRL_LOGOFF_EVENT = 5
CTRL_SHUTDOWN_EVENT = 6

View File

@ -0,0 +1,128 @@
; SHELL32.DLL structures and constants
struct NOTIFYICONDATA
cbSize dd ?
hWnd dd ?
uID dd ?
uFlags dd ?
uCallbackMessage dd ?
hIcon dd ?
szTip TCHAR 64 dup (?)
ends
struct NOTIFYICONDATAA
cbSize dd ?
hWnd dd ?
uID dd ?
uFlags dd ?
uCallbackMessage dd ?
hIcon dd ?
szTip db 64 dup (?)
ends
struct NOTIFYICONDATAW
cbSize dd ?
hWnd dd ?
uID dd ?
uFlags dd ?
uCallbackMessage dd ?
hIcon dd ?
szTip du 64 dup (?)
ends
struct BROWSEINFO
hwndOwner dd ?
pidlRoot dd ?
pszDisplayName dd ?
lpszTitle dd ?
ulFlags dd ?
lpfn dd ?
lParam dd ?
iImage dd ?
ends
; Taskbar icon messages
NIM_ADD = 0
NIM_MODIFY = 1
NIM_DELETE = 2
NIM_SETFOCUS = 3
NIM_SETVERSION = 4
; Taskbar icon flags
NIF_MESSAGE = 01h
NIF_ICON = 02h
NIF_TIP = 04h
NIF_STATE = 08h
NIF_INFO = 10h
NIF_GUID = 20h
; Constant Special Item ID List
CSIDL_DESKTOP = 0x0000
CSIDL_INTERNET = 0x0001
CSIDL_PROGRAMS = 0x0002
CSIDL_CONTROLS = 0x0003
CSIDL_PRINTERS = 0x0004
CSIDL_PERSONAL = 0x0005
CSIDL_FAVORITES = 0x0006
CSIDL_STARTUP = 0x0007
CSIDL_RECENT = 0x0008
CSIDL_SENDTO = 0x0009
CSIDL_BITBUCKET = 0x000A
CSIDL_STARTMENU = 0x000B
CSIDL_MYDOCUMENTS = 0x000C
CSIDL_MYMUSIC = 0x000D
CSIDL_MYVIDEO = 0x000E
CSIDL_DESKTOPDIRECTORY = 0x0010
CSIDL_DRIVES = 0x0011
CSIDL_NETWORK = 0x0012
CSIDL_NETHOOD = 0x0013
CSIDL_FONTS = 0x0014
CSIDL_TEMPLATES = 0x0015
CSIDL_COMMON_STARTMENU = 0x0016
CSIDL_COMMON_PROGRAMS = 0x0017
CSIDL_COMMON_STARTUP = 0x0018
CSIDL_COMMON_DESKTOPDIRECTORY = 0x0019
CSIDL_APPDATA = 0x001A
CSIDL_PRINTHOOD = 0x001B
CSIDL_LOCAL_APPDATA = 0x001C
CSIDL_ALTSTARTUP = 0x001D
CSIDL_COMMON_ALTSTARTUP = 0x001E
CSIDL_COMMON_FAVORITES = 0x001F
CSIDL_INTERNET_CACHE = 0x0020
CSIDL_COOKIES = 0x0021
CSIDL_HISTORY = 0x0022
CSIDL_COMMON_APPDATA = 0x0023
CSIDL_WINDOWS = 0x0024
CSIDL_SYSTEM = 0x0025
CSIDL_PROGRAM_FILES = 0x0026
CSIDL_MYPICTURES = 0x0027
CSIDL_PROFILE = 0x0028
CSIDL_SYSTEMX86 = 0x0029
CSIDL_PROGRAM_FILESX86 = 0x002A
CSIDL_PROGRAM_FILES_COMMON = 0x002B
CSIDL_PROGRAM_FILES_COMMONX86 = 0x002C
CSIDL_COMMON_TEMPLATES = 0x002D
CSIDL_COMMON_DOCUMENTS = 0x002E
CSIDL_COMMON_ADMINTOOLS = 0x002F
CSIDL_ADMINTOOLS = 0x0030
CSIDL_CONNECTIONS = 0x0031
CSIDL_COMMON_MUSIC = 0x0035
CSIDL_COMMON_PICTURES = 0x0036
CSIDL_COMMON_VIDEO = 0x0037
CSIDL_RESOURCES = 0x0038
CSIDL_RESOURCES_LOCALIZED = 0x0039
CSIDL_COMMON_OEM_LINKS = 0x003A
CSIDL_CDBURN_AREA = 0x003B
CSIDL_COMPUTERSNEARME = 0x003D
CSIDL_PROFILES = 0x003E
CSIDL_FOLDER_MASK = 0x00FF
CSIDL_FLAG_PER_USER_INIT = 0x0800
CSIDL_FLAG_NO_ALIAS = 0x1000
CSIDL_FLAG_DONT_VERIFY = 0x4000
CSIDL_FLAG_CREATE = 0x8000
CSIDL_FLAG_MASK = 0xFF00

View File

@ -0,0 +1,134 @@
; SHELL32.DLL structures and constants
struct NOTIFYICONDATA
cbSize dd ?
dd ?
hWnd dq ?
uID dd ?
uFlags dd ?
uCallbackMessage dd ?
dd ?
hIcon dq ?
szTip TCHAR 64 dup (?)
ends
struct NOTIFYICONDATAA
cbSize dd ?
dd ?
hWnd dq ?
uID dd ?
uFlags dd ?
uCallbackMessage dd ?
dd ?
hIcon dq ?
szTip db 64 dup (?)
ends
struct NOTIFYICONDATAW
cbSize dd ?
dd ?
hWnd dq ?
uID dd ?
uFlags dd ?
uCallbackMessage dd ?
dd ?
hIcon dq ?
szTip du 64 dup (?)
ends
struct BROWSEINFO
hwndOwner dq ?
pidlRoot dq ?
pszDisplayName dq ?
lpszTitle dq ?
ulFlags dd ?
dd ?
lpfn dq ?
lParam dq ?
iImage dq ?
ends
; Taskbar icon messages
NIM_ADD = 0
NIM_MODIFY = 1
NIM_DELETE = 2
NIM_SETFOCUS = 3
NIM_SETVERSION = 4
; Taskbar icon flags
NIF_MESSAGE = 01h
NIF_ICON = 02h
NIF_TIP = 04h
NIF_STATE = 08h
NIF_INFO = 10h
NIF_GUID = 20h
; Constant Special Item ID List
CSIDL_DESKTOP = 0x0000
CSIDL_INTERNET = 0x0001
CSIDL_PROGRAMS = 0x0002
CSIDL_CONTROLS = 0x0003
CSIDL_PRINTERS = 0x0004
CSIDL_PERSONAL = 0x0005
CSIDL_FAVORITES = 0x0006
CSIDL_STARTUP = 0x0007
CSIDL_RECENT = 0x0008
CSIDL_SENDTO = 0x0009
CSIDL_BITBUCKET = 0x000A
CSIDL_STARTMENU = 0x000B
CSIDL_MYDOCUMENTS = 0x000C
CSIDL_MYMUSIC = 0x000D
CSIDL_MYVIDEO = 0x000E
CSIDL_DESKTOPDIRECTORY = 0x0010
CSIDL_DRIVES = 0x0011
CSIDL_NETWORK = 0x0012
CSIDL_NETHOOD = 0x0013
CSIDL_FONTS = 0x0014
CSIDL_TEMPLATES = 0x0015
CSIDL_COMMON_STARTMENU = 0x0016
CSIDL_COMMON_PROGRAMS = 0x0017
CSIDL_COMMON_STARTUP = 0x0018
CSIDL_COMMON_DESKTOPDIRECTORY = 0x0019
CSIDL_APPDATA = 0x001A
CSIDL_PRINTHOOD = 0x001B
CSIDL_LOCAL_APPDATA = 0x001C
CSIDL_ALTSTARTUP = 0x001D
CSIDL_COMMON_ALTSTARTUP = 0x001E
CSIDL_COMMON_FAVORITES = 0x001F
CSIDL_INTERNET_CACHE = 0x0020
CSIDL_COOKIES = 0x0021
CSIDL_HISTORY = 0x0022
CSIDL_COMMON_APPDATA = 0x0023
CSIDL_WINDOWS = 0x0024
CSIDL_SYSTEM = 0x0025
CSIDL_PROGRAM_FILES = 0x0026
CSIDL_MYPICTURES = 0x0027
CSIDL_PROFILE = 0x0028
CSIDL_SYSTEMX86 = 0x0029
CSIDL_PROGRAM_FILESX86 = 0x002A
CSIDL_PROGRAM_FILES_COMMON = 0x002B
CSIDL_PROGRAM_FILES_COMMONX86 = 0x002C
CSIDL_COMMON_TEMPLATES = 0x002D
CSIDL_COMMON_DOCUMENTS = 0x002E
CSIDL_COMMON_ADMINTOOLS = 0x002F
CSIDL_ADMINTOOLS = 0x0030
CSIDL_CONNECTIONS = 0x0031
CSIDL_COMMON_MUSIC = 0x0035
CSIDL_COMMON_PICTURES = 0x0036
CSIDL_COMMON_VIDEO = 0x0037
CSIDL_RESOURCES = 0x0038
CSIDL_RESOURCES_LOCALIZED = 0x0039
CSIDL_COMMON_OEM_LINKS = 0x003A
CSIDL_CDBURN_AREA = 0x003B
CSIDL_COMPUTERSNEARME = 0x003D
CSIDL_PROFILES = 0x003E
CSIDL_FOLDER_MASK = 0x00FF
CSIDL_FLAG_PER_USER_INIT = 0x0800
CSIDL_FLAG_NO_ALIAS = 0x1000
CSIDL_FLAG_DONT_VERIFY = 0x4000
CSIDL_FLAG_CREATE = 0x8000
CSIDL_FLAG_MASK = 0xFF00

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,124 @@
; WSOCK32.DLL structures and constants
struct WSADATA
wVersion dw ?
wHighVersion dw ?
szDescription db 256+1 dup (?)
szSystemStatus db 128+1 dup (?)
iMaxSockets dw ?
iMaxUdpDg dw ?
_padding_ db 2 dup (?)
lpVendorInfo dd ?
ends
struct hostent
h_name dd ?
h_aliases dd ?
h_addrtype dw ?
h_length dw ?
h_addr_list dd ?
ends
struct sockaddr_in
sin_family dw ?
sin_port dw ?
sin_addr dd ?
sin_zero db 8 dup (?)
ends
struct sockaddr
sa_family dw ?
sa_data db 14 dup (?)
ends
; Socket types
SOCK_STREAM = 1
SOCK_DGRAM = 2
SOCK_RAW = 3
SOCK_RDM = 4
SOCK_SEQPACKET = 5
; Address formats
AF_UNSPEC = 0
AF_UNIX = 1
AF_INET = 2
AF_IMPLINK = 3
AF_PUP = 4
AF_CHAOS = 5
AF_NS = 6
AF_IPX = 6
AF_ISO = 7
AF_OSI = AF_ISO
AF_ECMA = 8
AF_DATAKIT = 9
AF_CCITT = 10
AF_SNA = 11
AF_DECnet = 12
AF_DLI = 13
AF_LAT = 14
AF_HYLINK = 15
AF_APPLETALK = 16
AF_NETBIOS = 17
; Protocol formats
PF_UNSPEC = 0
PF_UNIX = 1
PF_INET = 2
PF_IMPLINK = 3
PF_PUP = 4
PF_CHAOS = 5
PF_NS = 6
PF_IPX = 6
PF_ISO = 7
PF_OSI = PF_ISO
PF_ECMA = 8
PF_DATAKIT = 9
PF_CCITT = 10
PF_SNA = 11
PF_DECnet = 12
PF_DLI = 13
PF_LAT = 14
PF_HYLINK = 15
PF_APPLETALK = 16
PF_NETBIOS = 17
; IP Ports
IPPORT_ECHO = 7
IPPORT_DISCARD = 9
IPPORT_SYSTAT = 11
IPPORT_DAYTIME = 13
IPPORT_NETSTAT = 15
IPPORT_FTP = 21
IPPORT_TELNET = 23
IPPORT_SMTP = 25
IPPORT_TIMESERVER = 37
IPPORT_NAMESERVER = 42
IPPORT_WHOIS = 43
IPPORT_MTP = 57
IPPORT_TFTP = 69
IPPORT_RJE = 77
IPPORT_FINGER = 79
IPPORT_TTYLINK = 87
IPPORT_SUPDUP = 95
IPPORT_EXECSERVER = 512
IPPORT_LOGINSERVER = 513
IPPORT_CMDSERVER = 514
IPPORT_EFSSERVER = 520
IPPORT_BIFFUDP = 512
IPPORT_WHOSERVER = 513
IPPORT_ROUTESERVER = 520
IPPORT_RESERVED = 1024
; Notifications
FD_READ = 01h
FD_WRITE = 02h
FD_OOB = 04h
FD_ACCEPT = 08h
FD_CONNECT = 10h
FD_CLOSE = 20h

View File

@ -0,0 +1,9 @@
include 'dd.inc'
include 'align.inc'
include 'format.inc'
include 'x86-2.inc'
use everything
include '@@.inc'
include 'times.inc'
include 'fix.inc'

View File

@ -0,0 +1,31 @@
define fix? fix?
fix... = 0
calminstruction (name) fix? &value&
arrange name, fix.name
publish name, value
check fix...
jyes done
compute fix..., 1
arrange name, fix.=enable
assemble name
done:
end calminstruction
macro fix?.enable? chain
chain
macro include?! file*, head
include file, fix.enable head
purge ?, include?
end macro
calminstruction ?! &line&
local any
match any =fix? any?, line
jyes skip
transform line, fix
skip:
assemble line
end calminstruction
end macro

View File

@ -0,0 +1,381 @@
define format? format.extension
calminstruction format? statement*
local ext
match statement =as? ext, statement
jno pass
publish format:, ext
pass:
arrange statement, =format statement
assemble statement
end calminstruction
postpone
if definite format
format.binary as format
end if
end postpone
macro local_include? instr
local pos,chr,path
pos = lengthof __FILE__
while pos
chr = (__FILE__ shr (8*(pos-1))) and 0FFh
if chr = '/' | chr = '\'
break
end if
pos = pos - 1
end while
path = string __FILE__ and not ( (-1) shl (8*pos) )
macro instr file
include path bappend file
end macro
end macro
local_include __include
macro format?.MZ?
if ~ definite format
format binary as 'exe'
end if
__include 'format/mz.inc'
end macro
macro format?.PE? settings
PE.Settings.Characteristics = IMAGE_FILE_EXECUTABLE_IMAGE or IMAGE_FILE_32BIT_MACHINE or IMAGE_FILE_LINE_NUMS_STRIPPED or IMAGE_FILE_LOCAL_SYMS_STRIPPED
PE.Settings.DllCharacteristics = 0
PE.Settings.Subsystem = IMAGE_SUBSYSTEM_WINDOWS_CUI
local seq
define seq settings:
while 1
match :, seq
break
else match =DLL? more, seq
PE.Settings.Characteristics = PE.Settings.Characteristics or IMAGE_FILE_DLL
redefine seq more
else match =large? more, seq
PE.Settings.Characteristics = PE.Settings.Characteristics or IMAGE_FILE_LARGE_ADDRESS_AWARE
redefine seq more
else match =WDM? more, seq
PE.Settings.DllCharacteristics = PE.Settings.DllCharacteristics or IMAGE_DLLCHARACTERISTICS_WDM_DRIVER
redefine seq more
else match =NX? more, seq
PE.Settings.DllCharacteristics = PE.Settings.DllCharacteristics or IMAGE_DLLCHARACTERISTICS_NX_COMPAT
redefine seq more
else match =at? base =on? stub :, seq
PE.Settings.ImageBase = base
PE.Settings.Stub = stub
break
else match =at? base :, seq
PE.Settings.ImageBase = base
break
else match =on? stub :, seq
PE.Settings.Stub = stub
break
else
match =GUI? more, seq
PE.Settings.Subsystem = IMAGE_SUBSYSTEM_WINDOWS_GUI
redefine seq more
else match =console? more, seq
PE.Settings.Subsystem = IMAGE_SUBSYSTEM_WINDOWS_CUI
redefine seq more
else match =native? more, seq
PE.Settings.Subsystem = IMAGE_SUBSYSTEM_NATIVE
PE.Settings.SectionAlignment = 32
PE.Settings.FileAlignment = 32
redefine seq more
else match =EFI? more, seq
PE.Settings.Magic = 0x20B
PE.Settings.Subsystem = IMAGE_SUBSYSTEM_EFI_APPLICATION
redefine seq more
else match =EFIboot? more, seq
PE.Settings.Magic = 0x20B
PE.Settings.Subsystem = IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER
redefine seq more
else match =EFIruntime? more, seq
PE.Settings.Magic = 0x20B
PE.Settings.Subsystem = IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER
redefine seq more
else
err 'invalid argument'
break
end match
match V.v more, seq
PE.Settings.MajorSubsystemVersion = V
PE.Settings.MinorSubsystemVersion = v
redefine seq more
end match
end match
end while
if ~ definite format
if PE.Settings.Subsystem = IMAGE_SUBSYSTEM_EFI_APPLICATION | PE.Settings.Subsystem = IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER | PE.Settings.Subsystem = IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER
format binary as 'efi'
else if PE.Settings.Characteristics and IMAGE_FILE_DLL
format binary as 'dll'
else
format binary as 'exe'
end if
end if
__include 'format/pe.inc'
use32
end macro
macro format?.PE64? settings
PE.Settings.Magic = 0x20B
PE.Settings.Machine = IMAGE_FILE_MACHINE_AMD64
PE.Settings.Characteristics = IMAGE_FILE_EXECUTABLE_IMAGE or IMAGE_FILE_LARGE_ADDRESS_AWARE or IMAGE_FILE_LINE_NUMS_STRIPPED or IMAGE_FILE_LOCAL_SYMS_STRIPPED
PE.Settings.DllCharacteristics = 0
PE.Settings.Subsystem = IMAGE_SUBSYSTEM_WINDOWS_CUI
PE.Settings.MajorSubsystemVersion = 5
PE.Settings.MinorSubsystemVersion = 0
local seq
define seq settings:
while 1
match :, seq
break
else match =DLL? more, seq
PE.Settings.Characteristics = PE.Settings.Characteristics or IMAGE_FILE_DLL
redefine seq more
else match =WDM? more, seq
PE.Settings.DllCharacteristics = PE.Settings.DllCharacteristics or IMAGE_DLLCHARACTERISTICS_WDM_DRIVER
redefine seq more
else match =NX? more, seq
PE.Settings.DllCharacteristics = PE.Settings.DllCharacteristics or IMAGE_DLLCHARACTERISTICS_NX_COMPAT
redefine seq more
else match =at? base =on? stub :, seq
PE.Settings.ImageBase = base
PE.Settings.Stub = stub
break
else match =at? base :, seq
PE.Settings.ImageBase = base
break
else match =on? stub :, seq
PE.Settings.Stub = stub
break
else
match =GUI? more, seq
PE.Settings.Subsystem = IMAGE_SUBSYSTEM_WINDOWS_GUI
redefine seq more
else match =console? more, seq
PE.Settings.Subsystem = IMAGE_SUBSYSTEM_WINDOWS_CUI
redefine seq more
else match =native? more, seq
PE.Settings.Subsystem = IMAGE_SUBSYSTEM_NATIVE
PE.Settings.SectionAlignment = 32
PE.Settings.FileAlignment = 32
redefine seq more
else match =EFI? more, seq
PE.Settings.Subsystem = IMAGE_SUBSYSTEM_EFI_APPLICATION
redefine seq more
else match =EFIboot? more, seq
PE.Settings.Subsystem = IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER
redefine seq more
else match =EFIruntime? more, seq
PE.Settings.Subsystem = IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER
redefine seq more
else
err 'invalid argument'
break
end match
match V.v more, seq
PE.Settings.MajorSubsystemVersion = V
PE.Settings.MinorSubsystemVersion = v
redefine seq more
end match
end match
end while
if ~ definite format
if PE.Settings.Subsystem = IMAGE_SUBSYSTEM_EFI_APPLICATION | PE.Settings.Subsystem = IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER | PE.Settings.Subsystem = IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER
format binary as 'efi'
else if PE.Settings.Characteristics and IMAGE_FILE_DLL
format binary as 'dll'
else
format binary as 'exe'
end if
end if
__include 'format/pe.inc'
use64
end macro
macro format?.ELF? variant
match , variant
if ~ definite format
format binary as 'o'
end if
__include 'format/elf32.inc'
use32
else match =executable? settings, variant:
match brand =at? base:, settings
ELF.Settings.ABI = brand
ELF.Settings.BaseAddress = base
else match =at? base:, settings
ELF.Settings.BaseAddress = base
else match brand:, settings
ELF.Settings.ABI = brand
end match
__include 'format/elfexe.inc'
use32
else match =dynamic? settings, variant:
ELF.Settings.Type = ET_DYN
match brand =at? base:, settings
ELF.Settings.ABI = brand
ELF.Settings.BaseAddress = base
else match =at? base:, settings
ELF.Settings.BaseAddress = base
else match brand:, settings
ELF.Settings.ABI = brand
end match
__include 'format/elfexe.inc'
use32
else
err 'invalid argument'
end match
end macro
macro format?.ELF64? variant
match , variant
if ~ definite format
format binary as 'o'
end if
__include 'format/elf64.inc'
use64
else match =executable? settings, variant:
ELF.Settings.Class = ELFCLASS64
ELF.Settings.Machine = EM_X86_64
ELF.Settings.BaseAddress = 400000h
match brand =at? base:, settings
ELF.Settings.ABI = brand
ELF.Settings.BaseAddress = base
else match =at? base:, settings
ELF.Settings.BaseAddress = base
else match brand:, settings
ELF.Settings.ABI = brand
end match
__include 'format/elfexe.inc'
use64
else match =dynamic? settings, variant:
ELF.Settings.Class = ELFCLASS64
ELF.Settings.Type = ET_DYN
ELF.Settings.Machine = EM_X86_64
ELF.Settings.BaseAddress = 400000h
match brand =at? base:, settings
ELF.Settings.ABI = brand
ELF.Settings.BaseAddress = base
else match =at? base:, settings
ELF.Settings.BaseAddress = base
else match brand:, settings
ELF.Settings.ABI = brand
end match
__include 'format/elfexe.inc'
use64
else
err 'invalid argument'
end match
end macro
macro format?.ELFx32? variant
match , variant
if ~ definite format
format binary as 'o'
end if
ELF.Settings.Machine = EM_X86_64
__include 'format/elf32.inc'
use64
else match =executable? settings, variant:
ELF.Settings.Class = ELFCLASS32
ELF.Settings.Machine = EM_X86_64
ELF.Settings.BaseAddress = 400000h
match brand =at? base:, settings
ELF.Settings.ABI = brand
ELF.Settings.BaseAddress = base
else match =at? base:, settings
ELF.Settings.BaseAddress = base
else match brand:, settings
ELF.Settings.ABI = brand
end match
__include 'format/elfexe.inc'
use64
else
err 'invalid argument'
end match
end macro
macro format?.COFF?
if ~ definite format
format binary as 'obj'
end if
__include 'format/coff.inc'
use32
end macro
macro format?.MS? variant
match =COFF?, variant
if ~ definite format
format binary as 'obj'
end if
COFF.Settings.Characteristics = IMAGE_FILE_32BIT_MACHINE or IMAGE_FILE_LINE_NUMS_STRIPPED or IMAGE_FILE_BYTES_REVERSED_LO
__include 'format/coffms.inc'
use32
else
err 'invalid argument'
end match
end macro
macro format?.MS64? variant
match =COFF?, variant
if ~ definite format
format binary as 'obj'
end if
COFF.Settings.Machine = IMAGE_FILE_MACHINE_AMD64
COFF.Settings.Characteristics = IMAGE_FILE_32BIT_MACHINE or IMAGE_FILE_LINE_NUMS_STRIPPED or IMAGE_FILE_BYTES_REVERSED_LO
__include 'format/coffms.inc'
use64
else
err 'invalid argument'
end match
end macro
macro format?.MachO? variant
match , variant
if ~ definite format
format binary as 'o'
end if
MachO.Settings.FileType equ MH_OBJECT
__include 'format/macho.inc'
use32
else match =executable?, variant
MachO.Settings.BaseAddress = 0x1000
__include 'format/macho.inc'
use32
else match =executable? at? base, variant
MachO.Settings.BaseAddress = base
__include 'format/macho.inc'
use32
else
err 'invalid argument'
end match
end macro
macro format?.MachO64? variant
MachO.Settings.ProcessorType equ CPU_TYPE_X86_64
MachO.Settings.ProcessorSubtype equ CPU_SUBTYPE_X86_64_ALL
match , variant
if ~ definite format
format binary as 'o'
end if
MachO.Settings.FileType equ MH_OBJECT
__include 'format/macho.inc'
use64
else match =executable?, variant
MachO.Settings.BaseAddress = 0x100000000
__include 'format/macho.inc'
use64
else match =executable? =at? base, variant
MachO.Settings.BaseAddress = base
__include 'format/macho.inc'
use64
else
err 'invalid argument'
end match
end macro

View File

@ -0,0 +1,403 @@
macro struct? name
macro end?.struct?!
end namespace
esc end struc
virtual at 0
name name
sizeof.name = $
end virtual
purge end?.struct?
end macro
esc struc name
label . : sizeof.name
namespace .
end macro
struct SCNHDR
s_name db 8 dup ?
s_paddr dd ?
s_vaddr dd ?
s_size dd ?
s_scnptr dd ?
s_relptr dd ?
s_lnnoptr dd ?
s_nreloc dw ?
s_nlnno dw ?
s_flags dd ?
end struct
SCNHSZ = sizeof SCNHDR
struct RELOC
r_vaddr dd ?
r_symndx dd ?
r_type dw ?
end struct
RELSZ = sizeof RELOC
struct SYMENT
e_name db 8 dup ?
virtual at e_name
e_zeroes dd ?
e_offset dd ?
end virtual
e_value dd ?
e_scnum dw ?
e_type dw ?
e_sclass db ?
e_numaux db ?
end struct
SYMESZ = sizeof SYMENT
I386MAGIC = 0x14c
F_RELFLG = 0x0001
F_EXEC = 0x0002
F_LNNO = 0x0004
F_LSYMS = 0x0008
F_AR32WR = 0x0100
STYP_TEXT = 0x0020
STYP_DATA = 0x0040
STYP_BSS = 0x0080
N_UNDEF = 0
N_ABS = -1
N_DEBUG = -2
T_NULL = 0000b
T_VOID = 0001b
T_CHAR = 0010b
T_SHORT = 0011b
T_INT = 0100b
T_LONG = 0101b
T_FLOAT = 0110b
T_DOUBLE = 0111b
T_STRUCT = 1000b
T_UNION = 1001b
T_ENUM = 1010b
T_MOE = 1011b
T_UCHAR = 1100b
T_USHORT = 1101b
T_UINT = 1110b
T_ULONG = 1111b
T_LNGDBL = 01_0000b
DT_NON = 00b
DT_PTR = 01b
DT_FCN = 10b
DT_ARY = 11b
C_NULL = 0
C_AUTO = 1
C_EXT = 2
C_STAT = 3
C_REG = 4
C_EXTDEF = 5
C_LABEL = 6
C_ULABEL = 7
C_MOS = 8
C_ARG = 9
C_STRTAG = 10
C_MOU = 11
C_UNTAG = 12
C_TPDEF = 13
C_USTATIC = 14
C_ENTAG = 15
C_MOE = 16
C_REGPARM = 17
C_FIELD = 18
C_AUTOARG = 19
C_LASTENT = 20
C_BLOCK = 100
C_FCN = 101
C_EOS = 102
C_FILE = 103
C_LINE = 104
C_ALIAS = 105
C_HIDDEN = 106
C_EFCN = 255
RELOC_ADDR32 = 6
RELOC_REL32 = 20
COFF::
namespace COFF
Header:
f_magic dw I386MAGIC
f_nscns dw NUMBER_OF_SECTIONS
f_timdat dd __TIME__
f_symptr dd SYMBOL_TABLE_OFFSET
f_nsyms dd NUMBER_OF_SYMBOLS
f_opthdr dw 0
f_flags dw F_AR32WR + F_LNNO
Sections: db NUMBER_OF_SECTIONS * SCNHSZ dup 0
virtual at 0
symbol_table:: rb NUMBER_OF_SYMBOLS * SYMESZ
end virtual
virtual at 0
string_table:: dd STRING_TABLE_SIZE
STRING_POSITION = $
rb STRING_TABLE_SIZE - $
end virtual
virtual at 0
relocations:: rb NUMBER_OF_RELOCATIONS * RELSZ
end virtual
element relocatable?
macro section_start
local sym
element sym : relocatable * (1+SECTION_INDEX) + SYMBOL_INDEX
SECTION_BASE = sym
org sym
align.assume sym, SECTION_ALIGN
if DEFINED_SECTION | defined DEFAULT_SECTION
store SECTION_NAME : 8 at symbol_table : SYMBOL_INDEX * SYMESZ + SYMENT.e_name
store C_STAT at symbol_table : SYMBOL_INDEX * SYMESZ + SYMENT.e_sclass
store 1+SECTION_INDEX at symbol_table : SYMBOL_INDEX * SYMESZ + SYMENT.e_scnum
SYMBOL_INDEX = SYMBOL_INDEX + 1
end if
end macro
RELOCATION_INDEX = 0
SECTION_INDEX = 0
SECTION_RELOCATION_INDEX = RELOCATION_INDEX
SYMBOL_INDEX = 0
SECTION_OFFSET = $%
SECTION_ALIGN = 4
SECTION_NAME = '.flat'
SECTION_FLAGS = STYP_TEXT + STYP_DATA
DEFINED_SECTION = 0
section_start
end namespace
macro section?
namespace COFF
SECTION_SIZE = $% - SECTION_OFFSET
if DEFINED_SECTION | SECTION_SIZE > 0
if ~ DEFINED_SECTION
DEFAULT_SECTION := 1
end if
if $%% = SECTION_OFFSET
SECTION_FLAGS = SECTION_FLAGS or STYP_BSS
SECTION_OFFSET = 0
section $
else
UNINITIALIZED_LENGTH = $% - $%%
section $
db UNINITIALIZED_LENGTH dup 0
end if
store SECTION_NAME : 8 at COFF:Sections + SECTION_INDEX * SCNHSZ + SCNHDR.s_name
store SECTION_OFFSET at COFF:Sections + SECTION_INDEX * SCNHSZ + SCNHDR.s_scnptr
store SECTION_SIZE at COFF:Sections + SECTION_INDEX * SCNHSZ + SCNHDR.s_size
store SECTION_FLAGS at COFF:Sections + SECTION_INDEX * SCNHSZ + SCNHDR.s_flags
if RELOCATION_INDEX > SECTION_RELOCATION_INDEX
store RELOCATION_INDEX - SECTION_RELOCATION_INDEX at COFF:Sections + SECTION_INDEX * SCNHSZ + SCNHDR.s_nreloc
store RELOCATIONS_OFFSET + SECTION_RELOCATION_INDEX * RELSZ at COFF:Sections + SECTION_INDEX * SCNHSZ + SCNHDR.s_relptr
end if
SECTION_INDEX = SECTION_INDEX + 1
end if
end namespace
end macro
macro section? declaration*
namespace COFF
section
DEFINED_SECTION = 1
SECTION_FLAGS = 0
SECTION_OFFSET = $%
SECTION_ALIGN = 4
match name attributes, declaration
SECTION_NAME = name
local seq,list
define seq attributes
while 1
match car cdr, seq
define list car
define seq cdr
else
match any, seq
define list any
end match
break
end match
end while
irpv attribute, list
match =code?, attribute
SECTION_FLAGS = SECTION_FLAGS or STYP_TEXT
else match =data?, attribute
SECTION_FLAGS = SECTION_FLAGS or STYP_DATA
else
err 'unknown attribute "',`attribute,'"'
end match
end irpv
else
SECTION_NAME = declaration
end match
section_start
SECTION_RELOCATION_INDEX = RELOCATION_INDEX
end namespace
end macro
macro public? declaration*
namespace COFF
match =static? value =as? str, declaration
SYMBOL_VALUE = value
SYMBOL_NAME = string str
SYMBOL_CLASS = C_STAT
else match value =as? str, declaration
SYMBOL_VALUE = value
SYMBOL_NAME = string str
SYMBOL_CLASS = C_EXT
else match =static? value, declaration
SYMBOL_VALUE = value
SYMBOL_NAME = `value
SYMBOL_CLASS = C_STAT
else
SYMBOL_VALUE = declaration
SYMBOL_NAME = `declaration
SYMBOL_CLASS = C_EXT
end match
if SYMBOL_VALUE relativeto 1 elementof SYMBOL_VALUE & 1 elementof (1 metadataof SYMBOL_VALUE) relativeto relocatable & 1 scaleof (1 metadataof SYMBOL_VALUE) > 0
SYMBOL_SECTION_INDEX = 1 scaleof (1 metadataof SYMBOL_VALUE)
SYMBOL_VALUE = SYMBOL_VALUE - 1 elementof SYMBOL_VALUE
else
SYMBOL_SECTION_INDEX = N_ABS
end if
if lengthof SYMBOL_NAME > 8
store 0 at symbol_table : SYMBOL_INDEX * SYMESZ + SYMENT.e_zeroes
store STRING_POSITION at symbol_table : SYMBOL_INDEX * SYMESZ + SYMENT.e_offset
store SYMBOL_NAME : lengthof SYMBOL_NAME at string_table:STRING_POSITION
STRING_POSITION = STRING_POSITION + lengthof SYMBOL_NAME + 1
else
store SYMBOL_NAME : 8 at symbol_table : SYMBOL_INDEX * SYMESZ + SYMENT.e_name
end if
store SYMBOL_VALUE at symbol_table : SYMBOL_INDEX * SYMESZ + SYMENT.e_value
store SYMBOL_SECTION_INDEX at symbol_table : SYMBOL_INDEX * SYMESZ + SYMENT.e_scnum
store SYMBOL_CLASS at symbol_table : SYMBOL_INDEX * SYMESZ + SYMENT.e_sclass
SYMBOL_INDEX = SYMBOL_INDEX + 1
end namespace
end macro
macro extrn? declaration*
namespace COFF
local sym,psym
element sym : relocatable * (-1) + SYMBOL_INDEX
match str =as? name:size, declaration
label name:size at sym
SYMBOL_NAME = string str
else match name:size, declaration
label name:size at sym
SYMBOL_NAME = `name
else match str =as? name, declaration
label name at sym
SYMBOL_NAME = string str
else
label declaration at sym
SYMBOL_NAME = `declaration
end match
if lengthof SYMBOL_NAME > 8
store 0 at symbol_table : SYMBOL_INDEX * SYMESZ + SYMENT.e_zeroes
store STRING_POSITION at symbol_table : SYMBOL_INDEX * SYMESZ + SYMENT.e_offset
store SYMBOL_NAME : lengthof SYMBOL_NAME at string_table:STRING_POSITION
STRING_POSITION = STRING_POSITION + lengthof SYMBOL_NAME + 1
else
store SYMBOL_NAME : 8 at symbol_table : SYMBOL_INDEX * SYMESZ + SYMENT.e_name
end if
store C_EXT at symbol_table : SYMBOL_INDEX * SYMESZ + SYMENT.e_sclass
SYMBOL_INDEX = SYMBOL_INDEX + 1
end namespace
end macro
calminstruction dword? value
compute value, value
check ~ value relativeto 0 & value relativeto 1 elementof value & 1 elementof (1 metadataof value) relativeto COFF.relocatable
jyes addr32
check ~ value relativeto 0 & (value + COFF.SECTION_BASE) relativeto 1 elementof (value + COFF.SECTION_BASE)
jno plain
check 1 elementof (1 metadataof (value + COFF.SECTION_BASE)) relativeto COFF.relocatable
jyes rel32
plain:
emit 4, value
exit
local offset, symndx, type
addr32:
compute symndx, 0 scaleof (1 metadataof value)
compute type, RELOC_ADDR32
jump add_relocation
rel32:
compute value, value + COFF.SECTION_BASE
compute symndx, 0 scaleof (1 metadataof value)
compute type, RELOC_REL32
jump add_relocation
add_relocation:
compute offset, $%
emit 4, 0 scaleof value
check $% > offset
jno done
compute offset, offset - COFF.SECTION_OFFSET
local reloc
compute reloc, COFF.RELOCATION_INDEX * RELSZ
asm store offset at COFF.relocations : reloc + RELOC.r_vaddr
asm store symndx at COFF.relocations : reloc + RELOC.r_symndx
asm store type at COFF.relocations : reloc + RELOC.r_type
compute COFF.RELOCATION_INDEX, COFF.RELOCATION_INDEX + 1
done:
end calminstruction
postpone
purge section?
section
namespace COFF
NUMBER_OF_SECTIONS := SECTION_INDEX
STRING_TABLE_SIZE := STRING_POSITION
NUMBER_OF_SYMBOLS := SYMBOL_INDEX
NUMBER_OF_RELOCATIONS := RELOCATION_INDEX
RELOCATIONS_OFFSET = $%
load byte_sequence : NUMBER_OF_RELOCATIONS * RELSZ from relocations:0
db byte_sequence
SYMBOL_TABLE_OFFSET = $%
load byte_sequence : NUMBER_OF_SYMBOLS * SYMESZ from symbol_table:0
db byte_sequence
load byte_sequence : STRING_TABLE_SIZE from string_table:0
db byte_sequence
end namespace
end postpone

View File

@ -0,0 +1,684 @@
macro struct? name
macro end?.struct?!
end namespace
esc end struc
virtual at 0
name name
sizeof.name = $
end virtual
purge end?.struct?
end macro
esc struc name
label . : sizeof.name
namespace .
end macro
struct IMAGE_SECTION_HEADER
Name db 8 dup ?
VirtualSize dd ?
VirtualAddress dd ?
SizeOfRawData dd ?
PointerToRawData dd ?
PointerToRelocations dd ?
PointerToLinenumbers dd ?
NumberOfRelocations dw ?
NumberOfLinenumbers dw ?
Characteristics dd ?
end struct
struct IMAGE_RELOCATION
VirtualAddress dd ?
SymbolTableIndex dd ?
Type dw ?
end struct
struct IMAGE_SYMBOL
ShortName db 8 dup ?
virtual at ShortName
Zeroes dd ?
Offset dd ?
end virtual
Value dd ?
SectionNumber dw ?
Type dw ?
StorageClass db ?
NumberOfAuxSymbols db ?
end struct
IMAGE_FILE_MACHINE_UNKNOWN = 0x0
IMAGE_FILE_MACHINE_AM33 = 0x1D3
IMAGE_FILE_MACHINE_AMD64 = 0x8664
IMAGE_FILE_MACHINE_ARM = 0x1C0
IMAGE_FILE_MACHINE_ARMNT = 0x1C4
IMAGE_FILE_MACHINE_ARM64 = 0xAA64
IMAGE_FILE_MACHINE_EBC = 0xEBC
IMAGE_FILE_MACHINE_I386 = 0x14C
IMAGE_FILE_MACHINE_IA64 = 0x200
IMAGE_FILE_MACHINE_M32R = 0x9041
IMAGE_FILE_MACHINE_MIPS16 = 0x266
IMAGE_FILE_MACHINE_MIPSFPU = 0x366
IMAGE_FILE_MACHINE_MIPSFPU16 = 0x466
IMAGE_FILE_MACHINE_POWERPC = 0x1F0
IMAGE_FILE_MACHINE_POWERPCFP = 0x1F1
IMAGE_FILE_MACHINE_R4000 = 0x166
IMAGE_FILE_MACHINE_SH3 = 0x1A2
IMAGE_FILE_MACHINE_SH3DSP = 0x1A3
IMAGE_FILE_MACHINE_SH4 = 0x1A6
IMAGE_FILE_MACHINE_SH5 = 0x1A8
IMAGE_FILE_MACHINE_THUMB = 0x1C2
IMAGE_FILE_MACHINE_WCEMIPSV2 = 0x169
IMAGE_FILE_RELOCS_STRIPPED = 0x0001
IMAGE_FILE_EXECUTABLE_IMAGE = 0x0002
IMAGE_FILE_LINE_NUMS_STRIPPED = 0x0004
IMAGE_FILE_LOCAL_SYMS_STRIPPED = 0x0008
IMAGE_FILE_AGGRESSIVE_WS_TRIM = 0x0010
IMAGE_FILE_LARGE_ADDRESS_AWARE = 0x0020
IMAGE_FILE_BYTES_REVERSED_LO = 0x0080
IMAGE_FILE_32BIT_MACHINE = 0x0100
IMAGE_FILE_DEBUG_STRIPPED = 0x0200
IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP = 0x0400
IMAGE_FILE_NET_RUN_FROM_SWAP = 0x0800
IMAGE_FILE_SYSTEM = 0x1000
IMAGE_FILE_DLL = 0x2000
IMAGE_FILE_UP_SYSTEM_ONLY = 0x4000
IMAGE_FILE_BYTES_REVERSED_HI = 0x8000
IMAGE_SCN_TYPE_NO_PAD = 0x00000008
IMAGE_SCN_CNT_CODE = 0x00000020
IMAGE_SCN_CNT_INITIALIZED_DATA = 0x00000040
IMAGE_SCN_CNT_UNINITIALIZED_DATA = 0x00000080
IMAGE_SCN_LNK_OTHER = 0x00000100
IMAGE_SCN_LNK_INFO = 0x00000200
IMAGE_SCN_LNK_REMOVE = 0x00000800
IMAGE_SCN_LNK_COMDAT = 0x00001000
IMAGE_SCN_GPREL = 0x00008000
IMAGE_SCN_MEM_PURGEABLE = 0x00020000
IMAGE_SCN_MEM_16BIT = 0x00020000
IMAGE_SCN_MEM_LOCKED = 0x00040000
IMAGE_SCN_MEM_PRELOAD = 0x00080000
IMAGE_SCN_ALIGN_1BYTES = 0x00100000
IMAGE_SCN_ALIGN_2BYTES = 0x00200000
IMAGE_SCN_ALIGN_4BYTES = 0x00300000
IMAGE_SCN_ALIGN_8BYTES = 0x00400000
IMAGE_SCN_ALIGN_16BYTES = 0x00500000
IMAGE_SCN_ALIGN_32BYTES = 0x00600000
IMAGE_SCN_ALIGN_64BYTES = 0x00700000
IMAGE_SCN_ALIGN_128BYTES = 0x00800000
IMAGE_SCN_ALIGN_256BYTES = 0x00900000
IMAGE_SCN_ALIGN_512BYTES = 0x00A00000
IMAGE_SCN_ALIGN_1024BYTES = 0x00B00000
IMAGE_SCN_ALIGN_2048BYTES = 0x00C00000
IMAGE_SCN_ALIGN_4096BYTES = 0x00D00000
IMAGE_SCN_ALIGN_8192BYTES = 0x00E00000
IMAGE_SCN_LNK_NRELOC_OVFL = 0x01000000
IMAGE_SCN_MEM_DISCARDABLE = 0x02000000
IMAGE_SCN_MEM_NOT_CACHED = 0x04000000
IMAGE_SCN_MEM_NOT_PAGED = 0x08000000
IMAGE_SCN_MEM_SHARED = 0x10000000
IMAGE_SCN_MEM_EXECUTE = 0x20000000
IMAGE_SCN_MEM_READ = 0x40000000
IMAGE_SCN_MEM_WRITE = 0x80000000
IMAGE_REL_AMD64_ABSOLUTE = 0x0000
IMAGE_REL_AMD64_ADDR64 = 0x0001
IMAGE_REL_AMD64_ADDR32 = 0x0002
IMAGE_REL_AMD64_ADDR32NB = 0x0003
IMAGE_REL_AMD64_REL32 = 0x0004
IMAGE_REL_AMD64_REL32_1 = 0x0005
IMAGE_REL_AMD64_REL32_2 = 0x0006
IMAGE_REL_AMD64_REL32_3 = 0x0007
IMAGE_REL_AMD64_REL32_4 = 0x0008
IMAGE_REL_AMD64_REL32_5 = 0x0009
IMAGE_REL_AMD64_SECTION = 0x000A
IMAGE_REL_AMD64_SECREL = 0x000B
IMAGE_REL_AMD64_SECREL7 = 0x000C
IMAGE_REL_AMD64_TOKEN = 0x000D
IMAGE_REL_AMD64_SREL32 = 0x000E
IMAGE_REL_AMD64_PAIR = 0x000F
IMAGE_REL_AMD64_SSPAN32 = 0x0010
IMAGE_REL_I386_ABSOLUTE = 0x0000
IMAGE_REL_I386_DIR16 = 0x0001
IMAGE_REL_I386_REL16 = 0x0002
IMAGE_REL_I386_DIR32 = 0x0006
IMAGE_REL_I386_DIR32NB = 0x0007
IMAGE_REL_I386_SEG12 = 0x0009
IMAGE_REL_I386_SECTION = 0x000A
IMAGE_REL_I386_SECREL = 0x000B
IMAGE_REL_I386_TOKEN = 0x000C
IMAGE_REL_I386_SECREL7 = 0x000D
IMAGE_REL_I386_REL32 = 0x0014
IMAGE_SYM_UNDEFINED = 0
IMAGE_SYM_ABSOLUTE = -1
IMAGE_SYM_DEBUG = -2
IMAGE_SYM_TYPE_NULL = 0
IMAGE_SYM_TYPE_VOID = 1
IMAGE_SYM_TYPE_CHAR = 2
IMAGE_SYM_TYPE_SHORT = 3
IMAGE_SYM_TYPE_INT = 4
IMAGE_SYM_TYPE_LONG = 5
IMAGE_SYM_TYPE_FLOAT = 6
IMAGE_SYM_TYPE_DOUBLE = 7
IMAGE_SYM_TYPE_STRUCT = 8
IMAGE_SYM_TYPE_UNION = 9
IMAGE_SYM_TYPE_ENUM = 10
IMAGE_SYM_TYPE_MOE = 11
IMAGE_SYM_TYPE_BYTE = 12
IMAGE_SYM_TYPE_WORD = 13
IMAGE_SYM_TYPE_UINT = 14
IMAGE_SYM_TYPE_DWORD = 15
IMAGE_SYM_DTYPE_NULL = 0
IMAGE_SYM_DTYPE_POINTER = 1
IMAGE_SYM_DTYPE_FUNCTION = 2
IMAGE_SYM_DTYPE_ARRAY = 3
IMAGE_SYM_CLASS_END_OF_FUNCTION = -1
IMAGE_SYM_CLASS_NULL = 0
IMAGE_SYM_CLASS_AUTOMATIC = 1
IMAGE_SYM_CLASS_EXTERNAL = 2
IMAGE_SYM_CLASS_STATIC = 3
IMAGE_SYM_CLASS_REGISTER = 4
IMAGE_SYM_CLASS_EXTERNAL_DEF = 5
IMAGE_SYM_CLASS_LABEL = 6
IMAGE_SYM_CLASS_UNDEFINED_LABEL = 7
IMAGE_SYM_CLASS_MEMBER_OF_STRUCT = 8
IMAGE_SYM_CLASS_ARGUMENT = 9
IMAGE_SYM_CLASS_STRUCT_TAG = 10
IMAGE_SYM_CLASS_MEMBER_OF_UNION = 11
IMAGE_SYM_CLASS_UNION_TAG = 12
IMAGE_SYM_CLASS_TYPE_DEFINITION = 13
IMAGE_SYM_CLASS_UNDEFINED_STATIC = 14
IMAGE_SYM_CLASS_ENUM_TAG = 15
IMAGE_SYM_CLASS_MEMBER_OF_ENUM = 16
IMAGE_SYM_CLASS_REGISTER_PARAM = 17
IMAGE_SYM_CLASS_BIT_FIELD = 18
IMAGE_SYM_CLASS_BLOCK = 100
IMAGE_SYM_CLASS_FUNCTION = 101
IMAGE_SYM_CLASS_END_OF_STRUCT = 102
IMAGE_SYM_CLASS_FILE = 103
IMAGE_SYM_CLASS_SECTION = 104
IMAGE_SYM_CLASS_WEAK_EXTERNAL = 105
IMAGE_SYM_CLASS_CLR_TOKEN = 107
IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY = 1
IMAGE_WEAK_EXTERN_SEARCH_LIBRARY = 2
IMAGE_WEAK_EXTERN_SEARCH_ALIAS = 3
COFF::
namespace COFF
if defined Settings.Machine
MACHINE := Settings.Machine
else
MACHINE := IMAGE_FILE_MACHINE_I386
end if
if defined Settings.Characteristics
CHARACTERISTICS = Settings.Characteristics
else
CHARACTERISTICS = IMAGE_FILE_32BIT_MACHINE
end if
Header:
Machine dw MACHINE
NumberOfSections dw NUMBER_OF_SECTIONS
TimeDateStamp dd __TIME__
PointerToSymbolTable dd SYMBOL_TABLE_OFFSET
NumberOfSymbols dd NUMBER_OF_SYMBOLS
SizeOfOptionalHeader dw 0
Characteristics dw CHARACTERISTICS
Sections: db NUMBER_OF_SECTIONS * sizeof IMAGE_SECTION_HEADER dup 0
virtual at 0
symbol_table:: rb NUMBER_OF_SYMBOLS * sizeof IMAGE_SYMBOL
end virtual
virtual at 0
string_table:: dd STRING_TABLE_SIZE
STRING_POSITION = $
rb STRING_TABLE_SIZE - $
end virtual
virtual at 0
relocations:: rb NUMBER_OF_RELOCATIONS * sizeof IMAGE_RELOCATION
end virtual
element relocatable?
macro section_start
local sym
element sym : relocatable * (1+SECTION_INDEX) + SYMBOL_INDEX
SECTION_BASE = sym
org sym
align.assume sym, SECTION_ALIGN
if DEFINED_SECTION | defined DEFAULT_SECTION
store SECTION_NAME : 8 at symbol_table : SYMBOL_INDEX * sizeof IMAGE_SYMBOL + IMAGE_SYMBOL.ShortName
store IMAGE_SYM_CLASS_STATIC at symbol_table : SYMBOL_INDEX * sizeof IMAGE_SYMBOL + IMAGE_SYMBOL.StorageClass
store 1+SECTION_INDEX at symbol_table : SYMBOL_INDEX * sizeof IMAGE_SYMBOL + IMAGE_SYMBOL.SectionNumber
SYMBOL_INDEX = SYMBOL_INDEX + 1
end if
end macro
RELOCATION_INDEX = 0
SECTION_INDEX = 0
SECTION_RELOCATION_INDEX = RELOCATION_INDEX
SYMBOL_INDEX = 0
SECTION_OFFSET = $%
SECTION_ALIGN = 4
SECTION_NAME = '.flat'
SECTION_FLAGS = IMAGE_SCN_CNT_CODE + IMAGE_SCN_CNT_INITIALIZED_DATA + IMAGE_SCN_MEM_EXECUTE + IMAGE_SCN_MEM_READ + IMAGE_SCN_MEM_WRITE
DEFINED_SECTION = 0
section_start
end namespace
macro section?
namespace COFF
SECTION_SIZE = $% - SECTION_OFFSET
if DEFINED_SECTION | SECTION_SIZE > 0
if ~ DEFINED_SECTION
DEFAULT_SECTION := 1
end if
if $%% = SECTION_OFFSET
SECTION_FLAGS = SECTION_FLAGS or IMAGE_SCN_CNT_UNINITIALIZED_DATA
SECTION_OFFSET = 0
section $
else
UNINITIALIZED_LENGTH = $% - $%%
section $
db UNINITIALIZED_LENGTH dup 0
end if
if RELOCATION_INDEX > SECTION_RELOCATION_INDEX
store RELOCATIONS_OFFSET + SECTION_RELOCATION_INDEX * sizeof IMAGE_RELOCATION at COFF:Sections + SECTION_INDEX * sizeof IMAGE_SECTION_HEADER + IMAGE_SECTION_HEADER.PointerToRelocations
if RELOCATION_INDEX - SECTION_RELOCATION_INDEX > 65535
SECTION_FLAGS = SECTION_FLAGS or IMAGE_SCN_LNK_NRELOC_OVFL
store 0FFFFh at COFF:Sections + SECTION_INDEX * sizeof IMAGE_SECTION_HEADER + IMAGE_SECTION_HEADER.NumberOfRelocations
load RELOCATIONS : (RELOCATION_INDEX - SECTION_RELOCATION_INDEX) * sizeof IMAGE_RELOCATION from relocations : SECTION_RELOCATION_INDEX * sizeof IMAGE_RELOCATION
store RELOCATIONS : (RELOCATION_INDEX - SECTION_RELOCATION_INDEX) * sizeof IMAGE_RELOCATION at relocations : (SECTION_RELOCATION_INDEX+1) * sizeof IMAGE_RELOCATION
RELOCATION_INDEX = RELOCATION_INDEX + 1
store RELOCATION_INDEX - SECTION_RELOCATION_INDEX at relocations : SECTION_RELOCATION_INDEX * sizeof IMAGE_RELOCATION + IMAGE_RELOCATION.VirtualAddress
store 0 at relocations : SECTION_RELOCATION_INDEX * sizeof IMAGE_RELOCATION + IMAGE_RELOCATION.SymbolTableIndex
store 0 at relocations : SECTION_RELOCATION_INDEX * sizeof IMAGE_RELOCATION + IMAGE_RELOCATION.Type
else
store RELOCATION_INDEX - SECTION_RELOCATION_INDEX at COFF:Sections + SECTION_INDEX * sizeof IMAGE_SECTION_HEADER + IMAGE_SECTION_HEADER.NumberOfRelocations
end if
end if
store SECTION_NAME : 8 at COFF:Sections + SECTION_INDEX * sizeof IMAGE_SECTION_HEADER + IMAGE_SECTION_HEADER.Name
store SECTION_OFFSET at COFF:Sections + SECTION_INDEX * sizeof IMAGE_SECTION_HEADER + IMAGE_SECTION_HEADER.PointerToRawData
store SECTION_SIZE at COFF:Sections + SECTION_INDEX * sizeof IMAGE_SECTION_HEADER + IMAGE_SECTION_HEADER.SizeOfRawData
store SECTION_FLAGS at COFF:Sections + SECTION_INDEX * sizeof IMAGE_SECTION_HEADER + IMAGE_SECTION_HEADER.Characteristics
SECTION_INDEX = SECTION_INDEX + 1
end if
end namespace
end macro
macro section? declaration*
namespace COFF
section
DEFINED_SECTION = 1
SECTION_FLAGS = 0
SECTION_OFFSET = $%
SECTION_ALIGN = 4
match name attributes, declaration
SECTION_NAME = name
local seq,list
match flags =align? boundary, attributes
SECTION_ALIGN = boundary
define seq flags
else match =align? boundary, attributes
SECTION_ALIGN = boundary
define seq
else
define seq attributes
end match
while 1
match car cdr, seq
define list car
define seq cdr
else
match any, seq
define list any
end match
break
end match
end while
irpv attribute, list
match =code?, attribute
SECTION_FLAGS = SECTION_FLAGS or IMAGE_SCN_CNT_CODE
else match =data?, attribute
SECTION_FLAGS = SECTION_FLAGS or IMAGE_SCN_CNT_INITIALIZED_DATA
else match =readable?, attribute
SECTION_FLAGS = SECTION_FLAGS or IMAGE_SCN_MEM_READ
else match =writeable?, attribute
SECTION_FLAGS = SECTION_FLAGS or IMAGE_SCN_MEM_WRITE
else match =executable?, attribute
SECTION_FLAGS = SECTION_FLAGS or IMAGE_SCN_MEM_EXECUTE
else match =shareable?, attribute
SECTION_FLAGS = SECTION_FLAGS or IMAGE_SCN_MEM_SHARED
else match =discardable?, attribute
SECTION_FLAGS = SECTION_FLAGS or IMAGE_SCN_MEM_DISCARDABLE
else match =notpageable?, attribute
SECTION_FLAGS = SECTION_FLAGS or IMAGE_SCN_MEM_NOT_PAGED
else match =linkremove?, attribute
SECTION_FLAGS = SECTION_FLAGS or IMAGE_SCN_LNK_REMOVE
else match =linkinfo?, attribute
SECTION_FLAGS = SECTION_FLAGS or IMAGE_SCN_LNK_INFO
else
err 'unknown attribute "',`attribute,'"'
end match
end irpv
else
SECTION_NAME = declaration
end match
repeat 1, i:SECTION_ALIGN
if defined IMAGE_SCN_ALIGN_#i#BYTES
SECTION_FLAGS = SECTION_FLAGS or IMAGE_SCN_ALIGN_#i#BYTES
else
err 'invalid section alignment'
end if
end repeat
section_start
SECTION_RELOCATION_INDEX = RELOCATION_INDEX
end namespace
end macro
macro public? declaration*
namespace COFF
match =static? value =as? str, declaration
SYMBOL_VALUE = value
SYMBOL_NAME = string str
SYMBOL_CLASS = IMAGE_SYM_CLASS_STATIC
else match value =as? str, declaration
SYMBOL_VALUE = value
SYMBOL_NAME = string str
SYMBOL_CLASS = IMAGE_SYM_CLASS_EXTERNAL
else match =static? value, declaration
SYMBOL_VALUE = value
SYMBOL_NAME = `value
SYMBOL_CLASS = IMAGE_SYM_CLASS_STATIC
else
SYMBOL_VALUE = declaration
SYMBOL_NAME = `declaration
SYMBOL_CLASS = IMAGE_SYM_CLASS_EXTERNAL
end match
if SYMBOL_VALUE relativeto 1 elementof SYMBOL_VALUE & 1 elementof (1 metadataof SYMBOL_VALUE) relativeto relocatable & SYMBOL_CLASS = IMAGE_SYM_CLASS_EXTERNAL
if 1 scaleof (1 metadataof SYMBOL_VALUE) > 0
SYMBOL_SECTION_INDEX = 1 scaleof (1 metadataof SYMBOL_VALUE)
SYMBOL_VALUE = SYMBOL_VALUE - 1 elementof SYMBOL_VALUE
else
SYMBOL_SECTION_INDEX = IMAGE_SYM_UNDEFINED
SYMBOL_VALUE = 0
SYMBOL_CLASS = IMAGE_SYM_CLASS_WEAK_EXTERNAL
SYMBOL_TAG = 0 scaleof (1 metadataof SYMBOL_VALUE)
end if
else
SYMBOL_SECTION_INDEX = IMAGE_SYM_ABSOLUTE
end if
if lengthof SYMBOL_NAME > 8
store 0 at symbol_table : SYMBOL_INDEX * sizeof IMAGE_SYMBOL + IMAGE_SYMBOL.Zeroes
store STRING_POSITION at symbol_table : SYMBOL_INDEX * sizeof IMAGE_SYMBOL + IMAGE_SYMBOL.Offset
store SYMBOL_NAME : lengthof SYMBOL_NAME at string_table:STRING_POSITION
STRING_POSITION = STRING_POSITION + lengthof SYMBOL_NAME + 1
else
store SYMBOL_NAME : 8 at symbol_table : SYMBOL_INDEX * sizeof IMAGE_SYMBOL + IMAGE_SYMBOL.ShortName
end if
store SYMBOL_VALUE at symbol_table : SYMBOL_INDEX * sizeof IMAGE_SYMBOL + IMAGE_SYMBOL.Value
store SYMBOL_SECTION_INDEX at symbol_table : SYMBOL_INDEX * sizeof IMAGE_SYMBOL + IMAGE_SYMBOL.SectionNumber
store SYMBOL_CLASS at symbol_table : SYMBOL_INDEX * sizeof IMAGE_SYMBOL + IMAGE_SYMBOL.StorageClass
if SYMBOL_CLASS = IMAGE_SYM_CLASS_WEAK_EXTERNAL
store 1 at symbol_table : SYMBOL_INDEX * sizeof IMAGE_SYMBOL + IMAGE_SYMBOL.NumberOfAuxSymbols
SYMBOL_INDEX = SYMBOL_INDEX + 1
store SYMBOL_TAG : 4 at symbol_table : SYMBOL_INDEX * sizeof IMAGE_SYMBOL
store IMAGE_WEAK_EXTERN_SEARCH_ALIAS : 4 at symbol_table : SYMBOL_INDEX * sizeof IMAGE_SYMBOL + 4
end if
SYMBOL_INDEX = SYMBOL_INDEX + 1
end namespace
end macro
macro extrn? declaration*
namespace COFF
local sym,psym
element sym : relocatable * (-1) + SYMBOL_INDEX
match str =as? name:size, declaration
label name:size at sym
SYMBOL_NAME = string str
else match name:size, declaration
label name:size at sym
SYMBOL_NAME = `name
else match str =as? name, declaration
label name at sym
SYMBOL_NAME = string str
else
label declaration at sym
SYMBOL_NAME = `declaration
end match
if lengthof SYMBOL_NAME > 8
store 0 at symbol_table : SYMBOL_INDEX * sizeof IMAGE_SYMBOL + IMAGE_SYMBOL.Zeroes
store STRING_POSITION at symbol_table : SYMBOL_INDEX * sizeof IMAGE_SYMBOL + IMAGE_SYMBOL.Offset
store SYMBOL_NAME : lengthof SYMBOL_NAME at string_table:STRING_POSITION
STRING_POSITION = STRING_POSITION + lengthof SYMBOL_NAME + 1
else
store SYMBOL_NAME : 8 at symbol_table : SYMBOL_INDEX * sizeof IMAGE_SYMBOL + IMAGE_SYMBOL.ShortName
end if
store IMAGE_SYM_CLASS_EXTERNAL at symbol_table : SYMBOL_INDEX * sizeof IMAGE_SYMBOL + IMAGE_SYMBOL.StorageClass
SYMBOL_INDEX = SYMBOL_INDEX + 1
end namespace
end macro
element COFF.IMAGE_BASE
RVA? equ -COFF.IMAGE_BASE+
if COFF.MACHINE = IMAGE_FILE_MACHINE_I386
calminstruction dword? value
compute value, value
check ~ value relativeto 0 & value relativeto 1 elementof value & 1 elementof (1 metadataof value) relativeto COFF.relocatable
jyes dir32
check ~ value relativeto 0 & (value + COFF.IMAGE_BASE) relativeto 1 elementof (value + COFF.IMAGE_BASE) & 1 elementof (1 metadataof (value + COFF.IMAGE_BASE)) relativeto COFF.relocatable
jyes dir32nb
check ~ value relativeto 0 & (value + COFF.SECTION_BASE) relativeto 1 elementof (value + COFF.SECTION_BASE)
jno plain
check 1 elementof (1 metadataof (value + COFF.SECTION_BASE)) relativeto COFF.relocatable
jyes rel32
plain:
emit 4, value
exit
local offset, symndx, type
dir32:
compute symndx, 0 scaleof (1 metadataof value)
compute type, IMAGE_REL_I386_DIR32
jump add_relocation
dir32nb:
compute value, value + COFF.IMAGE_BASE
compute symndx, 0 scaleof (1 metadataof value)
compute type, IMAGE_REL_I386_DIR32NB
jump add_relocation
rel32:
compute value, value + (COFF.SECTION_BASE + $% + 4 - COFF.SECTION_OFFSET)
compute symndx, 0 scaleof (1 metadataof value)
compute type, IMAGE_REL_I386_REL32
jump add_relocation
add_relocation:
compute offset, $%
emit 4, 0 scaleof value
check $% > offset
jno done
compute offset, offset - COFF.SECTION_OFFSET
local relocation
compute relocation, COFF.RELOCATION_INDEX * sizeof IMAGE_RELOCATION
asm store offset at COFF.relocations : relocation + IMAGE_RELOCATION.VirtualAddress
asm store symndx at COFF.relocations : relocation + IMAGE_RELOCATION.SymbolTableIndex
asm store type at COFF.relocations : relocation + IMAGE_RELOCATION.Type
compute COFF.RELOCATION_INDEX, COFF.RELOCATION_INDEX + 1
done:
end calminstruction
calminstruction qword? value
compute value, value
check ~ value relativeto 0 & value relativeto 1 elementof value & 1 elementof (1 metadataof value) relativeto COFF.relocatable
jyes dir32
check ~ value relativeto 0 & (value + COFF.IMAGE_BASE) relativeto 1 elementof (value + COFF.IMAGE_BASE) & 1 elementof (1 metadataof (value + COFF.IMAGE_BASE)) relativeto COFF.relocatable
jyes dir32nb
plain:
emit 8, value
exit
local offset, symndx, type
dir32:
compute symndx, 0 scaleof (1 metadataof value)
compute type, IMAGE_REL_I386_DIR32
jump add_relocation
dir32nb:
compute value, value + COFF.IMAGE_BASE
compute symndx, 0 scaleof (1 metadataof value)
compute type, IMAGE_REL_I386_DIR32NB
jump add_relocation
add_relocation:
compute offset, $%
emit 8, 0 scaleof value
check $% > offset
jno done
compute offset, offset - COFF.SECTION_OFFSET
local relocation
compute relocation, COFF.RELOCATION_INDEX * sizeof IMAGE_RELOCATION
asm store offset at COFF.relocations : relocation + IMAGE_RELOCATION.VirtualAddress
asm store symndx at COFF.relocations : relocation + IMAGE_RELOCATION.SymbolTableIndex
asm store type at COFF.relocations : relocation + IMAGE_RELOCATION.Type
compute COFF.RELOCATION_INDEX, COFF.RELOCATION_INDEX + 1
done:
end calminstruction
else if COFF.MACHINE = IMAGE_FILE_MACHINE_AMD64
calminstruction dword? value
compute value, value
check ~ value relativeto 0 & value relativeto 1 elementof value & 1 elementof (1 metadataof value) relativeto COFF.relocatable
jyes addr32
check ~ value relativeto 0 & (value + COFF.IMAGE_BASE) relativeto 1 elementof (value + COFF.IMAGE_BASE) & 1 elementof (1 metadataof (value + COFF.IMAGE_BASE)) relativeto COFF.relocatable
jyes addr32nb
check ~ value relativeto 0 & (value + COFF.SECTION_BASE) relativeto 1 elementof (value + COFF.SECTION_BASE)
jno plain
check 1 elementof (1 metadataof (value + COFF.SECTION_BASE)) relativeto COFF.relocatable
jyes rel32
plain:
emit 4, value
exit
local offset, symndx, type
addr32:
compute symndx, 0 scaleof (1 metadataof value)
compute type, IMAGE_REL_AMD64_ADDR32
jump add_relocation
addr32nb:
compute value, value + COFF.IMAGE_BASE
compute symndx, 0 scaleof (1 metadataof value)
compute type, IMAGE_REL_AMD64_ADDR32NB
jump add_relocation
rel32:
compute value, value + (COFF.SECTION_BASE + $% + 4 - COFF.SECTION_OFFSET)
compute symndx, 0 scaleof (1 metadataof value)
compute type, IMAGE_REL_AMD64_REL32
jump add_relocation
add_relocation:
compute offset, $%
emit 4, 0 scaleof value
check $% > offset
jno done
compute offset, offset - COFF.SECTION_OFFSET
local relocation
compute relocation, COFF.RELOCATION_INDEX * sizeof IMAGE_RELOCATION
asm store offset at COFF.relocations : relocation + IMAGE_RELOCATION.VirtualAddress
asm store symndx at COFF.relocations : relocation + IMAGE_RELOCATION.SymbolTableIndex
asm store type at COFF.relocations : relocation + IMAGE_RELOCATION.Type
compute COFF.RELOCATION_INDEX, COFF.RELOCATION_INDEX + 1
done:
end calminstruction
calminstruction qword? value
compute value, value
check ~ value relativeto 0 & value relativeto 1 elementof value & 1 elementof (1 metadataof value) relativeto COFF.relocatable
jyes addr64
check ~ value relativeto 0 & (value + COFF.IMAGE_BASE) relativeto 1 elementof (value + COFF.IMAGE_BASE) & 1 elementof (1 metadataof (value + COFF.IMAGE_BASE)) relativeto COFF.relocatable
jyes addr64nb
plain:
emit 8, value
exit
local offset, symndx, type
addr64:
compute symndx, 0 scaleof (1 metadataof value)
compute type, IMAGE_REL_AMD64_ADDR64
jump add_relocation
addr64nb:
compute value, value + COFF.IMAGE_BASE
compute symndx, 0 scaleof (1 metadataof value)
compute type, IMAGE_REL_AMD64_ADDR64NB
jump add_relocation
add_relocation:
compute offset, $%
emit 8, 0 scaleof value
check $% > offset
jno done
compute offset, offset - COFF.SECTION_OFFSET
local relocation
compute relocation, COFF.RELOCATION_INDEX * sizeof IMAGE_RELOCATION
asm store offset at COFF.relocations : relocation + IMAGE_RELOCATION.VirtualAddress
asm store symndx at COFF.relocations : relocation + IMAGE_RELOCATION.SymbolTableIndex
asm store type at COFF.relocations : relocation + IMAGE_RELOCATION.Type
compute COFF.RELOCATION_INDEX, COFF.RELOCATION_INDEX + 1
done:
end calminstruction
end if
postpone
purge section?
section
namespace COFF
NUMBER_OF_SECTIONS := SECTION_INDEX
STRING_TABLE_SIZE := STRING_POSITION
NUMBER_OF_SYMBOLS := SYMBOL_INDEX
NUMBER_OF_RELOCATIONS := RELOCATION_INDEX
RELOCATIONS_OFFSET = $%
load byte_sequence : NUMBER_OF_RELOCATIONS * sizeof IMAGE_RELOCATION from relocations:0
db byte_sequence
SYMBOL_TABLE_OFFSET = $%
load byte_sequence : NUMBER_OF_SYMBOLS * sizeof IMAGE_SYMBOL from symbol_table:0
db byte_sequence
load byte_sequence : STRING_TABLE_SIZE from string_table:0
db byte_sequence
end namespace
end postpone

View File

@ -0,0 +1,573 @@
macro struct? name
macro end?.struct?!
end namespace
esc end struc
virtual at 0
name name
sizeof.name = $
end virtual
purge end?.struct?
end macro
esc struc name
label . : sizeof.name
namespace .
end macro
struct Elf32_Shdr
sh_name dd ?
sh_type dd ?
sh_flags dd ?
sh_addr dd ?
sh_offset dd ?
sh_size dd ?
sh_link dd ?
sh_info dd ?
sh_addralign dd ?
sh_entsize dd ?
end struct
struct Elf32_Sym
st_name dd ?
st_value dd ?
st_size dd ?
st_info db ?
st_other db ?
st_shndx dw ?
end struct
struct Elf32_Rel
r_offset dd ?
r_info dd ?
end struct
struct Elf32_Rela
r_offset dd ?
r_info dd ?
r_addend dd ?
end struct
struct Elf32_Phdr
p_type dd ?
p_offset dd ?
p_vaddr dd ?
p_paddr dd ?
p_filesz dd ?
p_memsz dd ?
p_flags dd ?
p_align dd ?
end struct
purge struct?
ELFCLASSNONE = 0
ELFCLASS32 = 1
ELFCLASS64 = 2
ELFDATANONE = 0
ELFDATA2LSB = 1
ELFDATA2MSB = 2
ELFOSABI_NONE = 0
ELFOSABI_HPUX = 1
ELFOSABI_NETBSD = 2
ELFOSABI_GNU = 3
ELFOSABI_LINUX = 3
ELFOSABI_SOLARIS = 6
ELFOSABI_AIX = 7
ELFOSABI_IRIX = 8
ELFOSABI_FREEBSD = 9
ELFOSABI_TRU64 = 10
ELFOSABI_MODESTO = 11
ELFOSABI_OPENBSD = 12
ELFOSABI_OPENVMS = 13
ELFOSABI_NSK = 14
ELFOSABI_AROS = 15
ELFOSABI_FENIXOS = 16
ELFOSABI_CLOUDABI = 17
ELFOSABI_OPENVOS = 18
ET_NONE = 0
ET_REL = 1
ET_EXEC = 2
ET_DYN = 3
ET_CORE = 4
ET_LOPROC = 0xff00
ET_HIPROC = 0xffff
EM_NONE = 0
EM_M32 = 1
EM_SPARC = 2
EM_386 = 3
EM_68K = 4
EM_88K = 5
EM_860 = 7
EM_MIPS = 8
EM_X86_64 = 62
EV_NONE = 0
EV_CURRENT = 1
SHN_UNDEF = 0
SHN_LORESERVE = 0xff00
SHN_LOPROC = 0xff00
SHN_HIPROC = 0xff1f
SHN_ABS = 0xfff1
SHN_COMMON = 0xfff2
SHN_HIRESERVE = 0xffff
SHT_NULL = 0
SHT_PROGBITS = 1
SHT_SYMTAB = 2
SHT_STRTAB = 3
SHT_RELA = 4
SHT_HASH = 5
SHT_DYNAMIC = 6
SHT_NOTE = 7
SHT_NOBITS = 8
SHT_REL = 9
SHT_SHLIB = 10
SHT_DYNSYM = 11
SHT_LOPROC = 0x70000000
SHT_HIPROC = 0x7fffffff
SHT_LOUSER = 0x80000000
SHT_HIUSER = 0xffffffff
SHF_WRITE = 0x1
SHF_ALLOC = 0x2
SHF_EXECINSTR = 0x4
SHF_MASKPROC = 0xf0000000
STT_NOTYPE = 0
STT_OBJECT = 1
STT_FUNC = 2
STT_SECTION = 3
STT_FILE = 4
STT_LOPROC = 13
STT_HIPROC = 15
STB_LOCAL = 0
STB_GLOBAL = 1
STB_WEAK = 2
STB_LOPROC = 13
STB_HIPROC = 15
R_386_NONE = 0
R_386_32 = 1
R_386_PC32 = 2
R_386_GOT32 = 3
R_386_PLT32 = 4
R_386_COPY = 5
R_386_GLOB_DAT = 6
R_386_JMP_SLOT = 7
R_386_RELATIVE = 8
R_386_GOTOFF = 9
R_386_GOTPC = 10
R_X86_64_NONE = 0
R_X86_64_64 = 1
R_X86_64_PC32 = 2
R_X86_64_GOT32 = 3
R_X86_64_PLT32 = 4
R_X86_64_COPY = 5
R_X86_64_GLOB_DAT = 6
R_X86_64_JUMP_SLOT = 7
R_X86_64_RELATIVE = 8
R_X86_64_GOTPCREL = 9
R_X86_64_32 = 10
R_X86_64_32S = 11
R_X86_64_16 = 12
R_X86_64_PC16 = 13
R_X86_64_8 = 14
R_X86_64_PC8 = 15
R_X86_64_DPTMOD64 = 16
R_X86_64_DTPOFF64 = 17
R_X86_64_TPOFF64 = 18
R_X86_64_TLSGD = 19
R_X86_64_TLSLD = 20
R_X86_64_DTPOFF32 = 21
R_X86_64_GOTTPOFF = 22
R_X86_64_TPOFF32 = 23
R_X86_64_PC64 = 24
R_X86_64_GOTOFF64 = 25
R_X86_64_GOTPC32 = 26
ELF::
namespace ELF
if defined Settings.Machine
MACHINE := Settings.Machine
else
MACHINE := EM_386
end if
if defined Settings.ABI
ABI := Settings.ABI
else
ABI := ELFOSABI_NONE
end if
if MACHINE = EM_386
R_32 = R_386_32
R_PC32 = R_386_PC32
R_GOTOFF = R_386_GOTOFF
R_PLT32 = R_386_PLT32
else if MACHINE = EM_X86_64
R_32 = R_X86_64_32
R_PC32 = R_X86_64_PC32
R_PLT32 = R_X86_64_PLT32
end if
Header:
e_ident db 0x7F,'ELF',ELFCLASS32,ELFDATA2LSB,EV_CURRENT,ABI,(16-$) dup 0
e_type dw ET_REL
e_machine dw MACHINE
e_version dd EV_CURRENT
e_entry dd 0
e_phoff dd 0
e_shoff dd SECTION_TABLE_OFFSET
e_flags dd 0
e_ehsize dw Content
e_phentsize dw 0
e_phnum dw 0
e_shentsize dw sizeof Elf32_Shdr
e_shnum dw NUMBER_OF_SECTIONS
e_shstrndx dw STRING_TABLE_SECTION_INDEX
Content:
virtual at 0
section_table:: rb NUMBER_OF_SECTIONS * sizeof Elf32_Shdr
end virtual
virtual at 0
symbol_table:: rb NUMBER_OF_SYMBOLS * sizeof Elf32_Sym
end virtual
virtual at 0
string_table::
_null db 0
_symtab db '.symtab',0
_strtab db '.strtab',0
SECTION_NAME_POSITION = $
rb SECTION_NAME_TABLE_SIZE - $
STRING_POSITION = $
rb STRING_TABLE_SIZE - $
end virtual
virtual at 0
relocations:: rb NUMBER_OF_RELOCATIONS * sizeof Elf32_Rel
end virtual
element relocatable?
macro section_org
local sym
element sym : relocatable * SECTION_INDEX + SECTION_SYMBOL_INDEX
SECTION_BASE = sym
org sym
align.assume sym, SECTION_ALIGN
end macro
RELOCATION_INDEX = 0
SECTION_INDEX = 1
SECTION_SYMBOL_INDEX = SECTION_INDEX
SECTION_RELOCATION_INDEX = RELOCATION_INDEX
SYMBOL_INDEX = NUMBER_OF_SECTION_SYMBOLS
SECTION_OFFSET = $%
SECTION_ALIGN = 4
SECTION_NAME = '.flat'
SECTION_FLAGS = SHF_ALLOC + SHF_WRITE + SHF_EXECINSTR
DEFINED_SECTION = 0
section_org
end namespace
macro section?
namespace ELF
SECTION_SIZE = $% - SECTION_OFFSET
if DEFINED_SECTION | SECTION_SIZE > 0
store SECTION_OFFSET at section_table : Elf32_Shdr.sh_offset + SECTION_INDEX * sizeof Elf32_Shdr
store SECTION_SIZE at section_table : Elf32_Shdr.sh_size + SECTION_INDEX * sizeof Elf32_Shdr
store SECTION_ALIGN at section_table : Elf32_Shdr.sh_addralign + SECTION_INDEX * sizeof Elf32_Shdr
store SECTION_FLAGS at section_table : Elf32_Shdr.sh_flags + SECTION_INDEX * sizeof Elf32_Shdr
if $%% = SECTION_OFFSET
store SHT_NOBITS at section_table : Elf32_Shdr.sh_type + SECTION_INDEX * sizeof Elf32_Shdr
section $
else
store SHT_PROGBITS at section_table : Elf32_Shdr.sh_type + SECTION_INDEX * sizeof Elf32_Shdr
UNINITIALIZED_LENGTH = $% - $%%
section $
db UNINITIALIZED_LENGTH dup 0
end if
store SECTION_INDEX at symbol_table : Elf32_Sym.st_shndx + SECTION_SYMBOL_INDEX * sizeof Elf32_Sym
store STT_SECTION + STB_LOCAL shl 4 at symbol_table : Elf32_Sym.st_info + SECTION_SYMBOL_INDEX * sizeof Elf32_Sym
if RELOCATION_INDEX > SECTION_RELOCATION_INDEX
store RELOCATIONS_OFFSET + SECTION_RELOCATION_INDEX * sizeof Elf32_Rel at section_table : Elf32_Shdr.sh_offset + (SECTION_INDEX+1) * sizeof Elf32_Shdr
store (RELOCATION_INDEX - SECTION_RELOCATION_INDEX) * sizeof Elf32_Rel at section_table : Elf32_Shdr.sh_size + (SECTION_INDEX+1) * sizeof Elf32_Shdr
store SHT_REL at section_table : Elf32_Shdr.sh_type + (SECTION_INDEX+1) * sizeof Elf32_Shdr
store SYMBOL_TABLE_SECTION_INDEX at section_table : Elf32_Shdr.sh_link + (SECTION_INDEX+1) * sizeof Elf32_Shdr
store SECTION_INDEX at section_table : Elf32_Shdr.sh_info + (SECTION_INDEX+1) * sizeof Elf32_Shdr
store sizeof Elf32_Rel at section_table : Elf32_Shdr.sh_entsize + (SECTION_INDEX+1) * sizeof Elf32_Shdr
store 4 at section_table : Elf32_Shdr.sh_addralign + (SECTION_INDEX+1) * sizeof Elf32_Shdr
store SECTION_NAME_POSITION at section_table : Elf32_Shdr.sh_name + (SECTION_INDEX+1) * sizeof Elf32_Shdr
store SECTION_NAME_POSITION + 4 at section_table : Elf32_Shdr.sh_name + SECTION_INDEX * sizeof Elf32_Shdr
store SECTION_NAME_POSITION + 4 at symbol_table : Elf32_Sym.st_name + SECTION_SYMBOL_INDEX * sizeof Elf32_Sym
store '.rel' + SECTION_NAME shl (4*8) : 4 + lengthof (string SECTION_NAME) at string_table:SECTION_NAME_POSITION
SECTION_NAME_POSITION = SECTION_NAME_POSITION + 4 + lengthof (string SECTION_NAME) + 1
SECTION_INDEX = SECTION_INDEX + 2
SECTION_SYMBOL_INDEX = SECTION_SYMBOL_INDEX + 1
else
store SECTION_NAME_POSITION at section_table : Elf32_Shdr.sh_name + SECTION_INDEX * sizeof Elf32_Shdr
store SECTION_NAME_POSITION at symbol_table : Elf32_Sym.st_name + SECTION_SYMBOL_INDEX * sizeof Elf32_Sym
store SECTION_NAME : lengthof (string SECTION_NAME) at string_table:SECTION_NAME_POSITION
SECTION_NAME_POSITION = SECTION_NAME_POSITION + lengthof (string SECTION_NAME) + 1
SECTION_INDEX = SECTION_INDEX + 1
SECTION_SYMBOL_INDEX = SECTION_SYMBOL_INDEX + 1
end if
end if
end namespace
end macro
macro section? declaration*
namespace ELF
section
DEFINED_SECTION = 1
SECTION_FLAGS = SHF_ALLOC
SECTION_OFFSET = $%
SECTION_ALIGN = 4
match name attributes, declaration
SECTION_NAME = name
local seq,list
match flags =align? boundary, attributes
SECTION_ALIGN = boundary
define seq flags
else match =align? boundary, attributes
SECTION_ALIGN = boundary
define seq
else
define seq attributes
end match
while 1
match car cdr, seq
define list car
define seq cdr
else
match any, seq
define list any
end match
break
end match
end while
irpv attribute, list
match =writeable?, attribute
SECTION_FLAGS = SECTION_FLAGS or SHF_WRITE
else match =executable?, attribute
SECTION_FLAGS = SECTION_FLAGS or SHF_EXECINSTR
else
err 'unknown attribute "',`attribute,'"'
end match
end irpv
else
SECTION_NAME = declaration
end match
section_org
SECTION_RELOCATION_INDEX = RELOCATION_INDEX
end namespace
end macro
macro public? declaration*
namespace ELF
match value =as? str, declaration
SYMBOL_VALUE = value
SYMBOL_SIZE = sizeof value
SYMBOL_NAME = string str
else
SYMBOL_VALUE = declaration
SYMBOL_SIZE = sizeof declaration
SYMBOL_NAME = `declaration
end match
if SYMBOL_VALUE relativeto 1 elementof SYMBOL_VALUE & 1 elementof (1 metadataof SYMBOL_VALUE) relativeto relocatable & 1 scaleof (1 metadataof SYMBOL_VALUE) > 0
SYMBOL_SECTION_INDEX = 1 scaleof (1 metadataof SYMBOL_VALUE)
SYMBOL_VALUE = SYMBOL_VALUE - 1 elementof SYMBOL_VALUE
else
SYMBOL_SECTION_INDEX = SHN_ABS
end if
store STRING_POSITION at symbol_table : Elf32_Sym.st_name + SYMBOL_INDEX * sizeof Elf32_Sym
store SYMBOL_NAME : lengthof SYMBOL_NAME at string_table:STRING_POSITION
STRING_POSITION = STRING_POSITION + lengthof SYMBOL_NAME + 1
store SYMBOL_VALUE at symbol_table : Elf32_Sym.st_value + SYMBOL_INDEX * sizeof Elf32_Sym
store SYMBOL_SIZE at symbol_table : Elf32_Sym.st_size + SYMBOL_INDEX * sizeof Elf32_Sym
store SYMBOL_SECTION_INDEX at symbol_table : Elf32_Sym.st_shndx + SYMBOL_INDEX * sizeof Elf32_Sym
if SYMBOL_SIZE
store STT_OBJECT + STB_GLOBAL shl 4 at symbol_table : Elf32_Sym.st_info + SYMBOL_INDEX * sizeof Elf32_Sym
else
store STT_FUNC + STB_GLOBAL shl 4 at symbol_table : Elf32_Sym.st_info + SYMBOL_INDEX * sizeof Elf32_Sym
end if
SYMBOL_INDEX = SYMBOL_INDEX + 1
end namespace
end macro
macro extrn? declaration*
namespace ELF
local sym,psym
element sym : relocatable * (-1) + SYMBOL_INDEX
element psym : PLT + SYMBOL_INDEX
match str =as? name:size, declaration
label name:size at sym
label PLT.name at psym
SYMBOL_NAME = string str
SYMBOL_SIZE = size
else match name:size, declaration
label name:size at sym
label PLT.name at psym
SYMBOL_NAME = `name
SYMBOL_SIZE = size
else match str =as? name, declaration
label name at sym
label PLT.name at psym
SYMBOL_NAME = string str
SYMBOL_SIZE = 0
else
label declaration at sym
label PLT.declaration at psym
SYMBOL_NAME = `declaration
SYMBOL_SIZE = 0
end match
store STRING_POSITION at symbol_table : Elf32_Sym.st_name + SYMBOL_INDEX * sizeof Elf32_Sym
store SYMBOL_NAME : lengthof SYMBOL_NAME at string_table:STRING_POSITION
STRING_POSITION = STRING_POSITION + lengthof SYMBOL_NAME + 1
store SYMBOL_SIZE at symbol_table : Elf32_Sym.st_size + SYMBOL_INDEX * sizeof Elf32_Sym
store STT_NOTYPE + STB_GLOBAL shl 4 at symbol_table : Elf32_Sym.st_info + SYMBOL_INDEX * sizeof Elf32_Sym
SYMBOL_INDEX = SYMBOL_INDEX + 1
end namespace
end macro
element _GLOBAL_OFFSET_TABLE_
RVA? equ -_GLOBAL_OFFSET_TABLE_+
element PLT?
calminstruction dword? value
compute value, value
check ~ value relativeto 0 & value relativeto 1 elementof value & 1 elementof (1 metadataof value) relativeto ELF.relocatable
jyes r_32
check ~ value relativeto 0 & (value + _GLOBAL_OFFSET_TABLE_) relativeto 1 elementof (value + _GLOBAL_OFFSET_TABLE_) & 1 elementof (1 metadataof (value + _GLOBAL_OFFSET_TABLE_)) relativeto ELF.relocatable
jyes r_gotoff
check ~ value relativeto 0 & (value + ELF.SECTION_BASE) relativeto 1 elementof (value + ELF.SECTION_BASE)
jno plain
check 1 elementof (1 metadataof (value + ELF.SECTION_BASE)) relativeto ELF.relocatable
jyes r_pc32
check 1 elementof (1 metadataof (value + ELF.SECTION_BASE)) relativeto PLT
jyes r_plt32
plain:
emit 4, value
exit
local offset, info
r_32:
compute info, ELF.R_32 + (0 scaleof (1 metadataof value)) shl 8
jump add_relocation
r_gotoff:
compute value, value + _GLOBAL_OFFSET_TABLE_
compute info, ELF.R_GOTOFF + (0 scaleof (1 metadataof value)) shl 8
jump add_relocation
r_pc32:
compute value, value + (ELF.SECTION_BASE + $% - ELF.SECTION_OFFSET)
compute info, ELF.R_PC32 + (0 scaleof (1 metadataof value)) shl 8
jump add_relocation
r_plt32:
compute value, value + (ELF.SECTION_BASE + $% - ELF.SECTION_OFFSET)
compute info, ELF.R_PLT32 + (0 scaleof (1 metadataof value)) shl 8
jump add_relocation
add_relocation:
compute offset, $%
emit 4, 0 scaleof value
check $% > offset
jno done
compute offset, offset - ELF.SECTION_OFFSET
local Rel
compute Rel, ELF.RELOCATION_INDEX * sizeof Elf32_Rel
asm store offset at ELF.relocations : Rel + Elf32_Rel.r_offset
asm store info at ELF.relocations : Rel + Elf32_Rel.r_info
compute ELF.RELOCATION_INDEX, ELF.RELOCATION_INDEX + 1
done:
end calminstruction
postpone
purge section?
section
namespace ELF
SECTION_NAME_TABLE_SIZE := SECTION_NAME_POSITION
STRING_TABLE_SIZE := STRING_POSITION
NUMBER_OF_SECTION_SYMBOLS := SECTION_SYMBOL_INDEX
NUMBER_OF_SYMBOLS := SYMBOL_INDEX
SYMBOL_TABLE_SIZE := NUMBER_OF_SYMBOLS * sizeof Elf32_Sym
NUMBER_OF_RELOCATIONS := RELOCATION_INDEX
rb (-$%) and 11b
RELOCATIONS_OFFSET = $%
load byte_sequence : NUMBER_OF_RELOCATIONS * sizeof Elf32_Rel from relocations:0
db byte_sequence
store _symtab at section_table : Elf32_Shdr.sh_name + SECTION_INDEX * sizeof Elf32_Shdr
store $% at section_table : Elf32_Shdr.sh_offset + SECTION_INDEX * sizeof Elf32_Shdr
store SYMBOL_TABLE_SIZE at section_table : Elf32_Shdr.sh_size + SECTION_INDEX * sizeof Elf32_Shdr
store sizeof Elf32_Sym at section_table : Elf32_Shdr.sh_entsize + SECTION_INDEX * sizeof Elf32_Shdr
store 4 at section_table : Elf32_Shdr.sh_addralign + SECTION_INDEX * sizeof Elf32_Shdr
store SHT_SYMTAB at section_table : Elf32_Shdr.sh_type + SECTION_INDEX * sizeof Elf32_Shdr
store STRING_TABLE_SECTION_INDEX at section_table : Elf32_Shdr.sh_link + SECTION_INDEX * sizeof Elf32_Shdr
store NUMBER_OF_SECTION_SYMBOLS at section_table : Elf32_Shdr.sh_info + SECTION_INDEX * sizeof Elf32_Shdr
SYMBOL_TABLE_SECTION_INDEX := SECTION_INDEX
load byte_sequence : SYMBOL_TABLE_SIZE from symbol_table:0
db byte_sequence
SECTION_INDEX = SECTION_INDEX + 1
store _strtab at section_table : Elf32_Shdr.sh_name + SECTION_INDEX * sizeof Elf32_Shdr
store $% at section_table : Elf32_Shdr.sh_offset + SECTION_INDEX * sizeof Elf32_Shdr
store STRING_TABLE_SIZE at section_table : Elf32_Shdr.sh_size + SECTION_INDEX * sizeof Elf32_Shdr
store 1 at section_table : Elf32_Shdr.sh_addralign + SECTION_INDEX * sizeof Elf32_Shdr
store SHT_STRTAB at section_table : Elf32_Shdr.sh_type + SECTION_INDEX * sizeof Elf32_Shdr
STRING_TABLE_SECTION_INDEX := SECTION_INDEX
load byte_sequence : STRING_TABLE_SIZE from string_table:0
db byte_sequence
SECTION_INDEX = SECTION_INDEX + 1
assert SECTION_INDEX <= SHN_LORESERVE
NUMBER_OF_SECTIONS := SECTION_INDEX
rb (-$%) and 11b
SECTION_TABLE_OFFSET := $%
load byte_sequence : NUMBER_OF_SECTIONS * sizeof Elf32_Shdr from section_table:0
db byte_sequence
end namespace
end postpone

View File

@ -0,0 +1,611 @@
macro struct? name
macro end?.struct?!
end namespace
esc end struc
virtual at 0
name name
sizeof.name = $
end virtual
purge end?.struct?
end macro
esc struc name
label . : sizeof.name
namespace .
end macro
struct Elf64_Shdr
sh_name dd ?
sh_type dd ?
sh_flags dq ?
sh_addr dq ?
sh_offset dq ?
sh_size dq ?
sh_link dd ?
sh_info dd ?
sh_addralign dq ?
sh_entsize dq ?
end struct
struct Elf64_Sym
st_name dd ?
st_info db ?
st_other db ?
st_shndx dw ?
st_value dq ?
st_size dq ?
end struct
struct Elf64_Rel
r_offset dq ?
r_info dq ?
end struct
struct Elf64_Rela
r_offset dq ?
r_info dq ?
r_addend dq ?
end struct
struct Elf64_Phdr
p_type dd ?
p_flags dd ?
p_offset dq ?
p_vaddr dq ?
p_paddr dq ?
p_filesz dq ?
p_memsz dq ?
p_align dq ?
end struct
purge struct?
ELFCLASSNONE = 0
ELFCLASS32 = 1
ELFCLASS64 = 2
ELFDATANONE = 0
ELFDATA2LSB = 1
ELFDATA2MSB = 2
ELFOSABI_NONE = 0
ELFOSABI_HPUX = 1
ELFOSABI_NETBSD = 2
ELFOSABI_GNU = 3
ELFOSABI_LINUX = 3
ELFOSABI_SOLARIS = 6
ELFOSABI_AIX = 7
ELFOSABI_IRIX = 8
ELFOSABI_FREEBSD = 9
ELFOSABI_TRU64 = 10
ELFOSABI_MODESTO = 11
ELFOSABI_OPENBSD = 12
ELFOSABI_OPENVMS = 13
ELFOSABI_NSK = 14
ELFOSABI_AROS = 15
ELFOSABI_FENIXOS = 16
ELFOSABI_CLOUDABI = 17
ELFOSABI_OPENVOS = 18
ET_NONE = 0
ET_REL = 1
ET_EXEC = 2
ET_DYN = 3
ET_CORE = 4
ET_LOPROC = 0xff00
ET_HIPROC = 0xffff
EM_NONE = 0
EM_IA_64 = 50
EM_X86_64 = 62
EV_NONE = 0
EV_CURRENT = 1
SHN_UNDEF = 0
SHN_LORESERVE = 0xff00
SHN_LOPROC = 0xff00
SHN_HIPROC = 0xff1f
SHN_ABS = 0xfff1
SHN_COMMON = 0xfff2
SHN_HIRESERVE = 0xffff
SHT_NULL = 0
SHT_PROGBITS = 1
SHT_SYMTAB = 2
SHT_STRTAB = 3
SHT_RELA = 4
SHT_HASH = 5
SHT_DYNAMIC = 6
SHT_NOTE = 7
SHT_NOBITS = 8
SHT_REL = 9
SHT_SHLIB = 10
SHT_DYNSYM = 11
SHT_LOPROC = 0x70000000
SHT_HIPROC = 0x7fffffff
SHT_LOUSER = 0x80000000
SHT_HIUSER = 0xffffffff
SHF_WRITE = 0x1
SHF_ALLOC = 0x2
SHF_EXECINSTR = 0x4
SHF_MASKPROC = 0xf0000000
STT_NOTYPE = 0
STT_OBJECT = 1
STT_FUNC = 2
STT_SECTION = 3
STT_FILE = 4
STT_LOPROC = 13
STT_HIPROC = 15
STB_LOCAL = 0
STB_GLOBAL = 1
STB_WEAK = 2
STB_LOPROC = 13
STB_HIPROC = 15
R_X86_64_NONE = 0
R_X86_64_64 = 1
R_X86_64_PC32 = 2
R_X86_64_GOT32 = 3
R_X86_64_PLT32 = 4
R_X86_64_COPY = 5
R_X86_64_GLOB_DAT = 6
R_X86_64_JUMP_SLOT = 7
R_X86_64_RELATIVE = 8
R_X86_64_GOTPCREL = 9
R_X86_64_32 = 10
R_X86_64_32S = 11
R_X86_64_16 = 12
R_X86_64_PC16 = 13
R_X86_64_8 = 14
R_X86_64_PC8 = 15
R_X86_64_DPTMOD64 = 16
R_X86_64_DTPOFF64 = 17
R_X86_64_TPOFF64 = 18
R_X86_64_TLSGD = 19
R_X86_64_TLSLD = 20
R_X86_64_DTPOFF32 = 21
R_X86_64_GOTTPOFF = 22
R_X86_64_TPOFF32 = 23
R_X86_64_PC64 = 24
R_X86_64_GOTOFF64 = 25
R_X86_64_GOTPC32 = 26
ELF::
namespace ELF
if defined Settings.Machine
MACHINE := Settings.Machine
else
MACHINE := EM_X86_64
end if
if defined Settings.ABI
ABI := Settings.ABI
else
ABI := ELFOSABI_NONE
end if
if MACHINE = EM_X86_64
R_64 = R_X86_64_64
R_32 = R_X86_64_32S
R_PC32 = R_X86_64_PC32
R_PLT32 = R_X86_64_PLT32
R_GOT32 = R_X86_64_GOT32
R_GOTPCREL = R_X86_64_GOTPCREL
end if
Header:
e_ident db 0x7F,'ELF',ELFCLASS64,ELFDATA2LSB,EV_CURRENT,ABI,(16-$) dup 0
e_type dw ET_REL
e_machine dw MACHINE
e_version dd EV_CURRENT
e_entry dq 0
e_phoff dq 0
e_shoff dq SECTION_TABLE_OFFSET
e_flags dd 0
e_ehsize dw Content
e_phentsize dw 0
e_phnum dw 0
e_shentsize dw sizeof Elf64_Shdr
e_shnum dw NUMBER_OF_SECTIONS
e_shstrndx dw STRING_TABLE_SECTION_INDEX
Content:
virtual at 0
section_table:: rb NUMBER_OF_SECTIONS * sizeof Elf64_Shdr
end virtual
virtual at 0
symbol_table:: rb NUMBER_OF_SYMBOLS * sizeof Elf64_Sym
end virtual
virtual at 0
string_table::
_null db 0
_symtab db '.symtab',0
_strtab db '.strtab',0
SECTION_NAME_POSITION = $
rb SECTION_NAME_TABLE_SIZE - $
STRING_POSITION = $
rb STRING_TABLE_SIZE - $
end virtual
virtual at 0
relocations:: rb NUMBER_OF_RELOCATIONS * sizeof Elf64_Rela
end virtual
element relocatable?
macro section_org
local sym
element sym : relocatable * SECTION_INDEX + SECTION_SYMBOL_INDEX
SECTION_BASE = sym
org sym
align.assume sym, SECTION_ALIGN
end macro
RELOCATION_INDEX = 0
SECTION_INDEX = 1
SECTION_SYMBOL_INDEX = SECTION_INDEX
SECTION_RELOCATION_INDEX = RELOCATION_INDEX
SYMBOL_INDEX = NUMBER_OF_SECTION_SYMBOLS
SECTION_OFFSET = $%
SECTION_ALIGN = 8
SECTION_NAME = '.flat'
SECTION_FLAGS = SHF_ALLOC + SHF_WRITE + SHF_EXECINSTR
DEFINED_SECTION = 0
section_org
end namespace
macro section?
namespace ELF
SECTION_SIZE = $% - SECTION_OFFSET
if DEFINED_SECTION | SECTION_SIZE > 0
store SECTION_OFFSET at section_table : Elf64_Shdr.sh_offset + SECTION_INDEX * sizeof Elf64_Shdr
store SECTION_SIZE at section_table : Elf64_Shdr.sh_size + SECTION_INDEX * sizeof Elf64_Shdr
store SECTION_ALIGN at section_table : Elf64_Shdr.sh_addralign + SECTION_INDEX * sizeof Elf64_Shdr
store SECTION_FLAGS at section_table : Elf64_Shdr.sh_flags + SECTION_INDEX * sizeof Elf64_Shdr
if $%% = SECTION_OFFSET
store SHT_NOBITS at section_table : Elf64_Shdr.sh_type + SECTION_INDEX * sizeof Elf64_Shdr
section $
else
store SHT_PROGBITS at section_table : Elf64_Shdr.sh_type + SECTION_INDEX * sizeof Elf64_Shdr
UNINITIALIZED_LENGTH = $% - $%%
section $
db UNINITIALIZED_LENGTH dup 0
end if
store SECTION_INDEX at symbol_table : Elf64_Sym.st_shndx + SECTION_SYMBOL_INDEX * sizeof Elf64_Sym
store STT_SECTION + STB_LOCAL shl 4 at symbol_table : Elf64_Sym.st_info + SECTION_SYMBOL_INDEX * sizeof Elf64_Sym
if RELOCATION_INDEX > SECTION_RELOCATION_INDEX
store RELOCATIONS_OFFSET + SECTION_RELOCATION_INDEX * sizeof Elf64_Rela at section_table : Elf64_Shdr.sh_offset + (SECTION_INDEX+1) * sizeof Elf64_Shdr
store (RELOCATION_INDEX - SECTION_RELOCATION_INDEX) * sizeof Elf64_Rela at section_table : Elf64_Shdr.sh_size + (SECTION_INDEX+1) * sizeof Elf64_Shdr
store SHT_RELA at section_table : Elf64_Shdr.sh_type + (SECTION_INDEX+1) * sizeof Elf64_Shdr
store SYMBOL_TABLE_SECTION_INDEX at section_table : Elf64_Shdr.sh_link + (SECTION_INDEX+1) * sizeof Elf64_Shdr
store SECTION_INDEX at section_table : Elf64_Shdr.sh_info + (SECTION_INDEX+1) * sizeof Elf64_Shdr
store sizeof Elf64_Rela at section_table : Elf64_Shdr.sh_entsize + (SECTION_INDEX+1) * sizeof Elf64_Shdr
store 8 at section_table : Elf64_Shdr.sh_addralign + (SECTION_INDEX+1) * sizeof Elf64_Shdr
store SECTION_NAME_POSITION at section_table : Elf64_Shdr.sh_name + (SECTION_INDEX+1) * sizeof Elf64_Shdr
store SECTION_NAME_POSITION + 5 at section_table : Elf64_Shdr.sh_name + SECTION_INDEX * sizeof Elf64_Shdr
store SECTION_NAME_POSITION + 5 at symbol_table : Elf64_Sym.st_name + SECTION_SYMBOL_INDEX * sizeof Elf64_Sym
store '.rela' + SECTION_NAME shl (5*8) : 5 + lengthof (string SECTION_NAME) at string_table:SECTION_NAME_POSITION
SECTION_NAME_POSITION = SECTION_NAME_POSITION + 5 + lengthof (string SECTION_NAME) + 1
SECTION_INDEX = SECTION_INDEX + 2
SECTION_SYMBOL_INDEX = SECTION_SYMBOL_INDEX + 1
else
store SECTION_NAME_POSITION at section_table : Elf64_Shdr.sh_name + SECTION_INDEX * sizeof Elf64_Shdr
store SECTION_NAME_POSITION at symbol_table : Elf64_Sym.st_name + SECTION_SYMBOL_INDEX * sizeof Elf64_Sym
store SECTION_NAME : lengthof (string SECTION_NAME) at string_table:SECTION_NAME_POSITION
SECTION_NAME_POSITION = SECTION_NAME_POSITION + lengthof (string SECTION_NAME) + 1
SECTION_INDEX = SECTION_INDEX + 1
SECTION_SYMBOL_INDEX = SECTION_SYMBOL_INDEX + 1
end if
end if
end namespace
end macro
macro section? declaration*
namespace ELF
section
DEFINED_SECTION = 1
SECTION_FLAGS = SHF_ALLOC
SECTION_OFFSET = $%
SECTION_ALIGN = 8
match name attributes, declaration
SECTION_NAME = name
local seq,list
match flags =align? boundary, attributes
SECTION_ALIGN = boundary
define seq flags
else match =align? boundary, attributes
SECTION_ALIGN = boundary
define seq
else
define seq attributes
end match
while 1
match car cdr, seq
define list car
define seq cdr
else
match any, seq
define list any
end match
break
end match
end while
irpv attribute, list
match =writeable?, attribute
SECTION_FLAGS = SECTION_FLAGS or SHF_WRITE
else match =executable?, attribute
SECTION_FLAGS = SECTION_FLAGS or SHF_EXECINSTR
else
err 'unknown attribute "',`attribute,'"'
end match
end irpv
else
SECTION_NAME = declaration
end match
section_org
SECTION_RELOCATION_INDEX = RELOCATION_INDEX
end namespace
end macro
macro public? declaration*
namespace ELF
match value =as? str, declaration
SYMBOL_VALUE = value
SYMBOL_SIZE = sizeof value
SYMBOL_NAME = string str
else
SYMBOL_VALUE = declaration
SYMBOL_SIZE = sizeof declaration
SYMBOL_NAME = `declaration
end match
if SYMBOL_VALUE relativeto 1 elementof SYMBOL_VALUE & 1 elementof (1 metadataof SYMBOL_VALUE) relativeto relocatable & 1 scaleof (1 metadataof SYMBOL_VALUE) > 0
SYMBOL_SECTION_INDEX = 1 scaleof (1 metadataof SYMBOL_VALUE)
SYMBOL_VALUE = SYMBOL_VALUE - 1 elementof SYMBOL_VALUE
else
SYMBOL_SECTION_INDEX = SHN_ABS
end if
store STRING_POSITION at symbol_table : Elf64_Sym.st_name + SYMBOL_INDEX * sizeof Elf64_Sym
store SYMBOL_NAME : lengthof SYMBOL_NAME at string_table:STRING_POSITION
STRING_POSITION = STRING_POSITION + lengthof SYMBOL_NAME + 1
store SYMBOL_VALUE at symbol_table : Elf64_Sym.st_value + SYMBOL_INDEX * sizeof Elf64_Sym
store SYMBOL_SIZE at symbol_table : Elf64_Sym.st_size + SYMBOL_INDEX * sizeof Elf64_Sym
store SYMBOL_SECTION_INDEX at symbol_table : Elf64_Sym.st_shndx + SYMBOL_INDEX * sizeof Elf64_Sym
if SYMBOL_SIZE
store STT_OBJECT + STB_GLOBAL shl 4 at symbol_table : Elf64_Sym.st_info + SYMBOL_INDEX * sizeof Elf64_Sym
else
store STT_FUNC + STB_GLOBAL shl 4 at symbol_table : Elf64_Sym.st_info + SYMBOL_INDEX * sizeof Elf64_Sym
end if
SYMBOL_INDEX = SYMBOL_INDEX + 1
end namespace
end macro
macro extrn? declaration*
namespace ELF
local sym,gsym,psym
element sym : relocatable * (-1) + SYMBOL_INDEX
element gsym : GOT + SYMBOL_INDEX
element psym : PLT + SYMBOL_INDEX
match str =as? name:size, declaration
label name:size at sym
label GOT.name at gsym
label PLT.name at psym
SYMBOL_NAME = string str
SYMBOL_SIZE = size
else match name:size, declaration
label name:size at sym
label GOT.name at gsym
label PLT.name at psym
SYMBOL_NAME = `name
SYMBOL_SIZE = size
else match str =as? name, declaration
label name at sym
label GOT.name at gsym
label PLT.name at psym
SYMBOL_NAME = string str
SYMBOL_SIZE = 0
else
label declaration at sym
label GOT.declaration at gsym
label PLT.declaration at psym
SYMBOL_NAME = `declaration
SYMBOL_SIZE = 0
end match
store STRING_POSITION at symbol_table : Elf64_Sym.st_name + SYMBOL_INDEX * sizeof Elf64_Sym
store SYMBOL_NAME : lengthof SYMBOL_NAME at string_table:STRING_POSITION
STRING_POSITION = STRING_POSITION + lengthof SYMBOL_NAME + 1
store SYMBOL_SIZE at symbol_table : Elf64_Sym.st_size + SYMBOL_INDEX * sizeof Elf64_Sym
store STT_NOTYPE + STB_GLOBAL shl 4 at symbol_table : Elf64_Sym.st_info + SYMBOL_INDEX * sizeof Elf64_Sym
SYMBOL_INDEX = SYMBOL_INDEX + 1
end namespace
end macro
element GOT?
element PLT?
calminstruction dword? value
compute value, value
check ~ value relativeto 0 & value relativeto 1 elementof value & 1 elementof (1 metadataof value) relativeto ELF.relocatable
jyes r_32
check ~ value relativeto 0 & value relativeto 1 elementof value & 1 elementof (1 metadataof value) relativeto GOT
jyes r_got32
check ~ value relativeto 0 & (value + ELF.SECTION_BASE) relativeto 1 elementof (value + ELF.SECTION_BASE)
jno plain
check 1 elementof (1 metadataof (value + ELF.SECTION_BASE)) relativeto ELF.relocatable
jyes r_pc32
check 1 elementof (1 metadataof (value + ELF.SECTION_BASE)) relativeto PLT
jyes r_plt32
check 1 elementof (1 metadataof (value + ELF.SECTION_BASE)) relativeto GOT
jyes r_gotpcrel
plain:
emit 4, value
exit
local offset, addend, info
r_32:
compute offset, $%
emit 4
check $% > offset
jno done
compute offset, offset - ELF.SECTION_OFFSET
compute addend, 0 scaleof value
compute info, ELF.R_32 + (0 scaleof (1 metadataof value)) shl 32
jump add_relocation
r_pc32:
compute offset, $%
emit 4
check $% > offset
jno done
compute offset, offset - ELF.SECTION_OFFSET
compute addend,value + ELF.SECTION_BASE + offset - 1 elementof value
compute info, ELF.R_PC32 + (0 scaleof (1 metadataof value)) shl 32
jump add_relocation
r_plt32:
compute offset, $%
emit 4
check $% > offset
jno done
compute offset, offset - ELF.SECTION_OFFSET
compute addend, value + ELF.SECTION_BASE + offset - 1 elementof value
compute info, ELF.R_PLT32 + (0 scaleof (1 metadataof value)) shl 32
jump add_relocation
r_gotpcrel:
compute offset, $%
emit 4
check $% > offset
jno done
compute offset, offset - ELF.SECTION_OFFSET
compute addend, value + ELF.SECTION_BASE + offset - 1 elementof value
compute info, ELF.R_GOTPCREL + (0 scaleof (1 metadataof value)) shl 32
jump add_relocation
r_got32:
compute offset, $%
emit 4
check $% > offset
jno done
compute offset, offset - ELF.SECTION_OFFSET
compute addend, 0 scaleof value
compute info, ELF.R_GOT32 + (0 scaleof (1 metadataof value)) shl 32
jump add_relocation
add_relocation:
local Rela
compute Rela, ELF.RELOCATION_INDEX * sizeof Elf64_Rela
asm store offset at ELF.relocations : Rela + Elf64_Rela.r_offset
asm store addend at ELF.relocations : Rela + Elf64_Rela.r_addend
asm store info at ELF.relocations : Rela + Elf64_Rela.r_info
compute ELF.RELOCATION_INDEX, ELF.RELOCATION_INDEX + 1
done:
end calminstruction
calminstruction qword? value
compute value, value
check ~ value relativeto 0 & value relativeto 1 elementof value & 1 elementof (1 metadataof value) relativeto ELF.relocatable
jyes r_64
plain:
emit 8, value
exit
local offset, addend, info
r_64:
compute offset, $%
emit 8
check $% > offset
jno done
compute offset, offset - ELF.SECTION_OFFSET
compute addend, 0 scaleof value
compute info, ELF.R_64 + (0 scaleof (1 metadataof value)) shl 32
add_relocation:
local Rela
compute Rela, ELF.RELOCATION_INDEX * sizeof Elf64_Rela
asm store offset at ELF.relocations : Rela + Elf64_Rela.r_offset
asm store addend at ELF.relocations : Rela + Elf64_Rela.r_addend
asm store info at ELF.relocations : Rela + Elf64_Rela.r_info
compute ELF.RELOCATION_INDEX, ELF.RELOCATION_INDEX + 1
done:
end calminstruction
postpone
purge section?
section
namespace ELF
SECTION_NAME_TABLE_SIZE := SECTION_NAME_POSITION
STRING_TABLE_SIZE := STRING_POSITION
NUMBER_OF_SECTION_SYMBOLS := SECTION_SYMBOL_INDEX
NUMBER_OF_SYMBOLS := SYMBOL_INDEX
SYMBOL_TABLE_SIZE := NUMBER_OF_SYMBOLS * sizeof Elf64_Sym
NUMBER_OF_RELOCATIONS := RELOCATION_INDEX
rb (-$%) and 111b
RELOCATIONS_OFFSET = $%
load byte_sequence : NUMBER_OF_RELOCATIONS * sizeof Elf64_Rela from relocations:0
db byte_sequence
store _symtab at section_table : Elf64_Shdr.sh_name + SECTION_INDEX * sizeof Elf64_Shdr
store $% at section_table : Elf64_Shdr.sh_offset + SECTION_INDEX * sizeof Elf64_Shdr
store SYMBOL_TABLE_SIZE at section_table : Elf64_Shdr.sh_size + SECTION_INDEX * sizeof Elf64_Shdr
store sizeof Elf64_Sym at section_table : Elf64_Shdr.sh_entsize + SECTION_INDEX * sizeof Elf64_Shdr
store 8 at section_table : Elf64_Shdr.sh_addralign + SECTION_INDEX * sizeof Elf64_Shdr
store SHT_SYMTAB at section_table : Elf64_Shdr.sh_type + SECTION_INDEX * sizeof Elf64_Shdr
store STRING_TABLE_SECTION_INDEX at section_table : Elf64_Shdr.sh_link + SECTION_INDEX * sizeof Elf64_Shdr
store NUMBER_OF_SECTION_SYMBOLS at section_table : Elf64_Shdr.sh_info + SECTION_INDEX * sizeof Elf64_Shdr
SYMBOL_TABLE_SECTION_INDEX := SECTION_INDEX
load byte_sequence : SYMBOL_TABLE_SIZE from symbol_table:0
db byte_sequence
SECTION_INDEX = SECTION_INDEX + 1
store _strtab at section_table : Elf64_Shdr.sh_name + SECTION_INDEX * sizeof Elf64_Shdr
store $% at section_table : Elf64_Shdr.sh_offset + SECTION_INDEX * sizeof Elf64_Shdr
store STRING_TABLE_SIZE at section_table : Elf64_Shdr.sh_size + SECTION_INDEX * sizeof Elf64_Shdr
store 1 at section_table : Elf64_Shdr.sh_addralign + SECTION_INDEX * sizeof Elf64_Shdr
store SHT_STRTAB at section_table : Elf64_Shdr.sh_type + SECTION_INDEX * sizeof Elf64_Shdr
STRING_TABLE_SECTION_INDEX := SECTION_INDEX
load byte_sequence : STRING_TABLE_SIZE from string_table:0
db byte_sequence
SECTION_INDEX = SECTION_INDEX + 1
assert SECTION_INDEX <= SHN_LORESERVE
NUMBER_OF_SECTIONS := SECTION_INDEX
rb (-$%) and 111b
SECTION_TABLE_OFFSET := $%
load byte_sequence : NUMBER_OF_SECTIONS * sizeof Elf64_Shdr from section_table:0
db byte_sequence
end namespace
end postpone

View File

@ -0,0 +1,321 @@
ELFCLASSNONE = 0
ELFCLASS32 = 1
ELFCLASS64 = 2
ELFDATANONE = 0
ELFDATA2LSB = 1
ELFDATA2MSB = 2
ELFOSABI_NONE = 0
ELFOSABI_HPUX = 1
ELFOSABI_NETBSD = 2
ELFOSABI_GNU = 3
ELFOSABI_LINUX = 3
ELFOSABI_SOLARIS = 6
ELFOSABI_AIX = 7
ELFOSABI_IRIX = 8
ELFOSABI_FREEBSD = 9
ELFOSABI_TRU64 = 10
ELFOSABI_MODESTO = 11
ELFOSABI_OPENBSD = 12
ELFOSABI_OPENVMS = 13
ELFOSABI_NSK = 14
ELFOSABI_AROS = 15
ELFOSABI_FENIXOS = 16
ELFOSABI_CLOUDABI = 17
ELFOSABI_OPENVOS = 18
ET_NONE = 0
ET_REL = 1
ET_EXEC = 2
ET_DYN = 3
ET_CORE = 4
ET_LOPROC = 0xff00
ET_HIPROC = 0xffff
EM_NONE = 0
EM_M32 = 1
EM_SPARC = 2
EM_386 = 3
EM_68K = 4
EM_88K = 5
EM_860 = 7
EM_MIPS = 8
EM_X86_64 = 62
EV_NONE = 0
EV_CURRENT = 1
PT_NULL = 0
PT_LOAD = 1
PT_DYNAMIC = 2
PT_INTERP = 3
PT_NOTE = 4
PT_SHLIB = 5
PT_PHDR = 6
PT_GNU_EH_FRAME = 0x6474e550
PT_GNU_STACK = 0x6474e551
PT_GNU_RELRO = 0x6474e552
PT_LOPROC = 0x70000000
PT_HIPROC = 0x7fffffff
PF_X = 1
PF_W = 2
PF_R = 4
PF_MASKOS = 0x0ff00000
PF_MASKPROC = 0xf0000000
ELF::
namespace ELF
if defined Settings.Class
CLASS := Settings.Class
else
CLASS := ELFCLASS32
end if
if defined Settings.Type
TYPE := Settings.Type
else
TYPE := ET_EXEC
end if
if defined Settings.Machine
MACHINE := Settings.Machine
else
MACHINE := EM_386
end if
if defined Settings.ABI
ABI := Settings.ABI
else
ABI := ELFOSABI_NONE
end if
if TYPE = ET_DYN
element DYNAMIC
align.assume DYNAMIC, 1000h
else
DYNAMIC := 0
end if
if defined Settings.BaseAddress
BASE_ADDRESS := DYNAMIC + Settings.BaseAddress
else
BASE_ADDRESS := DYNAMIC + 8048000h
end if
if defined Settings.LoadHeaders
LOAD_HEADERS := Settings.LoadHeaders
else
LOAD_HEADERS := 1
end if
Header:
e_ident db 0x7F,'ELF',CLASS,ELFDATA2LSB,EV_CURRENT,ABI,(16-$) dup 0
e_type dw TYPE
e_machine dw MACHINE
e_version dd EV_CURRENT
if CLASS <> ELFCLASS64
e_entry dd start - DYNAMIC
e_phoff dd ProgramHeader
e_shoff dd 0
e_flags dd 0
e_ehsize dw ProgramHeader
e_phentsize dw SEGMENT_HEADER_LENGTH
e_phnum dw NUMBER_OF_SEGMENTS
e_shentsize dw 28h
e_shnum dw 0
e_shstrndx dw 0
else
e_entry dq start - DYNAMIC
e_phoff dq ProgramHeader
e_shoff dq 0
e_flags dd 0
e_ehsize dw ProgramHeader
e_phentsize dw SEGMENT_HEADER_LENGTH
e_phnum dw NUMBER_OF_SEGMENTS
e_shentsize dw 40h
e_shnum dw 0
e_shstrndx dw 0
end if
ProgramHeader:
if CLASS <> ELFCLASS64
p_type dd PT_LOAD
p_offset dd 0
p_vaddr dd BASE_ADDRESS - DYNAMIC
p_paddr dd BASE_ADDRESS - DYNAMIC
p_filesz dd 0
p_memsz dd 0
p_flags dd PF_R+PF_W+PF_X
p_align dd 1000h
else
p_type dd PT_LOAD
p_flags dd PF_R+PF_W+PF_X
p_offset dq 0
p_vaddr dq BASE_ADDRESS - DYNAMIC
p_paddr dq BASE_ADDRESS - DYNAMIC
p_filesz dq 0
p_memsz dq 0
p_align dq 1000h
end if
SEGMENT_HEADER_LENGTH = $ - ProgramHeader
db (NUMBER_OF_SEGMENTS-1)*SEGMENT_HEADER_LENGTH dup 0
HEADERS_OFFSET = 0
HEADERS_BASE = BASE_ADDRESS
OVERLAY_HEADERS = LOAD_HEADERS
SEGMENT_INDEX = 0
DEFINED_SEGMENT = 0
SEGMENT_TYPE = PT_LOAD
FILE_OFFSET = $%
SEGMENT_BASE = BASE_ADDRESS + FILE_OFFSET and 0FFFh
org SEGMENT_BASE
start:
end namespace
RVA? equ -ELF.BASE_ADDRESS +
macro entry? address*
namespace ELF
store address-DYNAMIC at ELF:e_entry
end namespace
end macro
macro segment?
namespace ELF
DEFINED_SEGMENT_SIZE = $ - SEGMENT_BASE
if (DEFINED_SEGMENT | DEFINED_SEGMENT_SIZE > 0) & SEGMENT_TYPE = PT_LOAD & OVERLAY_HEADERS
FILE_OFFSET = HEADERS_OFFSET
SEGMENT_BASE = HEADERS_BASE
OVERLAY_HEADERS = 0
end if
store SEGMENT_BASE-DYNAMIC at ELF:p_vaddr+SEGMENT_INDEX*SEGMENT_HEADER_LENGTH
store SEGMENT_BASE-DYNAMIC at ELF:p_paddr+SEGMENT_INDEX*SEGMENT_HEADER_LENGTH
store FILE_OFFSET at ELF:p_offset+SEGMENT_INDEX*SEGMENT_HEADER_LENGTH
if SEGMENT_TYPE = PT_LOAD
RAW_DATA_SIZE = $%% - FILE_OFFSET
SEGMENT_SIZE = $ - SEGMENT_BASE
store RAW_DATA_SIZE at ELF:p_filesz+SEGMENT_INDEX*SEGMENT_HEADER_LENGTH
store SEGMENT_SIZE at ELF:p_memsz+SEGMENT_INDEX*SEGMENT_HEADER_LENGTH
if DEFINED_SEGMENT | DEFINED_SEGMENT_SIZE > 0
FILE_OFFSET = $%%
align 1000h
SEGMENT_BASE = $ + FILE_OFFSET and 0FFFh
end if
section SEGMENT_BASE
else
if OVERLAY_HEADERS = 0 & ( LOAD_HEADERS | SEGMENT_TYPE = PT_GNU_RELRO ) & ~ SEGMENT_TYPE = PT_GNU_STACK & ~ SEGMENT_TYPE = PT_NOTE
OVERLAY_HEADERS = 1
HEADERS_OFFSET = FILE_OFFSET
HEADERS_BASE = SEGMENT_BASE
end if
FILE_OFFSET = $%
SEGMENT_SIZE = $ - SEGMENT_BASE
store SEGMENT_SIZE at ELF:p_filesz+SEGMENT_INDEX*SEGMENT_HEADER_LENGTH
store SEGMENT_SIZE at ELF:p_memsz+SEGMENT_INDEX*SEGMENT_HEADER_LENGTH
if OVERLAY_HEADERS = 0
SEGMENT_BASE = DYNAMIC + (SEGMENT_BASE-DYNAMIC) and not 0FFFh + FILE_OFFSET and 0FFFh
else
SEGMENT_BASE = $
end if
if $% > $%%
store 0:byte at $-1
end if
org SEGMENT_BASE
end if
if DEFINED_SEGMENT | DEFINED_SEGMENT_SIZE > 0
SEGMENT_INDEX = SEGMENT_INDEX + 1
end if
end namespace
end macro
macro segment? attributes*
namespace ELF
segment
SEGMENT_TYPE = PT_LOAD
SEGMENT_FLAGS = 0
local seq,list
define seq attributes
while 1
match car cdr, seq
define list car
define seq cdr
else
match any, seq
define list any
end match
break
end match
end while
irpv attribute, list
match =readable?, attribute
SEGMENT_FLAGS = SEGMENT_FLAGS or PF_R
else match =writeable?, attribute
SEGMENT_FLAGS = SEGMENT_FLAGS or PF_W
else match =executable?, attribute
SEGMENT_FLAGS = SEGMENT_FLAGS or PF_X
else match =interpreter?, attribute
SEGMENT_TYPE = PT_INTERP
else match =dynamic?, attribute
SEGMENT_TYPE = PT_DYNAMIC
else match =note?, attribute
SEGMENT_TYPE = PT_NOTE
else match =gnustack?, attribute
SEGMENT_TYPE = PT_GNU_STACK
else match =gnuehframe?, attribute
SEGMENT_TYPE = PT_GNU_EH_FRAME
else match =gnurelro?, attribute
SEGMENT_TYPE = PT_GNU_RELRO
else
err 'unknown attribute "',`attribute,'"'
end match
end irpv
DEFINED_SEGMENT = 1
store SEGMENT_TYPE at ELF:p_type+SEGMENT_INDEX*SEGMENT_HEADER_LENGTH
store SEGMENT_FLAGS at ELF:p_flags+SEGMENT_INDEX*SEGMENT_HEADER_LENGTH
if SEGMENT_TYPE = PT_LOAD
store 1000h at ELF:p_align+SEGMENT_INDEX*SEGMENT_HEADER_LENGTH
else
store 1 at ELF:p_align+SEGMENT_INDEX*SEGMENT_HEADER_LENGTH
end if
end namespace
end macro
postpone
purge segment?
segment
namespace ELF
NUMBER_OF_SEGMENTS := SEGMENT_INDEX
end namespace
end postpone

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,146 @@
MZ::
.signature dw "MZ"
.bytes_in_last_page dw .LENGTH and 1FFh
.number_of_pages dw (.LENGTH-1) shr 9 + 1
.number_of_relocations dw .NUMBER_OF_RELOCATIONS
.number_of_header_paragraphs dw .HEADER_LENGTH shr 4
.minimum_heap dw (.LENGTH+.RESERVED_LENGTH-1) shr 4 - (.LENGTH-1) shr 4
.maximum_heap dw 0FFFFh
.initial_ss dw 0
.initial_sp dw 0
.checksum dw 0
.initial_ip dw 0
.initial_cs dw 0
.relocations_offset dw .relocations
.overlay_number dw 0
.relocations dw .NUMBER_OF_RELOCATIONS dup (?,?)
rb 0Fh - ($%+0Fh) and 0Fh
.HEADER_LENGTH = $
.RELOCATION_INDEX = 0
.ENTRY_DEFINED = 0
.HEAP_DEFINED = 0
.STACK_DEFINED = 0
.STACK_LENGTH = 1000h
org 0
macro entry? definition
local v
if MZ.ENTRY_DEFINED
err 'setting already specified'
else match seg:offs, definition
v = seg
if v relativeto MZ.segment
store v - MZ.segment : word at MZ : MZ.initial_cs
else
err 'incorrect segment'
end if
v = offs
if v >= 0 & v < 10000h
store v : word at MZ : MZ.initial_ip
else
err 'value out of range'
end if
MZ.ENTRY_DEFINED = 1
else
err 'invalid argument'
end match
end macro
macro heap? definition
local v,min
if MZ.HEAP_DEFINED
err 'setting already specified'
else
v = definition
if v >= 0 & v < 10000h
load min : word from MZ : MZ.minimum_heap
v = v + min
if v > 0FFFFh
v = 0FFFFh
end if
store v : word at MZ : MZ.maximum_heap
else
err 'value out of range'
end if
MZ.HEAP_DEFINED = 1
end if
end macro
macro stack? definition
local v
if MZ.STACK_DEFINED
err 'setting already specified'
else match seg:offs, definition
v = seg
if v relativeto MZ.segment
store v - MZ.segment : word at MZ : MZ.initial_ss
else
err 'incorrect segment'
end if
v = offs
if v >= 0 & v < 10000h
store v : word at MZ : MZ.initial_sp
else
err 'value out of range'
end if
MZ.STACK_DEFINED = 1
MZ.STACK_LENGTH = 0
else
MZ.STACK_DEFINED = 1
MZ.STACK_LENGTH = definition
end match
end macro
element MZ.segment
macro segment? definition
rb 0Fh - ($%+0Fh) and 0Fh
match name =use16?, definition
name := MZ.segment + ($%-MZ.HEADER_LENGTH) shr 4
use16
else match name =use32?, definition
name := MZ.segment + ($%-MZ.HEADER_LENGTH) shr 4
use32
else match name, definition
name := MZ.segment + ($%-MZ.HEADER_LENGTH) shr 4
end match
org 0
end macro
iterate word, word,dword
calminstruction word? value
compute value, value
check value relativeto MZ.segment
jno plain
local offset
compute offset, $%
emit word, value - MZ.segment
check $% > offset
jno done
compute offset, offset - MZ.HEADER_LENGTH
compute offset, offset and 0FFFFh + (offset and not 0FFFFh) shl 12
asm store offset:4 at MZ : MZ.relocations + MZ.RELOCATION_INDEX shl 2
compute MZ.RELOCATION_INDEX, MZ.RELOCATION_INDEX + 1
done:
exit
plain:
emit word, value
end calminstruction
end iterate
postpone
if MZ.STACK_LENGTH
rb 0Fh - ($%+0Fh) and 0Fh
store ($%-MZ.HEADER_LENGTH) shr 4 : word at MZ : MZ.initial_ss
rb MZ.STACK_LENGTH
store MZ.STACK_LENGTH : word at MZ : MZ.initial_sp
end if
MZ.LENGTH = $%%
MZ.RESERVED_LENGTH = $%-$%%
MZ.NUMBER_OF_RELOCATIONS = MZ.RELOCATION_INDEX
end postpone

View File

@ -0,0 +1,999 @@
IMAGE_FILE_MACHINE_UNKNOWN = 0x0
IMAGE_FILE_MACHINE_AM33 = 0x1D3
IMAGE_FILE_MACHINE_AMD64 = 0x8664
IMAGE_FILE_MACHINE_ARM = 0x1C0
IMAGE_FILE_MACHINE_ARMNT = 0x1C4
IMAGE_FILE_MACHINE_ARM64 = 0xAA64
IMAGE_FILE_MACHINE_EBC = 0xEBC
IMAGE_FILE_MACHINE_I386 = 0x14C
IMAGE_FILE_MACHINE_IA64 = 0x200
IMAGE_FILE_MACHINE_M32R = 0x9041
IMAGE_FILE_MACHINE_MIPS16 = 0x266
IMAGE_FILE_MACHINE_MIPSFPU = 0x366
IMAGE_FILE_MACHINE_MIPSFPU16 = 0x466
IMAGE_FILE_MACHINE_POWERPC = 0x1F0
IMAGE_FILE_MACHINE_POWERPCFP = 0x1F1
IMAGE_FILE_MACHINE_R4000 = 0x166
IMAGE_FILE_MACHINE_SH3 = 0x1A2
IMAGE_FILE_MACHINE_SH3DSP = 0x1A3
IMAGE_FILE_MACHINE_SH4 = 0x1A6
IMAGE_FILE_MACHINE_SH5 = 0x1A8
IMAGE_FILE_MACHINE_THUMB = 0x1C2
IMAGE_FILE_MACHINE_WCEMIPSV2 = 0x169
IMAGE_FILE_RELOCS_STRIPPED = 0x0001
IMAGE_FILE_EXECUTABLE_IMAGE = 0x0002
IMAGE_FILE_LINE_NUMS_STRIPPED = 0x0004
IMAGE_FILE_LOCAL_SYMS_STRIPPED = 0x0008
IMAGE_FILE_AGGRESSIVE_WS_TRIM = 0x0010
IMAGE_FILE_LARGE_ADDRESS_AWARE = 0x0020
IMAGE_FILE_BYTES_REVERSED_LO = 0x0080
IMAGE_FILE_32BIT_MACHINE = 0x0100
IMAGE_FILE_DEBUG_STRIPPED = 0x0200
IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP = 0x0400
IMAGE_FILE_NET_RUN_FROM_SWAP = 0x0800
IMAGE_FILE_SYSTEM = 0x1000
IMAGE_FILE_DLL = 0x2000
IMAGE_FILE_UP_SYSTEM_ONLY = 0x4000
IMAGE_FILE_BYTES_REVERSED_HI = 0x8000
IMAGE_DLLCHARACTERISTICS_HIGH_ENTROPY_VA = 0x0020
IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE = 0x0040
IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY = 0x0080
IMAGE_DLLCHARACTERISTICS_NX_COMPAT = 0x0100
IMAGE_DLLCHARACTERISTICS_NO_ISOLATION = 0x0200
IMAGE_DLLCHARACTERISTICS_NO_SEH = 0x0400
IMAGE_DLLCHARACTERISTICS_NO_BIND = 0x0800
IMAGE_DLLCHARACTERISTICS_APPCONTAINER = 0x1000
IMAGE_DLLCHARACTERISTICS_WDM_DRIVER = 0x2000
IMAGE_DLLCHARACTERISTICS_GUARD_CF = 0x4000
IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE = 0x8000
IMAGE_SUBSYSTEM_UNKNOWN = 0
IMAGE_SUBSYSTEM_NATIVE = 1
IMAGE_SUBSYSTEM_WINDOWS_GUI = 2
IMAGE_SUBSYSTEM_WINDOWS_CUI = 3
IMAGE_SUBSYSTEM_POSIX_CUI = 7
IMAGE_SUBSYSTEM_WINDOWS_CE_GUI = 9
IMAGE_SUBSYSTEM_EFI_APPLICATION = 10
IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER = 11
IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER = 12
IMAGE_SUBSYSTEM_EFI_ROM = 13
IMAGE_SUBSYSTEM_XBOX = 14
IMAGE_SCN_TYPE_NO_PAD = 0x00000008
IMAGE_SCN_CNT_CODE = 0x00000020
IMAGE_SCN_CNT_INITIALIZED_DATA = 0x00000040
IMAGE_SCN_CNT_UNINITIALIZED_DATA = 0x00000080
IMAGE_SCN_LNK_OTHER = 0x00000100
IMAGE_SCN_LNK_INFO = 0x00000200
IMAGE_SCN_LNK_REMOVE = 0x00000800
IMAGE_SCN_LNK_COMDAT = 0x00001000
IMAGE_SCN_GPREL = 0x00008000
IMAGE_SCN_MEM_PURGEABLE = 0x00020000
IMAGE_SCN_MEM_16BIT = 0x00020000
IMAGE_SCN_MEM_LOCKED = 0x00040000
IMAGE_SCN_MEM_PRELOAD = 0x00080000
IMAGE_SCN_ALIGN_1BYTES = 0x00100000
IMAGE_SCN_ALIGN_2BYTES = 0x00200000
IMAGE_SCN_ALIGN_4BYTES = 0x00300000
IMAGE_SCN_ALIGN_8BYTES = 0x00400000
IMAGE_SCN_ALIGN_16BYTES = 0x00500000
IMAGE_SCN_ALIGN_32BYTES = 0x00600000
IMAGE_SCN_ALIGN_64BYTES = 0x00700000
IMAGE_SCN_ALIGN_128BYTES = 0x00800000
IMAGE_SCN_ALIGN_256BYTES = 0x00900000
IMAGE_SCN_ALIGN_512BYTES = 0x00A00000
IMAGE_SCN_ALIGN_1024BYTES = 0x00B00000
IMAGE_SCN_ALIGN_2048BYTES = 0x00C00000
IMAGE_SCN_ALIGN_4096BYTES = 0x00D00000
IMAGE_SCN_ALIGN_8192BYTES = 0x00E00000
IMAGE_SCN_LNK_NRELOC_OVFL = 0x01000000
IMAGE_SCN_MEM_DISCARDABLE = 0x02000000
IMAGE_SCN_MEM_NOT_CACHED = 0x04000000
IMAGE_SCN_MEM_NOT_PAGED = 0x08000000
IMAGE_SCN_MEM_SHARED = 0x10000000
IMAGE_SCN_MEM_EXECUTE = 0x20000000
IMAGE_SCN_MEM_READ = 0x40000000
IMAGE_SCN_MEM_WRITE = 0x80000000
IMAGE_REL_BASED_ABSOLUTE = 0
IMAGE_REL_BASED_HIGH = 1
IMAGE_REL_BASED_LOW = 2
IMAGE_REL_BASED_HIGHLOW = 3
IMAGE_REL_BASED_HIGHADJ = 4
IMAGE_REL_BASED_DIR64 = 10
PE::
namespace PE
if defined Settings.Magic
MAGIC = Settings.Magic
else
MAGIC = 0x10B
end if
if defined Settings.Machine
MACHINE = Settings.Machine
else
MACHINE = IMAGE_FILE_MACHINE_I386
end if
if defined Settings.Characteristics
CHARACTERISTICS = Settings.Characteristics
else
CHARACTERISTICS = IMAGE_FILE_EXECUTABLE_IMAGE or IMAGE_FILE_32BIT_MACHINE
end if
if defined Settings.DllCharacteristics
DLL_CHARACTERISTICS = Settings.DllCharacteristics
else
DLL_CHARACTERISTICS = 0
end if
if defined Settings.Subsystem
SUBSYSTEM = Settings.Subsystem
else
SUBSYSTEM = IMAGE_SUBSYSTEM_WINDOWS_CUI
end if
if defined Settings.MajorSubsystemVersion
MAJOR_SUBSYSTEM_VERSION = Settings.MajorSubsystemVersion
else
MAJOR_SUBSYSTEM_VERSION = 3
end if
if defined Settings.MinorSubsystemVersion
MINOR_SUBSYSTEM_VERSION = Settings.MinorSubsystemVersion
else
MINOR_SUBSYSTEM_VERSION = 10
end if
if defined Settings.SectionAlignment
SECTION_ALIGNMENT := Settings.SectionAlignment
else
SECTION_ALIGNMENT := 1000h
end if
if defined Settings.FileAlignment
FILE_ALIGNMENT := Settings.FileAlignment
else
FILE_ALIGNMENT := 512
end if
if defined Fixups
element RELOCATION
DLL_CHARACTERISTICS = DLL_CHARACTERISTICS or IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE
align.assume RELOCATION, PE.SECTION_ALIGNMENT
else
RELOCATION := 0
CHARACTERISTICS = CHARACTERISTICS or IMAGE_FILE_RELOCS_STRIPPED
end if
if defined Settings.ImageBase
IMAGE_BASE := RELOCATION + Settings.ImageBase
else
IMAGE_BASE := RELOCATION + 400000h
end if
if defined Settings.LegacyHeaders
LEGACY_HEADERS := Settings.LegacyHeaders
else
LEGACY_HEADERS := 1
end if
NUMBER_OF_DIRECTORIES := 16
if defined Settings.Stub
virtual at 0
file Settings.Stub
if $ >= 1Ch
load SIGNATURE : word from 0
if SIGNATURE = "MZ" | SIGNATURE = "ZM"
StubTemplate::
end if
end if
end virtual
if defined StubTemplate
load .BYTES_IN_LAST_PAGE : word from StubTemplate:2
load .NUMBER_OF_PAGES : word from StubTemplate:4
.TEMPLATE_LENGTH = .NUMBER_OF_PAGES shl 9 - (-.BYTES_IN_LAST_PAGE) and 1FFh
load .RELOCATIONS_OFFSET : word from StubTemplate:18h
if .RELOCATIONS_OFFSET >= 40h
file Settings.Stub,.TEMPLATE_LENGTH
else
load .NUMBER_OF_RELOCATIONS : word from StubTemplate:6
.RELOCATIONS_LENGTH = .NUMBER_OF_RELOCATIONS shl 2
load .NUMBER_OF_HEADER_PARAGRAPHS : word from StubTemplate:8
.TEMPLATE_HEADER_LENGTH = .NUMBER_OF_HEADER_PARAGRAPHS shl 4
file Settings.Stub,1Ch
rb 40h - $
file Settings.Stub:.RELOCATIONS_OFFSET,.RELOCATIONS_LENGTH
align 16
.HEADER_LENGTH = $
file Settings.Stub:.TEMPLATE_HEADER_LENGTH,.TEMPLATE_LENGTH-.TEMPLATE_HEADER_LENGTH
.LENGTH = $
store 40h : word at 18h
store .HEADER_LENGTH shr 4 : word at 8
store .LENGTH and 1FFh : word at 2
store (.LENGTH-1) shr 9 + 1 : word at 4
end if
store Header : dword at 3Ch
else
Stub:
.signature dw "MZ"
.bytes_in_last_page dw .LENGTH and 1FFh
.number_of_pages dw (.LENGTH-1) shr 9 + 1
.number_of_relocations dw 0
.number_of_header_paragraphs dw .HEADER_LENGTH shr 4
.minimum_heap dw (10000h - (.LENGTH-.HEADER_LENGTH)) shr 4
.maximum_heap dw 0FFFFh
.initial_ss dw (-100h) shr 4
.initial_sp dw 0FFFEh
.checksum dw 0
.initial_ip dw 100h
.initial_cs dw (-100h) shr 4
.relocations_offset dw 40h
.overlay_number dw 0
rb 3Ch - $
.new_header_offset dd Header
.HEADER_LENGTH = $
file Settings.Stub
.LENGTH = $
end if
else
Stub:
.signature dw "MZ"
.bytes_in_last_page dw .LENGTH and 1FFh
.number_of_pages dw (.LENGTH-1) shr 9 + 1
.number_of_relocations dw 0
.number_of_header_paragraphs dw .HEADER_LENGTH shr 4
.minimum_heap dw .STACK_LENGTH shr 4
.maximum_heap dw 0FFFFh
.initial_ss dw 0
.initial_sp dw .LENGTH - .HEADER_LENGTH + .STACK_LENGTH
.checksum dw 0
.initial_ip dw 0
.initial_cs dw 0
.relocations_offset dw 40h
.overlay_number dw 0
rb 3Ch - $
.new_header_offset dd Header
.HEADER_LENGTH = $
.STACK_LENGTH = 100h
namespace Stub
use16
start:
push cs
pop ds
mov dx,message - start
mov ah,9
int 21h
mov ax,4C01h
int 21h
message db 'This program cannot be run in DOS mode.',0Dh,0Ah,24h
end namespace
align 16
.LENGTH = $
end if
if defined Settings.Stamp
TIMESTAMP := Settings.Stamp
else
TIMESTAMP := __TIME__
end if
align 8
Header:
.Signature dw "PE",0
.Machine dw MACHINE
.NumberOfSections dw NUMBER_OF_SECTIONS
.TimeDateStamp dd TIMESTAMP
.PointerToSymbolTable dd 0
.NumberOfSymbols dd 0
.SizeOfOptionalHeader dw SectionTable - OptionalHeader
.Characteristics dw CHARACTERISTICS
OptionalHeader:
.Magic dw MAGIC
.MajorLinkerVersion db 2
.MinorLinkerVersion db 0
.SizeOfCode dd 0
.SizeOfInitializedData dd 0
.SizeOfUninitializedData dd 0
.AddressOfEntryPoint dd 0
.BaseOfCode dd 0
if MAGIC <> 0x20B
.BaseOfData dd 0
.ImageBase dd IMAGE_BASE - RELOCATION
else
.ImageBase dq IMAGE_BASE - RELOCATION
end if
.SectionAlignment dd SECTION_ALIGNMENT
.FileAlignment dd FILE_ALIGNMENT
.MajorOperatingSystemVersion dw 1
.MinorOperatingSystemVersion dw 0
.MajorImageVersion dw 0
.MinorImageVersion dw 0
.MajorSubsystemVersion dw MAJOR_SUBSYSTEM_VERSION
.MinorSubsystemVersion dw MINOR_SUBSYSTEM_VERSION
.Win32VersionValue dd 0
.SizeOfImage dd SIZE_OF_IMAGE
.SizeOfHeaders dd SIZE_OF_HEADERS
.CheckSum dd 0
.Subsystem dw SUBSYSTEM
.DllCharacteristics dw DLL_CHARACTERISTICS
if MAGIC <> 0x20B
.SizeOfStackReserve dd 1000h
.SizeOfStackCommit dd 1000h
.SizeOfHeapReserve dd 10000h
.SizeOfHeapCommit dd 0
else
.SizeOfStackReserve dq 1000h
.SizeOfStackCommit dq 1000h
.SizeOfHeapReserve dq 10000h
.SizeOfHeapCommit dq 0
end if
.LoaderFlags dd 0
.NumberOfRvaAndSizes dd NUMBER_OF_DIRECTORIES
RvaAndSizes:
.Rva dd 0
.Size dd 0
.ENTRY_LENGTH = $ - RvaAndSizes
db (NUMBER_OF_DIRECTORIES-1)*RvaAndSizes.ENTRY_LENGTH dup 0
SectionTable:
.Name dq '.flat'
.VirtualSize dd 0
.VirtualAddress dd 0
.SizeOfRawData dd 0
.PointerToRawData dd 0
.PointerToRelocations dd 0
.PointerToLineNumbers dd 0
.NumberOfRelocations dw 0
.NumberOfLineNumbers dw 0
.Characteristics dd IMAGE_SCN_MEM_EXECUTE + IMAGE_SCN_MEM_READ + IMAGE_SCN_MEM_WRITE
.ENTRY_LENGTH = $ - SectionTable
db (NUMBER_OF_SECTIONS-1)*SectionTable.ENTRY_LENGTH dup 0
HeadersEnd:
define CheckSumBlocks PE,HeadersEnd
SECTION_INDEX = 0
RELOCATION_INDEX = 0
DEFINED_SECTION = 0
SECTION_DIRECTORIES = 0
align SECTION_ALIGNMENT
FIRST_SECTION_RVA:
section $%%
align FILE_ALIGNMENT,0
SIZE_OF_HEADERS = $%
FILE_OFFSET = $%
SECTION_BASE = IMAGE_BASE + FIRST_SECTION_RVA
org SECTION_BASE
store SECTION_BASE-IMAGE_BASE at PE:OptionalHeader.AddressOfEntryPoint
store SECTION_BASE-IMAGE_BASE at PE:SectionTable.VirtualAddress
store FILE_OFFSET at PE:SectionTable.PointerToRawData
virtual at 0
relocated_addresses:: rd NUMBER_OF_RELOCATIONS
end virtual
virtual at 0
relocation_types:: rw NUMBER_OF_RELOCATIONS
end virtual
end namespace
RVA? equ -PE.IMAGE_BASE +
macro entry? address*
namespace PE
store address-IMAGE_BASE at PE:OptionalHeader.AddressOfEntryPoint
end namespace
end macro
macro stack? reserve*,commit:1000h
namespace PE
store reserve at PE:OptionalHeader.SizeOfStackReserve
store commit at PE:OptionalHeader.SizeOfStackCommit
end namespace
end macro
macro heap? reserve*,commit:0
namespace PE
store reserve at PE:OptionalHeader.SizeOfHeapReserve
store commit at PE:OptionalHeader.SizeOfHeapCommit
end namespace
end macro
macro section?
namespace PE
repeat SECTION_DIRECTORIES
end data
end repeat
local AREA,DATA_LENGTH
AREA::
DATA_LENGTH = $-$$-($%-$%%)
CheckSumBlocks reequ CheckSumBlocks,AREA,DATA_LENGTH
SECTION_SIZE = $ - SECTION_BASE
store SECTION_SIZE at PE:SectionTable.VirtualSize+SECTION_INDEX*SectionTable.ENTRY_LENGTH
align SECTION_ALIGNMENT
SECTION_BASE = $
section $%%
align FILE_ALIGNMENT,0
RAW_DATA_SIZE = $% - FILE_OFFSET
store RAW_DATA_SIZE at PE:SectionTable.SizeOfRawData+SECTION_INDEX*SectionTable.ENTRY_LENGTH
FILE_OFFSET = $%
org SECTION_BASE
load SECTION_CHARACTERISTICS from PE:SectionTable.Characteristics+SECTION_INDEX*SectionTable.ENTRY_LENGTH
if SECTION_SIZE > 0 & RAW_DATA_SIZE = 0
SECTION_CHARACTERISTICS = SECTION_CHARACTERISTICS or IMAGE_SCN_CNT_UNINITIALIZED_DATA
store SECTION_CHARACTERISTICS at PE:SectionTable.Characteristics+SECTION_INDEX*SectionTable.ENTRY_LENGTH
end if
if LEGACY_HEADERS
if SECTION_CHARACTERISTICS and IMAGE_SCN_CNT_CODE & RAW_DATA_SIZE > 0
load CODE_SIZE from PE:OptionalHeader.SizeOfCode
if CODE_SIZE = 0
load CODE_BASE from PE:SectionTable.VirtualAddress+SECTION_INDEX*SectionTable.ENTRY_LENGTH
store CODE_BASE at PE:OptionalHeader.BaseOfCode
end if
CODE_SIZE = CODE_SIZE + RAW_DATA_SIZE
store CODE_SIZE at PE:OptionalHeader.SizeOfCode
end if
if SECTION_CHARACTERISTICS and IMAGE_SCN_CNT_INITIALIZED_DATA & RAW_DATA_SIZE > 0
load DATA_SIZE from PE:OptionalHeader.SizeOfInitializedData
if DATA_SIZE = 0 & MAGIC <> 0x20B
load DATA_BASE from PE:SectionTable.VirtualAddress+SECTION_INDEX*SectionTable.ENTRY_LENGTH
store DATA_BASE at PE:OptionalHeader.BaseOfData
end if
DATA_SIZE = DATA_SIZE + RAW_DATA_SIZE
store DATA_SIZE at PE:OptionalHeader.SizeOfInitializedData
end if
if SECTION_CHARACTERISTICS and IMAGE_SCN_CNT_UNINITIALIZED_DATA
load BSS_SIZE from PE:OptionalHeader.SizeOfUninitializedData
BSS_SIZE = BSS_SIZE + SECTION_SIZE
store BSS_SIZE at PE:OptionalHeader.SizeOfUninitializedData
end if
end if
if DEFINED_SECTION | SECTION_SIZE > 0
SECTION_INDEX = SECTION_INDEX + 1
end if
end namespace
end macro
macro section? declaration*
namespace PE
section
DEFINED_SECTION = 1
store SECTION_BASE-IMAGE_BASE at PE:SectionTable.VirtualAddress+SECTION_INDEX*SectionTable.ENTRY_LENGTH
store FILE_OFFSET at PE:SectionTable.PointerToRawData+SECTION_INDEX*SectionTable.ENTRY_LENGTH
SECTION_DIRECTORIES = 0
match name attributes, declaration
store name:qword at PE:SectionTable.Name+SECTION_INDEX*SectionTable.ENTRY_LENGTH
SECTION_CHARACTERISTICS = 0
local seq
define seq attributes:
while 1
match :, seq
break
else match =readable? tail, seq
redefine seq tail
SECTION_CHARACTERISTICS = SECTION_CHARACTERISTICS or IMAGE_SCN_MEM_READ
else match =writeable? tail, seq
redefine seq tail
SECTION_CHARACTERISTICS = SECTION_CHARACTERISTICS or IMAGE_SCN_MEM_WRITE
else match =writable? tail, seq
redefine seq tail
SECTION_CHARACTERISTICS = SECTION_CHARACTERISTICS or IMAGE_SCN_MEM_WRITE
else match =executable? tail, seq
redefine seq tail
SECTION_CHARACTERISTICS = SECTION_CHARACTERISTICS or IMAGE_SCN_MEM_EXECUTE
else match =discardable? tail, seq
redefine seq tail
SECTION_CHARACTERISTICS = SECTION_CHARACTERISTICS or IMAGE_SCN_MEM_DISCARDABLE
else match =shareable? tail, seq
redefine seq tail
SECTION_CHARACTERISTICS = SECTION_CHARACTERISTICS or IMAGE_SCN_MEM_SHARED
else match =import? tail, seq
redefine seq tail
SECTION_DIRECTORIES = SECTION_DIRECTORIES + 1
data import
else match =export? tail, seq
redefine seq tail
SECTION_DIRECTORIES = SECTION_DIRECTORIES + 1
data export
else match =resource? =from? path tail, seq
redefine seq tail
SECTION_DIRECTORIES = SECTION_DIRECTORIES + 1
data resource from path
else match =resource? tail, seq
redefine seq tail
SECTION_DIRECTORIES = SECTION_DIRECTORIES + 1
data resource
else match =fixups? tail, seq
redefine seq tail
SECTION_DIRECTORIES = SECTION_DIRECTORIES + 1
data fixups
else match =code? tail, seq
redefine seq tail
SECTION_CHARACTERISTICS = SECTION_CHARACTERISTICS or IMAGE_SCN_CNT_CODE
else match =data? tail, seq
redefine seq tail
SECTION_CHARACTERISTICS = SECTION_CHARACTERISTICS or IMAGE_SCN_CNT_INITIALIZED_DATA
else match =udata? tail, seq
redefine seq tail
SECTION_CHARACTERISTICS = SECTION_CHARACTERISTICS or IMAGE_SCN_CNT_UNINITIALIZED_DATA
else match attribute tail, seq
err 'unknown attribute "',`attribute,'"'
redefine seq :
end match
end while
store SECTION_CHARACTERISTICS at PE:SectionTable.Characteristics+SECTION_INDEX*SectionTable.ENTRY_LENGTH
else
store declaration:qword at PE:SectionTable.Name+SECTION_INDEX*SectionTable.ENTRY_LENGTH
end match
end namespace
end macro
macro data? type*
namespace PE
local number,content
define content
match =export?, type
number = 0
else match =import?, type
number = 1
else match =resource? =from? path, type
number = 2
define content resource_from path
else match =resource?, type
number = 2
else match =fixups?, type
number = 5
define content fixups
else
number = type
end match
define DATA_DIRECTORY number
load DATA_BASE:dword from PE:RvaAndSizes.Rva+DATA_DIRECTORY*RvaAndSizes.ENTRY_LENGTH
if DATA_BASE = 0
store $-IMAGE_BASE:dword at PE:RvaAndSizes.Rva+DATA_DIRECTORY*RvaAndSizes.ENTRY_LENGTH
match instruction, content
instruction
end match
else
err 'data already defined'
end if
end namespace
end macro
macro end?.data?
namespace PE
load DATA_BASE:dword from PE:RvaAndSizes.Rva+DATA_DIRECTORY*RvaAndSizes.ENTRY_LENGTH
store $-IMAGE_BASE-DATA_BASE:dword at PE:RvaAndSizes.Size+DATA_DIRECTORY*RvaAndSizes.ENTRY_LENGTH
restore DATA_DIRECTORY
end namespace
end macro
macro PE.resource_directory?
namespace PE
Resource: rb RESOURCE_HEADERS_LENGTH
Resource.counter = 0
define RESOURCE_DIRECTORIES_LIST Resource_root
Resource_root.counter = 0
end namespace
end macro
macro PE.resource_data? type*,id*,lang*,codepage:0
namespace PE
local _type,_id,_lang
_type = type
_id = id
_lang = lang
if ~ type eqtype 0
_type = _type shl 32
end if
if ~ id eqtype 0
_id = id shl 32
end if
if ~ lang eqtype 0
_lang = lang shl 32
end if
repeat 1, %type:_type, %id:_id, %lang:_lang
if ~ defined Resource_#%type#_#%id.counter
if ~ defined Resource_#%type.counter
repeat 1, i:Resource_root.counter
Resource_root.entry#i = type
Resource_root.offset#i = (Resource_#%type - Resource) or 80000000h
end repeat
Resource_root.counter = Resource_root.counter + 1
match list, RESOURCE_DIRECTORIES_LIST
define RESOURCE_DIRECTORIES_LIST list,Resource_#%type
end match
Resource_#%type.counter = 0
end if
repeat 1, i:Resource_#%type.counter
Resource_#%type.entry#i = id
Resource_#%type.offset#i = (Resource_#%type#_#%id - Resource) or 80000000h
end repeat
Resource_#%type.counter = Resource_#%type.counter + 1
match list, RESOURCE_DIRECTORIES_LIST
define RESOURCE_DIRECTORIES_LIST list,Resource_#%type#_#%id
end match
Resource_#%type#_#%id.counter = 0
end if
repeat 1, i:Resource_#%type#_#%id.counter
Resource_#%type#_#%id.entry#i = lang
Resource_#%type#_#%id.offset#i = Resource_#%type#_#%id#_#%lang - Resource
end repeat
Resource_#%type#_#%id.counter = Resource_#%type#_#%id.counter + 1
repeat 1, i:Resource.counter
Resource_#%type#_#%id#_#%lang := Resource.entry#i
Resource.cp#i := codepage
Resource.data#i:
end repeat
end repeat
end namespace
end macro
macro PE.end_resource_data?
namespace PE
repeat 1, i:Resource.counter
Resource.size#i := $ - Resource.data#i
end repeat
Resource.counter = Resource.counter + 1
align 4
end namespace
end macro
macro PE.end_resource_directory?
namespace PE
RESOURCE_HEADERS_POINTER = 0
match list, RESOURCE_DIRECTORIES_LIST
iterate dir, list
dir := Resource + RESOURCE_HEADERS_POINTER
RESOURCE_HEADERS_POINTER = RESOURCE_HEADERS_POINTER + 16 + dir.counter * 8
local x,y,z,a,b
x = dir.counter shr 1
while x > 0
y = x
while y < dir.counter
z = y
while z-x >= 0
repeat 1, i:z, j:z-x
if dir.entry#i eqtype 0
if ~ dir.entry#j eqtype 0 | dir.entry#i >= dir.entry#j
z = 0
end if
else if ~ dir.entry#j eqtype 0
a = dir.entry#i bswap lengthof dir.entry#i
b = dir.entry#j bswap lengthof dir.entry#j
if ( lengthof a >= lengthof b & a shr ((lengthof a - lengthof b)*8) >= b ) | ( lengthof a < lengthof b & a > b shr ((lengthof b - lengthof a)*8) )
z = 0
end if
end if
if z > 0
a = dir.entry#i
b = dir.offset#i
dir.entry#i = dir.entry#j
dir.offset#i = dir.offset#j
dir.entry#j = a
dir.offset#j = b
z = z - x
end if
end repeat
end while
y = y + 1
end while
x = x shr 1
end while
end iterate
iterate dir, list
store __TIME__ : 4 at dir + 4
dir.names_counter = 0
repeat dir.counter, i:0
if dir.entry#i eqtype 0
store dir.entry#i : 4 at dir + 16 + i * 8
else
dir.names_counter = dir.names_counter + 1
repeat 1, %id:dir.entry#i
if ~ defined Resource_string#%id
restore Resource_string#%id
Resource_string#%id = Resource + RESOURCE_HEADERS_POINTER
if lengthof dir.entry#i and 1
err 'a word-aligned string is expected as a name'
end if
RESOURCE_HEADERS_POINTER = RESOURCE_HEADERS_POINTER + lengthof dir.entry#i + 2
store (lengthof dir.entry#i)/2 : 2 at Resource_string#%id
store dir.entry#i : lengthof dir.entry#i at Resource_string#%id + 2
end if
store (Resource_string#%id - Resource) or 80000000h : 4 at dir + 16 + i * 8
end repeat
end if
store dir.offset#i : 4 at dir + 16 + i * 8 + 4
end repeat
store dir.names_counter : 2 at dir + 12
store dir.counter - dir.names_counter : 2 at dir + 14
end iterate
end match
if RESOURCE_HEADERS_POINTER and 11b
RESOURCE_HEADERS_POINTER = RESOURCE_HEADERS_POINTER + 4 - RESOURCE_HEADERS_POINTER and 11b
end if
repeat Resource.counter, i:0
Resource.entry#i := Resource + RESOURCE_HEADERS_POINTER
RESOURCE_HEADERS_POINTER = RESOURCE_HEADERS_POINTER + 16
store RVA(Resource.data#i) : 4 at Resource.entry#i
store Resource.size#i : 4 at Resource.entry#i + 4
store Resource.cp#i : 4 at Resource.entry#i + 8
end repeat
RESOURCE_HEADERS_LENGTH = RESOURCE_HEADERS_POINTER
end namespace
end macro
macro PE.resource_from path*
local res_file,res_size,res_header_size,res_data_size,res_data
local offset,char,type,id,lang
virtual at 0
res_file:: file path
res_size := $
end virtual
PE.resource_directory
offset = 0
while offset < res_size
load res_header_size : 4 from res_file : offset + 4
load res_data_size : 4 from res_file : offset + 0
if res_data_size > 0
offset =: offset + 8
load char : 2 from res_file : offset
if char = 0FFFFh
load char : 2 from res_file : offset + 2
type = +char
offset = offset + 4
else
while 1
if char = 0
load type : (%-1)*2 from res_file : offset
offset = offset + (% + % and 1)*2
break
end if
load char : 2 from res_file : offset + %*2
end while
end if
load char : 2 from res_file : offset
if char = 0FFFFh
load char : 2 from res_file : offset + 2
id = +char
offset = offset + 4
else
while 1
if char = 0
load id : (%-1)*2 from res_file : offset
offset = offset + (% + % and 1)*2
break
end if
load char : 2 from res_file : offset + %*2
end while
end if
load char : 2 from res_file : offset + 6
lang = +char
restore offset
PE.resource_data type,id,lang
load res_data : res_data_size from res_file : offset + res_header_size
db res_data
PE.end_resource_data
end if
offset = offset + res_header_size + res_data_size
if offset and 11b
offset = offset + 4 - offset and 11b
end if
end while
PE.end_resource_directory
end macro
macro PE.fixups
namespace PE
Fixups:
calminstruction BuildFixups
local PAGE_RVA, BLOCK_HEADER, BLOCK_SIZE
local INDEX, ADDRESS, TYPE, FIXUP
check NUMBER_OF_RELOCATIONS = 0
jyes dummy
compute PAGE_RVA, -1
compute BLOCK_HEADER, 0
compute BLOCK_SIZE, 0
compute INDEX,0
process:
check INDEX = NUMBER_OF_RELOCATIONS
jyes close_block
load ADDRESS, relocated_addresses:INDEX shl 2, 4
check PAGE_RVA >= 0 & ADDRESS and not 0FFFh = PAGE_RVA
jyes append_to_block
close_block:
check BLOCK_HEADER
jno start_new_block
check BLOCK_SIZE and 11b
jno finish_block
emit 2, 0
compute BLOCK_SIZE, BLOCK_SIZE + 2
finish_block:
store BLOCK_HEADER+4, 4, BLOCK_SIZE
start_new_block:
check INDEX = NUMBER_OF_RELOCATIONS
jyes done
compute PAGE_RVA, ADDRESS and not 0FFFh
compute BLOCK_HEADER, $%
emit 4, PAGE_RVA
emit 4, 0
compute BLOCK_SIZE, 8
append_to_block:
load TYPE, relocation_types:INDEX shl 1, 2
compute FIXUP, (ADDRESS and 0FFFh) or (TYPE shl 12)
emit 2, FIXUP
compute BLOCK_SIZE, BLOCK_SIZE + 2
compute INDEX, INDEX + 1
jump process
dummy:
emit 4, 0
emit 4, 8
done:
end calminstruction
BuildFixups
end namespace
end macro
if defined PE.Fixups
calminstruction dword? value*
compute value, value
check value relativeto 0 | ~ value relativeto PE.RELOCATION
jyes plain
local offset
compute offset, $%
emit 4, value - PE.RELOCATION
check $% > offset
jno done
store PE.relocated_addresses:PE.RELOCATION_INDEX shl 2, 4, $-4-PE.IMAGE_BASE
store PE.relocation_types:PE.RELOCATION_INDEX shl 1, 2, IMAGE_REL_BASED_HIGHLOW
compute PE.RELOCATION_INDEX, PE.RELOCATION_INDEX + 1
done:
exit
plain:
emit 4, value
end calminstruction
calminstruction qword? value*
compute value, value
check value relativeto 0 | ~ value relativeto PE.RELOCATION
jyes plain
local offset
compute offset, $%
emit 8, value - PE.RELOCATION
check $% > offset
jno done
store PE.relocated_addresses:PE.RELOCATION_INDEX shl 2, 4, $-8-PE.IMAGE_BASE
store PE.relocation_types:PE.RELOCATION_INDEX shl 1, 2, IMAGE_REL_BASED_DIR64
compute PE.RELOCATION_INDEX, PE.RELOCATION_INDEX + 1
done:
exit
plain:
emit 8, value
end calminstruction
end if
postpone
purge section?
section
namespace PE
SIZE_OF_IMAGE := SECTION_BASE - IMAGE_BASE
NUMBER_OF_SECTIONS := SECTION_INDEX
NUMBER_OF_RELOCATIONS := RELOCATION_INDEX
end namespace
end postpone
postpone ?
namespace PE
CHECKSUM = 0
calminstruction CheckSum
local AREA, DATA_LENGTH, POS, H
get_block:
match AREA=,DATA_LENGTH=,CheckSumBlocks, CheckSumBlocks
jyes block_ready
match AREA=,DATA_LENGTH, CheckSumBlocks
jyes last_block
exit
last_block:
arrange CheckSumBlocks,
block_ready:
compute POS, 0
process_block:
check POS + 2 <= DATA_LENGTH
jno finish_block
load H, AREA:POS, 2
compute CHECKSUM, CHECKSUM + H
compute POS, POS + 2
jump process_block
finish_block:
check POS + 1 = DATA_LENGTH
jno reduce_checksum
load H, AREA:POS, 1
compute CHECKSUM, CHECKSUM + H
reduce_checksum:
check CHECKSUM shr 16
jno get_block
compute CHECKSUM, CHECKSUM shr 16 + CHECKSUM and 0FFFFh
jump reduce_checksum
done:
end calminstruction
CheckSum
CHECKSUM = CHECKSUM + $%
store CHECKSUM at PE:OptionalHeader.CheckSum
end namespace
end postpone

View File

@ -0,0 +1,46 @@
iterate <instr,opcode>, pf2id,1Dh, pfacc,0AEh, pfadd,9Eh, pfmax,0A4h, pfmin,94h, \
pfmul,0B4h, pfrcp,96h, pfsub,9Ah, pi2fd,0Dh, pi2fw,0Ch, \
pfsubr,0AAh, pavgusb,0BFh, pfcmpeq,0B0h, pfcmpge,90h, pfcmpgt,0A0h, \
pfrsqrt,97h, pmulhrw,0B7h, pfrcpit2,0B6h, pfrsqit1,0A7h
calminstruction instr? dest*,src*
call x86.require.3DNow
call MMX.parse_operand@dest, dest
call MMX.parse_operand@src, src
check @src.size and not @dest.size
jno size_ok
err 'operand sizes do not match'
size_ok:
check @dest.type = 'mmreg' & (@src.type = 'mem' | @src.type = 'mmreg')
jno invalid_combination_of_operands
xcall x86.store_instruction@src, <0Fh,0Fh>,@dest.rm,(1),(opcode)
exit
invalid_combination_of_operands:
err 'invalid combination of operands'
end calminstruction
end iterate
calminstruction femms?
call x86.require.3DNow
emit 1, 0Fh
emit 1, 0Eh
end calminstruction
iterate <instr,postbyte>, prefetch,0, prefetchw,1
calminstruction instr? src*
call x86.require.3DNow
call MMX.parse_operand@src, src
check @src.type = 'mem'
jno invalid_operand
check @src.size and not 1
jno size_ok
err 'invalid operand size'
size_ok:
xcall x86.store_instruction@src, <0Fh,0Dh>,(postbyte)
exit
invalid_operand:
err 'invalid operand'
end calminstruction
end iterate

View File

@ -0,0 +1,58 @@
iterate <instr,supp>, aesdec,0DEh, aesenc,0DCh, aesdeclast,0DFh, aesenclast,0DDh
macro instr? dest*,src*
require AESNI
SSE.basic_instruction 66h,<38h,supp>,16,dest,src
end macro
macro v#instr? dest*,src*,src2*
AVX_512.parse_operand@dest dest
AVX_512.parse_operand@src src
AVX_512.parse_operand@src2 src2
if @dest.type = 'mmreg' & @src.type = 'mmreg' & (@src2.type = 'mem' | @src2.type = 'mmreg')
if @dest.size <> @src.size | @src2.size and not @dest.size
err 'operand sizes do not match'
end if
@src2.memsize = 0
if x86.ext and x86.VAES.ext
AVX_512.store_instruction@src2 @dest.size,VEX_66_0F38_W0,EVEX_AS_VEX+EVEX_VL,opcode,0,@dest.rm,@src.rm
else
require AESNI
AVX_512.store_instruction@src2 @dest.size,VEX_66_0F38_W0,EVEX_FORBIDDEN,opcode,0,@dest.rm,@src.rm
end if
else
err 'invalid combination of operands'
end if
end macro
end iterate
iterate <instr,opcode>, aesimc,0DBh
macro instr? dest*,src*
require AESNI
SSE.basic_instruction 66h,<38h,supp>,16,dest,src
end macro
macro v#instr? dest*,src*
require AESNI
AVX_512.single_source_instruction VEX_66_0F38_W0,EVEX_FORBIDDEN,opcode,16,dest,src
end macro
end iterate
iterate <instr,supp>, aeskeygenassist,0DFh
macro instr? dest*,src*,imm*
require AESNI
SSE.basic_instruction_imm8 66h,<3Ah,supp>,16,dest,src,imm
end macro
macro v#instr? dest*,src*,imm*
require AESNI
AVX_512.single_source_instruction_imm8 VEX_66_0F3A_W0,EVEX_FORBIDDEN,opcode,16,dest,src,imm
end macro
end iterate

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,290 @@
macro andn? dest*,src*,src2*
require BMI1
x86.parse_operand@dest dest
x86.parse_operand@src src
x86.parse_operand@src2 src2
if @dest.type = 'reg' & @src.type = 'reg' & (@src2.type = 'mem' | @src2.type = 'reg')
if @dest.size < 4
err 'invalid operand size'
else if @src.size <> @dest.size | @src2.size and not @dest.size
err 'operand sizes do not match'
end if
if @dest.size = 8
if x86.mode < 64
err 'instruction requires long mode'
end if
AVX.store_instruction@src2 16,VEX_0F38_W1,0F2h,@dest.rm,@src.rm
else
AVX.store_instruction@src2 16,VEX_0F38_W0,0F2h,@dest.rm,@src.rm
end if
else
err 'invalid combination of operands'
end if
end macro
macro bextr? dest*,src*,src2*
require BMI1
x86.parse_operand@dest dest
x86.parse_operand@src src
x86.parse_operand@src2 src2
if @dest.type = 'reg' & (@src.type = 'mem' | @src.type = 'reg') & @src2.type = 'reg'
if @dest.size < 4
err 'invalid operand size'
else if @src.size and not @dest.size | @src2.size <> @dest.size
err 'operand sizes do not match'
end if
if @dest.size = 8
if x86.mode < 64
err 'instruction requires long mode'
end if
AVX.store_instruction@src 16,VEX_0F38_W1,0F7h,@dest.rm,@src2.rm
else
AVX.store_instruction@src 16,VEX_0F38_W0,0F7h,@dest.rm,@src2.rm
end if
else
err 'invalid combination of operands'
end if
end macro
iterate <instr,opcode,postbyte>, blsi,0F3h,3, blsmsk,0F3h,2, blsr,0F3h,1
macro instr? dest*,src*
require BMI1
x86.parse_operand@dest dest
x86.parse_operand@src src
if @dest.type = 'reg' & (@src.type = 'mem' | @src.type = 'reg')
if @dest.size < 4
err 'invalid operand size'
else if @src.size and not @dest.size
err 'operand sizes do not match'
end if
if @dest.size = 8
if x86.mode < 64
err 'instruction requires long mode'
end if
AVX.store_instruction@src 16,VEX_0F38_W1,opcode,postbyte,@dest.rm
else
AVX.store_instruction@src 16,VEX_0F38_W0,opcode,postbyte,@dest.rm
end if
else
err 'invalid combination of operands'
end if
end macro
end iterate
iterate <instr,opcode>, lzcnt,0BDh, tzcnt,0BCh
macro instr? dest*,src*
require BMI1
x86.parse_operand@dest dest
x86.parse_operand@src src
if @dest.type = 'reg' & ( @src.type = 'reg' | @src.type = 'mem' )
if @src.size and not @dest.size
err 'operand sizes do not match'
end if
@src.opcode_prefix = 0F3h
if @dest.size > 1
x86.select_operand_prefix@src @dest.size
x86.store_instruction@src <0Fh,opcode>,@dest.rm
else
err 'invalid operand size'
end if
else
err 'invalid combination of operands'
end if
end macro
end iterate
iterate <instr,opcode>, bzhi,0F5h
macro instr? dest*,src*,src2*
require BMI2
x86.parse_operand@dest dest
x86.parse_operand@src src
x86.parse_operand@src2 src2
if @dest.type = 'reg' & (@src.type = 'mem' | @src.type = 'reg') & @src2.type = 'reg'
if @dest.size < 4
err 'invalid operand size'
else if @src.size and not @dest.size | @src2.size <> @dest.size
err 'operand sizes do not match'
end if
if @dest.size = 8
if x86.mode < 64
err 'instruction requires long mode'
end if
AVX.store_instruction@src 16,VEX_0F38_W1,opcode,@dest.rm,@src2.rm
else
AVX.store_instruction@src 16,VEX_0F38_W0,opcode,@dest.rm,@src2.rm
end if
else
err 'invalid combination of operands'
end if
end macro
end iterate
iterate <instr,vex_mp,opcode>, mulx,VEX_F2_0F38,0F6h, pdep,VEX_F2_0F38,0F5h, pext,VEX_F3_0F38,0F5h
macro instr? dest*,src*,src2*
require BMI2
x86.parse_operand@dest dest
x86.parse_operand@src src
x86.parse_operand@src2 src2
if @dest.type = 'reg' & @src.type = 'reg' & (@src2.type = 'mem' | @src2.type = 'reg')
if @dest.size < 4
err 'invalid operand size'
else if @src.size <> @dest.size | @src2.size and not @dest.size
err 'operand sizes do not match'
end if
if @dest.size = 8
if x86.mode < 64
err 'instruction requires long mode'
end if
AVX.store_instruction@src2 16,vex_mp#_W1,opcode,@dest.rm,@src.rm
else
AVX.store_instruction@src2 16,vex_mp#_W0,opcode,@dest.rm,@src.rm
end if
else
err 'invalid combination of operands'
end if
end macro
end iterate
macro rorx? dest*,src*,src2*
require BMI2
x86.parse_operand@dest dest
x86.parse_operand@src src
x86.parse_operand@src2 src2
if @dest.type = 'reg' & (@src.type = 'mem' | @src.type = 'reg') & @src2.type = 'imm'
if @dest.size < 4 | @src2.size and not 1
err 'invalid operand size'
else if @src.size and not @dest.size
err 'operand sizes do not match'
end if
if @dest.size = 8
if x86.mode < 64
err 'instruction requires long mode'
end if
AVX.store_instruction@src 16,VEX_F2_0F3A_W1,0F0h,@dest.rm,,1,@src2.imm
else
AVX.store_instruction@src 16,VEX_F2_0F3A_W0,0F0h,@dest.rm,,1,@src2.imm
end if
else
err 'invalid combination of operands'
end if
end macro
iterate <instr,vex_mp,opcode>, sarx,VEX_F3_0F38,0F7h, shlx,VEX_66_0F38,0F7h, shrx,VEX_F2_0F38,0F7h
macro instr? dest*,src*,src2*
require BMI2
x86.parse_operand@dest dest
x86.parse_operand@src src
x86.parse_operand@src2 src2
if @dest.type = 'reg' & (@src.type = 'mem' | @src.type = 'reg') & @src2.type = 'reg'
if @dest.size < 4
err 'invalid operand size'
else if @src.size and not @dest.size | @src2.size <> @dest.size
err 'operand sizes do not match'
end if
if @dest.size = 8
if x86.mode < 64
err 'instruction requires long mode'
end if
AVX.store_instruction@src 16,vex_mp#_W1,opcode,@dest.rm,@src2.rm
else
AVX.store_instruction@src 16,vex_mp#_W0,opcode,@dest.rm,@src2.rm
end if
else
err 'invalid combination of operands'
end if
end macro
end iterate
iterate <instr,vex_mpw,opcode>, vpermb,VEX_66_0F38_W0,8Dh, vpermi2b,VEX_66_0F38_W0,75h, vpermt2b,VEX_66_0F38_W0,7Dh
macro instr? dest*,src*,src2*
require AVX512_VBMI
AVX_512.basic_instruction vex_mpw,EVEX_REQUIRED+EVEX_VL,opcode,0,dest,src,src2
end macro
end iterate
iterate <instr,opcode>, vpmultishiftqb,83h
macro instr? dest*,src*,src2*
require AVX512_VBMI
AVX_512.basic_instruction_bcst VEX_66_0F38_W1,EVEX_REQUIRED+EVEX_VL,opcode,8,dest,src,src2
end macro
end iterate
iterate <instr,vex_mpw,opcode>, vpshldw,VEX_66_0F3A_W1,70h, vpshrdw,VEX_66_0F3A_W1,72h
macro instr? dest*,src*,src2*,aux*&
require AVX512_VBMI2
AVX_512.basic_instruction_imm8 vex_mpw,EVEX_REQUIRED+EVEX_VL,opcode,0,dest,src,src2,aux
end macro
end iterate
iterate <instr,unit,vex_mpw,opcode>, vpshldd,4,VEX_66_0F3A_W0,71h, vpshldq,8,VEX_66_0F3A_W1,71h, \
vpshrdd,4,VEX_66_0F3A_W0,73h, vpshrdq,8,VEX_66_0F3A_W1,73h
macro instr? dest*,src*,src2*,aux*&
require AVX512_VBMI2
AVX_512.basic_instruction_bcst_imm8 vex_mpw,EVEX_REQUIRED+EVEX_VL,opcode,unit,dest,src,src2,aux
end macro
end iterate
iterate <instr,vex_mpw,opcode>, vpshldvw,VEX_66_0F38_W1,70h, vpshrdvw,VEX_66_0F38_W1,72h
macro instr? dest*,src*,src2*
require AVX512_VBMI2
AVX_512.basic_instruction vex_mpw,EVEX_REQUIRED+EVEX_VL,opcode,0,dest,src,src2
end macro
end iterate
iterate <instr,unit,vex_mpw,opcode>, vpshldvd,4,VEX_66_0F38_W0,71h, vpshldvq,8,VEX_66_0F38_W1,71h, \
vpshrdvd,4,VEX_66_0F38_W0,73h, vpshrdvq,8,VEX_66_0F38_W1,73h
macro instr? dest*,src*,src2*
require AVX512_VBMI2
AVX_512.basic_instruction_bcst vex_mpw,EVEX_REQUIRED+EVEX_VL,opcode,unit,dest,src,src2
end macro
end iterate
iterate <instr,vex_mpw,opcode>, vpcompressb,VEX_66_0F38_W0,63h, vpcompressw,VEX_66_0F38_W1,63h
macro instr? dest*,src*
require AVX512_VBMI2
AVX_512.parse_k1z_operand@dest dest
AVX_512.parse_operand@src src
if (@dest.type = 'mmreg' | @dest.type = 'mem') & @src.type = 'mmreg'
if @dest.size and not @src.size
err 'operand sizes do not match'
end if
AVX_512.store_instruction@dest @src.size,vex_mpw,EVEX_REQUIRED+EVEX_VL,opcode,@dest.mask,@src.rm
else
err 'invalid combination of operands'
end if
end macro
end iterate
iterate <instr,vex_mpw,opcode>, vpexpandb,VEX_66_0F38_W0,62h, vpexpandw,VEX_66_0F38_W1,62h
macro instr? dest*,src*
require AVX512_VBMI2
AVX_512.single_source_instruction vex_mpw,EVEX_REQUIRED+EVEX_VL,opcode,0,dest,src
end macro
end iterate

View File

@ -0,0 +1,122 @@
iterate <instr,modrm>, endbr32,0FBh, endbr64,0FAh
macro instr?
require CET_IBT
db 0F3h,0Fh,1Eh,modrm
end macro
end iterate
iterate <instr,ext,postbyte>, clrssbsy,0AEh,6, rstorssp,01h,5
macro instr? src*
require CET_SS
x86.parse_operand@src src
if @src.type = 'mem'
if @src.size and not 8
err 'invalid operand size'
else
@src.opcode_prefix = 0F3h
x86.store_instruction@src <0Fh,ext>,postbyte
end if
else
err 'invalid operand'
end if
end macro
end iterate
iterate <instr,ext,postbyte>, incsspd,0AEh,5, rdsspd,1Eh,1
macro instr? src*
require CET_SS
x86.parse_operand@src src
if @src.type = 'reg'
if @src.size <> 4
err 'invalid operand size'
else
@src.opcode_prefix = 0F3h
x86.store_instruction@src <0Fh,ext>,postbyte
end if
else
err 'invalid operand'
end if
end macro
end iterate
iterate <instr,ext,postbyte>, incsspq,0AEh,5, rdsspq,1Eh,1
macro instr? src*
require CET_SS
x86.parse_operand@src src
if @src.type = 'reg'
if @src.size <> 8
err 'invalid operand size'
else
x86.select_operand_prefix@src 8
@src.opcode_prefix = 0F3h
x86.store_instruction@src <0Fh,ext>,postbyte
end if
else
err 'invalid operand'
end if
end macro
end iterate
iterate <instr,modrm>, saveprevssp,0EAh, setssbsy,0E8h
macro instr?
require CET_SS
db 0F3h,0Fh,01h,modrm
end macro
end iterate
iterate <instr,prefix,ext>, wrssd,0,0F6h, wrussd,66h,0F5h
macro instr? dest*,src*
require CET_SS
x86.parse_operand@dest dest
x86.parse_operand@src src
local size
if @src.size <> 4
err 'invalid operand size'
else if @dest.size and not @src.size
err 'operand sizes do not match'
end if
if @src.type = 'reg' & ( @dest.type = 'reg' | @dest.type = 'mem' )
@dest.opcode_prefix = prefix
x86.store_instruction@dest <0Fh,38h,ext>,@src.rm
else
err 'invalid combination of operands'
end if
end macro
end iterate
iterate <instr,prefix,ext>, wrssq,0,0F6h, wrussq,66h,0F5h
macro instr? dest*,src*
require CET_SS
x86.parse_operand@dest dest
x86.parse_operand@src src
local size
if @src.size <> 8
err 'invalid operand size'
else if @dest.size and not @src.size
err 'operand sizes do not match'
end if
if @src.type = 'reg' & ( @dest.type = 'reg' | @dest.type = 'mem' )
x86.select_operand_prefix@dest 8
@dest.opcode_prefix = prefix
x86.store_instruction@dest <0Fh,38h,ext>,@src.rm
else
err 'invalid combination of operands'
end if
end macro
end iterate

View File

@ -0,0 +1,742 @@
element st?
repeat 8, i:0
element st#i? : st? + i
end repeat
iterate context, @dest,@src,@src2,@aux
namespace context
calminstruction x87.parse_operand#context operand
local i
match =st?(i), operand
jyes indexed_streg_operand
call x86.parse_operand#context, operand
check type = 'imm' & size = 0
jno done
check imm eq 1 elementof imm & 1 metadataof imm relativeto st?
jyes streg_operand
check imm relativeto st? & imm = st?
jno done
compute type, 'streg'
compute mod, 11b
compute rm, 0
exit
streg_operand:
compute type, 'streg'
compute mod, 11b
compute rm, 1 metadataof imm - st?
exit
indexed_streg_operand:
compute size, 0
compute type, 'streg'
compute mod, 11b
compute rm, +i
done:
end calminstruction
end namespace
end iterate
iterate <instr,opcode>, fwait,9Bh, wait,9Bh
calminstruction instr?
call x86.require.8087
emit 1, opcode
end calminstruction
end iterate
iterate <instr,byte1,byte2>, fnop,0D9h,0D0h, fchs,0D9h,0E0h, fabs,0D9h,0E1h, ftst,0D9h,0E4h, fxam,0D9h,0E5h, fld1,0D9h,0E8h, \
fldl2t,0D9h,0E9h, fldl2e,0D9h,0EAh, fldpi,0D9h,0EBh, fldlg2,0D9h,0ECh, fldln2,0D9h,0EDh, fldz,0D9h,0EEh, \
f2xm1,0D9h,0F0h, fyl2x,0D9h,0F1h, fptan,0D9h,0F2h, fpatan,0D9h,0F3h, fxtract,0D9h,0F4h, \
fdecstp,0D9h,0F6h, fincstp,0D9h,0F7h, fprem,0D9h,0F8h, \
fyl2xp1,0D9h,0F9h, fsqrt,0D9h,0FAh, frndint,0D9h,0FCh, fscale,0D9h,0FDh, \
fneni,0DBh,0E0h, fndisi,0DBh,0E1h, fnclex,0DBh,0E2h, fninit,0DBh,0E3h, \
fcompp,0DEh,0D9h
calminstruction instr?
call x86.require.8087
emit 1, byte1
emit 1, byte2
end calminstruction
end iterate
iterate <instr,opcode>, fneni,0E0h, fndisi,0E1h
calminstruction instr?
call x86.requireexact.8087
emit 1, 0DBh
emit 1, opcode
end calminstruction
end iterate
iterate op, eni, disi, clex, init
calminstruction f#op?
asm fwait?
asm fn#op?
end calminstruction
end iterate
calminstruction fsetpm?
call x86.requireexact.80287
emit 1, 0DBh
emit 1, 0E4h
end calminstruction
iterate <instr,postbyte>, fadd,0, fmul,1, fsub,4, fsubr,5, fdiv,6, fdivr,7
calminstruction instr? operand&
call x86.require.8087
local dest, src
match dest=,src, operand
jyes st
call x87.parse_operand@dest, operand
check @dest.type = 'mem'
jno invalid_combination_of_operands
check @dest.size = 4
jyes mem_dword
check @dest.size = 8
jyes mem_qword
check @dest.size
jno unknown_size
err 'invalid operand size'
jump mem_dword
unknown_size:
err 'operand size not specified'
mem_dword:
xcall x86.store_instruction@dest, (0D8h),(postbyte)
exit
mem_qword:
xcall x86.store_instruction@dest, (0DCh),(postbyte)
exit
st:
call x87.parse_operand@dest, dest
call x87.parse_operand@src, src
check @dest.type = 'streg' & @src.type = 'streg'
jno invalid_combination_of_operands
check @dest.rm = 0
jyes st0_sti
check @src.rm = 0
jyes sti_st0
jump invalid_combination_of_operands
st0_sti:
emit 1, 0D8h
emit 1, 11b shl 6 + postbyte shl 3 + @src.rm
exit
sti_st0:
check postbyte >= 4
jyes switched
emit 1, 0DCh
emit 1, 11b shl 6 + postbyte shl 3 + @dest.rm
exit
switched:
emit 1, 0DCh
emit 1, 11b shl 6 + (postbyte xor 1) shl 3 + @dest.rm
exit
invalid_combination_of_operands:
err 'invalid combination of operands'
end calminstruction
end iterate
iterate <instr,postbyte>, faddp,0, fmulp,1, fsubrp,4, fsubp,5, fdivrp,6, fdivp,7
calminstruction instr? operand&
call x86.require.8087
local dest, src
match , operand
jyes default
match dest=,src, operand
jno invalid_combination_of_operands
call x87.parse_operand@dest, dest
call x87.parse_operand@src, src
check @dest.type = 'streg' & @src.type = 'streg' & @src.rm = 0
jyes ok
invalid_combination_of_operands:
err 'invalid combination of operands'
exit
default:
compute @dest.rm, 1
ok:
emit 1, 0DEh
emit 1, 11b shl 6 + postbyte shl 3 + @dest.rm
end calminstruction
end iterate
iterate <instr,postbyte>, fcom,2, fcomp,3
calminstruction instr? src:st1
call x86.require.8087
call x87.parse_operand@src, src
check @src.type = 'streg'
jyes st
check @src.type = 'mem'
jno invalid_operand
check @src.size = 4
jyes mem_dword
check @src.size = 8
jyes mem_qword
check @src.size
jno unknown_size
err 'invalid operand size'
jump mem_dword
unknown_size:
err 'operand size not specified'
mem_dword: st:
xcall x86.store_instruction@src, (0D8h),(postbyte)
exit
mem_qword:
xcall x86.store_instruction@src, (0DCh),(postbyte)
exit
invalid_operand:
err 'invalid operand'
end calminstruction
end iterate
iterate <instr,postbyte>, fiadd,0, fimul,1, ficom,2, ficomp,3, fisub,4, fisubr,5, fidiv,6, fidivr,7
calminstruction instr? src*
call x86.require.8087
call x87.parse_operand@src, src
check @src.type = 'mem'
jno invalid_operand
check @src.size = 2
jyes mem_word
check @src.size = 4
jyes mem_dword
check @src.size
jno unknown_size
err 'invalid operand size'
jump mem_word
unknown_size:
err 'operand size not specified'
mem_word:
xcall x86.store_instruction@src, (0DEh),(postbyte)
exit
mem_dword:
xcall x86.store_instruction@src, (0DAh),(postbyte)
exit
invalid_operand:
err 'invalid operand'
end calminstruction
end iterate
calminstruction fld? src*
call x86.require.8087
call x87.parse_operand@src, src
check @src.type = 'streg'
jyes st
check @src.type = 'mem'
jno invalid_operand
check @src.size = 4
jyes mem_dword
check @src.size = 8
jyes mem_qword
check @src.size = 10
jyes mem_tword
check @src.size
jno unknown_size
err 'invalid operand size'
jump mem_dword
unknown_size:
err 'operand size not specified'
mem_dword: st:
xcall x86.store_instruction@src, (0D9h),(0)
exit
mem_qword:
xcall x86.store_instruction@src, (0DDh),(0)
exit
mem_tword:
xcall x86.store_instruction@src, (0DBh),(5)
exit
invalid_operand:
err 'invalid operand'
end calminstruction
calminstruction fst? dest*
call x86.require.8087
call x87.parse_operand@dest, dest
check @dest.type = 'streg'
jyes st
check @dest.type = 'mem'
jno invalid_operand
check @dest.size = 4
jyes mem_dword
check @dest.size = 8
jyes mem_qword
check @dest.size
jno unknown_size
err 'invalid operand size'
jump mem_dword
unknown_size:
err 'operand size not specified'
mem_dword:
xcall x86.store_instruction@dest, (0D9h),(2)
exit
mem_qword: st:
xcall x86.store_instruction@dest, (0DDh),(2)
exit
invalid_operand:
err 'invalid operand'
end calminstruction
calminstruction fstp? dest*
call x86.require.8087
call x87.parse_operand@dest, dest
check @dest.type = 'streg'
jyes st
check @dest.type = 'mem'
jno invalid_operand
check @dest.size = 4
jyes mem_dword
check @dest.size = 8
jyes mem_qword
check @dest.size = 10
jyes mem_tword
check @dest.size
jno unknown_size
err 'invalid operand size'
jump mem_dword
unknown_size:
err 'operand size not specified'
mem_dword:
xcall x86.store_instruction@dest, (0D9h),(3)
exit
mem_qword: st:
xcall x86.store_instruction@dest, (0DDh),(3)
exit
mem_tword:
xcall x86.store_instruction@dest, (0DBh),(7)
exit
invalid_operand:
err 'invalid operand'
end calminstruction
calminstruction fild? src*
call x86.require.8087
call x87.parse_operand@src, src
check @src.type = 'mem'
jno invalid_operand
check @src.size = 2
jyes mem_word
check @src.size = 4
jyes mem_dword
check @src.size = 8
jyes mem_qword
check @src.size
jno unknown_size
err 'invalid operand size'
jump mem_word
unknown_size:
err 'operand size not specified'
mem_word:
xcall x86.store_instruction@src, (0DFh),(0)
exit
mem_dword:
xcall x86.store_instruction@src, (0DBh),(0)
exit
mem_qword:
xcall x86.store_instruction@src, (0DFh),(5)
exit
invalid_operand:
err 'invalid operand'
end calminstruction
calminstruction fist? dest*
call x86.require.8087
call x87.parse_operand@dest, dest
check @dest.type = 'mem'
jno invalid_operand
check @dest.size = 2
jyes mem_word
check @dest.size = 4
jyes mem_dword
check @dest.size
jno unknown_size
err 'invalid operand size'
jump mem_word
unknown_size:
err 'operand size not specified'
mem_word:
xcall x86.store_instruction@dest, (0DFh),(2)
exit
mem_dword:
xcall x86.store_instruction@dest, (0DBh),(2)
exit
invalid_operand:
err 'invalid operand'
end calminstruction
calminstruction fistp? dest*
call x86.require.8087
call x87.parse_operand@dest, dest
check @dest.type = 'mem'
jno invalid_operand
check @dest.size = 2
jyes mem_word
check @dest.size = 4
jyes mem_dword
check @dest.size = 8
jyes mem_qword
check @dest.size
jno unknown_size
err 'invalid operand size'
jump mem_word
unknown_size:
err 'operand size not specified'
mem_word:
xcall x86.store_instruction@dest, (0DFh),(3)
exit
mem_dword:
xcall x86.store_instruction@dest, (0DBh),(3)
exit
mem_qword:
xcall x86.store_instruction@dest, (0DFh),(7)
exit
invalid_operand:
err 'invalid operand'
end calminstruction
calminstruction fisttp? dest*
call x86.require.8087
call x87.parse_operand@dest, dest
check @dest.type = 'mem'
jno invalid_operand
check @dest.size = 2
jyes mem_word
check @dest.size = 4
jyes mem_dword
check @dest.size = 8
jyes mem_qword
check @dest.size
jno unknown_size
err 'invalid operand size'
jump mem_word
unknown_size:
err 'operand size not specified'
mem_word:
xcall x86.store_instruction@dest, (0DFh),(1)
exit
mem_dword:
xcall x86.store_instruction@dest, (0DBh),(1)
exit
mem_qword:
xcall x86.store_instruction@dest, (0DDh),(1)
exit
invalid_operand:
err 'invalid operand'
end calminstruction
iterate <instr,postbyte>, fbld,4, fbstp,6
calminstruction instr? src*
call x86.require.8087
call x87.parse_operand@src, src
check @src.type = 'mem'
jno invalid_operand
check @src.size and not 10
jyes invalid_operand_size
xcall x86.store_instruction@src, (0DFh),(postbyte)
exit
invalid_operand_size:
err 'invalid operand size'
exit
invalid_operand:
err 'invalid operand'
end calminstruction
end iterate
calminstruction fxch? src:st1
call x86.require.8087
call x87.parse_operand@src, src
check @src.type = 'streg'
jno invalid_operand
emit 1, 0D9h
emit 1, 11b shl 6 + 1 shl 3 + @src.rm
exit
invalid_operand:
err 'invalid operand'
end calminstruction
iterate <instr,basecode>, ffree,0DDh, ffreep,0DFh
calminstruction instr? src*
call x86.require.8087
call x87.parse_operand@src, src
check @src.type = 'streg'
jno invalid_operand
emit 1, basecode
emit 1, 11b shl 6 + @src.rm
exit
invalid_operand:
err 'invalid operand'
end calminstruction
end iterate
calminstruction fnstsw? dest*
call x86.require.8087
call x86.parse_operand@dest, dest
check @dest.size and not 2
jyes invalid_operand_size
check @dest.type = 'mem'
jyes mem
check @dest.type = 'reg' & @dest.rm = 0
jno invalid_operand
emit 1, 0DFh
emit 1, 0E0h
exit
mem:
xcall x86.store_instruction@dest, (0DDh),(7)
exit
invalid_operand_size:
err 'invalid operand size'
exit
invalid_operand:
err 'invalid operand'
end calminstruction
iterate <instr,postbyte>, fldcw,5, fnstcw,7
calminstruction instr? dest*
call x86.parse_operand@dest, dest
check @dest.size and not 2
jyes invalid_operand_size
check @dest.type = 'mem'
jno invalid_operand
xcall x86.store_instruction@dest, (0D9h),(postbyte)
exit
invalid_operand_size:
err 'invalid operand size'
exit
invalid_operand:
err 'invalid operand'
end calminstruction
end iterate
iterate <instr,postbyte>, fldenv,4, fnstenv,6
calminstruction instr? dest*
call x86.require.8087
call x86.parse_operand@dest, dest
check @dest.size and not 14
jyes invalid_operand_size
check @dest.type = 'mem'
jno invalid_operand
xcall x86.store_instruction@dest, (0D9h),(postbyte)
exit
invalid_operand_size:
err 'invalid operand size'
exit
invalid_operand:
err 'invalid operand'
end calminstruction
end iterate
iterate <instr,postbyte>, frstor,4, fnsave,6
calminstruction instr? dest*
call x86.require.8087
call x86.parse_operand@dest, dest
check @dest.size and not 94
jyes invalid_operand_size
check @dest.type = 'mem'
jno invalid_operand
xcall x86.store_instruction@dest, (0DDh),(postbyte)
exit
invalid_operand_size:
err 'invalid operand size'
exit
invalid_operand:
err 'invalid operand'
end calminstruction
end iterate
iterate op, stsw, stcw, stenv, save
calminstruction f#op? dest*
asm fwait?
asm fn#op? dest
end calminstruction
end iterate
iterate <instr,byte1,byte2>, fprem1,0D9h,0F5h, fsincos,0D9h,0FBh, fsin,0D9h,0FEh, fcos,0D9h,0FFh, fucompp,0DAh,0E9h
calminstruction instr?
call x86.require.80387
emit 1, byte1
emit 1, byte2
end calminstruction
end iterate
iterate <instr,postbyte>, fucom,4, fucomp,5
calminstruction instr? src:st1
call x86.require.80387
call x87.parse_operand@src, src
check @src.type = 'streg'
jno invalid_operand
xcall x86.store_instruction@src, (0DDh),(postbyte)
exit
invalid_operand:
err 'invalid operand'
end calminstruction
end iterate
iterate <instr,postbyte>, fldenv,4, fnstenv,6
calminstruction instr? dest*
call x86.require.80387
call x86.parse_operand@dest, dest
check @dest.size & ( ( x86.mode = 16 & @dest.size <> 14 ) | ( x86.mode = 32 & @dest.size <> 28 ) )
jyes invalid_operand_size
check @dest.type = 'mem'
jno invalid_operand
xcall x86.store_instruction@dest, (0D9h),(postbyte)
exit
invalid_operand_size:
err 'invalid operand size'
exit
invalid_operand:
err 'invalid operand'
end calminstruction
end iterate
iterate <instr,postbyte>, fldenvw,4, fnstenvw,6
calminstruction instr? dest*
call x86.require.80387
call x86.parse_operand@dest, dest
check @dest.size and not 14
jyes invalid_operand_size
check @dest.type = 'mem'
jno invalid_operand
xcall x86.store_operand_prefix, (2)
xcall x86.store_instruction@dest, (0D9h),(postbyte)
exit
invalid_operand_size:
err 'invalid operand size'
exit
invalid_operand:
err 'invalid operand'
end calminstruction
end iterate
iterate <instr,postbyte>, fldenvd,4, fnstenvd,6
calminstruction instr? dest*
call x86.require.80387
call x86.parse_operand@dest, dest
check @dest.size and not 28
jyes invalid_operand_size
check @dest.type = 'mem'
jno invalid_operand
xcall x86.store_operand_prefix, (4)
xcall x86.store_instruction@dest, (0D9h),(postbyte)
exit
invalid_operand_size:
err 'invalid operand size'
exit
invalid_operand:
err 'invalid operand'
end calminstruction
end iterate
iterate <instr,postbyte>, frstor,4, fnsave,6
calminstruction instr? dest*
call x86.require.80387
call x86.parse_operand@dest, dest
check @dest.size & ( ( x86.mode = 16 & @dest.size <> 94 ) | ( x86.mode = 32 & @dest.size <> 108 ) )
jyes invalid_operand_size
check @dest.type = 'mem'
jno invalid_operand
xcall x86.store_instruction@dest, (0DDh),(postbyte)
exit
invalid_operand_size:
err 'invalid operand size'
exit
invalid_operand:
err 'invalid operand'
end calminstruction
end iterate
iterate <instr,postbyte>, frstorw,4, fnsavew,6
calminstruction instr? dest*
call x86.require.80387
call x86.parse_operand@dest, dest
check @dest.size and not 94
jyes invalid_operand_size
check @dest.type = 'mem'
jno invalid_operand
xcall x86.store_operand_prefix, (2)
xcall x86.store_instruction@dest, (0DDh),(postbyte)
exit
invalid_operand_size:
err 'invalid operand size'
exit
invalid_operand:
err 'invalid operand'
end calminstruction
end iterate
iterate <instr,postbyte>, frstord,4, fnsaved,6
calminstruction instr? dest*
call x86.require.80387
call x86.parse_operand@dest, dest
check @dest.size and not 108
jyes invalid_operand_size
check @dest.type = 'mem'
jno invalid_operand
xcall x86.store_operand_prefix, (4)
xcall x86.store_instruction@dest, (0DDh),(postbyte)
exit
invalid_operand_size:
err 'invalid operand size'
exit
invalid_operand:
err 'invalid operand'
end calminstruction
end iterate
iterate op, stenvw, stenvd, savew, saved
calminstruction f#op? dest*
asm fwait?
asm fn#op? dest
end calminstruction
end iterate

View File

@ -0,0 +1,33 @@
iterate <instr,supp>, gf2p8mulb,0CFh
macro instr? dest*,src*
require GFNI
SSE.basic_instruction 66h,<38h,supp>,16,dest,src
end macro
end iterate
iterate <instr,supp>, gf2p8affineinvqb,0CFh, gf2p8affineqb,0CEh
macro instr? dest*,src*,imm*
require GFNI
SSE.basic_instruction_imm8 66h,<3Ah,supp>,16,dest,src,imm
end macro
end iterate
iterate <instr,opcode>, gf2p8mulb,0CFh
macro v#instr? dest*,src*,src2*&
require GFNI
AVX_512.basic_instruction VEX_66_0F38_W0,EVEX_AS_VEX+EVEX_VL,opcode,0,dest,src,src2
end macro
end iterate
iterate <instr,opcode>, gf2p8affineinvqb,0CFh, gf2p8affineqb,0CEh
macro v#instr? dest*,src*,src2*,imm*&
require GFNI
AVX_512.basic_instruction_bcst_imm8 VEX_66_0F3A_W1,EVEX_W1+EVEX_VL,opcode,8,dest,src,src2,imm
end macro
end iterate

View File

@ -0,0 +1,164 @@
element MMX.reg
repeat 8, i:0
element mm#i? : MMX.reg + i
end repeat
iterate context, @dest,@src,@src2,@aux
namespace context
calminstruction MMX.parse_operand#context operand
call x86.parse_operand#context, operand
check type = 'imm' & size = 0
jno done
check imm eq 1 elementof imm & 1 metadataof imm relativeto MMX.reg
jno done
compute type, 'mmreg'
compute mod, 11b
compute rm, 1 metadataof imm - MMX.reg
compute size, 8
done:
end calminstruction
calminstruction MMX.select_operand_prefix#context size*
check size = 16
jno no_prefix
call x86.require.SSE2
compute prefix, 66h
exit
no_prefix:
check size <> 8
jno done
err 'invalid operand size'
done:
end calminstruction
end namespace
end iterate
calminstruction MMX.basic_instruction ext,dest,src
call x86.require.MMX
call SSE.parse_operand@dest, dest
call SSE.parse_operand@src, src
check @src.size and not @dest.size
jno size_ok
err 'operand sizes do not match'
size_ok:
check @dest.type = 'mmreg' & (@src.type = 'mem' | @src.type = 'mmreg')
jno invalid_combination_of_operands
call MMX.select_operand_prefix@src, @dest.size
xcall x86.store_instruction@src, <0Fh,ext>,@dest.rm
exit
invalid_combination_of_operands:
err 'invalid combination of operands'
end calminstruction
calminstruction MMX.bit_shift_instruction ext,dest,src
call x86.require.MMX
call SSE.parse_operand@dest, dest
call SSE.parse_operand@src, src
check @dest.type = 'mmreg' & (@src.type = 'mem' | @src.type = 'mmreg')
jyes mmreg_rm
check @dest.type = 'mmreg' & @src.type = 'imm'
jyes mmreg_imm
err 'invalid combination of operands'
exit
mmreg_rm:
check @src.size and not @dest.size
jno mmreg_rm_ok
err 'operand sizes do not match'
mmreg_rm_ok:
call MMX.select_operand_prefix@src, @dest.size
xcall x86.store_instruction@src, <0Fh,ext>,@dest.rm
exit
mmreg_imm:
check @src.size and not 1
jno rm_mmreg_ok
err 'invalid operand size'
rm_mmreg_ok:
local iext, irm
compute iext, 70h+(ext and 0Fh)
compute irm, ((ext shr 4)-0Ch) shl 1
call MMX.select_operand_prefix@dest, @dest.size
xcall x86.store_instruction@dest, <0Fh,iext>,irm,byte,@src.imm
end calminstruction
iterate <instr,opcode>, punpcklbw,60h, punpcklwd,61h, punpckldq,62h, packsswb,63h, pcmpgtb,64h, pcmpgtw,65h, pcmpgtd,66h, packuswb,67h, punpckhbw,68h, \
punpckhwd,69h, punpckhdq,6Ah, packssdw,6Bh, pcmpeqb,74h, pcmpeqw,75h, pcmpeqd,76h, pmullw,0D5h, psubusb,0D8h, psubusw,0D9h, \
pand,0DBh, paddusb,0DCh, paddusw,0DDh, pandn,0DFh, pmulhw,0E5h, psubsb,0E8h, psubsw,0E9h, por,0EBh, paddsb,0ECh, paddsw,0EDh, \
pxor,0EFh, pmaddwd,0F5h, psubb,0F8h, psubw,0F9h, psubd,0FAh, paddb,0FCh, paddw,0FDh, paddd,0FEh
macro instr? dest*,src*
MMX.basic_instruction opcode,dest,src
end macro
end iterate
calminstruction movq? dest*,src*
call x86.require.MMX
call MMX.parse_operand@dest, dest
call MMX.parse_operand@src, src
check (@src.size or @dest.size) and not 8
jno size_ok
err 'invalid operand size'
size_ok:
check @dest.type = 'mmreg' & (@src.type = 'mem' | @src.type = 'mmreg')
jyes mmreg_mem
check @dest.type = 'mem' & @src.type = 'mmreg'
jyes mem_mmreg
err 'invalid combination of operands'
exit
mmreg_mem:
xcall x86.store_instruction@src, <0Fh,6Fh>,@dest.rm
exit
mem_mmreg:
xcall x86.store_instruction@dest, <0Fh,7Fh>,@src.rm
exit
end calminstruction
calminstruction movd? dest*,src*
call x86.require.MMX
call MMX.parse_operand@dest, dest
call MMX.parse_operand@src, src
check @dest.type = 'mmreg' & (@src.type = 'mem' | @src.type = 'reg')
jyes mmreg_rm
check (@dest.type = 'mem' | @dest.type = 'reg') & @src.type = 'mmreg'
jyes rm_mmreg
err 'invalid combination of operands'
exit
mmreg_rm:
check @src.size and not 4
jno mmreg_rm_ok
err 'invalid operand size'
mmreg_rm_ok:
xcall x86.store_instruction@src, <0Fh,6Eh>,@dest.rm
exit
rm_mmreg:
check @dest.size and not 4
jno rm_mmreg_ok
err 'invalid operand size'
rm_mmreg_ok:
xcall x86.store_instruction@dest, <0Fh,7Eh>,@src.rm
end calminstruction
iterate <instr,opcode>, psrlw,0D1h, psrld,0D2h, psrlq,0D3h, psrad,0E2h, psraw,0E1h, psllw,0F1h, pslld,0F2h, psllq,0F3h
macro instr? dest*,src*
MMX.bit_shift_instruction opcode,dest,src
end macro
end iterate
calminstruction emms?
call x86.require.MMX
emit 1, 0Fh
emit 1, 77h
end calminstruction

View File

@ -0,0 +1,194 @@
element MPX.bnd
repeat 4, i:0
element bnd#i? : MPX.bnd + i
end repeat
macro MPX.parse_operand ns,op
x86.parse_operand#ns op
if ns.type = 'imm' & ns.size = 0 & ns.imm eq 1 elementof ns.imm & 1 metadataof ns.imm relativeto MPX.bnd
ns.type = 'bnd'
ns.mod = 11b
ns.rm = 1 metadataof ns.imm - MPX.bnd
ns.size = 0
end if
end macro
macro MPX.parse_sib_operand ns,op&
match [b=,si], op
ns.split = 1
ns.segment_prefix = 0
ns.prefix = 0
ns.opcode_prefix = 0
ns.rex_prefix = 0
ns.size = 0
ns.type = 'mem'
ns.base_part = +b
ns.index_part = +si
if x86.mode = 64
ns.mode = 64
ns.address_registers_type = x86.r64
else
ns.mode = 32
ns.address_registers_type = x86.r32
end if
ns.base_registers = 0
ns.index_registers = 0
repeat elementsof ns.base_part
if % metadataof ns.base_part relativeto x86.r16 | % metadataof ns.base_part relativeto x86.r32 | % metadataof ns.base_part relativeto x86.r64 | % metadataof ns.address relativeto x86.ip
ns.base_registers = ns.base_registers + % elementof ns.base_part * % scaleof ns.base_part
end if
end repeat
repeat elementsof ns.index_part
if % metadataof ns.index_part relativeto x86.r16 | % metadataof ns.index_part relativeto x86.r32 | % metadataof ns.index_part relativeto x86.r64 | % metadataof ns.address relativeto x86.ip
ns.index_registers = ns.index_registers + % elementof ns.index_part * % scaleof ns.index_part
end if
end repeat
ns.displacement = ns.base_part - ns.base_registers + ns.index_part - ns.index_registers
if ns.index_registers eq 0
ns.index = 4
ns.scale = 1
else if elementsof ns.index_registers = 1 & 1 metadataof ns.index_registers relativeto ns.address_registers_type & 1 metadataof ns.index_registers - ns.address_registers_type <> 4
ns.index = 1 metadataof ns.index_registers - ns.address_registers_type
ns.scale = 1 scaleof ns.index_registers
else
err 'invalid address'
end if
if ns.base_registers eq 0
ns.rm = 4
ns.base = 5
ns.index_only = 1
else if ns.base_registers eq 1 elementof ns.base_registers & 1 metadataof ns.base_registers relativeto ns.address_registers_type
ns.base = 1 metadataof ns.base_registers - ns.address_registers_type
if ns.index = 4 & ns.base <> 4
ns.rm = ns.base
else
ns.rm = 4
end if
ns.index_only = 0
else
err 'invalid address'
end if
ns.auto_relative = 0
ns.displacement_size = 4
ns.mod = 2
if ns.index_only
ns.mod = 0
else if ns.displacement relativeto 0
if ns.displacement = 0 & ns.rm and 111b <> 5 & (ns.rm <> 4 | ns.base and 111b <> 5)
ns.displacement_size = 0
ns.mod = 0
else if ns.displacement < 80h & ns.displacement >= -80h
ns.displacement_size = 1
ns.mod = 1
else if ns.displacement - 1 shl ns.mode >= -80h & ns.displacement < 1 shl ns.mode
ns.displacement = ns.displacement - 1 shl ns.mode
ns.displacement_size = 1
ns.mod = 1
end if
end if
else
ns.split = 0
x86.parse_operand#ns op
end match
end macro
macro bndmk? dest*,src*&
require MPX
MPX.parse_operand @dest,dest
MPX.parse_sib_operand @src,src
if @dest.type = 'bnd' & @src.type = 'mem'
if @src.split & ~ 0 scaleof @src.base_part eq 0
err 'invalid base address'
end if
if (x86.mode = 64 & @src.size and not 8) | (x86.mode < 64 & @src.size and not 4)
err 'invalid operand size'
end if
@src.opcode_prefix = 0F3h
x86.store_instruction@src <0Fh,1Bh>,@dest.rm
else
err 'invalid combination of operands'
end if
end macro
macro bndmov? dest*,src*
require MPX
MPX.parse_operand @dest,dest
MPX.parse_operand @src,src
if @dest.type = 'bnd' & (@src.type = 'bnd' | @src.type = 'mem')
if (x86.mode = 64 & @src.size and not 16) | (x86.mode < 64 & @src.size and not 8)
err 'invalid operand size'
end if
if @src.type = 'mem' & @src.mode <> x86.mode
err 'invalid address'
end if
@src.opcode_prefix = 66h
x86.store_instruction@src <0Fh,1Ah>,@dest.rm
else if @dest.type = 'mem' & @src.type = 'bnd'
if (x86.mode = 64 & @dest.size and not 16) | (x86.mode < 64 & @dest.size and not 8)
err 'invalid operand size'
end if
if @dest.type = 'mem' & @dest.mode <> x86.mode
err 'invalid address'
end if
@dest.opcode_prefix = 66h
x86.store_instruction@dest <0Fh,1Bh>,@src.rm
else
err 'invalid combination of operands'
end if
end macro
iterate <instr,prefix,ext>, bndcl,0F3h,1Ah, bndcu,0F2h,1Ah, bndcn,0F2h,1Bh
macro instr? dest*,src*
require MPX
MPX.parse_operand @dest,dest
x86.parse_operand @src,src
if @dest.type = 'bnd' & (@src.type = 'reg' | @src.type = 'mem')
if (x86.mode = 64 & @src.size and not 8) | (x86.mode < 64 & @src.size and not 4)
err 'invalid operand size'
end if
if @src.type = 'mem' & @src.mode <> x86.mode
err 'invalid address'
end if
@src.opcode_prefix = prefix
x86.store_instruction@src <0Fh,ext>,@dest.rm
else
err 'invalid operand'
end if
end macro
end iterate
macro bndldx? dest*,src*&
require MPX
MPX.parse_operand @dest,dest
MPX.parse_sib_operand @src,src
if @dest.type = 'bnd' & @src.type = 'mem'
if @src.scale > 1 | ( @src.split & ~ 0 scaleof @src.index_part eq 0 )
err 'invalid index'
end if
x86.store_instruction@src <0Fh,1Ah>,@dest.rm
else
err 'invalid combination of operands'
end if
end macro
macro bndstx? operands*&
require MPX
match [dest] =, src, operands
MPX.parse_sib_operand @dest,[dest]
MPX.parse_operand @src,src
if @dest.type = 'mem' & @src.type = 'bnd'
if @dest.scale > 1 | ( @dest.split & ~ 0 scaleof @dest.index_part eq 0 )
err 'invalid index'
end if
x86.store_instruction@dest <0Fh,1Bh>,@src.rm
else
err 'invalid combination of operands'
end if
else
err 'invalid combination of operands'
end match
end macro

View File

@ -0,0 +1,24 @@
macro pclmulqdq? dest*,src*,imm*
require PCLMULQDQ
SSE.basic_instruction_imm8 66h,<3Ah,44h>,16,dest,src,imm
end macro
macro vpclmulqdq? dest*,src*,src2*,aux*
require VPCLMULQDQ
AVX_512.parse_operand@dest dest
AVX_512.parse_operand@src src
AVX_512.parse_operand@src2 src2
x86.parse_operand@aux aux
if @dest.type = 'mmreg' & @src.type = 'mmreg' & (@src2.type = 'mem' | @src2.type = 'mmreg') & @aux.type = 'imm'
if @aux.size and not 1
err 'invalid operand size'
else if @dest.size <> @src.size | @src2.size and not @dest.size
err 'operand sizes do not match'
end if
@src2.memsize = 0
AVX_512.store_instruction@src2 @dest.size,VEX_66_0F3A_W0,EVEX_AS_VEX+EVEX_VL,44h,@dest.mask,@dest.rm,@src.rm,1,@aux.imm
else
err 'invalid combination of operands'
end if
end macro

View File

@ -0,0 +1,444 @@
element SSE.reg
repeat 16, i:0
element xmm#i? : SSE.reg + i
end repeat
iterate context, @dest,@src,@src2,@aux
namespace context
calminstruction SSE.parse_operand#context operand
call x86.parse_operand#context, operand
check type = 'imm' & size = 0
jno done
check imm eq 1 elementof imm & 1 metadataof imm relativeto MMX.reg
jyes mm_register
check imm eq 1 elementof imm & 1 metadataof imm relativeto SSE.reg
jyes xmm_register
exit
mm_register:
compute rm, 1 metadataof imm - MMX.reg
compute size, 8
jump export_mmreg
xmm_register:
compute rm, 1 metadataof imm - SSE.reg
compute size, 16
export_mmreg:
compute type, 'mmreg'
compute mod, 11b
done:
end calminstruction
end namespace
end iterate
calminstruction SSE.basic_instruction pre,ext,msize,dest,src
call x86.require.SSE
call SSE.parse_operand@dest, dest
call SSE.parse_operand@src, src
check @dest.type = 'mmreg' & (@src.type = 'mem' | @src.type = 'mmreg')
jno invalid_combination_of_operands
check @dest.size <> 16 | (@src.type = 'mem' & @src.size and not msize) | (@src.type = 'mmreg' & @src.size <> 16)
jno size_ok
err 'invalid operand size'
size_ok:
compute @src.opcode_prefix, pre
xcall x86.store_instruction@src, <0Fh,ext>,@dest.rm
exit
invalid_combination_of_operands:
err 'invalid combination of operands'
end calminstruction
calminstruction SSE.basic_instruction_imm8 pre,ext,msize,dest,src,aux
call x86.require.SSE
call SSE.parse_operand@dest, dest
call SSE.parse_operand@src, src
call x86.parse_operand@aux, aux
check @dest.type = 'mmreg' & (@src.type = 'mem' | @src.type = 'mmreg') & @aux.type = 'imm'
jno invalid_combination_of_operands
check @dest.size <> 16 | (@src.type = 'mem' & @src.size and not msize) | (@src.type = 'mmreg' & @src.size <> 16) | @aux.size and not 1
jno size_ok
err 'invalid operand size'
size_ok:
compute @src.opcode_prefix, pre
xcall x86.store_instruction@src, <0Fh,ext>,@dest.rm,byte,@aux.imm
exit
invalid_combination_of_operands:
err 'invalid combination of operands'
end calminstruction
iterate <instr,ext>, sqrt,51h, rsqrt,52h, rcp,53h, add,58h, mul,59h, sub,5Ch, min,5Dh, div,5Eh, max,5Fh
macro instr#ps? dest*,src*
SSE.basic_instruction 0,ext,16,dest,src
end macro
macro instr#ss? dest*,src*
SSE.basic_instruction 0F3h,ext,4,dest,src
end macro
end iterate
iterate <instr,ext>, and,54h, andn,55h, or,56h, xor,57h, unpckl,14h, unpckh,15h
macro instr#ps? dest*,src*
SSE.basic_instruction 0,ext,16,dest,src
end macro
end iterate
macro cmpps? dest*,src*,code*
SSE.basic_instruction_imm8 0,0C2h,16,dest,src,code
end macro
macro cmpss? dest*,src*,code*
SSE.basic_instruction_imm8 0F3h,0C2h,4,dest,src,code
end macro
iterate <cond,code>, eq,0, lt,1, le,2, unord,3, neq,4, nlt,5, nle,6, ord,7
macro cmp#cond#ps? dest*,src*
cmpps dest,src,code
end macro
macro cmp#cond#ss? dest*,src*
cmpss dest,src,code
end macro
end iterate
macro shufps? dest*,src*,imm*
SSE.basic_instruction_imm8 0,0C6h,16,dest,src,imm
end macro
iterate <instr,ext>, movaps,28h, movups,10h
macro instr? dest*,src*
require SSE+
SSE.parse_operand@dest dest
SSE.parse_operand@src src
if (@dest.size or @src.size) and not 16
err 'invalid operand size'
end if
if @dest.type = 'mmreg' & (@src.type = 'mem' | @src.type = 'mmreg')
x86.store_instruction@src <0Fh,ext>,@dest.rm
else if @dest.type = 'mem' & @src.type = 'mmreg'
x86.store_instruction@dest <0Fh,ext+1>,@src.rm
else
err 'invalid combination of operands'
end if
end macro
end iterate
iterate <instr,ext>, movlps,12h, movhps,16h
macro instr? dest*,src*
require SSE+
SSE.parse_operand@dest dest
SSE.parse_operand@src src
if @dest.type = 'mmreg' & @src.type = 'mem'
if @dest.size <> 16 | @src.size and not 8
err 'invalid operand size'
end if
x86.store_instruction@src <0Fh,ext>,@dest.rm
else if @dest.type = 'mem' & @src.type = 'mmreg'
if @dest.size and not 8 | @src.size <> 16
err 'invalid operand size'
end if
x86.store_instruction@dest <0Fh,ext+1>,@src.rm
else
err 'invalid combination of operands'
end if
end macro
end iterate
iterate <instr,ext>, movhlps,12h, movlhps,16h
macro instr? dest*,src*
require SSE+
SSE.parse_operand@dest dest
SSE.parse_operand@src src
if (@dest.size or @src.size) and not 16
err 'invalid operand size'
end if
if @dest.type = 'mmreg' & @src.type = 'mmreg'
x86.store_instruction@src <0Fh,ext>,@dest.rm
else
err 'invalid combination of operands'
end if
end macro
end iterate
macro movss? dest*,src*
require SSE+
SSE.parse_operand@dest dest
SSE.parse_operand@src src
if @dest.type = 'mmreg' & (@src.type = 'mem' | @src.type = 'mmreg')
if @dest.size <> 16 | (@src.type = 'mem' & @src.size and not 4) | (@src.type = 'mmreg' & @src.size <> 16)
err 'invalid operand size'
end if
@src.opcode_prefix = 0F3h
x86.store_instruction@src <0Fh,10h>,@dest.rm
else if @dest.type = 'mem' & @src.type = 'mmreg'
if @dest.size and not 4 | @src.size <> 16
err 'invalid operand size'
end if
@dest.opcode_prefix = 0F3h
x86.store_instruction@dest <0Fh,11h>,@src.rm
else
err 'invalid combination of operands'
end if
end macro
macro movntps? dest*,src*
require SSE+
SSE.parse_operand@dest dest
SSE.parse_operand@src src
if @dest.type = 'mem' & @src.type = 'mmreg'
if (@dest.size or @src.size) and not 16
err 'invalid operand size'
end if
x86.store_instruction@dest <0Fh,2Bh>,@src.rm
else
err 'invalid combination of operands'
end if
end macro
macro movmskps? dest*,src*
require SSE+
x86.parse_operand@dest dest
SSE.parse_operand@src src
if @dest.type = 'reg' & @src.type = 'mmreg'
if (@dest.size <> 4 & (x86.mode < 64 | @dest.size <> 8)) | @src.size <> 16
err 'invalid operand size'
end if
x86.store_instruction@src <0Fh,50h>,@dest.rm
else
err 'invalid combination of operands'
end if
end macro
iterate <instr,ext>, ucomiss,2Eh, comiss,2Fh
macro instr? dest*,src*
require SSE+
SSE.parse_operand@dest dest
SSE.parse_operand@src src
if @dest.type = 'mmreg' & (@src.type = 'mem' | @src.type = 'mmreg')
if @dest.size <> 16 | (@src.type = 'mem' & @src.size and not 4) | (@src.type = 'mmreg' & @src.size <> 16)
err 'invalid operand size'
end if
x86.store_instruction@src <0Fh,ext>,@dest.rm
else
err 'invalid combination of operands'
end if
end macro
end iterate
macro cvtpi2ps? dest*,src*
require SSE+
SSE.parse_operand@dest dest
SSE.parse_operand@src src
if @dest.type = 'mmreg' & (@src.type = 'mem' | @src.type = 'mmreg')
if @dest.size <> 16 | @src.size and not 8
err 'invalid operand size'
end if
x86.store_instruction@src <0Fh,2Ah>,@dest.rm
else
err 'invalid combination of operands'
end if
end macro
macro cvtsi2ss? dest*,src*
require SSE+
SSE.parse_operand@dest dest
x86.parse_operand@src src
if @dest.type = 'mmreg' & (@src.type = 'mem' | @src.type = 'reg')
if @src.size = 0
err 'operand size not specified'
else if @dest.size <> 16 | @src.size < 4
err 'invalid operand size'
end if
x86.select_operand_prefix@src @src.size
@src.opcode_prefix = 0F3h
x86.store_instruction@src <0Fh,2Ah>,@dest.rm
else
err 'invalid combination of operands'
end if
end macro
iterate <instr,ext>, cvttps2pi,2Ch, cvtps2pi,2Dh
macro instr? dest*,src*
require SSE+
SSE.parse_operand@dest dest
SSE.parse_operand@src src
if @dest.type = 'mmreg' & (@src.type = 'mem' | @src.type = 'mmreg')
if @dest.size <> 8 | (@src.size = 'mem' & @src.size and not 8) | (@src.size = 'mmreg' & @src.size <> 16)
err 'invalid operand size'
end if
x86.store_instruction@src <0Fh,ext>,@dest.rm
else
err 'invalid combination of operands'
end if
end macro
end iterate
iterate <instr,ext>, cvttss2si,2Ch, cvtss2si,2Dh
macro instr? dest*,src*
require SSE+
SSE.parse_operand@dest dest
SSE.parse_operand@src src
if @dest.type = 'reg' & (@src.type = 'mem' | @src.type = 'mmreg')
if @dest.size < 4 | (@src.size = 'mem' & @src.size and not 4) | (@src.size = 'mmreg' & @src.size <> 16)
err 'invalid operand size'
end if
x86.select_operand_prefix@src @dest.size
@src.opcode_prefix = 0F3h
x86.store_instruction@src <0Fh,ext>,@dest.rm
else
err 'invalid combination of operands'
end if
end macro
end iterate
iterate <instr,ext>, pminub,0DAh, pmaxub,0DEh, pavgb,0E0h, pavgw,0E3h, pmulhuw,0E4h, pminsw,0EAh, pmaxsw,0EEh, psadbw,0F6h
macro instr? dest*,src*
require SSE+
MMX.basic_instruction ext,dest,src
end macro
end iterate
macro pinsrw? dest*,src*,sel*
require SSE+
MMX.parse_operand@dest dest
x86.parse_operand@src src
x86.parse_operand@aux sel
if @dest.type = 'mmreg' & (@src.type = 'reg' | @src.type = 'mem') & @aux.type = 'imm'
if (@src.type = 'reg' & @src.size <> 4) | (@src.type = 'mem' & @src.size and not 2) | @aux.size and not 1
err 'invalid operand size'
end if
x86.store_instruction@src <0Fh,0C4h>,@dest.rm,1,@aux.imm
else
err 'invalid combination of operands'
end if
end macro
macro pextrw? dest*,src*,sel*
require SSE+
x86.parse_operand@dest dest
MMX.parse_operand@src src
x86.parse_operand@aux sel
if @dest.type = 'reg' & @src.type = 'mmreg' & @aux.type = 'imm'
if @dest.size <> 4 | @aux.size and not 1
err 'invalid operand size'
end if
x86.store_instruction@src <0Fh,0C5h>,@dest.rm,1,@aux.imm
else
err 'invalid combination of operands'
end if
end macro
macro pshufw? dest*,src*,sel*
require SSE+
MMX.parse_operand@dest dest
MMX.parse_operand@src src
x86.parse_operand@aux sel
if @dest.type = 'mmreg' & (@src.type = 'mem' | @src.type = 'mmreg') & @aux.type = 'imm'
if @src.size and not 8 | @aux.size and not 1
err 'invalid operand size'
end if
x86.store_instruction@src <0Fh,70h>,@dest.rm,1,@aux.imm
else
err 'invalid combination of operands'
end if
end macro
macro pmovmskb? dest*,src*
require SSE+
x86.parse_operand@dest dest
MMX.parse_operand@src src
if @dest.type = 'reg' & @src.type = 'mmreg'
if @dest.size <> 4
err 'invalid operand size'
end if
x86.store_instruction@src <0Fh,0D7h>,@dest.rm
else
err 'invalid combination of operands'
end if
end macro
macro movntq? dest*,src*
require SSE+
MMX.parse_operand@dest dest
MMX.parse_operand@src src
if @dest.type = 'mem' & @src.type = 'mmreg'
if @dest.size and not 8
err 'invalid operand size'
end if
x86.store_instruction@dest <0Fh,0E7h>,@src.rm
else
err 'invalid combination of operands'
end if
end macro
macro maskmovq? src*,sel*
require SSE+
MMX.parse_operand@src src
MMX.parse_operand@aux sel
if @src.type = 'mmreg' & @aux.type = 'mmreg'
x86.store_instruction@aux <0Fh,0F7h>,@src.rm
else
err 'invalid combination of operands'
end if
end macro
iterate <instr,postbyte>, prefetchnta,0, prefetcht0,1, prefetcht1,2, prefetcht2,3
macro instr? src*
require SSE+
x86.parse_operand@src src
if @src.type = 'mem'
if @src.size and not 1
err 'invalid operand size'
end if
x86.store_instruction@src <0Fh,18h>,postbyte
else
err 'invalid operand'
end if
end macro
end iterate
macro sfence?
db 0Fh,0AEh,0F8h
end macro
iterate <instr,postbyte>, fxsave,0, fxrstor,1
macro instr? src*
require SSE+
x86.parse_operand@src src
if @src.type = 'mem'
if @src.size and not 512
err 'invalid operand size'
end if
x86.store_instruction@src <0Fh,0AEh>,postbyte
else
err 'invalid operand'
end if
end macro
end iterate
iterate <instr,postbyte>, ldmxcsr,2, stmxcsr,3
macro instr? src*
require SSE+
x86.parse_operand@src src
if @src.type = 'mem'
if @src.size and not 4
err 'invalid operand size'
end if
x86.store_instruction@src <0Fh,0AEh>,postbyte
else
err 'invalid operand'
end if
end macro
end iterate

View File

@ -0,0 +1,579 @@
iterate <instr,ext>, sqrt,51h, rsqrt,52h, rcp,53h, add,58h, mul,59h, sub,5Ch, min,5Dh, div,5Eh, max,5Fh
macro instr#pd? dest*,src*
require SSE2+
SSE.basic_instruction 66h,ext,16,dest,src
end macro
macro instr#sd? dest*,src*
require SSE2+
SSE.basic_instruction 0F2h,ext,8,dest,src
end macro
end iterate
iterate <instr,ext>, and,54h, andn,55h, or,56h, xor,57h, unpckl,14h, unpckh,15h
macro instr#pd? dest*,src*
require SSE2+
SSE.basic_instruction 66h,ext,16,dest,src
end macro
end iterate
macro cmppd? dest*,src*,code*
require SSE2+
SSE.basic_instruction_imm8 66h,0C2h,16,dest,src,code
end macro
macro SSE.cmpsd? dest*,src*,code*
require SSE2+
SSE.basic_instruction_imm8 0F2h,0C2h,8,dest,src,code
end macro
calminstruction cmpsd? args&
match , args
jno sse
xcall x86.store_operand_prefix, (4)
emit 1, 0A7h
exit
sse:
arrange args, =SSE.=cmpsd args
assemble args
end calminstruction
iterate <cond,code>, eq,0, lt,1, le,2, unord,3, neq,4, nlt,5, nle,6, ord,7
macro cmp#cond#pd? dest*,src*
require SSE2+
cmppd dest,src,code
end macro
macro cmp#cond#sd? dest*,src*
require SSE2+
cmpsd dest,src,code
end macro
end iterate
macro shufpd? dest*,src*,imm*
require SSE2+
SSE.basic_instruction_imm8 66h,0C6h,16,dest,src,imm
end macro
iterate <instr,ext>, movapd,28h, movupd,10h
macro instr? dest*,src*
require SSE2+
SSE.parse_operand@dest dest
SSE.parse_operand@src src
if (@dest.size or @src.size) and not 16
err 'invalid operand size'
end if
if @dest.type = 'mmreg' & (@src.type = 'mem' | @src.type = 'mmreg')
@src.opcode_prefix = 66h
x86.store_instruction@src <0Fh,ext>,@dest.rm
else if @dest.type = 'mem' & @src.type = 'mmreg'
@dest.opcode_prefix = 66h
x86.store_instruction@dest <0Fh,ext+1>,@src.rm
else
err 'invalid combination of operands'
end if
end macro
end iterate
iterate <instr,ext>, movlpd,12h, movhpd,16h
macro instr? dest*,src*
require SSE2+
SSE.parse_operand@dest dest
SSE.parse_operand@src src
if @dest.type = 'mmreg' & @src.type = 'mem'
if @dest.size <> 16 | @src.size and not 8
err 'invalid operand size'
end if
@src.opcode_prefix = 66h
x86.store_instruction@src <0Fh,ext>,@dest.rm
else if @dest.type = 'mem' & @src.type = 'mmreg'
if @dest.size and not 8 | @src.size <> 16
err 'invalid operand size'
end if
@dest.opcode_prefix = 66h
x86.store_instruction@dest <0Fh,ext+1>,@src.rm
else
err 'invalid combination of operands'
end if
end macro
end iterate
macro SSE.movsd? dest*,src*
require SSE2+
SSE.parse_operand@dest dest
SSE.parse_operand@src src
if @dest.type = 'mmreg' & (@src.type = 'mem' | @src.type = 'mmreg')
if @dest.size <> 16 | (@src.type = 'mem' & @src.size and not 8) | (@src.type = 'mmreg' & @src.size <> 16)
err 'invalid operand size'
end if
@src.opcode_prefix = 0F2h
x86.store_instruction@src <0Fh,10h>,@dest.rm
else if @dest.type = 'mem' & @src.type = 'mmreg'
if @dest.size and not 8 | @src.size <> 16
err 'invalid operand size'
end if
@dest.opcode_prefix = 0F2h
x86.store_instruction@dest <0Fh,11h>,@src.rm
else
err 'invalid combination of operands'
end if
end macro
calminstruction movsd? args&
match , args
jno sse
xcall x86.store_operand_prefix, (4)
emit 1, 0A5h
exit
sse:
arrange args, =SSE.=movsd args
assemble args
end calminstruction
iterate <instr,pre>, movdqa,66h, movdqu,0F3h
macro instr? dest*,src*
require SSE2+
SSE.parse_operand@dest dest
SSE.parse_operand@src src
if (@dest.size or @src.size) and not 16
err 'invalid operand size'
end if
if @dest.type = 'mmreg' & (@src.type = 'mem' | @src.type = 'mmreg')
@src.opcode_prefix = pre
x86.store_instruction@src <0Fh,6Fh>,@dest.rm
else if @dest.type = 'mem' & @src.type = 'mmreg'
@dest.opcode_prefix = pre
x86.store_instruction@dest <0Fh,7Fh>,@src.rm
else
err 'invalid combination of operands'
end if
end macro
end iterate
iterate <instr,ext>, movntpd,2Bh, movntdq,0E7h
macro instr? dest*,src*
require SSE2+
SSE.parse_operand@dest dest
SSE.parse_operand@src src
if @dest.type = 'mem' & @src.type = 'mmreg'
if (@dest.size or @src.size) and not 16
err 'invalid operand size'
end if
@dest.opcode_prefix = 66h
x86.store_instruction@dest <0Fh,ext>,@src.rm
else
err 'invalid combination of operands'
end if
end macro
end iterate
macro movmskpd? dest*,src*
require SSE2+
SSE.parse_operand@dest dest
SSE.parse_operand@src src
if @dest.type = 'reg' & @src.type = 'mmreg'
if (@dest.size <> 4 & (x86.mode < 64 | @dest.size <> 8)) | @src.size <> 16
err 'invalid operand size'
end if
@src.opcode_prefix = 66h
x86.store_instruction@src <0Fh,50h>,@dest.rm
else
err 'invalid combination of operands'
end if
end macro
macro maskmovdqu? dest*,src*
require SSE2+
SSE.parse_operand@dest dest
SSE.parse_operand@src src
if @dest.type = 'mmreg' & @src.type = 'mmreg'
if (@dest.size or @src.size) <> 16
err 'invalid operand size'
end if
@src.opcode_prefix = 66h
x86.store_instruction@src <0Fh,0F7h>,@dest.rm
else
err 'invalid combination of operands'
end if
end macro
iterate <instr,ext>, ucomisd,2Eh, comisd,2Fh
macro instr? dest*,src*
require SSE2+
SSE.parse_operand@dest dest
SSE.parse_operand@src src
if @dest.type = 'mmreg' & (@src.type = 'mem' | @src.type = 'mmreg')
if @dest.size <> 16 | (@src.type = 'mem' & @src.size and not 8) | (@src.type = 'mmreg' & @src.size <> 16)
err 'invalid operand size'
end if
@src.opcode_prefix = 66h
x86.store_instruction@src <0Fh,ext>,@dest.rm
else
err 'invalid combination of operands'
end if
end macro
end iterate
macro cvtps2pd? dest*,src*
require SSE2+
SSE.basic_instruction 0,5Ah,8,dest,src
end macro
macro cvtpd2ps? dest*,src*
require SSE2+
SSE.basic_instruction 66h,5Ah,16,dest,src
end macro
macro cvtsd2ss? dest*,src*
require SSE2+
SSE.basic_instruction 0F2h,5Ah,8,dest,src
end macro
macro cvtss2sd? dest*,src*
require SSE2+
SSE.basic_instruction 0F3h,5Ah,4,dest,src
end macro
macro cvtdq2ps? dest*,src*
require SSE2+
SSE.basic_instruction 0,5Bh,16,dest,src
end macro
macro cvtps2dq? dest*,src*
require SSE2+
SSE.basic_instruction 66h,5Bh,16,dest,src
end macro
macro cvttps2dq? dest*,src*
require SSE2+
SSE.basic_instruction 0F3h,5Bh,16,dest,src
end macro
macro cvttpd2dq? dest*,src*
require SSE2+
SSE.basic_instruction 66h,0E6h,16,dest,src
end macro
macro cvtpd2dq? dest*,src*
require SSE2+
SSE.basic_instruction 0F2h,0E6h,16,dest,src
end macro
macro cvtdq2pd? dest*,src*
require SSE2+
SSE.basic_instruction 0F3h,0E6h,8,dest,src
end macro
macro movdq2q? dest*,src*
require SSE2+
SSE.parse_operand@dest dest
SSE.parse_operand@src src
if @dest.type = 'mmreg' & @src.type = 'mmreg'
if @dest.size <> 8 | @src.size <> 16
err 'invalid operand size'
end if
@src.opcode_prefix = 0F2h
x86.store_instruction@src <0Fh,0D6h>,@dest.rm
else
err 'invalid combination of operands'
end if
end macro
macro movq2dq? dest*,src*
require SSE2+
SSE.parse_operand@dest dest
SSE.parse_operand@src src
if @dest.type = 'mmreg' & @src.type = 'mmreg'
if @dest.size <> 16 | @src.size <> 8
err 'invalid operand size'
end if
@src.opcode_prefix = 0F3h
x86.store_instruction@src <0Fh,0D6h>,@dest.rm
else
err 'invalid combination of operands'
end if
end macro
macro cvtpi2pd? dest*,src*
require SSE2+
SSE.parse_operand@dest dest
SSE.parse_operand@src src
if @dest.type = 'mmreg' & (@src.type = 'mem' | @src.type = 'mmreg')
if @dest.size <> 16 | @src.size and not 8
err 'invalid operand size'
end if
@src.opcode_prefix = 66h
x86.store_instruction@src <0Fh,2Ah>,@dest.rm
else
err 'invalid combination of operands'
end if
end macro
macro cvtsi2sd? dest*,src*
require SSE2+
SSE.parse_operand@dest dest
x86.parse_operand@src src
if @dest.type = 'mmreg' & (@src.type = 'mem' | @src.type = 'reg')
if @src.size = 0
err 'operand size not specified'
else if @dest.size <> 16 | @src.size < 4
err 'invalid operand size'
end if
x86.select_operand_prefix@src @src.size
@src.opcode_prefix = 0F2h
x86.store_instruction@src <0Fh,2Ah>,@dest.rm
else
err 'invalid combination of operands'
end if
end macro
iterate <instr,ext>, cvttpd2pi,2Ch, cvtpd2pi,2Dh
macro instr? dest*,src*
require SSE2+
SSE.parse_operand@dest dest
SSE.parse_operand@src src
if @dest.type = 'mmreg' & (@src.type = 'mem' | @src.type = 'mmreg')
if @dest.size <> 8 | @src.size and not 16
err 'invalid operand size'
end if
@src.opcode_prefix = 66h
x86.store_instruction@src <0Fh,ext>,@dest.rm
else
err 'invalid combination of operands'
end if
end macro
end iterate
iterate <instr,ext>, cvttsd2si,2Ch, cvtsd2si,2Dh
macro instr? dest*,src*
require SSE2+
x86.parse_operand@dest dest
SSE.parse_operand@src src
if @dest.type = 'reg' & (@src.type = 'mem' | @src.type = 'mmreg')
if @dest.size < 4 | (@src.type = 'mem' & @src.size and not 8) | (@src.type = 'mmreg' & @src.size <>16)
err 'invalid operand size'
end if
x86.select_operand_prefix@src @dest.size
@src.opcode_prefix = 0F2h
x86.store_instruction@src <0Fh,ext>,@dest.rm
else
err 'invalid combination of operands'
end if
end macro
end iterate
iterate <instr,ext>, paddq,0D4h, pmuludq,0F4h, psubq,0FBh
macro instr? dest*,src*
require SSE2+
MMX.basic_instruction ext,dest,src
end macro
end iterate
macro movq? dest*,src*
require SSE2+
SSE.parse_operand@dest dest
SSE.parse_operand@src src
if @dest.type = 'mmreg' & (@src.type = 'mem' | @src.type = 'mmreg')
if (@src.type = 'mem' & @src.size and not 8) | (@src.type = 'mmreg' & @src.size <> @dest.size)
err 'invalid operand size'
end if
if @dest.size = 8
x86.store_instruction@src <0Fh,6Fh>,@dest.rm
else
@src.opcode_prefix = 0F3h
x86.store_instruction@src <0Fh,7Eh>,@dest.rm
end if
else if @dest.type = 'mem' & @src.type = 'mmreg'
if @dest.size and not 8
err 'invalid operand size'
end if
if @src.size = 8
x86.store_instruction@dest <0Fh,7Fh>,@src.rm
else
@dest.opcode_prefix = 66h
x86.store_instruction@dest <0Fh,0D6h>,@src.rm
end if
else if @dest.type = 'reg' & @src.type = 'mmreg'
if @dest.size <> 8
err 'invalid operand size'
end if
if @src.size = 16
@dest.opcode_prefix = 66h
end if
@dest.prefix = 48h
x86.store_instruction@dest <0Fh,7Eh>,@src.rm
else if @dest.type = 'mmreg' & @src.type = 'reg'
if @src.size <> 8
err 'invalid operand size'
end if
if @dest.size = 16
@src.opcode_prefix = 66h
end if
@src.prefix = 48h
x86.store_instruction@src <0Fh,6Eh>,@dest.rm
else
err 'invalid combination of operands'
end if
end macro
macro movd? dest*,src*
require SSE2+
SSE.parse_operand@dest dest
SSE.parse_operand@src src
if @dest.type = 'mmreg' & (@src.type = 'mem' | @src.type = 'reg')
if @src.size and not 4
err 'invalid operand size'
end if
MMX.select_operand_prefix@src @dest.size
x86.store_instruction@src <0Fh,6Eh>,@dest.rm
else if (@dest.type = 'mem' | @dest.type = 'reg') & @src.type = 'mmreg'
if @dest.size and not 4
err 'invalid operand size'
end if
MMX.select_operand_prefix@dest @src.size
x86.store_instruction@dest <0Fh,7Eh>,@src.rm
else
err 'invalid combination of operands'
end if
end macro
macro pinsrw? dest*,src*,sel*
require SSE2+
SSE.parse_operand@dest dest
x86.parse_operand@src src
x86.parse_operand@aux sel
if @dest.type = 'mmreg' & (@src.type = 'reg' | @src.type = 'mem') & @aux.type = 'imm'
if (@src.type = 'reg' & @src.size <> 4) | (@src.type = 'mem' & @src.size and not 2) | @aux.size and not 1
err 'invalid operand size'
end if
MMX.select_operand_prefix@src @dest.size
x86.store_instruction@src <0Fh,0C4h>,@dest.rm,1,@aux.imm
else
err 'invalid combination of operands'
end if
end macro
macro pextrw? dest*,src*,sel*
require SSE2+
x86.parse_operand@dest dest
SSE.parse_operand@src src
x86.parse_operand@aux sel
if @dest.type = 'reg' & @src.type = 'mmreg' & @aux.type = 'imm'
if x86.mode = 64 & @dest.size = 8
@dest.size = 4
end if
if @dest.size <> 4 | @aux.size and not 1
err 'invalid operand size'
end if
MMX.select_operand_prefix@src @src.size
x86.store_instruction@src <0Fh,0C5h>,@dest.rm,1,@aux.imm
else
err 'invalid combination of operands'
end if
end macro
iterate <instr,pre>, pshufd,66h, pshuflw,0F2h, pshufhw,0F3h
macro instr? dest*,src*,sel*
require SSE2+
SSE.parse_operand@dest dest
SSE.parse_operand@src src
x86.parse_operand@aux sel
if @dest.type = 'mmreg' & (@src.type = 'mem' | @src.type = 'mmreg') & @aux.type = 'imm'
if @dest.size <> 16 | @src.size and not 16 | @aux.size and not 1
err 'invalid operand size'
end if
@src.opcode_prefix = pre
x86.store_instruction@src <0Fh,70h>,@dest.rm,1,@aux.imm
else
err 'invalid combination of operands'
end if
end macro
end iterate
macro pmovmskb? dest*,src*
require SSE2+
x86.parse_operand@dest dest
SSE.parse_operand@src src
if @dest.type = 'reg' & @src.type = 'mmreg'
if @dest.size <> 4 & (x86.mode < 64 | @dest.size <> 8)
err 'invalid operand size'
end if
MMX.select_operand_prefix@src @src.size
x86.store_instruction@src <0Fh,0D7h>,@dest.rm
else
err 'invalid combination of operands'
end if
end macro
iterate <instr,postbyte>, psrldq,3, pslldq,7
macro instr? dest*,cnt*
require SSE2+
SSE.parse_operand@dest dest
x86.parse_operand@aux cnt
if @dest.type = 'mmreg' & @aux.type = 'imm'
if @dest.size <> 16 | @aux.size and not 1
err 'invalid operand size'
end if
@dest.opcode_prefix = 66h
x86.store_instruction@dest <0Fh,73h>,postbyte,1,@aux.imm
else
err 'invalid combination of operands'
end if
end macro
end iterate
iterate <instr,ext>, punpcklqdq,6Ch, punpckhqdq,6Dh
macro instr? dest*,src*
require SSE2+
SSE.parse_operand@dest dest
SSE.parse_operand@src src
if @dest.type = 'mmreg' & (@src.type = 'mem' | @src.type = 'mmreg')
if (@dest.size or @src.size) and not 16
err 'invalid operand size'
end if
@src.opcode_prefix = 66h
x86.store_instruction@src <0Fh,ext>,@dest.rm
else
err 'invalid combination of operands'
end if
end macro
end iterate
macro movnti? dest*,src*
require SSE2+
x86.parse_operand@dest dest
x86.parse_operand@src src
if @dest.type = 'mem' & @src.type = 'reg'
if @dest.size and not @src.size
err 'operand sizes do not match'
else if @src.size <> 4 & @src.size <> 8
err 'invalid operand size'
end if
x86.select_operand_prefix@dest @src.size
x86.store_instruction@dest <0Fh,0C3h>,@src.rm
else
err 'invalid combination of operands'
end if
end macro
macro clflush? src*
require SSE2+
x86.parse_operand@src src
if @src.type = 'mem'
if @src.size and not 1
err 'invalid operand size'
end if
x86.store_instruction@src <0Fh,0AEh>,7
else
err 'invalid operand'
end if
end macro
macro lfence?
require SSE2+
db 0Fh,0AEh,0E8h
end macro
macro mfence?
require SSE2+
db 0Fh,0AEh,0F0h
end macro

View File

@ -0,0 +1,84 @@
macro fisttp? src*
require SSE3+
x86.parse_operand@src src
if @src.type = 'mem'
if @src.size = 2
x86.store_instruction@src 0DFh,1
else if @src.size = 4
x86.store_instruction@src 0DBh,1
else if @src.size = 8
x86.store_instruction@src 0DDh,1
else if @src.size
err 'invalid operand size'
else
err 'operand size not specified'
end if
else
err 'invalid operand'
end if
end macro
iterate <instr,ext>, addsub,0D0h, hadd,7Ch, hsub,7Dh
macro instr#pd? dest*,src*
require SSE3+
SSE.basic_instruction 66h,ext,16,dest,src
end macro
macro instr#ps? dest*,src*
require SSE3+
SSE.basic_instruction 0F2h,ext,16,dest,src
end macro
end iterate
iterate <instr,ext>, movsldup,12h, movshdup,16h
macro instr? dest*,src*
require SSE3+
SSE.basic_instruction 0F3h,ext,16,dest,src
end macro
end iterate
macro movddup? dest*,src*
require SSE3+
SSE.basic_instruction 0F2h,12h,8,dest,src
end macro
macro lddqu? dest*,src*
require SSE3+
SSE.parse_operand@src dest
SSE.parse_operand@src src
if (@dest.size or @src.size) and not 16
err 'invalid operand size'
end if
if @dest.type = 'mmreg' & @src.type = 'mem'
@src.opcode_prefix = 0F2h
x86.store_instruction@src <0Fh,0F0h>,@dest.rm
else
err 'invalid combination of operands'
end if
end macro
iterate <instr,supp>, pshufb,0, phaddw,1, phaddd,2, phaddsw,3, pmaddubsw,4, phsubw,5, phsubd,6, phsubsw,7, psignb,8, psignw,9, psignd,0Ah, pmulhrsw,0Bh, pabsb,1Ch, pabsw,1Dh, pabsd,1Eh
macro instr? dest*,src*
require SSSE3+
MMX.basic_instruction <38h,supp>,dest,src
end macro
end iterate
macro palignr? dest*,src*,aux*
require SSSE3+
SSE.parse_operand@dest dest
SSE.parse_operand@src src
x86.parse_operand@aux aux
if @dest.type = 'mmreg' & (@src.type = 'mem' | @src.type = 'mmreg') & @aux.type = 'imm'
if @src.size and not @dest.size
err 'operand sizes do not match'
end if
if @aux.size and not 1
err 'invalid operand size'
end if
MMX.select_operand_prefix@src @dest.size
x86.store_instruction@src <0Fh,3Ah,0Fh>,@dest.rm,1,@aux.imm
else
err 'invalid combination of operands'
end if
end macro

View File

@ -0,0 +1,278 @@
iterate <instr,supp>, ptest,17h, pmuldq,28h, pcmpeqq,29h, packusdw,2Bh, pminsb,38h, pminsd,39h, pminuw,3Ah, pminud,3Bh, pmaxsb,3Ch, pmaxsd,3Dh, pmaxuw,3Eh, pmaxud,3Fh, pmulld,40h, phminposuw,41h
macro instr? dest*,src*
require SSE4.1+
SSE.basic_instruction 66h,<38h,supp>,16,dest,src
end macro
end iterate
iterate <instr,supp>, roundps,08h, roundpd,09h, roundss,0Ah, roundsd,0Bh, blendps,0Ch, blendpd,0Dh, pblendw,0Eh, dpps,40h, dppd,41h, mpsadbw,42h
macro instr? dest*,src*,imm*
require SSE4.1+
SSE.basic_instruction_imm8 66h,<3Ah,supp>,16,dest,src,imm
end macro
end iterate
iterate <instr,supp>, pblendvb,10h, blendvps,14h, blendvpd,15h
macro instr? dest*,src*,sel*
require SSE4.1+
SSE.parse_operand@dest dest
SSE.parse_operand@src src
SSE.parse_operand@aux sel
if @dest.type = 'mmreg' & (@src.type = 'mem' | @src.type = 'mmreg') & @aux.type = 'mmreg' & @aux.size = 16 & @aux.rm = 0
if @dest.size or @src.size and not 16
err 'invalid operand size'
end if
@src.opcode_prefix = 66h
x86.store_instruction@src <0Fh,38h,supp>,@dest.rm
else
err 'invalid combination of operands'
end if
end macro
end iterate
iterate <conv,code,msize>, bw,0,8, bd,1,4, bq,2,2, wd,3,8, wq,4,4, dq,5,8
macro pmovsx#conv? dest*,src*
require SSE4.1+
SSE.basic_instruction 66h,<38h,20h+code>,msize,dest,src
end macro
macro pmovzx#conv? dest*,src*
require SSE4.1+
SSE.basic_instruction 66h,<38h,30h+code>,msize,dest,src
end macro
end iterate
macro insertps? dest*,src*,sel*
require SSE4.1+
SSE.basic_instruction_imm8 66h,<3Ah,21h>,4,dest,src,sel
end macro
macro extractps? dest*,src*,sel*
require SSE4.1+
x86.parse_operand@dest dest
SSE.parse_operand@src src
x86.parse_operand@aux sel
if @dest.type = 'reg' & @src.type = 'mmreg' & @aux.type = 'imm'
if x86.mode = 64 & @dest.size = 8
@dest.size = 4
end if
if @dest.size <> 4 | @src.size and not 16 | @aux.size and not 1
err 'invalid operand size'
end if
@dest.opcode_prefix = 66h
x86.store_instruction@dest <0Fh,3Ah,17h>,@src.rm,1,@aux.imm
else
err 'invalid combination of operands'
end if
end macro
macro pinsrb? dest*,src*,sel*
require SSE4.1+
SSE.parse_operand@dest dest
x86.parse_operand@src src
x86.parse_operand@aux sel
if (@dest.type = 'mmreg' & @dest.size = 16) & (@src.type = 'reg' | @src.type = 'mem') & @aux.type = 'imm'
if (@src.type = 'reg' & @src.size <> 4) | (@src.type = 'mem' & @src.size and not 1) | @aux.size and not 1
err 'invalid operand size'
end if
@src.opcode_prefix = 66h
x86.store_instruction@src <0Fh,3Ah,20h>,@dest.rm,1,@aux.imm
else
err 'invalid combination of operands'
end if
end macro
macro pinsrd? dest*,src*,sel*
require SSE4.1+
SSE.parse_operand@dest dest
x86.parse_operand@src src
x86.parse_operand@aux sel
if (@dest.type = 'mmreg' & @dest.size = 16) & (@src.type = 'reg' | @src.type = 'mem') & @aux.type = 'imm'
if @src.size and not 4 | @aux.size and not 1
err 'invalid operand size'
end if
@src.opcode_prefix = 66h
x86.store_instruction@src <0Fh,3Ah,22h>,@dest.rm,1,@aux.imm
else
err 'invalid combination of operands'
end if
end macro
macro pinsrq? dest*,src*,sel*
require SSE4.1+
SSE.parse_operand@dest dest
x86.parse_operand@src src
x86.parse_operand@aux sel
if (@dest.type = 'mmreg' & @dest.size = 16) & (@src.type = 'reg' | @src.type = 'mem') & @aux.type = 'imm'
if @src.size and not 8 | @aux.size and not 1
err 'invalid operand size'
end if
if x86.mode < 64
err 'instruction requires long mode'
end if
@src.opcode_prefix = 66h
@src.rex_prefix = 48h
x86.store_instruction@src <0Fh,3Ah,22h>,@dest.rm,1,@aux.imm
else
err 'invalid combination of operands'
end if
end macro
macro pextrb? dest*,src*,sel*
require SSE4.1+
x86.parse_operand@dest dest
SSE.parse_operand@src src
x86.parse_operand@aux sel
if (@dest.type = 'reg' | @dest.type = 'mem') & (@src.type = 'mmreg' & @src.size = 16) & @aux.type = 'imm'
if x86.mode = 64 & @dest.type = 'reg' & @dest.size = 8
@dest.size = 4
end if
if (@dest.type = 'reg' & @dest.size <> 4) | (@dest.size = 'mem' & @dest.size and not 1) | @aux.size and not 1
err 'invalid operand size'
end if
@dest.opcode_prefix = 66h
x86.store_instruction@dest <0Fh,3Ah,14h>,@src.rm,1,@aux.imm
else
err 'invalid combination of operands'
end if
end macro
macro pextrw? dest*,src*,sel*
require SSE4.1+
x86.parse_operand@dest dest
SSE.parse_operand@src src
x86.parse_operand@aux sel
if @dest.type = 'reg' & @src.type = 'mmreg' & @aux.type = 'imm'
if x86.mode = 64 & @dest.size = 8
@dest.size = 4
end if
if @dest.size <> 4 | @aux.size and not 1
err 'invalid operand size'
end if
MMX.select_operand_prefix@src @src.size
x86.store_instruction@src <0Fh,0C5h>,@dest.rm,1,@aux.imm
else if @dest.type = 'mem' & (@src.type = 'mmreg' & @src.size = 16) & @aux.type = 'imm'
if @dest.size and not 2 | @aux.size and not 1
err 'invalid operand size'
end if
@dest.opcode_prefix = 66h
x86.store_instruction@dest <0Fh,3Ah,15h>,@src.rm,1,@aux.imm
else
err 'invalid combination of operands'
end if
end macro
macro pextrd? dest*,src*,sel*
require SSE4.1+
x86.parse_operand@dest dest
SSE.parse_operand@src src
x86.parse_operand@aux sel
if (@dest.type = 'reg' | @dest.type = 'mem') & (@src.type = 'mmreg' & @src.size = 16) & @aux.type = 'imm'
if x86.mode = 64 & @dest.type = 'reg' & @dest.size = 8
@dest.size = 4
end if
if @dest.size and not 4 | @aux.size and not 1
err 'invalid operand size'
end if
@dest.opcode_prefix = 66h
x86.store_instruction@dest <0Fh,3Ah,16h>,@src.rm,1,@aux.imm
else
err 'invalid combination of operands'
end if
end macro
macro pextrq? dest*,src*,sel*
require SSE4.1+
x86.parse_operand@dest dest
SSE.parse_operand@src src
x86.parse_operand@aux sel
if (@dest.type = 'reg' | @dest.type = 'mem') & (@src.type = 'mmreg' & @src.size = 16) & @aux.type = 'imm'
if @dest.size and not 8 | @aux.size and not 1
err 'invalid operand size'
end if
if x86.mode < 64
err 'instruction requires long mode'
end if
@dest.opcode_prefix = 66h
@dest.rex_prefix = 48h
x86.store_instruction@dest <0Fh,3Ah,16h>,@src.rm,1,@aux.imm
else
err 'invalid combination of operands'
end if
end macro
macro movntdqa? dest*,src*
require SSE4.1+
SSE.parse_operand@dest dest
SSE.parse_operand@src src
if @dest.type = 'mmreg' & @src.type = 'mem'
if (@dest.size or @src.size) and not 16
err 'invalid operand size'
end if
@src.opcode_prefix = 66h
x86.store_instruction@src <0Fh,38h,2Ah>,@dest.rm
else
err 'invalid combination of operands'
end if
end macro
iterate <instr,supp>, pcmpgtq,37h
macro instr? dest*,src*
require SSE4.2+
SSE.basic_instruction 66h,<38h,supp>,16,dest,src
end macro
end iterate
iterate <instr,supp>, pcmpestrm,60h, pcmpestri,61h, pcmpistrm,62h, pcmpistri,63h
macro instr? dest*,src*,imm*
require SSE4.2+
SSE.basic_instruction_imm8 66h,<3Ah,supp>,16,dest,src,imm
end macro
macro v#instr? dest*,src*,imm*
require AVX+
AVX_512.single_source_instruction_imm8 VEX_66_0F3A_W0,EVEX_FORBIDDEN,supp,16,dest,src,imm
end macro
end iterate
macro crc32? dest*,src*
require SSE4.2+
x86.parse_operand@dest dest
x86.parse_operand@src src
if @dest.type = 'reg' & ( @src.type = 'reg' | @src.type = 'mem' )
if @dest.size <> 4 & ( @dest.size <> 8 | x86.mode <> 64 )
err 'invalid operand size'
end if
@src.opcode_prefix = 0F2h
if @src.size > 1
x86.select_operand_prefix@src @src.size
x86.store_instruction@src <0Fh,38h,0F1h>,@dest.rm
else if @src.size > 0
x86.store_instruction@src <0Fh,38h,0F0h>,@dest.rm
else
err 'operand size not specified'
end if
else
err 'invalid combination of operands'
end if
end macro
macro popcnt? dest*,src*
require POPCNT
x86.parse_operand@dest dest
x86.parse_operand@src src
if @dest.type = 'reg' & ( @src.type = 'reg' | @src.type = 'mem' )
if @src.size and not @dest.size
err 'operand sizes do not match'
end if
@src.opcode_prefix = 0F3h
if @dest.size > 1
x86.select_operand_prefix@src @dest.size
x86.store_instruction@src <0Fh,0B8h>,@dest.rm
else
err 'invalid operand size'
end if
else
err 'invalid combination of operands'
end if
end macro

View File

@ -0,0 +1,72 @@
iterate <instr,prefix,ext,postbyte>, vmxon,0F3h,0C7h,6, vmclear,66h,0C7h,6, \
vmptrld,0,0C7h,6, vmptrst,0,0C7h,7
macro instr? src*
require VMX
x86.parse_operand@src src
if @src.type = 'mem'
if @src.size and not 8
err 'invalid operand size'
else
@src.opcode_prefix = prefix
x86.store_instruction@src <0Fh,ext>,postbyte
end if
else
err 'invalid operand'
end if
end macro
end iterate
macro vmxoff?
require VMX
db 0Fh,1,0C4h
end macro
macro vmcall?
require VMX
db 0Fh,1,0C1h
end macro
macro vmlaunch?
require VMX
db 0Fh,1,0C2h
end macro
macro vmresume?
require VMX
db 0Fh,1,0C3h
end macro
macro vmread? dest*,src*
require VMX
x86.parse_operand@dest dest
x86.parse_operand@src src
if @src.type = 'reg' & (@dest.type = 'mem' | @dest.type = 'reg')
if (x86.mode < 64 & @src.size <> 4) | (x86.mode = 64 & @src.size <> 8)
err 'invalid operand size'
else if @dest.size and not @src.size
err 'operand sizes do not match'
end if
x86.store_instruction@dest <0Fh,78h>,@src.rm
else
err 'invalid combination of operands'
end if
end macro
macro vmwrite? dest*,src*
require VMX
x86.parse_operand@dest dest
x86.parse_operand@src src
if @dest.type = 'reg' & (@src.type = 'mem' | @src.type = 'reg')
if (x86.mode < 64 & @dest.size <> 4) | (x86.mode = 64 & @dest.size <> 8)
err 'invalid operand size'
else if @src.size and not @dest.size
err 'operand sizes do not match'
end if
x86.store_instruction@src <0Fh,79h>,@dest.rm
else
err 'invalid combination of operands'
end if
end macro

View File

@ -0,0 +1,155 @@
; Listing generator, which shows generated bytes next to offset in the output file
; and assumed address in memory (limited to the constant term if an address is a linear polynomial).
; The listing is stored in a file with .LST extension.
define Listing? Listing
namespace Listing
virtual at 0
HexDigits:: db '0123456789ABCDEF'
end virtual
spc0 := ''
repeat 34, i:0
spc#% := spc#i bappend ' '
end repeat
collected_source = ''
collected_$ = $
collected_$% = $%
collected_$%% = $%%
calminstruction generate
local source, $, $%, $%%
reverse:
take source, collected_source
take $, collected_$
take $%, collected_$%
take $%%, collected_$%%
jyes reverse
local offset
compute offset, $%
main:
take , $%
take , $%%
take $%, $%
jno done
check source
jno next
local undefined_bytes, defined_bytes
compute undefined_bytes, $% - $%%
compute defined_bytes, $%% - offset
compute offset, $%
local counter, digit
compute counter, 16
emit 1, '['
print_address:
compute counter, counter - 1
compute digit, ($ shr (counter shl 2)) and 0Fh
load digit, HexDigits:digit, 1
emit 1, digit
check counter
jyes print_address
emit 2, '] '
check defined_bytes > 0
jyes bytes_present
emit 34, spc34
jump print_source
bytes_present:
compute counter, 8
print_offset:
compute counter, counter - 1
compute digit, (($%-undefined_bytes-defined_bytes) shr (counter shl 2)) and 0Fh
load digit, HexDigits:digit, 1
emit 1, digit
check counter
jyes print_offset
local column, byte
emit 2, ': '
compute column, 0
print_bytes:
check defined_bytes > 0
jno fill_up
load byte, $% - undefined_bytes - defined_bytes, 1
check column = 8
jno print_byte
compute column, 0
emit 1, ' '
emit lengthof source, source
emit 2, 0A0Dh
emit 29, spc29
compute source, ''
print_byte:
compute digit, byte shr 4
load digit, HexDigits:digit, 1
emit 1, digit
compute digit, byte and 0Fh
load digit, HexDigits:digit, 1
emit 1, digit
emit 1, ' '
compute defined_bytes, defined_bytes - 1
compute column, column + 1
jump print_bytes
fill_up:
check column >= 8
jyes print_source
emit 3, spc3
compute column, column + 1
jump fill_up
print_source:
emit 1, ' '
emit lengthof source, source
emit 2, 0A0Dh
next:
take , source
take , $
jump main
done:
end calminstruction
end namespace
postpone ?
purge ?
virtual as 'lst'
Listing.generate
end virtual
end postpone
calminstruction ? &line&
local tmp
arrange tmp, line
stringify tmp
take Listing.collected_source, tmp
compute tmp, $ scale 0
take Listing.collected_$, tmp
compute tmp, $%
take Listing.collected_$%, tmp
compute tmp, $%%
take Listing.collected_$%%, tmp
assemble line
end calminstruction
calminstruction restartout? origin
arrange origin, =restartout origin
assemble origin
reset:
take , Listing.collected_source
take , Listing.collected_$
take , Listing.collected_$%
take , Listing.collected_$%%
jyes reset
end calminstruction

View File

@ -0,0 +1,54 @@
macro cominvk Object,proc,args&
iterate arg, args
indx 1+%%-%
pushd arg
end iterate
if ~ defined Object#.com.object
err `Object,' is not a COM object'
end if
mov eax,[Object]
push eax
mov eax,[eax]
call [eax+Object.proc]
end macro
macro comcall handle,Interface,proc,args&
iterate arg, args
indx 1+%%-%
pushd arg
end iterate
if ~ defined Interface#.com.interface
err `Interface,' is not a COM interface'
end if
match prefix [addr], :handle
mov eax,handle
push eax
mov eax,[eax]
else
push handle
local _handle
_handle := handle
mov eax,[_handle]
end match
call [eax+Interface.proc]
end macro
macro interface name,methods&
struc name
. dd ?
virtual at 0
iterate method, methods
.method dd ?
end iterate
end virtual
.com.object = name.com.interface
end struc
virtual at 0
iterate method, methods
name.method dd ?
end iterate
define name
name.com.interface = $ shr 2
end virtual
end macro

View File

@ -0,0 +1,51 @@
macro cominvk Object,proc,args&
if ~ defined Object#.com.object
err `Object,' is not a COM object'
end if
macro call dummy
mov rax,[rcx]
Call [rax+Object.proc]
end macro
match any, args
fastcall -,[Object],args
else
fastcall -,[Object]
end match
purge call
end macro
macro comcall handle,Interface,proc,args&
if ~ defined Interface#.com.interface
err `Interface,' is not a COM interface'
end if
macro call dummy
mov rax,[rcx]
Call [rax+Interface.proc]
end macro
match any, args
fastcall -,handle,args
else
fastcall -,handle
end match
purge call
end macro
macro interface name,methods&
struc name
. dq ?
virtual at 0
iterate method, methods
.method dq ?
end iterate
end virtual
.com.object = name.com.interface
end struc
virtual at 0
iterate method, methods
name.method dq ?
end iterate
define name
name.com.interface = $ shr 3
end virtual
end macro

View File

@ -0,0 +1,67 @@
macro export dllname,exports&
iterate <label,string>, exports
local module,addresses,names,ordinal,count
count = %%
dd 0,0,0,RVA module,1
dd count,count,RVA addresses,RVA names,RVA ordinal
addresses:
repeat count
indx %
dd RVA label
end repeat
names:
repeat count
dd RVA names.name#%
end repeat
ordinal:
repeat count
dw %-1
end repeat
module db dllname,0
repeat count
indx %
names.name#% db string,0
end repeat
local x,y,z,str1,str2,v1,v2
x = count shr 1
while x > 0
y = x
while y < count
z = y
while z-x >= 0
load v1:dword from names+z*4
str1 = ($-(RVA $))+v1
load v2:dword from names+(z-x)*4
str2 = ($-(RVA $))+v2
while v1 > 0
load v1:byte from str1+%-1
load v2:byte from str2+%-1
if v1 <> v2
break
end if
end while
if v1 < v2
load v1:dword from names+z*4
load v2:dword from names+(z-x)*4
store v1:dword at names+(z-x)*4
store v2:dword at names+z*4
load v1:word from ordinal+z*2
load v2:word from ordinal+(z-x)*2
store v1:word at ordinal+(z-x)*2
store v2:word at ordinal+z*2
else
break
end if
z = z-x
end while
y = y+1
end while
x = x shr 1
end while
break
end iterate
end macro

View File

@ -0,0 +1,337 @@
define _if _if
define _if..if? _if
define _if..else? _else
define _if..elseif? _elseif
define _if..endif? _endif
define _if..while? _while
define _if..endw? _endw
define _if..repeat? _repeat
define _if..until? _until
calminstruction (cmd) ? &a&
transform cmd,_if
arrange cmd, cmd a
assemble cmd
end calminstruction
macro _if cond
__IF equ :
local endif
__ENDIF equ endif
local else
__ELSE equ else
jcondexpr __ELSE,1,cond
end macro
macro _else
jmp __ENDIF
match _else, __ELSE
_else:
end match
restore __IF
__IF equ
end macro
macro _elseif cond
jmp __ENDIF
match _else, __ELSE
_else:
end match
restore __ELSE
local else
__ELSE equ else
jcondexpr __ELSE,1,cond
end macro
macro _endif
match :_else, __IF __ELSE
_else:
end match
match endif, __ENDIF
endif:
end match
restore __ELSE
restore __ENDIF
restore __IF
end macro
macro _while cond
local while
while:
__WHILE equ while
local endw
__ENDW equ endw
jcondexpr __ENDW,1,cond
end macro
macro _endw
jmp __WHILE
match endw, __ENDW
endw:
end match
restore __ENDW
restore __WHILE
end macro
macro _repeat
local repeat
repeat:
__REPEAT equ repeat
end macro
macro _until cond
jcondexpr __REPEAT,1,cond
restore __REPEAT
end macro
macro newlocal? var
local new
redefine var new
end macro
macro JCONDEXPR?: target,mode,cond
local buffer,current,counter
local neg,conj
local f,t
buffer equ cond
newlocal f
newlocal t
while 1
match ~x, buffer
buffer equ x
neg = (mode) xor 1
else
neg = mode
end match
match (x, buffer
counter = 1
current equ (
buffer equ x
while counter > 0
match p)s, buffer
match (ps, p
counter = counter + 1
current equ current (
buffer equ ps)s
else match pp(ps, p
counter = counter + 1
current equ current pp(
buffer equ ps)s
else
counter = counter - 1
current equ current p
buffer equ )s
end match
else
current equ current buffer
buffer equ
break
end match
end while
else
current equ
end match
match a|b, buffer
match c&d, a
current equ current c
buffer equ &d|b
else
current equ current a
buffer equ |b
end match
else match c&d, buffer
match a|b, c
current equ current a
buffer equ |b&d
else
current equ current c
buffer equ &d
end match
else
current equ current buffer
buffer equ
end match
match , buffer
match (c), current
jcondexpr t,neg,c
else match c, current
jcond t,neg,c
end match
break
else
match |b, buffer
buffer equ b
conj = 0
else match &d, buffer
buffer equ d
conj = 1
else
err 'invalid expression'
end match
if (mode) xor conj
match (c), current
jcondexpr f,neg xor 1,c
else match c, current
jcond f,neg xor 1,c
end match
match t,t
t:
end match
newlocal t
else
match (c), current
jcondexpr t,neg,c
else match c, current
jcond t,neg,c
end match
match f,f
f:
end match
newlocal f
end if
end match
end while
match t,t
label t at target
end match
match f,f
f:
end match
end macro
macro JCOND? target,neg,cond
match =signed? v1>==v2, cond
cmp v1,v2
if neg
jl target
else
jge target
end if
else match =signed? v1<==v2, cond
cmp v1,v2
if neg
jg target
else
jle target
end if
else match v1>==v2, cond
cmp v1,v2
if neg
jb target
else
jae target
end if
else match v1<==v2, cond
cmp v1,v2
if neg
ja target
else
jbe target
end if
else match v1==v2, cond
cmp v1,v2
if neg
jne target
else
je target
end if
else match v1<>v2, cond
cmp v1,v2
if neg
je target
else
jne target
end if
else match =signed? v1>v2, cond
cmp v1,v2
if neg
jle target
else
jg target
end if
else match =signed? v1<v2, cond
cmp v1,v2
if neg
jge target
else
jl target
end if
else match v1>v2, cond
cmp v1,v2
if neg
jbe target
else
ja target
end if
else match v1<v2, cond
cmp v1,v2
if neg
jae target
else
jb target
end if
else match =ZERO=?, cond
if neg
jnz target
else
jz target
end if
else match =CARRY=?, cond
if neg
jnc target
else
jc target
end if
else match =OVERFLOW=?, cond
if neg
jno target
else
jo target
end if
else match =SIGN=?, cond
if neg
jns target
else
js target
end if
else match =PARITY?, cond
if neg
jnp target
else
jp target
end if
else match v, cond
x86.parse_operand@aux v
if @aux.type = 'imm'
if neg
if v = 0
jmp target
end if
else
if v
jmp target
end if
end if
else if @aux.type = 'reg'
test v,v
if neg
jz target
else
jnz target
end if
else
cmp v,0
if neg
je target
else
jne target
end if
end if
end match
end macro

View File

@ -0,0 +1,59 @@
macro library? definitions&
PE.Imports:
iterate <name,string>, definitions
if ~ name.redundant
dd RVA name.lookup,0,0,RVA name.str,RVA name.address
end if
name.referred = 1
end iterate
dd 0,0,0,0,0
iterate <name,string>, definitions
if ~ name.redundant
name.str db string,0
align 2
end if
end iterate
end macro
macro import? name,definitions&
align 4
if defined name.referred
name.lookup:
iterate <label,string>, definitions
if used label
if string eqtype ''
dd RVA name.label
else
dd 80000000h + string
end if
end if
end iterate
if $ > name.lookup
name.redundant = 0
dd 0
else
name.redundant = 1
end if
name.address:
iterate <label,string>, definitions
if used label
if string eqtype ''
label dd RVA name.label
else
label dd 80000000h + string
end if
end if
end iterate
if ~ name.redundant
dd 0
end if
iterate <label,string>, definitions
if used label & string eqtype ''
name.label dw 0
db string,0
align 2
end if
end iterate
end if
end macro

View File

@ -0,0 +1,59 @@
macro library? definitions&
PE.Imports:
iterate <name,string>, definitions
if ~ name.redundant
dd RVA name.lookup,0,0,RVA name.str,RVA name.address
end if
name.referred = 1
end iterate
dd 0,0,0,0,0
iterate <name,string>, definitions
if ~ name.redundant
name.str db string,0
align 2
end if
end iterate
end macro
macro import? name,definitions&
align 8
if defined name.referred
name.lookup:
iterate <label,string>, definitions
if used label
if string eqtype ''
dq RVA name.label
else
dq 8000000000000000h + string
end if
end if
end iterate
if $ > name.lookup
name.redundant = 0
dq 0
else
name.redundant = 1
end if
name.address:
iterate <label,string>, definitions
if used label
if string eqtype ''
label dq RVA name.label
else
label dq 8000000000000000h + string
end if
end if
end iterate
if ~ name.redundant
dq 0
end if
iterate <label,string>, definitions
if used label & string eqtype ''
name.label dw 0
db string,0
align 2
end if
end iterate
end if
end macro

View File

@ -0,0 +1,88 @@
; Simple preprocessor for inline macros.
; Example of use:
;
; inlinemacro oddflip(number)
; return = (number) xor 1
; end inlinemacro
;
; db oddflip(3), oddflip(oddflip(0) shl 1)
; Any kind of definition of an expression-class symbol may be used for the return value.
include 'xcalm.inc'
define inlinemacro? inlinemacro?
inlinemacro... = 0
calminstruction inlinemacro?! &declaration&
local name
match name(arguments?), declaration
jyes define
match name= arguments?, declaration
jyes define
match name arguments?, declaration
define:
arrange tmp, =__inline__.name
arrange name, =inlinemacro.name
publish name, tmp
arrange tmp, =struc (=return?) name arguments
assemble tmp
end calminstruction
calminstruction end?.inlinemacro?!
asm end struc
check inlinemacro...
jyes done
compute inlinemacro..., 1
asm inlinemacro?.enable?
done:
end calminstruction
macro inlinemacro?.enable? chain
chain
macro include?! file*, head
include file, inlinemacro.enable head
purge ?, include?
end macro
calminstruction ?! &text&
local head, tail, name, arguments, more, i
init i, 0
match =inlinemacro? more, text
jyes ready
transform text, inlinemacro
jno ready
match =else? more, text
jno preprocess
compute i, i+1
arrange text, =__inline__.?(=else =if 1) =__inline__.?(=__return__.i==1) text =__inline__.?(=end =if) =__inline__.?(=if ~=definite =__return__.i)
preprocess:
match head? =__inline__.name tail?, text
jno ready
match (arguments?) tail?, tail, ()
jyes inline
arrange text, head name tail
jump preprocess
inline:
match ?, name
jyes special
local tmp, return
compute i, i+1
arrange return, =__return__.i
arrange tmp, return =inlinemacro.name arguments
arrange text, head return tail
take text, tmp
jump preprocess
special:
arrange text, head tail
take text, arguments
jump preprocess
ready:
assemble text
take , text
take text, text
jyes preprocess
end calminstruction
end macro

View File

@ -0,0 +1,395 @@
define stdcall? stdcall
macro stdcall?.push_string value&
local continue
if sizeof.TCHAR > 1
local alignment
virtual at $+5
align sizeof.TCHAR
alignment = $-$$
end virtual
db alignment dup 90h
end if
call continue
TCHAR value,0
continue:
end macro
macro stdcall?: proc*,args&
local count
count = 0
iterate arg, args
indx 1+%%-%
match =addr? val, arg
if val relativeto 0 | val relativeto $
push dword val
else
lea edx,[val]
push edx
end if
else match =double? [var], arg
push dword [var+4]
push dword [var]
count = count + 1
else match =double? val, arg
local low,high
virtual at 0
dq val
load low:dword from 0
load high:dword from 4
end virtual
push dword high
push dword low
count = count + 1
else match =invoke? func, arg
invoke func
push eax
else match =cinvoke? func, arg
cinvoke func
push eax
else match =stdcall? func, arg
stdcall func
push eax
else match =ccall? func, arg
ccall func
push eax
else match first=,rest, arg
stdcall?.push_string arg
else match size [var], arg
if size = 4
push arg
else
if size = 1
mov al, arg
else if size = 2
mov ax, arg
else
mov eax, arg
end if
push eax
end if
else match [var], arg
push dword arg
else
if arg eqtype ''
stdcall?.push_string arg
else
push dword arg
end if
end match
count = count + 1
end iterate
pcountcheck proc,count
call proc
end macro
macro ccall?: proc*,args&
local count
count = 0
iterate arg, args
indx 1+%%-%
match =addr? val, arg
if val relativeto 0 | val relativeto $
push dword val
else
lea edx,[val]
push edx
end if
else match =double? [var], arg
push dword [var+4]
push dword [var]
count = count + 1
else match =double? val, arg
local low,high
virtual at 0
dq val
load low:dword from 0
load high:dword from 4
end virtual
push dword high
push dword low
count = count + 1
else match =invoke? func, arg
invoke func
push eax
else match =cinvoke? func, arg
cinvoke func
push eax
else match =stdcall? func, arg
stdcall func
push eax
else match =ccall? func, arg
ccall func
push eax
else match first=,rest, arg
stdcall?.push_string arg
else match size [var], arg
if size = 4
push arg
else
if size = 1
mov al, arg
else if size = 2
mov ax, arg
else
mov eax, arg
end if
push eax
end if
else match [var], arg
push dword arg
else
if arg eqtype ''
stdcall?.push_string arg
else
push dword arg
end if
end match
count = count + 1
end iterate
pcountcheck proc,count
call proc
if count
add esp,count*4
end if
end macro
macro invoke?: proc*,args&
stdcall [proc],args
end macro
macro cinvoke?: proc*,args&
ccall [proc],args
end macro
macro pcountcheck? proc*,args*
end macro
define pcountsuffix %
prologue@proc equ prologuedef
macro prologuedef procname,flag,parmbytes,localbytes,reglist
local loc
loc = (localbytes+3) and (not 3)
parmbase@proc equ ebp+8
localbase@proc equ ebp-loc
if parmbytes | localbytes
push ebp
mov ebp,esp
if localbytes
sub esp,loc
end if
end if
iterate reg, reglist
push reg
end iterate
end macro
epilogue@proc equ epiloguedef
macro epiloguedef procname,flag,parmbytes,localbytes,reglist
iterate reg, reglist
indx %%-%+1
pop reg
end iterate
if parmbytes | localbytes
leave
end if
if flag and 10000b
retn
else
retn parmbytes
end if
end macro
close@proc equ
macro proc? statement&
local _local,params,flag,regs,parmbytes,localbytes,current,tmp,initlocal
macro endp?!
localbytes = current
purge ret?,locals?,endl?,proclocal?
match close:reglist, close@proc,<regs>
close name,flag,parmbytes,localbytes,reglist
end match
end match
end namespace
end if
end match
purge endp?
end macro
match name declaration, statement :
if used name
name:
namespace name
outscope match local?, proclocal
match =stdcall? args :, declaration
define params args
flag = 11b
else match =stdcall? :, declaration
define params
flag = 11b
else match =c? args :, declaration
define params args
flag = 10001b
else match =c? :, declaration
define params
flag = 10001b
else match args :, declaration
define params args
flag = 0
else
define params
flag = 0
end match
define regs
match =uses? list, params
define params list
while 1
match =, tail, params
define params tail
break
else match reg tail, params&
match more&, tail
define params more
else
define params
end match
if % = 1
regs equ reg
else
regs equ regs,reg
end if
else
break
end match
end while
else match =, tail, params
define params tail
end match
match prologue:reglist, prologue@proc:<regs>
prologue name,flags,parmbytes,localbytes,reglist
end match
virtual at parmbase@proc
namespace name
match args, params
iterate arg, args
match argname:type, arg
label argname:type
rb type
else
?arg dd ?
end match
end iterate
end match
parmbytes := $-(parmbase@proc)
match p, pcountsuffix
name#p = parmbytes/4
end match
end namespace
end virtual
macro ret? operand
match any, operand
retn operand
else
match epilogue:reglist, epilogue@proc:<regs>
epilogue name,flag,parmbytes,localbytes,reglist
end match
end match
end macro
current = 0
macro initlocal
local area,pointer,length,value
area::
pointer = localbase@proc+current
length = $@ - (localbase@proc) - current
current = $ - (localbase@proc)
end virtual
while length > 0
if length < 2
load value:byte from area:pointer
mov byte [pointer],value
pointer = pointer + 1
length = length - 1
else if length < 4
load value:word from area:pointer
mov word [pointer],value
pointer = pointer + 2
length = length - 2
else
load value:dword from area:pointer
mov dword [pointer],value
pointer = pointer + 4
length = length - 4
end if
end while
virtual at localbase@proc+current
end macro
macro locals?
virtual at localbase@proc+current
iterate dword, dword,qword
macro dword? value
if value relativeto 0
emit dword: value
else
initlocal
local pointer
pointer := $
end virtual
mov dword [pointer],value
virtual at pointer+4
current = $ - (localbase@proc)
end if
end macro
end iterate
macro ? line&
line
if $ > $@
initlocal
end if
end macro
end macro
macro endl?
purge ?, dword?,qword?
initlocal
end virtual
end macro
macro proclocal? args&
locals
iterate arg, args
match varname[count]:type, arg
?varname dbx type:count dup ?
else match varname:type, arg
?varname dbx type, ?
else match varname[count], arg
?varname rd count
else match varname type, arg
?varname type
else
?arg dd ?
end match
end iterate
endl
end macro
end macro

View File

@ -0,0 +1,491 @@
define fastcall? fastcall
fastcall.r1 equ rcx
fastcall.rd1 equ ecx
fastcall.rw1 equ cx
fastcall.rb1 equ cl
fastcall.rf1 equ xmm0
fastcall.r2 equ rdx
fastcall.rd2 equ edx
fastcall.rw2 equ dx
fastcall.rb2 equ dl
fastcall.rf2 equ xmm1
fastcall.r3 equ r8
fastcall.rd3 equ r8d
fastcall.rw3 equ r8w
fastcall.rb3 equ r8b
fastcall.rf3 equ xmm2
fastcall.r4 equ r9
fastcall.rd4 equ r9d
fastcall.rw4 equ r9w
fastcall.rb4 equ r9b
fastcall.rf4 equ xmm3
fastcall?.frame = -1
macro frame?
local size
define fastcall?.frame_size size
fastcall?.frame =: 0
sub rsp,size
end macro
macro end?.frame?
match size, fastcall?.frame_size
size := fastcall?.frame
add rsp,size
end match
restore fastcall?.frame,fastcall?.frame_size
end macro
macro endf?
end frame
end macro
macro fastcall?.inline_string var
local data,continue
jmp continue
if sizeof.TCHAR > 1
align sizeof.TCHAR,90h
end if
match value, var
data TCHAR value,0
end match
redefine var data
continue:
end macro
macro fastcall?: proc*,args&
local offset,framesize,type,value
if framesize & fastcall?.frame < 0
sub rsp,framesize
end if
offset = 0
local nest,called
called = 0
iterate arg, args
nest = 0
match =invoke? func, arg
nest = %
else match =fastcall? func, arg
nest = %
end match
if nest
if called
mov [rsp+8*(called-1)],rax
end if
frame
arg
end frame
called = nest
end if
end iterate
iterate arg, args
match =float? val, arg
type = 'f'
value reequ val
SSE.parse_operand@src val
else match =addr? val, arg
type = 'a'
value reequ val
x86.parse_operand@src [val]
else match =invoke? func, arg
if called = %
type = 0
value reequ rax
x86.parse_operand@src rax
else
type = 'r'
end if
else match =fastcall? func, arg
if called = %
type = 0
value reequ rax
x86.parse_operand@src rax
else
type = 'r'
end if
else match first=,rest, arg
type = 's'
value reequ arg
else
type = 0
value reequ arg
SSE.parse_operand@src arg
if @src.type = 'imm' & @src.size = 0
if value eqtype ''
type = 's'
end if
end if
end match
if type = 's'
fastcall.inline_string value
type = 'a'
end if
if % < 5
if type = 'f'
if @src.size = 8 | ~ @src.size | @src.type = 'mmreg'
if @src.type = 'imm'
mov rax,value
movq fastcall.rf#%,rax
else
movq fastcall.rf#%,value
end if
else if @src.size = 4
if @src.type = 'imm'
mov eax,value
movd fastcall.rf#%,eax
else
movd fastcall.rf#%,value
end if
else
err 'invalid argument ',`arg
end if
else
if type = 'a'
lea fastcall.r#%,[value]
else
if type = 'r'
@src.size = 8
@src.type = 'mem'
value equ [rsp+8*(%-1)]
end if
if @src.size = 8 | ~ @src.size
if @src.type <> 'reg' | ~ @src.imm eq fastcall.r#%
mov fastcall.r#%,value
end if
else if @src.size = 4
if @src.type <> 'reg' | ~ @src.imm eq fastcall.rd#%
mov fastcall.rd#%,value
end if
else if @src.size = 2
if @src.type <> 'reg' | ~ @src.imm eq fastcall.rw#%
mov fastcall.rw#%,value
end if
else if @src.size = 1
if @src.type <> 'reg' | ~ @src.imm eq fastcall.rb#%
mov fastcall.rb#%,value
end if
else
err 'invalid argument ',`arg
end if
end if
end if
else
if type = 'r'
; already on stack
else if @src.type = 'reg'
mov [rsp+offset],value
else if @src.type = 'mem'
if type = 'a'
lea rax,[value]
mov [rsp+offset],rax
else
if @src.size = 8 | ~ @src.size
mov rax,value
mov [rsp+offset],rax
else if @src.size = 4
mov eax,value
mov [rsp+offset],eax
else if @src.size = 2
mov ax,value
mov [rsp+offset],ax
else if @src.size = 1
mov al,value
mov [rsp+offset],al
else
err 'invalid argument ',`arg
end if
end if
else if @src.type = 'imm'
if @src.size = 8 | ~ @src.size
if (value) relativeto 0 & (value) - 1 shl 64 >= -80000000h & (value) < 1 shl 64
mov rax,(value) - 1 shl 64
mov [rsp+offset],rax
else if (value) relativeto 0 & ( (value) >= 80000000h | (value) < -80000000h )
mov rax,value
mov [rsp+offset],rax
else
mov qword [rsp+offset],value
end if
else if @src.size = 4
mov dword [rsp+offset],value
else if @src.size = 2
mov word [rsp+offset],value
else if @src.size = 1
mov byte [rsp+offset],value
else
err 'invalid argument ',`arg
end if
else if type = 'f' & @src.type = 'mmreg' & @src.size = 16
movq [rsp+offset],value
else
err 'invalid argument ',`arg
end if
end if
offset = offset + 8
end iterate
pcountcheck proc,offset/8
if offset < 20h
offset = 20h
end if
framesize = offset + offset and 8
call proc
if framesize & fastcall?.frame < 0
add rsp,framesize
else if fastcall?.frame >= 0 & framesize > fastcall?.frame
fastcall?.frame = framesize
end if
end macro
macro invoke?: proc*,args&
fastcall [proc],args
end macro
macro cinvoke?: proc*,args&
fastcall [proc],args
end macro
macro pcountcheck? proc*,args*
end macro
define pcountsuffix %
prologue@proc equ prologuedef
macro prologuedef procname,flag,parmbytes,localbytes,reglist
local loc,fill
loc = (localbytes+15) and (not 15)
parmbase@proc equ rbp+16
localbase@proc equ rbp-loc
push rbp
mov rbp,rsp
if loc+fill
sub rsp,loc+fill
end if
match any, reglist
iterate reg, reglist
push reg
if % = %%
fill := 8*(% and 1)
end if
end iterate
else
fill := 0
end match
end macro
epilogue@proc equ epiloguedef
macro epiloguedef procname,flag,parmbytes,localbytes,reglist
iterate reg, reglist
indx %%-%+1
pop reg
end iterate
leave
retn
end macro
close@proc equ
macro proc? statement&
local _local,params,flag,regs,parmbytes,localbytes,current,tmp,initlocal
macro endp?!
localbytes = current
purge ret?,locals?,endl?,proclocal?
match close:reglist, close@proc,<regs>
close name,flag,parmbytes,localbytes,reglist
end match
end match
end namespace
end if
end match
purge endp?
end macro
match name declaration, statement :
if used name
name:
namespace name
outscope match local?, proclocal
match =stdcall? args :, declaration
define params args
flag = 11b
else match =stdcall? :, declaration
define params
flag = 11b
else match =c? args :, declaration
define params args
flag = 10001b
else match =c? :, declaration
define params
flag = 10001b
else match args :, declaration
define params args
flag = 0
else
define params
flag = 0
end match
define regs
match =uses? list, params
define params list
while 1
match =, tail, params
define params tail
break
else match reg tail, params&
match more&, tail
define params more
else
define params
end match
if % = 1
regs equ reg
else
regs equ regs,reg
end if
else
break
end match
end while
else match =, tail, params
define params tail
end match
match prologue:reglist, prologue@proc:<regs>
prologue name,flags,parmbytes,localbytes,reglist
end match
virtual at parmbase@proc
namespace name
match args, params
iterate arg, args
match argname:type, arg
label argname:type
rb type
else
?arg dq ?
end match
end iterate
end match
parmbytes := $-(parmbase@proc)
match p, pcountsuffix
name#p = parmbytes/8
end match
end namespace
end virtual
macro ret? operand
match any, operand
retn operand
else
match epilogue:reglist, epilogue@proc:<regs>
epilogue name,flag,parmbytes,localbytes,reglist
end match
end match
end macro
current = 0
macro initlocal
local area,pointer,length,value
area::
pointer = localbase@proc+current
length = $@ - (localbase@proc) - current
current = $ - (localbase@proc)
end virtual
while length > 0
if length < 2
load value:byte from area:pointer
mov byte [pointer],value
pointer = pointer + 1
length = length - 1
else if length < 4
load value:word from area:pointer
mov word [pointer],value
pointer = pointer + 2
length = length - 2
else if length < 8
load value:dword from area:pointer
mov dword [pointer],value
pointer = pointer + 4
length = length - 4
else
load value:qword from area:pointer
if value < 80000000h | value >= 1 shl 64 - 80000000h
mov qword [pointer],value
pointer = pointer + 8
length = length - 8
else
mov dword [pointer],value and 0FFFFFFFFh
pointer = pointer + 4
length = length - 4
end if
end if
end while
virtual at localbase@proc+current
end macro
macro locals?
virtual at localbase@proc+current
iterate dword, dword,qword
macro dword? value
if value relativeto 0
emit dword: value
else
initlocal
local pointer
pointer := $
end virtual
mov dword [pointer],value
virtual at pointer+4
current = $ - (localbase@proc)
end if
end macro
end iterate
macro ? line&
line
if $ > $@
initlocal
end if
end macro
end macro
macro endl?
purge ?, dword?,qword?
initlocal
end virtual
end macro
macro proclocal? args&
locals
iterate arg, args
match varname[count]:type, arg
?varname dbx type:count dup ?
else match varname:type, arg
?varname dbx type, ?
else match varname[count], arg
?varname rq count
else match varname type, arg
?varname type
else
?arg dq ?
end match
end iterate
endl
end macro
end macro

View File

@ -0,0 +1,314 @@
macro directory definitions&
iterate <type,label>, definitions
root@resource dd 0,%t,0,%% shl 16
local total,current,next
total = %%
current = -1
next = 0
while current < next
current = next
repeat total
indx %
if type = current
dd type,80000000h+label-root@resource
else if type > current & ( next = current | next > type )
next = type
end if
end repeat
end while
break
end iterate
end macro
macro resource dir,definitions&
iterate <id,lang,label>, definitions
dir dd 0,%t,0,%% shl 16
local total,current,next,counter
total = %%
current = -1
next = 0
while current < next
current = next
counter = 0
repeat total
indx %
if id = current
if counter = 0
dd id,80000000h+label.directory-root@resource
end if
counter = counter + 1
label.count = counter
else if id > current & ( next = current | next > id )
next = id
end if
end repeat
end while
current = -1
next = 0
while current < next
current = next
counter = 0
repeat total
indx %
if id = current
if counter = 0
label.directory dd 0,%t,0,label.count shl 16
dd lang,label-root@resource
label.resid = id
else
dd lang,label-root@resource
end if
counter = counter + 1
else if id > current & ( next = current | next > id )
next = id
end if
end repeat
end while
break
end iterate
end macro
macro bitmap label,bitmap_file
local data,size
label dd RVA data,size,0,0
data file bitmap_file:0Eh
size = $ - data
align 4
end macro
macro icon group,definitions&
local data,size,position,header
iterate <label,icon_file>, definitions
virtual at 0
file icon_file:6,16
load size:dword from 8
load position:dword from 12
end virtual
label dd RVA data#%,size,0,0
data#% file icon_file:position,size
if % = %%
align 4
group dd RVA header,6+%%*14,0,0
header dw 0,1,%%
repeat %%
indx %
file icon_file:6,12
dw label.resid
end repeat
align 4
end if
end iterate
end macro
macro cursor group,definitions&
local data,header
iterate <label,cursor_file>, definitions
virtual at 0
file cursor_file:6,16
load label.width:byte from 0
load label.height:byte from 1
load label.size:dword from 8
load label.position:dword from 12
end virtual
label dd RVA data#%,label.size+4,0,0
data#% file cursor_file:10,4
file cursor_file:label.position,label.size
if % = %%
align 4
group dd RVA header,6+%%*14,0,0
header dw 0,2,%%
repeat %%
indx %
dw label.width,label.height,1,0
dd label.size+4
dw label.resid
end repeat
align 4
end if
end iterate
end macro
macro menu label
local data,size
label dd RVA data,size,0,0
data dw 1,4,0,0
local menu_level
menu_level = 1
macro menuitem string,id,resinfo:0,status:0,type:0
dd MFT_STRING or type,status,id
dw resinfo
du string,0
align 4
if resinfo and MFR_END
menu_level = menu_level - 1
end if
if resinfo and MFR_POPUP
menu_level = menu_level + 1
dd 0
end if
if menu_level = 0
size = $ - data
purge menuitem,menuseparator
end if
end macro
macro menuseparator resinfo:0
dd MFT_SEPARATOR,0,0
dw resinfo,0
if resinfo and MFR_END
menu_level = menu_level - 1
end if
if menu_level = 0
size = $ - data
purge menuitem,menuseparator
end if
end macro
end macro
macro dialog label,title,x,y,cx,cy,style,exstyle:0,menu:0,fontname:'MS Sans Serif',fontsize:8
local data,size,items
label dd RVA data,size,0,0
data dd style or DS_SETFONT,exstyle
dw items,x,y,cx,cy
if menu <> 0
dw 0FFFFh
end if
du menu,0,title,0
du fontsize,fontname,0
align 4
local dialog_items_counter
dialog_items_counter = 0
macro dialogitem class,it_title,it_id,it_x,it_y,it_cx,it_cy,it_style,it_exstyle:0
dd it_style or WS_CHILD,it_exstyle
dw it_x,it_y,it_cx,it_cy,it_id
if class eq 'BUTTON'
dw 0FFFFh,80h
else if class eq 'EDIT'
dw 0FFFFh,81h
else if class eq 'STATIC'
dw 0FFFFh,82h
else if class eq 'LISTBOX'
dw 0FFFFh,83h
else if class eq 'SCROLLBAR'
dw 0FFFFh,84h
else if class eq 'COMBOBOX'
dw 0FFFFh,85h
else
du class,0
end if
match any=,any, it_title
du it_title,0
else if it_title eqtype ''
du it_title,0
else
dw 0FFFFh,it_title
end if
dw 0
align 4
dialog_items_counter = dialog_items_counter + 1
end macro
macro enddialog
size = $ - data
items = dialog_items_counter
purge dialogitem,enddialog
end macro
end macro
macro accelerator label,definitions&
local data,size
label dd RVA data,size,0,0
data:
iterate <fvirt,key,cmd>, definitions
if % = %%
dw fvirt or 80h,key
size = %% * 8
else
dw fvirt,key
end if
dd cmd
end iterate
end macro
macro versioninfo label,fileos,filetype:0,filesubtype:0,lang,cp:0,values&
local data,size,vivalue,visize
label dd RVA data,size,0,0
data dw size,visize,0
du 'VS_VERSION_INFO',0,0
vivalue dd 0FEEF04BDh,00010000h
local version,count,shift,char,filever,productver
filever = 0
productver = 0
iterate <name,value>, values
if name eq 'FileVersion' | name eq 'ProductVersion'
virtual at 0
db value
count = $
version = 0
shift = 16
repeat count
load char:byte from %-1
if char='.'
if shift mod 32
shift = shift-16
else
shift = shift+32+16
end if
else
version = (version and not (0FFFFh shl shift)) or ((version shr shift and 0FFFFh)*10+char-'0') shl shift
end if
end repeat
end virtual
if name eq 'FileVersion'
filever = version
else if name eq 'ProductVersion'
productver = version
end if
end if
end iterate
dq filever,productver
dd 0,0,fileos,filetype,filesubtype,0,0
visize = $ - vivalue
local sfi_data,sfi_size
sfi_data dd sfi_size
du 1,'StringFileInfo',0
local str_data,str_size
str_data dd str_size
du 1,'040904E4',0
macro vdata name,value&
local vs_data,vs_size,value_data,value_size
align 4
vs_data dw vs_size,value_size/2
du 1,name,0
align 4
value_data du value,0
value_size = $ - value_data
vs_size = $ - vs_data
end macro
iterate <name,value>, values
vdata name,value
end iterate
purge vdata
align 4
str_size = $ - str_data
sfi_size = $ - sfi_data
local vfi_data,vfi_size,var_data,var_size
vfi_data dd vfi_size
du 1,'VarFileInfo',0,0
var_data dw var_size,4
du 0,'Translation',0,0
dw lang,cp
var_size = $ - var_data
vfi_size = $ - vfi_data
size = $ - data
end macro
macro resdata label
local data,size
label dd RVA data,size,0,0
data = $
macro endres
size = $ - data
align 4
purge endres
end macro
end macro

View File

@ -0,0 +1,456 @@
define struct? struct?
namespace struct?
calminstruction instantiate: instance*, sname*, &values&
local tmp
arrange tmp, =label instance : sname.=__size__
assemble tmp
arrange tmp, =namespace instance
assemble tmp
match , values
jyes values_ready
call struct?.initialize, sname, values
values_ready:
local i
compute i, 1
local field, val, stack
process_statement:
arrange field, sname.=__label#i
transform field
jyes labeled_statement
arrange field,
arrange tmp, sname.=__statement#i
transform tmp
jyes statement_ready
jump finish
labeled_statement:
arrange tmp, sname.=__label#i sname.=__definition#i
transform tmp
arrange val, =__init__.#field
transform val
jyes got_value
arrange val, sname.=__default__.#field
arrange field,
transform val
jno statement_ready
got_value:
arrange tmp, tmp val
statement_ready:
take stack, field
take stack, i
take stack, sname
assemble tmp
take , sname
take sname, stack
take , i
take i, stack
take , field
take field, stack
match , field
jyes next_statement
arrange tmp, sname.=__size__.#field - (=$ - field)
compute tmp, tmp
check tmp = 0
jyes next_statement
check tmp > 0
jyes fill_up
stringify field
err 'value too long to fit in ' bappend field
jump next_statement
fill_up:
arrange tmp, =rb tmp
assemble tmp
next_statement:
compute i, i + 1
jump process_statement
finish:
asm end namespace
end calminstruction
calminstruction initialize sname*, values&
local j, a
compute j, 0
arrange a, sname.=__argument
local tmp, field, val, sub
process_argument:
match field=, values, values, <>
jyes got_argument
arrange field, values
arrange values,
got_argument:
match field:val?, field, <>
jyes labeled_argument
check j < 0
jyes mixed_arguments
compute j, j + 1
arrange val, field
match <val>, val
arrange field, a#j
transform field
jno excess_arguments
match <tmp>, field
jno got_argument_field
take a, tmp
compute tmp, 0
take j, tmp
take values, val
jump process_argument
excess_arguments:
err 'excess arguments'
jump arguments_processed
mixed_arguments:
err 'unsupported mixing of labeled and ordered values'
jump arguments_processed
labeled_argument:
check j > 0
jyes mixed_arguments
compute j, -1
match <val>, val
got_argument_field:
arrange tmp, sname.=__default__.#field
transform tmp
jyes argument_ok
match field.sub, field
jno unknown_field
arrange tmp, sname.=__default__.#field
transform tmp
jno unknown_field
arrange val, sub:val
arrange tmp, =__multi__.#field
transform tmp
jno append_value
arrange val, tmp, val
arrange tmp, =__multi__.#field
append_value:
publish tmp, val
jump argument_ok
unknown_field:
stringify field
arrange tmp, sname
stringify tmp
err tmp bappend ' has no field named ' bappend field
jump next_argument
argument_ok:
arrange tmp, =__init__.#field
publish tmp, val
next_argument:
match , values
jno process_argument
arguments_processed:
take , values
take , j
take , a
take values, values
jyes next_argument
end calminstruction
define pname
define i
define j
define u
define a
calminstruction (&label) collect? &definition&
local sym, default, tmp
match , definition
jyes plain
match :tmp?, definition
jyes ignored
match ==tmp?, definition
jyes ignored
arrange default,
match definition= default, definition
arrange sym, pname.=__definition#i
publish sym:, definition
arrange sym, pname.=__label#i
publish sym:, label
arrange sym, pname.=__default__.#label
publish sym:, default
arrange definition, label definition default
assemble definition
arrange definition, =__size__.#label == =$ - label
assemble definition
match , a
jyes done
compute j, j + 1
arrange sym, a#j
publish sym:, label
done:
exit
ignored:
arrange label, label definition
plain:
assemble label
end calminstruction
calminstruction collect? &statement&
local proto, sym, tmp
check i
jyes in_body
compute u, 0
compute i, 1
compute j, 1
asm virtual at 0
match pname= proto, pname
arrange tmp, =namespace pname
assemble tmp
jno prototype_copied
use_prototype:
arrange a,
arrange tmp, proto.=__statement#i
transform tmp
jno prototype_arguments
arrange sym, pname.=__statement#i
publish sym:, tmp
assemble tmp
compute i, i + 1
jump use_prototype
prototype_arguments:
arrange tmp, proto.=__argument#j
transform tmp
jno prototype_copied
arrange sym, pname.=__argument#j
publish sym:, tmp
compute j, j + 1
jump prototype_arguments
prototype_copied:
compute j, j - 1
arrange a, pname.=__argument
in_body:
match =ends?, statement
jyes close
check u
jno process_definition
check u > 1
jno union_divider_ok
arrange tmp, =__union_divider
arrange sym, pname.=__statement#i
publish sym:, tmp
assemble tmp
compute i, i + 1
arrange a,
union_divider_ok:
compute u, u + 1
process_definition:
match =struct?, statement
jyes open_struct
match =union?, statement
jyes open_union
arrange sym, pname.=__statement#i
publish sym:, statement
assemble statement
compute i, i + 1
exit
open_union:
arrange tmp, =__union_start
arrange sym, pname.=__statement#i
publish sym:, tmp
assemble tmp
compute i, i + 1
arrange tmp, a
take a, tmp
compute tmp, 1
take u, tmp
exit
open_struct:
match , a
jyes unlisted_substruct
compute j, j + 1
arrange sym, a#j
arrange tmp, a#j#=_
take a, tmp
arrange tmp, <a>
publish sym:, tmp
jump begin_substruct
unlisted_substruct:
arrange tmp,
take a, tmp
begin_substruct:
compute tmp, 0
take j, tmp
compute tmp, 0
take u, tmp
exit
close:
check u
jno close_struct
arrange tmp, =__union_end
arrange sym, pname.=__statement#i
publish sym:, tmp
assemble tmp
compute i, i + 1
take , a
take , u
exit
close_struct:
take , a
take , j
take , u
take a, a
jyes done
asm end namespace
arrange sym, pname.=__size__
compute tmp, $
publish sym:, tmp
arrange tmp, #sym
arrange sym, =sizeof.pname
publish sym, tmp
asm end virtual
assemble statement
done:
end calminstruction
end namespace
macro struct? declaration*, attributes
if defined Struct.CheckAlignment & Struct.CheckAlignment
struct?.packed = 0
else
struct?.packed = 1
end if
match =packed?, attributes
struct?.packed = 1
else match any, attributes
err 'unknown attribute ',`any
end match
define struct?.pname declaration
struct?.i = 0
mvstruc ?, struct?.collect?
mvmacro ?, struct?.collect?
end macro
macro ends?
mvmacro struct?.collect?, ?
mvstruc struct?.collect?, ?
match name, struct?.pname
label name: name.__size__ at name.__size__
struct?.check name
local sname
define sname name
calminstruction (instance) name values&
call struct?.instantiate, instance, sname, values
end calminstruction
calminstruction name &values&
local ic, iname
init ic
compute ic, ic + 1
arrange iname, sname#ic
call struct?.instantiate, iname, sname, values
end calminstruction
end match
end macro
macro __union_start
local union
union:
union.i = 0
union.size = 0
union.initialized = 0
macro __union_open
union.i = union.i + 1
if (defined union.init & union.i <> union.init) | (~ defined union.init & union.i > 1)
virtual at union
end if
end macro
macro __union_close
if $@ > union
if union.i > 1
union.init := union.i
end if
if union.initialized
err 'conflicting initialization of union'
else
union.initialized = union.i
end if
end if
if $ - union > union.size
union.size = $ - union
end if
if (defined union.init & union.i <> union.init) | (~ defined union.init & union.i > 1)
end virtual
end if
end macro
macro __union_divider
__union_close
__union_open
end macro
macro __union_end
__union_close
if $ - union < union.size
rb union.size - ($ - union)
end if
purge __union_open,__union_close,__union_divider,__union_end
end macro
__union_open
end macro
calminstruction breakifndef? sym
transform sym
jyes ok
asm break
ok:
end calminstruction
macro struct?.check name
if ~ struct?.packed
local alignment, maxalignment
maxalignment = 1
while 1
breakifndef name.__statement#%
match label, name.__label#%
if defined name.label
local alignment
alignment = 1
if sizeof name.label > 0
alignment = 1 shl (bsf sizeof name.label)
end if
match type, name.__definition#%
if defined type.__alignment
alignment = type.__alignment
end if
end match
if name.label mod alignment > 0
repeat 1, natural: alignment
display 'warning: ',`name,'.',`label,' not aligned to its natural boundary (',`natural,')',13,10
end repeat
else if alignment > maxalignment
maxalignment = alignment
end if
end if
end match
end while
if sizeof name mod maxalignment > 0
repeat 1, size: sizeof name, natural: maxalignment
display 'warning: size of ',`name,' (',`size,') not aligned to its natural boundary (',`natural,')',13,10
end repeat
end if
name.__alignment := maxalignment
end if
end macro

View File

@ -0,0 +1,340 @@
; ADVAPI32 API calls parameters' count
AbortSystemShutdown% = 1
AccessCheck% = 8
AccessCheckAndAuditAlarm% = 11
AccessCheckByType% = 11
AccessCheckByTypeAndAuditAlarm% = 16
AccessCheckByTypeResultList% = 11
AccessCheckByTypeResultListAndAuditAlarm% = 16
AddAccessAllowedAce% = 4
AddAccessAllowedAceEx% = 5
AddAccessAllowedObjectAce% = 7
AddAccessDeniedAce% = 4
AddAccessDeniedAceEx% = 5
AddAccessDeniedObjectAce% = 7
AddAce% = 5
AddAuditAccessAce% = 6
AddAuditAccessAceEx% = 7
AddAuditAccessObjectAce% = 9
AdjustTokenGroups% = 6
AdjustTokenPrivileges% = 6
AllocateAndInitializeSid% = 11
AllocateLocallyUniqueId% = 1
AreAllAccessesGranted% = 2
AreAnyAccessesGranted% = 2
BackupEventLog% = 2
BuildExplicitAccessWithName% = 5
BuildImpersonateExplicitAccessWithName% = 6
BuildImpersonateTrustee% = 2
BuildSecurityDescriptor% = 9
BuildTrusteeWithName% = 2
BuildTrusteeWithSid% = 2
CancelOverlappedAccess% = 1
ChangeServiceConfig2% = 3
ChangeServiceConfig% = 11
ClearEventLog% = 2
CloseEventLog% = 1
CloseRaw% = 1
CloseServiceHandle% = 1
ControlService% = 3
ConvertAccessToSecurityDescriptor% = 5
ConvertSecurityDescriptorToAccess% = 7
ConvertSecurityDescriptorToAccessNamed% = 7
ConvertToAutoInheritPrivateObjectSecurity% = 6
CopySid% = 3
CreatePrivateObjectSecurity% = 6
CreatePrivateObjectSecurityEx% = 8
CreateProcessAsUser% = 11
CreateRestrictedToken% = 9
CreateService% = 13
CryptAcquireContext% = 5
CryptContextAddRef% = 3
CryptCreateHash% = 5
CryptDecrypt% = 6
CryptDeriveKey% = 5
CryptDestroyHash% = 1
CryptDestroyKey% = 1
CryptDuplicateHash% = 4
CryptDuplicateKey% = 4
CryptEncrypt% = 7
CryptEnumProviderTypes% = 6
CryptEnumProviders% = 6
CryptExportKey% = 6
CryptGenKey% = 4
CryptGenRandom% = 3
CryptGetDefaultProvider% = 5
CryptGetHashParam% = 5
CryptGetKeyParam% = 5
CryptGetProvParam% = 5
CryptGetUserKey% = 3
CryptHashData% = 4
CryptHashSessionKey% = 3
CryptImportKey% = 6
CryptReleaseContext% = 2
CryptSetHashParam% = 4
CryptSetKeyParam% = 4
CryptSetProvParam% = 4
CryptSetProvider% = 2
CryptSetProviderEx% = 4
CryptSignHash% = 6
CryptVerifySignature% = 6
DecryptFile% = 2
DeleteAce% = 2
DeleteService% = 1
DeregisterEventSource% = 1
DestroyPrivateObjectSecurity% = 1
DuplicateToken% = 3
DuplicateTokenEx% = 6
ElfBackupEventLogFile% = 2
ElfChangeNotify% = 2
ElfClearEventLogFile% = 2
ElfCloseEventLog% = 1
ElfDeregisterEventSource% = 1
ElfNumberOfRecords% = 2
ElfOldestRecord% = 2
ElfOpenBackupEventLog% = 3
ElfOpenEventLog% = 3
ElfReadEventLog% = 7
ElfRegisterEventSource% = 3
ElfReportEvent% = 12
EncryptFile% = 1
EnumDependentServices% = 6
EnumServicesStatus% = 8
EqualPrefixSid% = 2
EqualSid% = 2
FindFirstFreeAce% = 2
FreeSid% = 1
GetAccessPermissionsForObject% = 9
GetAce% = 3
GetAclInformation% = 4
GetAuditedPermissionsFromAcl% = 4
GetCurrentHwProfile% = 1
GetEffectiveRightsFromAcl% = 3
GetExplicitEntriesFromAcl% = 3
GetFileSecurity% = 5
GetKernelObjectSecurity% = 5
GetLengthSid% = 1
GetMultipleTrustee% = 1
GetMultipleTrusteeOperation% = 1
GetNamedSecurityInfo% = 8
GetNamedSecurityInfoEx% = 9
GetNumberOfEventLogRecords% = 2
GetOldestEventLogRecord% = 2
GetOverlappedAccessResults% = 4
GetPrivateObjectSecurity% = 5
GetSecurityDescriptorControl% = 3
GetSecurityDescriptorDacl% = 4
GetSecurityDescriptorGroup% = 3
GetSecurityDescriptorLength% = 1
GetSecurityDescriptorOwner% = 3
GetSecurityDescriptorSacl% = 4
GetSecurityInfo% = 8
GetSecurityInfoEx% = 9
GetServiceDisplayName% = 4
GetServiceKeyName% = 4
GetSidLengthRequired% = 1
GetSidSubAuthority% = 2
GetSidSubAuthorityCount% = 1
GetTokenInformation% = 5
GetTrusteeName% = 1
GetTrusteeType% = 1
GetUserName% = 2
I_ScSetServiceBits% = 5
ImpersonateLoggedOnUser% = 1
ImpersonateNamedPipeClient% = 1
ImpersonateSelf% = 1
InitializeAcl% = 3
InitializeSecurityDescriptor% = 2
InitializeSid% = 3
InitiateSystemShutdown% = 5
IsTextUnicode% = 3
IsTokenRestricted% = 1
IsValidAcl% = 1
IsValidSecurityDescriptor% = 1
IsValidSid% = 1
LockServiceDatabase% = 1
LogonUser% = 6
LookupAccountName% = 7
LookupAccountSid% = 7
LookupPrivilegeDisplayName% = 5
LookupPrivilegeName% = 4
LookupPrivilegeValue% = 3
LookupSecurityDescriptorParts% = 7
LsaAddAccountRights% = 4
LsaAddPrivilegesToAccount% = 2
LsaClearAuditLog% = 1
LsaClose% = 1
LsaCreateAccount% = 4
LsaCreateSecret% = 4
LsaCreateTrustedDomain% = 4
LsaCreateTrustedDomainEx% = 5
LsaDelete% = 1
LsaDeleteTrustedDomain% = 2
LsaEnumerateAccountRights% = 4
LsaEnumerateAccounts% = 5
LsaEnumerateAccountsWithUserRight% = 4
LsaEnumeratePrivileges% = 5
LsaEnumeratePrivilegesOfAccount% = 2
LsaEnumerateTrustedDomains% = 5
LsaEnumerateTrustedDomainsEx% = 6
LsaFreeMemory% = 1
LsaGetQuotasForAccount% = 2
LsaGetSystemAccessAccount% = 2
LsaGetUserName% = 2
LsaICLookupNames% = 7
LsaICLookupSids% = 7
LsaIGetTrustedDomainAuthInfoBlobs% = 4
LsaISetTrustedDomainAuthInfoBlobs% = 4
LsaLookupNames% = 5
LsaLookupPrivilegeDisplayName% = 4
LsaLookupPrivilegeName% = 3
LsaLookupPrivilegeValue% = 3
LsaLookupSids% = 5
LsaNtStatusToWinError% = 1
LsaOpenAccount% = 4
LsaOpenPolicy% = 4
LsaOpenSecret% = 4
LsaOpenTrustedDomain% = 4
LsaQueryDomainInformationPolicy% = 3
LsaQueryInfoTrustedDomain% = 3
LsaQueryInformationPolicy% = 3
LsaQueryLocalInformationPolicy% = 3
LsaQuerySecret% = 5
LsaQuerySecurityObject% = 3
LsaQueryTrustedDomainInfo% = 4
LsaQueryTrustedDomainInfoByName% = 4
LsaRemoveAccountRights% = 5
LsaRemovePrivilegesFromAccount% = 3
LsaRetrievePrivateData% = 3
LsaSetDomainInformationPolicy% = 3
LsaSetInformationPolicy% = 3
LsaSetInformationTrustedDomain% = 3
LsaSetLocalInformationPolicy% = 3
LsaSetQuotasForAccount% = 2
LsaSetSecret% = 3
LsaSetSecurityObject% = 3
LsaSetSystemAccessAccount% = 2
LsaSetTrustedDomainInfoByName% = 4
LsaSetTrustedDomainInformation% = 4
LsaStorePrivateData% = 3
MakeAbsoluteSD% = 11
MakeSelfRelativeSD% = 3
MapGenericMask% = 2
NotifyBootConfigStatus% = 1
NotifyChangeEventLog% = 2
ObjectCloseAuditAlarm% = 3
ObjectDeleteAuditAlarm% = 3
ObjectOpenAuditAlarm% = 12
ObjectPrivilegeAuditAlarm% = 6
OpenBackupEventLog% = 2
OpenEventLog% = 2
OpenProcessToken% = 3
OpenRaw% = 3
OpenSCManager% = 3
OpenService% = 3
OpenThreadToken% = 4
PrivilegeCheck% = 3
PrivilegedServiceAuditAlarm% = 5
QueryRecoveryAgents% = 3
QueryServiceConfig2% = 5
QueryServiceConfig% = 4
QueryServiceLockStatus% = 4
QueryServiceObjectSecurity% = 5
QueryServiceStatus% = 2
QueryWindows31FilesMigration% = 1
ReadEventLog% = 7
ReadRaw% = 3
RegCloseKey% = 1
RegConnectRegistry% = 3
RegCreateKey% = 3
RegCreateKeyEx% = 9
RegDeleteKey% = 2
RegDeleteValue% = 2
RegEnumKey% = 4
RegEnumKeyEx% = 8
RegEnumValue% = 8
RegFlushKey% = 1
RegGetKeySecurity% = 4
RegLoadKey% = 3
RegNotifyChangeKeyValue% = 5
RegOpenKey% = 3
RegOpenKeyEx% = 5
RegOverridePredefKey% = 2
RegQueryInfoKey% = 12
RegQueryMultipleValues% = 5
RegQueryValue% = 4
RegQueryValueEx% = 6
RegReplaceKey% = 4
RegRestoreKey% = 3
RegSaveKey% = 3
RegSetKeySecurity% = 3
RegSetValue% = 5
RegSetValueEx% = 6
RegUnLoadKey% = 2
RegisterEventSource% = 2
RegisterServiceCtrlHandler% = 2
ReportEvent% = 9
RevertToSelf% = 0
SetAclInformation% = 4
SetEntriesInAccessList% = 6
SetEntriesInAcl% = 4
SetEntriesInAuditList% = 6
SetFileSecurity% = 3
SetKernelObjectSecurity% = 3
SetNamedSecurityInfo% = 7
SetNamedSecurityInfoEx% = 9
SetPrivateObjectSecurity% = 5
SetPrivateObjectSecurityEx% = 6
SetSecurityDescriptorControl% = 3
SetSecurityDescriptorDacl% = 4
SetSecurityDescriptorGroup% = 3
SetSecurityDescriptorOwner% = 3
SetSecurityDescriptorSacl% = 4
SetSecurityInfo% = 7
SetSecurityInfoEx% = 9
SetServiceBits% = 4
SetServiceObjectSecurity% = 3
SetServiceStatus% = 2
SetThreadToken% = 2
SetTokenInformation% = 4
StartService% = 3
StartServiceCtrlDispatcher% = 1
SynchronizeWindows31FilesAndWindowsNTRegistry% = 4
SystemFunction001% = 3
SystemFunction002% = 3
SystemFunction003% = 2
SystemFunction004% = 3
SystemFunction005% = 3
SystemFunction006% = 2
SystemFunction007% = 2
SystemFunction008% = 3
SystemFunction009% = 3
SystemFunction010% = 3
SystemFunction011% = 3
SystemFunction012% = 3
SystemFunction013% = 3
SystemFunction014% = 3
SystemFunction015% = 3
SystemFunction016% = 3
SystemFunction017% = 3
SystemFunction018% = 3
SystemFunction019% = 3
SystemFunction020% = 3
SystemFunction021% = 3
SystemFunction022% = 3
SystemFunction023% = 3
SystemFunction024% = 3
SystemFunction025% = 3
SystemFunction026% = 3
SystemFunction027% = 3
SystemFunction028% = 2
SystemFunction029% = 2
SystemFunction030% = 2
SystemFunction031% = 2
SystemFunction032% = 2
SystemFunction033% = 2
TrusteeAccessToObject% = 6
UnlockServiceDatabase% = 1
WriteRaw% = 3

View File

@ -0,0 +1,69 @@
; COMCTL32 API calls parameters' count
CreateMappedBitmap% = 5
CreatePropertySheetPage% = 1
CreateStatusWindow% = 4
CreateToolbar% = 8
CreateToolbarEx% = 13
CreateUpDownControl% = 12
DestroyPropertySheetPage% = 1
DrawInsert% = 3
DrawStatusText% = 4
FlatSB_EnableScrollBar% = 3
FlatSB_GetScrollInfo% = 3
FlatSB_GetScrollPos% = 2
FlatSB_GetScrollProp% = 3
FlatSB_GetScrollRange% = 4
FlatSB_SetScrollInfo% = 4
FlatSB_SetScrollPos% = 4
FlatSB_SetScrollProp% = 4
FlatSB_SetScrollRange% = 5
FlatSB_ShowScrollBar% = 3
GetEffectiveClientRect% = 3
ImageList_Add% = 3
ImageList_AddIcon% = 2
ImageList_AddMasked% = 3
ImageList_BeginDrag% = 4
ImageList_Copy% = 5
ImageList_Create% = 5
ImageList_Destroy% = 1
ImageList_DragEnter% = 3
ImageList_DragLeave% = 1
ImageList_DragMove% = 2
ImageList_DragShowNolock% = 1
ImageList_Draw% = 6
ImageList_DrawEx% = 10
ImageList_DrawIndirect% = 1
ImageList_Duplicate% = 1
ImageList_EndDrag% = 0
ImageList_GetBkColor% = 1
ImageList_GetDragImage% = 2
ImageList_GetIcon% = 3
ImageList_GetIconSize% = 3
ImageList_GetImageCount% = 1
ImageList_GetImageInfo% = 3
ImageList_GetImageRect% = 3
ImageList_LoadImage% = 7
ImageList_Merge% = 6
ImageList_Read% = 1
ImageList_Remove% = 2
ImageList_Replace% = 4
ImageList_ReplaceIcon% = 3
ImageList_SetBkColor% = 2
ImageList_SetDragCursorImage% = 4
ImageList_SetFilter% = 3
ImageList_SetIconSize% = 3
ImageList_SetImageCount% = 2
ImageList_SetOverlayImage% = 3
ImageList_Write% = 2
InitCommonControls% = 0
InitCommonControlsEx% = 1
InitializeFlatSB% = 1
LBItemFromPt% = 4
MakeDragList% = 1
MenuHelp% = 7
PropertySheet% = 1
ShowHideMenuCtl% = 3
UninitializeFlatSB% = 1
_TrackMouseEvent% = 1

View File

@ -0,0 +1,18 @@
; COMDLG32 API calls parameters' count
ChooseColor% = 1
ChooseFont% = 1
CommDlgExtendedError% = 0
FindText% = 1
FormatCharDlgProc% = 4
GetFileTitle% = 3
GetOpenFileName% = 1
GetSaveFileName% = 1
LoadAlterBitmap% = 3
PageSetupDlg% = 1
PrintDlg% = 1
ReplaceText% = 1
WantArrows% = 4
dwLBSubclass% = 4
dwOKSubclass% = 4

View File

@ -0,0 +1,319 @@
; GDI32 API calls parameters' count
AbortDoc% = 1
AbortPath% = 1
AddFontMemResourceEx% = 4
AddFontResource% = 1
AddFontResourceEx% = 3
AngleArc% = 6
AnimatePalette% = 4
Arc% = 9
ArcTo% = 9
BeginPath% = 1
BitBlt% = 9
CancelDC% = 1
CheckColorsInGamut% = 4
ChoosePixelFormat% = 2
Chord% = 9
CloseEnhMetaFile% = 1
CloseFigure% = 1
CloseMetaFile% = 1
ColorCorrectPalette% = 4
ColorMatchToTarget% = 3
CombineRgn% = 4
CombineTransform% = 3
CopyEnhMetaFile% = 2
CopyMetaFile% = 2
CreateBitmap% = 5
CreateBitmapIndirect% = 1
CreateBrushIndirect% = 1
CreateColorSpace% = 1
CreateCompatibleBitmap% = 3
CreateCompatibleDC% = 1
CreateDC% = 4
CreateDIBPatternBrush% = 2
CreateDIBPatternBrushPt% = 2
CreateDIBSection% = 6
CreateDIBitmap% = 6
CreateDiscardableBitmap% = 3
CreateEllipticRgn% = 4
CreateEllipticRgnIndirect% = 1
CreateEnhMetaFile% = 4
CreateFont% = 14
CreateFontIndirect% = 1
CreateFontIndirectEx% = 1
CreateHalftonePalette% = 1
CreateHatchBrush% = 2
CreateIC% = 4
CreateMetaFile% = 1
CreatePalette% = 1
CreatePatternBrush% = 1
CreatePen% = 3
CreatePenIndirect% = 1
CreatePolyPolygonRgn% = 4
CreatePolygonRgn% = 3
CreateRectRgn% = 4
CreateRectRgnIndirect% = 1
CreateRoundRectRgn% = 6
CreateScalableFontResource% = 4
CreateSolidBrush% = 1
DPtoLP% = 3
DeleteColorSpace% = 1
DeleteDC% = 1
DeleteEnhMetaFile% = 1
DeleteMetaFile% = 1
DeleteObject% = 1
DescribePixelFormat% = 4
DeviceCapabilitiesEx% = 6
DrawEscape% = 4
Ellipse% = 5
EnableEUDC% = 1
EndDoc% = 1
EndPage% = 1
EndPath% = 1
EnumEnhMetaFile% = 5
EnumFontFamilies% = 4
EnumFontFamiliesEx% = 5
EnumFonts% = 4
EnumICMProfiles% = 3
EnumMetaFile% = 4
EnumObjects% = 4
EqualRgn% = 2
Escape% = 5
ExcludeClipRect% = 5
ExtCreatePen% = 5
ExtCreateRegion% = 3
ExtEscape% = 6
ExtFloodFill% = 5
ExtSelectClipRgn% = 3
ExtTextOut% = 8
FillPath% = 1
FillRgn% = 3
FixBrushOrgEx% = 4
FlattenPath% = 1
FloodFill% = 4
FrameRgn% = 5
GdiComment% = 3
GdiDeleteSpoolFileHandle% = 1
GdiEndDocEMF% = 1
GdiEndPageEMF% = 2
GdiFlush% = 0
GdiGetBatchLimit% = 0
GdiGetDC% = 1
GdiGetDevmodeForPage% = 4
GdiGetPageCount% = 1
GdiGetPageHandle% = 3
GdiGetSpoolFileHandle% = 3
GdiPlayDCScript% = 6
GdiPlayEMF% = 5
GdiPlayJournal% = 5
GdiPlayPageEMF% = 4
GdiPlayPrivatePageEMF% = 3
GdiPlayScript% = 7
GdiResetDCEMF% = 2
GdiSetBatchLimit% = 1
GdiStartDocEMF% = 2
GdiStartPageEMF% = 1
GetArcDirection% = 1
GetAspectRatioFilterEx% = 2
GetBitmapBits% = 3
GetBitmapDimensionEx% = 2
GetBkColor% = 1
GetBkMode% = 1
GetBoundsRect% = 3
GetBrushOrgEx% = 2
GetCharABCWidths% = 4
GetCharABCWidthsFloat% = 4
GetCharABCWidthsI% = 5
GetCharWidth32% = 4
GetCharWidth% = 4
GetCharWidthFloat% = 4
GetCharWidthI% = 5
GetCharacterPlacement% = 6
GetClipBox% = 2
GetClipRgn% = 2
GetColorAdjustment% = 2
GetColorSpace% = 1
GetCurrentObject% = 2
GetCurrentPositionEx% = 2
GetDCBrushColor% = 1
GetDCOrgEx% = 2
GetDCPenColor% = 1
GetDIBColorTable% = 4
GetDIBits% = 7
GetDeviceCaps% = 2
GetDeviceGammaRamp% = 2
GetEnhMetaFile% = 1
GetEnhMetaFileBits% = 3
GetEnhMetaFileDescription% = 3
GetEnhMetaFileHeader% = 3
GetEnhMetaFilePaletteEntries% = 3
GetEnhMetaFilePixelFormat% = 3
GetFontAssocStatus% = 1
GetFontData% = 5
GetFontLanguageInfo% = 1
GetFontUnicodeRanges% = 2
GetGlyphIndices% = 5
GetGlyphOutline% = 7
GetGraphicsMode% = 1
GetICMProfile% = 3
GetKerningPairs% = 3
GetLogColorSpace% = 3
GetMapMode% = 1
GetMetaFile% = 1
GetMetaFileBitsEx% = 3
GetMetaRgn% = 2
GetMiterLimit% = 2
GetNearestColor% = 2
GetNearestPaletteIndex% = 2
GetObject% = 3
GetObjectType% = 1
GetOutlineTextMetrics% = 3
GetPaletteEntries% = 4
GetPath% = 4
GetPixel% = 3
GetPixelFormat% = 1
GetPolyFillMode% = 1
GetROP2% = 1
GetRandomRgn% = 3
GetRasterizerCaps% = 2
GetRegionData% = 3
GetRelAbs% = 2
GetRgnBox% = 2
GetStockObject% = 1
GetStretchBltMode% = 1
GetSystemPaletteEntries% = 4
GetSystemPaletteUse% = 1
GetTextAlign% = 1
GetTextCharacterExtra% = 1
GetTextCharset% = 1
GetTextCharsetInfo% = 3
GetTextColor% = 1
GetTextExtentExPoint% = 7
GetTextExtentExPointI% = 7
GetTextExtentPoint32% = 4
GetTextExtentPoint% = 4
GetTextExtentPointI% = 4
GetTextFace% = 3
GetTextMetrics% = 2
GetViewportExtEx% = 2
GetViewportOrgEx% = 2
GetWinMetaFileBits% = 5
GetWindowExtEx% = 2
GetWindowOrgEx% = 2
GetWorldTransform% = 2
IntersectClipRect% = 5
InvertRgn% = 2
LPtoDP% = 3
LineDD% = 6
LineTo% = 3
MaskBlt% = 12
ModifyWorldTransform% = 3
MoveToEx% = 4
OffsetClipRgn% = 3
OffsetRgn% = 3
OffsetViewportOrgEx% = 4
OffsetWindowOrgEx% = 4
PaintRgn% = 2
PatBlt% = 6
PathToRegion% = 1
Pie% = 9
PlayEnhMetaFile% = 3
PlayEnhMetaFileRecord% = 4
PlayMetaFile% = 2
PlayMetaFileRecord% = 4
PlgBlt% = 10
PolyBezier% = 3
PolyBezierTo% = 3
PolyDraw% = 4
PolyPatBlt% = 5
PolyPolygon% = 4
PolyPolyline% = 4
PolyTextOut% = 3
Polygon% = 3
Polyline% = 3
PolylineTo% = 3
PtInRegion% = 3
PtVisible% = 3
RealizePalette% = 1
RectInRegion% = 2
RectVisible% = 2
Rectangle% = 5
RemoveFontMemResourceEx% = 1
RemoveFontResource% = 1
RemoveFontResourceEx% = 3
ResetDC% = 2
ResizePalette% = 2
RestoreDC% = 2
RoundRect% = 7
SaveDC% = 1
ScaleViewportExtEx% = 6
ScaleWindowExtEx% = 6
SelectBrushLocal% = 2
SelectClipPath% = 2
SelectClipRgn% = 2
SelectFontLocal% = 2
SelectObject% = 2
SelectPalette% = 3
SetAbortProc% = 2
SetArcDirection% = 2
SetBitmapBits% = 3
SetBitmapDimensionEx% = 4
SetBkColor% = 2
SetBkMode% = 2
SetBoundsRect% = 3
SetBrushOrgEx% = 4
SetColorAdjustment% = 2
SetColorSpace% = 2
SetDCBrushColor% = 2
SetDCPenColor% = 2
SetDIBColorTable% = 4
SetDIBits% = 7
SetDIBitsToDevice% = 12
SetDeviceGammaRamp% = 2
SetEnhMetaFileBits% = 2
SetFontEnumeration% = 1
SetGraphicsMode% = 2
SetICMMode% = 2
SetICMProfile% = 2
SetMagicColors% = 3
SetMapMode% = 2
SetMapperFlags% = 2
SetMetaFileBitsEx% = 2
SetMetaRgn% = 1
SetMiterLimit% = 3
SetPaletteEntries% = 4
SetPixel% = 4
SetPixelFormat% = 3
SetPixelV% = 4
SetPolyFillMode% = 2
SetROP2% = 2
SetRectRgn% = 5
SetRelAbs% = 2
SetStretchBltMode% = 2
SetSystemPaletteUse% = 2
SetTextAlign% = 2
SetTextCharacterExtra% = 2
SetTextColor% = 2
SetTextJustification% = 3
SetViewportExtEx% = 4
SetViewportOrgEx% = 4
SetWinMetaFileBits% = 4
SetWindowExtEx% = 4
SetWindowOrgEx% = 4
SetWorldTransform% = 2
StartDoc% = 2
StartPage% = 1
StretchBlt% = 11
StretchDIBits% = 13
StrokeAndFillPath% = 1
StrokePath% = 1
SwapBuffers% = 1
TextOut% = 5
TranslateCharsetInfo% = 3
UnrealizeObject% = 1
UpdateColors% = 1
UpdateICMRegKey% = 4
WidenPath% = 1
gdiPlaySpoolStream% = 6

View File

@ -0,0 +1,557 @@
; KERNEL32 API calls parameters' count
AddAtom% = 1
AddConsoleAlias% = 3
AllocConsole% = 0
AreFileApisANSI% = 0
AssignProcessToJobObject% = 2
BackupRead% = 7
BackupSeek% = 6
BackupWrite% = 7
BaseAttachCompleteThunk% = 0
Beep% = 2
BeginUpdateResource% = 2
BuildCommDCB% = 2
BuildCommDCBAndTimeouts% = 3
CallNamedPipe% = 7
CancelIo% = 1
CancelWaitableTimer% = 1
ClearCommBreak% = 1
ClearCommError% = 3
CloseConsoleHandle% = 1
CloseHandle% = 1
CloseProfileUserMapping% = 0
CmdBatNotification% = 1
CommConfigDialog% = 3
CompareFileTime% = 2
CompareString% = 6
ConnectNamedPipe% = 2
ConsoleMenuControl% = 3
ContinueDebugEvent% = 3
ConvertDefaultLocale% = 1
ConvertThreadToFiber% = 1
CopyFile% = 3
CopyFileEx% = 6
CreateConsoleScreenBuffer% = 5
CreateDirectory% = 2
CreateDirectoryEx% = 3
CreateEvent% = 4
CreateFiber% = 3
CreateFile% = 7
CreateFileMapping% = 6
CreateHardLink% = 3
CreateIoCompletionPort% = 4
CreateJobObject% = 2
CreateMailslot% = 4
CreateMutex% = 3
CreateNamedPipe% = 8
CreatePipe% = 4
CreateProcess% = 10
CreateRemoteThread% = 7
CreateSemaphore% = 4
CreateTapePartition% = 4
CreateThread% = 6
CreateToolhelp32Snapshot% = 2
CreateVirtualBuffer% = 3
CreateWaitableTimer% = 3
DebugActiveProcess% = 1
DebugBreak% = 0
DefineDosDevice% = 3
DeleteAtom% = 1
DeleteCriticalSection% = 1
DeleteFiber% = 1
DeleteFile% = 1
DeviceIoControl% = 8
DisableThreadLibraryCalls% = 1
DisconnectNamedPipe% = 1
DosDateTimeToFileTime% = 3
DuplicateConsoleHandle% = 4
DuplicateHandle% = 7
EndUpdateResource% = 2
EnterCriticalSection% = 1
EnumCalendarInfo% = 4
EnumCalendarInfoEx% = 4
EnumDateFormats% = 3
EnumDateFormatsEx% = 3
EnumResourceLanguages% = 5
EnumResourceNames% = 4
EnumResourceTypes% = 3
EnumSystemCodePages% = 2
EnumSystemLocales% = 2
EnumTimeFormats% = 3
EraseTape% = 3
EscapeCommFunction% = 2
ExitProcess% = 1
ExitThread% = 1
ExitVDM% = 2
ExpandEnvironmentStrings% = 3
ExpungeConsoleCommandHistory% = 1
ExtendVirtualBuffer% = 2
FatalAppExit% = 2
FatalExit% = 1
FileTimeToDosDateTime% = 3
FileTimeToLocalFileTime% = 2
FileTimeToSystemTime% = 2
FillConsoleOutputAttribute% = 5
FillConsoleOutputCharacter% = 5
FindAtom% = 1
FindClose% = 1
FindCloseChangeNotification% = 1
FindFirstChangeNotification% = 3
FindFirstFile% = 2
FindFirstFileEx% = 6
FindNextChangeNotification% = 1
FindNextFile% = 2
FindResource% = 3
FindResourceEx% = 4
FlushConsoleInputBuffer% = 1
FlushFileBuffers% = 1
FlushInstructionCache% = 3
FlushViewOfFile% = 2
FoldString% = 5
FormatMessage% = 7
FreeConsole% = 0
FreeEnvironmentStrings% = 1
FreeLibrary% = 1
FreeLibraryAndExitThread% = 2
FreeResource% = 1
FreeVirtualBuffer% = 1
GenerateConsoleCtrlEvent% = 2
GetACP% = 0
GetAtomName% = 3
GetBinaryType% = 2
GetCPInfo% = 2
GetCPInfoEx% = 3
GetCommConfig% = 3
GetCommMask% = 2
GetCommModemStatus% = 2
GetCommProperties% = 2
GetCommState% = 2
GetCommTimeouts% = 2
GetCommandLine% = 0
GetCompressedFileSize% = 2
GetComputerName% = 2
GetConsoleAlias% = 4
GetConsoleAliasExes% = 2
GetConsoleAliasExesLength% = 0
GetConsoleAliases% = 3
GetConsoleAliasesLength% = 1
GetConsoleCP% = 0
GetConsoleCommandHistory% = 3
GetConsoleCommandHistoryLength% = 1
GetConsoleCursorInfo% = 2
GetConsoleDisplayMode% = 1
GetConsoleFontInfo% = 4
GetConsoleFontSize% = 2
GetConsoleHardwareState% = 3
GetConsoleInputExeName% = 2
GetConsoleInputWaitHandle% = 0
GetConsoleKeyboardLayoutName% = 1
GetConsoleMode% = 2
GetConsoleOutputCP% = 0
GetConsoleScreenBufferInfo% = 2
GetConsoleTitle% = 2
GetConsoleWindow% = 0
GetCurrencyFormat% = 6
GetCurrentConsoleFont% = 3
GetCurrentDirectory% = 2
GetCurrentProcess% = 0
GetCurrentProcessId% = 0
GetCurrentThread% = 0
GetCurrentThreadId% = 0
GetDateFormat% = 6
GetDefaultCommConfig% = 3
GetDevicePowerState% = 1
GetDiskFreeSpace% = 5
GetDiskFreeSpaceEx% = 4
GetDriveType% = 1
GetEnvironmentStrings% = 0
GetEnvironmentVariable% = 3
GetExitCodeProcess% = 2
GetExitCodeThread% = 2
GetFileAttributes% = 1
GetFileAttributesEx% = 3
GetFileInformationByHandle% = 2
GetFileSize% = 2
GetFileTime% = 4
GetFileType% = 1
GetFullPathName% = 4
GetHandleInformation% = 2
GetLargestConsoleWindowSize% = 1
GetLastError% = 0
GetLocalTime% = 1
GetLocaleInfo% = 4
GetLogicalDriveStrings% = 2
GetLogicalDrives% = 0
GetLongPathName% = 3
GetMailslotInfo% = 5
GetModuleFileName% = 3
GetModuleHandle% = 1
GetNamedPipeHandleState% = 7
GetNamedPipeInfo% = 5
GetNextVDMCommand% = 1
GetNumberFormat% = 6
GetNumberOfConsoleFonts% = 0
GetNumberOfConsoleInputEvents% = 2
GetNumberOfConsoleMouseButtons% = 1
GetOEMCP% = 0
GetOverlappedResult% = 4
GetPriorityClass% = 1
GetPrivateProfileInt% = 4
GetPrivateProfileSection% = 4
GetPrivateProfileSectionNames% = 3
GetPrivateProfileString% = 6
GetPrivateProfileStruct% = 5
GetProcAddress% = 2
GetProcessAffinityMask% = 3
GetProcessHeap% = 0
GetProcessHeaps% = 2
GetProcessPriorityBoost% = 2
GetProcessShutdownParameters% = 2
GetProcessTimes% = 5
GetProcessVersion% = 1
GetProcessWorkingSetSize% = 3
GetProfileInt% = 3
GetProfileSection% = 3
GetProfileString% = 5
GetQueuedCompletionStatus% = 5
GetShortPathName% = 3
GetStartupInfo% = 1
GetStdHandle% = 1
GetStringType% = 5
GetStringTypeEx% = 5
GetSystemDefaultLCID% = 0
GetSystemDefaultLangID% = 0
GetSystemDirectory% = 2
GetSystemInfo% = 1
GetSystemPowerStatus% = 1
GetSystemTime% = 1
GetSystemTimeAdjustment% = 3
GetSystemTimeAsFileTime% = 1
GetTapeParameters% = 4
GetTapePosition% = 5
GetTapeStatus% = 1
GetTempFileName% = 4
GetTempPath% = 2
GetThreadContext% = 2
GetThreadLocale% = 0
GetThreadPriority% = 1
GetThreadPriorityBoost% = 2
GetThreadSelectorEntry% = 3
GetThreadTimes% = 5
GetTickCount% = 0
GetTimeFormat% = 6
GetTimeZoneInformation% = 1
GetUserDefaultLCID% = 0
GetUserDefaultLangID% = 0
GetVDMCurrentDirectories% = 2
GetVersion% = 0
GetVersionEx% = 1
GetVolumeInformation% = 8
GetWindowsDirectory% = 2
GlobalAddAtom% = 1
GlobalAlloc% = 2
GlobalCompact% = 1
GlobalDeleteAtom% = 1
GlobalFindAtom% = 1
GlobalFix% = 1
GlobalFlags% = 1
GlobalFree% = 1
GlobalGetAtomName% = 3
GlobalHandle% = 1
GlobalLock% = 1
GlobalMemoryStatus% = 1
GlobalMemoryStatusVlm% = 1
GlobalReAlloc% = 3
GlobalSize% = 1
GlobalUnWire% = 1
GlobalUnfix% = 1
GlobalUnlock% = 1
GlobalWire% = 1
Heap32First% = 3
Heap32ListFirst% = 2
Heap32ListNext% = 2
Heap32Next% = 1
HeapAlloc% = 3
HeapCompact% = 2
HeapCreate% = 3
HeapDestroy% = 1
HeapExtend% = 4
HeapFree% = 3
HeapLock% = 1
HeapReAlloc% = 4
HeapSize% = 3
HeapSummary% = 3
HeapUnlock% = 1
HeapUsage% = 5
HeapValidate% = 3
HeapWalk% = 2
InitAtomTable% = 1
InitializeCriticalSection% = 1
InitializeCriticalSectionAndSpinCount% = 2
InterlockedCompareExchange% = 3
InterlockedDecrement% = 1
InterlockedExchange% = 2
InterlockedExchangeAdd% = 2
InterlockedIncrement% = 1
InvalidateConsoleDIBits% = 2
IsBadCodePtr% = 1
IsBadHugeReadPtr% = 2
IsBadHugeWritePtr% = 2
IsBadReadPtr% = 2
IsBadStringPtr% = 2
IsBadWritePtr% = 2
IsDBCSLeadByte% = 1
IsDBCSLeadByteEx% = 2
IsDebuggerPresent% = 0
IsProcessorFeaturePresent% = 1
IsValidCodePage% = 1
IsValidLocale% = 2
LCMapString% = 6
LeaveCriticalSection% = 1
LoadLibrary% = 1
LoadLibraryEx% = 3
LoadModule% = 2
LoadResource% = 2
LocalAlloc% = 2
LocalCompact% = 1
LocalFileTimeToFileTime% = 2
LocalFlags% = 1
LocalFree% = 1
LocalHandle% = 1
LocalLock% = 1
LocalReAlloc% = 3
LocalShrink% = 2
LocalSize% = 1
LocalUnlock% = 1
LockFile% = 5
LockFileEx% = 6
LockResource% = 1
MapViewOfFile% = 5
MapViewOfFileEx% = 6
MapViewOfFileVlm% = 7
Module32First% = 2
Module32Next% = 2
MoveFile% = 2
MoveFileEx% = 3
MoveFileWithProgress% = 5
MulDiv% = 3
MultiByteToWideChar% = 6
OpenEvent% = 3
OpenFile% = 3
OpenFileMapping% = 3
OpenJobObject% = 3
OpenMutex% = 3
OpenProcess% = 3
OpenProfileUserMapping% = 0
OpenSemaphore% = 3
OpenWaitableTimer% = 3
OutputDebugString% = 1
PeekConsoleInput% = 4
PeekNamedPipe% = 6
PostQueuedCompletionStatus% = 4
PrepareTape% = 3
Process32First% = 2
Process32Next% = 2
PulseEvent% = 1
PurgeComm% = 2
QueryDosDevice% = 3
QueryInformationJobObject% = 5
QueryPerformanceCounter% = 1
QueryPerformanceFrequency% = 1
QueryWin31IniFilesMappedToRegistry% = 4
QueueUserAPC% = 3
RaiseException% = 4
ReadConsole% = 5
ReadConsoleInput% = 4
ReadConsoleInputEx% = 5
ReadConsoleOutput% = 5
ReadConsoleOutputAttribute% = 5
ReadConsoleOutputCharacter% = 5
ReadFile% = 5
ReadFileEx% = 5
ReadFileScatter% = 5
ReadFileVlm% = 5
ReadProcessMemory% = 5
ReadProcessMemoryVlm% = 5
RegisterConsoleVDM% = 11
RegisterWaitForInputIdle% = 1
RegisterWowBaseHandlers% = 1
RegisterWowExec% = 1
ReleaseMutex% = 1
ReleaseSemaphore% = 3
RemoveDirectory% = 1
RequestWakeupLatency% = 1
ResetEvent% = 1
ResumeThread% = 1
RtlFillMemory% = 3
RtlMoveMemory% = 3
RtlUnwind% = 4
RtlZeroMemory% = 2
ScrollConsoleScreenBuffer% = 5
SearchPath% = 6
SetCommBreak% = 1
SetCommConfig% = 3
SetCommMask% = 2
SetCommState% = 2
SetCommTimeouts% = 2
SetComputerName% = 1
SetConsoleActiveScreenBuffer% = 1
SetConsoleCP% = 1
SetConsoleCommandHistoryMode% = 1
SetConsoleCtrlHandler% = 2
SetConsoleCursor% = 2
SetConsoleCursorInfo% = 2
SetConsoleCursorPosition% = 2
SetConsoleDisplayMode% = 3
SetConsoleFont% = 2
SetConsoleHardwareState% = 3
SetConsoleIcon% = 1
SetConsoleInputExeName% = 1
SetConsoleKeyShortcuts% = 4
SetConsoleMaximumWindowSize% = 2
SetConsoleMenuClose% = 1
SetConsoleMode% = 2
SetConsoleNumberOfCommands% = 2
SetConsoleOutputCP% = 1
SetConsolePalette% = 3
SetConsoleScreenBufferSize% = 2
SetConsoleTextAttribute% = 2
SetConsoleTitle% = 1
SetConsoleWindowInfo% = 3
SetCriticalSectionSpinCount% = 2
SetCurrentDirectory% = 1
SetDefaultCommConfig% = 3
SetEndOfFile% = 1
SetEnvironmentVariable% = 2
SetErrorMode% = 1
SetEvent% = 1
SetFileApisToANSI% = 0
SetFileApisToOEM% = 0
SetFileAttributes% = 2
SetFilePointer% = 4
SetFileTime% = 4
SetHandleCount% = 1
SetHandleInformation% = 3
SetInformationJobObject% = 4
SetLastConsoleEventActive% = 0
SetLastError% = 1
SetLocalTime% = 1
SetLocaleInfo% = 3
SetMailslotInfo% = 2
SetNamedPipeHandleState% = 4
SetPriorityClass% = 2
SetProcessAffinityMask% = 2
SetProcessPriorityBoost% = 2
SetProcessShutdownParameters% = 2
SetProcessWorkingSetSize% = 3
SetStdHandle% = 2
SetSystemPowerState% = 2
SetSystemTime% = 1
SetSystemTimeAdjustment% = 2
SetTapeParameters% = 3
SetTapePosition% = 6
SetThreadAffinityMask% = 2
SetThreadContext% = 2
SetThreadExecutionState% = 1
SetThreadIdealProcessor% = 2
SetThreadLocale% = 1
SetThreadPriority% = 2
SetThreadPriorityBoost% = 2
SetTimeZoneInformation% = 1
SetUnhandledExceptionFilter% = 1
SetVDMCurrentDirectories% = 2
SetVolumeLabel% = 2
SetWaitableTimer% = 6
SetupComm% = 3
ShowConsoleCursor% = 2
SignalObjectAndWait% = 4
SizeofResource% = 2
Sleep% = 1
SleepEx% = 2
SuspendThread% = 1
SwitchToFiber% = 1
SwitchToThread% = 0
SystemTimeToFileTime% = 2
SystemTimeToTzSpecificLocalTime% = 3
TerminateJobObject% = 2
TerminateProcess% = 2
TerminateThread% = 2
Thread32First% = 2
Thread32Next% = 2
TlsAlloc% = 0
TlsFree% = 1
TlsGetValue% = 1
TlsSetValue% = 2
Toolhelp32ReadProcessMemory% = 5
TransactNamedPipe% = 7
TransmitCommChar% = 2
TrimVirtualBuffer% = 1
TryEnterCriticalSection% = 1
UnhandledExceptionFilter% = 1
UnlockFile% = 5
UnlockFileEx% = 5
UnmapViewOfFile% = 1
UnmapViewOfFileVlm% = 1
UpdateResource% = 6
VDMConsoleOperation% = 2
VDMOperationStarted% = 1
VerLanguageName% = 3
VerifyConsoleIoHandle% = 1
VirtualAlloc% = 4
VirtualAllocEx% = 5
VirtualAllocVlm% = 6
VirtualBufferExceptionHandler% = 3
VirtualFree% = 3
VirtualFreeEx% = 4
VirtualFreeVlm% = 5
VirtualLock% = 2
VirtualProtect% = 4
VirtualProtectEx% = 5
VirtualProtectVlm% = 6
VirtualQuery% = 3
VirtualQueryEx% = 4
VirtualQueryVlm% = 4
VirtualUnlock% = 2
WaitCommEvent% = 3
WaitForDebugEvent% = 2
WaitForMultipleObjects% = 4
WaitForMultipleObjectsEx% = 5
WaitForSingleObject% = 2
WaitForSingleObjectEx% = 3
WaitNamedPipe% = 2
WideCharToMultiByte% = 8
WinExec% = 2
WriteConsole% = 5
WriteConsoleInput% = 4
WriteConsoleInputVDM% = 4
WriteConsoleOutput% = 5
WriteConsoleOutputAttribute% = 5
WriteConsoleOutputCharacter% = 5
WriteFile% = 5
WriteFileEx% = 5
WriteFileGather% = 5
WriteFileVlm% = 5
WritePrivateProfileSection% = 3
WritePrivateProfileString% = 4
WritePrivateProfileStruct% = 5
WriteProcessMemory% = 5
WriteProcessMemoryVlm% = 5
WriteProfileSection% = 2
WriteProfileString% = 3
WriteTapemark% = 4
_hread% = 3
_hwrite% = 3
_lclose% = 1
_lcreat% = 2
_llseek% = 3
_lopen% = 2
_lread% = 3
_lwrite% = 3
lstrcat% = 2
lstrcmp% = 2
lstrcmpi% = 2
lstrcpy% = 2
lstrcpyn% = 3
lstrlen% = 1

View File

@ -0,0 +1,73 @@
; SHELL32 API calls parameters' count
CheckEscapes% = 2
DoEnvironmentSubst% = 2
DragAcceptFiles% = 2
DragFinish% = 1
DragQueryFile% = 4
DragQueryPoint% = 2
DuplicateIcon% = 2
ExtractAssociatedIcon% = 3
ExtractAssociatedIconEx% = 4
ExtractIcon% = 3
ExtractIconEx% = 5
ExtractIconResInfo% = 5
FindExeDlgProc% = 4
FindExecutable% = 3
FreeIconList% = 2
InternalExtractIconList% = 3
RealShellExecute% = 10
RealShellExecuteEx% = 11
RegenerateUserEnvironment% = 2
SHAddToRecentDocs% = 2
SHAppBarMessage% = 2
SHBrowseForFolder% = 1
SHChangeNotify% = 4
SHEmptyRecycleBin% = 3
SHFileOperation% = 1
SHFormatDrive% = 4
SHFreeNameMappings% = 1
SHGetDataFromIDList% = 5
SHGetDesktopFolder% = 1
SHGetDiskFreeSpace% = 4
SHGetFileInfo% = 5
SHGetInstanceExplorer% = 1
SHGetMalloc% = 1
SHGetNewLinkInfo% = 5
SHGetPathFromIDList% = 2
SHGetSettings% = 2
SHGetSpecialFolderLocation% = 3
SHGetSpecialFolderPath% = 4
SHInvokePrinterCommand% = 5
SHLoadInProc% = 1
SHQueryRecycleBin% = 2
SHUpdateRecycleBinIcon% = 0
SheChangeDir% = 1
SheChangeDirEx% = 1
SheFullPath% = 3
SheGetCurDrive% = 0
SheGetDir% = 2
SheRemoveQuotes% = 1
SheSetCurDrive% = 1
SheShortenPath% = 2
ShellAbout% = 4
ShellExecute% = 6
ShellExecuteEx% = 1
ShellHookProc% = 3
Shell_NotifyIcon% = 2
StrChr% = 2
StrChrI% = 2
StrCmpN% = 3
StrCmpNI% = 3
StrCpyN% = 3
StrNCmp% = 3
StrNCmpI% = 3
StrNCpy% = 3
StrRChr% = 3
StrRChrI% = 3
StrRStr% = 3
StrRStrI% = 3
StrStr% = 2
StrStrI% = 2
WOWShellExecute% = 7

View File

@ -0,0 +1,477 @@
; USER32 API calls parameters' count
ActivateKeyboardLayout% = 2
AdjustWindowRect% = 3
AdjustWindowRectEx% = 4
AnimateWindow% = 3
AnyPopup% = 0
AppendMenu% = 4
ArrangeIconicWindows% = 1
AttachThreadInput% = 3
BeginDeferWindowPos% = 1
BeginPaint% = 2
BlockInput% = 1
BringWindowToTop% = 1
BroadcastSystemMessage% = 5
CallMsgFilter% = 2
CallNextHookEx% = 4
CallWindowProc% = 5
CascadeChildWindows% = 2
CascadeWindows% = 5
ChangeClipboardChain% = 2
ChangeDisplaySettings% = 2
ChangeDisplaySettingsEx% = 5
ChangeMenu% = 5
CharLower% = 1
CharLowerBuff% = 2
CharNext% = 1
CharNextEx% = 3
CharPrev% = 2
CharPrevEx% = 4
CharToOem% = 2
CharToOemBuff% = 3
CharUpper% = 1
CharUpperBuff% = 2
CheckDlgButton% = 3
CheckMenuItem% = 3
CheckMenuRadioItem% = 5
CheckRadioButton% = 4
ChildWindowFromPoint% = 3
ChildWindowFromPointEx% = 4
ClientToScreen% = 2
ClipCursor% = 1
CloseClipboard% = 0
CloseDesktop% = 1
CloseWindow% = 1
CloseWindowStation% = 1
CopyAcceleratorTable% = 3
CopyIcon% = 1
CopyImage% = 5
CopyRect% = 2
CountClipboardFormats% = 0
CreateAcceleratorTable% = 2
CreateCaret% = 4
CreateCursor% = 7
CreateDesktop% = 6
CreateDialogIndirectParam% = 5
CreateDialogParam% = 5
CreateIcon% = 7
CreateIconFromResource% = 4
CreateIconFromResourceEx% = 7
CreateIconIndirect% = 1
CreateMDIWindow% = 10
CreateMenu% = 0
CreatePopupMenu% = 0
CreateWindowEx% = 12
CreateWindowStation% = 4
DdeAbandonTransaction% = 3
DdeAccessData% = 2
DdeAddData% = 4
DdeClientTransaction% = 8
DdeCmpStringHandles% = 2
DdeConnect% = 4
DdeConnectList% = 5
DdeCreateDataHandle% = 7
DdeCreateStringHandle% = 3
DdeDisconnect% = 1
DdeDisconnectList% = 1
DdeEnableCallback% = 3
DdeFreeDataHandle% = 1
DdeFreeStringHandle% = 2
DdeGetData% = 4
DdeGetLastError% = 1
DdeGetQualityOfService% = 3
DdeImpersonateClient% = 1
DdeInitialize% = 4
DdeKeepStringHandle% = 2
DdeNameService% = 4
DdePostAdvise% = 3
DdeQueryConvInfo% = 3
DdeQueryNextServer% = 2
DdeQueryString% = 5
DdeReconnect% = 1
DdeSetQualityOfService% = 3
DdeSetUserHandle% = 3
DdeUnaccessData% = 1
DdeUninitialize% = 1
DefDlgProc% = 4
DefFrameProc% = 5
DefMDIChildProc% = 4
DefWindowProc% = 4
DeferWindowPos% = 8
DeleteMenu% = 3
DestroyAcceleratorTable% = 1
DestroyCaret% = 0
DestroyCursor% = 1
DestroyIcon% = 1
DestroyMenu% = 1
DestroyWindow% = 1
DialogBoxIndirectParam% = 5
DialogBoxParam% = 5
DispatchMessage% = 1
DlgDirList% = 5
DlgDirListComboBox% = 5
DlgDirSelectComboBoxEx% = 4
DlgDirSelectEx% = 4
DragDetect% = 3
DragObject% = 5
DrawAnimatedRects% = 4
DrawCaption% = 4
DrawEdge% = 4
DrawFocusRect% = 2
DrawFrame% = 4
DrawFrameControl% = 4
DrawIcon% = 4
DrawIconEx% = 9
DrawMenuBar% = 1
DrawState% = 10
DrawText% = 5
DrawTextEx% = 6
EditWndProc% = 4
EmptyClipboard% = 0
EnableMenuItem% = 3
EnableScrollBar% = 3
EnableWindow% = 2
EndDeferWindowPos% = 1
EndDialog% = 2
EndMenu% = 0
EndPaint% = 2
EnumChildWindows% = 3
EnumClipboardFormats% = 1
EnumDesktopWindows% = 3
EnumDesktops% = 3
EnumDisplayMonitors% = 4
EnumDisplaySettings% = 3
EnumDisplaySettingsEx% = 4
EnumProps% = 2
EnumPropsEx% = 3
EnumThreadWindows% = 3
EnumWindowStations% = 2
EnumWindows% = 2
EqualRect% = 2
ExcludeUpdateRgn% = 2
ExitWindowsEx% = 2
FillRect% = 3
FindWindow% = 2
FindWindowEx% = 4
FlashWindow% = 2
FrameRect% = 3
FreeDDElParam% = 2
GetActiveWindow% = 0
GetAltTabInfo% = 5
GetAncestor% = 2
GetAsyncKeyState% = 1
GetCapture% = 0
GetCaretBlinkTime% = 0
GetCaretPos% = 1
GetClassInfo% = 3
GetClassInfoEx% = 3
GetClassLong% = 2
GetClassName% = 3
GetClassWord% = 2
GetClientRect% = 2
GetClipCursor% = 1
GetClipboardData% = 1
GetClipboardFormatName% = 3
GetClipboardSequenceNumber% = 0
GetClipboardViewer% = 0
GetComboBoxInfo% = 2
GetCursor% = 0
GetCursorInfo% = 1
GetCursorPos% = 1
GetDC% = 1
GetDCEx% = 3
GetDesktopWindow% = 0
GetDialogBaseUnits% = 0
GetDlgCtrlID% = 1
GetDlgItem% = 2
GetDlgItemInt% = 4
GetDlgItemText% = 4
GetDoubleClickTime% = 0
GetFocus% = 0
GetForegroundWindow% = 0
GetGUIThreadInfo% = 2
GetGuiResources% = 2
GetIconInfo% = 2
GetInputDesktop% = 0
GetInputState% = 0
GetKBCodePage% = 0
GetKeyNameText% = 3
GetKeyState% = 1
GetKeyboardLayout% = 1
GetKeyboardLayoutList% = 2
GetKeyboardLayoutName% = 1
GetKeyboardState% = 1
GetKeyboardType% = 1
GetLastActivePopup% = 1
GetLastInputInfo% = 1
GetListBoxInfo% = 1
GetMenu% = 1
GetMenuBarInfo% = 4
GetMenuCheckMarkDimensions% = 0
GetMenuContextHelpId% = 1
GetMenuDefaultItem% = 3
GetMenuInfo% = 2
GetMenuItemCount% = 1
GetMenuItemID% = 2
GetMenuItemInfo% = 4
GetMenuItemRect% = 4
GetMenuState% = 3
GetMenuString% = 5
GetMessage% = 4
GetMessageExtraInfo% = 0
GetMessagePos% = 0
GetMessageTime% = 0
GetMonitorInfo% = 2
GetMouseMovePoints% = 5
GetNextDlgGroupItem% = 3
GetNextDlgTabItem% = 3
GetOpenClipboardWindow% = 0
GetParent% = 1
GetPriorityClipboardFormat% = 2
GetProcessWindowStation% = 0
GetProp% = 2
GetQueueStatus% = 1
GetScrollBarInfo% = 3
GetScrollInfo% = 3
GetScrollPos% = 2
GetScrollRange% = 4
GetShellWindow% = 0
GetSubMenu% = 2
GetSysColor% = 1
GetSysColorBrush% = 1
GetSystemMenu% = 2
GetSystemMetrics% = 1
GetTabbedTextExtent% = 5
GetThreadDesktop% = 1
GetTitleBarInfo% = 2
GetTopWindow% = 1
GetUpdateRect% = 3
GetUpdateRgn% = 3
GetUserObjectInformation% = 5
GetUserObjectSecurity% = 5
GetWindow% = 2
GetWindowContextHelpId% = 1
GetWindowDC% = 1
GetWindowInfo% = 2
GetWindowLong% = 2
GetWindowModuleFileName% = 3
GetWindowPlacement% = 2
GetWindowRect% = 2
GetWindowRgn% = 2
GetWindowText% = 3
GetWindowTextLength% = 1
GetWindowThreadProcessId% = 2
GetWindowWord% = 2
GrayString% = 9
HideCaret% = 1
HiliteMenuItem% = 4
IMPGetIME% = 2
IMPQueryIME% = 1
IMPSetIME% = 2
ImpersonateDdeClientWindow% = 2
InSendMessage% = 0
InSendMessageEx% = 1
InflateRect% = 3
InsertMenu% = 5
InsertMenuItem% = 4
IntersectRect% = 3
InvalidateRect% = 3
InvalidateRgn% = 3
InvertRect% = 2
IsCharAlpha% = 1
IsCharAlphaNumeric% = 1
IsCharLower% = 1
IsCharUpper% = 1
IsChild% = 2
IsClipboardFormatAvailable% = 1
IsDialogMessage% = 2
IsDlgButtonChecked% = 2
IsIconic% = 1
IsMenu% = 1
IsRectEmpty% = 1
IsWindow% = 1
IsWindowEnabled% = 1
IsWindowUnicode% = 1
IsWindowVisible% = 1
IsZoomed% = 1
KillSystemTimer% = 2
KillTimer% = 2
LoadAccelerators% = 2
LoadBitmap% = 2
LoadCursor% = 2
LoadCursorFromFile% = 1
LoadIcon% = 2
LoadImage% = 6
LoadKeyboardLayout% = 2
LoadMenu% = 2
LoadMenuIndirect% = 1
LoadString% = 4
LockWindowUpdate% = 1
LockWorkStation% = 0
LookupIconIdFromDirectory% = 2
LookupIconIdFromDirectoryEx% = 5
MapDialogRect% = 2
MapVirtualKey% = 2
MapVirtualKeyEx% = 3
MapWindowPoints% = 4
MenuItemFromPoint% = 4
MessageBeep% = 1
MessageBox% = 4
MessageBoxEx% = 5
MessageBoxIndirect% = 1
ModifyMenu% = 5
MonitorFromPoint% = 3
MonitorFromRect% = 2
MonitorFromWindow% = 2
MoveWindow% = 6
MsgWaitForMultipleObjects% = 5
MsgWaitForMultipleObjectsEx% = 5
NotifyWinEvent% = 4
OemKeyScan% = 1
OemToChar% = 2
OemToCharBuff% = 3
OffsetRect% = 3
OpenClipboard% = 1
OpenDesktop% = 4
OpenIcon% = 1
OpenInputDesktop% = 3
OpenWindowStation% = 3
PackDDElParam% = 3
PaintDesktop% = 1
PeekMessage% = 5
PostMessage% = 4
PostQuitMessage% = 1
PostThreadMessage% = 4
PtInRect% = 3
RealChildWindowFromPoint% = 3
RealGetWindowClass% = 3
RedrawWindow% = 4
RegisterClass% = 1
RegisterClassEx% = 1
RegisterClipboardFormat% = 1
RegisterDeviceNotification% = 3
RegisterHotKey% = 4
RegisterWindowMessage% = 1
ReleaseCapture% = 0
ReleaseDC% = 2
RemoveMenu% = 3
RemoveProp% = 2
ReplyMessage% = 1
ReuseDDElParam% = 5
ScreenToClient% = 2
ScrollChildren% = 3
ScrollDC% = 7
ScrollWindow% = 5
ScrollWindowEx% = 8
SendDlgItemMessage% = 5
SendIMEMessageEx% = 2
SendInput% = 3
SendMessage% = 4
SendMessageCallback% = 6
SendMessageTimeout% = 7
SendNotifyMessage% = 4
SetActiveWindow% = 1
SetCapture% = 1
SetCaretBlinkTime% = 1
SetCaretPos% = 2
SetClassLong% = 3
SetClassWord% = 3
SetClipboardData% = 2
SetClipboardViewer% = 1
SetCursor% = 1
SetCursorPos% = 2
SetDebugErrorLevel% = 1
SetDeskWallpaper% = 1
SetDlgItemInt% = 4
SetDlgItemText% = 3
SetDoubleClickTime% = 1
SetFocus% = 1
SetForegroundWindow% = 1
SetKeyboardState% = 1
SetLastErrorEx% = 2
SetMenu% = 2
SetMenuContextHelpId% = 2
SetMenuDefaultItem% = 3
SetMenuInfo% = 2
SetMenuItemBitmaps% = 5
SetMenuItemInfo% = 4
SetMessageExtraInfo% = 1
SetMessageQueue% = 1
SetParent% = 2
SetProcessWindowStation% = 1
SetProp% = 3
SetRect% = 5
SetRectEmpty% = 1
SetScrollInfo% = 4
SetScrollPos% = 4
SetScrollRange% = 5
SetShellWindow% = 1
SetSysColors% = 3
SetSystemCursor% = 2
SetSystemMenu% = 2
SetSystemTimer% = 4
SetThreadDesktop% = 1
SetTimer% = 4
SetUserObjectInformation% = 4
SetUserObjectSecurity% = 3
SetWinEventHook% = 7
SetWindowContextHelpId% = 2
SetWindowLong% = 3
SetWindowPlacement% = 2
SetWindowPos% = 7
SetWindowRgn% = 3
SetWindowText% = 2
SetWindowWord% = 3
SetWindowsHook% = 2
SetWindowsHookEx% = 4
ShowCaret% = 1
ShowCursor% = 1
ShowOwnedPopups% = 2
ShowScrollBar% = 3
ShowWindow% = 2
ShowWindowAsync% = 2
SubtractRect% = 3
SwapMouseButton% = 1
SwitchDesktop% = 1
SystemParametersInfo% = 4
TabbedTextOut% = 8
TileChildWindows% = 2
TileWindows% = 5
ToAscii% = 5
ToAsciiEx% = 6
ToUnicode% = 6
ToUnicodeEx% = 7
TrackMouseEvent% = 1
TrackPopupMenu% = 7
TrackPopupMenuEx% = 6
TranslateAccelerator% = 3
TranslateMDISysAccel% = 2
TranslateMessage% = 1
UnhookWinEvent% = 1
UnhookWindowsHook% = 2
UnhookWindowsHookEx% = 1
UnionRect% = 3
UnloadKeyboardLayout% = 1
UnpackDDElParam% = 4
UnregisterClass% = 2
UnregisterDeviceNotification% = 1
UnregisterHotKey% = 2
UpdateWindow% = 1
UserHandleGrantAccess% = 2
ValidateRect% = 2
ValidateRgn% = 2
VkKeyScan% = 1
VkKeyScanEx% = 2
WINNLSEnableIME% = 2
WINNLSGetEnableStatus% = 1
WINNLSGetIMEHotkey% = 1
WaitForInputIdle% = 2
WaitMessage% = 0
WinHelp% = 4
WindowFromDC% = 1
WindowFromPoint% = 2
keybd_event% = 4
mouse_event% = 5
wvsprintf% = 3

View File

@ -0,0 +1,70 @@
; WSOCK32 API calls parameters' count
AcceptEx% = 8
EnumProtocols% = 3
GetAcceptExSockaddrs% = 8
GetAddressByName% = 10
GetNameByType% = 3
GetService% = 7
GetTypeByName% = 2
MigrateWinsockConfiguration% = 3
NPLoadNameSpaces% = 3
SetService% = 6
TransmitFile% = 7
WEP% = 0
WSAAsyncGetHostByAddr% = 7
WSAAsyncGetHostByName% = 5
WSAAsyncGetProtoByName% = 5
WSAAsyncGetProtoByNumber% = 5
WSAAsyncGetServByName% = 6
WSAAsyncGetServByPort% = 6
WSACancelAsyncRequest% = 4
WSACancelBlockingCall% = 0
WSACleanup% = 0
WSAGetLastError% = 0
WSAIsBlocking% = 0
WSARecvEx% = 4
WSASetBlockingHook% = 1
WSASetLastError% = 1
WSAStartup% = 2
WSAUnhookBlockingHook% = 0
__WSAFDIsSet% = 2
accept% = 3
bind% = 3
closesocket% = 1
connect% = 3
dn_expand% = 5
gethostbyaddr% = 3
gethostbyname% = 1
gethostname% = 2
getnetbyname% = 1
getpeername% = 3
getprotobyname% = 1
getprotobynumber% = 1
getservbyname% = 2
getservbyport% = 2
getsockname% = 3
getsockopt% = 5
htonl% = 1
htons% = 1
inet_addr% = 1
inet_network% = 1
inet_ntoa% = 1
ioctlsocket% = 3
listen% = 2
ntohl% = 1
ntohs% = 1
rcmd% = 6
recv% = 4
recvfrom% = 6
rexec% = 6
rresvport% = 1
s_perror% = 2
select% = 5
send% = 4
sendto% = 6
sethostname% = 2
setsockopt% = 5
shutdown% = 2
socket% = 3

View File

@ -0,0 +1,30 @@
% = 0
calminstruction times?: statement
local number, instruction, limit
match number= statement, statement, ()
jno incomplete_statement
take limit, number
compute limit, limit
take instruction, statement
compute number, 1
take %, number
check limit < 0
jyes negative_number
loop:
check % > limit
jyes done
assemble instruction
compute %, % + 1
jump loop
incomplete_statement:
err 'incomplete statement'
exit
negative_number:
err 'the number of times must be positive'
done:
take , %
take , limit
take , instruction
end calminstruction

View File

@ -0,0 +1,33 @@
macro api names&
iterate name, names
if used name
label name:dword at name#A
end if
end iterate
end macro
struc? TCHAR args:?&
. db args
end struc
macro TCHAR args:?&
db args
end macro
sizeof.TCHAR = 1
include 'macro/struct.inc'
include 'macro/proc32.inc'
include 'macro/com32.inc'
include 'macro/import32.inc'
include 'macro/export.inc'
include 'macro/resource.inc'
include 'equates/kernel32.inc'
include 'equates/user32.inc'
include 'equates/gdi32.inc'
include 'equates/comctl32.inc'
include 'equates/comdlg32.inc'
include 'equates/shell32.inc'
include 'equates/wsock32.inc'

View File

@ -0,0 +1,62 @@
include 'win32a.inc'
include 'macro/inline.inc'
include 'macro/if.inc'
define _winx
define _winx.code? _code
define _winx.data? _data
define _winx.end? _end
calminstruction (name) ? &a&
local cmd
match .cmd, name
jno pass
transform cmd, _winx
jno pass
arrange cmd, cmd a
assemble cmd
exit
pass:
arrange cmd, name a
assemble cmd
end calminstruction
macro _data
section '.data' data readable writeable
end macro
macro _code
section '.text' code readable executable
end macro
macro _end label
entry label
section '.idata' import data readable writeable
library kernel32,'KERNEL32.DLL',\
user32,'USER32.DLL',\
gdi32,'GDI32.DLL',\
advapi32,'ADVAPI32.DLL',\
comctl32,'COMCTL32.DLL',\
comdlg32,'COMDLG32.DLL',\
shell32,'SHELL32.DLL',\
wsock32,'WSOCK32.DLL'
include! 'api/kernel32.inc'
include! 'api/user32.inc'
include! 'api/gdi32.inc'
include! 'api/advapi32.inc'
include! 'api/comctl32.inc'
include! 'api/comdlg32.inc'
include! 'api/shell32.inc'
include! 'api/wsock32.inc'
end macro
if x86.mode = 16
format PE GUI 4.0
end if

View File

@ -0,0 +1,31 @@
include 'win32ax.inc'
include 'pcount/kernel32.inc'
include 'pcount/user32.inc'
include 'pcount/gdi32.inc'
include 'pcount/advapi32.inc'
include 'pcount/comctl32.inc'
include 'pcount/comdlg32.inc'
include 'pcount/shell32.inc'
include 'pcount/wsock32.inc'
macro pcountcheck? proc*,count*
local pname,pcount
match p, pcountsuffix
match [name], proc
define pcount name#p
else match name, proc
define pcount name#p
end match
end match
if defined pcount & count <> pcount
repeat 1, found:count, expected:pcount
match [name], proc
err 'invalid count of parameters for ',`name,' (',`found,' instead of ',`expected,')'
else
err 'invalid count of parameters for ',`proc,' (',`found,' instead of ',`expected,')'
end match
end repeat
end if
end macro

View File

@ -0,0 +1,33 @@
macro api names&
iterate name, names
if used name
label name:dword at name#W
end if
end iterate
end macro
struc? TCHAR args:?&
. du args
end struc
macro TCHAR args:?&
du args
end macro
sizeof.TCHAR = 2
include 'macro/struct.inc'
include 'macro/proc32.inc'
include 'macro/com32.inc'
include 'macro/import32.inc'
include 'macro/export.inc'
include 'macro/resource.inc'
include 'equates/kernel32.inc'
include 'equates/user32.inc'
include 'equates/gdi32.inc'
include 'equates/comctl32.inc'
include 'equates/comdlg32.inc'
include 'equates/shell32.inc'
include 'equates/wsock32.inc'

View File

@ -0,0 +1,62 @@
include 'win32w.inc'
include 'macro/inline.inc'
include 'macro/if.inc'
define _winx
define _winx.code? _code
define _winx.data? _data
define _winx.end? _end
calminstruction (name) ? &a&
local cmd
match .cmd, name
jno pass
transform cmd, _winx
jno pass
arrange cmd, cmd a
assemble cmd
exit
pass:
arrange cmd, name a
assemble cmd
end calminstruction
macro _data
section '.data' data readable writeable
end macro
macro _code
section '.text' code readable executable
end macro
macro _end label
entry label
section '.idata' import data readable writeable
library kernel32,'KERNEL32.DLL',\
user32,'USER32.DLL',\
gdi32,'GDI32.DLL',\
advapi32,'ADVAPI32.DLL',\
comctl32,'COMCTL32.DLL',\
comdlg32,'COMDLG32.DLL',\
shell32,'SHELL32.DLL',\
wsock32,'WSOCK32.DLL'
include! 'api/kernel32.inc'
include! 'api/user32.inc'
include! 'api/gdi32.inc'
include! 'api/advapi32.inc'
include! 'api/comctl32.inc'
include! 'api/comdlg32.inc'
include! 'api/shell32.inc'
include! 'api/wsock32.inc'
end macro
if x86.mode = 16
format PE GUI 4.0
end if

View File

@ -0,0 +1,31 @@
include 'win32wx.inc'
include 'pcount/kernel32.inc'
include 'pcount/user32.inc'
include 'pcount/gdi32.inc'
include 'pcount/advapi32.inc'
include 'pcount/comctl32.inc'
include 'pcount/comdlg32.inc'
include 'pcount/shell32.inc'
include 'pcount/wsock32.inc'
macro pcountcheck? proc*,count*
local pname,pcount
match p, pcountsuffix
match [name], proc
define pcount name#p
else match name, proc
define pcount name#p
end match
end match
if defined pcount & count <> pcount
repeat 1, found:count, expected:pcount
match [name], proc
err 'invalid count of parameters for ',`name,' (',`found,' instead of ',`expected,')'
else
err 'invalid count of parameters for ',`proc,' (',`found,' instead of ',`expected,')'
end match
end repeat
end if
end macro

View File

@ -0,0 +1,35 @@
macro api names&
iterate name, names
if used name
label name:qword at name#A
end if
end iterate
end macro
struc? TCHAR args:?&
. db args
end struc
macro TCHAR args:?&
db args
end macro
sizeof.TCHAR = 1
include 'macro/struct.inc'
include 'macro/proc64.inc'
include 'macro/com64.inc'
include 'macro/import64.inc'
include 'macro/export.inc'
include 'macro/resource.inc'
Struct.CheckAlignment = 1
include 'equates/kernel64.inc'
include 'equates/user64.inc'
include 'equates/gdi64.inc'
include 'equates/comctl64.inc'
include 'equates/comdlg64.inc'
include 'equates/shell64.inc'
include 'equates/wsock32.inc'

View File

@ -0,0 +1,67 @@
include 'win64a.inc'
include 'macro/inline.inc'
include 'macro/if.inc'
define _winx
define _winx.code? _code
define _winx.data? _data
define _winx.end? _end
calminstruction (name) ? &a&
local cmd
match .cmd, name
jno pass
transform cmd, _winx
jno pass
arrange cmd, cmd a
assemble cmd
exit
pass:
arrange cmd, name a
assemble cmd
end calminstruction
macro _data
section '.data' data readable writeable
end macro
macro _code
section '.text' code readable executable
entry $
sub rsp,8
if defined _winx.entry & ~ _winx.entry eq $
jmp _winx.entry
end if
end macro
macro _end label
_winx.entry := label
section '.idata' import data readable writeable
library kernel32,'KERNEL32.DLL',\
user32,'USER32.DLL',\
gdi32,'GDI32.DLL',\
advapi32,'ADVAPI32.DLL',\
comctl32,'COMCTL32.DLL',\
comdlg32,'COMDLG32.DLL',\
shell32,'SHELL32.DLL',\
wsock32,'WSOCK32.DLL'
include! 'api/kernel32.inc'
include! 'api/user32.inc'
include! 'api/gdi32.inc'
include! 'api/advapi32.inc'
include! 'api/comctl32.inc'
include! 'api/comdlg32.inc'
include! 'api/shell32.inc'
include! 'api/wsock32.inc'
end macro
if x86.mode = 16
format PE64 GUI 5.0
end if

Some files were not shown because too many files have changed in this diff Show More