🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #13758

Casting LPARAM to correct type

#13758
From: Brent
Date: Thu, 11 Sep 2003 23:38
43 lines
2141 bytes
Hi All,

I havn't been able to find any other examples like this when it comes to
casting.  Anyway, here goes.  I'm writing a WH_DEBUG hook and below is my
callback procedure.

The lParam points to the address of a DEBUGHOOKINFO structure.  How do I get
the 'data' from this structure and pass it onto the CallNextHookEx function?
Thanks.

LRESULT CALLBACK MyDebugHook(int Code,
  WPARAM wParam, LPARAM lParam)
{
  // if (HDebugHook is 0 it means that a new
  // process has attached to the hook DLL.
  // We must load the HDebugHook value from
  // the temp file so that we can pass it
  // in CallNextHookEx.
  if (HDebugHook == 0) {
    FS = new TFileStream(
      TempHookFile, fmOpenRead);
    FS->Read(HDebugHook, sizeof(HDebugHook));
    delete FS;
  }

  DEBUGHOOKINFO *hookInfo = reinterpret_cast<DEBUGHOOKINFO *>(lParam);
  if(Code == HC_ACTION)
    return CallNextHookEx(HDebugHook, hookInfo->code,
                                          hookInfo->wParam,
hookInfo->lParam);

  if(wParam == WH_SHELL)
    ShowMessage("About to call a Shell HOOK");

// Call the next hook in the chain.
  return CallNextHookEx(HDebugHook, hookInfo->code,
                                        hookInfo->wParam, hookInfo->lParam);

}

Thanks,

brent
Technical Details
Message-ID: <3f610680@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-05!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,bee5ed984338f8ea,start
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-09-11 16:36:31 PST
From: "Brent" <nospam@nospam.com>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Casting LPARAM to correct type
Date: Fri, 12 Sep 2003 09:38:57 +1000
Lines: 45
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 203.10.46.171
Message-ID: <3f610680@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1063323264 203.10.46.171 (11 Sep 2003 16:34:24 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-05!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail