flat assembler
Message board for the users of flat assembler.

Index > Windows > compile and run asm within lua, with Fasm.dll

Goto page Previous  1, 2
Author
Thread Post new topic Reply to topic
idle



Joined: 06 Jan 2011
Posts: 440
Location: Ukraine
idle 11 Mar 2021, 21:41
v5 fails under VirtualBox xp.sp3.x32
Post 11 Mar 2021, 21:41
View user's profile Send private message Reply with quote
idle



Joined: 06 Jan 2011
Posts: 440
Location: Ukraine
idle 11 Mar 2021, 22:09
pber wrote:
failed under XP?
I don't know the exact linking options, because I'm using the ide of ultimate++, which hides the details of its compiling machinery. And I don't know how to see them.


ollydbg/x64dbg - attach - select your ide - Alt+E to view modules linked - kernel32.dll - Ctrl+N to Show Names - find|type CreateFile[A|W] - F2 to set up a break point - upon a hit - Ctrl+G for switching a caller in our case - in CPU window type [esp] - Enter - ... - se an attachment


Description:
Filesize: 137.35 KB
Viewed: 12761 Time(s)

2021-03-12_000901.png


Description:
Filesize: 43.58 KB
Viewed: 12761 Time(s)

2021-03-12_000435.png


Post 11 Mar 2021, 22:09
View user's profile Send private message Reply with quote
idle



Joined: 06 Jan 2011
Posts: 440
Location: Ukraine
idle 11 Mar 2021, 22:20
CreateProcessA
i beg your pardon!
i need a sllep
Post 11 Mar 2021, 22:20
View user's profile Send private message Reply with quote
pber



Joined: 23 Jul 2017
Posts: 24
pber 12 Mar 2021, 02:46
...the string passed is not from my program, at least not in my intentions.
Could it be a virus?

How did you managed to stop at that point?
I want to make the same and see what is going on.
Post 12 Mar 2021, 02:46
View user's profile Send private message Reply with quote
pber



Joined: 23 Jul 2017
Posts: 24
pber 12 Mar 2021, 02:50
just checked with ProcMon, my sw never try to access to nothing similar to "cpuid.txt"
Post 12 Mar 2021, 02:50
View user's profile Send private message Reply with quote
idle



Joined: 06 Jan 2011
Posts: 440
Location: Ukraine
idle 12 Mar 2021, 06:56
Smile

I can not run ike so an example had to be posted.
First, download x64dbg with some plugins and preconf, unpack it and run (x64dbg\bin\release\x96dbg.exe).

ollydbg/x64dbg
Alt+A to attach or
F3 to open
select your ide
F9 to run
Alt+E to view modules linked
kernel32.dll
Ctrl+N to Show Names
find|type CreateProcess[A|W]
F2 to set up a break point
Shift+F9 whenever hll code rising nontheless exceptions
Ctrl+G upon a hit for switching a caller in our case
in CPU window type [esp] that is EIP register | return address
Enter
Post 12 Mar 2021, 06:56
View user's profile Send private message Reply with quote
pber



Joined: 23 Jul 2017
Posts: 24
pber 12 Mar 2021, 14:14
ok, understood... thanks.

If I check createProcess calls this way, the only process created is about fossil.exe. If I remeber well, I test for the existence of the exe before trying to start it, so you should not see it.

no cpuid.txt. I don't figure out why you see that, but I'm quite sure it's not ike.

* * *

the next try I'll do is using log for tracing the initial steps of ike.exe.
The problem is that it is a GUI app and it does not open console's.
You should start it from inside a program that reads the the output of the subprocess, in order to see an hypothetical runtime error.

This is what I usually do (that is from an editor called CodeBrowser. Emacs would works well too).
So if you run ike.exe from cmd.exe you will not see any message.

Bad design, I know ...
Post 12 Mar 2021, 14:14
View user's profile Send private message Reply with quote
idle



Joined: 06 Jan 2011
Posts: 440
Location: Ukraine
idle 12 Mar 2021, 14:24
Could you post ike package which works on your machine.
I have both xp&10.

cpuid.txt - do not mind, i used personal project as an example
Post 12 Mar 2021, 14:24
View user's profile Send private message Reply with quote
pber



Joined: 23 Jul 2017
Posts: 24
pber 13 Mar 2021, 14:56
release 006 contains also a run_ike, wich opens a console and then launches ike.exe. It should display some error, I hope.

https://drive.google.com/file/d/13RGxi-Hc7MzlqeKeCb6RVpL_21_bD57U/view?usp=sharing
Post 13 Mar 2021, 14:56
View user's profile Send private message Reply with quote
idle



Joined: 06 Jan 2011
Posts: 440
Location: Ukraine
idle 13 Mar 2021, 20:08
i suppose i need lua vm standalone?
i have no lua installed
should i?
or it is portable


Description:
Filesize: 47.32 KB
Viewed: 12680 Time(s)

xp&w10 2021-03-13_213203.png


Post 13 Mar 2021, 20:08
View user's profile Send private message Reply with quote
idle



Joined: 06 Jan 2011
Posts: 440
Location: Ukraine
idle 13 Mar 2021, 20:22
Same error on both OSes after Lua4Windows installed.
Moreover it fails on Cyrillic paths.


Shocked
Post 13 Mar 2021, 20:22
View user's profile Send private message Reply with quote
pber



