dwCount++;  wsprintf(szName, "PathToExe%02d", ++dwIndex);
wsprintf(szName, "PathToExe%02d", ++dwIndex);
DWORD ProcessAppItem(HKEY hkRootKey, LPSTR szKeyAppList, LPSTR szAppID){  DWORD dwCount = 0;  DWORD dwIndex = 1;  const DWORD dwUpperLimit = 100;  BOOL  bDefaultApp;  char szBuf[MAX_BUF];  char szKey[MAX_BUF];  char szName[MAX_BUF];  char szUninstKey[MAX_BUF];  GetPrivateProfileString("General", "Default AppID", "", szBuf, sizeof(szBuf), szFileIniUninstall);  bDefaultApp = (lstrcmpi(szAppID, szBuf) == 0);  wsprintf(szKey, "%s\\%s", szKeyAppList, szAppID);  if(lstrcmpi(szAppID, ugUninstall.szClientAppID) == 0) // This is the app that the user said   {                                                    //    on the command-line to uninstall.    if((ugUninstall.szClientAppPath[0] == '\0') || (bDefaultApp)) //If we didn't get an /app_path or this    {                                                             //   is the default app, just remove it.      RegDeleteKey(hkRootKey, szKey);      if(bDefaultApp)      {        wsprintf(szKey, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\GRE (%s)", ugUninstall.szUserAgent);        RegDeleteKey(hkRootKey, szKey);      }      return 0;    }    wsprintf(szName, "PathToExe%02d", dwIndex);    while( (WinRegNameExists(hkRootKey, szKey, szName)) // Since we got an /app_path we need to cycle        && (dwIndex < dwUpperLimit) )                   //   through the list looking for that instance.    {      GetWinReg(hkRootKey, szKey, szName, szBuf, MAX_BUF);      if( (lstrcmpi(szBuf, ugUninstall.szClientAppPath) == 0) || (!FileExists(szBuf)) )        RemovePathToExeXX(hkRootKey, szKey, dwIndex, dwUpperLimit);      else        dwCount++;      wsprintf(szName, "PathToExe%02d", ++dwIndex);    }    if(dwCount == 0)      RegDeleteKey(hkRootKey, szKey);    return dwCount;  }  if(bDefaultApp) // The Default App does not have an installed file registered.  However, an entry in   {               // the Windows Add/Remove products list indicates that the Default App is installed                  // and needs to be counted.    wsprintf(szUninstKey, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%s (%s)",ugUninstall.szProductName, ugUninstall.szUserAgent);    GetWinReg(hkRootKey, szUninstKey, "UninstallString", szBuf, sizeof(szBuf));    if(szBuf[0] != '\0')      return 1;  }  wsprintf(szName, "PathToExe%02d", dwIndex);  while(WinRegNameExists(hkRootKey, szKey, szName)) // Count the entries which can be verified by the  {                                                 //   existence of the file pointed to by PathToExeXX    GetWinReg(hkRootKey, szKey, szName, szBuf, MAX_BUF);    if(FileExists(szBuf))        {      dwCount++;    }    else                                       // This is an orphaned entry.  Remove it from the list.      RemovePathToExeXX(hkRootKey, szKey, dwIndex, dwUpperLimit);  // When we remove a PathToExeXX registry setting we must                                                // reenumerate the list so there are no gaps in the count.    wsprintf(szName, "PathToExe%02d", ++dwIndex);  }  if(dwCount == 0)    RegDeleteKey(hkRootKey, szKey);  return dwCount;}