pull up r18212 from trunk
authorTom Yu <tlyu@mit.edu>
Fri, 21 Jul 2006 23:27:46 +0000 (23:27 +0000)
committerTom Yu <tlyu@mit.edu>
Fri, 21 Jul 2006 23:27:46 +0000 (23:27 +0000)
 r18212@cathode-dark-space:  jaltman | 2006-06-25 15:21:41 -0400
 ticket: new
 subject: NetIDMgr updates

 * add scrollbars to option tree pane in configuration dialog

 * convert to using Microsoft's safe string library both to ensure
   safe string manipulation and to avoid deprecation warnings

 * disable deprecation warnings for Platform SDK header shlwapi.h
   which cannot otherwise be compiled

 * add kerberos 5 kvno property to tickets.  display in properties
   dialog and main window if column selected by user

 * improve manifest handling in order to support both manifests
   generated by the compiler and those hand crafted in order to
   specify the correct versions of the custom control libraries.

 * update khimaira message types and credential acquisition
   documentation

ticket: 3938

git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-5@18361 dc483132-0cff-0310-8789-dd5450dbe970

40 files changed:
src/windows/identity/apiversion.txt
src/windows/identity/config/Makefile.w2k
src/windows/identity/config/Makefile.w32
src/windows/identity/include/khmsgtypes.h
src/windows/identity/kconfig/api.c
src/windows/identity/kcreddb/credential.c
src/windows/identity/kcreddb/credtype.c
src/windows/identity/kcreddb/type.c
src/windows/identity/nidmgrdll/Makefile
src/windows/identity/plugins/common/krb5common.c
src/windows/identity/plugins/common/krb5common.h
src/windows/identity/plugins/krb4/Makefile
src/windows/identity/plugins/krb4/errorfuncs.c
src/windows/identity/plugins/krb4/krb4funcs.c
src/windows/identity/plugins/krb4/krb4newcreds.c
src/windows/identity/plugins/krb5/Makefile
src/windows/identity/plugins/krb5/datarep.c
src/windows/identity/plugins/krb5/datarep.h
src/windows/identity/plugins/krb5/krb5configcc.c
src/windows/identity/plugins/krb5/krb5configdlg.c
src/windows/identity/plugins/krb5/krb5configid.c
src/windows/identity/plugins/krb5/krb5configids.c
src/windows/identity/plugins/krb5/krb5funcs.c
src/windows/identity/plugins/krb5/krb5identpro.c
src/windows/identity/plugins/krb5/krb5main.c
src/windows/identity/plugins/krb5/krbcred.h
src/windows/identity/plugins/krb5/lang/en_us/langres.rc
src/windows/identity/plugins/krb5/langres.h
src/windows/identity/ui/Makefile
src/windows/identity/ui/credwnd.c
src/windows/identity/ui/debugfuncs.c
src/windows/identity/ui/htwnd.c
src/windows/identity/ui/htwnd.h
src/windows/identity/ui/newcredwnd.c
src/windows/identity/uilib/action.c
src/windows/identity/uilib/alert.c
src/windows/identity/uilib/configui.c
src/windows/identity/uilib/creddlg.c
src/windows/identity/uilib/khnewcred.h
src/windows/identity/util/perfstat.c

index 008510fba06e4d1c75e53df6f7a9fa007c33742d..72456acd3ab5464729d987891de355464be9e8bf 100644 (file)
@@ -120,15 +120,41 @@ Date=(TBD)
 # Flag for error events to signal that the error event has been committed.\r
 \r
 +khui_action_trigger()\r
+# Function for triggerring an action.\r
 \r
 +khui_action_set_hwnd()\r
+# internal API.  Should not be used by anyone.  Basically sets the HWND that should receive event notifications from the UI library.\r
 \r
 +KEPT_PTR\r
+# error library data type for pointers\r
 \r
 +_cptr\r
+# type cast macro for pointer types\r
 \r
 !khc_open_space\r
 # name parameter is now a const string\r
 \r
 !KCDB_ATTRNAME_ISSUE\r
-# Fixed typo
\ No newline at end of file
+# Fixed typo\r
+\r
+!kherr_val\r
+# is now an inline function instead of a macro\r
+\r
+!kherr_param\r
+# is now a structure instead of an integer type\r
+\r
++KEPT_NONE\r
+# new constant signifying a NULL parameter\r
+\r
+!_int32, _uint32, _int64, _uint64, _cstr, _tstr, _cptr\r
+# appropriate typecasts added\r
+\r
++vnull\r
+# macro to insert a NULL parameter\r
+\r
+!_report_cs0, _report_cs1, _report_cs2, _report_cs3\r
+!_report_sr0, _report_sr1, _report_sr2, _report_sr3\r
+!_report_mr0, _report_mr1, _report_mr2, _report_mr3\r
+!_report_ts0, _report_ts1, _report_ts2, _report_ts3\r
+# modified to use _vnull() instead of 0 for NULL parameters\r
+\r
index 81c33546aebde4275a8bd24a84c850d56a58e3e8..4ea6b8856e44932d6d844d9604683b3bc2ed1c2a 100644 (file)
@@ -211,11 +211,20 @@ khcwarn=$(khcwarn) /WX
 ldebug=$(ldebug) /DEBUG\r
 cdebug=$(cdebug) -Os -Zi\r
 \r
+# Additionally, suppress conflicting default library directives that we\r
+# might pull in from external libraries.\r
+\r
+!ifndef NODEBUG\r
+lndeflibflag=/NODEFAULTLIB:MSVCRT\r
+!else\r
+lndeflibflag=/NODEFAULTLIB:MSVCRTD\r
+!endif\r
+\r
 khcflags=$(cdebug) $(cflags) $(incflags) $(khdefines) $(khcwarn)\r
-khlguiflags=$(ldebug) $(guilflags)\r
-khlconflags=$(ldebug) $(conlflags)\r
-khldllguiflags=$(ldebug) $(dlllflags)\r
-khldllconflags=$(ldebug) $(dlllflags)\r
+khlguiflags=$(ldebug) $(guilflags) $(lndeflibflag)\r
+khlconflags=$(ldebug) $(conlflags) $(lndeflibflag)\r
+khldllguiflags=$(ldebug) $(dlllflags) $(lndeflibflag)\r
+khldllconflags=$(ldebug) $(dlllflags) $(lndeflibflag)\r
 \r
 !if "$(KH_RUNTIME)" == "STATIC"\r
 khcflags=$(khcflags) $(cvarsmt)\r
index ed966d7b51280abc42e543e131f0cb4ad289deec..503e44dc1dbe680ca9e73fd97264b7a1b6fdaeb1 100644 (file)
@@ -224,11 +224,20 @@ khcwarn=$(khcwarn) /WX
 ldebug=$(ldebug) /DEBUG\r
 cdebug=$(cdebug) -Os -Zi\r
 \r
+# Additionally, suppress conflicting default library directives that we\r
+# might pull in from external libraries.\r
+\r
+!ifndef NODEBUG\r
+lndeflibflag=/NODEFAULTLIB:MSVCRT\r
+!else\r
+lndeflibflag=/NODEFAULTLIB:MSVCRTD\r
+!endif\r
+\r
 khcflags=$(cdebug) $(cflags) $(incflags) $(khdefines) $(khcwarn)\r
-khlguiflags=$(ldebug) $(guilflags)\r
-khlconflags=$(ldebug) $(conlflags)\r
-khldllguiflags=$(ldebug) $(dlllflags)\r
-khldllconflags=$(ldebug) $(dlllflags)\r
+khlguiflags=$(ldebug) $(guilflags) $(lndeflibflag)\r
+khlconflags=$(ldebug) $(conlflags) $(lndeflibflag)\r
+khldllguiflags=$(ldebug) $(dlllflags) $(lndeflibflag)\r
+khldllconflags=$(ldebug) $(dlllflags) $(lndeflibflag)\r
 \r
 !if "$(KH_RUNTIME)" == "STATIC"\r
 khcflags=$(khcflags) $(cvarsmt)\r
@@ -294,4 +303,28 @@ etag::
 \r
 .SUFFIXES: .h\r
 \r
+#\r
+# Manifest handling\r
+#\r
+# Starting with Visual Studio 8, the C compiler and the linker\r
+# generate manifests so that the applications will link with the\r
+# correct side-by-side DLLs at run-time.  These are required for\r
+# correct operation under Windows XP.  We also have custom manifests\r
+# which need to be merged with the manifests that VS creates.\r
+#\r
+# The syntax for invoking the _VC_MANIFEST_EMBED_foo macro is:\r
+# $(_VC_MANIFEST_EMBED_???) <any additional manifests that need to be merged in>\r
+#\r
+\r
+!ifndef MT\r
+MT=mt.exe -nologo\r
+!endif\r
+\r
+_VC_MANIFEST_EMBED_EXE= \\r
+if exist $@.manifest $(MT) -outputresource:$@;1 -manifest $@.manifest\r
+\r
+_VC_MANIFEST_EMBED_DLL=$(_VC_MANIFEST_EMBED_EXE)\r
+\r
+# End of manifest handling\r
+\r
 !endif\r
index b590e056bbf8d0b7a6dbe863663f9eb7e75ed667..686a9717f697c9416273bfa2236938f6e885da77 100644 (file)
     This message notifies credentials providers that a password change\r
     request has been received.\r
 \r
+    A plug-in handling this message that wishes to participate in the\r
+    password change operation is expected to add a\r
+    ::khui_new_creds_by_type to the list of participants in the\r
+    ::khui_new_creds structure by calling khui_cw_add_type().\r
+\r
+    The password change operation requires user interaction.  Any\r
+    plug-ins that are participating in the operation need to provide a\r
+    user-interface.\r
+\r
     Message parameters:\r
     - \b vparam : pointer to a ::khui_new_creds structure\r
+\r
+    \see khui_cw_add_type(), ::khui_new_creds, ::khui_new_creds_by_type\r
  */\r
 #define KMSG_CRED_PASSWORD  16\r
 \r
 /*! \brief Initiate the process of obtaining new credentials\r
 \r
     The UI sends this message to start the process of obtaining new\r
-    credentials.  See \ref cred_acq for more information about handling this\r
-    message.\r
+    credentials.  See \ref cred_acq for more information about\r
+    handling this message.\r
+\r
+    A plug-in handling this message that wishes to participate in the\r
+    new credentials acquisition operation is expected to add a\r
+    ::khui_new_creds_by_type to hte list of participants in the\r
+    ::khui_new_creds structure by calling khui_cw_add_type().\r
 \r
     Message parameters:\r
     - \b vparam : pointer to a ::khui_new_creds structure\r
 \r
-    \see \ref cred_acq\r
+    \see \ref cred_acq, khui_cw_add_type(), ::khui_new_creds,\r
+    ::khui_new_creds_by_type\r
  */\r
 #define KMSG_CRED_NEW_CREDS 17\r
 \r
     This is a notification sent to individual credentials providers\r
     that a specified identity's credentials should be renewed.\r
 \r
+    A plug-in handling this message that wishes to participate in the\r
+    renew credentials operation is expected to add a\r
+    ::khui_new_creds_by_type to the list of participants in the\r
+    ::khui_new_creds structure by calling khui_cw_add_type().\r
+\r
     Message parameters:\r
     - \b vparam : Pointer to a khui_new_creds object\r
+\r
+    \see khui_cw_add_type(), ::khui_new_creds,\r
+    ::khui_new_creds_by_type\r
  */\r
 #define KMSG_CRED_RENEW_CREDS       18\r
 \r
     dialog completion.\r
 \r
     Currently, the dialog messages are:\r
-    - ::KMSG_CRED_INITIAL_CREDS\r
     - ::KMSG_CRED_NEW_CREDS\r
     - ::KMSG_CRED_RENEW_CREDS\r
     - ::KMSG_CRED_DIALOG_SETUP\r
