Jump to content
Tuts 4 You

Delphi To Fasm


Isaev

Recommended Posts

Posted
  Function GetAppDataPath:String;
Var
Test:Array[1..255] Of Char;
Begin
FillChar(Test,SizeOf(Test),Ord(' '));
SHGetSpecialFolderPath(Application.Handle,@Test,CSIDL_APPDATA,False);
Result:=Trim(Test);
End;Path:=GetAppDataPath+'\mypath\txt.txt';
Posted

Try this:

  CALL GetStartupInfoA
POP EAX
POP EAX
POP EAX
POP EAX

Now the full programs path together with name is loaded in EAX..

Posted
Path:=GetAppDataPath+'\mypath\txt.txt';

rip the parts you need as I did ;)

; DialogBox exampleformat PE GUI 4.0
entry start
include 'put your path here\INCLUDE\WIN32ax.INC'
include 'put your path here\INCLUDE\MACRO\MASM.INC'
include 'put your path here\INCLUDE\MACRO\PROC32.INC'
include 'put your path here\INCLUDE\API\SHELL32.INC'
ID_MESSAGE = 102
CSIDL_APPDATA equ 1ahsection '.data' data readable writeable
flags dd ?
caption rb 40h
message rb 100h
rbuf rb MAX_PATH
fn db '\mypath\txt.txt',0
section '.code' code readable executable start:
invoke GetModuleHandle,0
invoke DialogBoxParam,eax,37,HWND_DESKTOP,DialogProc,0
or eax,eax
jz exit
invoke MessageBox,HWND_DESKTOP,message,caption,[flags]
exit:
invoke ExitProcess,0proc DialogProc hwnddlg,msg,wparam,lparam
push ebx esi edi
cmp [msg],WM_INITDIALOG
je .wminitdialog
cmp [msg],WM_COMMAND
je .wmcommand
cmp [msg],WM_CLOSE
je .wmclose
xor eax,eax
jmp .finish
.wminitdialog:
jmp .processed
.wmcommand:
cmp [wparam],BN_CLICKED shl 16 + IDOK
jne .processed invoke SHGetSpecialFolderPathA,[hwnddlg],rbuf,CSIDL_APPDATA,FALSE
invoke lstrcatA,rbuf,fn
invoke SetDlgItemText,[hwnddlg],ID_MESSAGE, rbuf .failed:
jmp .processed
.wmclose:
invoke EndDialog,[hwnddlg],0
.processed:
mov eax,1
.finish:
pop edi esi ebx
ret
endpsection '.idata' import data readable writeable library kernel,'KERNEL32.DLL',\
user,'USER32.DLL',\
shell,'SHELL32.DLL'
import kernel,\
GetModuleHandle,'GetModuleHandleA',\
lstrcatA,'lstrcatA',\
ExitProcess,'ExitProcess'
import user,\
DialogBoxParam,'DialogBoxParamA',\
SetDlgItemText,'SetDlgItemTextA',\
MessageBox,'MessageBoxA',\
EndDialog,'EndDialog' import shell,\
SHGetSpecialFolderPathA,'SHGetSpecialFolderPathA'section '.rsrc' resource data readable directory RT_DIALOG,dialogs resource dialogs,\
37,LANG_ENGLISH+SUBLANG_DEFAULT,demonstration dialog demonstration,'SHGetSpecialFolderPathA',70,70,190,65,WS_CAPTION+WS_POPUP+WS_SYSMENU+DS_MODALFRAME
dialogitem 'EDIT','',ID_MESSAGE,10,10,170,13,WS_VISIBLE+WS_BORDER+WS_TABSTOP+ES_AUTOHSCROLL
dialogitem 'BUTTON','OK',IDOK,10,30,45,15,WS_VISIBLE+WS_TABSTOP+BS_DEFPUSHBUTTON
enddialog
Posted

Addict

Super! It is impossible to transfer my happiness! :D

Many thanks!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...