I have to show the timestamp (change time) für an EXE within the program, and this works if the file ist called from the local hard drive. When called from a network share, I receive an error. When examining the "properties" of the shared file, I am owner, and I have full access.
This is the code:
STDMETHODIMP CKonfiguration::GetFileChangeTime(/*[in]*/ BSTR bsDateiMitPfad, /*[out]*/ BSTR * bsZeitstempel)
*bsZeitstempel = NULL;
// unsinnigen Dateinamen abfangen
if (SysStringLen(bsDateiMitPfad) <= 1)
HANDLE hFile = CreateFile(bsDateiMitPfad, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
DWORD dwLastError = GetLastError();
if (hFile == INVALID_HANDLE_VALUE)
FILETIME ftCreationTime, ftLastAccessTime, ftLastWriteTime, ftLocal;
BOOL bSuccess = GetFileTime(hFile, &ftCreationTime, &ftLastAccessTime, &ftLastWriteTime);
dwLastError = GetLastError();
CreateFile gives me INVALID_HANDLE_VALUE, and the LastError is ERROR_SHARING_VIOLATION. The call is from within the EXE herself, she tries to find out her own timestamp. GetFileTime must be called with a file handle opened with GENERIC_READ says the documentation, so this is no point for further fiddling.
The server where the share is physically located is a Windows Server 2003 and in the same domain as the client accessing it.
This is VB6, but I had to put it into the .NET zone, because there is no other fitting any more :-(
Any ideas ?