On Monday 02 March 2009 17:26:47 Nikolay Sivov wrote:
Andreas Rosenberg wrote:
+ TRACE("%p %s %p\n", hToken, debugstr_w(lpProfileDir), lpcchSize ); + /* profile specific tokens not supported, so hToken ignored */ + + SetLastError(0); + res = RegOpenKeyExW(HKEY_LOCAL_MACHINE,profile_pathname,0L,KEY_QUERY_VALUE,&keyPr ofileDir);
Why do you need this SetLastError(0)?
Shouldn't every API function clear this? Otherwise your will get an error state, from a previous API call when checking GetLastError which may result in strange error codes.
+ res = RegGetValueW(keyProfileDir,profile_subkey,profile_keyname,RRF_RT_ANY, + NULL,buffer,&sizePath); /* RegGetValue expects pcbData in bytes */ + error = GetLastError(); + RegCloseKey(keyProfileDir);
error isn't used after that.
+ /* else ("GetUserNameW failed\n"); */ + } + /* else ("RegGetValueW failed - %d %d %d\n",res,error,sizePath); */ + } + /* else ("RegOpenKeyExW failed\n"); */ return FALSE;
What do these debug-comment lines mean?
I had added more code here to show debug information. I left it in case some later debugging should be required.