I had prepared a portion of my conference demo which involved a hook procedure.
It ran perfectly stand-alone, but running from a DLL in the RBase address space it blew up. I am told there is only one other hook procedure active in the RBase GUI, FWIW. Using a key logger to capture data seems extraordinary and burdensome to say the least. ----- Original Message ----- From: "Paul InterlockInfo" <[EMAIL PROTECTED]> To: "RBASE-L Mailing List" <[email protected]> Sent: Wednesday, March 19, 2008 11:15 PM Subject: [RBASE-L] - Re: Hooked on Handles > When a program starts (well RBase launches it with a command) I would also > like to launch this keylogger/hook just on to this program and grab what is > keyed in to this launched program and then grab it all and digest it into > the RBase program then shut it down. This program that I launch has a set > of date fields and customer id that I could then validate against the > database and see that this person did not accidently assign a wrong date. > This other program, there is no getting into the fields and the programmers > are not going to allow it. They think no matter how many times I have told > them, all I want is the date and id! > > > > I hate to think using a keylogger. I spend hours every day checking > computers for these things and just the thought of using one makes me sick! > So I was thinking a more professional way and > > > > Sincerely, > > Paul Dewey > > > > > > Example see below, but to me it looks GREEK to me! Just looking for > ideas or advice. Jumping off a bridge is not an option. > > > > > uses > SysUtils, > Classes,windows; > > var CurrentHook: HHook; > { > GlobalKeyboardHook > } > function GlobalKeyBoardHook(code: integer; wParam: word; lParam: longword): > longword; stdcall; > begin > if code<0 then begin //if code is <0 your keyboard hook should always > run CallNextHookEx instantly and > GlobalKeyBoardHook:=CallNextHookEx(CurrentHook,code,wParam,lparam); > //then return the value from it. > Exit; > end; > //firstly, is the key being pressed, and is it between A and Z > //note that wParam contains the scan code of the key (which for a-z is > the same as the ascii value) > if ((lParam and KF_UP)=0) and (wParam>=65) and (wParam<=90) then begin > // I hope I can do something here with wParam before it reaches the > active application > // but don't know how > end; > CallNextHookEx(CurrentHook,code,wParam,lparam); //call the next hook > proc if there is one > GlobalKeyBoardHook:=0; //if GlobalKeyBoardHook returns a non-zero value, > the window that should get > //the keyboard message doesnt get it. > Exit; > end; > { > SetHookHandle > ------------- > This procedure is called by hooks.exe simply to 'inform' the dll ofthe > handle generated when creating the hook. This is required if the hook > procedure is to call CallNextHookEx. It also resets the > position in the key list to 0. > } > procedure SetHookHandle(HookHandle: HHook); stdcall; > begin > CurrentHook:=HookHandle; > end; > exports GlobalKeyBoardHook index 1, > SetHookHandle index 2; > begin > end. > // Global unit > unit Global; > interface > uses windows,Local; > //define the structure of the SetHookHandle function in hookdll.dll > type TSetHookHandle = procedure(HookHandle: HHook); stdcall; > var LibLoaded: boolean; //true if hookdll.dll is already loaded > LibHandle: HInst; //dll handle > HookProcAdd: pointer; //memory address of hook procedure in windows > GHookInstalled: boolean; > SetHookHandle: TSetHookHandle; > function LoadHookProc: boolean; > function SetupGlobalHook: boolean; > implementation > { > LoadHookProc > } > function LoadHookProc: boolean; > begin > //attempt to load the dll containing our hook proc > LibHandle:=LoadLibrary('hookdll.dll'); > if LibHandle=0 then begin //if loading fails, exit and return false > LoadHookProc:=false; > exit; > end; > //once the dll is loaded, get the address in the dll of our hook proc > HookProcAdd:=GetProcAddress(LibHandle,'GlobalKeyBoardHook'); > @SetHookHandle:=GetProcAddress(LibHandle,'SetHookHandle'); > if (HookProcAdd=nil)or(@SetHookHandle=nil) then begin //if loading fails, > unload library, exit and return false > FreeLibrary(LibHandle); > LoadHookProc:=false; > exit; > end; > LoadHookProc:=true; > end; > { > SetupGlobalHook > > > > > > > > From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Lawrence > Lustig > Sent: Wednesday, March 19, 2008 5:50 PM > To: RBASE-L Mailing List > Subject: [RBASE-L] - Re: Hooked on Handles > > > > << > > I know that I am using the term "legit" loosely here. But please note that > I am not trying to steal anything. My attempt is only to capture user input > and place it into the database, not change or copy. > > >> > > > What are you trying to do? Hook the keyboard? You can look up keyboard > loggers -- they're generally not considered "good form", but I'm sure there > are some legitimate uses for them. > -- > Larry > >

