void regExportSettingsToINI() { if(vbKey != NULL) { regExportSettingsToINI(vbKey, VBA_PREF); }  HKEY key;  if(RegOpenKey(HKEY_CURRENT_USER, "Software\\Emulators\\VisualBoyAdvance\\Viewer", &key) == ERROR_SUCCESS) { regExportSettingsToINI(key, "Viewer"); RegCloseKey(key);
static void regExportSettingsToINI(HKEY key, const char *section) { char valueName[256]; int index = 0; while(1) { DWORD nameSize = 256; DWORD size = 2048; DWORD type; LONG res = RegEnumValue(key, index, valueName, &nameSize, NULL, &type, (LPBYTE)buffer, &size);  if(res == ERROR_SUCCESS) { switch(type) { case REG_DWORD: { char temp[256]; wsprintf(temp, "%u", *((DWORD *)buffer)); WritePrivateProfileString(section, valueName, temp, regVbaPath); } break; case REG_SZ: WritePrivateProfileString(section, valueName, buffer, regVbaPath); break; case REG_BINARY: { char temp[256];  wsprintf(temp, "%u", size); CStdString k = valueName; k += "Count"; WritePrivateProfileString(section, k, temp, regVbaPath); WritePrivateProfileStruct(section, valueName, buffer, size, regVbaPath); } break; } index++; } else break;
void regExportSettingsToINI(){   if(vbKey != NULL) {    regExportSettingsToINI(vbKey, VBA_PREF);  }  HKEY key;  if(RegOpenKey(HKEY_CURRENT_USER,                 "Software\\Emulators\\VisualBoyAdvance\\Viewer", &key) ==     ERROR_SUCCESS) {    regExportSettingsToINI(key, "Viewer");    RegCloseKey(key);  }}