Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Windows API
  4. CBT HOOK not called sometimes

CBT HOOK not called sometimes

Scheduled Pinned Locked Moved Windows API
helphostingperformancequestion
2 Posts 2 Posters 3 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dani kenan
    wrote on last edited by
    #1

    Hi, I have a hook dll to implement a CBT global hook which help us identify some specific type of windows creation. Lets assume the dll is called "a.dll" and that it is is installed by process "a.exe" using SetWindowsHookEx. Due to performance considerations, the hook should only be installed on processes with name "b.exe". In the DllMain of "a.dll", when dwReason == DLL_PROCESS_ATTACH I check for the hosting process name and ensure it is either "a.exe" or "b.exe", otherwise I return 0, which ensures the dll is not loaded to that process. This works great 99% of the time, but seldom we see glitches, where the cbt hook is not being called, and we miss the creation of some of the windows. Are you familiar with this issue? Can you think of something we are doing wrong? Do you have a better/fully consistent solution for identifying windows creation? 10x Dani

    L 1 Reply Last reply
    0
    • D dani kenan

      Hi, I have a hook dll to implement a CBT global hook which help us identify some specific type of windows creation. Lets assume the dll is called "a.dll" and that it is is installed by process "a.exe" using SetWindowsHookEx. Due to performance considerations, the hook should only be installed on processes with name "b.exe". In the DllMain of "a.dll", when dwReason == DLL_PROCESS_ATTACH I check for the hosting process name and ensure it is either "a.exe" or "b.exe", otherwise I return 0, which ensures the dll is not loaded to that process. This works great 99% of the time, but seldom we see glitches, where the cbt hook is not being called, and we miss the creation of some of the windows. Are you familiar with this issue? Can you think of something we are doing wrong? Do you have a better/fully consistent solution for identifying windows creation? 10x Dani

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      dani kenan wrote:

      Are you familiar with this issue?

      No

      dani kenan wrote:

      Can you think of something we are doing wrong?

      Yes. maybe your comparison code isn't correct. Are you using a case-sensitive string compare? suggestion: log every DLL_PROCESS_ATTACH with its relevant data to a text file and inspect that. :)

      Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

      Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups