//+------------------------------------------------------------------------- // // Microsoft Windows // // Copyright (C) Microsoft Corporation, 1998 - 1999 // // File: listvw.cpp // //-------------------------------------------------------------------------- #include "pch.cpp" #pragma hdrstop #include #include #include "celib.h" #include "listvw.h" extern HINSTANCE g_hInstance; typedef struct _DISPLAYSTRING_EXPANSION { LPCWSTR szContractedToken; LPCWSTR szExpansionString; } DISPLAYSTRING_EXPANSION, *PDISPLAYSTRING_EXPANSION; DISPLAYSTRING_EXPANSION displayStrings[] = { { wszFCSAPARM_SERVERDNSNAME, L"%SERVER_DNS_NAME%"}, { wszFCSAPARM_SERVERSHORTNAME, L"%SERVER_SHORT_NAME%"}, { wszFCSAPARM_SANITIZEDCANAME, L"%CA_NAME%"}, { wszFCSAPARM_CERTFILENAMESUFFIX, L"%CERT_SUFFIX%"}, { wszFCSAPARM_DOMAINDN, L"%DOMAIN_NAME%"}, { wszFCSAPARM_CONFIGDN, L"%CONFIG_NAME%"}, { wszFCSAPARM_SANITIZEDCANAMEHASH, L"%CA_NAME_HASH%"}, { wszFCSAPARM_CRLFILENAMESUFFIX, L"%CRL_SUFFIX%"}, }; DISPLAYSTRING_EXPANSION escapedStrings[] = { { L"%9", L"%%"}, }; HRESULT ValidateTokens( IN OUT LPWSTR szURL, OUT DWORD* pchBadBegin, OUT DWORD* pchBadEnd) { HRESULT hr = S_FALSE; int i; LPWSTR pszMatch; LPWSTR pszFound = szURL; WCHAR rgszToken[MAX_PATH]; *pchBadBegin = -1; *pchBadEnd = -1; // look for escape token open marker while(NULL != (pszFound = wcschr(pszFound, L'%'))) { pszMatch = wcschr(&pszFound[1], L'%'); // look for closing marker if (pszMatch == NULL) goto Ret; DWORD dwChars = SAFE_SUBTRACT_POINTERS(pszMatch, pszFound) +1; // dwChars is chars including markers if (dwChars == 2) goto NextMatch; // %% is valid escape sequence if (dwChars > MAX_PATH) goto Ret; // invalid escape token! // isolate the token CopyMemory(rgszToken, pszFound, dwChars * sizeof(WCHAR)); rgszToken[dwChars] = L'\0'; for (i=0; iiContextType == HELPINFO_WINDOW) { // Display context help for a control WinHelp((HWND)pHelpInfo->hItemHandle, szHelpFile, HELP_WM_HELP, (ULONG_PTR)(LPVOID)rgzHelpIDs); } return TRUE; } BOOL OnDialogContextHelp(HWND hWnd, LPCTSTR szHelpFile, const DWORD rgzHelpIDs[]) { if (rgzHelpIDs == NULL || szHelpFile == NULL) return TRUE; assert(IsWindow(hWnd)); WinHelp(hWnd, szHelpFile, HELP_CONTEXTMENU, (ULONG_PTR)(LPVOID)rgzHelpIDs); return TRUE; }