Skip to content
⌘ NSIS Forum Archive

GetCurrentProcessId gives 'error'

5 posts

demiller9#

GetCurrentProcessId gives 'error'

Can someone please tell me why I get an error from this?
System::Call "Kernel32::GetCurrentProcessID() i .r4"
${If} $4 == "error"
System::Call kernel32::GetLastError()i.r5
${EndIf}
$4 = 'error' and $5 = 126, which means "ERROR_MOD_NOT_FOUND"??

Thanks,
Don
Anders#
System::Call "kernel32::GetCurrentProcessId()i.r4" (Id not ID)

BTW, the system plugin can call GetLastError for you in the same call, check out the system readme. Calling it the way you are doing is probably not a good idea, you don't know if System::Call does something to change the error state
demiller9#
I added the v in both places and the result is the same.

EDIT: Corrected the name from ID to Id and of course it works. The v was not necessary after all. I'll re-read the docs about letting it call GetLastError. Thanks, Anders.

Don