drag drop no longer working once application gets installed - c#

I have an application that has drag and drop functionality to import images and video's. While developing, and testing through Visual Studio this has never given any problems.
After installing through a set up project, everything in the application works fine, except the drag and drop, which seems to be doing nothing. Are there any security settings that need to be set through an installer, or something of that nature that could be preventing drag and drop after installation ?

Yes, your drag+drop will not be permitted if your program runs with elevated permissions. It is called User Interface Privilege Isolation, Vista UIPI for short. It is complementary to UAC and controlled by the uiAccess attribute in the manifest entry that you'd use to elevate your process. As well as a certificate and a proper install location.
Realistically: don't elevate your program. It is a security hole when restricted programs can get their objects dropped in your privileged program. UIPI tries to prevent that.
But debug your program first.

Build a debug version of your application, build your installer with the output. You can either include the .pdb files in the installer or copy them to the install location after you install.
Run the installed application, and then in Visual Studio, go to Debug --> Attach to Process. Select the process from the list, and click the "Attach" button. Add breakpoints, etc, and debug as normal.
If you don't run into the problem on your build machine, you can also run a remote debugging session to debug the application on a different computer, but this requires a little more setup.

Related

How to define the moment when the installing of components was finished?

Sometimes AutoCAD 2009 spoils own menu files and some settings. At this case I recover the application state through the deleting its registry key in HKCU and its folders in the current user profile. Now I am to install necessary components (they recreate the registry key in HKCU and folders). For this purpose I programmatically launch the application. But I want to kill the process when the necessary components will be installed complettely during the application starting (because AutoCAD launching takes many time).
If I kill the acad.exe process, then the components installing will be killed too. I dont need such behaviour.
Is it possible to define (programmatically, I use C#) the moment when the installing of these components was finished? Or maybe it is possible to define that some components of the application are not installed on the current user profile still and then to force the launching of these components installing without the application launching (I don't know how to do it).
If you delete files or registry entries from the installed product, it's a feature of Windows Installer that it repairs the install at certain trigger points, one of which is using an advertised shortcut. If you don't want that application to actually run and want only the repair, then an alternative is to go to Programs and Features, select the product and Repair it. Or right click the MSI file and choose repair.

Custom Application updater

I have created a code, which compares XML files on the client side (in PC) with the XML file located on the FTP server; where once it detects that client is running older version of the program, it will download the latest build (so that user has always up to date program).
Here is the trick. Due to the fact, that I am overwriting files at run-time, I had to create an external console application which is being called from the main app if user wants to update. This way, first console application is executed and afterwards main app is closed, so that no files are locked by the system (application's .exe file would otherwise be locked and we could not replace it with the new one).
This process runs perfectly, if it is being installed somewhere else other than under the system folder (by that I mean e.g. C:\Program Files\ drive). If user has decided to install main application there, then suddenly my app crashes as it does not have admin privileges.
I am using Install Shield LE when disbursing this app, and users that are using this program are not administrators (which means that I go to every computer and type admin password when I/users install this program).
Is there a way, how to execute my updated console application with admin rights, or how to define via Install Shield that once this app has been executed, I always want it to be executed as admin?
Hope that my explanation has not been confusing. I am more than happy to share additional details if necessary, as I need to figure out how to solve this thing.
I imagine you don't have an AD configuration as Emmanuel suggest, because in this case you would push the updates without any problems and would not have to design an automatic updater.
I don't know if InstallShield has something like this, but Advanced Installer has the support to install a dedicated updater that runs as a service, thus it has all the permissions required to install an application under Program Files.
Of course this means you need to replace your updater with the one from Advanced Installer and also that the initial installation of the application on the end user machines will still require admin credentials. (future installs can install silently, without the user's intervention)
You'll need to add the following line to your app manifest:
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
Documentation on the msdn is here.

Can't debug windows Service VS2010 Win7

I am not able to debug any of my services after migrating from XP and VS2005, to Win7 and VS2010.
I can compile, I can install, I can run the services correctly.
But, I need to debug them. And when I try to attach to the process, I select the running process as I always did on VS2005, and I receive an error telling that I need admin permission.
I am already an administrator. Also, after searching a lot on the internet, I found that running VS2010 as an admin (via right click) should fix it, but I still can't.
I also tried to mark the checkbox on vslauncher.exe properties to run it always as administrator. The VS2010 window shows on top that it actually is running as admin, but again, when I try to attach to the process it says that I need admin rights.
Has anybody any idea about how to proceed?
It was a permissions problem.
Win7 comes with a new security system, and I had to add to my profile (even being an admin) this permission:
Control panel -> Administrative tools -> Local Security policy -> Local Policies -> User rights Assignment -> Debug programs -> Add user or group .
And there, I added my own user. Reboot machine(Important!! Without rebooting, it won't work).
After that, I was able to attach processes to debug them. It's been a really long time to solve this, I hope to help other people that find this same problem.
Thanks everybody for your help.
Edit your service and put the following line into the OnStart() method:
Debugger.Launch(); It's important that you do this in OnStart() rather than a thread launched by OnStart() so that if there is any bug, you can catch it prior to your service crashing.
When your service starts the debugger will open. Windows will then offer to automatically launch an elevated visual studio so you can attach to your service. I find it very useful to put this line in with an app.config setting so you can enable it as required (i.e launch and attach debugger to service).
FYI when you use Vista / Windows 7 you can run apps as administrator. However these apps explicitly reject administrative privileges unless you launch them with "Elevated" permissions. This is a security feature called UAC.

Install application in window 7 without UAC using C#

When I install my C# app in windows 7, UAC always shows. I'm not logged in as Administrator but I want my application to be installed without the UAC.
Can you give me ways on how to do it?
The UAC prompt shows for any number of reasons, none of which is "the code inside the exe calls function X or tries to write to place Y." These include:
the name contains setup, patch, update etc (eg setup21.exe) and there is no manifest
you embedded a manifest that asks for requireAdministrator. You would have done this on purpose in Visual Studio.
there is an external manifest (for NewApp.exe it would be NewApp.exe.manifest) in the same folder that asks for requireAdministrator. You would have done this on purpose too.
you have right-clicked the exe, and on the Properties Compatibility you have chosen to elevate it, or to run as XPSP2 which for 7 also elevates
someone in your company has applied a Group Policy that this installation app should run elevated (unlikely)
you once ran it, got a dialog from Windows saying "that may not have worked right" and agreed to try again with "recommended settings"
Do any of these seem likely? If so, correct them and see if the UAC prompt goes away.
Single Package Authoring link text
You'll want to use Windows Installer / Windows Installer XML to make this install behave the way you request.
If you want to install an app without UAC then you can only touch folders that the currently logged in user can write to. Google Chrome does this--it installs the entire application to the user's local application data folder.
It's very non-standard and I would argue MS should prohibit running code from this location, but it's a working solution to requiring administrator/UAC access to install applications.
Incidentally, Google Chrome more recently made a traditional installer available so one user can install it to be used by all users on the computer.
If you want your application to be installed without triggering the UAC, install to %APPDATA% (instead of installing to %ProgramFiles%) and write to the HKCU hive only in the registry (i.e. don't try to write to HKLM, HKCR, etc.)

MSI not running the current version of the code in .NET Setup project

I'm not sure what happened, but my installer is in a weird state--when I install my MSI, it doesn't seem to be running the current version of the code (I'm using Custom Actions). I verified it by placing some MessageBox.Shows and sure enough, they are not popping up.
It's possible I may have had a few unsuccessful installs previously which may have put the installer in a bad state...but how do I go about resolving this?
Thanks...
If you think you are running older copies of your .msi code, the best way to resolve it is to delete all files from your %temp% directory (type "%temp%" in the windows explorer address bar and you'll see the contents of this directory and delete everything, then try again.)
You shouldn't expect MessageBox.Show to work in a .NET custom installer action. Those actions run in the context of the Windows Installer service, which doesn't run on the interactive desktop. Try logging to the event log (or any other I/O operation that doesn't depend on the current windows desktop and doesn't require an administrative or current-user security token) if you want to debug your custom action.

Categories

Resources