Jump to content

SelfPath[MASM]


top10
 Share

Recommended Posts

[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

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

Chat Room

Chat Room

Chatroom Rules

No support in chat, open a thread.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

The popup will be closed in 15 seconds...