flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
semiono 07 Oct 2010, 23:33
Code: mov [StartSTR.cb],sinfo mov [StartSTR.dwFlags],STARTF_USEPOSITION ;STARTF_USESTDHANDLES mov dword [StartSTR.dwX],0x0 mov dword [StartSTR.dwY],0x1c invoke CreateProcess,exec,[rlcc],NULL,NULL,\ CREATE_NEW_CONSOLE,NORMAL_PRIORITY_CLASS,NULL,NULL,StartSTR,StartInfo ;DETACHED_PROCESS not result! ![]() |
|||
![]() |
|
lemask 08 Oct 2010, 06:32
Have you checked the return codes?
|
|||
![]() |
|
semiono 12 Oct 2010, 14:14
What is SIZE INFO in fasm?
mov [StartSTR.cb], SIZE INFO < masm32 mov [StartSTR.cb], $-sinfo ?? |
|||
![]() |
|
revolution 12 Oct 2010, 14:17
Code: mov [StartSTR.cb],sizeof.STARTUPINFO |
|||
![]() |
|
semiono 12 Oct 2010, 18:13
* I have an idea to collect myself %fasm%\const.inc
1. What is right from that - INFINITE dd 0xffffffff or INFINITE equ 0xffffffff or INFINITE = 0xffffffff ![]() 2. If it possible i want make like that Code: ; const.inc section '.code' executable readable writable ; not sure that ! invoke ExpandEnvironmentStrings,'%WinDir%',WinDir,MAX_PATH WinDir dd ? Code: ; code.asm include '%fasm%/const.inc' section '.data' data readable writable lpFile db WinDir,'\Path\File.exe',0 But it's not correctly. How it possible to improove? ![]() |
|||
![]() |
|
baldr 12 Oct 2010, 18:33
semiono,
That depends on whether you need -1 directly, or an address of -1. dd gives you latter, equ and = make it plain. WinDir dd ? is only 4-byte (i.e. char) buffer for the result of ExpandEnvironmentStrings(), perhaps it's not enough. ![]() db WinDir is rarely a correct directive (hint: any WinDir value outside [-128…255] range will raise complaints from compiler). |
|||
![]() |
|
semiono 25 Oct 2010, 20:28
Code: format PE Console include '%fasm%\win32ax.inc' section '.code' executable start: invoke GetConsoleWindow mov [hWnd],eax lea eax,[@rc] invoke GetWindowRect,[hWnd],eax invoke SetWindowPos,[hWnd],HWND_TOP,50,28,1024,480,SWP_SHOWWINDOW invoke CreateProcess,NULL,'cmd.exe',NULL,NULL,TRUE,NULL,NULL,NULL,@si,@pi invoke WaitForSingleObject,[@pi.hProcess],INFINITE invoke CloseHandle,[@pi.hProcess] invoke CloseHandle,[@pi.hProcess] exit: invoke ExitProcess,NULL .end start section '.data' readable writable INFINITE = 0xffffffff @si STARTUPINFO @pi PROCESS_INFORMATION @rc RECT hWnd dd ? Good work! Please, anybody, what is need to initializate the SetConsoleTextAttribute? Structures, Handles... How it's to?... is it not need call CreateConsoleScreenBuffer? Some full code examples is enough for me ![]() --- Code: format PE Console include '%fasm%\win32ax.inc' section '.code' executable start: invoke GetStdHandle,STD_OUTPUT_HANDLE mov [@si.hStdOutput],eax invoke GetConsoleWindow mov [hWnd],eax lea eax,[@rc] invoke GetWindowRect,[hWnd],eax invoke SetWindowPos,[hWnd],HWND_TOP,0,38,1024,480,SWP_SHOWWINDOW invoke SetConsoleTextAttribute,[@si.hStdOutput],0x0009 invoke CreateProcess,NULL,'cmd.exe',NULL,NULL,TRUE,NULL,NULL,NULL,@si,@pi invoke WaitForSingleObject,[@pi.hProcess],INFINITE invoke CloseHandle,[@pi.hProcess] invoke CloseHandle,[@pi.hProcess] exit: invoke ExitProcess,NULL .end start section '.data' readable writable INFINITE = 0xffffffff @si STARTUPINFO @pi PROCESS_INFORMATION @rc RECT hWnd dd ? Ok! Last edited by semiono on 26 Oct 2010, 00:30; edited 1 time in total |
|||
![]() |
|
semiono 26 Oct 2010, 00:29
![]() SetCurrentConsoleFontEx >8--- Minimum supported client Windows Vista What do for XP ! ![]() SetConsoleFontSize() isn't declared but i need (Lucida Console 18 ) font. Is it something good more undeclarated ? |
|||
![]() |
|
Picnic 27 Oct 2010, 07:19
There is a method programmatically to change console font in runtime using some undocumented Windows functions, although it is a bit tricky.
Code: ;struct _CONSOLE_FONT { ; DWORD index; ; COORD dim; ;} CONSOLE_FONT; ;SetConsoleFont(HANDLE hOutput, DWORD fontIndex); ;GetConsoleFontInfo(HANDLE hOutput, BOOL bMaximize, DWORD numFonts, CONSOLE_FONT* info); ;GetNumberOfConsoleFonts(); Here is some code i've written based on a C++ sample, program loops through all available console fonts and display sizes. It works on my XP but i never test it on Vista or 7. Use at your own risk. Code: format PE CONSOLE 4.0 entry main include "win32axp.inc" section ".idata" import data readable writeable library kernel32, "KERNEL32.DLL",\ user32, "USER32.DLL" include "\api\kernel32.inc" include "\api\user32.inc" SetConsoleFont equ PSetConsoleFont GetConsoleFontInfo equ PGetConsoleFontInfo GetNumberOfConsoleFonts equ PGetNumberOfConsoleFonts .data szSetConsoleFont db "SetConsoleFont",0 szGetConsoleFontInfo db "GetConsoleFontInfo",0 szGetNumberOfConsoleFonts db "GetNumberOfConsoleFonts",0 kernel32 db "kernel32.dll",0 ErrorTxt db "API Failed",0 FoundTxt db "Found font X(%d) Y(%d)",13,10,0 Align 4 Temp1 dd 0 hModule dd 0 hOut dd 0 hBuffer dd 0 FontArray dd 0 NumberOfFonts dd 0 PSetConsoleFont dd 0 PGetConsoleFontInfo dd 0 PGetNumberOfConsoleFonts dd 0 ;CONSOLE_FONT: ; .index dd ? ; .x dw ? ; .y dw ? .code main: invoke GetModuleHandle, kernel32 call TestAPI mov [hModule], eax ; Undocumented API's stdcall LoadFunc, [hModule], szSetConsoleFont, PSetConsoleFont stdcall LoadFunc, [hModule], szGetConsoleFontInfo, PGetConsoleFontInfo stdcall LoadFunc, [hModule], szGetNumberOfConsoleFonts, PGetNumberOfConsoleFonts invoke GetStdHandle, STD_OUTPUT_HANDLE mov [hOut], eax invoke GetNumberOfConsoleFonts .if ~eax ; No fonts found ; mov eax, 1 jmp Exit .endif mov [NumberOfFonts], eax ;--------------------------------------------------------- ; Allocate: (NumberOfFonts*SIZEOF.CONSOLE_FONT) ; +Length_of_Buffer ; ;--------------------------------------------------------- lea eax, [(eax*8)+256] invoke LocalAlloc, LMEM_ZEROINIT, eax call TestAPI mov [hBuffer], eax add eax, 256 mov [FontArray], eax invoke GetConsoleFontInfo, [hOut], 0, [NumberOfFonts], [FontArray] mov ebx, [FontArray] ;--------------------------------------------------------- ; Loop through all available console fonts ; and display sizes. ; ;--------------------------------------------------------- @@: invoke GetConsoleFontSize, [hOut], dword [ebx] movzx ecx, ax shr eax, 16 mov edx, eax cinvoke wsprintf, [hBuffer], FoundTxt, ecx, edx invoke WriteConsole, [hOut], [hBuffer], eax, Temp1, 0 invoke SetConsoleFont, [hOut], dword [ebx] call TestAPI invoke Sleep, 1000 add ebx, 8 dec [NumberOfFonts] ja @B xor eax, eax Exit: invoke ExitProcess, eax ;--------------------------------------------------------- proc LoadFunc uses ecx edx, hMod, lpName, pFunc ; ;--------------------------------------------------------- invoke GetProcAddress, [hMod], [lpName] call TestAPI mov edx, [pFunc] mov [edx], eax ret endp ;--------------------------------------------------------- TestAPI: ; ;--------------------------------------------------------- test eax, eax jnz @F invoke MessageBox, HWND_DESKTOP, ErrorTxt, 0, MB_OK mov eax, 1 jmp Exit @@: ret Last edited by Picnic on 27 Oct 2010, 19:54; edited 1 time in total |
|||
![]() |
|
semiono 27 Oct 2010, 14:44
Thanks!!!!!!!!!!!!!!!!!! "Use at your own risk." Very well
Good!!! And I don't need Vista anyway! ![]() ---- I went to test ![]() |
|||
![]() |
|
Picnic 27 Oct 2010, 20:00
You're welcome semiono.
p.s: I did a small change in 'Allocate' part. |
|||
![]() |
|
semiono 27 Oct 2010, 21:47
Picnic, this code available to set (Lucida Console 18 ) ?
Is it only Raster Fonts enums? On the fly i don't understant what is font i see in animation... And please, howto set some assign font n x m and stop enums other? I can't quickly read and modify yor large code ![]() |
|||
![]() |
|
Picnic 27 Oct 2010, 23:02
Quote: Is it only Raster Fonts enums? Quote: howto set some assign font n x m and stop enums other ebx is loaded with the FontArray start address and each font entry in table is a CONSOLE_FONT structure which occupies 8 bytes, so Code: invoke SetConsoleFont, [hOut], dword [ebx+0] Line below returns font size values in eax Code: invoke GetConsoleFontSize, [hOut], dword [ebx] Split eax lowword-highword (width-height) to ecx-edx Code: movzx ecx, ax shr eax, 16 mov edx, eax Hope this helps. |
|||
![]() |
|
semiono 28 Oct 2010, 02:35
Thanks!
|
|||
![]() |
|
semiono 29 Oct 2010, 02:28
regs way - close console and try again
![]()
_________________ Windows 9, FL Studio 19 |
|||||||||||
![]() |
|
semiono 29 Oct 2010, 02:43
What you say about it?
push TRUE vs jmp's ... And how it work? lpData dd NULL dup NULL ![]() |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.