Joined: 23 Jul 2017
Posts: 24
pber 13 Mar 2021, 20:41
many thanks idle!
now I can reason about the poblem

lua is linked statically within the exe
and ... sadly I used only ascii strings...

it's one of the very first things I must do
Post 13 Mar 2021, 20:41
View user's profile Send private message Reply with quote
pber



Joined: 23 Jul 2017
Posts: 24
pber 13 Mar 2021, 20:46
ok. i'm really an idiot.
It's a very old code.
A font is missing and everything stops.

You was right: it was not the manifest, simply my stupidity.
Post 13 Mar 2021, 20:46
View user's profile Send private message Reply with quote
pber



Joined: 23 Jul 2017
Posts: 24
pber 13 Mar 2021, 22:16
stupid or not: Ike should be a funny toy for an hacker
At least it is to me.

There are three nice toys to hack bit and bytes: Tcc, Fasm and FF (and Ike, obviously).
FreeForth is a super small and super fast Forth.
Forth is an orrible language, but FF compiles to machine code and it's too attractive.
I hacked it for working as a dll and I wrote an API for interfacing FF to C/ASM.
Still bugged, but working.

https://drive.google.com/file/d/1oIyqR69o60ze1VNYQAtcrXR8BwwVnKDY/view?usp=sharing
Post 13 Mar 2021, 22:16
View user's profile Send private message Reply with quote
idle



Joined: 06 Jan 2011
Posts: 440
Location: Ukraine
idle 15 Mar 2021, 17:05
Hello.

IT RUNS ON XP!

I'm impressed with the catolaging and systemizing!

Could you plese provide more examples on a spare of you.

Forum members and not only to see what it can...

Cheers
Post 15 Mar 2021, 17:05
View user's profile Send private message Reply with quote
pber



Joined: 23 Jul 2017
Posts: 24
pber 16 Mar 2021, 04:26
idle wrote:
Hello.
IT RUNS ON XP!


HAPPY TO EAR THAT!

idle wrote:
Hello.
I'm impressed with the catolaging and systemizing!


Ike is a tool for generating source-code. It's just at the beginning, in fact Ike code introduces just a few variants to Lua (the one I love more is ?
instead of
print(a, b, c)
you can type
? a,b,c
as in the old VB Laughing

in this days I reworked the FFI call method, that is the Lua function for calling cdecl/stdcall functions.
I rewrote it in Fasm. I want to keep it (and the next tools) in a form that is loaded when Ide start,
so that they can be changed in any time.

Well, I think it's not so easy digging something like Ike. There is still much confusion in its code.

to open a file use CTRL-P

ASM, TCC and FF examples are in scratch.ike, in the end: kA (ike's assembler)

Many things work other don't (I try to mark non working examples with ! )
Keep attention on HOW you run scripts.

You can run in-process and out-process.

in-process means that the script runs in the same Ide's vm (many eaxmple are NOT wrote for that mode)
out-process means that a new ike.exe is run just to execute that script (working with scripts that talk to CPU it's more secure that way)

CTRL-X CTRL-S
is useful to save Ide's state BEFORE trying to crash it running asm code
So that when you restart Ide reopen the same files at the same edit-point.

(...going to publish the last release)
Post 16 Mar 2021, 04:26
View user's profile Send private message Reply with quote
pber



Joined: 23 Jul 2017
Posts: 24
pber 16 Mar 2021, 04:39
https://drive.google.com/file/d/1P_IizIs6QHeoQI8I6DxHXDDJ90dRP0XE/view?usp=sharing

+ improved the output. now there is one dedicated thread that updates the output in console and finally it outputs fast
+ sadly the output management is still messy: Lua emits output in the process tab, external code emits output in the process TAB. ...I'm still in a transitional phase.

+ kA.ike contains the new call
Fasm uses call.1 to boot, then passes using call.2
Post 16 Mar 2021, 04:39
View user's profile Send private message Reply with quote
idle



Joined: 06 Jan 2011
Posts: 440
Location: Ukraine
idle 17 Mar 2021, 19:00
Foud source code, moreover it contains support of arm code generastion.
I do not still understand why being buit with -m32 on an x64-machine generates x64-code by default.
Well, under-VirtualBox.xp.sp3.x32 buid included, which generates x32 code by default.
It seems tcc compiler sets TCC_TARGET_? by itself.

I'm fasm freak) anyways.

\tinycc-mob - Unofficial open-source mirror of mob development branch\4win32.bat
Code:
@echo off
echo Make sure tcc in the Path...
pause
pushd %~dp0
cd "tcc-mob\win32"
buid-tcc.bat -c "tcc.exe -bench"
popd
    
Post 17 Mar 2021, 19:00
View user's profile Send private message Reply with quote
pber



Joined: 23 Jul 2017
Posts: 24
pber 18 Mar 2021, 05:32
I have the opposit problem, I'm still not able to make tcc working or 64bits.
(for a "stupid" question of linkers)
TCC for mobile sounds cool, but i'm perplex about the code tcc emits, which is slow.
Post 18 Mar 2021, 05:32
View user's profile Send private message Reply with quote
idle



Joined: 06 Jan 2011
Posts: 440
Location: Ukraine
idle 19 Mar 2021, 22:05
run cmd.exe at /tinycc-mob - Unofficial open-source mirror of mob development branch/tcc-mob/, type
tcc tcc.c -m64
Post 19 Mar 2021, 22:05
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.