Hi, i try to programm a little plugin, that has access tu the main programm.
But when I want to add a Item in the listview control, the main programm srashes. - I pnly can delete all items.
What could be wrong ?

Posted on 2003-09-25 13:03:37 by Bubu-Boy
please post code... i have a feeling either your not correcting the stack or set something up wronge..
Posted on 2003-09-25 13:23:30 by devilsclaw
hi here is my code:

mov item.imask,LVIF_TEXT
mov item.iSubItem,1
mov item.iItem,1
mov item.pszText, OFFSET buffer
mov item.cchTextMax,sizeof buffer
INVOKE SendMessage, hWnd, LVM_GETITEMTEXT, 0, ADDR item

This code works fine with own listviews.
Posted on 2003-09-25 13:57:37 by Bubu-Boy
Hi, Bubu-Boy.
If hWnd is the correct handle to the listview (not the parent window), then the code you posted is 100% correct. So the bug must be somewhere else...
Posted on 2003-09-25 17:16:27 by QvasiModo
Hi, i tryed some other programm (not written by me) explorer.exe for example.
they crahes all. I can delite all items, but i cant read a item. *arggg*
or add a item.

Perhaps I need the right rights...? - But how other plugins works? Do i have to declare the listview handle as public?

Posted on 2003-09-26 05:51:43 by Bubu-Boy

Hi, i tryed some other programm (not written by me) explorer.exe for example.
they crahes all. I can delite all items, but i cant read a item. *arggg*
or add a item.

That's because you're not in the target process' address space. You're providing an address of the itemstruct that is not available in the target process or it may be occupied by a code section or something. You would have to inject your own DLL to the target process and somehow make it "contact" your program. Unfortunately, I can't help you any further, because I haven't done this myself yet.
Posted on 2003-09-26 06:55:02 by Morris
is there a nother way? - I overgive the address, and the address is availible. So it have to work.

what now ?
Posted on 2003-09-26 07:11:50 by Bubu-Boy
Search for "code injection", "hook", "interprocess communication", etc..
BTW, the problem resides in the fact that pointers are not valid across applications. So you need to either:
- "inject" code in the target app (that is, put it in it's memory space and execute it)
- install a global hook, and let the hook library do that
- if you have the source to the target pp as well, use WM_COPYDATA to pass it information. Or you can use a custom message with RegisterWindowMessage.
Posted on 2003-09-26 17:37:54 by QvasiModo
Yes there is... there is either ApiHooks Libs which have a error that needs to be corrected where sometimes it fails to load the program because it cant load the dll... not a big deal..

or there is the do it your self way...

It says it does not work on windows 2000 but that because it was not tested on windows 2000. it has now been tested and works.. he a friend of mine so i know this..
Posted on 2003-09-26 21:27:34 by devilsclaw
Thank you all!

expacelly QvasiModo, Morris and devilsclaw I will take a look.

Greets BBB
Posted on 2003-09-27 00:53:16 by Bubu-Boy