flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
Furs 19 Jul 2017, 20:42
There is no reason that a console app should be faster than one without. After all, the "console" thing is part of the PE format and is a single thing you have to change -- it is definitely not part of your "code". You can even change it manually with a Hex Editor.
Now of course it could be slower if your runtime adds a lot of stupid bloat and junk to the non-console version. Do you control the entry point of your application? You should. I don't have more info about it, so providing more info would help. Is it written in asm or C/C++ or something else? You can still use e.g. C standard library (even from asm) without actually pulling that bloat into your executable, just link msvcrt.dll or whatever else you need and let it handle the symbol lookup. (note: if you use C compiler you'll have to pass some options, for GCC it is -nostdlib, to get full control over the entry point; main is NOT the entry point, it happens after a lot of bloat) But yes, I need more info first on how you build your app ![]() Oh, to add, if you want to "remove" the console window you need to turn it into a non-console application. This does not require changing your code but it could break. You need to change a byte only. I'm not sure if it will work, given the runtime initialization (if any?), you need to change the Subsystem field of this: https://msdn.microsoft.com/en-us/library/windows/desktop/ms680339%28v=vs.85%29.aspx (look online about PE format if you really want to do this "hack"; change it to 2 or IMAGE_SUBSYSTEM_WINDOWS_GUI, it should be set to 3 currently since it's console) |
|||
![]() |
|
addhaloka 19 Jul 2017, 23:33
Furs
Naturally, I made it in FASM. ![]() ![]() Source code: Code: format PE GUI 5.0 ; if replace 'GUI' to 'CONSOLE' its really works faster entry start include 'win32w.inc' section '.text' code readable executable align 10h data import library kernel32,'KERNEL32.DLL',\ user32,'USER32.DLL' include 'api/kernel32.inc' include 'api/user32.inc' end data align 10h fmt du '%4.4u-%2.2u-%2.2u_%2.2u-%2.2u-%2.2u',0 align 10h proc getTargetDir push esi edi invoke GetCurrentDirectory,MAX_PATH*2,targetdir mov esi,targetdir mov edi,targetdir @@: lodsw stosw test ax,ax jne @B sub esi,2 mov word[esi],5Ch add esi,2 mov word[esi],0 pop edi esi ret endp start: invoke GetLocalTime,systemtime movsx eax,[systemtime.wYear] movsx ecx,[systemtime.wMonth] movsx edx,[systemtime.wDay] movsx ebx,[systemtime.wHour] movsx esi,[systemtime.wMinute] movsx edi,[systemtime.wSecond] cinvoke wsprintf,dirname,fmt,eax,ecx,edx,ebx,esi,edi call getTargetDir invoke lstrcat,targetdir,dirname invoke CreateDirectory,targetdir,0 invoke ExitProcess,0 section '.data' readable writeable dirname du 20 dup(?) targetdir du MAX_PATH dup(?) systemtime SYSTEMTIME |
|||
![]() |
|
Grom PE 20 Jul 2017, 07:24
Programs that differ only by Console/GUI bit are equally fast for me.
Perhaps you should check for resident software you have installed that injects its own nonsense to all starting GUI programs. |
|||
![]() |
|
addhaloka 20 Jul 2017, 14:03
Grom PE wrote: Perhaps you should check for resident software you have installed that injects its own nonsense to all starting GUI programs. Hardly - it was tested on different PCs/OS (XP SP3 x86, Win 7 x86/x64, Win 8.1 x64) - everywhere the same behavior. Also for a long time already I do not use antiviruses, HIPS, etc., i.e. software that can cause similar effects. |
|||
![]() |
|
Furs 20 Jul 2017, 14:15
How do you judge how fast it is?
Total Commander might not redraw its window immediately after you launch the app with GUI; but it will after the console since OS forces a refresh (because there was a window in the way, you know?). So that's why it could feel faster. In this sense, both are instant except one is just updated slower on your screen. I know with Wine (on Linux) Total Commander doesn't redraw instantly many times, but it could be a wine thing of course. Of course if you have another means to judge how fast it is other than the screen itself, then this isn't the issue. Can't say it happens here, sorry, so I'm stumped if so. ![]() |
|||
![]() |
|
Grom PE 20 Jul 2017, 21:19
Yeah, check again with ptime: http://www.pc-tools.net/win32/ptime/
|
|||
![]() |
|
addhaloka 21 Jul 2017, 04:59
In vain I, probably, addressed this question - it was necessary to look first in google.
That there was no window it is necessary compile as GUI and nothing else. There are at least two (FreeConsole, or GetConsoleWindow > ShowWindow,eax,SW_HIDE) ways to hide the window in the console app, but they are useless, since the program is already completing the task and ends, while the window is still blinking. ![]() Thanks to everyone and sorry for disturbing. |
|||
![]() |
|
Grom PE 21 Jul 2017, 06:42
It's a bad idea to hide the console window — it may not be yours. What if I run your program from a console program?
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.