home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 11 Util
/
11-Util.zip
/
BKUPINI.ZIP
/
BKUPSINI.C
< prev
next >
Wrap
Text File
|
1990-05-20
|
5KB
|
111 lines
#define EXTERN extern
#include "INIPGMS.h"
VOID APIENTRY Backup_Ini()
{
CHAR buffersave[MAXNAMEL+1], buffer[MAXNAMEL+1] ;
HINI hiniBkup ;
ULONG ulApplLen, ulKeyNamesSize, ulKeyDataSize ;
PVOID pvoidKeyNames, pvoidKeyData ;
PSZ pszApplName, pszKeyNames ;
strcpy( buffersave, (PSZ)pvoidWorkArea ) ;
strcpy( buffer, buffersave ) ;
strcat( buffer, "OS2SV.INI" ) ;
hiniBkup = PrfOpenProfile( hAB, buffer ) ;
pvoidWorkArea = pvoidWorkAreaOrigin ;
ulWorkAreaSize = WORKAREASIZE ;
ulApplLen = ulWorkAreaSize ;
if( PrfQueryProfileData( HINI_USERPROFILE,
NULL,
NULL,
pvoidWorkArea,
&ulApplLen ) )
{
(PBYTE)pvoidKeyNames = (PBYTE)pvoidWorkArea +
ulApplLen + 1 ;
for( pszApplName = (PSZ)pvoidWorkArea;
strlen(pszApplName) ;
pszApplName += strlen(pszApplName)+1 )
{
ulKeyNamesSize = ulWorkAreaSize - (ulApplLen + 1) ;
PrfQueryProfileData( HINI_USERPROFILE,
pszApplName,
NULL,
pvoidKeyNames,
&ulKeyNamesSize ) ;
(PBYTE)pvoidKeyData = (PBYTE)pvoidKeyNames + ulKeyNamesSize + 1 ;
for( pszKeyNames = (PSZ)pvoidKeyNames;
strlen(pszKeyNames) ;
pszKeyNames += strlen(pszKeyNames)+1 )
{
ulKeyDataSize = ulWorkAreaSize -
(ulApplLen + ulKeyNamesSize + 2) ;
PrfQueryProfileData( HINI_USERPROFILE,
pszApplName,
pszKeyNames,
pvoidKeyData,
&ulKeyDataSize ) ;
PrfWriteProfileData( hiniBkup,
pszApplName,
pszKeyNames,
pvoidKeyData,
ulKeyDataSize ) ;
} /* End of Key process for */
} /* End of Appl process for */
} /* End of If Applname */
PrfCloseProfile( hiniBkup ) ;
strcpy( buffer, buffersave ) ;
strcat( buffer, "OS2SYSSV.INI" ) ;
hiniBkup = PrfOpenProfile( hAB, buffer ) ;
pvoidWorkArea = pvoidWorkAreaOrigin ;
ulWorkAreaSize = WORKAREASIZE ;
ulApplLen = ulWorkAreaSize ;
if( PrfQueryProfileData( HINI_SYSTEMPROFILE,
NULL,
NULL,
pvoidWorkArea,
&ulApplLen ) )
{
(PBYTE)pvoidKeyNames = (PBYTE)pvoidWorkArea +
ulApplLen + 1 ;
for( pszApplName = (PSZ)pvoidWorkArea;
strlen(pszApplName) ;
pszApplName += strlen(pszApplName)+1 )
{
ulKeyNamesSize = ulWorkAreaSize - (ulApplLen + 1) ;
PrfQueryProfileData( HINI_SYSTEMPROFILE,
pszApplName,
NULL,
pvoidKeyNames,
&ulKeyNamesSize ) ;
(PBYTE)pvoidKeyData = (PBYTE)pvoidKeyNames + ulKeyNamesSize + 1 ;
for( pszKeyNames = (PSZ)pvoidKeyNames;
strlen(pszKeyNames) ;
pszKeyNames += strlen(pszKeyNames)+1 )
{
ulKeyDataSize = ulWorkAreaSize -
(ulApplLen + ulKeyNamesSize + 2) ;
PrfQueryProfileData( HINI_SYSTEMPROFILE,
pszApplName,
pszKeyNames,
pvoidKeyData,
&ulKeyDataSize ) ;
PrfWriteProfileData( hiniBkup,
pszApplName,
pszKeyNames,
pvoidKeyData,
ulKeyDataSize ) ;
} /* End of Key process for */
} /* End of Appl process for */
} /* End of If Applname */
PrfCloseProfile( hiniBkup ) ;
WinPostMsg(hwndThreadWaiter, WM_COMMAND, MPFROMSHORT(THREAD_GONE), 0L) ;
DosExit( EXIT_THREAD, 0 ) ;
}