We have a Windows service written in C++ that does start other programs with CreateProcessAsUser() as different users with LogonUser(). Code below shows how we do this. Our service is started with Local System account.
One of these programs accesses a network shared directory provided by UNC path, e.g. \otherpc\somedirectory. We have now a single customer where this does not work. The program started with CreateProcessAsUser() can not access that directory at all.
The user provided to LogonUser() does have all required permissions, when manually logged in with this user in Windows, \otherpc\somedirectory is visible, files can be read from that directory. Also when starting the service with that particular user, instead of Local System account, everything works fine too.
Any help appreciated.
HANDLE hToken;
LogonUser(User, myDomain, Password, LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, &hToken)
STARTUPINFO si = {0};
PROCESS_INFORMATION pi = {0};
si.cb = sizeof(STARTUPINFO);
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = FALSE;
CreateProcessAsUser(
hToken, appPath,NULL,
NULL,
NULL,
FALSE,
CREATE_NO_WINDOW,
NULL,
NULL,
&si,
&pi
);