Service access file on network folder
-
Hello everybody, I created a service which runs nicely on my local machine. If I like to test an existence of a file, which is located on a network-folder (net use g: \\...) then the function _access returns me -1 (not exists). If I call exactly the same function with the same filename in a standard application (not as a service) then all works fine. Is it an access-security problem, or do I use simply the wrong function to test the existence of a file? (I don't wanted to use a fopen,fclose) Big thanks for any ideas :)
-
Hello everybody, I created a service which runs nicely on my local machine. If I like to test an existence of a file, which is located on a network-folder (net use g: \\...) then the function _access returns me -1 (not exists). If I call exactly the same function with the same filename in a standard application (not as a service) then all works fine. Is it an access-security problem, or do I use simply the wrong function to test the existence of a file? (I don't wanted to use a fopen,fclose) Big thanks for any ideas :)
what account is your service running under - default localsystem ? if so, you'll need to change that so that the account you run under has network access (localsystem by default does not have network access, this includes shares iirc).. create a dedicated account for your service, give it the correct access, its better than localsystem (if you google around a bit you should find more pointers on the same) 'g'
-
Hello everybody, I created a service which runs nicely on my local machine. If I like to test an existence of a file, which is located on a network-folder (net use g: \\...) then the function _access returns me -1 (not exists). If I call exactly the same function with the same filename in a standard application (not as a service) then all works fine. Is it an access-security problem, or do I use simply the wrong function to test the existence of a file? (I don't wanted to use a fopen,fclose) Big thanks for any ideas :)
-
Hello everybody, I created a service which runs nicely on my local machine. If I like to test an existence of a file, which is located on a network-folder (net use g: \\...) then the function _access returns me -1 (not exists). If I call exactly the same function with the same filename in a standard application (not as a service) then all works fine. Is it an access-security problem, or do I use simply the wrong function to test the existence of a file? (I don't wanted to use a fopen,fclose) Big thanks for any ideas :)
-
Big thanks for your replies. That seems logic, but it doesn't work ... it's seriously a configuration problem. I'll make a workaround Thanks you two :)
Try to see what GetLastError returns immediately after the call to __access, it might tell you something. There's a tool in Visual Studio that will give you the error text for each error id.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition. Blaise Pascal