Hello, I am retreiving the DWORD from the registry using this code

VB Code:
  1. Function GetSettingLong(ByVal Hkey As Long, ByVal strPath As String, ByVal strValueName As String, Optional Default As Long) As Long
  2.  
  3. Dim lResult As Long
  4. Dim lValueType As Long
  5. Dim lBuf As Long
  6. Dim lDataBufSize As Long
  7. Dim r As Long
  8. Dim keyhand As Long
  9.  
  10. r = RegOpenKey(Hkey, strPath, keyhand)
  11.  
  12. lDataBufSize = 4
  13.    
  14. lResult = RegQueryValueEx(keyhand, strValueName, 0&, lValueType, lBuf, lDataBufSize)
  15.  
  16. If lResult = ERROR_SUCCESS Then
  17.     If lValueType = REG_DWORD Then
  18.         GetSettingLong = lBuf
  19.     End If
  20. End If
  21.  
  22. r = RegCloseKey(keyhand)
  23.    
  24. End Function

This works perfectly on most machines that runs this function, however on an Windows XP machine this always returns 0. Even though on other XP machines this works perfectly on this XP machine it does not work even though lResult has the value ERROR_SUCCESS.

I have looked directly in the registry and the values are there, I have sucessfully retreived REG_SZ values from that XP machine but for some reason it does not reterive the DWORD for this machine.

The only difference I see is that it is a French version of windows. Any ideas anybody?