private static byte[] WindowsRegEnumKeyEx1(int hKey,int subKeyIndex,int maxKeyLength){
  byte[] result=WindowsRegEnumKeyEx(hKey,subKeyIndex,maxKeyLength);
  if (result != null) {
    return result;
  }
 else {
    long sleepTime=INIT_SLEEP_TIME;
    for (int i=0; i < MAX_ATTEMPTS; i++) {
      try {
        Thread.sleep(sleepTime);
      }
 catch (      InterruptedException e) {
        return result;
      }
      sleepTime*=2;
      result=WindowsRegEnumKeyEx(hKey,subKeyIndex,maxKeyLength);
      if (result != null) {
        return result;
      }
    }
  }
  return result;
}

private static byte [ ] WindowsRegEnumKeyEx1 ( int hKey , int subKeyIndex , int maxKeyLength ) { byte [ ] result = WindowsRegEnumKeyEx ( hKey , subKeyIndex , maxKeyLength ) ; if ( result != null ) { return result ; } else { long sleepTime = INIT_SLEEP_TIME ; for ( int i = 0 ; i < MAX_ATTEMPTS ; i ++ ) { try { Thread . sleep ( sleepTime ) ; } catch ( InterruptedException e ) { return result ; } sleepTime *= 2 ; result = WindowsRegEnumKeyEx ( hKey , subKeyIndex , maxKeyLength ) ; if ( result != null ) { return result ; } } } return result ; }
retries regenumkeyex ( ) max_attempts times before giving up .
