No drag & drop when Running as administrator?

Corel Paint Shop Pro

Moderator: Kathy_9

Post Reply
migf1
Posts: 510
Joined: Fri Apr 03, 2020 3:09 pm
operating_system: Windows 8.1
System_Drive: C
32bit or 64bit: 64 Bit

No drag & drop when Running as administrator?

Post by migf1 »

I'd never noticed until a couple of days ago.

Is it normal NOT to be able to drag & drop images from the File Explorer into PSP 2020 when it's been Run as administrator?

PSP2020u Win8.1 Pro
Good Unofficial PaintShop Pro Tutorials: Creation CasselMake Shop ProHEC Image EditingLeviFiction PSP Basics
(plus my own Gimp & Stuff)
LeviFiction
Advisor
Posts: 6831
Joined: Thu Oct 02, 2008 1:07 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Alienware M17xR4
processor: Intel Core i7-3630QM CPU - 2_40GH
ram: 6 GB
Video Card: NVIDIA GeForce GTX 660M
sound_card: Sound Blaster Recon3Di
Hard_Drive_Capacity: 500GB
Corel programs: PSP: 8-2023
Location: USA

Re: No drag & drop when Running as administrator?

Post by LeviFiction »

I believe the answer is yes. I employ best practices and my Administrator account is a different account from my day to day account. So if I run as Administrator it's literally running as a different person so I expect this behavior.

But I believe Explorer runs without admin privileges so they are on different execution levels. Can you drag and drop from explorer into other programs when running as admin?

Also why are you running as admin? Even if you're editing photos in protected areas you just copy those files or make that folder accessible by your regular account temporarily.
https://levifiction.wordpress.com/
migf1
Posts: 510
Joined: Fri Apr 03, 2020 3:09 pm
operating_system: Windows 8.1
System_Drive: C
32bit or 64bit: 64 Bit

Re: No drag & drop when Running as administrator?

Post by migf1 »

You are right Levi!

I indeed cannot drag & drop in progs that have been started with admin rights, I just tried with Photoshop and Gimp. All these years I didn't know that!

The issue came up with the splash-randomizer I am working on. It needs admin rights in order to replace the images in the installation folder of PSP. So far so good!

However, I added an option for calling PSP when the splash is installed and from what I saw, since the randomizer runs with admin rights, the called PSP runs with admin-rights too. Everything else seems to work fine, except for drag & drop images from the file explorer.

I've tried several functions for calling PSP, like system(), spawn(), ShellExec(), ShellExecEx(), and CreateProcess(). No luck! I'm not sure I can solve this programmatically (and if I can, I will probably need to do lots of research). Or it could be the other way around: running the randomizer in normal mode, and temporarily elevate it just for writing the splash-images in the installation folder of PSP. If you have an pointers to any of those things, please let me know.

If I can't overcome it, I'll suggest in the docs your excellent AdvancedPasteAs scripts as a workaround :)
Good Unofficial PaintShop Pro Tutorials: Creation CasselMake Shop ProHEC Image EditingLeviFiction PSP Basics
(plus my own Gimp & Stuff)
LeviFiction
Advisor
Posts: 6831
Joined: Thu Oct 02, 2008 1:07 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Alienware M17xR4
processor: Intel Core i7-3630QM CPU - 2_40GH
ram: 6 GB
Video Card: NVIDIA GeForce GTX 660M
sound_card: Sound Blaster Recon3Di
Hard_Drive_Capacity: 500GB
Corel programs: PSP: 8-2023
Location: USA

Re: No drag & drop when Running as administrator?

Post by LeviFiction »

I found this recommendation online. I don't know if it works when called from an Admin privleged run. It's just a simple commandline batch code. Replace %ApplicationPath% with the actual path to PSP and it should only run the program as the regular user not admin.

cmd /min /C "set __COMPAT_LAYER=RUNASINVOKER && start "" %ApplicationPath%"

I have another idea but I have never tested it so I don't know if it'll work. Windows can create something similar to Symbolic links in Linux. This allows you to put a file in a restricted location and have it point to a non-restricted location. Then you just edit/replace the file in the non-restricted location and the link will take care of the rest. This is different from using a shortcut. And I don't know if you can just overwrite the file, or if you can only edit the contents of the file to maintain that link. But if it works this means you can have an initial install run that sets up the link and then your program will never need admin privileges again.
https://levifiction.wordpress.com/
migf1
Posts: 510
Joined: Fri Apr 03, 2020 3:09 pm
operating_system: Windows 8.1
System_Drive: C
32bit or 64bit: 64 Bit

Re: No drag & drop when Running as administrator?

Post by migf1 »

Thanks for the reply Levi!

I am trying the batch-file like one, but is not working so far. About the Symbolic links, I am not sure I got how it works, but I'll do some research.

I am looking online too. Found a few things, and it doesn't seem to be trivial. So far everything I've found suggests using a known unelevated process of Windows (like the explorer) and have it launch the program for you, by doing some weird stuff... I've even found one article suggesting code-injection via global hooking... lol (plus so far, I'm only finding examples in C++ and C# / .net, some of which rely on external libraries too... MDSN doesn't seem to directly support de-elevating)... maybe I should change my thinking, and see if i can start the randomizer un-elevated and elevate it only for writing the files in the PSP folder (elevating seems to be easy via passing "runas" instead of "open" in ShellExecEx().. but de-elevating seems a totally different story).

