Recent

Author Topic: FormDropFiles from the administrator  (Read 635 times)

BIT

  • Full Member
  • ***
  • Posts: 129
FormDropFiles from the administrator
« on: November 13, 2022, 07:40:27 am »
If you run the program from the administrator, the function stops working, what could be the reason?

Code: Pascal  [Select][+][-]
  1. procedure TForm1.FormDropFiles(Sender: TObject; const FileNames: array of string);
  2. var
  3.   FileName: string;
  4. begin
  5.   for FileName in FileNames do
  6.   begin
  7.  ShowMessage(FileName);
  8.   end;
  9. end;    

Thaddy

  • Hero Member
  • *****
  • Posts: 12893
Re: FormDropFiles from the administrator
« Reply #1 on: November 13, 2022, 10:00:05 am »
Platform? Bitness?, OS?, full small example?
Who is responsable for that!! The caller or the callee.. Out! ya'll, NOW. In UTC time, please, so maybe Yesterday or tomorrow.

BIT

  • Full Member
  • ***
  • Posts: 129
Re: FormDropFiles from the administrator
« Reply #2 on: November 13, 2022, 10:24:42 am »
Platform? Bitness?, OS?, full small example?
windows 8.1 64 bit

jamie

  • Hero Member
  • *****
  • Posts: 5161
Re: FormDropFiles from the administrator
« Reply #3 on: November 13, 2022, 11:56:07 am »
I assume what you mean "Stops working" is that the function/Event never gets called?

 For me it works however, I am still using older Lazarus 2.0.4 with 3.0.4 compiler most of the time for existing projects because the compiler does things for me that newer compiler broke.

  But that does not mean this is your issue. You could have a shell file naming with system links in there causing issues to accumulate the list.

  Also, maybe the drop message is being filtered?


The only true wisdom is knowing you know nothing

Soner

  • Sr. Member
  • ****
  • Posts: 288
Re: FormDropFiles from the administrator
« Reply #4 on: November 13, 2022, 01:49:20 pm »
This is normal behaviour at windows.
Start notepad oder cmd.exe as admininistrator and dag drop files from explorer, they will not react.

jamie

  • Hero Member
  • *****
  • Posts: 5161
Re: FormDropFiles from the administrator
« Reply #5 on: November 13, 2022, 02:24:13 pm »
really?

 There must be a filter setting because I am logged in as Admin here and it works.

 This is Windows 10 Pro.

 But I will say this however, I've seen the shell return different links while in Admin mode verses in a normal user mode.

 After thinking about this, maybe he is talking about normal user mode and running apps "As Administrator"? I think the default setting is to not allow that among other features.

« Last Edit: November 13, 2022, 02:35:38 pm by jamie »
The only true wisdom is knowing you know nothing

PascalDragon

  • Hero Member
  • *****
  • Posts: 4951
  • Compiler Developer
Re: FormDropFiles from the administrator
« Reply #6 on: November 13, 2022, 02:33:24 pm »
If you run the program from the administrator, the function stops working, what could be the reason?

You can not drag and drop between non-elevated and elevated applications (or applications run in a different user context).

Soner

  • Sr. Member
  • ****
  • Posts: 288
Re: FormDropFiles from the administrator
« Reply #7 on: November 13, 2022, 03:16:26 pm »
I have also Windows 10 pro and i have administrator account. I started the applications "run as admin".

Without "run as admin" your applications start normal, even when you have administrator account.
Start your editor from startmenu and edit some textfiles from windows folder you can't save it. You must start it as administrator. or you have disabled uac.

i think it is security thing.

BIT

  • Full Member
  • ***
  • Posts: 129
Re: FormDropFiles from the administrator
« Reply #8 on: November 13, 2022, 03:24:59 pm »
After thinking about this, maybe he is talking about normal user mode and running apps "As Administrator"? I think the default setting is to not allow that among other features.
Yes I do so

Remy Lebeau

  • Hero Member
  • *****
  • Posts: 1173
    • Lebeau Software
Re: FormDropFiles from the administrator
« Reply #9 on: November 14, 2022, 11:20:48 pm »
You can not drag and drop between non-elevated and elevated applications (or applications run in a different user context).

You can drag from a higher-privilege process to a lower-privilege process just fine.  But UAC will block drags from a lower-privilege process to a higher-privilege unless the latter explicitly allows the following messages via ChangeWindowMessageFilter/Ex():

WM_COPYDATA ($004A)
WM_COPYGLOBALDATA ($0049)
WM_DROPFILES ($0233)
« Last Edit: November 14, 2022, 11:28:12 pm by Remy Lebeau »
Remy Lebeau
Lebeau Software - Owner, Developer
Internet Direct (Indy) - Admin, Developer (Support forum)

PascalDragon

  • Hero Member
  • *****
  • Posts: 4951
  • Compiler Developer
Re: FormDropFiles from the administrator
« Reply #10 on: November 15, 2022, 07:23:35 am »
You can not drag and drop between non-elevated and elevated applications (or applications run in a different user context).

You can drag from a higher-privilege process to a lower-privilege process just fine.  But UAC will block drags from a lower-privilege process to a higher-privilege unless the latter explicitly allows the following messages via ChangeWindowMessageFilter/Ex():

WM_COPYDATA ($004A)
WM_COPYGLOBALDATA ($0049)
WM_DROPFILES ($0233)

Gotta admit that I didn't have the need for that yet, so I didn't research a solution. But at least there is one that BIT can use. ;D

 

TinyPortal © 2005-2018