flat assembler
Message board for the users of flat assembler.

Index > Windows > [solved] How Suspend/Resume thread?

Author
Thread Post new topic Reply to topic
nairam



Joined: 12 Feb 2015
Posts: 3
nairam 05 Sep 2016, 21:38
This not work. I mean set thread dor concrete cpu core
Sad

invoke CreateThread,0,1024,vlakno2,dword edi,4,dword [thread2]
invoke SetThreadIdealProcessor,dword [thread2],0
invoke ResumeThread,dword [thread2]

nairam


Description: example
Download
Filename: multithread_11_suspend.ASM
Filesize: 1.54 KB
Downloaded: 464 Time(s)

Post 05 Sep 2016, 21:38
View user's profile Send private message Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1619
Location: Toronto, Canada
AsmGuru62 06 Sep 2016, 02:12
Here:

https://msdn.microsoft.com/en-us/library/windows/desktop/ms686253(v=vs.85).aspx

1. The system schedules threads on their preferred processors whenever possible.

So, if you call the function - it is not guaranteed to run in the core you specify.

2. Did you call GetLastError() AFTER calling SetThreadIdealProcessor() - maybe it will give you some idea why system failed to schedule your thread for the specified core.
Post 06 Sep 2016, 02:12
View user's profile Send private message Send e-mail Reply with quote
nairam



Joined: 12 Feb 2015
Posts: 3
nairam 06 Sep 2016, 12:20
invoke CreateThread,0,1024,vlakno2,dword edi,4,dword [thread2]
invoke SetThreadIdealProcessor,dword [thread2],0
invoke GetLastError
invoke ResumeThread,dword [thread2]

eax == ERROR_INVALID_HANDLE ;(6)

I try dword[threadID] also only threadID or NULL with id in EAX.
How I get global? threadID?
Post 06 Sep 2016, 12:20
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20303
Location: In your JS exploiting you and your system
revolution 06 Sep 2016, 13:55
You need to use the thread handle, not the ID. The handle is returned in EAX.
Post 06 Sep 2016, 13:55
View user's profile Send private message Visit poster's website Reply with quote
nairam



Joined: 12 Feb 2015
Posts: 3
nairam 06 Sep 2016, 15:08
Yes, with handle in EAX work. Tnx.
Post 06 Sep 2016, 15:08
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.