I am bit tired already, but I'll also search for Window's Symbolic links, and maybe I get what your idea is about.
Good Unofficial PaintShop Pro Tutorials: Creation CasselMake Shop ProHEC Image EditingLeviFiction PSP Basics
(plus my own Gimp & Stuff)
migf1
Posts: 510
Joined: Fri Apr 03, 2020 3:09 pm
operating_system: Windows 8.1
System_Drive: C
32bit or 64bit: 64 Bit

Re: No drag & drop when Running as administrator?

Post by migf1 »

Update: The batch-like suggestion is definitely not working on my Win8.1 Pro.

I just run c:\windows\system32\cmd.exe with admin rights, and then inside it I issued the suggestion: http://prntscr.com/tmnbf2

PSP run, but with admin rights (meaning I still couldn't drag & drop images in it).
Good Unofficial PaintShop Pro Tutorials: Creation CasselMake Shop ProHEC Image EditingLeviFiction PSP Basics
(plus my own Gimp & Stuff)
LeviFiction
Advisor
Posts: 6831
Joined: Thu Oct 02, 2008 1:07 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Alienware M17xR4
processor: Intel Core i7-3630QM CPU - 2_40GH
ram: 6 GB
Video Card: NVIDIA GeForce GTX 660M
sound_card: Sound Blaster Recon3Di
Hard_Drive_Capacity: 500GB
Corel programs: PSP: 8-2023
Location: USA

Re: No drag & drop when Running as administrator?

Post by LeviFiction »

A symbolic link is a file that points to another file. When a program opens the link file it actually opens the target file.

So you'd first have an installer program that sets up the initial linking, this will need the admin privileges. The Installer goes to the Splash Screen location and it moves the Splash Screen to a public location for example C:\Uses\Public\Pictures\PSP Splash Screens

Then it uses the mklink command to create link files inside the original Splash Screen folder pointing to their new location. The "mlink" command works like this: mlink "filename of link file to create" "Path to existing target file"

mklink "C:\Program Files\Corel\PaintShop Pro 2020\Data\Pro\Splash-Screen-Large.png" "C:\users\public\pictures\PSP Splash Screens\Splash-Screen-Large.png"

Now when I edit or overwrite the "Splash-Screen-Large.png" file inside the Public Pictures folder, PSP will see that change. No need for admin priivleges. So your random splash screen starter won't need admin privileges to just filter through random splash screens.
https://levifiction.wordpress.com/
migf1
Posts: 510
Joined: Fri Apr 03, 2020 3:09 pm
operating_system: Windows 8.1
System_Drive: C
32bit or 64bit: 64 Bit

Re: No drag & drop when Running as administrator?

Post by migf1 »

Thanks for the details Levi, I do get it now!

I came up with a slightly different solution, which seems to work with an initial test i did.

A separate admin privileged program, whose only job would be to copy the .png images into the PSP's Pro and Ultimate folders. The un-elevated randomizer will call that program when it needs to do the copying, passing it the paths.

I coded a primitive such program which does not copy anything yet, it just creates a temp file into PSP's Data folder. It worked.

Hopefully I'll find some time to finish it up by the end of the day (well, my day anyway lol) and report back to this topic.
Good Unofficial PaintShop Pro Tutorials: Creation CasselMake Shop ProHEC Image EditingLeviFiction PSP Basics
(plus my own Gimp & Stuff)
migf1
Posts: 510
Joined: Fri Apr 03, 2020 3:09 pm
operating_system: Windows 8.1
System_Drive: C
32bit or 64bit: 64 Bit

Re: No drag & drop when Running as administrator?

Post by migf1 »

Just reporting back that a separate program with admin privileges called with a simple system() call from within the un-elevated randomizer just for the copying, worked :)

So, one more thing down :)
Good Unofficial PaintShop Pro Tutorials: Creation CasselMake Shop ProHEC Image EditingLeviFiction PSP Basics
(plus my own Gimp & Stuff)
LeviFiction
Advisor
Posts: 6831
Joined: Thu Oct 02, 2008 1:07 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Alienware M17xR4
processor: Intel Core i7-3630QM CPU - 2_40GH
ram: 6 GB
Video Card: NVIDIA GeForce GTX 660M
sound_card: Sound Blaster Recon3Di
Hard_Drive_Capacity: 500GB
Corel programs: PSP: 8-2023
Location: USA

Re: No drag & drop when Running as administrator?

Post by LeviFiction »

Awesome, glad it worked out. :D
https://levifiction.wordpress.com/
migf1
Posts: 510
Joined: Fri Apr 03, 2020 3:09 pm
operating_system: Windows 8.1
System_Drive: C
32bit or 64bit: 64 Bit

Re: No drag & drop when Running as administrator?

Post by migf1 »

Thanks Levi!

There are still 2 things to be fixed, but maybe I post it (probably tomorrow) and try to deal with them in an update or something:
1. It works only for folders/files whose names are ascii (so non-english names give an error)
2. It only works when PSP2020 is installed in its default locations ( "C:\Program Files\Corel\Coel PaintShop 2020 (64-bit)\" and "C:\Program Files (x86)\Corel\Coel PaintShop 2020 (32-bit)\" )

Both would probably be solved if I had a GUI, but for now I've pretty much coded it in plain C99 as a console application (plus my C compiler doesn't support all win32 api functions.. at least some of my tries to call Registry functions via the win32 api failed, complaining that the functions are not defined).

Anyway, enough for today LOL
Good Unofficial PaintShop Pro Tutorials: Creation CasselMake Shop ProHEC Image EditingLeviFiction PSP Basics
(plus my own Gimp & Stuff)
Post Reply