Posted October 15, 200717 yr 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';
October 15, 200717 yr Try this: CALL GetStartupInfoA POP EAX POP EAX POP EAX POP EAXNow the full programs path together with name is loaded in EAX..
October 15, 200717 yr Path:=GetAppDataPath+'\mypath\txt.txt'; rip the parts you need as I did ; DialogBox exampleformat PE GUI 4.0entry startinclude '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 = 102CSIDL_APPDATA equ 1ahsection '.data' data readable writeable flags dd ? caption rb 40h message rb 100h rbuf rb MAX_PATH fn db '\mypath\txt.txt',0section '.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 retendpsection '.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
Create an account or sign in to comment