Lo modifique y ahora crea imports para fasm a partir de cualquier libreria
Código (ASM) [Seleccionar]
format pe console
espacio equ 13,10,0
include 'win32ax.inc'
.code
start:
stdcall CrearImport,"user32.dll","user32.inc"
invoke ExitProcess,0
proc CrearImport,NombreLIB,NombreImport
locals
DirPEHeader dd ?
PunteroPEHeader dd ?
RVAofExportDirectory dd ?
NumberOfNames dd ?
AddressOfNames dd ?
Funcion dd ?
HFile dd ?
Nosirve dd ?
Largo dd ?
LibHandle dd ?
endl
push ebx edx edi ecx
invoke LoadLibrary, [NombreLIB]
mov [LibHandle],eax
cmp eax,NULL
je .Error
push dword[eax + 03Ch]
pop [DirPEHeader]
push [DirPEHeader]
pop [PunteroPEHeader]
add [PunteroPEHeader],eax
mov ebx,[PunteroPEHeader]
cmp word[ebx],"PE"
jne .Error
push dword[ebx+078h]
pop [RVAofExportDirectory]
mov ebx, [RVAofExportDirectory]
add ebx,eax
push dword[ebx+018h]
pop [NumberOfNames]
mov edx,[NumberOfNames]
push dword[ebx+20h]
pop [AddressOfNames]
mov ebx,[NumberOfNames]
mov edi, [AddressOfNames]
add edi,[LibHandle]
invoke CreateFileA, [NombreImport], GENERIC_WRITE, 0, 0, CREATE_ALWAYS, 0, 0
mov [HFile], eax
invoke lstrlen,"import "
invoke WriteFile, [HFile], "import ",eax,addr Nosirve, NULL
invoke lstrlen,[NombreLIB]
sub eax,4
invoke WriteFile, [HFile], [NombreLIB],eax,addr Nosirve, NULL
invoke WriteFile,[HFile] , ",\",2,addr Nosirve, NULL
invoke WriteFile, [HFile], espacio,2,addr Nosirve, NULL
.bucle:
dec ebx
mov eax, [edi + ebx * 4]
add eax,[LibHandle]
mov [Funcion],eax
invoke lstrlen, [Funcion]
invoke WriteFile, [HFile], [Funcion],eax,addr Nosirve, NULL
invoke WriteFile, [HFile],",",1,addr Nosirve, NULL
invoke WriteFile, [HFile],"'",1,addr Nosirve, NULL
invoke lstrlen, [Funcion]
invoke WriteFile, [HFile], [Funcion],eax,addr Nosirve, NULL
.if ebx = 0
invoke WriteFile, [HFile],"'",1,addr Nosirve, NULL
.else
invoke WriteFile, [HFile],"',\",3,addr Nosirve, NULL
invoke WriteFile, [HFile], espacio,2,addr Nosirve, NULL
.endif
cmp ebx,0
jne .bucle
invoke CloseHandle, [HFile]
pop ecx edi edx ebx
ret
.Error:
ret
endp
.end start