You are trying to access a local variable that has already gone out of scope. This is a bad idea. Instead, you should rewrite your GetExecutablePath
function such that it accepts a pointer to a buffer.
To answer the question anyway: technically, you would use some form of memory block copy.
PS: you don't have to zero eax
when you know it's already zero ;)
PS #2: you should forget about masm's high-level directives such as .if
or .while
and use the appropriate asm constructs instead. If you are a beginner you should learn those, and if you are not, then it's no extra effort and you'll at least know exactly what you'll get.