index 83aa0657cd2efb71bf79ab7a6e93b4e76e9aedcb..ef182fe32c6514dd40df79843ef22052ec1638a9 100644 (file)
@@ -677,6 +677,7 @@ khcint_open_space(kconf_conf_space * parent,
     HKEY pkey = NULL;\r
     HKEY ckey = NULL;\r
     wchar_t buf[KCONF_MAXCCH_NAME];\r
+    size_t cb_regpath = 0;\r
 \r
     if(!parent)\r
         p = conf_root;\r
@@ -686,10 +687,7 @@ khcint_open_space(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
-    wcsncpy(buf, sname, n_sname);\r
-    buf[n_sname] = L'\0';\r
+    StringCchCopyN(buf, ARRAYLENGTH(buf), sname, n_sname);\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\r
@@ -760,19 +758,18 @@ khcint_open_space(kconf_conf_space * parent,
     /*SAFE: p->regpath: is valid since it was set using this same\r
       function. */\r
     /*SAFE: buf: see above */\r
-    c->regpath = PMALLOC((wcslen(p->regpath) + wcslen(buf) + 2) * sizeof(wchar_t));\r
+    cb_regpath = (wcslen(p->regpath) + wcslen(buf) + 2) * sizeof(wchar_t);\r
+    c->regpath = PMALLOC(cb_regpath);\r
 \r
     assert(c->regpath != NULL);\r
 \r
-#pragma warning( push )\r
-#pragma warning( disable: 4995 )\r
     /*SAFE: c->regpath: allocated above to be big enough */\r
     /*SAFE: p->regpath: see above */\r
-    wcscpy(c->regpath, p->regpath);\r
-    wcscat(c->regpath, L"\\");\r
+    StringCbCopy(c->regpath, cb_regpath, p->regpath);\r
+    StringCbCat(c->regpath, cb_regpath, L"\\");\r
+\r
     /*SAFE: buf: see above */\r
-    wcscat(c->regpath, buf);\r
-#pragma warning( pop )\r
+    StringCbCat(c->regpath, cb_regpath, buf);\r
 \r
     khcint_space_hold(c);\r
 \r
index 6886cc5b6c0516b9e2d2df5fb43cbf881b7cfc8c..98854dab46dfe7b9dad9ba4058ad864a01bae792 100644 (file)
@@ -943,12 +943,18 @@ kcdb_creds_is_equal(khm_handle vcred1,
 \r
     kcdb_cred_lock_read();\r
     if(!kcdb_cred_is_active_cred(vcred1) ||\r
-       !kcdb_cred_is_active_cred(vcred2))\r
+       !kcdb_cred_is_active_cred(vcred2)) {\r
+\r
+        code = FALSE;\r
         goto _exit;\r
 \r
+    }\r
+\r
     if(vcred1 == vcred2) {\r
+\r
         code = TRUE;\r
         goto _exit;\r
+\r
     }\r
 \r
     cred1 = vcred1;\r
index e57b22b5309ebfde62d7e1edea2c479c195317e1..89e0175f008593f9d3f761214c362b9fe0778261 100644 (file)
@@ -281,11 +281,7 @@ KHMEXP khm_int32 KHMAPI kcdb_credtype_describe(
             *cbbuf = s;\r
             rv = KHM_ERROR_TOO_LONG;\r
         } else {\r
-#pragma warning(push)\r
-#pragma warning(disable:4995)\r
-            wcscpy(buf, str); /* str is one of the string fields in t->ct which has \r
-                              been validated when the type was registered. */\r
-#pragma warning(pop)\r
+            StringCbCopy(buf, *cbbuf, str);\r
             *cbbuf = s;\r
         }\r
     } else {\r
@@ -321,10 +317,7 @@ KHMEXP khm_int32 KHMAPI kcdb_credtype_get_name(
             *cbbuf = s;\r
             rv = KHM_ERROR_TOO_LONG;\r
         } else {\r
-#pragma warning(push)\r
-#pragma warning(disable: 4995)\r
-            wcscpy(buf, t->ct.name); /* t->ct.name was validated when the type was registered */\r
-#pragma warning(pop)\r
+            StringCbCopy(buf, *cbbuf, t->ct.name);\r
             *cbbuf = s;\r
         }\r
     } else {\r
index baf5f9730dc9f7a85cc464d5f6cf78df5d4a5246..c1215f583425b506e50cff5a5e5339573f6cee99 100644 (file)
@@ -391,9 +391,11 @@ FtIntervalToString(LPFILETIME data, wchar_t * buffer, khm_size * cb_buf)
             t = ibuf + wcslen(ibuf);\r
             if(h == 1)\r
             {\r
-                LoadString(hinst_kcreddb, IDS_IVL_1H, t, ARRAYLENGTH(ibuf) - wcslen(ibuf));\r
+                LoadString(hinst_kcreddb, IDS_IVL_1H, t,\r
+                           (int) (ARRAYLENGTH(ibuf) - wcslen(ibuf)));\r
             } else {\r
-                LoadString(hinst_kcreddb, IDS_IVL_H, fbuf, ARRAYLENGTH(fbuf));\r
+                LoadString(hinst_kcreddb, IDS_IVL_H, fbuf,\r
+                           (int) ARRAYLENGTH(fbuf));\r
                 StringCbPrintf(t, sizeof(ibuf) - wcslen(ibuf)*sizeof(wchar_t), fbuf, h);\r
             }\r
         }\r
@@ -415,9 +417,11 @@ FtIntervalToString(LPFILETIME data, wchar_t * buffer, khm_size * cb_buf)
             t = ibuf + wcslen(ibuf);\r
             if(m == 1)\r
             {\r
-                LoadString(hinst_kcreddb, IDS_IVL_1M, t, ARRAYLENGTH(ibuf) - wcslen(ibuf));\r
+                LoadString(hinst_kcreddb, IDS_IVL_1M, t,\r
+                           (int) (ARRAYLENGTH(ibuf) - wcslen(ibuf)));\r
             } else {\r
-                LoadString(hinst_kcreddb, IDS_IVL_M, fbuf, ARRAYLENGTH(fbuf));\r
+                LoadString(hinst_kcreddb, IDS_IVL_M, fbuf,\r
+                           (int) ARRAYLENGTH(fbuf));\r
                 StringCbPrintf(t, sizeof(ibuf) - wcslen(ibuf)*sizeof(wchar_t), fbuf, m);\r
             }\r
         }\r
@@ -434,9 +438,11 @@ FtIntervalToString(LPFILETIME data, wchar_t * buffer, khm_size * cb_buf)
             t = ibuf + wcslen(ibuf);\r
             if(s == 1)\r
             {\r
-                LoadString(hinst_kcreddb, IDS_IVL_1S, t, ARRAYLENGTH(ibuf) - wcslen(ibuf));\r
+                LoadString(hinst_kcreddb, IDS_IVL_1S, t,\r
+                           (int) (ARRAYLENGTH(ibuf) - wcslen(ibuf)));\r
             } else {\r
-                LoadString(hinst_kcreddb, IDS_IVL_S, fbuf, ARRAYLENGTH(fbuf));\r
+                LoadString(hinst_kcreddb, IDS_IVL_S, fbuf,\r
+                           (int) ARRAYLENGTH(fbuf));\r
                 StringCbPrintf(t, sizeof(ibuf) - wcslen(ibuf)*sizeof(wchar_t), fbuf, s);\r
             }\r
         }\r
index d3f50021c6b5de1ee89f9a9008e86a8cd5200d07..701a79d7de06699a2832f9fabec12690b8e92f75 100644 (file)
@@ -113,8 +113,10 @@ SCLIB=
 
 $(DLLFILE): $(OBJFILES) $(RESFILES)
        $(DLLGUILINK) $(LIBFILES) $(SDKLIBFILES) $(SCLIB)
+       $(_VC_MANIFEST_EMBED_DLL)
 
 all: mkdirs $(DLLFILE)
 
 clean::
        $(RM) $(DLLFILE)
+       $(RM) $(DLLFILE).manifest
index de1cea4abf9c8faa41465c7bda0669545ed44b26..5ba59df4e7d3dffac935380c700ff81ccac80e03 100644 (file)
@@ -31,6 +31,7 @@
 #ifdef DEBUG\r
 #include<assert.h>\r
 #endif\r
+#include<strsafe.h>\r
 \r
 /**************************************/\r
 /* khm_krb5_error():           */\r
index bd6337192a77481b03955cf9660b0a50541a81e4..df3db93ae14f5a67fd3915188bbbd0f8a9ccf171 100644 (file)
 \r
 #ifndef NO_KRB5\r
 int khm_krb5_error(krb5_error_code rc, LPCSTR FailedFunctionName, \r
-                     int FreeContextFlag, krb5_context *ctx,\r
-                     krb5_ccache *cache);\r
+                   int FreeContextFlag, krb5_context *ctx,\r
+                   krb5_ccache *cache);\r
 \r
+int\r
+khm_krb5_get_error_string(krb5_error_code rc,\r
+                          wchar_t * buffer,\r
+                          khm_size cb_buffer);\r
 \r
 int khm_krb5_initialize(khm_handle ident, krb5_context *, krb5_ccache *);\r
 \r
index b1ad963f080ab0448f61f9bd75414ca45c11fb31..c5226aaaa07d33000a1f02d692746adccfbd708a 100644 (file)
@@ -70,6 +70,7 @@ $(OBJ)\krb4config.c: krbconfig.csv $(CONFDIR)\csvschema.cfg
 
 $(DLLFILE): $(OBJFILES) $(VERRESFILE) $(MSGRESFILE)
        $(DLLGUILINK) $(LIBFILES) $(SDKLIBFILES) $(SCLIB)
+       $(_VC_MANIFEST_EMBED_DLL)
 
 all: mkdirs $(MSGRESFILE) $(DLLFILE) lang
 
index 5adc66b9143ebd50ff8b66d20d5a800d07c324ca..f1aa63d88b87806c173e4b97e7966524e02f94c7 100644 (file)
@@ -27,6 +27,8 @@
 #include<krbcred.h>\r
 #include<kherror.h>\r
 \r
+#include<strsafe.h>\r
+\r
 extern void (__cdecl *pinitialize_krb_error_func)();\r
 extern void (__cdecl *pinitialize_kadm_error_table)();\r
 \r
@@ -89,8 +91,7 @@ LPSTR err_describe(LPSTR buf, size_t len, long code)
     case kadm_err_base:\r
        break;\r
     default:\r
-       strncpy(buf, com_err_msg, len);\r
-       buf[len-1] = '\0';\r
+        StringCbCopyA(buf, len, com_err_msg);\r
        return buf;\r
     }\r
 \r
@@ -194,8 +195,7 @@ LPSTR err_describe(LPSTR buf, size_t len, long code)
             break;\r
         }\r
     if(com_err_msg != buf) {\r
-        strncpy(buf, com_err_msg, len);\r
-       buf[len-1] = '\0';\r
+        StringCbCopyA(buf, len, com_err_msg);\r
     }\r
     cp = buf + strlen(buf);\r
     *cp++ = '\n';\r
index 8928f71fdea924a4019bee9603a258aca0d3b857..18c05981fc499800600663954f12e8eb3bd4059d 100644 (file)
@@ -243,10 +243,10 @@ khm_krb5_get_profile_file(LPSTR confname, UINT szConfname)
     {\r
         GetWindowsDirectoryA(confname,szConfname);\r
         confname[szConfname-1] = '\0';\r
-               strncat(confname, "\\",sizeof(confname)-strlen(confname));\r
-        confname[szConfname-1] = '\0';\r
-               strncat(confname, KRB5_FILE,sizeof(confname)-strlen(confname));\r
-        confname[szConfname-1] = '\0';\r
+\r
+        StringCchCatA(confname, szConfname, "\\");\r
+        StringCchCatA(confname, szConfname, KRB5_FILE);\r
+\r
         return FALSE;\r
     }\r
     \r
@@ -254,7 +254,7 @@ khm_krb5_get_profile_file(LPSTR confname, UINT szConfname)
     \r
     if (configFile)\r
     {\r
-        strncpy(confname, *configFile, szConfname);\r
+        StringCchCopyA(confname, szConfname, *configFile);\r
         pkrb5_free_config_files(configFile); \r
     }\r
     \r
@@ -262,10 +262,9 @@ khm_krb5_get_profile_file(LPSTR confname, UINT szConfname)
     {\r
         GetWindowsDirectoryA(confname,szConfname);\r
         confname[szConfname-1] = '\0';\r
-               strncat(confname, "\\",sizeof(confname)-strlen(confname));\r
-        confname[szConfname-1] = '\0';\r
-               strncat(confname, KRB5_FILE,sizeof(confname)-strlen(confname));\r
-        confname[szConfname-1] = '\0';\r
+\r
+        StringCchCatA(confname, szConfname, "\\");\r
+        StringCchCatA(confname, szConfname, KRB5_FILE);\r
     }\r
     \r
     return FALSE;\r
