I'm trying to write a keyboard hook with VC++ 5.0 under Win NT.
Now I've found the source of all my problems: a string in the shared segment. I'd like any suggestion that will help solving this nasty problem. I'll try to explain you....
I've 3 possibility :
1- I declare the string in the shared segment initializing it to NULL. Then, when my hook try to assign a value to it, my foreground
application (whatever it is) crashes giving this message (The
instruction in "a location" referenced to the location "0x00000000". The memory couldn't be "written"). This happens also when the string is initialized to a string long d characters and after my hook assigns to this string longer than d to this string.
2- I initialize the string to a very long string. Then the foreground applications have never crashed, but the hook "sometimes" (when it uses predefinited functions like strcpy or others) stops working. It ignores keyboard messages.
3- I do NOT put the string in the shared segment, then my hook doesn't stop, the applications don't crash, but obviously the hook doesn't work well 'cause it sometimes loses the string value.
I'm sorry for being so verbose, but I want the problem very clear to you. As previously said any help will be really welcomed.