[PythonCE] PC/import_nt.c and CE registry functions

Doug Marien doug@jarna.com
Thu, 25 Jul 2002 15:25:01 -0700


Forgot about this in my last registry post, but the RegQueryValueEx calls in
import_nt.c are failing with an ERROR_INVALID_PARAMETER, however, when I
first call RegOpenKeyEx and use that in the query call, everything works.

I searched the pocketpc developer groups and couldn't find anyone who posted
a similar problem with ReqQueryValueEx.  And considering this code works
fine under Windows, I'm guessing it's pocketpc specific?

So, I tweaked the existing code slightly (starting around line 77) to:

regStat = RegOpenKeyEx(HKEY_CURRENT_USER, moduleKey, 0, 0, &keyBase);
if (regStat == ERROR_SUCCESS)
{
  regStat = RegQueryValueEx(keyBase, NULL, NULL,& lptype, (char *) tPathBuf,
&modNameSize);

  RegCloseKey(keyBase);
}

if (regStat != ERROR_SUCCESS)
{
  regStat = RegOpenKeyEx(HKEY_LOCAL_MACHINE, moduleKey, 0, 0, &keyBase);
  if (regStat != ERROR_SUCCESS)
    goto done;

  // be anal - failure may have reset size param
  modNameSize = pathLen;
  regStat = RegQueryValueEx(keyBase, NULL, NULL,& lptype, (char *) tPathBuf,
&modNameSize);

  RegCloseKey(keyBase);

  if (regStat != ERROR_SUCCESS)
    goto done;
}

Has anyone had experience/frustration with the registry functions on CE?  Or
am I just missing something? :)

Thanks,
Doug