@@ -274,51 +273,41 @@ khm_krb5_get_profile_file(LPSTR confname, UINT szConfname)
 BOOL\r
 khm_get_krb4_con_file(LPSTR confname, UINT szConfname)\r
 {\r
-    if (hKrb5 && !hKrb4)\r
-       { // hold krb.con where krb5.ini is located\r
-            CHAR krbConFile[MAX_PATH]="";\r
-            LPSTR pFind;\r
+    if (hKrb5 && !hKrb4) {\r
+        // hold krb.con where krb5.ini is located\r
+        CHAR krbConFile[MAX_PATH]="";\r
+        LPSTR pFind;\r
 \r
-           //strcpy(krbConFile, CLeashApp::m_krbv5_profile->first_file->filename);\r
-            if (khm_krb5_get_profile_file(krbConFile, sizeof(krbConFile)))     \r
-                {\r
-                   GetWindowsDirectoryA(krbConFile,sizeof(krbConFile));\r
-                    krbConFile[MAX_PATH-1] = '\0';\r
-                    strncat(krbConFile, "\\",sizeof(krbConFile)-strlen(krbConFile));\r
-                    krbConFile[MAX_PATH-1] = '\0';\r
-                    strncat(krbConFile, KRB5_FILE,sizeof(krbConFile)-strlen(krbConFile));\r
-                    krbConFile[MAX_PATH-1] = '\0';\r
-                }\r
+        if (khm_krb5_get_profile_file(krbConFile, sizeof(krbConFile))) {\r
+            GetWindowsDirectoryA(krbConFile,sizeof(krbConFile));\r
+            krbConFile[MAX_PATH-1] = '\0';\r
 \r
-            pFind = strrchr(krbConFile, '\\');\r
-            if (pFind)\r
-               {\r
-                    *pFind = 0;\r
-                    strncat(krbConFile, "\\",sizeof(krbConFile)-strlen(krbConFile));\r
-                    krbConFile[MAX_PATH-1] = '\0';\r
-                    strncat(krbConFile, KRB_FILE,sizeof(krbConFile)-strlen(krbConFile));\r
-                    krbConFile[MAX_PATH-1] = '\0';\r
-               }\r
-            else\r
-                krbConFile[0] = 0;\r
-            \r
-            strncpy(confname, krbConFile, szConfname);\r
+            StringCbCatA(krbConFile, sizeof(krbConFile), "\\");\r
+        }\r
+\r
+        pFind = strrchr(krbConFile, '\\');\r
+\r
+        if (pFind) {\r
+            *pFind = '\0';\r
+\r
+            StringCbCatA(krbConFile, sizeof(krbConFile), "\\");\r
+            StringCbCatA(krbConFile, sizeof(krbConFile), KRB_FILE);\r
+        } else {\r
+            krbConFile[0] = '\0';\r
+        }\r
+\r
+        StringCchCopyA(confname, szConfname, krbConFile);\r
+    } else if (hKrb4) { \r
+        unsigned int size = szConfname;\r
+        memset(confname, '\0', szConfname);\r
+        if (!pkrb_get_krbconf2(confname, &size)) {\r
+            GetWindowsDirectoryA(confname,szConfname);\r
             confname[szConfname-1] = '\0';\r
-       }\r
-    else if (hKrb4)\r
-       { \r
-            unsigned int size = szConfname;\r
-            memset(confname, '\0', szConfname);\r
-            if (!pkrb_get_krbconf2(confname, &size))\r
-               { // Error has happened\r
-                   GetWindowsDirectoryA(confname,szConfname);\r
-                    confname[szConfname-1] = '\0';\r
-                    strncat(confname, "\\",szConfname-strlen(confname));\r
-                    confname[szConfname-1] = '\0';\r
-                    strncat(confname,KRB_FILE,szConfname-strlen(confname));\r
-                    confname[szConfname-1] = '\0';\r
-               }\r
-       }\r
+            StringCchCatA(confname, szConfname, "\\");\r
+            StringCchCatA(confname, szConfname, KRB_FILE);\r
+        }\r
+    }\r
+\r
     return FALSE;\r
 }\r
 \r
