Results from Kerberos Interop session:
authorJeffrey Altman <jaltman@secure-endpoints.com>
Sun, 2 Apr 2006 04:28:26 +0000 (04:28 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Sun, 2 Apr 2006 04:28:26 +0000 (04:28 +0000)
 - 64-bit Windows compatibility

 - correct uninitialized variables

 - work without kerberos 4 libraries including krb524

 - add a mechanism to add and remove identities from
   the options dialog.   This allows a configuration
   to be specified using a separate file based ccache
   for each identity

 - work without availability of ccapi

 - force a renew of credentials on startup to support
   the case when MSLSA is the only credential cache

ticket: new

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17832 dc483132-0cff-0310-8789-dd5450dbe970

39 files changed:
src/windows/identity/kconfig/api.c
src/windows/identity/kconfig/kconfiginternal.h
src/windows/identity/kcreddb/buf.c
src/windows/identity/kcreddb/identity.c
src/windows/identity/kcreddb/kcreddb.h
src/windows/identity/kcreddb/type.c
src/windows/identity/kherr/kherr.c
src/windows/identity/kherr/kherr.h
src/windows/identity/kherr/kherrinternal.h
src/windows/identity/kmm/kmm_registrar.c
src/windows/identity/kmm/kplugin.h
src/windows/identity/kmq/init.c
src/windows/identity/kmq/msgtype.c
src/windows/identity/plugins/common/dynimport.c
src/windows/identity/plugins/common/krb5common.c
src/windows/identity/plugins/krb4/errorfuncs.c
src/windows/identity/plugins/krb4/krb4plugin.c
src/windows/identity/plugins/krb5/krb5configdlg.c
src/windows/identity/plugins/krb5/krb5funcs.c
src/windows/identity/plugins/krb5/krb5identpro.c
src/windows/identity/plugins/krb5/krb5newcreds.c
src/windows/identity/ui/cfg_general_wnd.c
src/windows/identity/ui/cfg_identities_wnd.c
src/windows/identity/ui/configwnd.c
src/windows/identity/ui/credfuncs.c
src/windows/identity/ui/credfuncs.h
src/windows/identity/ui/credwnd.c
src/windows/identity/ui/htwnd.c
src/windows/identity/ui/lang/en_us/khapp.rc
src/windows/identity/ui/main.c
src/windows/identity/ui/mainwnd.c
src/windows/identity/ui/newcredwnd.c
src/windows/identity/ui/resource.h
src/windows/identity/ui/statusbar.c
src/windows/identity/uilib/configui.c
src/windows/identity/uilib/creddlg.c
src/windows/identity/uilib/khconfigui.h
src/windows/identity/util/mstring.c
src/windows/identity/util/sync.c

index 72a20acbcc7fec788348625416ce0cb20c690e69..83aa0657cd2efb71bf79ab7a6e93b4e76e9aedcb 100644 (file)
@@ -166,33 +166,34 @@ khcint_handle_dup(kconf_handle * o)
 \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
@@ -211,7 +212,7 @@ khcint_RegOpenKeyEx(HKEY hkey, LPCWSTR sSubKey, DWORD ulOptions,
     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
@@ -378,7 +379,7 @@ khcint_RegCreateKeyEx(HKEY hKey,
     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
@@ -475,7 +476,7 @@ khcint_RegCreateKeyEx(HKEY hKey,
             }\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
@@ -668,9 +669,9 @@ khcint_free_space(kconf_conf_space * 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
@@ -685,14 +686,14 @@ khcint_open_space_int(kconf_conf_space * parent,
     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
@@ -704,6 +705,18 @@ khcint_open_space_int(kconf_conf_space * parent,
     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
@@ -842,7 +855,7 @@ khc_open_space(khm_handle parent, const wchar_t * cspace, khm_int32 flags,
                                              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
@@ -1756,7 +1769,7 @@ khc_get_type(khm_handle conf, wchar_t * value) {
     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
@@ -1913,7 +1926,7 @@ khcint_remove_space(kconf_conf_space * c, khm_int32 flags) {
 #endif\r
     if (!p)\r
         return KHM_ERROR_INVALID_OPERATION;\r
-            \r
+\r
     cc = TFIRSTCHILD(c);\r
     while (cc) {\r
         cn = LNEXT(cc);\r
@@ -1931,6 +1944,21 @@ khcint_remove_space(kconf_conf_space * c, khm_int32 flags) {
         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
@@ -1969,8 +1997,6 @@ khc_remove_space(khm_handle conf) {
          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
@@ -2076,7 +2102,7 @@ khcint_load_schema_i(khm_handle parent, kconf_schema * schema,
     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
@@ -2158,7 +2184,7 @@ khcint_unload_schema_i(khm_handle parent, kconf_schema * schema,
     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
index 64068f4a9031cf80cb04f91be901fb7d06a3f260..24929a989acba5f9962a61ada9a27121e5b89fa8 100644 (file)
@@ -62,9 +62,9 @@ typedef struct kconf_conf_space_t {
     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
index 1811bc126d27f0a3b83d988182add56d44b1c910..07a65a1b04d07cda372edb91c1ec6c11d4bb865b 100644 (file)
@@ -134,7 +134,7 @@ void kcdb_buf_alloc(kcdb_buf * buf, khm_size slot, khm_ui_2 id, khm_size cbsize)
         }\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
index b9b8194b1b87d3b79fa0674c1519d4bdcfba2e01..07ceb5812d08ae8f5c17cb0eb910065bb91a1a72 100644 (file)
@@ -616,8 +616,12 @@ kcdb_identity_get_config(khm_handle vid,
                             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
@@ -646,11 +650,16 @@ kcdbint_ident_post_message(khm_int32 op, kcdb_identity * id) {
 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
@@ -659,20 +668,23 @@ KHMEXP khm_int32 KHMAPI
 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
@@ -1031,8 +1043,7 @@ kcdb_identity_get_attrib(khm_handle vid,
 }\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
@@ -1285,15 +1296,16 @@ kcdb_identpro_compare_name(const wchar_t * name1,
     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
@@ -1301,6 +1313,7 @@ kcdb_identpro_compare_name(const wchar_t * name1,
         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
@@ -1310,7 +1323,7 @@ kcdb_identpro_compare_name(const wchar_t * name1,
 \r
         rv = namex.result;\r
     }\r
-    \r
+\r
     return rv;\r
 }\r
 \r
@@ -1334,8 +1347,7 @@ kcdb_identpro_set_default(khm_handle identity)
     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
@@ -1346,8 +1358,7 @@ kcdb_identpro_set_default(khm_handle identity)
 }\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
@@ -1437,7 +1448,8 @@ kcdb_identpro_notify_create(khm_handle identity)
     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
@@ -1463,12 +1475,12 @@ KHMEXP khm_int32 KHMAPI kcdb_identpro_get_ui_cb(void * rock)
     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
index 7826a82c0d3a6a4657cf323b5d6ea8d9c6757c5e..63d16252dd1dcab08b0af50c42b5304fff780be4 100644 (file)
@@ -524,6 +524,13 @@ kcdb_identity_get_default(khm_handle * pvid);
 \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
index 30771c07a31796437d20a2ccb8e89bbf44a10240..baf5f9730dc9f7a85cc464d5f6cf78df5d4a5246 100644 (file)
@@ -1275,7 +1275,7 @@ int _iv_is_in_spec(wchar_t *s, int n, wchar_t * spec)
         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
index 3b7a5d453f15884bfcd375a993d2c3a1640f70a8..feecbe06cef623f584ae7d1f0e7003fcf2d0d65a 100644 (file)
@@ -281,22 +281,22 @@ void free_event_params(kherr_event * e) {
     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
@@ -460,7 +460,7 @@ void pick_err_event(kherr_context * c)
 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
@@ -493,8 +493,8 @@ static void resolve_string_resource(kherr_event * e,
                                     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
@@ -537,8 +537,8 @@ static void resolve_msg_resource(kherr_event * e,
                                 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
@@ -725,7 +725,8 @@ kherr_reportf(const wchar_t * long_desc_fmt, ...) {
 \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
@@ -757,7 +758,11 @@ kherr_reportf_ex(enum kherr_severity severity,
     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
@@ -1024,7 +1029,7 @@ KHMEXP void KHMAPI kherr_push_new_context(khm_int32 flags)
 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
@@ -1288,7 +1293,7 @@ KHMEXP kherr_param kherr_dup_string(const wchar_t * s)
     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
@@ -1303,3 +1308,14 @@ KHMEXP kherr_param kherr_dup_string(const wchar_t * s)
 \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
index 99e7856220bc5e7ea2cd5ec41ddc272e45163602..7950587646b2ba0c988621076d96e87c6ba5c1e9 100644 (file)
 /*! \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
@@ -637,33 +638,40 @@ kherr_reportf(const wchar_t * long_desc_fmt,
  */\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
@@ -671,16 +679,16 @@ KHMEXP kherr_param kherr_dup_string(const wchar_t * s);
 #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
@@ -688,16 +696,16 @@ KHMEXP kherr_param kherr_dup_string(const wchar_t * s);
 \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
@@ -705,32 +713,32 @@ KHMEXP kherr_param kherr_dup_string(const wchar_t * s);
 \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
index 2b43fd7f4dc3308bb7c208973feaca8c13c0df6c..da33c596e222ff754573a0693a31424f6b4d0844 100644 (file)
@@ -60,8 +60,8 @@ extern kherr_event * evt_free_list;
 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
index 73651d44c6f3c9e3815ea93b056d8aa6a42676a0..742ccc7d73d899ef1bf00099b647a3ce2f245bca 100644 (file)
@@ -861,8 +861,8 @@ void kmmint_init_module(kmm_module_i * m) {
                          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
index 99f94f1f4a020a3e721fa3c66eeb3c658d195b63..e4e6003eecd3b5d4e9690b1f19b3d22026a28e5e 100644 (file)
@@ -90,7 +90,7 @@ KHMEXP khm_int32 KHMAPI init_module(kmm_module h_module);
 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
@@ -133,7 +133,7 @@ KHMEXP khm_int32 KHMAPI exit_module(kmm_module h_module);
 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
index 77b8dd0e14b101a9cb392818771712b348c73504..00b8f6f4f26b268a457e585784d677044af8b84b 100644 (file)
@@ -49,8 +49,14 @@ void kmqint_init(void) {
     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
index 62a0133d206ee73aac82e787368702b51a5523f3..3fd31ec17b3996ef5eea3d76026526145a3fc1b5 100644 (file)
@@ -252,7 +252,7 @@ void kmqint_msg_type_del_sub(kmq_msg_subscription *s) {
     \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
index 016af86e980131c294a977ed838891e406570b24..7eecc754954a4a8d7504e34284c7ba02bc9d660d 100644 (file)
@@ -364,8 +364,10 @@ khm_int32 init_imports(void) {
 \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
index cb9d86bc529ead26dc6478b0301d1c7653b0d9c9..de1cea4abf9c8faa41465c7bda0669545ed44b26 100644 (file)
@@ -91,7 +91,7 @@ khm_krb5_initialize(khm_handle ident,
 \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
@@ -289,6 +289,12 @@ khm_krb5_find_ccache_for_identity(khm_handle ident, krb5_context *pctx,
 \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
@@ -337,6 +343,8 @@ khm_krb5_find_ccache_for_identity(khm_handle ident, krb5_context *pctx,
         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
index dba9f5dc6cb6d0494e04345c044ecefa335c1811..5adc66b9143ebd50ff8b66d20d5a800d07c324ca 100644 (file)
@@ -62,7 +62,7 @@ extern LPSTR (*Lerror_table_name)(long);
 \r
 HWND GetRootParent (HWND Child)\r
 {\r
-    HWND Last;\r
+    HWND Last = NULL;\r
     while (Child)\r
     {\r
         Last = Child;\r
index 972ed4a0198d55b5ccdd98348fad712294e39c67..fb6a88307e440612b620579440fcdfc0f15936f7 100644 (file)
@@ -49,6 +49,9 @@ krb4_msg_system(khm_int32 msg_type, khm_int32 msg_subtype,
     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
@@ -200,10 +203,14 @@ krb4_msg_system(khm_int32 msg_type, khm_int32 msg_subtype,
                                              &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
@@ -212,6 +219,7 @@ krb4_msg_system(khm_int32 msg_type, khm_int32 msg_subtype,
                 kcdb_credset_delete(krb4_credset);\r
             }\r
         break;\r
+#endif\r
     }\r
 \r
     return rv;\r
index 0cb8b2ab7038bfeeb59c6c318248511493566d8d..ad64d488338a3f6c16e5dd22d9ca9eba76857c49 100644 (file)
@@ -713,9 +713,9 @@ k5_write_config_data(k5_config_data * d) {
                         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,
@@ -836,9 +836,9 @@ k5_write_config_data(k5_config_data * d) {
                         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,
@@ -850,10 +850,6 @@ k5_write_config_data(k5_config_data * d) {
 
                     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 {
@@ -861,8 +857,6 @@ k5_write_config_data(k5_config_data * d) {
                                                      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;
index af2d997c87075cef4731a82bc5d585fb06ffd988..dab522c5dcd30ec51cee924f760a73b4d98e6e6b 100644 (file)
@@ -568,12 +568,12 @@ _exit:
     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
@@ -581,11 +581,20 @@ khm_krb5_list_tickets(krb5_context *krbv5Context)
     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
@@ -594,12 +603,6 @@ khm_krb5_list_tickets(krb5_context *krbv5Context)
     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
@@ -623,6 +626,8 @@ khm_krb5_list_tickets(krb5_context *krbv5Context)
         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
@@ -730,11 +735,11 @@ khm_krb5_renew_ident(khm_handle identity)
     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
@@ -1620,7 +1625,7 @@ khm_krb5_ms2mit(BOOL save_creds)
     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
index f12e6a9b97f96f80ac0f7533b5737f45eb8bb1e4..f52e3441ddb167a60bd39c95ea48d0f04844e776 100644 (file)
@@ -1248,6 +1248,28 @@ k5_ident_exit(khm_int32 msg_type,
     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
@@ -1292,8 +1314,10 @@ k5_msg_ident(khm_int32 msg_type,
         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
@@ -1335,6 +1359,12 @@ k5_msg_ident(khm_int32 msg_type,
     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
index c896537794c830a1f06d22e781e613d929d8b2f3..daa80b84528f653e2993543da796430bf0c945e5 100644 (file)
@@ -1109,11 +1109,16 @@ k5_read_dlg_params(khm_handle conf,
 {\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
@@ -1712,7 +1717,7 @@ k5_msg_cred_dialog(khm_int32 msg_type,
             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
index 03c430060a4ed4e78fb411c7ce1ce80739666ba4..71edb2688d88cb96dbfb0211c0688168ba0c127f 100644 (file)
@@ -24,6 +24,7 @@
 \r
 /* $Id$ */\r
 \r
+#include<shlwapi.h>\r
 #include<khmapp.h>\r
 #include<assert.h>\r
 \r
@@ -267,8 +268,61 @@ khm_cfg_general_proc(HWND hwnd,
         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
index 26a60e5e0f7c822751be20d29f956fa8aa73607e..3297b05be7e93a9c775cd3cbdb65497b1ed03d74 100644 (file)
@@ -429,9 +429,22 @@ write_params_ident(ident_data * d) {
     }\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
@@ -699,6 +712,136 @@ refresh_view_idents_state(HWND hwnd) {
                             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
@@ -795,6 +938,14 @@ khm_cfg_ids_tab_proc(HWND hwnd,
             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
@@ -834,6 +985,7 @@ khm_cfg_ids_tab_proc(HWND hwnd,
     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
@@ -960,6 +1112,8 @@ refresh_data_ident(HWND hwnd, khui_config_init_data * idata) {
     }\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
@@ -1061,6 +1215,7 @@ khm_cfg_id_tab_proc(HWND hwnd,
     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
index a7da446772d99810e0ea3f27d92de3e48758ab7d..5059dba28b44d4ced7cb05b814dc711f836d210e 100644 (file)
@@ -402,13 +402,16 @@ static void
 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
@@ -664,7 +667,12 @@ cfgui_dlgproc(HWND hwnd,
             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
@@ -717,6 +725,7 @@ void khm_refresh_config(void) {
     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
@@ -794,6 +803,29 @@ void khm_refresh_config(void) {
         }\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
index e09791e7be2ae477ef8cf6fa4adae30a3dc03bc2..937e82ff9773ce15a44f54288a84318601fcfa35 100644 (file)
@@ -805,7 +805,7 @@ khm_cred_dispatch_process_message(khui_new_creds *nc)
 }\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
@@ -818,6 +818,11 @@ khm_cred_process_commandline(void) {
         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
@@ -841,21 +846,34 @@ khm_cred_process_commandline(void) {
         }\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
@@ -864,15 +882,15 @@ khm_cred_process_commandline(void) {
                                  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
@@ -886,9 +904,8 @@ khm_cred_process_commandline(void) {
                     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
@@ -899,6 +916,8 @@ khm_cred_process_commandline(void) {
             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
@@ -907,7 +926,7 @@ khm_cred_process_commandline(void) {
 }\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
@@ -932,7 +951,7 @@ khm_cred_begin_commandline(void) {
     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
index fe8ed6c2570584a3c3b7042692640fc6228cdef3..677d27945d4139e2df9adf2bd302a903b49ea958 100644 (file)
@@ -66,10 +66,10 @@ khm_cred_wait_for_dialog(DWORD timeout, khm_int32 * result,
                          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
index 1289561e44b2ebfb7d5dc011795c25d9466cdc59..b68a3f953f19f8b28d0db921f0f3e35f15c0eddc 100644 (file)
@@ -399,7 +399,6 @@ cw_load_view(khui_credwnd_tbl * tbl, wchar_t * view, HWND hwnd) {
     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
@@ -1539,7 +1538,7 @@ cw_get_cell_height(HDC hdc, HFONT hf) {
     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
@@ -1717,7 +1716,7 @@ cw_erase_rect(HDC hdc,
             break;\r
 \r
         default:\r
-                return;\r
+            return;\r
         }\r
 \r
         if(tbl->kbm_logo_shade.cx != -1 && type == CW_ER_BLANK) {\r
@@ -1727,6 +1726,8 @@ cw_erase_rect(HDC hdc,
             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
@@ -1737,7 +1738,7 @@ cw_erase_rect(HDC hdc,
             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
@@ -2145,6 +2146,7 @@ cw_handle_header_msg(khui_credwnd_tbl * tbl, LPNMHEADER ph) {
                     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
@@ -2167,7 +2169,7 @@ cw_handle_header_msg(khui_credwnd_tbl * tbl, LPNMHEADER ph) {
                     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
@@ -2327,7 +2329,7 @@ cw_wm_paint(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
     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
@@ -4244,7 +4246,7 @@ cw_wm_command(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
     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
@@ -4303,7 +4305,7 @@ cw_wm_command(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
     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
index 0ad9c880f48e7938c543272cb5bb716929f09ff1..a9472585b4f6eb1fde09dba5ed40b411d1a32428 100644 (file)
@@ -143,7 +143,7 @@ static LONG table_lookup(struct tx_tbl_t * tbl, int n, wchar_t * v, int len)
     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
@@ -344,7 +344,7 @@ static int htw_parse_tag(
     /* 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
@@ -368,9 +368,9 @@ static int htw_parse_tag(
             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, &param_start, &param_len);\r
             }\r
         }\r
@@ -421,7 +421,7 @@ static int htw_parse_tag(
             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
@@ -435,15 +435,15 @@ static int htw_parse_tag(
             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
@@ -458,57 +458,56 @@ static int htw_parse_tag(
             *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
@@ -521,9 +520,9 @@ static int htw_parse_tag(
             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
@@ -539,9 +538,9 @@ static int htw_parse_tag(
         }\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
@@ -549,7 +548,7 @@ static int htw_parse_tag(
         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
@@ -570,7 +569,7 @@ static int htw_parse_tag(
 \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
@@ -1051,7 +1050,7 @@ void khm_register_htwnd_class(void)
 \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
@@ -1059,7 +1058,7 @@ HWND khm_create_htwnd(HWND parent, LPWSTR text, int x, int y, int width, int hei
 \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
index ceba01f5a118e8041e0ce6df0cd01e44b3aa5536..5a795dd994c8ffaa7ddf66d185a3590604cf20db 100644 (file)
@@ -287,8 +287,9 @@ BEGIN
     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
@@ -382,6 +383,7 @@ BEGIN
     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
@@ -396,8 +398,7 @@ BEGIN
                     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
@@ -442,6 +443,18 @@ BEGIN
     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
@@ -578,6 +591,14 @@ BEGIN
         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
@@ -786,6 +807,13 @@ BEGIN
     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
index 6987db3ef4a750d2494dd4b270508fe22acf85d9..cad5dc5667db1c0f41dbb97796b6df0d14cc08e4 100644 (file)
@@ -118,6 +118,12 @@ void khm_parse_commandline(void) {
             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
@@ -552,9 +558,9 @@ int WINAPI WinMain(HINSTANCE hInstance,
         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
index 81886fa8e95bf674fb2be5e2652d1fab19406426..bc9b1cec768d8793b59b00ce59036eef341f03a4 100644 (file)
@@ -522,10 +522,10 @@ khm_main_wnd_proc(HWND hwnd,
                 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
@@ -594,7 +594,7 @@ khm_main_wnd_proc(HWND hwnd,
             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
index 3730a3c6e25eb8804826e86d5c5656d1b051dcf3..56c79294bc7d14f0e3342cc835d921677dabf433 100644 (file)
@@ -803,6 +803,8 @@ nc_add_control_row(khui_nc_wnd_data * d,
         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
@@ -1250,7 +1252,7 @@ static LRESULT nc_handle_wm_nc_notify(HWND hwnd,
                       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
index 30f67755ae132bde2d9b083708ba56b08c0c3423..77e9dcee1ba70d4eec61c1da485762317bcfe572 100644 (file)
 #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
index 9a2f8e79c93db9646a3fd23ee97e43f45bb700d6..5bcf2c2a5133e40b7fa78ca30a40c1cf15a53660 100644 (file)
@@ -25,6 +25,9 @@
 /* $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
@@ -88,19 +91,25 @@ khui_statusbar_set_parts(HWND parent) {
 \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
index ae8cd2f7c38a90b0106db00c8e89100166e29415..9aa88cd287cdb10f472d5a485d542fb0b17189ad 100644 (file)
@@ -190,6 +190,12 @@ khui_cfg_register(khui_config_node vparent,
 \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
@@ -254,6 +260,12 @@ khui_cfg_remove(khui_config_node vnode) {
     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
index 082f9f25748effb2159b9c81d9437a34d5d9be82..154ed18eb4ddff3ab20108207b7741920638ceb9 100644 (file)
@@ -322,8 +322,8 @@ cw_create_prompt(khm_size idx,
                  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
index f124b513f381a81aef428058d1dd1cfaf9e62d5c..1d09fae9ea0c7649cf3bc0f6a07e4bcec5b8d6dc 100644 (file)
@@ -77,6 +77,11 @@ enum khui_wm_cfg_notifications {
       '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
index 75bab017432afd0df1eb4a4e7a6f555d25e5db25..b642d1af88382bbf463a8e0ed963759a936dadbf 100644 (file)
@@ -190,12 +190,12 @@ multi_string_find(const wchar_t * ms,
 \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
index d686a8e80ab28de35f9df0adcace74bd5368f33b..d811eb99dafb6af12494bc6b6928f848fe91e32a 100644 (file)
@@ -49,11 +49,15 @@ KHMEXP void KHMAPI InitializeRwLock(PRWLOCK pLock)
 \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
@@ -93,7 +97,6 @@ KHMEXP void KHMAPI LockObtainWrite(PRWLOCK pLock)
        pLock->writer == GetCurrentThreadId()) {\r
         pLock->locks++;\r
         LeaveCriticalSection(&(pLock->cs));\r
-        assert(FALSE);\r
         return;\r
     }\r
     LeaveCriticalSection(&(pLock->cs));\r
@@ -108,6 +111,7 @@ KHMEXP void KHMAPI LockObtainWrite(PRWLOCK pLock)
     pLock->locks++;\r
     pLock->writer = GetCurrentThreadId();\r
     ResetEvent(pLock->readwx);\r
+    ResetEvent(pLock->writewx);\r
     LeaveCriticalSection(&(pLock->cs));\r
 }\r
 \r