# 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
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
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
\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
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
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
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
/*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
\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
*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
*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
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
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
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
$(DLLFILE): $(OBJFILES) $(RESFILES)
$(DLLGUILINK) $(LIBFILES) $(SDKLIBFILES) $(SCLIB)
+ $(_VC_MANIFEST_EMBED_DLL)
all: mkdirs $(DLLFILE)
clean::
$(RM) $(DLLFILE)
+ $(RM) $(DLLFILE).manifest
#ifdef DEBUG\r
#include<assert.h>\r
#endif\r
+#include<strsafe.h>\r
\r
/**************************************/\r
/* khm_krb5_error(): */\r
\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
$(DLLFILE): $(OBJFILES) $(VERRESFILE) $(MSGRESFILE)
$(DLLGUILINK) $(LIBFILES) $(SDKLIBFILES) $(SCLIB)
+ $(_VC_MANIFEST_EMBED_DLL)
all: mkdirs $(MSGRESFILE) $(DLLFILE) lang
#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
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
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
{\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
\r
if (configFile)\r
{\r
- strncpy(confname, *configFile, szConfname);\r
+ StringCchCopyA(confname, szConfname, *configFile);\r
pkrb5_free_config_files(configFile); \r
}\r
\r
{\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
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
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
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
\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
\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
$(DLLFILE): $(OBJFILES) $(VERRESFILE)
$(DLLGUILINK) $(MSGRESFILE) $(LIBFILES) $(SDKLIBFILES) $(SCLIB)
+ $(_VC_MANIFEST_EMBED_DLL)
$(MSGRESFILE): $(OBJ)\krb5_msgs.rc
}\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
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
#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
\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
\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
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
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
/* $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];
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;
}
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) {
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) {
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;
}
UnicodeStrToAnsi(astr, sizeof(astr), d->config_file);
- if (stricmp(config_file, astr)) {
+ if (_stricmp(config_file, astr)) {
assert(FALSE);
}
(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;
}
(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;
}
(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;
}
\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
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
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
\r
/* $Id$ */\r
\r
+#define STRSAFE_NO_DEPRECATE\r
+\r
#include<krbcred.h>\r
#include<krb5.h>\r
#include<assert.h>\r
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
{\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
\r
if (configFile)\r
{\r
- strncpy(confname, *configFile, szConfname);\r
+ StringCchCopyA(confname, szConfname, *configFile);\r
pkrb5_free_config_files(configFile); \r
}\r
\r
{\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
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
{ // 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
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
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
(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
(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
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
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
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
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
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
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
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
#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
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
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
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
#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
EXEFILE=$(BINDIR)\netidmgr.exe
-MANIFESTFILE=$(BINDIR)\netidmgr.exe.manifest
+MANIFESTFILE=$(BINDIR)\netidmgr.exe.static.manifest
OBJFILES= \
$(OBJ)\main.obj \
!endif
$(CP) $** $@
-
!if ("$(CPU)" == "IA64" ) || ("$(CPU)" == "AMD64" ) || ("$(CPU)" == "ALPHA64" )
SCLIB=bufferoverflowu.lib
!else
$(EXEFILE): $(OBJFILES) $(RESFILES) $(LIBFILES)
$(EXEGUILINK) $(SDKLIBFILES) $(SCLIB)
+ $(_VC_MANIFEST_EMBED_EXE) $(MANIFESTFILE)
-all: mkdirs $(EXEFILE) $(MANIFESTFILE)
-
+all: mkdirs $(MANIFESTFILE) $(EXEFILE)
/* 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
\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
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
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
\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
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
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
}\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
)\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
\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
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
}\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
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
#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
#include<utils.h>\r
#include<assert.h>\r
\r
+#include<strsafe.h>\r
+\r
/***********************************************************************\r
Alerter\r
***********************************************************************/\r
#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
#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
#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
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
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
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