You may need to trim the values to ensure that there are no trailing spaces causing a problem.

To check for a read failure you need to test the error values, something like:
Code:
$ValueX=ReadProfileString("X:\test.ini","Test","Test")
If @ERROR
"Cannot check - failed to read value from X:" ?
"Error was: "+@ERROR+", "+@SERROR ?
Else
$ValueD=ReadProfileString("D:\test.ini","Test","Test")
If @ERROR
"Cannot check - failed to read value from D:" ?
"Error was: "+@ERROR+", "+@SERROR ?
Else
If $ValueX <> $ValueY
"Values do not match" ?
EndIf
EndIf
EndIf