Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
10
Erster Beitrag:
vor 2 Jahren, 8 Monaten
Letzter Beitrag:
vor 11 Monaten, 3 Wochen
Beteiligte Autoren:
Curtis, Alexandre Leclerc, Tor-Bjarne, Ola

[WD19 & Win8.1] The requested operation requires elevation (740)

Startbeitrag von Ola am 29.11.2014 12:01

Hi All

I am trying to launch a third party exe from my ERP. It checks for the existence of certain types of files in a certain directory and then sends them to the third party. When calling it with WD19's Exerun I get the following error:

"Unable to lauch 'file path and name' executable:
The requested operation requires elevation (740)"

When called from a file manager (Total Commander), I can launch the same program after first closing a pop up window asking whether it's ok to launch. But I do not get the pop up window when using Exerun in my ERP, just the error.

Quite obviously this is caused by Windows' inbuilt terroristvirus called UAC. In Windows 8.1 this problem is no longer totally controllable from the UAC setting slider window, like it was in 7.

So I disabled the EnableUA key in the Windows register:
HKEY_LOCAL_MACHINE -> Software -> Microsoft -> Windows ->
CurrentVersion -> Policies -> System -> EnableUA = 0

Now the program can be run from Total Commander without any pop-ups disturbing the user, but WD19's Exerun still can't run it; it still gives the same error.

Any suggestions on how to handle this problem in Windev 19?

Best regards
Ola

Antworten:

Re: [WD19 & Win8.1] The requested operation requires elevation (740)

Hi Ola,

Perhaps ShellExecute(Fexedir()+"\YourExe.exe") can do the trick?

Cheers
Tor-Bjarne

von Tor-Bjarne - am 29.11.2014 12:18

Re: [WD19 & Win8.1] The requested operation requires elevation (740)

Hi Tor-Bjarne

Yes! ShellExecute does the trick. Many thanks!

I thought that it is used only for opening a document with the associated app, but indeed, it also launches a plain exe file.

Now I am wondering, whether I should replace Exerun with ShellExecute everywhere in my app...

best regards
Ola

von Ola - am 29.11.2014 19:03

Re: [WD19 & Win8.1] The requested operation requires elevation (740)

Hi,

I would consider it, my understanding of shellexecute is like a doubleclick on a file in the file explorer. If a exefile open, if a pdf file open acrobat and load and so on :)

But exerun give you some options like exeDontWait, exeIconize and so forth. So it depends on what you want.

There is (probably) a Windows API that can start an exe and ask for elevation/permission (or a adminuser and password as input) but here you got to ask some WInDev/Windows API experts, as I have not done this mutch :)

Cheers
Tor-Bjarne

von Tor-Bjarne - am 30.11.2014 12:26

Re: [WD19 & Win8.1] The requested operation requires elevation (740)

Hi guys,

Indeed this is possible to start an EXE which has no specific manifest file in elevated mode by code. But this is a bit complex. Couple years ago an article in the LST 86 (p. 32) was giving some code on how to do it that way.

We have used a slightly modified version of that code example for years and works very well. (So we were able to restart our own application in elevated mode, if it detected drivers were missing, to automatically install what was missing without needing a special install software.)

I guess if it is of interest to you, you could ask the Free Technical Support team to get your hand on the code example.

Best regards,
Alexandre Leclerc

von Alexandre Leclerc - am 01.12.2014 13:50

Re: [WD19 & Win8.1] The requested operation requires elevation (740)

I'm having the same problem with ExeRun(). I would use ShellExecute(), but it seems that you can't pass arguments to ShellExecute().

Has anyone come up with a work around for this? Does anyone have code that elevates a user permission?

von Curtis - am 31.08.2016 13:53

Re: [WD19 & Win8.1] The requested operation requires elevation (740)

Hi Curtis,

Just take a look at WDSETUP as it does exactly that. All the required code is in a collection, if my memory is right. We used that code in another application and it works well.

Best regards,
Alexandre Leclerc

von Alexandre Leclerc - am 31.08.2016 15:00

Re: [WD19 & Win8.1] The requested operation requires elevation (740)

WDSetup is a big project. I haven't found anything yet. Any idea what keywords to search on?

von Curtis - am 31.08.2016 16:11

Re: [WD19 & Win8.1] The requested operation requires elevation (740)

Hi Curtis,

Look for "ShellExecuteEx" (in collection "Proc Info Sys"). You will see the "runas" string as constant for the execution with UAC (higher privileges).

Best regards,
Alexandre Leclerc

Edit 1: Forgot to say that the exact procedure name is "bCreateProcess()".

von Alexandre Leclerc - am 31.08.2016 17:08

Re: [WD19 & Win8.1] The requested operation requires elevation (740)

Thanks!

von Curtis - am 31.08.2016 20:41
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.