【问题标题】:First-chance exception at 0x03f7111c in CEDel.exe: 0xC0000005: Access violation writing location 0x002e0364CEDel.exe 中 0x03f7111c 的第一次机会异常:0xC0000005:访问冲突写入位置 0x002e0364
【发布时间】:2013-02-21 13:50:11
【问题描述】:

我收到“CEDel.exe 中 0x03f7111c 处的第一次机会异常:0xC0000005:访问冲突写入位置 0x002e0364。”运行我的代码时出错。我目前在调试模式下运行,并在插入我的计算机的实际 Win Mobile CE 6.5.3 设备上运行。堆栈的顶部(不是反汇编)指向一个 if 语句,我不确定是什么导致了错误。该项目是几年前在 MS eMbedded C++ 中创建的,我正在将其移植到 MS Visual Studio 2008。

代码是

CDeviceFuncCursor& curs = tempDeviceFunc.GetCursor();// added for debug checks

if (((wcscmp(_wcsupr(tempDeviceFunc.GetCursor().m_szSection), _wcsupr(INI_SERVERS_SECTION)) == 0) &&    //INI_SERVERS_SECTION == _T("Servers")
    ((wcscmp(_wcsupr(tempDeviceFunc.GetCursor().m_szVariable), _wcsupr(FTP_PRIMARY)) == 0) ||   //FTP_PRIMARY == _T("Primary")
*    (wcscmp(_wcsupr(tempDeviceFunc.GetCursor().m_szVariable), _wcsupr(SERVER_PORT)) == 0))))   //SERVER_PORT == _T("SERVERPORT")
{
    CString csValue = tempDeviceFunc.GetCursor().m_szValue;
    csValue = EncryptData(csValue.GetBuffer(csValue.GetLength()));

    WriteProfileString(tempDeviceFunc.GetCursor().m_szSection, tempDeviceFunc.GetCursor().m_szVariable, csValue.GetBuffer(csValue.GetLength()+1));
}

带 * 的行是堆栈所指向的行。

在断点处:curs.m_szSection = "APPLICATIONCONTROL", curs.m_szVariable = "AppLanguage", curs.m_szValue == "0"

我不确定在哪里可以找到错误,

【问题讨论】:

    标签: c++ visual-studio-2008 visual-c++ windows-ce


    【解决方案1】:

    我猜你有一个宏

    #define SERVER_PORT _T("SERVERPORT")
    

    在这种情况下,_T("SERVERPORT") 是一个 const 数组。
    你不能修改它(_wcsupr 就地修改它的参数)。

    用变量替换宏:

    TCHAR SERVER_PORT[] = _T("SERVERPORT");
    

    【讨论】:

    • 非常感谢,我暂时没想到那里看看。这确实修复了我的代码。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-07
    • 2012-12-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多