Access passwords through MFC Application and page faults 
Author Message
 Access passwords through MFC Application and page faults

I am trying to enable password processing in my MFC DAO application.
The application connects to the database, and modifies the data as
expected; however, in the end when I hit the "Close" button on my
application I get an error dialog stating:

Application caused an invalid page fault in module DDAO35.DLL at
157:049adldd

When I remove all the password enabling code, the application exits
fine.  Is there something I am overlooking in the use of password
arguments to the CDbDatabase that is causing this?

Any ideas/suggestions would be appreciated.

Here's what some of the password code looks like:

        CString m_strDatabase;
        CString m_strPassword;
        CString m_strConnect;
        BOOL    m_bExclusive;
        BOOL    m_bReadOnly;

CLoaderAppDlg::CLoaderAppDlg(CWnd* pParent /*=NULL*/)
        : CDialog(CLoaderAppDlg::IDD, pParent)
{
        //{{AFX_DATA_INIT(CLoaderAppDlg)
                // member initialization here
        m_strDatabase = _T("");
        in_strFileName = _T("");
        m_strConnect = _T("");
        m_strPassword = _T("");
        m_bExclusive = FALSE;
        m_bReadOnly = FALSE;
        //}}AFX_DATA_INIT
        // Note that LoadIcon does not require a subsequent DestroyIcon in
Win32
        m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);

Quote:
}

void CLoaderAppDlg::DoDataExchange(CDataExchange* pDX)
{
        CDialog::DoDataExchange(pDX);
        //{{AFX_DATA_MAP(CLoaderAppDlg)
        DDX_Text(pDX, IDC_DATABASE_PROMPT, m_strDatabase);
        DDV_MaxChars(pDX, m_strDatabase, 256);
        DDX_Text(pDX, IDC_INPUTFILE_PROMPT, in_strFileName);
        DDV_MaxChars(pDX, in_strFileName, 256);
        DDX_Text(pDX, IDC_PASSWORD_PROMPT, m_strPassword);
        DDV_MaxChars(pDX, m_strPassword, 256);
        //}}AFX_DATA_MAP

Quote:
}

...
...
        try
        {
                //Open the database
                (GetDlgItem(IDC_DATABASE_PROMPT))->GetWindowText(m_strDatabase);
                (GetDlgItem(IDC_PASSWORD_PROMPT))->GetWindowText(m_strPassword);
                m_strConnect = CString(";pwd=") + m_strPassword;
                m_bExclusive = TRUE;

                m_dbDatabase = m_dbEngine.OpenDatabase( m_strDatabase, m_bExclusive,
m_bReadOnly, m_strConnect);
...
...



Fri, 27 Apr 2001 03:00:00 GMT  
 Access passwords through MFC Application and page faults
Nevermind.  A minor tweak to the event-handler on the "Close" button did
the trick.
Quote:

> I am trying to enable password processing in my MFC DAO application.
> The application connects to the database, and modifies the data as
> expected; however, in the end when I hit the "Close" button on my
> application I get an error dialog stating:

> Application caused an invalid page fault in module DDAO35.DLL at
> 157:049adldd

> When I remove all the password enabling code, the application exits
> fine.  Is there something I am overlooking in the use of password
> arguments to the CDbDatabase that is causing this?

> Any ideas/suggestions would be appreciated.

> Here's what some of the password code looks like:

>         CString m_strDatabase;
>         CString m_strPassword;
>         CString m_strConnect;
>         BOOL    m_bExclusive;
>         BOOL    m_bReadOnly;

> CLoaderAppDlg::CLoaderAppDlg(CWnd* pParent /*=NULL*/)
>         : CDialog(CLoaderAppDlg::IDD, pParent)
> {
>         //{{AFX_DATA_INIT(CLoaderAppDlg)
>                 // member initialization here
>         m_strDatabase = _T("");
>         in_strFileName = _T("");
>         m_strConnect = _T("");
>         m_strPassword = _T("");
>         m_bExclusive = FALSE;
>         m_bReadOnly = FALSE;
>         //}}AFX_DATA_INIT
>         // Note that LoadIcon does not require a subsequent DestroyIcon in
> Win32
>         m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
> }

> void CLoaderAppDlg::DoDataExchange(CDataExchange* pDX)
> {
>         CDialog::DoDataExchange(pDX);
>         //{{AFX_DATA_MAP(CLoaderAppDlg)
>         DDX_Text(pDX, IDC_DATABASE_PROMPT, m_strDatabase);
>         DDV_MaxChars(pDX, m_strDatabase, 256);
>         DDX_Text(pDX, IDC_INPUTFILE_PROMPT, in_strFileName);
>         DDV_MaxChars(pDX, in_strFileName, 256);
>         DDX_Text(pDX, IDC_PASSWORD_PROMPT, m_strPassword);
>         DDV_MaxChars(pDX, m_strPassword, 256);
>         //}}AFX_DATA_MAP
> }

> ...
> ...
>         try
>         {
>                 //Open the database
>                 (GetDlgItem(IDC_DATABASE_PROMPT))->GetWindowText(m_strDatabase);
>                 (GetDlgItem(IDC_PASSWORD_PROMPT))->GetWindowText(m_strPassword);
>                 m_strConnect = CString(";pwd=") + m_strPassword;
>                 m_bExclusive = TRUE;

>                 m_dbDatabase = m_dbEngine.OpenDatabase( m_strDatabase, m_bExclusive,
> m_bReadOnly, m_strConnect);
> ...
> ...



Wed, 02 May 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Invalid page faults when accessing large arrays

2. diagnose a page fault/access violation

3. GetDiskFreeSpaceExA called with pointer causes invalid page fault in MFC dll

4. Accessing MFC DLL from a non-MFC application

5. application to access application to access the internet

6. Calling display settings property page from MFC application

7. Property pages in MFC Dialog application

8. Data Access tool to access MS-Access from DOS/C application

9. Database Access in NON MFC Application

10. Database access in a Non MFC application

11. Ole Problem at access to Access97 with an MFC-application

 

 
Powered by phpBB® Forum Software