fix installation reg values not written
This commit is contained in:
@@ -190,6 +190,32 @@ bool RegistryAccess::SetRegValue( const RString &sKey, const RString &sName, boo
|
|||||||
return bSuccess;
|
return bSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool RegistryAccess::CreateKey( const RString &sKey )
|
||||||
|
{
|
||||||
|
RString sSubkey;
|
||||||
|
HKEY hType;
|
||||||
|
if( !GetRegKeyType(sKey, sSubkey, hType) )
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
HKEY hKey;
|
||||||
|
DWORD dwDisposition = 0;
|
||||||
|
if( ::RegCreateKeyEx(
|
||||||
|
hType,
|
||||||
|
sSubkey,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
REG_OPTION_NON_VOLATILE,
|
||||||
|
KEY_ALL_ACCESS,
|
||||||
|
NULL,
|
||||||
|
&hKey,
|
||||||
|
&dwDisposition ) != ERROR_SUCCESS )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
::RegCloseKey(hKey);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (c) 2004 Glenn Maynard
|
* (c) 2004 Glenn Maynard
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ namespace RegistryAccess
|
|||||||
bool SetRegValue( const RString &sKey, const RString &sName, const RString &val );
|
bool SetRegValue( const RString &sKey, const RString &sName, const RString &val );
|
||||||
bool SetRegValue( const RString &sKey, const RString &sName, int val );
|
bool SetRegValue( const RString &sKey, const RString &sName, int val );
|
||||||
bool SetRegValue( const RString &sKey, const RString &sName, bool val );
|
bool SetRegValue( const RString &sKey, const RString &sName, bool val );
|
||||||
|
|
||||||
|
bool CreateKey( const RString &sKey );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -179,8 +179,6 @@ BOOL MainMenuDlg::OnInitDialog()
|
|||||||
TCHAR szCurDir[MAX_PATH];
|
TCHAR szCurDir[MAX_PATH];
|
||||||
GetCurrentDirectory( ARRAYSIZE(szCurDir), szCurDir );
|
GetCurrentDirectory( ARRAYSIZE(szCurDir), szCurDir );
|
||||||
GetDlgItem( IDC_EDIT_INSTALLATION )->SetWindowText( szCurDir );
|
GetDlgItem( IDC_EDIT_INSTALLATION )->SetWindowText( szCurDir );
|
||||||
SMPackageUtil::AddGameInstallDir( szCurDir );
|
|
||||||
SMPackageUtil::SetDefaultInstallDir( szCurDir );
|
|
||||||
|
|
||||||
return TRUE; // return TRUE unless you set the focus to a control
|
return TRUE; // return TRUE unless you set the focus to a control
|
||||||
// EXCEPTION: OCX Property Pages should return FALSE
|
// EXCEPTION: OCX Property Pages should return FALSE
|
||||||
|
|||||||
@@ -15,17 +15,16 @@ static const RString INSTALLATIONS_KEY = "HKEY_LOCAL_MACHINE\\Software\\" PRODUC
|
|||||||
|
|
||||||
void SMPackageUtil::WriteGameInstallDirs( const vector<RString>& asInstallDirsToWrite )
|
void SMPackageUtil::WriteGameInstallDirs( const vector<RString>& asInstallDirsToWrite )
|
||||||
{
|
{
|
||||||
|
RegistryAccess::CreateKey( INSTALLATIONS_KEY );
|
||||||
|
|
||||||
for( unsigned i=0; i<100; i++ )
|
for( unsigned i=0; i<100; i++ )
|
||||||
{
|
{
|
||||||
RString sName = ssprintf("%d",i);
|
RString sName = ssprintf("%d",i);
|
||||||
// Reg.DeleteKey( sName ); // delete key is broken in this library, so just write over it with ""
|
RString sValue;
|
||||||
RegistryAccess::SetRegValue( INSTALLATIONS_KEY, sName, RString() );
|
if( i < asInstallDirsToWrite.size() )
|
||||||
}
|
sValue = asInstallDirsToWrite[i];
|
||||||
|
|
||||||
for( unsigned i=0; i<asInstallDirsToWrite.size(); i++ )
|
RegistryAccess::SetRegValue( INSTALLATIONS_KEY, sName, sValue );
|
||||||
{
|
|
||||||
RString sName = ssprintf("%d",i);
|
|
||||||
RegistryAccess::SetRegValue( INSTALLATIONS_KEY, sName, asInstallDirsToWrite[i] );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ BOOL CSmpackageApp::InitInstance()
|
|||||||
if( CAN_INSTALL_PACKAGES && SMPackageUtil::IsValidInstallDir(szCurrentDirectory) )
|
if( CAN_INSTALL_PACKAGES && SMPackageUtil::IsValidInstallDir(szCurrentDirectory) )
|
||||||
{
|
{
|
||||||
SMPackageUtil::AddGameInstallDir( szCurrentDirectory ); // add this if it doesn't already exist
|
SMPackageUtil::AddGameInstallDir( szCurrentDirectory ); // add this if it doesn't already exist
|
||||||
|
SMPackageUtil::SetDefaultInstallDir( szCurrentDirectory );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user