RE: Service on XP fails accessing a file on the network

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Morris (Morris_at_online.nospam)
Date: 03/01/05


Date: Tue, 1 Mar 2005 07:57:05 -0800

I tried the CreatFile which reported the same error: "Logon failure bad user
name or password"

Here is the createFile command as used

//2-25-05 for Test of XP network access only
        {
                HANDLE hCoverPage;
                FILE *stream, *stream2;
                CString ermsg, strFileName(L"\\\\CALLMASTER\\cmdata\\callmaster.mdb");
                CTraceEntryExit::LogData( _T("--- CALLMASTER network file access TEST.
for : %s"), strFileName );
                //MessageBox( NULL, NULL, (LPCTSTR) "CALLMASTER TEST.",
MB_ICONEXCLAMATION | MB_OK );
                hCoverPage = CreateFile((LPCTSTR) strFileName, // pointer to name of the
file
                                                                GENERIC_READ, // access (read-write) mode
                                                                FILE_SHARE_READ|FILE_SHARE_WRITE, // share mode
                                                                NULL, // pointer to security attributes
                                                                OPEN_EXISTING, // how to create
                                                                FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
                                                                NULL); // handle to file with attributes to copy

        // if( (stream = _wfopen( strFileName, L"r" )) == NULL ){
                if (hCoverPage == INVALID_HANDLE_VALUE) {
                                ermsg.Format(_T("--- TEST Network access to file CALLMASTER Failed for
file %s."),strFileName);
                                {
                                        LPVOID lpMsgBuf;
                                        FormatMessage(
                                                FORMAT_MESSAGE_ALLOCATE_BUFFER |
                                                FORMAT_MESSAGE_FROM_SYSTEM |
                                                FORMAT_MESSAGE_IGNORE_INSERTS,
                                                NULL,
                                                GetLastError(),
                                                MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
                                                (LPTSTR) &lpMsgBuf,
                                                0,
                                                NULL );
                                        // Display the string.
                                        CTraceEntryExit::LogData(_T("--- TEST Network access to file CALLMASTER
failed GetLastError errormsg: %s."),(LPCTSTR) lpMsgBuf);
                                        // Free the buffer.
                                        LocalFree( lpMsgBuf );
                                }
                }
                else{
                                ermsg.Format(_T("--- TEST Network access to file CALLMASTER OK for file
%s."),strFileName);
                }
                CTraceEntryExit::LogData( _T("--- TEST CALLMASTER network file access
TEST done. Result : %s"), ermsg );
                //MessageBox( NULL, (LPCTSTR) ermsg, (LPCTSTR) ("CALLMASTER network file
access TEST. Result "), MB_ICONEXCLAMATION | MB_OK );
        }
"Rhett Gong [MSFT]" wrote:

> Please call CreateFile in your service on this access db file and let us
> know what error you get and what parameter you put in CreateFile.
>
> Thanks,
> Rhett Gong [MSFT]
> Microsoft Online Partner Support
> Get Secure! - www.microsoft.com/security
>
> This posting is provided "AS IS" with no warranties and confers no rights.
>
>