Programmatically Allow Access to IE7/IE8 clipboard - winapi

Is there a way to programmatically disable the "Allow Access" message box that keeps getting in the way of the user every time my program tries to read IE's clipboard?

You haven't explained where your program is running specifically. The client user may use Tools > Internet Options > Security > Custom... to adjust the security option. If you're hosting the web browser control, you can use the Feature Control Key to opt-out of clipboard protections.

Answering my own question: .NET Framework 3.0 has an API for that: IInternetSecurityManager.

Related

Firefox - deactivate "open with Application" to prevent system manipulation

I am using firefox in an security system. There is an option under Preferences --> Applications that alows the user to define what url will be opened in which application.
For example: mailto: will open Outlook. You can also define other keywords to open an application.
Is there a way to block this preferences? Script/Config what ever.
Thank you
Use a sandboxing solution that prevents firefox from acessing or executing those external applications. On linux you can use firejail and configure it accordingly.

SPDY on web browser control

I am trying to enable SPDY on web browser control (Internet Explorer 11/WIN 8.1).
In Internet Explorer advanced settings and in the registry the EnableSPDY3_0 is set to 1.
But in my web browser control the SPDY is not working.
Are there other settings that I need to configure?
How specifically are you attempting to detect SPDY?
I took a quick look with Fiddler and confirmed that SPDY is not used by the Web Browser control outside of IE itself. As this is a new and somewhat experimental feature, I'm not that surprised that the WebOC isn't using it yet.
If you rename your executable to iexplore.exe then you will find that SPDY is used. (WARNING: This isn't recommended for many functionality and security reasons.) That behavior indicates that they're using a FEATURE_CONTROL KEY to control whether SPDY is permitted; feature control keys work on a per-process basis.
I don't see a documented entry for this feature in the official FEATURE_CONTROL list. Internet Explorer's documentation writer and networking PM have confirmed that this is deliberately not documented and suggest that a bug be filed at connect.microsoft.com if you'd like to see a change in policy on this.

Setting mailto: protocol handler programmatically in Windows 8

Before Windows 8, the method of adding a mailto: protocol handler was straightforward (as outlined here Register Windows program with the mailto protocol programmatically)
As of Windows 8, the old method no longer works. It would seem that Win8 enforces the following key: HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Associations\URLAssociations\‌​MAILTO\UserChoice.
It also appears the ProgID of the selected app is hashed and can't be forged, at least not that I can tell.
Does anyone have a working method for this, or can point me at a utility class/code that'll outline how to accomplish this programmatically?
For code, any language will do.
Edit
I've been asked from other discussions to specify a use-case, so I think it'd be helpful in the context of this question. Please consider this screenshot https://github.com/shellscape/Gmail-Notifier-Plus/raw/master/Promotional/prefs-account.png and the checkbox allowing the user to specify mailto handling. In this use-case, no one is forcing the user, the user is in control and makes the decision. While windows 8 store apps (metro/modern) have an available app manifest entry that automates the missing process described above, nothing seems to readily exist for desktop apps.
You can set your application to be activated by a custom protocol (like mailto:). When the user installs your app, if there is no other app supporting that protocol, they are not prompted and you are automatically assigned to that protocol.
If, however, the user already has an app that handles that protocol, then they will be prompted with a list of apps who support that protocol with the option to select the default. You cannot force the user to make a specific selection.
Also, if the user clicks on a protocol (like myprotocol:) and they have no app installed that handles that protocol then they will be sent to the store (app) which automatically searches for all apps that support that protocol. The user then installs whatever they want. You cannot force the user to make a specific selection (if any at all).
I wrote an article on protocol activation. It might be interesting to you: http://blog.jerrynixon.com/2012/10/walkthrough-using-windows-8-custom.html
So, I made Desktop Firefox my default mailto handler today in Windows 8 by adding the string value "mailto" to the HKCU\Software\Clients\StartMenuInternet\FIREFOX.EXE\Capabilities\URLAssociations and setting the value of "mailto" equal to the ProgID or "FirefoxURL". I then deleted the keys at HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Associations\URLAssociations\‌​MAILTO\UserChoice to allow me to choose the default client again and this time Firefox was available for me to choose.
The essence of this question seems to be that one cannot take over the default client for any protocol anymore (post Windows 8). The user must choose. However, if you wanted to break the OS convention you could hook the call to create the choose default dialog, which would take research, effort, and be only a temporary kludge and would require "breaking" the OS, or you could send a double click to the dialog to choose for the user, assuming your program has elevated rights so that it can send clicks to Admin windows. That would probably be the easiest way, the user would never know what happened, just a quick flash. Really though, after registering itself as a protocol handler, I don't think any program should go beyond deleting the default protocol handler registry entry, thereby forcing the user to re-choose.
This is how to set mailto protocol manually and simply in Windows 8, 8.1, 2012, 2012R2
Add a new registry branch HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\mailto\UserChoice
Then click any mailto: link in your web browser, say IE
and finally there in a program list for you to choose which was not available before.
Also MAILTO appears in Control Panel\All Control Panel Items\Default Programs now. There is no other option to add/remove a protocol from there.
You can't have your app directly take over file associations anymore in Windows 8. There are guidelines for how to handle this for both Windows Store and desktop applications here: http://msdn.microsoft.com/en-us/library/windows/apps/hh700321.aspx

Is it possible to access Win API from Firefox/Internet Explorer toolbar extention?

We have an idea to develop a toolbar for major browsers on Windows.
The toolbar will be a compliment for our weather application.
We want the toolbar to have an access to Windows API, specifically we need Registry and file system access (want access main app user settings).
Is it possible with Firefox and Internet Explorer toolbar extentions?
Browser toolbar development is new grounds for me.
I just want to know if it makes sense to start the project.
You can access the registry and filesystem from Firefox using the existing XPCom interfaces that are already exposed for you.
Internet Explorer plug-ins are all native, so you're already writing Win32 and COM, so you just call whatever API you need. However, since you are most likely running in a low integrity process, you need to read this which will explain the limitations on registry and filesystem access that you will encounter. If you describe exactly what registry and filesystem locations you're interested in, I can give you a more detailed answer.
The filesystem can be accessed from a Firefox extension:
File System access from Firefox Extension
I don't know about Internet Explorer, but that seems like it would make sense.
As for Registry access in Firefox, see this:
https://developer.mozilla.org/en/accessing_the_windows_registry_using_xpcom
It sounds like it should all be possible. I didn't find anything about Internet Explorer, but it seems like that would be a feature that they would include. I don't like to mess with the registry since that is not cross-platform, but if you really need the user settings, then I guess you have a valid reason. Just remember that not all of your users will be using Windows, and Mac OS doesn't have a registry (neither does Linux), so try not to restrict yourself too much if you can avoid it.

Simulate Offline Mode for HTML5 Cache Testing

I have an HTML5 application that requires offline support. For running the application, I use a local Apache server. I am trying to figure out what the best way is to simulate offline mode.
Currently, in Firefox I disable my Air-Port to simulate offline mode, but this is a pain.
Any suggestions? I am open to using other browsers, if a method exists that doesn't require turning off my Internet.
For Firefox
☰ (hamburger menu)->More->Work Offline
Google Chrome doesn't appear to have this feature
Edit:
Also, another alternative is slightly more time-consuming to setup in the beginning but might be worth it. For Firefox/Chrome there should be proxy plugins, set up a fake/bad profile for each so that you proxy to something that doesn't exist... like 127.0.0.20:8080. After that you can switch the proxy setting on and off to emulate a full-stack test.
The other answers are out of date. The only place this appears in Firefox v92 is under
File > Work Offline
The File menu can be accessed in the top left of Firefox by pressing the ALT key.
Be warned that this does not prevent traffic from "localhost" loop-back itself, unless you additionally turn on
network.disable-localhost-when-offline
preference in about:config.
Bugzilla issue: Add option to disallow connections to localhost while in offline mode.
In Chrome you can open developer tools switch to the network tab and set throttling to offline
For Firefox, from the ☰ (hamburger menu), choose Web Developer > Work Offline.
For Chrome, open DevTools and select the Network panel. Throttling is set to Online (Disabled) by default. From the dropdown menu, you can choose presets Fast 3G and Slow 3G, but to simulate Offline Mode, you want to choose Offline.

Resources