flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
revolution 07 Jun 2015, 08:34
You need to make it an address because of the implicit EBP offset:
Code: invoke SetWindowText, [hWndMain], addr searchingForFileStr ;... invoke FindFirstFile, addr fffStr, addr wfd |
|||
![]() |
|
DergMoney 07 Jun 2015, 09:14
Thanks for the quick reply revolution. Unfortunately it didn't work
![]() flat assembler version 1.71.39 (1048576 kilobytes memory) test.asm [72]: invoke FindFirstFile, addr fffStr, addr wfd D:\Program Files (x86)\Fasm\INCLUDE\macro/proc32.inc [17] invoke [3]: pushd arg error: invalid value. Code: proc threadCheckForFiles locals wfd WIN32_FIND_DATA fffStr db "*.txt", 00 searchingForFilesStr db "Searching for files...", 00 fnfHnd dd ? endl invoke SetWindowText, [hWndMain], addr searchingForFileStr cmp eax, TRUE je .start call showError .start: invoke FindFirstFile, addr fffStr, addr wfd cmp eax, INVALID_HANDLE_VALUE jne @f jne .start jmp .finish @@: ; save FindNext handle mov [fnfHnd], eax .finish: ret endp |
|||
![]() |
|
revolution 07 Jun 2015, 09:19
Are you including the win32ax.inc file?
|
|||
![]() |
|
DergMoney 07 Jun 2015, 09:27
All the code is is a simple window that sets up a thread 'threadCheckForFiles'
If I comment out the two 'offensive' lines ![]() Code: invoke SetWindowText, [hWndMain], addr searchingForFileStr . . invoke FindFirstFile, addr fffStr, addr wfd it assembles without issue ![]() Full code... Code: format PE GUI 4.0 entry start include "%fasminc%\win32a.inc" section '.code' code readable executable start: invoke GetModuleHandle, 0 mov [wc.hInstance], eax invoke LoadIcon, 0, IDI_APPLICATION mov [wc.hIcon], eax invoke LoadCursor, 0, IDC_ARROW mov [wc.hCursor], eax invoke RegisterClass, wc or eax,eax jz showError invoke CreateWindowEx, NULL, ClassMain, AppName, WS_OVERLAPPEDWINDOW or WS_VISIBLE, 100, 100, 600, 200, NULL, NULL, [wc.hInstance], NULL test eax,eax jz showError mov [hWndMain], eax invoke CreateThread, NULL, 0, threadCheckForFiles, NULL,NORMAL_PRIORITY_CLASS, tcffId invoke CloseHandle, eax msgLoop: invoke GetMessage, msg, NULL, 0, 0 or eax, eax jz endLoop invoke TranslateMessage, msg invoke DispatchMessage, msg jmp msgLoop showError: invoke GetLastError invoke FormatMessage, FORMAT_MESSAGE_FROM_SYSTEM or FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL, eax, LANG_NEUTRAL, errStrBuff, 0, NULL invoke MessageBox, HWND_DESKTOP, [errStrBuff], NULL, MB_ICONERROR or MB_OK endLoop: invoke ExitProcess, [msg.wParam] proc WndProc hwnd, wmsg, wparam, lparam push ebx esi edi cmp [wmsg], WM_DESTROY je .wmDestroy .defWndProc: invoke DefWindowProc, [hwnd], [wmsg], [wparam], [lparam] jmp .finish .showError: invoke GetLastError invoke FormatMessage, FORMAT_MESSAGE_FROM_SYSTEM or FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL, eax, LANG_NEUTRAL, errStrBuff, 0, NULL invoke MessageBox, HWND_DESKTOP, [errStrBuff], NULL, MB_ICONERROR or MB_OK .wmDestroy: invoke PostQuitMessage, 0 xor eax, eax .finish: pop edi esi ebx ret endp proc threadCheckForFiles locals wfd WIN32_FIND_DATA fffStr db "*.txt", 00 searchingForFilesStr db "Searching for files...", 00 fnfHnd dd ? endl invoke SetWindowText, [hWndMain], addr searchingForFileStr cmp eax, TRUE je .start call showError .start: invoke FindFirstFile, addr fffStr, addr wfd cmp eax, INVALID_HANDLE_VALUE jne @f jne .start jmp .finish @@: ; save FindNext handle mov [fnfHnd], eax .finish: ret endp section '.data' data readable writeable ClassMain db "WinClass", 00 AppName db "Test App", 00 hWndMain dd ? wc WNDCLASS CS_HREDRAW or CS_VREDRAW, WndProc, 0, 0, NULL, NULL, NULL, COLOR_BTNFACE + 1, NULL, ClassMain msg MSG errStrBuff dd ? tcffId dd ? section '.idata' import data readable writeable library kernel32,'KERNEL32.DLL',\ user32, 'USER32.DLL' include '%fasminc%\api\Kernel32.inc' include '%fasminc%\api\User32.inc' |
|||
![]() |
|
revolution 07 Jun 2015, 09:29
I see your problem: include "%fasminc%\win32a.inc".
You'll need the "x" version. include "%fasminc%\win32ax.inc" |
|||
![]() |
|
DergMoney 07 Jun 2015, 09:31
Hadn't noticed you changed your last post.Here's fasm's output using win32ax
flat assembler version 1.71.39 (1048576 kilobytes memory) test.asm [67]: invoke SetWindowText, [hWndMain], addr searchingForFileStr D:\Program Files (x86)\Fasm\INCLUDE\win32ax.inc [41] invoke [0]: \{ \reverse pushd <arg> D:\Program Files (x86)\Fasm\INCLUDE\win32ax.inc [37] pushd [27]: pushd <value> D:\Program Files (x86)\Fasm\INCLUDE\win32ax.inc [37] match [1]: pushd <value> D:\Program Files (x86)\Fasm\INCLUDE\win32ax.inc [78] pushd [6]: if +var relativeto 0 | +var relativeto $ D:\Program Files (x86)\Fasm\INCLUDE\win32ax.inc [78] match [1]: if +var relativeto 0 | +var relativeto $ error: undefined symbol 'searchingForFileStr'. |
|||
![]() |
|
DergMoney 07 Jun 2015, 09:34
Duh!
searchingForFileStr vs searchingForFilesStr sorry to waste your time ![]() |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.