@@ -433,7 +422,12 @@ wchar_t * khm_krb5_get_realm_list(void)
         wchar_t * d;\r
 \r
         if (!khm_get_krb4_con_file(krb_conf,sizeof(krb_conf)) && \r
-            (file = fopen(krb_conf, "rt")))\r
+#if _MSC_VER >= 1400\r
+            !fopen_s(&file, krb_conf, "rt")\r
+#else\r
+           (file = fopen(krb_conf, "rt"))\r
+#endif\r
+            )\r
         {\r
             char lineBuf[256];\r
 \r
@@ -519,25 +513,32 @@ make_postfix(const char * base,
              const char * postfix,\r
              char ** rcopy)\r
 {\r
-    int base_size;\r
-    int ret_size;\r
+    size_t base_size;\r
+    size_t ret_size;\r
     char * copy = 0;\r
     char * ret = 0;\r
+    size_t t;\r
+\r
+    if (FAILED(StringCbLengthA(base, STRSAFE_MAX_CCH * sizeof(char), &t)))\r
+        goto cleanup;\r
+\r
+    base_size = t + 1;\r
+\r
+    if (FAILED(StringCbLengthA(postfix, STRSAFE_MAX_CCH * sizeof(char), &t)))\r
+        goto cleanup;\r
+\r
+    ret_size = base_size + t + 1;\r
 \r
-    base_size = (int) strlen(base) + 1;\r
-    ret_size = base_size + (int) strlen(postfix) + 1;\r
     copy = malloc(base_size);\r
     ret = malloc(ret_size);\r
 \r
     if (!copy || !ret)\r
         goto cleanup;\r
 \r
-    strncpy(copy, base, base_size);\r
-    copy[base_size - 1] = 0;\r
-\r
-    strncpy(ret, base, base_size);\r
-    strncpy(ret + (base_size - 1), postfix, ret_size - (base_size - 1));\r
-    ret[ret_size - 1] = 0;\r
+    StringCbCopyNA(copy, base_size, base, base_size);\r
+    StringCbCopyNA(ret, ret_size, base, base_size);\r
+    StringCbCopyNA(ret + (base_size - 1), ret_size - (base_size - 1),\r
+                   postfix, ret_size - (base_size - 1));\r
 \r
  cleanup:\r
     if (!copy || !ret) {\r
index b3dd7cea76c087e8faea41eac88f00dc00c8ec2b..407c30fedf914ee30a1cd5a76f92859c978b4959 100644 (file)
@@ -115,10 +115,15 @@ void k4_update_data(k4_dlg_data * d) {
 \r
 khm_boolean k4_should_identity_get_k4(khm_handle ident) {\r
     khm_int32 idflags = 0;\r
+    khm_int32 t = TRUE;\r
     khm_handle csp_ident = NULL;\r
     khm_handle csp_k4 = NULL;\r
     khm_boolean get_k4 = TRUE;\r
 \r
+    if (KHM_SUCCEEDED(khc_read_int32(csp_params, L"Krb4NewCreds", &t)) &&\r
+        !t)\r
+        return FALSE;\r
+\r
     if (KHM_FAILED(kcdb_identity_get_flags(ident, &idflags)))\r
         return FALSE;\r
 \r
@@ -325,8 +330,7 @@ void k4_handle_wmnc_notify(k4_dlg_data * d,
 \r
             l = (khui_htwnd_link *) lParam;\r
 \r
-            wcsncpy(wid, l->id, l->id_len);\r
-            wid[l->id_len] = 0;\r
+            StringCchCopyN(wid, ARRAYLENGTH(wid), l->id, l->id_len);\r
             wids = wcschr(wid, L':');\r
 \r
             if (!wids)\r
index 67475ee010f6837626b1c280825032e47b66c57d..cfee907b2ad13d33ebe50e68ee61424ae44d5951 100644 (file)
@@ -74,6 +74,7 @@ $(OBJ)\krb5config.c: krbconfig.csv $(CONFDIR)\csvschema.cfg
 
 $(DLLFILE):  $(OBJFILES) $(VERRESFILE) 
        $(DLLGUILINK) $(MSGRESFILE) $(LIBFILES) $(SDKLIBFILES) $(SCLIB)
+       $(_VC_MANIFEST_EMBED_DLL)
 
 $(MSGRESFILE): $(OBJ)\krb5_msgs.rc
 
index 97d629eb4ce9f7409857b97269bc9b81a1eef138..92eabf4daa287bd3718492ba871fefb8cc9bef38 100644 (file)
@@ -274,6 +274,36 @@ krb5flags_toString(const void *d,
     }\r
 }\r
 \r
+khm_int32 KHMAPI\r
+kvno_toString(const void * data, khm_size cbdata,\r
+              wchar_t *destbuf, khm_size *pcbdestbuf,\r
+              khm_int32 flags)\r
+{\r
+    int resid = 0;\r
+    int kvno;\r
+    wchar_t buf[256];\r
+    size_t cblength;\r
+\r
+    if (cbdata != sizeof(khm_int32))\r
+        return KHM_ERROR_INVALID_PARAM;\r
+\r
+    kvno = *((khm_int32 *) data);\r
+\r
+    StringCbPrintf(buf, sizeof(buf), L"#%d", kvno);\r
+\r
+    StringCbLength(buf, ARRAYLENGTH(buf), &cblength);\r
+    cblength += sizeof(wchar_t);\r
+\r
+    if (!destbuf || *pcbdestbuf < cblength) {\r
+        *pcbdestbuf = cblength;\r
+        return KHM_ERROR_TOO_LONG;\r
+    } else {\r
+        StringCbCopy(destbuf, *pcbdestbuf, buf);\r
+        *pcbdestbuf = cblength;\r
+        return KHM_ERROR_SUCCESS;\r
+    }\r
+}\r
+\r
 khm_int32\r
 serialize_krb5_addresses(krb5_address ** a, void * buf, size_t * pcbbuf)\r
 {\r
index eeb6970dade9f9e752e06790462f3551030f8321..90f1923fa00c6fd649b02839ba29957a74a506aa 100644 (file)
@@ -59,6 +59,11 @@ khm_int32 KHMAPI
 krb5flags_toString(const void *, khm_size, wchar_t *,\r
                    khm_size *, khm_int32);\r
 \r
+khm_int32 KHMAPI\r
+kvno_toString(const void * data, khm_size cbdata,\r
+              wchar_t *destbuf, khm_size *pcbdestbuf,\r
+              khm_int32 flags);\r
+\r
 khm_int32 KHMAPI\r
 renew_for_cb(khm_handle cred, khm_int32 id, void * buffer,\r
              khm_size * pcbsize);\r
index 66e7a08d00c7418a313ef56bb795458eddf3d4c3..425d13430f8b6782dcaf07d4935b3031c30b63e0 100644 (file)
 #define _WIN32_WINNT 0x501\r
 #endif\r
 \r
+#define STRSAFE_NO_DEPRECATE\r
+\r
 #include<krbcred.h>\r
 #include<krb5.h>\r
 #include<assert.h>\r
 #include<lm.h>\r
 #include<commctrl.h>\r
-\r
-#pragma warning(push)\r
-#pragma warning(disable: 4995)\r
 #include<shlwapi.h>\r
-#pragma warning(pop)\r
+\r
+#include<strsafe.h>\r
 \r
 typedef struct tag_k5_file_cc {\r
     wchar_t path[MAX_PATH];\r
@@ -97,7 +97,7 @@ void k5_add_file_cc(k5_ccc_data * d, wchar_t * path) {
 \r
     /* see if it's there first */\r
     for (i=0; i < d->n_file_ccs; i++) {\r
-        if(!wcsicmp(d->file_ccs[i].path, path))\r
+        if(!_wcsicmp(d->file_ccs[i].path, path))\r
             return;\r
     }\r
 \r
@@ -232,7 +232,7 @@ BOOL k5_ccc_get_mod(k5_ccc_dlg_data * d) {
 \r
     for (i=0; i < d->work.n_file_ccs; i++) {\r
         for (j=0; j < d->save.n_file_ccs; j++) {\r
-            if (!wcsicmp(d->work.file_ccs[i].path,\r
+            if (!_wcsicmp(d->work.file_ccs[i].path,\r
                          d->save.file_ccs[j].path))\r
                 break;\r
         }\r
@@ -372,7 +372,7 @@ k5_ccconfig_dlgproc(HWND hwnd,
                     return TRUE; /* nothing to add */\r
 \r
                 for (i=0; i < d->work.n_file_ccs; i++) {\r
-                    if (!wcsicmp(path, d->work.file_ccs[i].path)) {\r
+                    if (!_wcsicmp(path, d->work.file_ccs[i].path)) {\r
 \r
                         /* allow the user to correct case, as appropriate */\r
                         StringCbCopy(d->work.file_ccs[i].path,\r
@@ -522,7 +522,7 @@ k5_ccconfig_dlgproc(HWND hwnd,
                                                      LVNI_SELECTED)) != -1) {\r
                     ListView_GetItemText(lv, lv_idx, 0, buf, ARRAYLENGTH(buf));\r
                     for (i=0; i < d->work.n_file_ccs; i++) {\r
-                        if (!wcsicmp(buf, d->work.file_ccs[i].path)) {\r
+                        if (!_wcsicmp(buf, d->work.file_ccs[i].path)) {\r
                             k5_del_file_cc(&d->work, i);\r
                             break;\r
                         }\r
index ad64d488338a3f6c16e5dd22d9ca9eba76857c49..65f010840e997598670f49c48aa166c2fc8a3eaa 100644 (file)
 
 /* $Id$ */
 
+#define STRSAFE_NO_DEPRECATE
+
 #include<krbcred.h>
 #include<krb5.h>
 #include<assert.h>
 #include<lm.h>
 #include<commctrl.h>
-
-#pragma warning(push)
-#pragma warning(disable: 4995)
 #include<shlwapi.h>
-#pragma warning(pop)
 
+#include<strsafe.h>
 
 typedef struct tag_k5_realm_kdc {
     wchar_t       name[K5_MAXCCH_HOST];
@@ -134,12 +133,12 @@ k5_parse_boolean(const char *s)
     const char *const *p;
 
     for(p=conf_yes; *p; p++) {
-        if (!stricmp(*p,s))
+        if (!_stricmp(*p,s))
             return 1;
     }
 
     for(p=conf_no; *p; p++) {
-        if (!stricmp(*p,s))
+        if (!_stricmp(*p,s))
             return 0;
     }
 
@@ -409,7 +408,7 @@ k5_read_config_data(k5_config_data * d) {
                                      sizeof(kdc_name), values[i]);
 
                     for (j=0; j < d->realms[s].n_kdcs; j++)
-                        if (!wcsicmp(kdc_name, d->realms[s].kdcs[j].name))
+                        if (!_wcsicmp(kdc_name, d->realms[s].kdcs[j].name))
                             break;
 
                     if (j < d->realms[s].n_kdcs) {
@@ -436,7 +435,7 @@ k5_read_config_data(k5_config_data * d) {
                     AnsiStrToUnicode(kdc_name, sizeof(kdc_name), values[i]);
 
                     for (j=0; j < d->realms[s].n_kdcs; j++)
-                        if (!wcsicmp(kdc_name, d->realms[s].kdcs[j].name))
+                        if (!_wcsicmp(kdc_name, d->realms[s].kdcs[j].name))
                             break;
 
                     if (j < d->realms[s].n_kdcs) {
@@ -478,7 +477,7 @@ k5_read_config_data(k5_config_data * d) {
                 AnsiStrToUnicode(wdr_to, sizeof(wdr_to), dr_to);
 
                 for (j=0; j < d->n_realms; j++) {
-                    if (!wcsicmp(wdr_to, d->realms[j].realm))
+                    if (!_wcsicmp(wdr_to, d->realms[j].realm))
                         break;
                 }
 
@@ -588,7 +587,7 @@ k5_write_config_data(k5_config_data * d) {
 
     UnicodeStrToAnsi(astr, sizeof(astr), d->config_file);
 
-    if (stricmp(config_file, astr)) {
+    if (_stricmp(config_file, astr)) {
         assert(FALSE);
     }
 
@@ -1965,7 +1964,7 @@ k5_realms_dlgproc(HWND hwnd,
                                     (d->realms[i].flags & K5_RDFLAG_DELETED))
                                     continue;
 
-                                if (!wcsicmp(d->realms[i].realm, pdisp->item.pszText))
+                                if (!_wcsicmp(d->realms[i].realm, pdisp->item.pszText))
                                     break;
                             }
 
@@ -2084,7 +2083,7 @@ k5_realms_dlgproc(HWND hwnd,
                                     (d->realms[r].kdcs[k].flags & K5_RKFLAG_DELETED))
                                     continue;
 
-                                if (!wcsicmp(d->realms[r].kdcs[k].name,
+                                if (!_wcsicmp(d->realms[r].kdcs[k].name,
                                              pdisp->item.pszText))
                                     break;
                             }
@@ -2283,8 +2282,8 @@ k5_realms_dlgproc(HWND hwnd,
                                     (d->realms[r].domain_maps[m].flags & K5_DMFLAG_DELETED))
                                     continue;
 
-                                if (!wcsicmp(d->realms[r].domain_maps[m].name,
-                                             pdisp->item.pszText))
+                                if (!_wcsicmp(d->realms[r].domain_maps[m].name,
+                                              pdisp->item.pszText))
                                     break;
                             }
 
index ccc38941a6b77ef9a08f70b79440d9a1cb701203..ebec91e997d3bd8f0949f285f6978cd82eb8d8a0 100644 (file)
 \r
 /* $Id$ */\r
 \r
+#define STRSAFE_NO_DEPRECATE\r
+\r
 #include<krbcred.h>\r
 #include<krb5.h>\r
 #include<assert.h>\r
 #include<lm.h>\r
 #include<commctrl.h>\r
-\r
-#pragma warning(push)\r
-#pragma warning(disable: 4995)\r
 #include<shlwapi.h>\r
-#pragma warning(pop)\r
+\r
+#include<strsafe.h>\r
 \r
 typedef struct tag_k5_id_dlg_data {\r
     khui_config_init_data cfg;\r
@@ -164,7 +164,7 @@ k5_id_is_mod(HWND hw, k5_id_dlg_data * d) {
     SendDlgItemMessage(hw, IDC_CFG_PUBLICIP, IPM_GETADDRESS,\r
                        0, (LPARAM) &dwaddress);\r
 \r
-    if (wcsicmp(ccache, d->ccache) ||\r
+    if (_wcsicmp(ccache, d->ccache) ||\r
 \r
         d->tc_renew.current != d->renew_life ||\r
 \r
@@ -259,7 +259,7 @@ k5_id_write_params(HWND hw, k5_id_dlg_data * d) {
     GetDlgItemText(hw, IDC_CFG_CCACHE, ccache, ARRAYLENGTH(ccache));\r
 \r
     if (SUCCEEDED(StringCbLength(ccache, sizeof(ccache), &cb)) &&\r
-        wcsicmp(ccache, d->ccache)) {\r
+        _wcsicmp(ccache, d->ccache)) {\r
         khc_write_string(csp_ident, L"DefaultCCName", ccache);\r
         StringCbCopy(d->ccache, sizeof(d->ccache), ccache);\r
     } else {\r
index 4eebb9c62994acbe1593095c5fddccf6d472b33f..579b9f712d3194c5cca452076bfc9a08ce40bbd8 100644 (file)
@@ -24,6 +24,8 @@
 \r
 /* $Id$ */\r
 \r
+#define STRSAFE_NO_DEPRECATE\r
+\r
 #include<krbcred.h>\r
 #include<krb5.h>\r
 #include<assert.h>\r
index dab522c5dcd30ec51cee924f760a73b4d98e6e6b..1f7b2bdad138b6a07d748e4a6790581a0b593dbd 100644 (file)
@@ -434,12 +434,15 @@ static long get_tickets_from_cache(krb5_context ctx,
         if ( !pkrb5_decode_ticket(&KRBv5Credentials.ticket, &tkt)) {\r
             ti = tkt->enc_part.enctype;\r
             kcdb_cred_set_attr(cred, attr_id_tkt_enctype, &ti, sizeof(ti));\r
+            ti = tkt->enc_part.kvno;\r
+            kcdb_cred_set_attr(cred, attr_id_kvno, &ti, sizeof(ti));\r
             pkrb5_free_ticket(ctx, tkt);\r
             tkt = NULL;\r
         }\r
 \r
         ti = KRBv5Credentials.keyblock.enctype;\r
         kcdb_cred_set_attr(cred, attr_id_key_enctype, &ti, sizeof(ti));\r
+\r
         kcdb_cred_set_attr(cred, KCDB_ATTR_LOCATION, wcc_name, \r
                            KCDB_CBSIZE_AUTO);\r
 \r
@@ -1734,10 +1737,10 @@ khm_krb5_get_profile_file(LPSTR confname, UINT szConfname)
     {\r
         GetWindowsDirectoryA(confname,szConfname);\r
         confname[szConfname-1] = '\0';\r
-        strncat(confname, "\\",sizeof(confname)-strlen(confname));\r
-        confname[szConfname-1] = '\0';\r
-        strncat(confname, KRB5_FILE,sizeof(confname)-strlen(confname));\r
-        confname[szConfname-1] = '\0';\r
+\r
+        StringCchCatA(confname, szConfname, "\\");\r
+        StringCchCatA(confname, szConfname, KRB5_FILE);\r
+\r
         return FALSE;\r
     }\r
     \r
@@ -1745,7 +1748,7 @@ khm_krb5_get_profile_file(LPSTR confname, UINT szConfname)
     \r
     if (configFile)\r
     {\r
-        strncpy(confname, *configFile, szConfname);\r
+        StringCchCopyA(confname, szConfname, *configFile);\r
         pkrb5_free_config_files(configFile); \r
     }\r
     \r
@@ -1753,10 +1756,8 @@ khm_krb5_get_profile_file(LPSTR confname, UINT szConfname)
     {\r
         GetWindowsDirectoryA(confname,szConfname);\r
         confname[szConfname-1] = '\0';\r
-        strncat(confname, "\\",sizeof(confname)-strlen(confname));\r
-        confname[szConfname-1] = '\0';\r
-        strncat(confname, KRB5_FILE,sizeof(confname)-strlen(confname));\r
-        confname[szConfname-1] = '\0';\r
+        StringCchCatA(confname, szConfname, "\\");\r
+        StringCchCatA(confname, szConfname, KRB5_FILE);\r
     }\r
     \r
     return FALSE;\r
@@ -1773,25 +1774,19 @@ khm_get_krb4_con_file(LPSTR confname, UINT szConfname)
         if (khm_krb5_get_profile_file(krbConFile, sizeof(krbConFile))) {\r
             GetWindowsDirectoryA(krbConFile,sizeof(krbConFile));\r
             krbConFile[MAX_PATH-1] = '\0';\r
-            strncat(krbConFile, "\\",sizeof(krbConFile)-strlen(krbConFile));\r
-            krbConFile[MAX_PATH-1] = '\0';\r
-            strncat(krbConFile, KRB5_FILE,sizeof(krbConFile)-strlen(krbConFile));\r
-            krbConFile[MAX_PATH-1] = '\0';\r
+            StringCchCatA(confname, szConfname, "\\");\r
         }\r
         \r
         pFind = strrchr(krbConFile, '\\');\r
         if (pFind) {\r
-            *pFind = 0;\r
-            strncat(krbConFile, "\\",sizeof(krbConFile)-strlen(krbConFile));\r
-            krbConFile[MAX_PATH-1] = '\0';\r
-            strncat(krbConFile, KRB_FILE,sizeof(krbConFile)-strlen(krbConFile));\r
-            krbConFile[MAX_PATH-1] = '\0';\r
+            *pFind = '\0';\r
+            StringCchCatA(krbConFile, ARRAYLENGTH(krbConFile), "\\");\r
+            StringCchCatA(krbConFile, ARRAYLENGTH(krbConFile), KRB_FILE);\r
         }\r
         else\r
-            krbConFile[0] = 0;\r
-        \r
-        strncpy(confname, krbConFile, szConfname);\r
-        confname[szConfname-1] = '\0';\r
+            krbConFile[0] = '\0';\r
+\r
+        StringCchCopyA(confname, szConfname, krbConFile);\r
     }\r
     else if (hKrb4) { \r
         unsigned int size = szConfname;\r
@@ -1800,10 +1795,8 @@ khm_get_krb4_con_file(LPSTR confname, UINT szConfname)
             { // Error has happened\r
                 GetWindowsDirectoryA(confname,szConfname);\r
                 confname[szConfname-1] = '\0';\r
-                strncat(confname, "\\",szConfname-strlen(confname));\r
-                confname[szConfname-1] = '\0';\r
-                strncat(confname,KRB_FILE,szConfname-strlen(confname));\r
-                confname[szConfname-1] = '\0';\r
+                StringCchCatA(confname, szConfname, "\\");\r
+                StringCchCatA(confname, szConfname, KRB_FILE);\r
             }\r
     }\r
     return FALSE;\r
@@ -1922,7 +1915,12 @@ khm_krb5_get_realm_list(void)
         wchar_t * d;\r
 \r
         if (!khm_get_krb4_con_file(krb_conf,sizeof(krb_conf)) && \r
-            (file = fopen(krb_conf, "rt")))\r
+#if _MSC_VER >= 1400\r
+            !fopen_s(&file, krb_conf, "rt")\r
+#else\r
+           (file = fopen(krb_conf, "rt"))\r
+#endif\r
+            )\r
         {\r
             char lineBuf[256];\r
 \r
@@ -2151,7 +2149,8 @@ khm_int32 KHMAPI
 khm_krb5_creds_is_equal(khm_handle vcred1, khm_handle vcred2, void * dummy) {\r
     if (kcdb_creds_comp_attr(vcred1, vcred2, KCDB_ATTR_LOCATION) ||\r
         kcdb_creds_comp_attr(vcred1, vcred2, attr_id_key_enctype) ||\r
-        kcdb_creds_comp_attr(vcred1, vcred2, attr_id_tkt_enctype))\r
+        kcdb_creds_comp_attr(vcred1, vcred2, attr_id_tkt_enctype) ||\r
+        kcdb_creds_comp_attr(vcred1, vcred2, attr_id_kvno))\r
         return 1;\r
     else\r
         return 0;\r
index f52e3441ddb167a60bd39c95ea48d0f04844e776..b263e6bf3071c1be284b830c185fbdf45585de40 100644 (file)
@@ -212,7 +212,7 @@ update_crossfeed(khui_new_creds * nc,
                         (WPARAM) idx,\r
                         (LPARAM) srealm);\r
 \r
-            if (!wcsicmp(srealm, un_realm) && wcscmp(srealm, un_realm)) {\r
+            if (!_wcsicmp(srealm, un_realm) && wcscmp(srealm, un_realm)) {\r
                 /* differ only by case */\r
 \r
                 StringCchCopy(un_realm, ARRAYLENGTH(un) - (un_realm - un),\r
@@ -260,7 +260,7 @@ update_crossfeed(khui_new_creds * nc,
                     (WPARAM) idx,\r
                     (LPARAM) srealm);\r
 \r
-        if (!wcsicmp(srealm, realm) && wcscmp(srealm, realm)) {\r
+        if (!_wcsicmp(srealm, realm) && wcscmp(srealm, realm)) {\r
             StringCbCopy(realm, sizeof(realm), srealm);\r
 \r
             SetWindowText(d->hw_realm, srealm);\r
@@ -1145,7 +1145,7 @@ k5_ident_update(khm_int32 msg_type,
     khm_krb5_canon_cc_name(w_ccname, sizeof(w_ccname));\r
     khm_krb5_canon_cc_name(wid_ccname, sizeof(wid_ccname));\r
 \r
-    if (!wcsicmp(w_ccname, wid_ccname))\r
+    if (!_wcsicmp(w_ccname, wid_ccname))\r
         kcdb_identity_set_default_int(ident);\r
 \r
  _iu_cleanup:\r
@@ -1499,7 +1499,7 @@ DWORD WINAPI k5_ccname_monitor_thread(LPVOID lpParameter) {
                 new_ccname[0] = L'\0';\r
             }\r
 \r
-            if (wcsicmp(new_ccname, reg_ccname)) {\r
+            if (_wcsicmp(new_ccname, reg_ccname)) {\r
                 k5_refresh_default_identity(ctx);\r
                 StringCbCopy(reg_ccname, sizeof(reg_ccname), new_ccname);\r
             }\r
index ee85355a0bf254b9fa9cd2162e707fd1df48fb58..97ef85ee9503436022540d26423cba6b6c7a04e1 100644 (file)
@@ -36,23 +36,27 @@ khm_int32 type_id_enctype       = -1;
 khm_int32 type_id_addr_list     = -1;\r
 khm_int32 type_id_krb5_flags    = -1;\r
 khm_int32 type_id_krb5_princ    = -1;\r
+khm_int32 type_id_kvno          = -1;\r
 \r
 BOOL type_regd_enctype      = FALSE;\r
 BOOL type_regd_addr_list    = FALSE;\r
 BOOL type_regd_krb5_flags   = FALSE;\r
 BOOL type_regd_krb5_princ   = FALSE;\r
+BOOL type_regd_kvno         = FALSE;\r
 \r
 khm_int32 attr_id_key_enctype   = -1;\r
 khm_int32 attr_id_tkt_enctype   = -1;\r
 khm_int32 attr_id_addr_list     = -1;\r
 khm_int32 attr_id_krb5_flags    = -1;\r
 khm_int32 attr_id_krb5_ccname   = -1;\r
+khm_int32 attr_id_kvno          = -1;\r
 \r
 BOOL attr_regd_key_enctype  = FALSE;\r
 BOOL attr_regd_tkt_enctype  = FALSE;\r
 BOOL attr_regd_addr_list    = FALSE;\r
 BOOL attr_regd_krb5_flags   = FALSE;\r
 BOOL attr_regd_krb5_ccname  = FALSE;\r
+BOOL attr_regd_kvno         = FALSE;\r
 \r
 khm_handle csp_plugins      = NULL;\r
 khm_handle csp_krbcred   = NULL;\r
@@ -196,6 +200,31 @@ KHMEXP khm_int32 KHMAPI init_module(kmm_module h_module) {
         type_regd_krb5_flags = TRUE;\r
     }\r
 \r
+    if (KHM_FAILED(kcdb_type_get_id(TYPENAME_KVNO, &type_id_kvno))) {\r
+        kcdb_type type;\r
+        kcdb_type *t32;\r
+\r
+        kcdb_type_get_info(KCDB_TYPE_INT32, &t32);\r
+\r
+        type.id = KCDB_TYPE_INVALID;\r
+        type.name = TYPENAME_KVNO;\r
+        type.flags = KCDB_TYPE_FLAG_CB_FIXED;\r
+        type.cb_max = t32->cb_max;\r
+        type.cb_min = t32->cb_min;\r
+        type.isValid = t32->isValid;\r
+        type.comp = t32->comp;\r
+        type.dup = t32->dup;\r
+        type.toString = kvno_toString;\r
+\r
+        rv = kcdb_type_register(&type, &type_id_kvno);\r
+        kcdb_type_release_info(t32);\r
+\r
+        if (KHM_FAILED(rv))\r
+            goto _exit;\r
+\r
+        type_regd_kvno = TRUE;\r
+    }\r
+\r
     /* Register common attributes */\r
     if(KHM_FAILED(kcdb_attrib_get_id(ATTRNAME_KEY_ENCTYPE, &attr_id_key_enctype))) {\r
         kcdb_attrib attrib;\r
@@ -328,6 +357,32 @@ KHMEXP khm_int32 KHMAPI init_module(kmm_module h_module) {
         attr_regd_krb5_ccname = TRUE;\r
     }\r
 \r
+    if (KHM_FAILED(kcdb_attrib_get_id(ATTRNAME_KVNO, &attr_id_kvno))) {\r
+        kcdb_attrib attrib;\r
+        wchar_t sbuf[KCDB_MAXCCH_SHORT_DESC];\r
+        wchar_t lbuf[KCDB_MAXCCH_LONG_DESC];\r
+        /* although we are loading a long description, it still fits\r
+           in the short description buffer */\r
+\r
+        ZeroMemory(&attrib, sizeof(attrib));\r
+\r
+        attrib.name = ATTRNAME_KVNO;\r
+        attrib.id = KCDB_ATTR_INVALID;\r
+        attrib.type = type_id_kvno;\r
+        attrib.flags = KCDB_ATTR_FLAG_TRANSIENT;\r
+        LoadString(hResModule, IDS_KVNO_SHORT_DESC, sbuf, ARRAYLENGTH(sbuf));\r
+        LoadString(hResModule, IDS_KVNO_LONG_DESC, lbuf, ARRAYLENGTH(lbuf));\r
+        attrib.short_desc = sbuf;\r
+        attrib.long_desc = lbuf;\r
+\r
+        rv = kcdb_attrib_register(&attrib, &attr_id_kvno);\r
+\r
+        if (KHM_FAILED(rv))\r
+            goto _exit;\r
+\r
+        attr_regd_kvno = TRUE;\r
+    }\r
+\r
     rv = kmm_get_plugins_config(0, &csp_plugins);\r
     if(KHM_FAILED(rv)) goto _exit;\r
 \r
@@ -359,6 +414,8 @@ KHMEXP khm_int32 KHMAPI exit_module(kmm_module h_module) {
         kcdb_attrib_unregister(attr_id_krb5_flags);\r
     if(attr_regd_krb5_ccname)\r
         kcdb_attrib_unregister(attr_id_krb5_ccname);\r
+    if(attr_regd_kvno)\r
+        kcdb_attrib_unregister(attr_id_kvno);\r
 \r
     if(type_regd_enctype)\r
         kcdb_type_unregister(type_id_enctype);\r
@@ -366,6 +423,8 @@ KHMEXP khm_int32 KHMAPI exit_module(kmm_module h_module) {
         kcdb_type_unregister(type_id_addr_list);\r
     if(type_regd_krb5_flags)\r
         kcdb_type_unregister(type_id_krb5_flags);\r
+    if(type_regd_kvno)\r
+        kcdb_type_unregister(type_id_kvno);\r
 \r
     if(csp_params) {\r
         khc_close_space(csp_params);\r
index 3e64b00772e8f3491c3ff1d440164af011c8c650..4b9373d08103d4691becbf26b393df7ea84be39b 100644 (file)
@@ -62,12 +62,14 @@ typedef enum tag_k5_lsa_import {
 #define TYPENAME_ADDR_LIST      L"AddrList"\r
 #define TYPENAME_KRB5_FLAGS     L"Krb5Flags"\r
 #define TYPENAME_KRB5_PRINC     L"Krb5Principal"\r
+#define TYPENAME_KVNO           L"Kvno"\r
 \r
 #define ATTRNAME_KEY_ENCTYPE    L"KeyEncType"\r
 #define ATTRNAME_TKT_ENCTYPE    L"TktEncType"\r
 #define ATTRNAME_ADDR_LIST      L"AddrList"\r
 #define ATTRNAME_KRB5_FLAGS     L"Krb5Flags"\r
 #define ATTRNAME_KRB5_CCNAME    L"Krb5CCName"\r
+#define ATTRNAME_KVNO           L"Kvno"\r
 \r
 void init_krb();\r
 void exit_krb();\r
@@ -84,6 +86,7 @@ extern khm_int32 type_id_enctype;
 extern khm_int32 type_id_addr_list;\r
 extern khm_int32 type_id_krb5_flags;\r
 extern khm_int32 type_id_krb5_princ;\r
+extern khm_int32 type_id_kvno;\r
 \r
 extern BOOL      type_regd_krb5_princ;\r
 \r
@@ -92,6 +95,7 @@ extern khm_int32 attr_id_tkt_enctype;
 extern khm_int32 attr_id_addr_list;\r
 extern khm_int32 attr_id_krb5_flags;\r
 extern khm_int32 attr_id_krb5_ccname;\r
+extern khm_int32 attr_id_kvno;\r
 \r
 extern khm_ui_4  k5_commctl_version;\r
 \r
index c54bdb4b1aafbeb4a0d1fa3ea5affef51481b1fe..49673c3781a348e0b7b3a6d9b2c39bc2ccc190a2 100644 (file)
@@ -521,6 +521,8 @@ BEGIN
     IDS_CFG_RE_MMK          "Toggle &master KDC"\r
     IDS_CFG_RE_MND          "&Add new domain mapping"\r
     IDS_CFG_RE_MDD          "&Remove domain mapping"\r
+    IDS_KVNO_LONG_DESC      "Key version number"\r
+    IDS_KVNO_SHORT_DESC     "Kvno"\r
 END\r
 \r
 #endif    // English (U.S.) resources\r
index edda7dd02dd50412aa90737f8a49d6904602a1f6..da8a62ffda537575d99eaea51041fb077a02c093 100644 (file)
 #define IDS_CFG_RE_MMK                  214\r
 #define IDS_CFG_RE_MND                  215\r
 #define IDS_CFG_RE_MDD                  216\r
+#define IDS_KVNO_SHORT_DESC             217\r
+#define IDS_KVNO_LONG_DESC              218\r
 #define IDC_NCK5_RENEWABLE              1002\r
 #define IDC_NCK5_FORWARDABLE            1004\r
 #define IDC_NCK5_REALM                  1005\r
 // \r
 #ifdef APSTUDIO_INVOKED\r
 #ifndef APSTUDIO_READONLY_SYMBOLS\r
-#define _APS_NEXT_RESOURCE_VALUE        118\r
+#define _APS_NEXT_RESOURCE_VALUE        219\r
 #define _APS_NEXT_COMMAND_VALUE         40002\r
 #define _APS_NEXT_CONTROL_VALUE         1079\r
 #define _APS_NEXT_SYMED_VALUE           101\r
index e09d9f8c7cbfe63e96134128f6f19fd99d4ba3ff..35c19bdba16b6862199922d89f738a1e67e85c4b 100644 (file)
@@ -27,7 +27,7 @@ MODULE=ui
 
 EXEFILE=$(BINDIR)\netidmgr.exe
 
-MANIFESTFILE=$(BINDIR)\netidmgr.exe.manifest
+MANIFESTFILE=$(BINDIR)\netidmgr.exe.static.manifest
 
 OBJFILES=                      \
        $(OBJ)\main.obj         \
@@ -88,7 +88,6 @@ $(MANIFESTFILE): netidmgr.manifest.$(CPU).$(KH_CLVER).debug
 !endif
        $(CP) $** $@
 
-
 !if  ("$(CPU)" == "IA64" ) || ("$(CPU)" == "AMD64" ) || ("$(CPU)" == "ALPHA64" )
 SCLIB=bufferoverflowu.lib
 !else
@@ -97,6 +96,6 @@ SCLIB=
 
 $(EXEFILE): $(OBJFILES) $(RESFILES) $(LIBFILES)
        $(EXEGUILINK) $(SDKLIBFILES) $(SCLIB)
+       $(_VC_MANIFEST_EMBED_EXE) $(MANIFESTFILE)
 
-all: mkdirs $(EXEFILE) $(MANIFESTFILE)
-
+all: mkdirs $(MANIFESTFILE) $(EXEFILE)
index b68a3f953f19f8b28d0db921f0f3e35f15c0eddc..31df6bdf7079f93ebf4fb604d66216c6c8f6cc28 100644 (file)
@@ -4113,7 +4113,7 @@ cw_wm_command(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
         /* a hyperlink was activated */\r
         khui_htwnd_link * l;\r
         l = (khui_htwnd_link *) lParam;\r
-        wcsncpy(wid, l->id, l->id_len);\r
+        StringCchCopyN(wid, ARRAYLENGTH(wid), l->id, l->id_len);\r
         wid[l->id_len] = 0;\r
 \r
         if(!wcscmp(wid, L"NewCreds")) {\r
index b18ef42bb731dde9f12686b37f9cabf182afccb6..7df6e9d651730864faa306e7bf7067550862e991 100644 (file)
@@ -202,8 +202,12 @@ void khm_start_file_log(void) {
 \r
     khm_get_file_log_path(sizeof(temppath), temppath);\r
 \r
+    logfile = NULL;\r
+#if _MSC_VER >= 1400\r
+    _wfopen_s(&logfile, temppath, L"w");\r
+#else\r
     logfile = _wfopen(temppath, L"w");\r
-\r
+#endif\r
     kherr_add_ctx_handler(debug_event_handler,\r
                          KHERR_CTX_BEGIN |\r
                          KHERR_CTX_END |\r
index a9472585b4f6eb1fde09dba5ed40b411d1a32428..9507fbdd0c228a9181ec326758a7168cb4d1213d 100644 (file)
@@ -121,6 +121,8 @@ typedef struct khui_htwnd_data_t {
     wchar_t * text;\r
     int scroll_left;\r
     int scroll_top;\r
+    int ext_width;\r
+    int ext_height;\r
     COLORREF bk_color;\r
     HCURSOR hc_hand;\r
     int l_pixel_y;\r
@@ -630,6 +632,8 @@ static LRESULT htw_paint(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
     int align;\r
     int y;\r
     wchar_t * par_start;\r
+    int ext_width = 0;\r
+    int ext_height = 0;\r
 \r
     d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
 \r
@@ -645,8 +649,11 @@ static LRESULT htw_paint(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 \r
     GetClientRect(hwnd, &r);\r
 \r
+#ifdef DRAW_HTWND_CLIENT_EDGE\r
+    /* for the moment, we are skipping on the client edge. */\r
     if(d->flags & KHUI_HTWND_CLIENTEDGE)\r
         DrawEdge(hdc, &r, EDGE_SUNKEN, BF_ADJUST | BF_RECT | BF_FLAT);\r
+#endif\r
 \r
     hbk = CreateSolidBrush(RGB(255,255,255));\r
     FillRect(hdc, &r, hbk);\r
@@ -728,8 +735,6 @@ static LRESULT htw_paint(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
         p = par_start;\r
         format_unwind(&s_stack, s_start); /* unwind format stack */\r
 \r
-        //MoveToEx(hdc, x, y + l_height, NULL);\r
-\r
         p_width = 0;\r
 \r
         while(*p) {\r
@@ -766,13 +771,14 @@ static LRESULT htw_paint(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
                 SetTextColor(hdc, format_color(&s_stack));\r
 \r
                 GetTextExtentPoint32(hdc, p, (int)(c - p), &s);\r
-                rd.left = x + p_width;\r
-                rd.top = y;\r
-                rd.right = x + p_width + s.cx;\r
-                rd.bottom = y + l_height;\r
+                rd.left = x + p_width - d->scroll_left;\r
+                rd.top = y - d->scroll_top;\r
+                rd.right = x + p_width + s.cx - d->scroll_left;\r
+                rd.bottom = y + l_height - d->scroll_top;\r
 \r
                 if(IntersectRect(&rt, &rd, &r)) {\r
-                    DrawText(hdc, p, (int)(c - p), &rt, DT_BOTTOM | DT_LEFT | DT_SINGLELINE | DT_NOPREFIX);\r
+                    DrawText(hdc, p, (int)(c - p), &rd,\r
+                             DT_BOTTOM | DT_LEFT | DT_SINGLELINE | DT_NOPREFIX);\r
                 }\r
 \r
                 p_width += s.cx;\r
@@ -782,12 +788,86 @@ static LRESULT htw_paint(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
             }\r
         }\r
 \r
+        if (p_width > ext_width)\r
+            ext_width = p_width;\r
+\r
         y += l_height;\r
         par_start = p;\r
     }\r
 \r
+    if (y > ext_height)\r
+        ext_height = y;\r
+\r
     EndPaint(hwnd, &ps);\r
 \r
+    if (d->ext_width < ext_width) {\r
+        SCROLLINFO si;\r
+        LONG l;\r
+\r
+        /* the extents need to be adjusted.  But first check if we\r
+           have exactly the right scroll bars we need. */\r
+        if ((ext_width > (r.right - r.left) &&\r
+             !(d->flags & KHUI_HTWND_HSCROLL)) ||\r
+            (ext_height > (r.bottom - r.top) &&\r
+             !(d->flags & KHUI_HTWND_VSCROLL)) ||\r
+\r
+            (ext_width <= (r.right - r.left) &&\r
+             (d->flags & KHUI_HTWND_HSCROLL)) ||\r
+            (ext_height <= (r.bottom - r.top) &&\r
+             (d->flags & KHUI_HTWND_VSCROLL))) {\r
+\r
+            /* need to add scroll bars */\r
+            if (ext_width > (r.right - r.left))\r
+                d->flags |= KHUI_HTWND_HSCROLL;\r
+            else\r
+                d->flags &= ~KHUI_HTWND_HSCROLL;\r
+\r
+            if (ext_height > (r.bottom - r.top))\r
+                d->flags |= KHUI_HTWND_VSCROLL;\r
+            else\r
+                d->flags &= ~KHUI_HTWND_VSCROLL;\r
+\r
+            l = GetWindowLongPtr(hwnd, GWL_STYLE);\r
+            l &= ~(WS_HSCROLL | WS_VSCROLL);\r
+\r
+            l |= ((d->flags & KHUI_HTWND_HSCROLL) ? WS_HSCROLL : 0) |\r
+                ((d->flags & KHUI_HTWND_VSCROLL) ? WS_VSCROLL : 0);\r
+\r
+            SetWindowLongPtr(hwnd, GWL_STYLE, l);\r
+\r
+            InvalidateRect(hwnd, NULL, FALSE);\r
+            /* since the client area changed, we do another redraw\r
+               before updating the scroll bar positions. */\r
+        } else {\r
+            d->ext_width = ext_width;\r
+            d->ext_height = ext_height;\r
+\r
+            if (d->flags & KHUI_HTWND_HSCROLL) {\r
+                ZeroMemory(&si, sizeof(si));\r
+                si.cbSize = sizeof(si);\r
+                si.fMask = SIF_ALL | SIF_DISABLENOSCROLL;\r
+                si.nMin = 0;\r
+                si.nMax = ext_width;\r
+                si.nPage = r.right - r.left;\r
+                si.nPos = d->scroll_left;\r
+\r
+                SetScrollInfo(hwnd, SB_HORZ, &si, TRUE);\r
+            }\r
+\r
+            if (d->flags & KHUI_HTWND_VSCROLL) {\r
+                ZeroMemory(&si, sizeof(si));\r
+                si.cbSize = sizeof(si);\r
+                si.fMask = SIF_ALL | SIF_DISABLENOSCROLL;\r
+                si.nMin = 0;\r
+                si.nMax = ext_height;\r
+                si.nPage = r.bottom - r.top;\r
+                si.nPos = d->scroll_top;\r
+\r
+                SetScrollInfo(hwnd, SB_VERT, &si, TRUE);\r
+            }\r
+        }\r
+    }\r
+\r
     return 0;\r
 }\r
 \r
@@ -798,231 +878,328 @@ LRESULT CALLBACK khui_htwnd_proc(HWND hwnd,
                                  )\r
 {\r
     switch(uMsg) {\r
-        case WM_CREATE:\r
-            {\r
-                CREATESTRUCT * cs;\r
-                khui_htwnd_data * d;\r
-                size_t cbsize;\r
+    case WM_CREATE:\r
+        {\r
+            CREATESTRUCT * cs;\r
+            khui_htwnd_data * d;\r
+            size_t cbsize;\r
 \r
-                cs = (CREATESTRUCT *) lParam;\r
+            cs = (CREATESTRUCT *) lParam;\r
 \r
-                d = PMALLOC(sizeof(*d));\r
-                ZeroMemory(d, sizeof(*d));\r
+            d = PMALLOC(sizeof(*d));\r
+            ZeroMemory(d, sizeof(*d));\r
 \r
-                if(cs->dwExStyle & WS_EX_TRANSPARENT) {\r
-                    d->flags |= KHUI_HTWND_TRANSPARENT;\r
-                }\r
-                if(cs->dwExStyle & WS_EX_CLIENTEDGE) {\r
-                    d->flags |= KHUI_HTWND_CLIENTEDGE;\r
-                }\r
-                d->id = (int)(INT_PTR) cs->hMenu;\r
+            if(cs->dwExStyle & WS_EX_TRANSPARENT) {\r
+                d->flags |= KHUI_HTWND_TRANSPARENT;\r
+            }\r
+            if(cs->dwExStyle & WS_EX_CLIENTEDGE) {\r
+                d->flags |= KHUI_HTWND_CLIENTEDGE;\r
+            }\r
+            if(cs->style & WS_HSCROLL) {\r
+                d->flags |= KHUI_HTWND_HSCROLL;\r
+            }\r
+            if(cs->style & WS_VSCROLL) {\r
+                d->flags |= KHUI_HTWND_VSCROLL;\r
+            }\r
+            d->id = (int)(INT_PTR) cs->hMenu;\r
 \r
-                d->active_link = -1;\r
-                d->bk_color = RGB(255,255,255);\r
-                d->hc_hand = LoadCursor(NULL, IDC_HAND);\r
+            d->active_link = -1;\r
+            d->bk_color = RGB(255,255,255);\r
+            d->hc_hand = LoadCursor(NULL, IDC_HAND);\r
 \r
-                if(SUCCEEDED(StringCbLength(cs->lpszName, KHUI_HTWND_MAXCB_TEXT, &cbsize))) {\r
-                    cbsize += sizeof(wchar_t);\r
-                    d->text = PMALLOC(cbsize);\r
-                    StringCbCopy(d->text, cbsize, cs->lpszName);\r
-                }\r
+            if(SUCCEEDED(StringCbLength(cs->lpszName, KHUI_HTWND_MAXCB_TEXT, &cbsize))) {\r
+                cbsize += sizeof(wchar_t);\r
+                d->text = PMALLOC(cbsize);\r
+                StringCbCopy(d->text, cbsize, cs->lpszName);\r
+            }\r
+\r
+            /* this is just a flag to the WM_PAINT handler that the\r
+               extents haven't been set yet. */\r
+            d->ext_width = -1;\r
 \r
 #pragma warning(push)\r
 #pragma warning(disable: 4244)\r
-                SetWindowLongPtr(hwnd, 0, (LONG_PTR) d);\r
+            SetWindowLongPtr(hwnd, 0, (LONG_PTR) d);\r
 #pragma warning(pop)\r
 \r
-                return 0;\r
+            return 0;\r
+        }\r
+        break;\r
+\r
+    case WM_SETTEXT:\r
+        {\r
+            wchar_t * newtext;\r
+            size_t cbsize;\r
+            khui_htwnd_data * d;\r
+            BOOL rv;\r
+\r
+            d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
+            newtext = (wchar_t *) lParam;\r
+\r
+            if(d->text) {\r
+                PFREE(d->text);\r
+                d->text = NULL;\r
             }\r
-            break;\r
 \r
-        case WM_SETTEXT:\r
-            {\r
-                wchar_t * newtext;\r
-                size_t cbsize;\r
-                khui_htwnd_data * d;\r
-                BOOL rv;\r
+            if(SUCCEEDED(StringCbLength(newtext, KHUI_HTWND_MAXCB_TEXT, &cbsize))) {\r
+                cbsize += sizeof(wchar_t);\r
+                d->text = PMALLOC(cbsize);\r
+                StringCbCopy(d->text, cbsize, newtext);\r
+                rv = TRUE;\r
+            } else\r
+                rv = FALSE;\r
+\r
+            clear_styles(d);\r
+\r
+            d->ext_width = -1;\r
+            d->scroll_left = 0;\r
+            d->scroll_top = 0;\r
 \r
-                d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
-                newtext = (wchar_t *) lParam;\r
+            InvalidateRect(hwnd, NULL, TRUE);\r
 \r
-                if(d->text) {\r
-                    PFREE(d->text);\r
-                    d->text = NULL;\r
+            return rv;\r
+        }\r
+        break;\r
+\r
+    case WM_DESTROY:\r
+        {\r
+            khui_htwnd_data * d;\r
+            int i;\r
+\r
+            d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
+            if(d->text)\r
+                PFREE(d->text);\r
+            d->text = 0;\r
+\r
+            if(d->links) {\r
+                for(i=0;i<d->max_links;i++) {\r
+                    if(d->links[i])\r
+                        PFREE(d->links[i]);\r
                 }\r
+                PFREE(d->links);\r
+            }\r
 \r
-                if(SUCCEEDED(StringCbLength(newtext, KHUI_HTWND_MAXCB_TEXT, &cbsize))) {\r
-                    cbsize += sizeof(wchar_t);\r
-                    d->text = PMALLOC(cbsize);\r
-                    StringCbCopy(d->text, cbsize, newtext);\r
-                    rv = TRUE;\r
-                } else\r
-                    rv = FALSE;\r
+            clear_styles(d);\r
 \r
-                clear_styles(d);\r
+            PFREE(d);\r
+        }\r
+        break;\r
 \r
-                InvalidateRect(hwnd, NULL, TRUE);\r
+    case WM_ERASEBKGND:\r
+        {\r
+            khui_htwnd_data * d;\r
+            d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
 \r
-                return rv;\r
-            }\r
-            break;\r
+            if(d->flags & KHUI_HTWND_TRANSPARENT)\r
+                return TRUE;\r
 \r
-        case WM_DESTROY:\r
-            {\r
-                khui_htwnd_data * d;\r
-                int i;\r
-\r
-                d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
-                if(d->text)\r
-                    PFREE(d->text);\r
-                d->text = 0;\r
-\r
-                if(d->links) {\r
-                    for(i=0;i<d->max_links;i++) {\r
-                        if(d->links[i])\r
-                            PFREE(d->links[i]);\r
-                    }\r
-                    PFREE(d->links);\r
-                }\r
+            return FALSE;\r
+        }\r
+\r
+    case WM_PAINT:\r
+        htw_paint(hwnd, uMsg, wParam, lParam);\r
+        break;\r
+\r
+    case WM_SETCURSOR:\r
+        {\r
+            khui_htwnd_data * d;\r
 \r
-                clear_styles(d);\r
+            if(hwnd != (HWND)wParam)\r
+                break;\r
+                \r
+            d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
 \r
-                PFREE(d);\r
+            if(d->active_link >= 0) {\r
+                SetCursor(d->hc_hand);\r
+                return TRUE;\r
             }\r
-            break;\r
+        }\r
+        break;\r
 \r
-        case WM_ERASEBKGND:\r
-            {\r
-                khui_htwnd_data * d;\r
-                d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
+    case WM_SETFOCUS:\r
+        {\r
+            khui_htwnd_data * d;\r
 \r
-                if(d->flags & KHUI_HTWND_TRANSPARENT)\r
-                    return TRUE;\r
+            d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
 \r
-                return FALSE;\r
-            }\r
+            d->flags |= KHUI_HTWND_FOCUS;\r
 \r
-        case WM_PAINT:\r
-            htw_paint(hwnd, uMsg, wParam, lParam);\r
-            break;\r
+            InvalidateRect(hwnd, NULL, TRUE);\r
+        }\r
+        break;\r
 \r
-        case WM_SETCURSOR:\r
-            {\r
-                khui_htwnd_data * d;\r
+    case WM_KILLFOCUS:\r
+        {\r
+            khui_htwnd_data * d;\r
 \r
-                if(hwnd != (HWND)wParam)\r
-                    break;\r
+            d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
 \r
-                d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
+            d->flags &= ~KHUI_HTWND_FOCUS;\r
 \r
-                if(d->active_link >= 0) {\r
-                    SetCursor(d->hc_hand);\r
-                    return TRUE;\r
-                }\r
-            }\r
-            break;\r
+            InvalidateRect(hwnd, NULL, TRUE);\r
+        }\r
+        break;\r
+\r
+    case WM_LBUTTONDOWN:\r
+        {\r
+            khui_htwnd_data * d;\r
 \r
-        case WM_SETFOCUS:\r
-            {\r
-                khui_htwnd_data * d;\r
+            d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
 \r
-                d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
+            d->md_link = d->active_link;\r
 \r
-                d->flags |= KHUI_HTWND_FOCUS;\r
+            SetCapture(hwnd);\r
+        }\r
+        break;\r
+\r
+    case WM_LBUTTONUP:\r
+        {\r
+            khui_htwnd_data * d;\r
 \r
-                InvalidateRect(hwnd, NULL, TRUE);\r
+            d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
+\r
+            if(d->md_link == d->active_link && d->md_link >= 0) {\r
+                /* clicked */\r
+                SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(d->id, BN_CLICKED), (LPARAM) d->links[d->md_link]);\r
             }\r
-            break;\r
 \r
-        case WM_KILLFOCUS:\r
-            {\r
-                khui_htwnd_data * d;\r
+            ReleaseCapture();\r
+        }\r
+        break;\r
 \r
-                d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
+    case WM_HSCROLL:\r
+        {\r
+            khui_htwnd_data * d;\r
+            int old_pos;\r
+            int new_pos;\r
+            int ext;\r
+            SCROLLINFO si;\r
+            RECT r;\r
+\r
+            d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
+\r
+            old_pos = new_pos = d->scroll_left;\r
+            ext = d->ext_width;\r
+\r
+            switch(HIWORD(wParam)) {\r
+            case SB_THUMBTRACK:\r
+            case SB_THUMBPOSITION:\r
+                ZeroMemory(&si, sizeof(si));\r
+                si.cbSize = sizeof(si);\r
+                si.fMask = SIF_TRACKPOS;\r
+                GetScrollInfo(hwnd, SB_HORZ, &si);\r
+                new_pos = si.nTrackPos;\r
+                break;\r
 \r
-                d->flags &= ~KHUI_HTWND_FOCUS;\r
+            case SB_LINELEFT:\r
+                new_pos -= ext / 12; /* arbitrary unit */\r
+                break;\r
 \r
-                InvalidateRect(hwnd, NULL, TRUE);\r
+            case SB_LINERIGHT:\r
+                new_pos += ext / 12; /* arbitrary unit */\r
+                break;\r
+\r
+            case SB_PAGELEFT:\r
+                GetClientRect(hwnd, &r);\r
+                new_pos -= r.right - r.left;\r
+                break;\r
+\r
+            case SB_PAGERIGHT:\r
+                GetClientRect(hwnd, &r);\r
+                new_pos += r.right - r.left;\r
+                break;\r
             }\r
-            break;\r
 \r
-        case WM_LBUTTONDOWN:\r
-            {\r
-                khui_htwnd_data * d;\r
+            if (new_pos == old_pos)\r
+                break;\r
 \r
-                d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
+            GetClientRect(hwnd, &r);\r
 \r
-                d->md_link = d->active_link;\r
+#if 0\r
+            if (new_pos > ext - (r.right - r.left))\r
+                new_pos = ext - (r.right - r.left);\r
+#endif\r
+            if (new_pos > ext)\r
+                new_pos = ext;\r
 \r
-                SetCapture(hwnd);\r
-            }\r
-            break;\r
+            if (new_pos < 0)\r
+                new_pos = 0;\r
 \r
-        case WM_LBUTTONUP:\r
-            {\r
-                khui_htwnd_data * d;\r
+            if (new_pos == old_pos)\r
+                break;\r
 \r
-                d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
+            ZeroMemory(&si, sizeof(si));\r
+            si.cbSize = sizeof(si);\r
+            si.fMask = SIF_POS;\r
+            si.nPos = new_pos;\r
+            SetScrollInfo(hwnd, SB_HORZ, &si, TRUE);\r
+            /* note that Windows sometimes adjusts the position after\r
+               setting it with SetScrollInfo.  We have to look it up\r
+               again to see what value it ended up at. */\r
+            GetScrollInfo(hwnd, SB_HORZ, &si);\r
+            new_pos = si.nPos;\r
+\r
+            if (new_pos == old_pos)\r
+                break;\r
 \r
-                if(d->md_link == d->active_link && d->md_link >= 0) {\r
-                    /* clicked */\r
-                    SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(d->id, BN_CLICKED), (LPARAM) d->links[d->md_link]);\r
-                }\r
+            d->scroll_left = new_pos;\r
 \r
-                ReleaseCapture();\r
-            }\r
-            break;\r
+            ScrollWindow(hwnd, old_pos - new_pos, 0, NULL, NULL);\r
 \r
-        case WM_MOUSEMOVE:\r
-            {\r
-                khui_htwnd_data * d;\r
-                int i;\r
-                POINT p;\r
-                int nl;\r
+            return 0;\r
+        }\r
+        break;\r
 \r
-                p.x = GET_X_LPARAM(lParam);\r
-                p.y = GET_Y_LPARAM(lParam);\r
-                d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
+    case WM_MOUSEMOVE:\r
+        {\r
+            khui_htwnd_data * d;\r
+            int i;\r
+            POINT p;\r
+            int nl;\r
+\r
+            d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
+            p.x = GET_X_LPARAM(lParam) + d->scroll_left;\r
+            p.y = GET_Y_LPARAM(lParam) + d->scroll_top;\r
                 \r
-                for(i=0; i<d->n_links; i++) {\r
-                    if(d->links && d->links[i] && PtInRect(&(d->links[i]->r), p))\r
-                        break;\r
-                }\r
+            for(i=0; i<d->n_links; i++) {\r
+                if(d->links && d->links[i] && PtInRect(&(d->links[i]->r), p))\r
+                    break;\r
+            }\r
 \r
-                if(i == d->n_links)\r
-                    nl = -1;\r
-                else\r
-                    nl = i;\r
+            if(i == d->n_links)\r
+                nl = -1;\r
+            else\r
+                nl = i;\r
 \r
-                if(d->active_link != nl) {\r
-                    if(d->active_link >= 0) {\r
-                        if(d->flags & KHUI_HTWND_TRANSPARENT)\r
+            if(d->active_link != nl) {\r
+                if(d->active_link >= 0) {\r
+                    if(d->flags & KHUI_HTWND_TRANSPARENT)\r
                         {\r
                             HWND parent = GetParent(hwnd);\r
                             if(parent) {\r
                                 InvalidateRect(parent, NULL, TRUE);\r
                             }\r
                         }\r
-                        /* although we are invalidating the rect before setting active_link,\r
-                           WM_PAINT will not be issued until wndproc returns */\r
-                        InvalidateRect(hwnd, &(d->links[d->active_link]->r), TRUE);\r
-                    }\r
-                    d->active_link = nl;\r
-                    if(d->active_link >= 0) {\r
-                        /* although we are invalidating the rect before setting active_link,\r
-                           WM_PAINT will not be issued until wndproc returns */\r
-                        if(d->flags & KHUI_HTWND_TRANSPARENT)\r
+                    /* although we are invalidating the rect before setting active_link,\r
+                       WM_PAINT will not be issued until wndproc returns */\r
+                    InvalidateRect(hwnd, &(d->links[d->active_link]->r), TRUE);\r
+                }\r
+                d->active_link = nl;\r
+                if(d->active_link >= 0) {\r
+                    /* although we are invalidating the rect before setting active_link,\r
+                       WM_PAINT will not be issued until wndproc returns */\r
+                    if(d->flags & KHUI_HTWND_TRANSPARENT)\r
                         {\r
                             HWND parent = GetParent(hwnd);\r
                             if(parent) {\r
                                 InvalidateRect(parent, NULL, TRUE);\r
                             }\r
                         }\r
-                        InvalidateRect(hwnd, &(d->links[d->active_link]->r), TRUE);\r
-                    }\r
+                    InvalidateRect(hwnd, &(d->links[d->active_link]->r), TRUE);\r
                 }\r
             }\r
-            break;\r
+        }\r
+        break;\r
     }\r
 \r
     return DefWindowProc(hwnd, uMsg,wParam,lParam);\r
index e83dbb68445be4d909c5f1217fdc6c5ffcd854a4..2ca8c261b8333d382a9e19dd324b04209b3edc55 100644 (file)
@@ -40,6 +40,8 @@ We currently support the following tags:
 \r
 #define KHUI_HTWND_TRANSPARENT  1\r
 #define KHUI_HTWND_CLIENTEDGE   2\r
+#define KHUI_HTWND_HSCROLL      4\r
+#define KHUI_HTWND_VSCROLL      8\r
 #define KHUI_HTWND_FOCUS        2048\r
 \r
 #define KHUI_HTWND_CLASS L"KhmHtWnd"\r
index 56c79294bc7d14f0e3342cc835d921677dabf433..e263f7c87ebc20b720f747ea53c7abff21fb1656 100644 (file)
@@ -967,7 +967,8 @@ nc_handle_wm_command(HWND hwnd,
                    l->param_len < ARRAYLENGTH(sparam) &&\r
                    l->param_len > 0) {\r
 \r
-                    wcsncpy(sparam, l->param, l->param_len);\r
+                    StringCchCopyN(sparam, ARRAYLENGTH(sparam),\r
+                                   l->param, l->param_len);\r
                     sparam[l->param_len] = L'\0';\r
 \r
                 } else {\r
@@ -1006,7 +1007,7 @@ nc_handle_wm_command(HWND hwnd,
                 }\r
 \r
                 /* if it was for us, then we need to process the message */\r
-                if(!wcsicmp(sid, CTLINKID_SWITCH_PANEL)) {\r
+                if(!_wcsicmp(sid, CTLINKID_SWITCH_PANEL)) {\r
                     khm_int32 credtype;\r
                     khui_new_creds_by_type * t;\r
 \r
@@ -1021,10 +1022,10 @@ nc_handle_wm_command(HWND hwnd,
                                                    WMNC_DIALOG_SWITCH_PANEL),\r
                                         0);\r
                     }\r
-                } else if (!wcsicmp(sid, L"NotDef")) {\r
+                } else if (!_wcsicmp(sid, L"NotDef")) {\r
                     d->nc->set_default = FALSE;\r
                     nc_update_credtext(d);\r
-                } else if (!wcsicmp(sid, L"MakeDef")) {\r
+                } else if (!_wcsicmp(sid, L"MakeDef")) {\r
                     d->nc->set_default = TRUE;\r
                     nc_update_credtext(d);\r
                 }\r
index 29699476b3c185233036012bd74e8c7272607f89..f96ec5deecfb3f9abceb1a53abf05245254b7f9a 100644 (file)
@@ -29,6 +29,8 @@
 #include<utils.h>\r
 #include<assert.h>\r
 \r
+#include<strsafe.h>\r
+\r
 khui_action_ref khui_main_menu[] = {\r
     MENU_SUBMENU(KHUI_MENU_FILE),\r
     MENU_SUBMENU(KHUI_MENU_CRED),\r
index 3d06a07e22b4cf85878226b0ce3e91c4a154771e..96436543a7eee76a1cb92a27f937337c7e901e9b 100644 (file)
@@ -28,6 +28,8 @@
 #include<utils.h>\r
 #include<assert.h>\r
 \r
+#include<strsafe.h>\r
+\r
 /***********************************************************************\r
   Alerter\r
 ***********************************************************************/\r
index 9aa88cd287cdb10f472d5a485d542fb0b17189ad..79e570820ab8b53df4c75a2508d9cc18adcc2200 100644 (file)
@@ -30,6 +30,8 @@
 #include<utils.h>\r
 #include<assert.h>\r
 \r
+#include<strsafe.h>\r
+\r
 khm_int32 cfgui_node_serial;\r
 LONG init_once = 0;\r
 CRITICAL_SECTION cs_cfgui;\r
index 154ed18eb4ddff3ab20108207b7741920638ceb9..458218d90b0a2edd98587f5dddadb61e75c8fb54 100644 (file)
@@ -28,6 +28,8 @@
 #include<utils.h>\r
 #include<assert.h>\r
 \r
+#include<strsafe.h>\r
+\r
 #define CW_ALLOC_INCR 8\r
 \r
 static void cw_free_prompts(khui_new_creds * c);\r
index 45df19779fdbd28381368feb860cdda625002418..e561eb10832e2528e18c1b1a066dbdbf04d880b9 100644 (file)
@@ -415,24 +415,50 @@ typedef struct tag_khui_new_creds {
 #define KHUI_MAXCB_PNAME (KHUI_MAXCCH_PNAME * sizeof(wchar_t))\r
 \r
 /*! \brief A descriptor of a panel in the new credentials acquisition tab\r
+\r
+    When processing certain credentials messages such as\r
+    ::KMSG_CRED_PASSWORD, ::KMSG_CRED_NEW_CREDS,\r
+    ::KMSG_CRED_RENEW_CREDS, a pointer to a ::khui_new_creds structure\r
+    will be passed in to the message handler.  If the handler of the\r
+    message needs to add one or more credentials types as participants\r
+    of the operation, the handler will need to call khui_cw_add_type()\r
+    and specify a ::khui_new_creds_by_type structure.\r
+\r
+    Note that the memory address passed in to the call to\r
+    khui_cw_add_type() will not be copied.  Therefore, the block of\r
+    memory should remain as-is for the lifetime of the\r
+    ::khui_new_creds structure or until it is removed with a call to\r
+    khui_cw_del_type().\r
+\r
+    Some of the credentials messages that require specifying a\r
+    ::khui_new_creds_by_type structure require providing a\r
+    user-interface.  In these cases, the fields marked for providing a\r
+    UI may be required to hold valid values.  If the message does not\r
+    require providing a UI, these fields will be ignored.\r
 */\r
 typedef struct tag_khui_new_creds_by_type {\r
     khui_new_creds * nc;        /*!< Internal use.  Do not set */\r
     khm_int32   flags;          /*!< Internal use.  Do not set */\r
 \r
     khm_int32   type;           /*!< The identifier of the credentials\r
-                                  type */\r
+                                  type.  This is a credentials type\r
+                                  identifier allocated with a call to\r
+                                  kcdb_credtype_register(). */\r
 \r
     khm_int32   type_deps[KHUI_MAX_TYPE_DEPS];\r
                                 /*!< credentials types that this\r
                                     credential type depends on.  Each\r
                                     element defines a credentials type\r
                                     identifier that this type depends\r
-                                    on for this operation. */\r
+                                    on for this operation.  The number\r
+                                    of valid values in this array\r
+                                    should be specified in the \a\r
+                                    n_type_deps field. */\r
 \r
     khm_size    n_type_deps;    /*!< Number of dependencies listed\r
                                   above.  Should be between 0 and\r
-                                  ::KHUI_MAX_TYPE_DEPS */\r
+                                  ::KHUI_MAX_TYPE_DEPS.  Specify 0 if\r
+                                  there are no dependencies. */\r
 \r
     khm_size    ordinal;        /*!< The requested ordinal.  The UI\r
                                   would attempt to place this panel at\r
@@ -446,29 +472,49 @@ typedef struct tag_khui_new_creds_by_type {
     wchar_t    *name;           /*!< Name of the panel (localized,\r
                                   optional).  If NULL, the localized\r
                                   name of the credentials type is\r
-                                  used.  */\r
+                                  used. Only used if providing a\r
+                                  user-interface. */\r
 \r
-    HICON       icon;           /*!< Icon for the panel (optional) */\r
+    HICON       icon;           /*!< Icon for the panel (optional).\r
+                                  Only used if providing a\r
+                                  user-interface. */\r
 \r
     wchar_t    *tooltip;        /*!< Tooltip for the panel (localized,\r
                                   optional).  If NULL, no tooltip will\r
-                                  be assigned for the panel */\r
+                                  be assigned for the panel.  Only\r
+                                  used if providing a\r
+                                  user-interface.  */\r
 \r
     HMODULE     h_module;       /*!< Handle to the module containing\r
-                                  the dialog resource */\r
-\r
-    LPWSTR      dlg_template;   /*!< The dialog resource */\r
-    DLGPROC     dlg_proc;       /*!< The dialog procedure */\r
+                                  the dialog resource.  Only used if\r
+                                  providing a user-interface. */\r
+\r
+    LPWSTR      dlg_template;   /*!< The dialog resource.  Only used\r
+                                  if providing a user-interface. */\r
+    DLGPROC     dlg_proc;       /*!< The dialog procedure. Only used\r
+                                  if providing a user-interface. */\r
+\r
+    HWND        hwnd_panel;     /*!< The dialog window.  Once the\r
+                                  dialog panel is created, a handle to\r
+                                  the panel will be assigned here.\r
+                                  Note that the handle is assigned\r
+                                  after a successful call to\r
+                                  CreateDialogParam and hence would\r
+                                  not be available when handling the\r
+                                  WM_INITDIALOG message from the\r
+                                  dialog procedure.  Only used of\r
+                                  providing a user-interface. */\r
 \r
-    HWND        hwnd_panel;     /*!< The dialog window */\r
     HWND        hwnd_tc;        /*!< Internal use. Do not set */\r
 \r
     wchar_t    *credtext;       /*!< A brief description of the\r
                                   current state of this cred\r
-                                  type. (localized, optional) */\r
+                                  type. (localized, optional).  Only\r
+                                  used if providing a\r
+                                  user-interface. */\r
 \r
     LPARAM      aux;            /*!< auxilliary field.  For use by the\r
-                                  credential provider */\r
+                                  plug-in. */\r
 } khui_new_creds_by_type;\r
 \r
 /*!\name Flags for khui_new_creds_by_type\r
@@ -652,6 +698,22 @@ khui_cw_unlock_nc(khui_new_creds * c);
     See the description of ::khui_new_cred_panel for information on\r
     how to populate it to describe a credentials type panel.\r
 \r
+    Note that the structure pointed to by \a t is added by reference.\r
+    The memory pointed to by \a t is not copied.  Hence, the block of\r
+    memory and any other blocks pointed to by the\r
+    ::khui_new_creds_by_type structure located there should remain\r
+    intact for the lifetime of the ::khui_new_creds structure pointed\r
+    to by \a c or until the credentials type panel is removed from the\r
+    ::khui_new_creds structure with a call to khui_cw_del_type().\r
+\r
+    Generally, a plug-in that calls this function should allocate a\r
+    block of memory to contain the ::khui_new_creds_by_type structure,\r
+    fill it in and then pass in the address in a call to\r
+    khui_cw_add_type() while handling a ::KMSG_CRED_PASSWORD,\r
+    ::KMSG_CRED_NEW_CREDS or ::KMSG_CRED_RENEW_CREDS message.  Then\r
+    the plug-in should remove the reference with a call to\r
+    khui_cw_del_type() while processing ::KMSG_CRED_END.\r
+\r
     \see khui_cw_del_type()\r
     \see \ref cred_acq_panel_spec\r
     \see ::khui_new_cred_panel\r
index 6cf8ae44a0cbb313140295daf85d12c54c5966e5..c9996b31cd1d59ef368ce76a37476fc2b0ca4799 100644 (file)
@@ -247,9 +247,14 @@ perf_dump(char * file) {
     perf_once();\r
 \r
     EnterCriticalSection(&cs_alloc);\r
+#if _MSC_VER >= 1400\r
+    if (fopen_s(&f, file, "w"))\r
+        return;\r
+#else\r
     f = fopen(file, "w");\r
     if (!f)\r
-        return;\r
+       return;\r
+#endif\r
 \r
     fprintf(f, "Leaked allocations list ....\n");\r
     fprintf(f, "File\tLine\tThread\tSize\n");\r