Skip to content

CrystalDiskMark settings storage folder #128

Closed

Description

@Unikat2000

Hi,

I noticed that that the config settings for CrystalDiskMark were not carried over to the build, so I did a little research and found out that the settings are not stored the folder with the executable, but instead in the roaming folder.

So I edited the script and replaced

%ConfigFilex86%="%TargetPrograms%%ProgramFolder%\DiskMark32.ini"
%ConfigFilex64%="%TargetPrograms%%ProgramFolder%\DiskMark64.ini"

with

%ConfigFilex86%="%TargetDir%\Users\Default\AppData\Roaming%ProgramFolder%\DiskMark32.ini"
%ConfigFilex64%="%TargetDir%\Users\Default\AppData\Roaming%ProgramFolder%\DiskMark64.ini"

Now its works like it should. Maybe someone can fix this in the repo..

Activity

  1. homes32 commented on Feb 24, 2025

    @homes32
    Contributor

    Looks like a bug in CrystalDiskMark.

    The constructor for CMainDialogFx isn't correctly detecting we have admin rights so it falls back to the %appData% folder instead of the exe dir.

    #if _MSC_VER > 1310
    #ifdef ADMIN// for CrystalDiskInfo
    	GetModuleFileName(NULL, ini, MAX_PATH);
    	if ((ptrEnd = _tcsrchr(ini, '.')) != NULL)
    	{
    		*ptrEnd = '\0';
    		_tcscat_s(ini, MAX_PATH, _T(".ini");
    		m_Ini = ini;
    	}
    #else
    	TCHAR drive[_MAX_DRIVE];
    	TCHAR ext[_MAX_EXT];
    	TCHAR appData[MAX_PATH];
    	TCHAR dir[_MAX_DIR];
    	TCHAR fileName[_MAX_FNAME];
    	GetModuleFileName(NULL, ini, MAX_PATH);
    	_tsplitpath(ini, drive, dir, fileName, ext);
    	SHGetSpecialFolderPath(NULL, appData, CSIDL_APPDATA, 0);
    	directry.Format(_T("%s\\%s"), appData, PRODUCT_FILENAME);
    	CreateDirectory(directry, NULL);
    	m_Ini.Format(_T("%s\\%s\\%s.ini"), appData, PRODUCT_FILENAME, fileName);
    #endif
    #if _MSC_VER > 1310
    #ifdef ADMIN// for CrystalDiskInfo
    	GetModuleFileName(NULL, ini, MAX_PATH);
    	if ((ptrEnd = _tcsrchr(ini, '.')) != NULL)
    	{
    		*ptrEnd = '\0';
    		_tcscat_s(ini, MAX_PATH, _T(".ini");
    		m_Ini = ini;
    	}
    #else
    	TCHAR drive[_MAX_DRIVE];
    	TCHAR ext[_MAX_EXT];
    	TCHAR appData[MAX_PATH];
    	TCHAR dir[_MAX_DIR];
    	TCHAR fileName[_MAX_FNAME];
    	GetModuleFileName(NULL, ini, MAX_PATH);
    	_tsplitpath(ini, drive, dir, fileName, ext);
    	SHGetSpecialFolderPath(NULL, appData, CSIDL_APPDATA, 0);
    	directry.Format(_T("%s\\%s"), appData, PRODUCT_FILENAME);
    	CreateDirectory(directry, NULL);
    	m_Ini.Format(_T("%s\\%s\\%s.ini"), appData, PRODUCT_FILENAME, fileName);
    #endif
    

    I'll update the script to work around the issue until it's resolved.

  2. added
    bug
    external
    on Feb 24, 2025
  3. self-assigned this
    on Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugexternal

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions