\r
void \r
khcint_space_hold(kconf_conf_space * s) {\r
- InterlockedIncrement(&(s->refcount));\r
+ EnterCriticalSection(&cs_conf_global);\r
+ s->refcount ++;\r
+ LeaveCriticalSection(&cs_conf_global);\r
}\r
\r
void \r
khcint_space_release(kconf_conf_space * s) {\r
- LONG l = InterlockedDecrement(&(s->refcount));\r
- if(!l) {\r
- EnterCriticalSection(&cs_conf_global);\r
+ khm_int32 l;\r
\r
- /* check again */\r
- if (!l) {\r
- if(s->regkey_machine)\r
- RegCloseKey(s->regkey_machine);\r
- if(s->regkey_user)\r
- RegCloseKey(s->regkey_user);\r
- s->regkey_machine = NULL;\r
- s->regkey_user = NULL;\r
-\r
- if (s->flags &\r
- (KCONF_SPACE_FLAG_DELETE_M |\r
- KCONF_SPACE_FLAG_DELETE_U)) {\r
- khcint_remove_space(s, s->flags);\r
- }\r
- }\r
+ EnterCriticalSection(&cs_conf_global);\r
\r
- LeaveCriticalSection(&cs_conf_global);\r
+ l = -- s->refcount;\r
+ if (l == 0) {\r
+ if(s->regkey_machine)\r
+ RegCloseKey(s->regkey_machine);\r
+ if(s->regkey_user)\r
+ RegCloseKey(s->regkey_user);\r
+ s->regkey_machine = NULL;\r
+ s->regkey_user = NULL;\r
+\r
+ if (s->flags &\r
+ (KCONF_SPACE_FLAG_DELETE_M |\r
+ KCONF_SPACE_FLAG_DELETE_U)) {\r
+ khcint_remove_space(s, s->flags);\r
+ }\r
}\r
+\r
+ LeaveCriticalSection(&cs_conf_global);\r
}\r
\r
/* case sensitive replacement for RegOpenKeyEx */\r
t = sSubKey;\r
\r
/* check for case insensitive prefix first */\r
- if (!wcsnicmp(sSubKey, CONFIG_REGPATHW, ARRAYLENGTH(CONFIG_REGPATHW) - 1)) {\r
+ if (!_wcsnicmp(sSubKey, CONFIG_REGPATHW, ARRAYLENGTH(CONFIG_REGPATHW) - 1)) {\r
HKEY hkt;\r
\r
t = sSubKey + (ARRAYLENGTH(CONFIG_REGPATHW) - 1);\r
t = lpSubKey;\r
\r
/* check for case insensitive prefix first */\r
- if (!wcsnicmp(lpSubKey, CONFIG_REGPATHW, ARRAYLENGTH(CONFIG_REGPATHW) - 1)) {\r
+ if (!_wcsnicmp(lpSubKey, CONFIG_REGPATHW, ARRAYLENGTH(CONFIG_REGPATHW) - 1)) {\r
HKEY hkt;\r
\r
t = lpSubKey + (ARRAYLENGTH(CONFIG_REGPATHW) - 1);\r
}\r
}\r
\r
- if (!wcsnicmp(sk_name, t, cch) &&\r
+ if (!_wcsnicmp(sk_name, t, cch) &&\r
(sk_name[cch] == L'\0' ||\r
sk_name[cch] == L'~')) {\r
long new_idx;\r
}\r
\r
khm_int32 \r
-khcint_open_space_int(kconf_conf_space * parent, \r
- const wchar_t * sname, size_t n_sname, \r
- khm_int32 flags, kconf_conf_space **result) {\r
+khcint_open_space(kconf_conf_space * parent, \r
+ const wchar_t * sname, size_t n_sname, \r
+ khm_int32 flags, kconf_conf_space **result) {\r
kconf_conf_space * p;\r
kconf_conf_space * c;\r
HKEY pkey = NULL;\r
if(n_sname >= KCONF_MAXCCH_NAME || n_sname <= 0)\r
return KHM_ERROR_INVALID_PARAM;\r
\r
- /*SAFE: buf: buffer size == KCONF_MAXCCH_NAME * wchar_t >\r
- n_sname * wchar_t */\r
+ /* SAFE: buf: buffer size == KCONF_MAXCCH_NAME * wchar_t >\r
+ n_sname * wchar_t */\r
wcsncpy(buf, sname, n_sname);\r
buf[n_sname] = L'\0';\r
\r
/* see if there is already a config space by this name. if so,\r
- return it. Note that if the configuration space is specified in a\r
- schema, we would find it here. */\r
+ return it. Note that if the configuration space is specified\r
+ in a schema, we would find it here. */\r
EnterCriticalSection(&cs_conf_global);\r
c = TFIRSTCHILD(p);\r
while(c) {\r
LeaveCriticalSection(&cs_conf_global);\r
\r
if(c) {\r
+\r
+ if (c->flags & KCONF_SPACE_FLAG_DELETED) {\r
+ if (flags & KHM_FLAG_CREATE) {\r
+ c->flags &= ~(KCONF_SPACE_FLAG_DELETED |\r
+ KCONF_SPACE_FLAG_DELETE_M |\r
+ KCONF_SPACE_FLAG_DELETE_U);\r
+ } else {\r
+ *result = NULL;\r
+ return KHM_ERROR_NOT_FOUND;\r
+ }\r
+ }\r
+\r
khcint_space_hold(c);\r
*result = c;\r
return KHM_ERROR_SUCCESS;\r
validated above */\r
}\r
\r
- rv = khcint_open_space_int(p, str, end - str, flags, &c);\r
+ rv = khcint_open_space(p, str, end - str, flags, &c);\r
\r
if(KHM_SUCCEEDED(rv) && (*end == L'\\'\r
#if 0\r
HKEY hku = NULL;\r
kconf_conf_space * c;\r
khm_int32 rv;\r
- LONG hr;\r
+ LONG hr = ERROR_SUCCESS;\r
DWORD type = 0;\r
\r
if(!khc_is_config_running())\r
#endif\r
if (!p)\r
return KHM_ERROR_INVALID_OPERATION;\r
- \r
+\r
cc = TFIRSTCHILD(c);\r
while (cc) {\r
cn = LNEXT(cc);\r
c->flags |= (flags &\r
(KCONF_SPACE_FLAG_DELETE_M |\r
KCONF_SPACE_FLAG_DELETE_U));\r
+\r
+ /* if all the registry spaces have been marked as deleted and\r
+ there is no schema, we should mark the space as deleted as\r
+ well. Note that ideally we only need to check for stores\r
+ which have data corresponding to this configuration space,\r
+ but this is a bit problematic since we don't monitor the\r
+ registry for changes. */\r
+ if ((c->flags &\r
+ (KCONF_SPACE_FLAG_DELETE_M |\r
+ KCONF_SPACE_FLAG_DELETE_U)) ==\r
+ (KCONF_SPACE_FLAG_DELETE_M |\r
+ KCONF_SPACE_FLAG_DELETE_U) &&\r
+ (!c->schema || c->nSchema == 0))\r
+\r
+ c->flags |= KCONF_SPACE_FLAG_DELETED;\r
}\r
\r
if (c->regpath && p->regpath) {\r
space has any children left. If there are none, check if the\r
parent space is also marked for deletion.\r
*/\r
- HKEY hku = NULL;\r
- HKEY hkm = NULL;\r
kconf_conf_space * c;\r
khm_int32 rv = KHM_ERROR_SUCCESS;\r
khm_int32 flags = 0;\r
int state = 0;\r
int end_found = 0;\r
kconf_conf_space * thisconf = NULL;\r
- khm_handle h;\r
+ khm_handle h = NULL;\r
\r
i=begin;\r
while(!end_found) {\r
int state = 0;\r
int end_found = 0;\r
kconf_conf_space * thisconf = NULL;\r
- khm_handle h;\r
+ khm_handle h = NULL;\r
\r
i=begin;\r
while(!end_found) {\r
TDCL(struct kconf_conf_space_t);\r
} kconf_conf_space;\r
\r
-//#define KCONF_SPACE_FLAG_SCHEMA 0x00000020\r
#define KCONF_SPACE_FLAG_DELETE_U 0x00000040\r
#define KCONF_SPACE_FLAG_DELETE_M 0x00000080\r
+#define KCONF_SPACE_FLAG_DELETED 0x00000100\r
\r
typedef struct kconf_conf_handle_t {\r
khm_int32 magic;\r
}\r
\r
if(buf->cb_used > f->offset + cbold) {\r
- int i;\r
+ khm_size i;\r
\r
memmove(\r
((BYTE *) buf->buffer) + (f->offset + cbnew),\r
flags | KCONF_FLAG_NOPARSENAME,\r
&hident);\r
\r
- if(KHM_FAILED(rv))\r
+ if(KHM_FAILED(rv)) {\r
+ EnterCriticalSection(&cs_ident);\r
+ id->flags &= ~KCDB_IDENT_FLAG_CONFIG;\r
+ LeaveCriticalSection(&cs_ident);\r
goto _exit;\r
+ }\r
\r
EnterCriticalSection(&cs_ident);\r
id->flags |= KCDB_IDENT_FLAG_CONFIG;\r
KHMEXP khm_int32 KHMAPI \r
kcdb_identity_hold(khm_handle vid) {\r
kcdb_identity * id;\r
+\r
+ EnterCriticalSection(&cs_ident);\r
if(kcdb_is_active_identity(vid)) {\r
id = vid;\r
- InterlockedIncrement(&(id->refcount));\r
- } else\r
+ id->refcount++;\r
+ } else {\r
+ LeaveCriticalSection(&cs_ident);\r
return KHM_ERROR_INVALID_PARAM;\r
+ }\r
+ LeaveCriticalSection(&cs_ident);\r
return ERROR_SUCCESS;\r
}\r
\r
kcdb_identity_release(khm_handle vid) {\r
kcdb_identity * id;\r
khm_int32 refcount;\r
+\r
+ EnterCriticalSection(&cs_ident);\r
if(kcdb_is_identity(vid)) {\r
id = vid;\r
- refcount = InterlockedDecrement(&(id->refcount));\r
+ refcount = --id->refcount;\r
if(refcount == 0) {\r
- EnterCriticalSection(&cs_ident);\r
/* We only delete identities which do not have a\r
configuration. */\r
if (id->refcount == 0 &&\r
!(id->flags & KCDB_IDENT_FLAG_CONFIG))\r
kcdb_identity_delete(vid);\r
- LeaveCriticalSection(&cs_ident);\r
}\r
- } else\r
+ } else {\r
+ LeaveCriticalSection(&cs_ident);\r
return KHM_ERROR_INVALID_PARAM;\r
+ }\r
+ LeaveCriticalSection(&cs_ident);\r
return ERROR_SUCCESS;\r
}\r
\r
}\r
\r
KHMEXP khm_int32 KHMAPI \r
-kcdb_identity_get_attr_string(\r
- khm_handle vid,\r
+kcdb_identity_get_attr_string(khm_handle vid,\r
khm_int32 attr_id,\r
wchar_t * buffer,\r
khm_size * pcbbuf,\r
kcdb_ident_name_xfer namex;\r
khm_int32 rv = 0;\r
\r
+ /* Generally in kcdb_identpro_* functions we don't emulate\r
+ any behavior if the provider is not available, but lacking\r
+ a way to make this known, we emulate here */\r
+ rv = wcscmp(name1, name2);\r
+\r
EnterCriticalSection(&cs_ident);\r
if(kcdb_ident_sub != NULL) {\r
sub = kcdb_ident_sub;\r
} else {\r
sub = NULL;\r
- /* Generally in kcdb_identpro_* functions we don't emulate\r
- any behavior if the provider is not available, but lacking\r
- a way to make this known, we emulate here */\r
- rv = wcscmp(name1, name2);\r
}\r
LeaveCriticalSection(&cs_ident);\r
\r
ZeroMemory(&namex, sizeof(namex));\r
namex.name_src = name1;\r
namex.name_alt = name2;\r
+ namex.result = rv;\r
\r
kmq_send_sub_msg(sub,\r
KMSG_IDENT,\r
\r
rv = namex.result;\r
}\r
- \r
+\r
return rv;\r
}\r
\r
LeaveCriticalSection(&cs_ident);\r
\r
if(sub != NULL) {\r
- rv = kmq_send_sub_msg(\r
- sub,\r
+ rv = kmq_send_sub_msg(sub,\r
KMSG_IDENT,\r
KMSG_IDENT_SET_DEFAULT,\r
(identity != NULL),\r
}\r
\r
KHMEXP khm_int32 KHMAPI \r
-kcdb_identpro_set_searchable(\r
- khm_handle identity,\r
+kcdb_identpro_set_searchable(khm_handle identity,\r
khm_boolean searchable)\r
{\r
khm_handle sub;\r
return rv;\r
}\r
\r
-KHMEXP khm_int32 KHMAPI kcdb_identpro_get_ui_cb(void * rock)\r
+KHMEXP khm_int32 KHMAPI \r
+kcdb_identpro_get_ui_cb(void * rock)\r
{\r
khm_handle sub;\r
khm_int32 rv = KHM_ERROR_SUCCESS;\r
return rv;\r
}\r
\r
-KHMEXP khm_int32 KHMAPI kcdb_identity_enum(\r
- khm_int32 and_flags,\r
- khm_int32 eq_flags,\r
- wchar_t * name_buf,\r
- khm_size * pcb_buf,\r
- khm_size * pn_idents)\r
+KHMEXP khm_int32 KHMAPI \r
+kcdb_identity_enum(khm_int32 and_flags,\r
+ khm_int32 eq_flags,\r
+ wchar_t * name_buf,\r
+ khm_size * pcb_buf,\r
+ khm_size * pn_idents)\r
{\r
kcdb_identity * id;\r
khm_int32 rv = KHM_ERROR_SUCCESS;\r
\r
/*! \brief Get the configuration space for the identity. \r
\r
+ If the configuration space for the identity does not exist and the\r
+ flags parameter does not specify ::KHM_FLAG_CREATE, then the\r
+ function will return a failure code as specified in\r
+ ::khc_open_space(). Depending on whether or not a configuration\r
+ space was found, the ::KCDB_IDENT_FLAG_CONFIG flag will be set or\r
+ reset for the identity.\r
+\r
\param[in] id Identity for which the configuraiton space is requested\r
\r
\param[in] flags Flags used when calling khc_open_space(). If \a\r
if(!e)\r
e = b + wcslen(b);\r
\r
- if((e - b) == n && !wcsnicmp(b, s, n)) {\r
+ if((e - b) == n && !_wcsnicmp(b, s, n)) {\r
return TRUE;\r
}\r
\r
if(parm_type(e->p1) == KEPT_STRINGT) {\r
assert((void *) parm_data(e->p1));\r
PFREE((void*) parm_data(e->p1));\r
- e->p1 = (kherr_param) 0;\r
+ ZeroMemory(&e->p1, sizeof(e->p1));\r
}\r
if(parm_type(e->p2) == KEPT_STRINGT) {\r
assert((void *) parm_data(e->p2));\r
PFREE((void*) parm_data(e->p2));\r
- e->p2 = (kherr_param) 0;\r
+ ZeroMemory(&e->p2, sizeof(e->p2));\r
}\r
if(parm_type(e->p3) == KEPT_STRINGT) {\r
assert((void *) parm_data(e->p3));\r
PFREE((void*) parm_data(e->p3));\r
- e->p3 = (kherr_param) 0;\r
+ ZeroMemory(&e->p3, sizeof(e->p3));\r
}\r
if(parm_type(e->p4) == KEPT_STRINGT) {\r
assert((void *) parm_data(e->p4));\r
PFREE((void*) parm_data(e->p4));\r
- e->p4 = (kherr_param) 0;\r
+ ZeroMemory(&e->p4, sizeof(e->p4));\r
}\r
}\r
\r
static void arg_from_param(DWORD_PTR ** parm, kherr_param p) {\r
int t;\r
\r
- if (p != 0) {\r
+ if (p.type != KEPT_NONE) {\r
t = parm_type(p);\r
if (t == KEPT_INT32 ||\r
t == KEPT_UINT32 ||\r
khm_int32 or_flag) {\r
wchar_t tfmt[KHERR_MAXCCH_STRING];\r
wchar_t tbuf[KHERR_MAXCCH_STRING];\r
- size_t chars;\r
- size_t bytes;\r
+ size_t chars = 0;\r
+ size_t bytes = 0;\r
\r
if(e->flags & if_flag) {\r
if(e->h_module != NULL)\r
khm_int32 if_flag,\r
khm_int32 or_flag) {\r
wchar_t tbuf[KHERR_MAXCCH_STRING];\r
- size_t chars;\r
- size_t bytes;\r
+ size_t chars = 0;\r
+ size_t bytes = 0;\r
DWORD_PTR args[8];\r
\r
if(e->flags & if_flag) {\r
\r
e = kherr_report(KHERR_DEBUG_1,\r
NULL, NULL, NULL, buf, NULL, 0,\r
- KHERR_SUGGEST_NONE, 0, 0, 0, 0, KHERR_RF_CSTR_LONG_DESC\r
+ KHERR_SUGGEST_NONE, _vnull(), _vnull(), _vnull(), _vnull(),\r
+ KHERR_RF_CSTR_LONG_DESC\r
#ifdef _WIN32\r
,NULL\r
#endif\r
va_end(vl);\r
\r
e = kherr_report(severity, NULL, facility, NULL, buf, NULL, facility_id,\r
- KHERR_SUGGEST_NONE, 0, 0, 0, 0, KHERR_RF_CSTR_LONG_DESC\r
+ KHERR_SUGGEST_NONE,\r
+ _vnull(),\r
+ _vnull(),\r
+ _vnull(),\r
+ _vnull(), KHERR_RF_CSTR_LONG_DESC\r
#ifdef _WIN32\r
,hModule\r
#endif\r
kherr_param dup_parm(kherr_param p) {\r
if(parm_type(p) == KEPT_STRINGT) {\r
wchar_t * d = PWCSDUP((wchar_t *)parm_data(p));\r
- return kherr_val(KEPT_STRINGT, d);\r
+ return kherr_val(KEPT_STRINGT, (khm_ui_8) d);\r
} else\r
return p;\r
}\r
size_t cb_s;\r
\r
if (s == NULL)\r
- return (kherr_param) 0;\r
+ return _vnull();\r
\r
if (FAILED(StringCbLength(s, KHERR_MAXCB_STRING, &cb_s)))\r
cb_s = KHERR_MAXCB_STRING;\r
\r
return _tstr(dest);\r
}\r
+\r
+\r
+#if 0\r
+KHMEXP kherr_param kherr_val(khm_octet ptype, khm_ui_8 pvalue) {\r
+ kherr_param p;\r
+ p.type = ptype;\r
+ p.data = pvalue;\r
+\r
+ return p;\r
+}\r
+#endif\r
/*! \brief Parameter types\r
*/\r
enum kherr_parm_types {\r
- KEPT_INT32 = 1,\r
- KEPT_UINT32,\r
- KEPT_INT64,\r
- KEPT_UINT64,\r
- KEPT_STRINGC, /*!< String constant */\r
- KEPT_STRINGT, /*!< String. Will be freed using\r
- free() when the event is freed */\r
- KEPT_PTR /*!< Pointer type. */\r
+ KEPT_NONE = 0,\r
+ KEPT_INT32 = 1,\r
+ KEPT_UINT32,\r
+ KEPT_INT64,\r
+ KEPT_UINT64,\r
+ KEPT_STRINGC, /*!< String constant */\r
+ KEPT_STRINGT, /*!< String. Will be freed using\r
+ free() when the event is freed */\r
+ KEPT_PTR /*!< Pointer type. */\r
};\r
\r
-#ifdef _WIN32\r
-typedef khm_ui_8 kherr_param;\r
-#else\r
-#error kherr_param undefined\r
-#endif\r
+\r
+typedef struct tag_kherr_param {\r
+ khm_octet type;\r
+ khm_ui_8 data;\r
+} kherr_param;\r
\r
/*! \brief Severity levels\r
\r
*/\r
KHMEXP kherr_param kherr_dup_string(const wchar_t * s);\r
\r
-/* convenience macros for specifying parameters for kherr_report */\r
-#define kherr_val(type,val) \\r
- ((((kherr_param)(type)) << ((sizeof(kherr_param)-1)*8)) | (kherr_param) (val))\r
-\r
-#define _int32(i) kherr_val(KEPT_INT32, i)\r
-#define _uint32(ui) kherr_val(KEPT_UINT32, ui)\r
-#define _int64(i) kherr_val(KEPT_INT64, i)\r
-#define _uint64(ui) kherr_val(KEPT_UINT64, ui)\r
-#define _cstr(cs) kherr_val(KEPT_STRINGC, cs)\r
-#define _tstr(ts) kherr_val(KEPT_STRINGT, ts)\r
-#define _cptr(p) kherr_val(KEPT_PTR, p)\r
+__inline KHMEXP kherr_param\r
+kherr_val(khm_octet ptype, khm_ui_8 pvalue) {\r
+ kherr_param p;\r
+\r
+ p.type = ptype;\r
+ p.data = pvalue;\r
+\r
+ return p;\r
+}\r
+\r
+#define _int32(i) kherr_val(KEPT_INT32, (khm_ui_8) i)\r
+#define _uint32(ui) kherr_val(KEPT_UINT32, (khm_ui_8) ui)\r
+#define _int64(i) kherr_val(KEPT_INT64, (khm_ui_8) i)\r
+#define _uint64(ui) kherr_val(KEPT_UINT64, (khm_ui_8) ui)\r
+#define _cstr(cs) kherr_val(KEPT_STRINGC, (khm_ui_8) cs)\r
+#define _tstr(ts) kherr_val(KEPT_STRINGT, (khm_ui_8) ts)\r
+#define _cptr(p) kherr_val(KEPT_PTR, (khm_ui_8) p)\r
+#define _vnull() kherr_val(KEPT_NONE, 0)\r
#define _dupstr(s) kherr_dup_string(s)\r
\r
/* convenience macros for calling kherr_report */\r
#ifdef KHERR_HMODULE\r
\r
#define _report_cs0(severity, long_description) \\r
- kherr_report((severity), NULL, KHERR_FACILITY, NULL, (long_description), NULL, KHERR_FACILITY_ID, 0, 0, 0, 0, 0, 0, KHERR_HMODULE)\r
+ kherr_report((severity), NULL, KHERR_FACILITY, NULL, (long_description), NULL, KHERR_FACILITY_ID, 0, _vnull(), _vnull(), _vnull(), _vnull(), 0, KHERR_HMODULE)\r
\r
#define _report_cs1(severity, long_description, p1) \\r
- kherr_report((severity), NULL, KHERR_FACILITY, NULL, (long_description), NULL, KHERR_FACILITY_ID, 0, p1, 0, 0, 0, 0, KHERR_HMODULE)\r
+ kherr_report((severity), NULL, KHERR_FACILITY, NULL, (long_description), NULL, KHERR_FACILITY_ID, 0, p1, _vnull(), _vnull(), _vnull(), 0, KHERR_HMODULE)\r
\r
#define _report_cs2(severity, long_description, p1, p2) \\r
- kherr_report((severity), NULL, KHERR_FACILITY, NULL, (long_description), NULL, KHERR_FACILITY_ID, 0, p1, p2, 0, 0, 0, KHERR_HMODULE)\r
+ kherr_report((severity), NULL, KHERR_FACILITY, NULL, (long_description), NULL, KHERR_FACILITY_ID, 0, p1, p2, _vnull(), _vnull(), 0, KHERR_HMODULE)\r
\r
#define _report_cs3(severity, long_description, p1, p2, p3) \\r
- kherr_report((severity), NULL, KHERR_FACILITY, NULL, (long_description), NULL, KHERR_FACILITY_ID, 0, p1, p2, p3, 0, 0, KHERR_HMODULE)\r
+ kherr_report((severity), NULL, KHERR_FACILITY, NULL, (long_description), NULL, KHERR_FACILITY_ID, 0, p1, p2, p3, _vnull(), 0, KHERR_HMODULE)\r
\r
#define _report_cs4(severity, long_description, p1, p2, p3, p4) \\r
kherr_report((severity), NULL, KHERR_FACILITY, NULL, (long_description), NULL, KHERR_FACILITY_ID, 0, p1, p2, p3, p4, 0, KHERR_HMODULE)\r
#else\r
\r
#define _report_cs0(severity, long_description) \\r
- kherr_report((severity), NULL, KHERR_FACILITY, NULL, (long_description), NULL, KHERR_FACILITY_ID, 0, 0, 0, 0, 0, 0, NULL)\r
+ kherr_report((severity), NULL, KHERR_FACILITY, NULL, (long_description), NULL, KHERR_FACILITY_ID, 0, _vnull(), _vnull(), _vnull(), _vnull(), 0, NULL)\r
\r
#define _report_cs1(severity, long_description, p1) \\r
- kherr_report((severity), NULL, KHERR_FACILITY, NULL, (long_description), NULL, KHERR_FACILITY_ID, 0, p1, 0, 0, 0, 0, NULL)\r
+ kherr_report((severity), NULL, KHERR_FACILITY, NULL, (long_description), NULL, KHERR_FACILITY_ID, 0, p1, _vnull(), _vnull(), _vnull(), 0, NULL)\r
\r
#define _report_cs2(severity, long_description, p1, p2) \\r
- kherr_report((severity), NULL, KHERR_FACILITY, NULL, (long_description), NULL, KHERR_FACILITY_ID, 0, p1, p2, 0, 0, 0, NULL)\r
+ kherr_report((severity), NULL, KHERR_FACILITY, NULL, (long_description), NULL, KHERR_FACILITY_ID, 0, p1, p2, _vnull(), _vnull(), 0, NULL)\r
\r
#define _report_cs3(severity, long_description, p1, p2, p3) \\r
- kherr_report((severity), NULL, KHERR_FACILITY, NULL, (long_description), NULL, KHERR_FACILITY_ID, 0, p1, p2, p3, 0, 0, NULL)\r
+ kherr_report((severity), NULL, KHERR_FACILITY, NULL, (long_description), NULL, KHERR_FACILITY_ID, 0, p1, p2, p3, _vnull(), 0, NULL)\r
\r
#define _report_cs4(severity, long_description, p1, p2, p3, p4) \\r
kherr_report((severity), NULL, KHERR_FACILITY, NULL, (long_description), NULL, KHERR_FACILITY_ID, 0, p1, p2, p3, p4, 0, NULL)\r
\r
#ifdef _WIN32\r
#define _report_sr0(severity, long_desc_id) \\r
- kherr_report((severity), NULL, KHERR_FACILITY, NULL, MAKEINTRESOURCE(long_desc_id), NULL, KHERR_FACILITY_ID, 0, 0, 0, 0, 0, KHERR_RF_RES_LONG_DESC, KHERR_HMODULE)\r
+ kherr_report((severity), NULL, KHERR_FACILITY, NULL, MAKEINTRESOURCE(long_desc_id), NULL, KHERR_FACILITY_ID, 0, _vnull(), _vnull(), _vnull(), _vnull(), KHERR_RF_RES_LONG_DESC, KHERR_HMODULE)\r
\r
#define _report_sr1(severity, long_desc_id, p1) \\r
- kherr_report((severity), NULL, KHERR_FACILITY, NULL, MAKEINTRESOURCE(long_desc_id), NULL, KHERR_FACILITY_ID, 0, p1, 0, 0, 0, KHERR_RF_RES_LONG_DESC, KHERR_HMODULE)\r
+ kherr_report((severity), NULL, KHERR_FACILITY, NULL, MAKEINTRESOURCE(long_desc_id), NULL, KHERR_FACILITY_ID, 0, p1, _vnull(), _vnull(), _vnull(), KHERR_RF_RES_LONG_DESC, KHERR_HMODULE)\r
\r
#define _report_sr2(severity, long_desc_id, p1, p2) \\r
- kherr_report((severity), NULL, KHERR_FACILITY, NULL, MAKEINTRESOURCE(long_desc_id), NULL, KHERR_FACILITY_ID, 0, p1, p2, 0, 0, KHERR_RF_RES_LONG_DESC, KHERR_HMODULE)\r
+ kherr_report((severity), NULL, KHERR_FACILITY, NULL, MAKEINTRESOURCE(long_desc_id), NULL, KHERR_FACILITY_ID, 0, p1, p2, _vnull(), _vnull(), KHERR_RF_RES_LONG_DESC, KHERR_HMODULE)\r
\r
#define _report_sr3(severity, long_desc_id, p1, p2, p3) \\r
- kherr_report((severity), NULL, KHERR_FACILITY, NULL, MAKEINTRESOURCE(long_desc_id), NULL, KHERR_FACILITY_ID, 0, p1, p2, p3, 0, KHERR_RF_RES_LONG_DESC, KHERR_HMODULE)\r
+ kherr_report((severity), NULL, KHERR_FACILITY, NULL, MAKEINTRESOURCE(long_desc_id), NULL, KHERR_FACILITY_ID, 0, p1, p2, p3, _vnull(), KHERR_RF_RES_LONG_DESC, KHERR_HMODULE)\r
\r
#define _report_sr4(severity, long_desc_id, p1, p2, p3, p4) \\r
kherr_report((severity), NULL, KHERR_FACILITY, NULL, MAKEINTRESOURCE(long_desc_id), NULL, KHERR_FACILITY_ID, 0, p1, p2, p3, p4, KHERR_RF_RES_LONG_DESC, KHERR_HMODULE)\r
\r
#ifdef _WIN32\r
#define _report_mr0(severity, long_desc_msg_id) \\r
- kherr_report((severity), NULL, KHERR_FACILITY, NULL, (wchar_t *)(long_desc_msg_id), NULL, KHERR_FACILITY_ID, 0, 0, 0, 0, 0, KHERR_RF_MSG_LONG_DESC, KHERR_HMODULE)\r
+ kherr_report((severity), NULL, KHERR_FACILITY, NULL, (wchar_t *)(long_desc_msg_id), NULL, KHERR_FACILITY_ID, 0, _vnull(), _vnull(), _vnull(), _vnull(), KHERR_RF_MSG_LONG_DESC, KHERR_HMODULE)\r
\r
#define _report_mr1(severity, long_desc_msg_id, p1) \\r
- kherr_report((severity), NULL, KHERR_FACILITY, NULL, (wchar_t *)(long_desc_msg_id), NULL, KHERR_FACILITY_ID, 0, p1, 0, 0, 0, KHERR_RF_MSG_LONG_DESC, KHERR_HMODULE)\r
+ kherr_report((severity), NULL, KHERR_FACILITY, NULL, (wchar_t *)(long_desc_msg_id), NULL, KHERR_FACILITY_ID, 0, p1, _vnull(), _vnull(), _vnull(), KHERR_RF_MSG_LONG_DESC, KHERR_HMODULE)\r
\r
#define _report_mr2(severity, long_desc_msg_id, p1, p2) \\r
- kherr_report((severity), NULL, KHERR_FACILITY, NULL, (wchar_t *)(long_desc_msg_id), NULL, KHERR_FACILITY_ID, 0, p1, p2, 0, 0, KHERR_RF_MSG_LONG_DESC, KHERR_HMODULE)\r
+ kherr_report((severity), NULL, KHERR_FACILITY, NULL, (wchar_t *)(long_desc_msg_id), NULL, KHERR_FACILITY_ID, 0, p1, p2, _vnull(), _vnull(), KHERR_RF_MSG_LONG_DESC, KHERR_HMODULE)\r
\r
#define _report_mr3(severity, long_desc_msg_id, p1, p2, p3) \\r
- kherr_report((severity), NULL, KHERR_FACILITY, NULL, (wchar_t *)(long_desc_msg_id), NULL, KHERR_FACILITY_ID, 0, p1, p2, p3, 0, KHERR_RF_MSG_LONG_DESC, KHERR_HMODULE)\r
+ kherr_report((severity), NULL, KHERR_FACILITY, NULL, (wchar_t *)(long_desc_msg_id), NULL, KHERR_FACILITY_ID, 0, p1, p2, p3, _vnull(), KHERR_RF_MSG_LONG_DESC, KHERR_HMODULE)\r
\r
#define _report_mr4(severity, long_desc_msg_id, p1, p2, p3, p4) \\r
kherr_report((severity), NULL, KHERR_FACILITY, NULL, (wchar_t *)(long_desc_msg_id), NULL, KHERR_FACILITY_ID, 0, p1, p2, p3, p4, KHERR_RF_MSG_LONG_DESC, KHERR_HMODULE)\r
#endif\r
\r
#define _report_ts0(severity, long_desc_ptr) \\r
- kherr_report((severity), NULL, KHERR_FACILITY, NULL, (long_desc_ptr), NULL, KHERR_FACILITY_ID, 0, 0, 0, 0, 0, KHERR_RF_FREE_LONG_DESC, NULL)\r
+ kherr_report((severity), NULL, KHERR_FACILITY, NULL, (long_desc_ptr), NULL, KHERR_FACILITY_ID, 0, _vnull(), _vnull(), _vnull(), _vnull(), KHERR_RF_FREE_LONG_DESC, NULL)\r
\r
#define _report_ts1(severity, long_desc_ptr, p1) \\r
- kherr_report((severity), NULL, KHERR_FACILITY, NULL, (long_desc_ptr), NULL, KHERR_FACILITY_ID, 0, p1, 0, 0, 0, KHERR_RF_FREE_LONG_DESC, NULL)\r
+ kherr_report((severity), NULL, KHERR_FACILITY, NULL, (long_desc_ptr), NULL, KHERR_FACILITY_ID, 0, p1, _vnull(), _vnull(), _vnull(), KHERR_RF_FREE_LONG_DESC, NULL)\r
\r
#define _report_ts2(severity, long_desc_ptr, p1, p2) \\r
- kherr_report((severity), NULL, KHERR_FACILITY, NULL, (long_desc_ptr), NULL, KHERR_FACILITY_ID, 0, p1, p2, 0, 0, KHERR_RF_FREE_LONG_DESC, NULL)\r
+ kherr_report((severity), NULL, KHERR_FACILITY, NULL, (long_desc_ptr), NULL, KHERR_FACILITY_ID, 0, p1, p2, _vnull(), _vnull(), KHERR_RF_FREE_LONG_DESC, NULL)\r
\r
#define _report_ts3(severity, long_desc_ptr, p1, p2, p3) \\r
- kherr_report((severity), NULL, KHERR_FACILITY, NULL, (long_desc_ptr), NULL, KHERR_FACILITY_ID, 0, p1, p2, p3, 0, KHERR_RF_FREE_LONG_DESC, NULL)\r
+ kherr_report((severity), NULL, KHERR_FACILITY, NULL, (long_desc_ptr), NULL, KHERR_FACILITY_ID, 0, p1, p2, p3, _vnull(), KHERR_RF_FREE_LONG_DESC, NULL)\r
\r
#define _report_ts4(severity, long_desc_ptr, p1, p2, p3, p4) \\r
kherr_report((severity), NULL, KHERR_FACILITY, NULL, (long_desc_ptr), NULL, KHERR_FACILITY_ID, 0, p1, p2, p3, p4, KHERR_RF_FREE_LONG_DESC, NULL)\r
extern kherr_handler_node * ctx_handlers;\r
extern khm_size n_ctx_handlers;\r
\r
-#define parm_type(p) ((int) (((p)>>((sizeof(kherr_param) - 1) * 8)) & 0xff))\r
-#define parm_data(p) ((p) & ~(((kherr_param)0xff)<<((sizeof(kherr_param) - 1) * 8)))\r
+#define parm_type(p) ((p).type)\r
+#define parm_data(p) ((p).data)\r
\r
void resolve_event_strings(kherr_event *);\r
void attach_this_thread(void);\r
KHERR_FACILITY_ID,\r
KHERR_SUGGEST_NONE,\r
_cstr(m->name),\r
- ((warn_e)? _cstr(warn_e->long_desc):0),\r
- 0,0,\r
+ ((warn_e)? _cstr(warn_e->long_desc):_vnull()),\r
+ _vnull(),_vnull(),\r
KHERR_RF_MSG_SHORT_DESC |\r
((warn_e)? KHERR_RF_MSG_SUGGEST: 0),\r
KHERR_HMODULE);\r
typedef khm_int32 (KHMAPI *init_module_t)(kmm_module);\r
\r
#if defined(_WIN64)\r
-#define EXP_INIT_MODULE "_init_module@8"\r
+#define EXP_INIT_MODULE "init_module"\r
#elif defined(_WIN32)\r
#define EXP_INIT_MODULE "_init_module@4"\r
#else\r
typedef khm_int32 (KHMAPI *exit_module_t)(kmm_module);\r
\r
#if defined(_WIN64)\r
-#define EXP_EXIT_MODULE "_exit_module@8"\r
+#define EXP_EXIT_MODULE "exit_module"\r
#elif defined(_WIN32)\r
#define EXP_EXIT_MODULE "_exit_module@4"\r
#else\r
khc_load_schema(NULL, schema_kmqconfig);\r
khc_open_space(NULL, KMQ_CONF_SPACE_NAME, KHM_PERM_READ, &hconfig);\r
if(hconfig) {\r
- khc_read_int32(hconfig, KMQ_CONF_QUEUE_DEAD_TIMEOUT_NAME, &kmq_queue_dead_timeout);\r
- khc_read_int32(hconfig, KMQ_CONF_CALL_DEAD_TIMEOUT_NAME, &kmq_call_dead_timeout);\r
+ khm_int32 t = 0;\r
+\r
+ khc_read_int32(hconfig, KMQ_CONF_QUEUE_DEAD_TIMEOUT_NAME, &t);\r
+ kmq_queue_dead_timeout = t;\r
+\r
+ khc_read_int32(hconfig, KMQ_CONF_CALL_DEAD_TIMEOUT_NAME, &t);\r
+ kmq_call_dead_timeout = t;\r
+\r
khc_close_space(hconfig);\r
}\r
kmqint_init_msg_types();\r
\note Obtains ::cs_kmq_types\r
*/\r
kmq_msg_subscription * kmqint_msg_type_del_sub_hwnd(khm_int32 t, HWND hwnd) {\r
- kmq_msg_subscription *s;\r
+ kmq_msg_subscription *s = NULL;\r
\r
if(t < 0 || t > KMQ_MSG_TYPE_MAX)\r
return NULL;\r
\r
#define CKRV if(!imp_rv) goto _err_ret\r
\r
+#ifndef _WIN64\r
imp_rv = LoadFuncs(KRB4_DLL, k4_fi, &hKrb4, 0, 1, 0, 0);\r
CKRV;\r
+#endif\r
\r
imp_rv = LoadFuncs(KRB5_DLL, k5_fi, &hKrb5, 0, 1, 0, 0);\r
CKRV;\r
\r
LPCSTR functionName;\r
int freeContextFlag;\r
- krb5_error_code rc;\r
+ krb5_error_code rc = 0;\r
krb5_flags flags = 0;\r
\r
if (pkrb5_init_context == NULL)\r
\r
ctx = *pctx;\r
\r
+ if (!pcc_initialize ||\r
+ !pcc_get_NC_info ||\r
+ !pcc_free_NC_info ||\r
+ !pcc_shutdown)\r
+ goto _skip_cc_iter;\r
+\r
code = pcc_initialize(&cc_ctx, CC_API_VER_2, NULL, NULL);\r
if (code)\r
goto _exit;\r
cache = 0;\r
}\r
\r
+ _skip_cc_iter:\r
+\r
if (KHM_SUCCEEDED(kmm_get_plugins_config(0, &csp_plugins))) {\r
khc_open_space(csp_plugins, L"Krb5Cred\\Parameters", 0, &csp_params);\r
khc_close_space(csp_plugins);\r
\r
HWND GetRootParent (HWND Child)\r
{\r
- HWND Last;\r
+ HWND Last = NULL;\r
while (Child)\r
{\r
Last = Child;\r
switch(msg_subtype) {\r
case KMSG_SYSTEM_INIT:\r
{\r
+#ifdef _WIN64\r
+ return KHM_ERROR_NOT_IMPLEMENTED;\r
+#else\r
kcdb_credtype ct;\r
wchar_t buf[KCDB_MAXCCH_SHORT_DESC];\r
size_t cbsize;\r
&attr_id_krb5_flags))) {\r
rv = KHM_ERROR_UNKNOWN;\r
}\r
+#endif\r
}\r
break;\r
\r
case KMSG_SYSTEM_EXIT:\r
+#ifdef _WIN64\r
+ return 0;\r
+#else\r
if(credtype_id_krb4 >= 0)\r
{\r
/* basically just unregister the credential type */\r
kcdb_credset_delete(krb4_credset);\r
}\r
break;\r
+#endif\r
}\r
\r
return rv;\r
if (d->realms[r].kdcs[k].master)
pprofile_add_relation(profile, sec_master,
host);
- else
- pprofile_add_relation(profile, sec_kdcs,
- host);
+
+ pprofile_add_relation(profile, sec_kdcs,
+ host);
if (d->realms[r].kdcs[k].admin)
pprofile_add_relation(profile, sec_admin,
if (d->realms[r].kdcs[k].master)
pprofile_add_relation(profile, sec_master,
host);
- else
- pprofile_add_relation(profile, sec_kdcs,
- host);
+
+ pprofile_add_relation(profile, sec_kdcs,
+ host);
if (d->realms[r].kdcs[k].admin)
pprofile_add_relation(profile, sec_admin,
if (d->realms[r].kdcs[k].flags & K5_RKFLAG_MOD_MASTER) {
if (!d->realms[r].kdcs[k].master) {
- pprofile_update_relation(profile, sec_kdcs,
- host, NULL);
- pprofile_add_relation(profile, sec_kdcs,
- host);
pprofile_update_relation(profile, sec_master,
host, NULL);
} else {
host, NULL);
pprofile_add_relation(profile, sec_master,
host);
- pprofile_update_relation(profile, sec_kdcs,
- host, NULL);
}
d->realms[r].kdcs[k].flags &= ~K5_RKFLAG_MOD_MASTER;
return code;\r
}\r
\r
-long \r
+long\r
khm_krb5_list_tickets(krb5_context *krbv5Context)\r
{\r
- krb5_context ctx;\r
+ krb5_context ctx = NULL;\r
krb5_ccache cache = 0;\r
- krb5_error_code code;\r
+ krb5_error_code code = 0;\r
apiCB * cc_ctx = 0;\r
struct _infoNC ** pNCi = NULL;\r
int i;\r
wchar_t * ms = NULL;\r
khm_size cb;\r
\r
- ctx = NULL;\r
- cache = NULL;\r
-\r
kcdb_credset_flush(krb5_credset);\r
\r
+ if((*krbv5Context == 0) && (code = (*pkrb5_init_context)(krbv5Context))) {\r
+ goto _exit;\r
+ }\r
+\r
+ ctx = (*krbv5Context);\r
+\r
+ if (!pcc_initialize ||\r
+ !pcc_get_NC_info ||\r
+ !pcc_free_NC_info ||\r
+ !pcc_shutdown)\r
+ goto _skip_cc_iter;\r
+\r
code = pcc_initialize(&cc_ctx, CC_API_VER_2, NULL, NULL);\r
if (code)\r
goto _exit;\r
if (code) \r
goto _exit;\r
\r
- if((*krbv5Context == 0) && (code = (*pkrb5_init_context)(krbv5Context))) {\r
- goto _exit;\r
- }\r
-\r
- ctx = (*krbv5Context);\r
-\r
for(i=0; pNCi[i]; i++) {\r
char ccname[KRB5_MAXCCH_CCNAME];\r
\r
cache = 0;\r
}\r
\r
+ _skip_cc_iter:\r
+\r
if (KHM_SUCCEEDED(khc_read_int32(csp_params, L"MsLsaList", &t)) && t) {\r
code = (*pkrb5_cc_resolve)(ctx, "MSLSA:", &cache);\r
\r
krb5_creds my_creds;\r
krb5_data *realm = 0;\r
\r
+ memset(&my_creds, 0, sizeof(krb5_creds));\r
+\r
if ( !pkrb5_init_context )\r
goto cleanup;\r
\r
- memset(&my_creds, 0, sizeof(krb5_creds));\r
-\r
code = khm_krb5_initialize(identity, &ctx, &cc);\r
if (code) \r
goto cleanup;\r
return(FALSE);\r
#else /* NO_KRB5 */\r
krb5_context kcontext = 0;\r
- krb5_error_code code;\r
+ krb5_error_code code = 0;\r
krb5_ccache ccache=0;\r
krb5_ccache mslsa_ccache=0;\r
krb5_creds creds;\r
return KHM_ERROR_SUCCESS;\r
}\r
\r
+/* forward dcl */\r
+khm_int32 KHMAPI\r
+k5_ident_name_comp_func(const void * dl, khm_size cb_dl,\r
+ const void * dr, khm_size cb_dr);\r
+\r
+static khm_int32\r
+k5_ident_compare_name(khm_int32 msg_type,\r
+ khm_int32 msg_subtype,\r
+ khm_ui_4 uparam,\r
+ void * vparam) {\r
+ kcdb_ident_name_xfer *px;\r
+\r
+ px = (kcdb_ident_name_xfer *) vparam;\r
+\r
+ /* note that k5_ident_name_comp_func() ignores the size\r
+ specifiers. So we can just pass in 0's. */\r
+ px->result = k5_ident_name_comp_func(px->name_src, 0,\r
+ px->name_alt, 0);\r
+\r
+ return KHM_ERROR_SUCCESS;\r
+}\r
+\r
#if 0\r
/* copy and paste template for ident provider messages */\r
static khm_int32\r
break;\r
\r
case KMSG_IDENT_COMPARE_NAME:\r
- /* TODO: handle KMSG_IDENT_COMPARE_NAME */\r
- break;\r
+ return k5_ident_compare_name(msg_type,\r
+ msg_subtype,\r
+ uparam,\r
+ vparam);\r
\r
case KMSG_IDENT_SET_DEFAULT:\r
return k5_ident_set_default(msg_type,\r
return KHM_ERROR_SUCCESS;\r
}\r
\r
+/* note that we are ignoring the size specifiers. We can do that\r
+ because we are guaranteed that dl and dr point to NULL terminated\r
+ unicode strings when used with credential data buffers. We also\r
+ use the fact that we are ignoring the size specifiers when we call\r
+ this function from k5_ident_compare_name() to avoid calculating the\r
+ length of the string. */\r
khm_int32 KHMAPI\r
k5_ident_name_comp_func(const void * dl, khm_size cb_dl,\r
const void * dr, khm_size cb_dr) {\r
{\r
khm_int32 i;\r
\r
- khc_read_int32(conf, L"Renewable", &d->renewable);\r
- khc_read_int32(conf, L"Forwardable", &d->forwardable);\r
- khc_read_int32(conf, L"Proxiable", &d->proxiable);\r
- khc_read_int32(conf, L"Addressless", &d->addressless);\r
- khc_read_int32(conf, L"PublicIP", &d->publicIP);\r
+ khc_read_int32(conf, L"Renewable", &i);\r
+ d->renewable = i;\r
+ khc_read_int32(conf, L"Forwardable", &i);\r
+ d->forwardable = i;\r
+ khc_read_int32(conf, L"Proxiable", &i);\r
+ d->proxiable = i;\r
+ khc_read_int32(conf, L"Addressless", &i);\r
+ d->addressless = i;\r
+ khc_read_int32(conf, L"PublicIP", &i);\r
+ d->publicIP = i;\r
\r
khc_read_int32(conf, L"DefaultLifetime", &i);\r
d->tc_lifetime.current = i;\r
khui_new_creds_by_type * nct;\r
k5_dlg_data * d;\r
\r
- khm_int32 r;\r
+ khm_int32 r = 0;\r
\r
nc = (khui_new_creds *) vparam;\r
\r
\r
/* $Id$ */\r
\r
+#include<shlwapi.h>\r
#include<khmapp.h>\r
#include<assert.h>\r
\r
d = (dlg_data *) (DWORD_PTR) GetWindowLongPtr(hwnd, DWLP_USER);\r
\r
if (HIWORD(wParam) == BN_CLICKED) {\r
- refresh_data(hwnd, d);\r
- check_for_modification(d);\r
+ if (LOWORD(wParam) == IDC_CFG_SHOWLOG) {\r
+ /* we need to display the logfile */\r
+ wchar_t buf[512];\r
+\r
+ buf[0] = L'\0';\r
+ khm_get_file_log_path(sizeof(buf), buf);\r
+\r
+ if (!buf[0] ||\r
+ !PathFileExists(buf)) {\r
+\r
+ wchar_t title[256];\r
+ wchar_t msg[550];\r
+ wchar_t fmt[256];\r
+\r
+ LoadString(khm_hInstance, IDS_CFG_LOGF_CS,\r
+ title, ARRAYLENGTH(title));\r
+ LoadString(khm_hInstance, IDS_CFG_LOGF_CSR,\r
+ fmt, ARRAYLENGTH(fmt));\r
+\r
+ StringCbPrintf(msg, sizeof(msg), fmt, buf);\r
+\r
+ MessageBox(hwnd, title, msg, MB_OK);\r
+ \r
+ } else {\r
+ wchar_t cmdline[550];\r
+ STARTUPINFO si;\r
+ PROCESS_INFORMATION pi;\r
+\r
+ StringCbCopy(cmdline, sizeof(cmdline), L"notepad.exe ");\r
+ StringCbCat(cmdline, sizeof(cmdline), L"\"");\r
+ StringCbCat(cmdline, sizeof(cmdline), buf);\r
+ StringCbCat(cmdline, sizeof(cmdline), L"\"");\r
+\r
+ ZeroMemory(&si, sizeof(si));\r
+ si.cb = sizeof(si);\r
+ ZeroMemory(&pi, sizeof(pi));\r
+\r
+ CreateProcess(NULL,\r
+ cmdline,\r
+ NULL, NULL,\r
+ FALSE,\r
+ 0, NULL, NULL,\r
+ &si,\r
+ &pi);\r
+\r
+ if (pi.hProcess)\r
+ CloseHandle(pi.hProcess);\r
+ if (pi.hThread)\r
+ CloseHandle(pi.hThread);\r
+\r
+ }\r
+ } else {\r
+ refresh_data(hwnd, d);\r
+ check_for_modification(d);\r
+ }\r
}\r
\r
khm_set_dialog_result(hwnd, 0);\r
}\r
\r
if (d->removed) {\r
+ khm_handle h = NULL;\r
\r
khc_remove_space(csp_ident);\r
\r
+ /* calling kcdb_identity_get_config() will update the\r
+ KCDB_IDENT_FLAG_CONFIG flag for the identity to reflect the\r
+ fact that it nolonger has a configuration. */\r
+ kcdb_identity_get_config(d->ident, 0, &h);\r
+ if (h) {\r
+ /* what the ? */\r
+#ifdef DEBUG\r
+ assert(FALSE);\r
+#endif\r
+ khc_close_space(h);\r
+ }\r
+\r
} else {\r
\r
if (d->saved.monitor != d->work.monitor)\r
KHUI_CNFLAG_APPLIED | KHUI_CNFLAG_MODIFIED);\r
}\r
\r
+/* dialog box procedure for the "Add new identity" dialog */\r
+INT_PTR CALLBACK\r
+khm_cfg_add_ident_proc(HWND hwnd,\r
+ UINT umsg,\r
+ WPARAM wParam,\r
+ LPARAM lparam) {\r
+ switch(umsg) {\r
+ case WM_INITDIALOG:\r
+ /* set the max length of the edit control first */\r
+ SendDlgItemMessage(hwnd, IDC_CFG_IDNAME,\r
+ EM_SETLIMITTEXT,\r
+ KCDB_IDENT_MAXCCH_NAME - 1,\r
+ 0);\r
+ break;\r
+\r
+ case WM_DESTROY:\r
+ /* nor do we have to do anything here */\r
+ break;\r
+\r
+ case WM_COMMAND:\r
+ if (LOWORD(wParam) == IDOK) {\r
+ wchar_t idname[KCDB_IDENT_MAXCCH_NAME];\r
+ khm_int32 rv = KHM_ERROR_SUCCESS;\r
+ khm_handle ident = NULL;\r
+ khm_handle csp_ident = NULL;\r
+ khm_size i;\r
+ wchar_t err_msg[512] = L"";\r
+\r
+ GetDlgItemText(hwnd, IDC_CFG_IDNAME, idname,\r
+ ARRAYLENGTH(idname));\r
+\r
+ idname[ARRAYLENGTH(idname) - 1] = L'\0';\r
+ if (KHM_FAILED(rv = kcdb_identpro_validate_name(idname)) &&\r
+ rv != KHM_ERROR_NO_PROVIDER &&\r
+ rv != KHM_ERROR_NOT_IMPLEMENTED) {\r
+ /* the supplied name was invalid or something */\r
+\r
+ wchar_t fmt[256];\r
+\r
+ LoadString(khm_hInstance, IDS_CFG_IDNAME_INV,\r
+ fmt, ARRAYLENGTH(fmt));\r
+ StringCbPrintf(err_msg, sizeof(err_msg), fmt, idname);\r
+\r
+ goto show_failure;\r
+ }\r
+\r
+ /* now check if this is actually a new identity */\r
+ for (i=0; i < cfg_idents.n_idents; i++) {\r
+ if (!kcdb_identpro_compare_name(cfg_idents.idents[i].idname,\r
+ idname))\r
+ break;\r
+ }\r
+\r
+ if (i < cfg_idents.n_idents) {\r
+ wchar_t fmt[256];\r
+\r
+ LoadString(khm_hInstance, IDS_CFG_IDNAME_EXT,\r
+ fmt, ARRAYLENGTH(fmt));\r
+ StringCbPrintf(err_msg, sizeof(err_msg), fmt, idname);\r
+\r
+ goto show_failure;\r
+ }\r
+\r
+ /* ok. now we are all set to add the new identity */\r
+ if (KHM_FAILED(rv = kcdb_identity_create(idname,\r
+ KCDB_IDENT_FLAG_CREATE,\r
+ &ident))) {\r
+ /* oops */\r
+ wchar_t fmt[256];\r
+\r
+ LoadString(khm_hInstance, IDS_CFG_IDNAME_CCR,\r
+ fmt, ARRAYLENGTH(fmt));\r
+ StringCbPrintf(err_msg, sizeof(err_msg), fmt, rv);\r
+\r
+ goto show_failure;\r
+ }\r
+\r
+ /* now we have to create the identity configuration. */\r
+ if (KHM_FAILED(rv = kcdb_identity_get_config(ident,\r
+ KHM_FLAG_CREATE,\r
+ &csp_ident))) {\r
+ wchar_t fmt[256];\r
+\r
+ LoadString(khm_hInstance, IDS_CFG_IDNAME_CCC,\r
+ fmt, ARRAYLENGTH(fmt));\r
+ StringCbPrintf(err_msg, sizeof(err_msg), fmt, rv);\r
+\r
+ kcdb_identity_release(ident);\r
+\r
+ goto show_failure;\r
+ }\r
+\r
+ khm_refresh_config();\r
+\r
+ kcdb_identity_release(ident);\r
+ khc_close_space(csp_ident);\r
+\r
+ EndDialog(hwnd, 0);\r
+ break;\r
+\r
+ show_failure:\r
+ {\r
+ wchar_t title[512];\r
+ wchar_t fmt[256];\r
+\r
+ if (!err_msg[0])\r
+ break;\r
+\r
+ LoadString(khm_hInstance, IDS_CFG_IDNAME_PRB,\r
+ fmt, ARRAYLENGTH(fmt));\r
+ StringCbPrintf(title, sizeof(title), fmt, idname);\r
+\r
+ MessageBox(hwnd, err_msg, title, MB_OK | MB_ICONSTOP);\r
+\r
+ /* don't end the dialog yet */\r
+ break;\r
+ }\r
+ break;\r
+ \r
+ } else if (LOWORD(wParam) == IDCANCEL) {\r
+ EndDialog(hwnd, 1);\r
+ }\r
+ break;\r
+ }\r
+\r
+ return FALSE;\r
+}\r
+\r
+/* dialog procedure for the "general" pane of the "identities"\r
+ configuration node. */\r
INT_PTR CALLBACK\r
khm_cfg_ids_tab_proc(HWND hwnd,\r
UINT umsg,\r
case IDC_CFG_STICKY:\r
refresh_data_idents(hwnd);\r
break;\r
+\r
+ case IDC_CFG_ADDIDENT:\r
+ DialogBoxParam(khm_hInstance,\r
+ MAKEINTRESOURCE(IDD_CFG_ADDIDENT),\r
+ hwnd,\r
+ khm_cfg_add_ident_proc,\r
+ (LPARAM) hwnd);\r
+ break;\r
}\r
\r
refresh_view_idents_state(hwnd);\r
return FALSE;\r
}\r
\r
+/* dialog procedure for the "Identities" configuration node */\r
INT_PTR CALLBACK\r
khm_cfg_identities_proc(HWND hwnd,\r
UINT uMsg,\r
}\r
}\r
\r
+/* dialog procedure for the "general" pane of individual identity\r
+ configuration nodes. */\r
INT_PTR CALLBACK\r
khm_cfg_id_tab_proc(HWND hwnd,\r
UINT umsg,\r
return FALSE;\r
}\r
\r
+/* dialog procedure for individual identity configuration nodes */\r
INT_PTR CALLBACK\r
khm_cfg_identity_proc(HWND hwnd,\r
UINT uMsg,\r
cfgui_apply_settings(khui_config_node node) {\r
HWND hwnd;\r
khui_config_node c;\r
+ khm_int32 flags;\r
\r
hwnd = khui_cfg_get_hwnd(node);\r
+ flags = khui_cfg_get_flags(node);\r
\r
- if (hwnd)\r
+ if (hwnd && (flags & KHUI_CNFLAG_MODIFIED)) {\r
SendMessage(hwnd, KHUI_WM_CFG_NOTIFY,\r
MAKEWPARAM(0, WMCFG_APPLY),\r
(LPARAM) node);\r
+ }\r
\r
if (KHM_FAILED(khui_cfg_get_first_child(node, &c)))\r
return;\r
cfgui_update_state(hwnd, LOWORD(wParam), \r
(khui_config_node) lParam);\r
break;\r
+\r
+ case WMCFG_SYNC_NODE_LIST:\r
+ /*TODO: synchronize the node lists here */\r
+ break;\r
}\r
+\r
return TRUE;\r
}\r
\r
int n_tries = 0;\r
khui_config_node cfg_ids = NULL;\r
khui_config_node cfg_r = NULL;\r
+ khui_config_node cfg_iter = NULL;\r
khui_menu_def * omenu;\r
khm_boolean refresh_menu = FALSE;\r
\r
}\r
}\r
\r
+ for (khui_cfg_get_first_child(cfg_ids, &cfg_iter);\r
+ cfg_iter;\r
+ khui_cfg_get_next_release(&cfg_iter)) {\r
+\r
+ wchar_t cfgname[KCDB_IDENT_MAXCCH_NAME];\r
+ khm_size cb;\r
+ khm_handle tident = NULL;\r
+ khm_int32 tflags = 0;\r
+\r
+ cb = sizeof(cfgname);\r
+ khui_cfg_get_name(cfg_iter, cfgname, &cb);\r
+\r
+ if (KHM_FAILED(kcdb_identity_create(cfgname, 0, &tident)) ||\r
+ KHM_FAILED(kcdb_identity_get_flags(tident, &tflags)) ||\r
+ !(tflags & KCDB_IDENT_FLAG_ACTIVE) ||\r
+ !(tflags & KCDB_IDENT_FLAG_CONFIG)) {\r
+\r
+ /* this configuration node needs to be removed */\r
+\r
+ khui_cfg_remove(cfg_iter);\r
+ }\r
+ }\r
+\r
/* Now iterate through the root level configuration nodes and make\r
sure we have a menu item for each of them. */\r
if (KHM_FAILED(khui_cfg_get_first_child(NULL, &cfg_r)))\r
}\r
\r
void\r
-khm_cred_process_commandline(void) {\r
+khm_cred_process_startup_actions(void) {\r
khm_handle defident = NULL;\r
\r
if (!khm_startup.processing)\r
kcdb_identity_get_default(&defident);\r
}\r
\r
+ /* For asynchronous actions, we trigger the action and then exit\r
+ the loop. Once the action completes, the completion handler\r
+ will trigger a continuation message which will result in this\r
+ function getting called again. Then we can proceed with the\r
+ rest of the startup actions. */\r
do {\r
if (khm_startup.init) {\r
if (defident)\r
}\r
\r
if (khm_startup.renew) {\r
- if (defident)\r
- khui_context_set(KHUI_SCOPE_IDENT,\r
- defident,\r
- KCDB_CREDTYPE_INVALID,\r
- NULL, NULL, 0,\r
- NULL);\r
- else\r
- khui_context_reset();\r
+ khm_size count;\r
+\r
+ kcdb_credset_get_size(NULL, &count);\r
+\r
+ /* if there are no credentials, we just skip over the\r
+ renew action. */\r
\r
- khm_cred_renew_creds();\r
khm_startup.renew = FALSE;\r
- break;\r
+\r
+ if (count != 0) {\r
+ if (defident)\r
+ khui_context_set(KHUI_SCOPE_IDENT,\r
+ defident,\r
+ KCDB_CREDTYPE_INVALID,\r
+ NULL, NULL, 0,\r
+ NULL);\r
+ else\r
+ khui_context_reset();\r
+\r
+ khm_cred_renew_creds();\r
+ break;\r
+ }\r
}\r
\r
if (khm_startup.destroy) {\r
+\r
+ khm_startup.destroy = FALSE;\r
+\r
if (defident) {\r
khui_context_set(KHUI_SCOPE_IDENT,\r
defident,\r
NULL);\r
\r
khm_cred_destroy_creds(FALSE, FALSE);\r
+ break;\r
}\r
-\r
- khm_startup.destroy = FALSE;\r
- break;\r
}\r
\r
if (khm_startup.autoinit) {\r
khm_size count;\r
\r
+ khm_startup.autoinit = FALSE;\r
+\r
kcdb_credset_get_size(NULL, &count);\r
\r
if (count == 0) {\r
khui_context_reset();\r
\r
khm_cred_obtain_new_creds(NULL);\r
+ break;\r
}\r
- khm_startup.autoinit = FALSE;\r
- break;\r
}\r
\r
if (khm_startup.exit) {\r
break;\r
}\r
\r
+ /* when we get here, then we are all done with the command\r
+ line stuff */\r
khm_startup.processing = FALSE;\r
} while(FALSE);\r
\r
}\r
\r
void\r
-khm_cred_begin_commandline(void) {\r
+khm_cred_begin_startup_actions(void) {\r
khm_handle csp_cw;\r
\r
if (khm_startup.seen)\r
khm_startup.seen = TRUE;\r
khm_startup.processing = TRUE;\r
\r
- khm_cred_process_commandline();\r
+ khm_cred_process_startup_actions();\r
}\r
\r
void\r
wchar_t * ident, khm_size cb_ident);\r
\r
void\r
-khm_cred_begin_commandline(void);\r
+khm_cred_begin_startup_actions(void);\r
\r
void\r
-khm_cred_process_commandline(void);\r
+khm_cred_process_startup_actions(void);\r
\r
void\r
khm_cred_refresh(void);\r
wchar_t buf[KCONF_MAXCCH_NAME];\r
wchar_t * clist = NULL;\r
khm_size cbsize;\r
- wchar_t * cstr = NULL;\r
wchar_t * iter = NULL;\r
int i;\r
HDC hdc;\r
SIZE size;\r
size_t cbbuf;\r
wchar_t buf[64];\r
- HFONT hfold;\r
+ HFONT hfold = NULL;\r
\r
if (hf)\r
hfold = SelectFont(hdc, hf);\r
break;\r
\r
default:\r
- return;\r
+ return;\r
}\r
\r
if(tbl->kbm_logo_shade.cx != -1 && type == CW_ER_BLANK) {\r
rlogo.bottom = r_wnd->bottom;\r
rie = IntersectRect(&ri, r_erase, &rlogo);\r
} else {\r
+ ZeroMemory(&rlogo, sizeof(rlogo));\r
+ ZeroMemory(&ri, sizeof(ri));\r
rie = FALSE;\r
}\r
\r
HBITMAP hbmold = SelectObject(hdcb, tbl->kbm_logo_shade.hbmp);\r
\r
BitBlt(hdc, ri.left, ri.top, ri.right - ri.left, ri.bottom - ri.top,\r
- hdcb, ri.left - rlogo.left, ri.top - rlogo.top, SRCCOPY);\r
+ hdcb, ri.left - rlogo.left, ri.top - rlogo.top, SRCCOPY);\r
\r
SelectObject(hdcb, hbmold);\r
DeleteDC(hdcb);\r
Header_SetItem(tbl->hwnd_header, hidx, &hi);\r
}\r
\r
+#if 0\r
} else if (tbl->cols[idx].flags &\r
(KHUI_CW_COL_SORT_INC |\r
KHUI_CW_COL_SORT_DEC)) {\r
hidx = Header_OrderToIndex(tbl->hwnd_header, i);\r
Header_SetItem(tbl->hwnd_header, hidx, &hi);\r
}\r
-\r
+#endif\r
} else {\r
int i;\r
int sort_index = 0;\r
HDC hdc;\r
PAINTSTRUCT ps;\r
RECT r,rh;\r
- HFONT hf_old;\r
+ HFONT hf_old = NULL;\r
int row_s, row_e;\r
int col_s, col_e;\r
int i,j,x,y,xs,xe,ys,ye;\r
case KHUI_PACTION_UP_TOGGLE:\r
{ /* cursor up */\r
khm_int32 new_row;\r
- WPARAM wp;\r
+ WPARAM wp = 0;\r
\r
new_row = tbl->cursor_row - 1;\r
\r
case KHUI_PACTION_DOWN_TOGGLE:\r
{ /* cursor down */\r
khm_int32 new_row;\r
- WPARAM wp;\r
+ WPARAM wp = 0;\r
\r
new_row = tbl->cursor_row + 1;\r
\r
int i;\r
\r
for(i=0; i<n; i++) {\r
- if(!wcsnicmp(tbl[i].string, v, len))\r
+ if(!_wcsnicmp(tbl[i].string, v, len))\r
return tbl[i].value;\r
}\r
\r
/* start initially points to the starting '<' */\r
c = token_end(++start);\r
\r
- if(!wcsnicmp(start,L"a",c-start)) {\r
+ if(!_wcsnicmp(start,L"a",c-start)) {\r
/* start of an 'a' tag */\r
wchar_t * id_start = NULL;\r
int id_len = 0;\r
if(c==e)\r
break;\r
\r
- if(!wcsnicmp(c,L"id",e-c)) {\r
+ if(!_wcsnicmp(c,L"id",e-c)) {\r
c = read_attr(e, &id_start, &id_len);\r
- } else if(!wcsnicmp(c,L"param",e-c)) {\r
+ } else if(!_wcsnicmp(c,L"param",e-c)) {\r
c = read_attr(e, ¶m_start, ¶m_len);\r
}\r
}\r
d->n_links++;\r
}\r
\r
- } else if(!wcsnicmp(start, L"/a", c - start)) {\r
+ } else if(!_wcsnicmp(start, L"/a", c - start)) {\r
khui_htwnd_link * l;\r
\r
c = wcschr(c,L'>');\r
l->r.right = p_abs->x;\r
l->r.bottom = p_abs->y + lh;\r
}\r
- } else if(!wcsnicmp(start, L"p", c - start)) {\r
+ } else if(!_wcsnicmp(start, L"p", c - start)) {\r
wchar_t * e;\r
wchar_t * align_s = NULL;\r
- int align_len;\r
+ int align_len = 0;\r
\r
c = skip_ws(c);\r
e = token_end(c);\r
\r
- if(c != e && !wcsnicmp(c,L"align",e-c)) {\r
+ if(c != e && !_wcsnicmp(c,L"align",e-c)) {\r
c = read_attr(e, &align_s, &align_len);\r
}\r
\r
*align = ALIGN_LEFT;\r
\r
n = 1;\r
- } else if(!wcsnicmp(start, L"b", c - start)) {\r
+ } else if(!_wcsnicmp(start, L"b", c - start)) {\r
format_push(s,d, HTW_DEFAULT, FV_BOLD, HTW_DEFAULT);\r
- } else if(!wcsnicmp(start, L"/b", c - start)) {\r
+ } else if(!_wcsnicmp(start, L"/b", c - start)) {\r
format_pop(s);\r
- } else if(!wcsnicmp(start, L"u", c - start)) {\r
+ } else if(!_wcsnicmp(start, L"u", c - start)) {\r
format_push(s,d, HTW_DEFAULT, FV_UNDERLINE, HTW_DEFAULT);\r
- } else if(!wcsnicmp(start, L"/u", c - start)) {\r
+ } else if(!_wcsnicmp(start, L"/u", c - start)) {\r
format_pop(s);\r
- } else if(!wcsnicmp(start, L"large", c - start)) {\r
+ } else if(!_wcsnicmp(start, L"large", c - start)) {\r
format_push(s,d,-MulDiv(HTW_LARGE_SIZE, d->l_pixel_y, 72), HTW_DEFAULT, HTW_DEFAULT);\r
- } else if(!wcsnicmp(start, L"/large", c - start)) {\r
+ } else if(!_wcsnicmp(start, L"/large", c - start)) {\r
format_pop(s);\r
- } else if(!wcsnicmp(start, L"huge", c - start)) {\r
+ } else if(!_wcsnicmp(start, L"huge", c - start)) {\r
format_push(s,d,-MulDiv(HTW_HUGE_SIZE, d->l_pixel_y, 72), HTW_DEFAULT, HTW_DEFAULT);\r
- } else if(!wcsnicmp(start, L"/huge", c - start)) {\r
+ } else if(!_wcsnicmp(start, L"/huge", c - start)) {\r
format_pop(s);\r
- } else if(!wcsnicmp(start, L"center", c - start)) {\r
+ } else if(!_wcsnicmp(start, L"center", c - start)) {\r
c = wcschr(c, L'>');\r
if(!c)\r
c = c + wcslen(c);\r
*align = ALIGN_CENTER;\r
n = 1;\r
- } else if(!wcsnicmp(start, L"left", c - start) ||\r
- !wcsnicmp(start, L"p", c - start)) \r
+ } else if(!_wcsnicmp(start, L"left", c - start) ||\r
+ !_wcsnicmp(start, L"p", c - start)) \r
{\r
c = wcschr(c, L'>');\r
if(!c)\r
c = c + wcslen(c);\r
*align = ALIGN_LEFT;\r
n = 1;\r
- } else if(!wcsnicmp(start, L"right", c - start)) {\r
+ } else if(!_wcsnicmp(start, L"right", c - start)) {\r
c = wcschr(c, L'>');\r
if(!c)\r
c = c + wcslen(c);\r
*align = ALIGN_RIGHT;\r
n = 1;\r
- } else if(!wcsnicmp(start, L"/center", c - start) ||\r
- !wcsnicmp(start, L"/left", c - start) ||\r
- !wcsnicmp(start, L"/right", c - start) ||\r
- !wcsnicmp(start, L"/p", c - start))\r
- {\r
+ } else if(!_wcsnicmp(start, L"/center", c - start) ||\r
+ !_wcsnicmp(start, L"/left", c - start) ||\r
+ !_wcsnicmp(start, L"/right", c - start) ||\r
+ !_wcsnicmp(start, L"/p", c - start)) {\r
c = wcschr(c, L'>');\r
if(!c)\r
c = c + wcslen(c);\r
*align = ALIGN_LEFT;\r
n = 1;\r
- } else if(!wcsnicmp(start, L"font", c - start)) {\r
+ } else if(!_wcsnicmp(start, L"font", c - start)) {\r
wchar_t * color_s = NULL;\r
- int color_len;\r
+ int color_len = 0;\r
wchar_t * size_s = NULL;\r
- int size_len;\r
+ int size_len = 0;\r
LONG color = HTW_DEFAULT;\r
LONG h = HTW_DEFAULT;\r
\r
if(c==e)\r
break;\r
\r
- if(!wcsnicmp(c,L"color",e-c)) {\r
+ if(!_wcsnicmp(c,L"color",e-c)) {\r
c = read_attr(e, &color_s, &color_len);\r
- } else if(!wcsnicmp(c,L"size",e-c)) {\r
+ } else if(!_wcsnicmp(c,L"size",e-c)) {\r
c = read_attr(e, &size_s, &size_len);\r
}\r
}\r
}\r
\r
format_push(s,d,h,HTW_DEFAULT,color);\r
- } else if(!wcsnicmp(start, L"/font", c - start)) {\r
+ } else if(!_wcsnicmp(start, L"/font", c - start)) {\r
format_pop(s);\r
- } else if(!wcsnicmp(start, L"settab", c - start)) {\r
+ } else if(!_wcsnicmp(start, L"settab", c - start)) {\r
wchar_t * e;\r
wchar_t * pos_s = NULL;\r
int pos_len;\r
c = skip_ws(c);\r
e = token_end(c);\r
\r
- if(c != e && !wcsnicmp(c,L"pos",e-c)) {\r
+ if(c != e && !_wcsnicmp(c,L"pos",e-c)) {\r
c = read_attr(e, &pos_s, &pos_len);\r
}\r
\r
\r
d->tabs[d->n_tabs++] = MulDiv(dx, bx, 4);\r
}\r
- } else if(!wcsnicmp(start, L"tab", c - start)) {\r
+ } else if(!_wcsnicmp(start, L"tab", c - start)) {\r
int i;\r
\r
if(!dry_run) {\r
\r
void khm_unregister_htwnd_class(void)\r
{\r
- UnregisterClass((LPWSTR) khui_htwnd_cls, khm_hInstance);\r
+ UnregisterClass(MAKEINTATOM(khui_htwnd_cls), khm_hInstance);\r
}\r
\r
HWND khm_create_htwnd(HWND parent, LPWSTR text, int x, int y, int width, int height, DWORD ex_style, DWORD style)\r
\r
return CreateWindowEx(\r
ex_style,\r
- (LPWSTR) khui_htwnd_cls,\r
+ MAKEINTATOM(khui_htwnd_cls),\r
text,\r
style | WS_CHILD,\r
x,y,width,height,\r
CONTROL "Log trace events to trace log at the following location:",\r
IDC_CFG_LOGTOFILE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,\r
16,113,225,10\r
- EDITTEXT IDC_CFG_LOGPATH,16,127,225,14,ES_AUTOHSCROLL | \r
+ EDITTEXT IDC_CFG_LOGPATH,16,127,173,14,ES_AUTOHSCROLL | \r
ES_READONLY\r
+ PUSHBUTTON "Show log ...",IDC_CFG_SHOWLOG,193,127,50,14\r
CONTROL "A&utomatically import Windows logon identity",\r
IDC_CFG_AUTOIMPORT,"Button",BS_AUTOCHECKBOX | NOT \r
WS_VISIBLE | WS_TABSTOP,16,158,165,10\r
CONTROL "Always show in the credentials list (Pinned)",\r
IDC_CFG_STICKY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,\r
34,151,10\r
+ PUSHBUTTON "&Add new identity...",IDC_CFG_ADDIDENT,17,120,86,14\r
END\r
\r
IDD_CFG_ID_TAB DIALOGEX 0, 0, 235, 151\r
BS_AUTOCHECKBOX | WS_TABSTOP,7,7,107,10\r
CONTROL "Automatically renew",IDC_CFG_RENEW,"Button",\r
BS_AUTOCHECKBOX | WS_TABSTOP,7,20,81,10\r
- PUSHBUTTON "Remove identity ...",IDC_CFG_REMOVE,139,122,78,14,NOT \r
- WS_VISIBLE\r
+ PUSHBUTTON "Remove identity ...",IDC_CFG_REMOVE,139,122,78,14\r
END\r
\r
IDD_ABOUT DIALOGEX 0, 0, 268, 170\r
PUSHBUTTON "&Revert to default",IDC_CFG_REVERT,168,122,72,14\r
END\r
\r
+IDD_CFG_ADDIDENT DIALOGEX 0, 0, 325, 70\r
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | \r
+ WS_SYSMENU\r
+CAPTION "Add new identity"\r
+FONT 8, "MS Shell Dlg", 400, 0, 0x1\r
+BEGIN\r
+ LTEXT "&Identity name",IDC_STATIC,7,10,46,8\r
+ EDITTEXT IDC_CFG_IDNAME,67,7,195,14,ES_AUTOHSCROLL\r
+ DEFPUSHBUTTON "OK",IDOK,268,7,50,14\r
+ PUSHBUTTON "Cancel",IDCANCEL,268,24,50,14\r
+END\r
+\r
\r
/////////////////////////////////////////////////////////////////////////////\r
//\r
TOPMARGIN, 7\r
BOTTOMMARGIN, 175\r
END\r
+\r
+ IDD_CFG_ADDIDENT, DIALOG\r
+ BEGIN\r
+ LEFTMARGIN, 7\r
+ RIGHTMARGIN, 318\r
+ TOPMARGIN, 7\r
+ BOTTOMMARGIN, 63\r
+ END\r
END\r
#endif // APSTUDIO_INVOKED\r
\r
IDS_CFG_APPEAR_LONG "Appearance"\r
IDS_ACTION_OPT_APPEAR "Appearance ..."\r
IDS_APR_SAMPLE_TEXT_SEL "Sample text (selected). 01234567890"\r
+ IDS_CFG_IDNAME_INV "The identity name %s is invalid."\r
+ IDS_CFG_IDNAME_PRB "Can't add new identity %s"\r
+ IDS_CFG_IDNAME_EXT "The identity name %s already exists."\r
+ IDS_CFG_IDNAME_CCR "Can't create new identity. This may be caused by lack of resources or an unknown failure. The code returned was %d."\r
+ IDS_CFG_IDNAME_CCC "Can't create identity configuration. This may be caused by lack or resources or not having the correct permissions to create the configuration space. The code returned was %d."\r
+ IDS_CFG_LOGF_CS "Can't show log file"\r
+ IDS_CFG_LOGF_CSR "The log file %s does not exist."\r
END\r
\r
#endif // English (U.S.) resources\r
break;\r
}\r
}\r
+\r
+ /* special: always enable renew when other options aren't specified */\r
+ if (!khm_startup.exit &&\r
+ !khm_startup.destroy &&\r
+ !khm_startup.init)\r
+ khm_startup.renew = TRUE;\r
}\r
\r
void khm_register_window_classes(void) {\r
xfer = MapViewOfFile(hmap, FILE_MAP_WRITE, 0, 0,\r
sizeof(query_app_version));\r
\r
- if (xfer) {\r
- ZeroMemory(&query_app_version, sizeof(query_app_version));\r
+ ZeroMemory(&query_app_version, sizeof(query_app_version));\r
\r
+ if (xfer) {\r
query_app_version.magic = KHM_QUERY_APP_VER_MAGIC;\r
query_app_version.code = KHM_ERROR_NOT_IMPLEMENTED;\r
query_app_version.ver_caller = app_version;\r
khm_update_standard_toolbar();\r
} else if (m->type == KMSG_ACT &&\r
m->subtype == KMSG_ACT_BEGIN_CMDLINE) {\r
- khm_cred_begin_commandline();\r
+ khm_cred_begin_startup_actions();\r
} else if (m->type == KMSG_ACT &&\r
m->subtype == KMSG_ACT_CONTINUE_CMDLINE) {\r
- khm_cred_process_commandline();\r
+ khm_cred_process_startup_actions();\r
} else if (m->type == KMSG_ACT &&\r
m->subtype == KMSG_ACT_SYNC_CFG) {\r
khm_refresh_config();\r
khm_startup.seen = FALSE;\r
khm_startup.processing = FALSE;\r
\r
- khm_cred_begin_commandline();\r
+ khm_cred_begin_startup_actions();\r
}\r
break;\r
\r
r_row.bottom += r_input.bottom;\r
OffsetRect(&r_label, r_row.left, r_row.top);\r
} else {\r
+ SetRectEmpty(&r_label);\r
+ SetRectEmpty(&r_input);\r
#ifdef DEBUG\r
assert(FALSE);\r
#else\r
nc_tab_sort_func);\r
\r
for(i=0; i < d->nc->n_types;i++) {\r
- wchar_t * name;\r
+ wchar_t * name = NULL;\r
\r
d->nc->types[i]->ordinal = i + 1;\r
\r
#define IDS_PISTATE_PLACEHOLD 210\r
#define IDD_CFG_APPEAR 210\r
#define IDS_PISTATE_REG 211\r
+#define IDD_CFG_ADDIDENT 211\r
#define IDS_PISTATE_HOLD 212\r
#define IDS_PISTATE_INIT 213\r
#define IDS_PISTATE_RUN 214\r
#define IDS_CFG_APPEAR_LONG 261\r
#define IDS_ACTION_OPT_APPEAR 262\r
#define IDS_APR_SAMPLE_TEXT_SEL 263\r
+#define IDS_CFG_IDNAME_INV 264\r
+#define IDS_CFG_IDNAME_PRB 265\r
+#define IDS_CFG_IDNAME_EXT 266\r
+#define IDS_CFG_IDNAME_CCR 267\r
+#define IDS_CFG_IDNAME_CCC 268\r
+#define IDS_CFG_LOGF_CS 269\r
+#define IDS_CFG_LOGF_CSR 270\r
#define IDC_NC_USERNAME 1007\r
#define IDC_NC_PASSWORD 1008\r
#define IDC_NC_CREDTEXT_LABEL 1009\r
#define IDC_CFG_SIZE 1130\r
#define IDC_CFG_BOLD 1131\r
#define IDC_CFG_ITALICS 1132\r
+#define IDC_CFG_ADDIDENT 1133\r
+#define IDC_CFG_IDNAME 1134\r
+#define IDC_CFG_SHOWLOG 1135\r
#define IDA_ACTIVATE_MENU 40003\r
#define IDA_UP 40004\r
#define IDA_DOWN 40005\r
// \r
#ifdef APSTUDIO_INVOKED\r
#ifndef APSTUDIO_READONLY_SYMBOLS\r
-#define _APS_NEXT_RESOURCE_VALUE 211\r
+#define _APS_NEXT_RESOURCE_VALUE 212\r
#define _APS_NEXT_COMMAND_VALUE 40010\r
-#define _APS_NEXT_CONTROL_VALUE 1133\r
+#define _APS_NEXT_CONTROL_VALUE 1136\r
#define _APS_NEXT_SYMED_VALUE 101\r
#endif\r
#endif\r
/* $Id$ */\r
\r
#include<khmapp.h>\r
+#ifdef DEBUG\r
+#include<assert.h>\r
+#endif\r
\r
khm_statusbar_part khm_statusbar_parts[] = {\r
{KHUI_SBPART_INFO, 0, KHUI_SB_WTYPE_FILLER},\r
\r
lastx = 0;\r
for(i=0;i<khm_n_statusbar_parts;i++) {\r
- int w;\r
+ int w = 0;\r
switch(khm_statusbar_parts[i].wtype) {\r
- case KHUI_SB_WTYPE_ABSOLUTE:\r
- w = khm_statusbar_parts[i].width;\r
- break;\r
-\r
- case KHUI_SB_WTYPE_RELATIVE:\r
- w = (khm_statusbar_parts[i].width * width) / 100;\r
- break;\r
-\r
- case KHUI_SB_WTYPE_FILLER:\r
- w = fillerwidth;\r
- break;\r
+ case KHUI_SB_WTYPE_ABSOLUTE:\r
+ w = khm_statusbar_parts[i].width;\r
+ break;\r
+\r
+ case KHUI_SB_WTYPE_RELATIVE:\r
+ w = (khm_statusbar_parts[i].width * width) / 100;\r
+ break;\r
+\r
+ case KHUI_SB_WTYPE_FILLER:\r
+ w = fillerwidth;\r
+ break;\r
+\r
+ default:\r
+ w = 0;\r
+#ifdef DEBUG\r
+ assert(FALSE);\r
+#endif\r
}\r
lastx += w;\r
\r
\r
EnterCriticalSection(&cs_cfgui);\r
TADDCHILD(parent, node);\r
+\r
+ if (hwnd_cfgui) {\r
+ SendMessage(hwnd_cfgui, KHUI_WM_CFG_NOTIFY,\r
+ MAKEWPARAM(0, WMCFG_SYNC_NODE_LIST), 0);\r
+ }\r
+\r
LeaveCriticalSection(&cs_cfgui);\r
\r
/* when the root config list changes, we need to notify the UI.\r
EnterCriticalSection(&cs_cfgui);\r
node = cfgui_node_i_from_handle(vnode);\r
node->flags |= KHUI_CN_FLAG_DELETED;\r
+\r
+ if (hwnd_cfgui) {\r
+ SendMessage(hwnd_cfgui, KHUI_WM_CFG_NOTIFY,\r
+ MAKEWPARAM(0, WMCFG_SYNC_NODE_LIST), 0);\r
+ }\r
+\r
LeaveCriticalSection(&cs_cfgui);\r
\r
return KHM_ERROR_SUCCESS;\r
khm_int32 flags)\r
{\r
khui_new_creds_prompt * p;\r
- size_t cb_prompt;\r
- size_t cb_def;\r
+ size_t cb_prompt = 0;\r
+ size_t cb_def = 0;\r
\r
if(prompt && FAILED(StringCbLength(prompt, KHUI_MAXCB_PROMPT, &cb_prompt)))\r
return NULL;\r
'Apply' button or the 'Ok' button. The panels are responsible\r
for applying the configuration changes and updating their flags\r
using khui_cfg_set_flags(). */\r
+\r
+ WMCFG_SYNC_NODE_LIST = 4,\r
+ /*!< Sent from the UI library to the configuration window to\r
+ notify the window that the node list has changed. This message\r
+ is sent synchronously before the node is removed. */\r
};\r
\r
/*! \brief Registration information for a configuration node\r
\r
if(flags & KHM_PREFIX) {\r
if(((flags & KHM_CASE_SENSITIVE) && !wcsncmp(s, str, cch_s)) ||\r
- (!(flags & KHM_CASE_SENSITIVE) && !wcsnicmp(s, str, cch_s)))\r
+ (!(flags & KHM_CASE_SENSITIVE) && !_wcsnicmp(s, str, cch_s)))\r
return (wchar_t *) s;\r
} else {\r
if((cch == cch_s) &&\r
((flags & KHM_CASE_SENSITIVE) && !wcsncmp(s, str, cch)) ||\r
- (!(flags & KHM_CASE_SENSITIVE) && !wcsnicmp(s, str, cch)))\r
+ (!(flags & KHM_CASE_SENSITIVE) && !_wcsnicmp(s, str, cch)))\r
return (wchar_t *) s;\r
}\r
\r
\r
KHMEXP void KHMAPI DeleteRwLock(PRWLOCK pLock)\r
{\r
- DeleteCriticalSection(&(pLock->cs));\r
+ EnterCriticalSection(&pLock->cs);\r
+\r
CloseHandle(pLock->readwx);\r
CloseHandle(pLock->writewx);\r
pLock->readwx = NULL;\r
pLock->writewx = NULL;\r
+\r
+ LeaveCriticalSection(&pLock->cs);\r
+ DeleteCriticalSection(&(pLock->cs));\r
}\r
\r
KHMEXP void KHMAPI LockObtainRead(PRWLOCK pLock)\r
pLock->writer == GetCurrentThreadId()) {\r
pLock->locks++;\r
LeaveCriticalSection(&(pLock->cs));\r
- assert(FALSE);\r
return;\r
}\r
LeaveCriticalSection(&(pLock->cs));\r
pLock->locks++;\r
pLock->writer = GetCurrentThreadId();\r
ResetEvent(pLock->readwx);\r
+ ResetEvent(pLock->writewx);\r
LeaveCriticalSection(&(pLock->cs));\r
}\r
\r