LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Kill and restore Windows explorer.exe task

Solved!
Go to solution

Hi all,

my application includes a login procedure. When a user log on in my application as “normal user” I need to disable the Windows GUI (what I need to do is to avoid the user use windows desktop, toolbar, start menu and explorer window). Vice versa, when user log on as administrator (in my application, not in Window), Windows GUI should be restored.

I’ve done this:

 

when user log on as normal user, I kill the process explorer.exe. In particular, I execute the following line command using System Exec VI: taskkill /im explorer.exe /f 

This command works fine: windows desktop, explorer, start menu are not accessible.

 

When user log on as administrator, I should restore explorer.exe task. To do this, I simply execute the following line command using System Exec VI: explorer

Explorer.exe is launched, but a windows explorer window is shown and not else (Desktop, start button, toolbar remain unaccessible).

Instead, if a manually run explorer using the command window (not programmatically with System Exec VI), desktop, start button, toolbar are restored correctly.

 

Can you help me?

 

I attach an example VI of what I did

0 Kudos
Message 1 of 9
(4,382 Views)

Note: for who use my code - to restore explorer process, CTRL+ALt+CANC -> File -> Run new task -> type explorer

0 Kudos
Message 2 of 9
(4,375 Views)

My question is:

does using the cmd "manually" differ from using the System Exec VI?

0 Kudos
Message 3 of 9
(4,326 Views)

@AC_85 wrote:

My question is:

does using the cmd "manually" differ from using the System Exec VI?


No, well it shoulden't because the system exec just opens a cmd window and inserts the commands.

 

But you can hide the window using the system exec.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 4 of 9
(4,310 Views)

Instead of kill it, can you just hide the desktop window?

 

George Zou
0 Kudos
Message 5 of 9
(4,295 Views)
Solution
Accepted by topic author sqrt(-1)

Yes, I do not know why, but it is different.

To fix your original issue I have system execed C:\Windows\explorer.exe, not simply explorer.exe

Edit: Is your protection perfect? Can they press ctrl+alt+del, open task manager, run explorer?

Message 6 of 9
(4,292 Views)

@Alexander_Sobolev wrote:

Yes, I do not know why, but it is different.

To fix your original issue I have system execed C:\Windows\explorer.exe, not simply explorer.exe

Edit: Is your protection perfect? Can they press ctrl+alt+del, open task manager, run explorer?


Oh thanks Alexander. Using c:\Windows\Explorer.exe works fine!!

You're right: my protection is vulnerable, but this method should be simply a sort of "deterrent" to avoid the access to windows main features.

 

Thanks again

0 Kudos
Message 7 of 9
(4,260 Views)

@RTSLVU wrote:

@AC_85 wrote:

My question is:

does using the cmd "manually" differ from using the System Exec VI?


No, well it shoulden't because the system exec just opens a cmd window and inserts the commands.

 

But you can hide the window using the system exec.


Not really true. System Exec starts a process with the command line you enter. That is NOT the same as a command line shell, which is implemented by cmd.exe. To get the whole cmd.exe handling such as environment variable expansion, etc you need to prepend your command line with cmd /C or cmd /K (for debugging) as listed here. This starts cmd.exe as process and then passes the rest of the command line to it for interpretation as if you had typed it in the command line shell.

Rolf Kalbermatter
My Blog
0 Kudos
Message 8 of 9
(4,222 Views)

@AC_85 wrote:

@Alexander_Sobolev wrote:

Yes, I do not know why, but it is different.

To fix your original issue I have system execed C:\Windows\explorer.exe, not simply explorer.exe

Edit: Is your protection perfect? Can they press ctrl+alt+del, open task manager, run explorer?


Oh thanks Alexander. Using c:\Windows\Explorer.exe works fine!!

You're right: my protection is vulnerable, but this method should be simply a sort of "deterrent" to avoid the access to windows main features.

 

Thanks again


 

I have to say I find when you use "deterrents" like this you are basically telling the operator that you do not trust them to do their jobs.  

 

Quite frankly is is not our job a programmers ( nor is it IT's job) to be supervisors.

 

If an operator is surfing the web or playing Solitare instead of their job, that is their supervisors problem.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 9 of 9
(4,215 Views)