GetDeviceInfo Errors in Source Code CE4.2

From: H. Edgar (nospam_at_nospam.com)
Date: 11/28/04


Date: Sun, 28 Nov 2004 18:35:13 +0100


The ATAPI driver function CDisk::GetDeviceInfo in CE4.2 CSP X86 has some C++
errors:
It uses the function AtaGetRegistryString from helper.cpp, e.g. in the
following statement:

if (!hKey || !AtaGetRegistryString( hKey, REG_VALUE_HDPROFILE, (PTSTR
*)&psdi->szProfile, sizeof(psdi->szProfile))) {
            wcscpy( psdi->szProfile, REG_VALUE_HDPROFILE);
}

The cast (PTSTR *)&psdi->szProfile is wrong. This generates an exception
error because AtaGetRegistryString tries to write into *((PTSTR
*)&psdi->szProfile). This is wrong for

struct
{
    szProfile[40];
}

Edgar