Creating a temporary variable
Lets say you need a temporary variable, but you want to create it inside an inline or macro you could use several options such as using inherited variables or globals however probably the best option would be like so:
// First we will push a 0 integer onto the stack
// If you require a pointer to an int, then push your int value instead.
push 0
// esp is the pointer to the stack which is the top value (latest push)
// the stack is is 4 byte aligned (int or dword size)
myFunction(esp);
// finished with the int, remove it from the stack without trashing a register
add esp, 4
a sample of it in use would be the filewrite macro:
inline function filewrite(handle, text, len) {
push eax
WriteFile($handle,$text,$len,esp,0);
add esp, 4
$return eax;
}
in this case the WriteFile api requires a pointer to a dword to write the written byte count, filecreate does not use it so we can just use the temporary solution as so.