• Earn real money by being active: Hello Guest, earn real money by simply being active on the forum — post quality content, get reactions, and help the community. Once you reach the minimum credit amount, you’ll be able to withdraw your balance directly. Learn how it works.

ASM SelfPath[MASM]

Status
Not open for further replies.

top10

Moderator
User
Joined
Mar 18, 2015
Messages
487
Reputation
0
Reaction score
5,047
Points
243
Credits
0
‎10 Years of Service‎
70%
[LENGUAJE=ASM].386

.model flat,stdcall

option casemap:none

include \masm32\include\windows.inc

include \masm32\include\kernel32.inc ; Needed for GetModuleFileName

includelib \masm32\lib\kernel32.lib ; Library for Kernel32

include \masm32\include\user32.inc ; Needed For MessageBox

includelib \masm32\lib\user32.lib ; Library for User32

.data ;Data Section

MsgBoxCaption db File Location,0 ; Caption Used In MessageBox

MsgBoxText db This file is located in.,0 ; Text String

mPath byte 256 dup (0) ; Variable in which EXE Path will be stored

.code ; This Is The Section Where The Actual Code Is

start:

invoke GetModuleFileName, 0, offset mPath, 256 ; Invokes GetModuleFileName and stores address in variable mPath

invoke MessageBox, NULL, addr MsgBoxText, addr MsgBoxCaption, MB_OK ; MessageBox Displaying The String MsgBoxText

invoke MessageBox, NULL, addr mPath, addr MsgBoxCaption, MB_OK ; MessageBox Displaying the actual Executeable Location

invoke ExitProcess, NULL ; Closes The Application Properly Without Errors

end start[/LENGUAJE]

Credits DeadlyVermilion

 
Status
Not open for further replies.
Back
Top