Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 833171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:28:31+00:00 2026-05-15T04:28:31+00:00

I’m confusing about opening different threads with OpenThread Function and examining them with NtQueryInformationThread

  • 0

I’m confusing about opening different threads with OpenThread Function and examining them with NtQueryInformationThread native function .
I have no problem with NtQueryInformationThread & I can examine them finely.
the problem is I don’t know how to loop through different number of threads using OpenThread
(with SetDebugPrivilege Consideration) .
suppose we have different threads from number 5100 to 5200 & we want to examine them sequentially : for example 5100, 5101, 5102, 5103, 5104, 5105 … 5200 … .
I don’t know how to use OpenThread Function in delphi in right way … .
I’m using this syntax & I found it wrong :

OpenThread(THREAD_ALL_ACCESS,false,(DWORD)5100)

.
if anyone could guide me how to use OpenThread though different number of threads it would be great .

thanks alot .

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T04:28:31+00:00Added an answer on May 15, 2026 at 4:28 am

    I’m not sure how’d you get threads with stricly sequential IDs, cause Windows doesn’t (have to) assing thread IDs in any pattern.
    If you want to loop through a set of threads, you’ll have to use the Tool Help API:

    1. call CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0) to get system state snapshot
    2. loop through the threads with Thread32First and Thread32Next and select the threads you want to work with (eg. by its process’ ID)
    3. use OpenThread with an appropriate access mask, eg. THREAD_QUERY_INFORMATION

      do NOT use THREAD_ALL_ACCESS unless you created the thread in the current process and you know exactly what you’re doing
      (restrain yourself to read-only access, if you touch threads of another process)
    4. do what you want to, eg. call NtQueryInformationThread
    5. don’t forget CloseHandle

    You have to handle the possibility of any of the threads terminating (and being replaced with a new thread with the same ID) as long as you don’t hold the threads handle.

    Edit (further clarification by request)
    The CreateToolhelp32Snapshot with dwFlags == TH32CS_SNAPTHREAD gives you a system-wide snapshot (the th32ProcessID argument is ignored in this case) of all threads existing in the moment, regardless of their state, and the THREADENTRY32 structure subsequently returned by Thread32[First|Next] contains the th32ThreadID and th32OwnerProcessID fields, which you can use to identify the thread.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I don't have much knowledge about the IPv6 protocol, so sorry if the question
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I am reading a book about Javascript and jQuery and using one of the
I have this code to decode numeric html entities to the UTF8 equivalent character.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.