C
C#3mo ago
peroxovy

Desktop app on Windows - inter process communication / permissions problem.

Hello, I need to build an app which must "copy" files from NFS/SMB share. Requirements: - GUI for the User, so I have chosen WPF: User will have listed specific "available" packages(list of dirs, files within it) from this share and will be able to "download" it to his local computer. I'll skip how does the package is constructed, but I have a problem with permissions. Directories on local disk have some AD groups assigned to security policy, it means that the App should be run as a Service User - different one than the GUI, because "normal" users don't have permissions to do some changes within directories on the disk. So the problem is... I need to build probably 2 applications - 1 as a Windows Service and 2nd as a WPF(GUI). I don't know exactly how I can construct any communication between those two "processes"... I've tested a WCF hosted on Windows Service(named pipes) and I don't know if it's good approach, because I wan't two-way communication. Do I select correct communication type? I want to present f.e. a progress of copying a package to User, so somehow I need to call some methods within WCF when previously I've called a "copy" method. I read plenty of tutorials, stack topics but all of them are basic and I can't "breakthrough" with my blocking points.
6 Replies
SpReeD
SpReeD3mo ago
Named pipes seems fine - Shared Memory won't work, because the allocated space is bound to user-policy and the service runs on a different policy.
peroxovy
peroxovy3mo ago
Thanks. Any tips how to pass object's to WPF through it? Currently I'm facing some issues when I specified interface with custom type like shared class. And named pipe is unexpectedly closing when I receive an output to GUI.
Lex Li
Lex Li3mo ago
It would be 1) upon raw sockets you build your own protocol or 2) use a well established protocol such as websockets (wrapped nicely by SignalR). Try to avoid WCF as that's too heavy.
SpReeD
SpReeD3mo ago
As of my understanding he want some simple IPC between programs running on the same machine, so any kind of sockets would be unsuitable, although possible, here.
Lex Li
Lex Li3mo ago
That's a strange comment. All sorts of apps (like Electron based) are using variants of sockets (HTTP or not). As long as you bind to localhost, the traffic won't leave that machine.
peroxovy
peroxovy3mo ago
So I to sum up: Named Pipes or HTTP? - It will run on the same machine. - "Connection" only to NFS/SMB share(Netapp storage) to copy files from(Text file with paths inside as a definition of a "package") - Restriction on disk so "service"(run as service user) separated from GUI(local user). - GUI presents the list of available packages, able to "download" it to the machine, show progress etc. Like a "download" manager. To copy I will use simple File.Copy() or AlphaFS(lib that allows paths longer than 255 chars).