/****************************************************************************** * This function receives the currently read entry and performs the * corresponding action. * isUnicode affects parsing of REG_MULTI_SZ values */ static void processRegEntry(WCHAR* stdInput, BOOL isUnicode) { /* * We encountered the end of the file, make sure we * close the opened key and exit */ if (stdInput == NULL) { closeKey(); return; } if ( stdInput[0] == '[') /* We are reading a new key */ { WCHAR* keyEnd; closeKey(); /* Close the previous key */ /* Get rid of the square brackets */ stdInput++; keyEnd = strrchrW(stdInput, ']'); if (keyEnd) *keyEnd='\0'; /* delete the key if we encounter '-' at the start of reg key */ if ( stdInput[0] == '-') { delete_registry_key(stdInput + 1); } else if ( openKeyW(stdInput) != ERROR_SUCCESS ) { char* stdInputA = GetMultiByteString(stdInput); fprintf(stderr,"%s: setValue failed to open key %s\n", getAppName(), stdInputA); HeapFree(GetProcessHeap(), 0, stdInputA); } } else if( currentKeyHandle && (( stdInput[0] == '@') || /* reading a default @=data pair */ ( stdInput[0] == '\"'))) /* reading a new value=data pair */ { processSetValue(stdInput, isUnicode); } else { /* Since we are assuming that the file format is valid we must be * reading a blank line which indicates the end of this key processing */ closeKey(); } }
/****************************************************************************** * This function receives the currently read entry and performs the * corresponding action. * isUnicode affects parsing of REG_MULTI_SZ values */ static void processRegEntry(WCHAR* stdInput, BOOL isUnicode) { /* * We encountered the end of the file, make sure we * close the opened key and exit */ if (stdInput == NULL) { closeKey(); return; } if ( stdInput[0] == '[') /* We are reading a new key */ { WCHAR* keyEnd; closeKey(); /* Close the previous key */ /* Get rid of the square brackets */ stdInput++; keyEnd = strrchrW(stdInput, ']'); if (keyEnd) *keyEnd='\0'; /* delete the key if we encounter '-' at the start of reg key */ if (stdInput[0] == '-') delete_registry_key(stdInput + 1); else if (openKeyW(stdInput) != ERROR_SUCCESS) output_message(STRING_OPEN_KEY_FAILED, stdInput); } else if( currentKeyHandle && (( stdInput[0] == '@') || /* reading a default @=data pair */ ( stdInput[0] == '\"'))) /* reading a new value=data pair */ { processSetValue(stdInput, isUnicode); } else { /* Since we are assuming that the file format is valid we must be * reading a blank line which indicates the end of this key processing */ closeKey(); } }