Commit a780a3846c051b4cbd2ff8298de773e63779e371
1 parent
e90fa6be
Exists in
master
and in
2 other branches
Adding method to write string to windows registry.
Showing
2 changed files
with
17 additions
and
0 deletions
Show diff stats
src/core/windows/registry.c
... | ... | @@ -67,3 +67,18 @@ LIB3270_EXPORT DWORD lib3270_win32_get_dword(HKEY hKey, const char *name, DWORD |
67 | 67 | |
68 | 68 | return val; |
69 | 69 | } |
70 | + | |
71 | +LIB3270_EXPORT LSTATUS lib3270_win32_set_string(LPCSTR module, LPCSTR keyname, LPCSTR value) { | |
72 | + | |
73 | + HKEY hKey = 0; | |
74 | + LSTATUS status = lib3270_win32_create_regkey(module, KEY_CREATE_SUB_KEY|KEY_SET_VALUE, &hKey); | |
75 | + | |
76 | + if(status != ERROR_SUCCESS) | |
77 | + return status; | |
78 | + | |
79 | + status = RegSetValueEx(hKey,keyname,0,REG_SZ,(const BYTE *) value,strlen(value)+1); | |
80 | + | |
81 | + RegCloseKey(hKey); | |
82 | + | |
83 | + return status; | |
84 | +} | ... | ... |
src/include/windows/lib3270/win32.h
... | ... | @@ -50,6 +50,8 @@ LIB3270_EXPORT const char * lib3270_win32_strerror(int e); |
50 | 50 | LIB3270_EXPORT const char * lib3270_win32_local_charset(void); |
51 | 51 | LIB3270_EXPORT LSTATUS lib3270_win32_create_regkey(LPCSTR lpSubKey, REGSAM samDesired, PHKEY phkResult); |
52 | 52 | LIB3270_EXPORT DWORD lib3270_win32_get_dword(HKEY hKey, const char *name, DWORD def); |
53 | +LIB3270_EXPORT LSTATUS lib3270_win32_set_registry(LPCSTR module, LPCSTR keyname, LPCSTR value); | |
54 | +LIB3270_EXPORT LSTATUS lib3270_win32_set_string(LPCSTR module, LPCSTR keyname, LPCSTR value); | |
53 | 55 | |
54 | 56 | /** |
55 | 57 | * @brief Translate windows error code. | ... | ... |