Drag n' Drop files in Vista RC1?

Dear all,

I find a very strange issue in Vista RC1.

If we wanna add "requireAdministrator" in the program,

(Refhttp://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnlong/html/AccProtVista.asp)

The program will still fail to get the "WM_DROPFILES" message from Vista.

Does anyone have the same problem?...Orz

Best Regards,

Shuyang

p.s. The following is my manifest

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="X86"
name="Microsoft.Windows.XPStyle"
type="win32"
/>
<description>Your app description here</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="requireAdministrator"
uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>

[1877 byte] By [shuyangtu] at [2007-12-24]
# 1
For security reasons, drag/drop is disallowed between windows with different security level.
RaymondChen-MSFT at 2007-8-31 > top of Msdn Tech,Software Development for Windows Vista,UI Development for Windows Vista...
# 2

Dear Raymond,

My application needs "Drag n' Drop" and "Write registry key into HKEY_CLASSES_ROOT"

I've tried "requireAdministrator" and "highestAvailable" in the manifest.xml for registry key writing

But they would both disallow the "Drag n' Drop" function.

Is there a way to allow "Drag n' Drop" and "Write registry key into HKEY_CLASSES_ROOT" in the application?

Best regards,

Shuyang

shuyangtu at 2007-8-31 > top of Msdn Tech,Software Development for Windows Vista,UI Development for Windows Vista...
# 3
You can use your imagination. For example, have two processes, one that does the UI and accepts the drag/drop, and another that does the HKCR stuff. But generally speaking applications should not be messing with HKCR at runtime; they should only update it at install time.
RaymondChen-MSFT at 2007-8-31 > top of Msdn Tech,Software Development for Windows Vista,UI Development for Windows Vista...
# 4

Dear Raymond,

It seems that WM_COPYDATDA does not work on the "requireAdministrator" program.

(Please ref to the topic WM_COPYDATA and manifest.xml)

I try to use "Event" to let two programs communicate each other.

The Event is created in the "requireAdministrator" program and the other program without "requireAdministrator" would signal it.

However, I find out that the program without "requireAdministrator" can not signal the event which is created by the "requireAdministrator" program.

This design only works when the event is created in the program without "requireAdministrator".

Does it the right behavior or it will be fixed in the future version of Vista?

Best regards,

Shuyang

shuyangtu at 2007-8-31 > top of Msdn Tech,Software Development for Windows Vista,UI Development for Windows Vista...
# 5
This is expected. When the high-privilege process creates the event, the default security attributes permit only other high-privilege processes to access it. If you want a lower-privilege process to be able to access the event, you need to set custom security on the event.
RaymondChen-MSFT at 2007-8-31 > top of Msdn Tech,Software Development for Windows Vista,UI Development for Windows Vista...
# 6

Hi,

I am having the same issue. How do you custom set the security of the event?

Thanks

cynistersix at 2007-8-31 > top of Msdn Tech,Software Development for Windows Vista,UI Development for Windows Vista...
# 7
Use the LPSECURITY_ATTRIBUTES parameter of CreateEvent to set custom security on an event. Note that this is not for the faint of heart. If you mess up, you can create a security hole. (The same security hole that the default security attributes are trying to protect you from.)
RaymondChen-MSFT at 2007-8-31 > top of Msdn Tech,Software Development for Windows Vista,UI Development for Windows Vista...
# 8
Can you please show and example of this?
cynistersix at 2007-8-31 > top of Msdn Tech,Software Development for Windows Vista,UI Development for Windows Vista...
# 9

Lots of other people have written ACL-management code. Here are some (I do not vouch for their accuracy; these are just the first few that came up in a web search)

http://www.codeproject.com/win32/accesscontrollists.asp

http://www.codeproject.com/system/secntobj.asp

RaymondChen-MSFT at 2007-8-31 > top of Msdn Tech,Software Development for Windows Vista,UI Development for Windows Vista...
# 10

Can I disable this "feature" (I can't drag files from explorer to Visual Studio 2005): this single fault alone is seriously making me consider ditching Vista and switching back to XP on my software development machine.

shewitt_au at 2007-8-31 > top of Msdn Tech,Software Development for Windows Vista,UI Development for Windows Vista...
# 11

I'm with you on that.

morten_tor at 2007-8-31 > top of Msdn Tech,Software Development for Windows Vista,UI Development for Windows Vista...
# 12

I'm working around the issue by creating a desktop shortcut to "explorer.exe" and setting "Run as administrator" under "Advanced Properties" and adding a shortcut key to make it easier to bring up. Still have that annoying "User Account Control" dialog though... Stick out tongue

Steve at 2007-8-31 > top of Msdn Tech,Software Development for Windows Vista,UI Development for Windows Vista...

Software Development for Windows Vista

Site Classified