mirror of
https://gitlab.com/hashborgir/plugy.git
synced 2024-11-30 12:36:02 +00:00
69 lines
1.8 KiB
C++
69 lines
1.8 KiB
C++
/******************************************************************************
|
|
File modified by Yohann NICOLAS.
|
|
|
|
NAME
|
|
inifile.h
|
|
|
|
DESCRIPTION
|
|
Memory cached INI file read/write class to replace legacy MS code
|
|
|
|
COPYRIGHT
|
|
©1999-2004 Ultrafunk (www.ultrafunk.com) - info@ultrafunk.com
|
|
|
|
******************************************************************************/
|
|
#pragma once
|
|
|
|
#include <windows.h>
|
|
|
|
#define INIFILE_READ 10
|
|
#define INIFILE_WRITE 20
|
|
#define INIFILE_MPQREAD 30
|
|
|
|
#define MAX_SECTIONNAME_LENGTH 128
|
|
#define MAX_KEYNAME_LENGTH 128
|
|
|
|
class INIFile
|
|
{
|
|
public:
|
|
INIFile();
|
|
~INIFile();
|
|
|
|
BOOL InitReadWrite(const char *path, int readWrite, DWORD writeCacheSize);
|
|
BOOL close();
|
|
int GetPrivateProfileString(const char *section, const char *key, const char *def, char *dest, DWORD size);
|
|
BOOL WritePrivateProfileString(char *section, char *key, char *string);
|
|
|
|
private:
|
|
char m_currentSection[MAX_SECTIONNAME_LENGTH];
|
|
char *m_cache;
|
|
char *m_sectionStart;
|
|
char *m_sectionEnd;
|
|
int m_readWrite;
|
|
char m_path[_MAX_PATH];
|
|
HANDLE m_file;
|
|
DWORD m_cacheWritePos;
|
|
};
|
|
|
|
class INIFileW
|
|
{
|
|
public:
|
|
INIFileW();
|
|
~INIFileW();
|
|
|
|
BOOL InitReadWrite(const char *path, int readWrite, DWORD writeCacheSize);
|
|
BOOL close();
|
|
int GetPrivateProfileString(LPCWSTR section, LPCWSTR key, LPCWSTR def, LPWSTR dest, DWORD size);
|
|
int GetPrivateProfileStringList(LPCWSTR section, LPCWSTR key, DWORD** codes, LPWSTR** values);
|
|
//BOOL WritePrivateProfileString(char *section, char *key, char *string);
|
|
LPWSTR m_cache;
|
|
|
|
private:
|
|
WCHAR m_currentSection[MAX_SECTIONNAME_LENGTH];
|
|
LPCWSTR m_sectionStart;
|
|
LPCWSTR m_sectionEnd;
|
|
int m_readWrite;
|
|
char m_path[_MAX_PATH];
|
|
HANDLE m_file;
|
|
DWORD m_cacheWritePos;
|
|
};
|
|
/*================================= END OF FILE =================================*/ |