X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/3d88e64dfcf5dc0fd361ce0c504c67a9196ce44c..211d84da9aff9c324b12f274d82cf2dc35348750:/winstore.c diff --git a/winstore.c b/winstore.c index 90d262fe..3ce84e06 100644 --- a/winstore.c +++ b/winstore.c @@ -3,7 +3,6 @@ * defined in storage.h. */ -#include #include #include #include @@ -61,12 +60,14 @@ static void unmungestr(const char *in, char *out, int outlen) return; } -void *open_settings_w(const char *sessionname) +void *open_settings_w(const char *sessionname, char **errmsg) { HKEY subkey1, sesskey; int ret; char *p; + *errmsg = NULL; + if (!sessionname || !*sessionname) sessionname = "Default Settings"; @@ -76,13 +77,18 @@ void *open_settings_w(const char *sessionname) ret = RegCreateKey(HKEY_CURRENT_USER, puttystr, &subkey1); if (ret != ERROR_SUCCESS) { sfree(p); + *errmsg = dupprintf("Unable to create registry key\n" + "HKEY_CURRENT_USER%s", puttystr); return NULL; } ret = RegCreateKey(subkey1, p, &sesskey); sfree(p); RegCloseKey(subkey1); - if (ret != ERROR_SUCCESS) + if (ret != ERROR_SUCCESS) { + *errmsg = dupprintf("Unable to create registry key\n" + "HKEY_CURRENT_USER%s\\%s", puttystr, p); return NULL; + } return (void *) sesskey; } @@ -176,18 +182,6 @@ int read_setting_fontspec(void *handle, const char *name, FontSpec *result) ret.height = read_setting_i(handle, settingname, INT_MIN); sfree(settingname); if (ret.height == INT_MIN) return 0; - if (ret.height < 0) { - int oldh, newh; - HDC hdc = GetDC(NULL); - int logpix = GetDeviceCaps(hdc, LOGPIXELSY); - ReleaseDC(NULL, hdc); - - oldh = -ret.height; - newh = MulDiv(oldh, 72, logpix) + 1; - if (MulDiv(newh, logpix, 72) > oldh) - newh--; - ret.height = newh; - } *result = ret; return 1; }