I'm just trying to use a few api calls to get the priority class from a single executable. Theoretically (and please let me know if I'm wrong), I can use the following: 1) FindWindow to get the handle of the window from its title. 2) GetWindowThreadProcessId to get the process id 3) GetPriorityClass to get the pri class of the process
Those're basically the relevant lines. I added message boxes at different stages of the code to help troubleshoot and I always get a return value of 0 from the GetPriorityClass call. I've traced that section of code with sice and it looks like the break down is happening with the processID after the return from the GetWindowThreadProcessID call. The handle is properly returned from the FindWindow call, so the problem must be in either (or both) the GetPriorityClass or GetWindowThreadProcessID calls. More than likely I'm messing up the params for one (or both) of these functions. Does anyone see the problem? --4oh4
invoke FindWindow, NULL, addr winTitle mov hwnd, eax invoke GetWindowThreadProcessId,hwnd, processID invoke GetPriorityClass, processID mov eax, processID ;to check against the different pri classes
i dont have the API reference by me ... but arent there supposed to be "addr processID" instead of just processID in the second invoke ? and isnt the 3rd invoke returning value in eax that you just overwrite right after ?
Let me start by saying that I'm fairly new to the world of asm, and thus open to all suggestions here. I had originally tried "addr processID" as the second parameter in the GetWindowThreadProcessId invoke. It didn't work either. As for the "mov eax, processID"... I copy and pasted the code into the first post and left out much of the code that wasn't applicable. There were several lines of code between the GetPriorityClass invoke and the "mov eax, processID". I did however switch to a different register just to avoid confusion. --4oh4