Add wrappers for StringCbXXXX functions and default RegLoadXXXX.
Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
parent
ed82f9d9d6
commit
907474c489
5 changed files with 42 additions and 0 deletions
|
@ -27,6 +27,8 @@ add_library(appleii SHARED
|
|||
linux/benchmark.cpp
|
||||
linux/paddle.cpp
|
||||
linux/version.cpp
|
||||
linux/stringcb.cpp
|
||||
linux/registry.cpp
|
||||
|
||||
Z80VICE/z80.cpp
|
||||
Z80VICE/z80mem.cpp
|
||||
|
|
18
source/linux/registry.cpp
Normal file
18
source/linux/registry.cpp
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include "linux/wincompat.h"
|
||||
#include "linux/stringcb.h"
|
||||
#include "linux/interface.h"
|
||||
|
||||
BOOL RegLoadString (LPCTSTR section, LPCTSTR key, BOOL peruser, LPTSTR buffer, DWORD chars, LPCTSTR defaultValue)
|
||||
{
|
||||
BOOL success = RegLoadString(section, key, peruser, buffer, chars);
|
||||
if (!success)
|
||||
StringCbCopy(buffer, chars, defaultValue);
|
||||
return success;
|
||||
}
|
||||
|
||||
BOOL RegLoadValue (LPCTSTR section, LPCTSTR key, BOOL peruser, DWORD* value, DWORD defaultValue) {
|
||||
BOOL success = RegLoadValue(section, key, peruser, value);
|
||||
if (!success)
|
||||
*value = defaultValue;
|
||||
return success;
|
||||
}
|
16
source/linux/stringcb.cpp
Normal file
16
source/linux/stringcb.cpp
Normal file
|
@ -0,0 +1,16 @@
|
|||
#include "linux/stringcb.h"
|
||||
#include <cstring>
|
||||
|
||||
HRESULT StringCbCopy(char * pszDest, const size_t cbDest, const char * pszSrc)
|
||||
{
|
||||
strncpy(pszDest, pszSrc, cbDest - 1);
|
||||
pszDest[cbDest - 1] = '\0';
|
||||
return 0;
|
||||
}
|
||||
|
||||
HRESULT StringCbCat(char * pszDest, const size_t cbDest, const char * pszSrc)
|
||||
{
|
||||
strncat(pszDest, pszSrc, cbDest - strlen(pszDest) - 1);
|
||||
pszDest[cbDest - 1] = '\0';
|
||||
return 0;
|
||||
}
|
5
source/linux/stringcb.h
Normal file
5
source/linux/stringcb.h
Normal file
|
@ -0,0 +1,5 @@
|
|||
#include "linux/wincompat.h"
|
||||
|
||||
HRESULT StringCbCopy(char * pszDest, const size_t cbDest, const char * pszSrc);
|
||||
HRESULT StringCbCat(char * pszDest,const size_t cbDest, const char * pszSrc);
|
||||
#define StringCbPrintf snprintf
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "linux/wincompat.h"
|
||||
#include "linux/dummies.h"
|
||||
#include "linux/stringcb.h"
|
||||
#include "minizip/unzip.h"
|
||||
|
||||
#define FILE_BEGIN SEEK_SET
|
||||
|
|
Loading…
Add table
Reference in a new issue