Does anybody know a way to do such thing? I assume there's some API functions.
Thanks!
Does anybody know a way to do such thing? I assume there's some API functions.
Thanks!
A friend gave me 2 programs he created:
One program (msnmsgr.exe, the first one) uses CreateProcess to the other one which is (svchost.exe, another program he created) and this program open the clipboard and writes a string using SetClipboardData while(1).
Now I am supposed to gain back the access to the clipboard (Note that he is using familiar program names, it might be a hint)
The entire point of the clipboard is so multiple programs have access to shared memory. If you want no others to access it, find other means of whatever you're trying to do.
MagosX.com
Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime.
This isn't a board for virus creation discussionsI'm trying to make that no other application will be able to write to the clipboard
All problems in computer science can be solved by another level of indirection,
except for the problem of too many layers of indirection.
– David J. Wheeler
The clipboard is actually a chain of windows referred to as the clipboard viewer chain. If you wish to bypass any/all windows in this chain, you will have to add your GUI's app to the head of this chain. Your app can then choose not to pass this information down the chain or choose a starting window to pass the information down the chain. In other words, the app can choose to pass the information down the chain starting at the fourth window in the chain and going down the chain from that point. You must remove your GUI's window from the chain prior to terminating your app. Otherwise, the consequences will be extremely unpredicatable. An example.
What I'm trying to do IS NOT for a virus purpose, I guarantee - as I've told you, a friend gave me 2 programs: one that creates a process of the other one, and the other one who OpenClipboard(), EmptyClipboard(), SetClipboardData() while(1)! Do you want me to upload this 2 executables here so you could see these programs?
Last edited by eXeCuTeR; 07-27-2008 at 07:00 AM.
eXeCuTeR,
Just an FYI in case your intent is malevolent.
The solution I proposed will probably work on Li'l Tommies home computer. But in a more professional setting such as private/public sector organizations, it will definitely be detected by workstation policy settings. Thus, you'll have the network/security administrator rolling over with laughter if you use this technique.
Remember this quote?
I really don't care if it's a virus or a prank or whatever.
The thing is - you have not given a solid reason why you want to deny access to the clipboard.
If you want to retake the clipboard from a program, simply kill the program.
I find it silly to get a get an exercise to steal the clipboard from another program.
Do you actually want to moderate the clipboard (ie, control who gains access and which does not)?
Well behaved programs do not mess with the clipboard 'chain'. The clipboard is supposed to be a global OS-wide object that all programs can access. This is why we can take a screenshot and then open up some image editing program and paste from the clipboard to create a new image.
Any other behavior is completely against the design and therefore a misuse of the clipboard resource.
Last edited by VirtualAce; 07-27-2008 at 07:54 PM.