1 |
/* wptRegistry.cpp - W32 Registry access |
/* wptRegistry.cpp - Windows Registry access |
2 |
* Copyright (C) 2000-2005 Timo Schulz |
* Copyright (C) 2000-2006 Timo Schulz |
3 |
* |
* |
4 |
* This file is part of WinPT. |
* This file is part of WinPT. |
5 |
* |
* |
278 |
if( reg ) |
if( reg ) |
279 |
RegCloseKey( reg ); |
RegCloseKey( reg ); |
280 |
return rc; |
return rc; |
281 |
} /* create_file_type */ |
} |
282 |
|
|
283 |
|
|
284 |
/* Expand a string with %foo% entries so that %foo% will |
/* Expand a string with %foo% entries so that %foo% will |
363 |
rc = WPTERR_REGISTRY; |
rc = WPTERR_REGISTRY; |
364 |
RegCloseKey( reg_key ); |
RegCloseKey( reg_key ); |
365 |
return rc; |
return rc; |
366 |
} /* set_reg_entry */ |
} |
367 |
|
|
368 |
|
|
369 |
int |
int |
391 |
leave: |
leave: |
392 |
RegCloseKey( reg_key ); |
RegCloseKey( reg_key ); |
393 |
return rc; |
return rc; |
394 |
} /* set_reg_key */ |
} |
395 |
|
|
396 |
|
|
397 |
int |
int |
482 |
"NoCompressMultiMedia", |
"NoCompressMultiMedia", |
483 |
"Expert", |
"Expert", |
484 |
"FMProgressBar", |
"FMProgressBar", |
485 |
|
"BackupSecring" |
486 |
}; |
}; |
487 |
|
|
488 |
|
|
501 |
int |
int |
502 |
get_reg_winpt_single (int id) |
get_reg_winpt_single (int id) |
503 |
{ |
{ |
504 |
char * buf = NULL; |
char *buf; |
505 |
int val = 0; |
int val = 0; |
506 |
|
|
507 |
buf = get_reg_entry (HKEY_CURRENT_USER, WINPT_REG, cfg[id]); |
buf = get_reg_entry (HKEY_CURRENT_USER, WINPT_REG, cfg[id]); |
561 |
case CFG_FM_PROGRESS: |
case CFG_FM_PROGRESS: |
562 |
sprintf (buf, "%d", opt->fm.progress); |
sprintf (buf, "%d", opt->fm.progress); |
563 |
break; |
break; |
564 |
|
|
565 |
|
case CFG_BACKUP_INC_SKR: |
566 |
|
sprintf (buf, "%d", opt->backup.include_secr); |
567 |
|
break; |
568 |
} |
} |
569 |
rc = set_reg_entry (HKEY_CURRENT_USER, WINPT_REG, cfg[i], buf); |
rc = set_reg_entry (HKEY_CURRENT_USER, WINPT_REG, cfg[i], buf); |
570 |
if (rc) |
if (rc) |
604 |
set_reg_winpt_flag (const char * name, int val) |
set_reg_winpt_flag (const char * name, int val) |
605 |
{ |
{ |
606 |
return set_reg_entry (HKEY_CURRENT_USER, WINPT_REG, name, val? "1" : "0"); |
return set_reg_entry (HKEY_CURRENT_USER, WINPT_REG, name, val? "1" : "0"); |
607 |
} /* set_reg_winpt_flag */ |
} |
608 |
|
|
609 |
|
|
610 |
int |
int |
620 |
flag = -1; |
flag = -1; |
621 |
free_if_alloc (buf); |
free_if_alloc (buf); |
622 |
return flag; |
return flag; |
623 |
} /* get_reg_winpt_flag */ |
} |
624 |
|
|
625 |
|
|
626 |
/* Retrieve the winpt preferences from the registry. */ |
/* Retrieve the winpt preferences from the registry. */ |
673 |
case CFG_FM_PROGRESS: |
case CFG_FM_PROGRESS: |
674 |
opt->fm.progress = atol (val); |
opt->fm.progress = atol (val); |
675 |
break; |
break; |
676 |
|
|
677 |
|
case CFG_BACKUP_INC_SKR: |
678 |
|
opt->backup.include_secr = atol (val); |
679 |
|
break; |
680 |
} |
} |
681 |
free_if_alloc (val); |
free_if_alloc (val); |
682 |
} |
} |