New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix migrate by process name #8110
Conversation
@@ -42,7 +42,7 @@ def run | |||
if datastore['SPAWN'] | |||
print_status("Spawning notepad.exe process to migrate to") | |||
target_pid = create_temp_proc | |||
elsif datastore['PID'] != 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Damn.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha! That does make sense, I should've noticed that and mentioned it in #8109. Thanks!
@@ -23,8 +23,8 @@ def initialize(info={}) | |||
register_options( | |||
[ | |||
OptBool.new( 'SPAWN',[ false,'Spawn process to migrate to. If name for process not given notepad.exe is used.', true]), | |||
OptInt.new( 'PID', [false, 'PID of process to migrate to.']), | |||
OptString.new( 'NAME', [false, 'Name of process to migrate to.']), | |||
OptInt.new( 'PID', [false, 'PID of process to migrate to.', nil]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should be nil
by default if none specified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are nil
!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean they're already nil
.
Release NotesThis fix resolves an issue that prevented process migration through a specified process name from being handled as expected on Windows systems. |
Fixes #8109
This fixes the ability to migrate into a process by name (e.g., explorer.exe). The if/else block would never reach the NAME check because
pid != 0
is always true (unless for some reason you specifically set it to 0).