简体   繁体   English

在0xC0000005中的0x6ececafa出现未处理的异常:访问冲突写入位置0x00000000

[英]Unhandled Exception as at 0x6ececafa in 0xC0000005 : Access violation writing location 0x00000000

Getting exception in the following code. 在以下代码中获取异常。

HRESULT GetRemovableDrive(
    __out   LPDWORD   lpdwRemovableDriveCount,
    __out   CHAR*     szRemovableDrive )
{
    INT     iDriveCnt                   = 0;
    CHAR   TempDrive[ MAX_PATH ]       = { TEXT('\0') };

hResult = CheckDriveReady( tzDriveName, &bIsDeviceReady );
                    if ( !hResult && TRUE == bIsDeviceReady )
                    {
                        //
                        // Copy drive name
                        //
                        strcpy_s ( TempDrive, tzDriveName );
                        memcpy(szRemovableDrive + iDriveCnt, TempDrive, 1);
                        iDriveCnt++;
                        ( *lpdwRemovableDriveCount )++;
                    } // if
}

Getting exception while performing the memcpy as unhandled exception :Access violation writing location 0x00000000. 在执行memcpy时获取异常作为未处理的异常:访问冲突写入位置0x00000000。

The message is pretty clear. 消息很清楚。 You are writing to address 0 on the call to memcpy() . 您正在调用memcpy()写入地址0。 That means that szRemovableDrive and iDriveCnt are both 0 since that's the write destination address. 这意味着szRemovableDriveiDriveCnt均为0,因为这是写入目标地址。 The caller is likely passing in a NULL pointer to GetRemoveableDrive() for that parameter. 调用者可能GetRemoveableDrive() NULL指针传递给该参数的GetRemoveableDrive()

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 0xC0000005:访问冲突读取位置0x00000000 - 0xC0000005: Access violation reading location 0x00000000 NVIDIA未处理的异常,位于0x002a2da2中 <work.exe> 0xC0000005:访问冲突读取位置0x00000000 - NVIDIA Unhandled exception at 0x002a2da2 in <work.exe>0xC0000005: Access violation reading location 0x00000000 0xC0000005:访问冲突执行位置0x00000000 - 0xC0000005: Access violation executing location 0x00000000 0xC0000005:访问冲突读取位置0x00000000 - 0xC0000005: Access violation reading location 0x00000000 tester.exe中0x00b21840处未处理的异常:0xC0000005:访问冲突读取位置0x00000000 - Unhandled exception at 0x00b21840 in tester.exe: 0xC0000005: Access violation reading location 0x00000000 Project4.exe中0x00998876处的首次机会异常:0xC0000005:访问冲突写入位置0x00000000 - First-chance exception at 0x00998876 in Project4.exe: 0xC0000005: Access violation writing location 0x00000000 MyString.exe中0x0FC9E559(ucrtbased.dll)的未处理异常:0xC0000005:访问冲突写入位置0x00000000 - Unhandled exception at 0x0FC9E559 (ucrtbased.dll) in MyString.exe: 0xC0000005: Access violation writing location 0x00000000 在 Project0_opengl.exe 中的 0x00000000 处抛出异常:0xC0000005:访问冲突执行位置 0x00000000 - Exception thrown at 0x00000000 in Project0_opengl.exe: 0xC0000005: Access violation executing location 0x00000000 在 CobwebDiagram.exe 中的 0x00000000 处引发异常:0xC0000005:访问冲突执行位置 0x00000000 - Exception thrown at 0x00000000 in CobwebDiagram.exe: 0xC0000005: Access violation executing location 0x00000000 C ++:0xC0000005:访问冲突写入位置0x00000000 - C++: 0xC0000005: Access violation writing location 0x00000000
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM