August 29, 2008

Why did the RegQueryValueEx() return ERROR_MORE_DATA?

Q: Why does the RegQueryValueEx() always return ERROR_MORE_DATA?

A: If the lpData buffer is too small to receive the data, the function returns ERROR_MORE_DATA.

Windows API:

LONG WINAPI RegQueryValueEx(
  __in HKEY hKey,
  __in_opt LPCTSTR lpValueName,
  __reserved LPDWORD lpReserved,
  __out_opt LPDWORD lpType,
  __out_opt LPBYTE lpData,
  __inout_opt LPDWORD lpcbData
);

Tips:
When you are using RegQueryValueExW(), the parameter of lpcbData
SHOULD be the array size in BYTES, not in characters.

MSDN Reference:

August 21, 2008

How to use Application Verifier for a service on Vista?

Q: After added the execution file of a service to Application Verifier(AV), I still can not find any log reported by AV.

A: You can find the logs here "c:\windows\system32\config\systemprofile\appverifierlogs". You can also copy it to the current user profile, then view logs from AV.