GetOpenFileName () used with user impersonation

1

I have a process that needs SYSTEM privileges and for this to be released by a service. When this process runs the GetOpenFileName () to open a select files dialog, I get an error message saying

  

C: \ Windows \ system32 \ config \ systemprofile \ Desktop is not available.

The Desktop, My Documents, etc. folders, when selected in the dialog box, are associated with the SYSTEM account. This is because the process is running with SYSTEM privileges. Right.

I tried to solve this problem by impersonating the application with the ImpersonateLoggedOnUser (), but the GetOpenFileName () continues to be associated with the system account and displaying the same error messages.

I've also tried with the new API dialog box, the Common Item Dialog, but the same thing happens. The strange thing is that if the process is impersonated as a user, the GetUserName () returns the correct name of the personified user.

What might be the reason for this?

    
asked by anonymous 24.08.2017 / 13:41

1 answer

0

Services does not have interactive desktop access by default. I believe the same should be created with a specific attribute to be allowed. Try searching for SERVICE_INTERACTIVE_PROCESS.

This help should clarify the constraints and means of implementing the solution: Interactive Services

    
24.08.2017 / 14:06