So i have a really old game client that annoyingly takes it upon itself to change the desktop resolution to cater for something like 1600x900 resolution to achieve full screen, i'm trying to figure out how to stop this happening.
I imagine it's calling something like ChangeDisplaySettings() in user32.dll, if so is it possible to block specific dll calls, or perhaps an easier way?
Thanks in advance.
EDIT: I should add the game client is not my own thus i have no direct control over what it's doing.
I have managed to breakpoint before the ChangeDisplaySettingsA() call and modify the lpDevMode parameters to achieve what i want, now i just need to figure out how to do this programmatically.
Related
It may be a silly question, but I dont know what to google.
Consider this, we are building unity AR application that run on IOS. Every client has custom need, so there is custom application for every one of them. Because of that whole application lifecycle managment is nigthmare.
We would like to build just one appliaction as player and download all content (unity app) from server and just run it.
Is something like that possible? How can we achieve that?
You could make a variable that can be selected to set up the application based on that one global variable.
For example make a class called "Global" as a Singleton class, then call that class from wherever you need custom needs set up to see in which way they should be adjusted.
If it's not only IOS related, you can use Platform Dependent Compilation: https://docs.unity3d.com/Manual/PlatformDependentCompilation.html
AssetBundle recommended by #Everts seems like good fit, it does not solve everything but for sure helps a lot.
i need to block any screen capture software on the computer from taking screen shots. Since all of them are work on standard API-functions, i think i could monitor and block them.
I need to use C#.
All i have found is how to monitor and block them in a certain program (screen capture program). They are looking for a function in the program, then they change it address on mine function address.
But how can i do it, if i haven't any certain programs? I need to block anyone which tries to take a screenshot.
If your final goal is possible or not I don't know, but for the hooking the API portion I can help you out.
I have used the library EasyHook many times in the past, this will let you hook and intercept system function calls from C# code fairly easily. Just read through the PDF tutorial for setup instructions.
For actually finding the API's I recommend Rohitab's API Monitor, it's still in Alpha stages but it works really well and is free. You just hook it on to a processes and it tells you every external DLL call it makes (with the parameters it passed if you have the xml definition file for the DLL, the program comes with almost all of the windows API dll's pre-defined).
The combination of EasyHook and API Monitor is a great 1-2 punch for mucking with other program's calls.
It is not possible to prevent screenshots from being taken. The battle is already lost because of the DWM (Desktop Window Manager). It's lower level than Win32 and device contexts.
If you want to protect the text in your program, there are a lot easier ways to extract it than doing screenshots and OCR. TextOut and/or Direct2D hooking and accessibility APIs.
If there's a lot of IP in your program. Then don't make it all available onscreen. Make sure it's tedious to crawl the GUI for text, and hard to automate it. And don't load whole texts in memory of the program.
Possible solutions:
1. To prevent copying of text. Draw the text as an image.
2. To prevent accessibility technologies, like screen readers - override WndProc in your control, handle and ignore the window message WM_GETOBJECT.
3. To make it harder if they try to use OCR. Draw graphics behind the text. Human readable, but much harder for a machine to interpret it.
Neither of these methods are invasive for the user.
** A very invasive suggestion **:
If you are really serious about preventing anyone from "stealing" your content.
Implement mouse and keyboard hooks. Filter out typical copy shortcuts. Prevent the mouse from leaving the boundaries of your application.
Allow your application to only run when the OS runs well-known processes and services.
If any process starts which you don't recognize, black out the application and notify the user about it, and request the user to close it. And ofc make sure someone is not just spoofing a well-known process.
Monitor the clipboard as you suggested yourself.
You can ofc soften some of these suggestions based on the context of your application.
As Scott just posted it likely can be prevented with API hooks to see that paint events only go to desktop bound handles and not others, and refuse to paint otherwise. However, you need to consider the following scenarios and see if they're relevant threat to your approach or not:
Your software may be running in a virtual machine like VMWare. Such software has capapbilities to capture screen that does so at "virtual hardware" level, and your API hooks will not be able to discern it - and this would be the easiest way approach if I wanted to bypass your protections.
As a post suggests here, nothing also prevents someone to take monitor cable and plug it into another computer's capture card, and take screenshot that way. Again, your hooks will be helpless here.
Bottom line, you can make it somewhat harder to do, but bypassing such protection may be pretty trivial thing to do.
My 2c.
Is it possible, without modifying the Windows OS, to have a piece of software intercept the rendering of the desktop, and modify it before it is displayed? For example, if I wanted to intercept it, and apply a fish-eye effect to my entire screen, would this be possible?
If so, how would I go about doing so? (Don't worry about the effects, was only an example, i merely need the interception side of things)
Also, I need to be able to intercept mouse clicks, and modify their position before Windows responds to the input.
If anyone has links to this, or similar projects in C# or C++, that would also be extremely helpful.
Yes it's possible. E.g. the WinAmp player does that. However that code is very unstable so be prepared to reboot if you try it.
Please help me create hook for AP.I function GetSystemMetrics.
I want that when some app(for example calc.exe) call GetSystemMetrics they receive my value(for example 500x500) and other apps get correct screen size.
And if somebody can tell me how can I do this use C# and .net CF 2.0 I'll be very happy.
Thanks and hope for you help.
I don't think it's possible to do in C#/.NET without writing any native code. However, the good news is that there is a wonderful library called madCodeHook which is really easy to use. Take a look at http://madshi.net/
You can't do that, even in native code (at least not without ugly, bad-idea, vtable/kernel memory hacks that may or may not continue to work across versions of the OS). GetSystemMetrics calls down to the OS to get information about the platform. There's no way, short of recompiling the OS and changing those values, that you can "override" thse values and get the OS to report other numbers (unless, of course, the OS was already built in such a way that those numbers came from somewhere your app can modify - like the registry).
EDIT
Based on your comments, your actual problem is that you're trying to create some form of "taskbar" type application and you'd like other apps outside of your control to not overlay your taskbar when they maximize. This is exactly how the exisiting Explorer taskbar works, so my suggestion is to go look in the default shell source code and see how it is accomplished there.
The end result is likely going to be that you will either clone the existing shell code and modify the existing taskbar to meet your needs, or you'll create an entirely new shell application that has the behavior you want, but you almost certainly are going to have to replace the shell, and that can only be done with native code.
I'm using DirectShowNet.dll to grab a photo
of my web camera.
Anytime my camera initializes it first shows me this
screen. Where can I turn it off?
http://www.goat-it.com/!tino/screen.jpg
Looks like your code is pulling up the prop pages for your camera. I have only been able to get this property page to show if I explicitly write code to do it. How are you getting the image? Graph -> CaptureGraphBuilder2 + SampleGrabber -> SampleGrabberCB?
You could use the Win32 FindWindow command to find it and then send a WM_COMMAND to press the OK button?
Edit: Well if you want to do it the more "proper" way (Though my experience is from the C++ end, but I assume its much the same) you may want to locate the video capture filter. Once you've located that you can query interface it to see if you can access its IPropertyPage (IIRC) interface. If you can then you should just be able to call Deactivate.
Alas I don't have access to a webcam at the moment so I can't check on how exactly to do this ...
Are you using the ICaptureGraphBuilder? If so it may well be worth learning how to enumerate all the devices and attach them together yourself. It will give you a MUCH better understanding of whats going on :)