|
|
/*
* resstr.c - Return code to string translation routines. * * Taken from URL code * * Created: ChrisPi 9-11-95 * */
/* Headers
**********/
#include "precomp.h"
#include "uls2.h"
/* Macros
*********/
/*
* macro for simplifying result to string translation, assumes result string * pointer pcsz */
#define STRING_CASE(val) case val: pcsz = #val; break
/****************************** Public Functions *****************************/
#ifdef DEBUG
PCSTR GetINTString(int n) { static char s_rgchINT[] = "-2147483646";
wsprintfA(s_rgchINT, "%d", n);
ASSERT(IS_VALID_STRING_PTR_A(s_rgchINT, CSTR));
return(s_rgchINT); }
PCSTR GetINT_PTRString(INT_PTR n) { static char s_rgchINT[] = "-2147483646xxxxxxxxxx";
wsprintfA(s_rgchINT, "%Id", n);
ASSERT(IS_VALID_STRING_PTR_A(s_rgchINT, CSTR));
return(s_rgchINT); }
PCSTR GetULONGString(ULONG ul) { static char s_rgchULONG[] = "4294967295";
wsprintfA(s_rgchULONG, "%lx", ul);
ASSERT(IS_VALID_STRING_PTR_A(s_rgchULONG, CSTR));
return(s_rgchULONG); }
PCSTR GetBOOLString(BOOL bResult) { PCSTR pcsz;
pcsz = bResult ? "TRUE" : "FALSE";
ASSERT(IS_VALID_STRING_PTR_A(pcsz, CSTR));
return(pcsz); }
PCSTR GetPVOIDString(PVOID ptr) { static char s_rgchPVOID[] = "0xffff0000ffff0000";
wsprintfA(s_rgchPVOID, "0x%p", ptr);
ASSERT(IS_VALID_STRING_PTR_A(s_rgchPVOID, CSTR));
return(s_rgchPVOID); }
PCSTR GetClipboardFormatNameString(UINT ucf) { PCSTR pcsz; static char s_szCFName[MAX_PATH];
switch (ucf) { STRING_CASE(CF_TEXT); STRING_CASE(CF_BITMAP); STRING_CASE(CF_METAFILEPICT); STRING_CASE(CF_SYLK); STRING_CASE(CF_DIF); STRING_CASE(CF_TIFF); STRING_CASE(CF_OEMTEXT); STRING_CASE(CF_DIB); STRING_CASE(CF_PALETTE); STRING_CASE(CF_PENDATA); STRING_CASE(CF_RIFF); STRING_CASE(CF_WAVE); STRING_CASE(CF_UNICODETEXT); STRING_CASE(CF_ENHMETAFILE); STRING_CASE(CF_HDROP); STRING_CASE(CF_LOCALE); STRING_CASE(CF_MAX); STRING_CASE(CF_OWNERDISPLAY); STRING_CASE(CF_DSPTEXT); STRING_CASE(CF_DSPBITMAP); STRING_CASE(CF_DSPMETAFILEPICT); STRING_CASE(CF_DSPENHMETAFILE);
default: if (! GetClipboardFormatNameA(ucf, s_szCFName, sizeof(s_szCFName))) lstrcpyA(s_szCFName, "UNKNOWN CLIPBOARD FORMAT"); pcsz = s_szCFName; break; }
ASSERT(IS_VALID_STRING_PTR_A(pcsz, CSTR));
return(pcsz); }
PCSTR GetCOMPARISONRESULTString(COMPARISONRESULT cr) { PCSTR pcsz;
switch (cr) { STRING_CASE(CR_FIRST_SMALLER); STRING_CASE(CR_FIRST_LARGER); STRING_CASE(CR_EQUAL);
default: ERROR_OUT(("GetCOMPARISONRESULTString() called on unknown COMPARISONRESULT %d.", cr)); pcsz = "UNKNOWN COMPARISONRESULT"; break; }
ASSERT(IS_VALID_STRING_PTR_A(pcsz, CSTR));
return(pcsz); }
PCSTR GetHRESULTString(HRESULT hr) { PCSTR pcsz; static char s_rgchHRESULT[] = "0x12345678";
switch (hr) { STRING_CASE(S_OK); STRING_CASE(S_FALSE);
STRING_CASE(DRAGDROP_S_CANCEL); STRING_CASE(DRAGDROP_S_DROP); STRING_CASE(DRAGDROP_S_USEDEFAULTCURSORS);
STRING_CASE(E_UNEXPECTED); STRING_CASE(E_NOTIMPL); STRING_CASE(E_OUTOFMEMORY); STRING_CASE(E_INVALIDARG); STRING_CASE(E_NOINTERFACE); STRING_CASE(E_POINTER); STRING_CASE(E_HANDLE); STRING_CASE(E_ABORT); STRING_CASE(E_FAIL); STRING_CASE(E_ACCESSDENIED);
STRING_CASE(CLASS_E_NOAGGREGATION);
STRING_CASE(CO_E_NOTINITIALIZED); STRING_CASE(CO_E_ALREADYINITIALIZED); STRING_CASE(CO_E_INIT_ONLY_SINGLE_THREADED);
STRING_CASE(DV_E_DVASPECT); STRING_CASE(DV_E_LINDEX); STRING_CASE(DV_E_TYMED); STRING_CASE(DV_E_FORMATETC);
#ifdef __INTSHCUT_H__
STRING_CASE(E_FLAGS);
STRING_CASE(URL_E_INVALID_SYNTAX); STRING_CASE(URL_E_UNREGISTERED_PROTOCOL);
STRING_CASE(IS_E_EXEC_FAILED);
STRING_CASE(E_FILE_NOT_FOUND); STRING_CASE(E_PATH_NOT_FOUND);
#endif
// ULS error codes
//
STRING_CASE(ILS_E_SERVER_SERVICE); STRING_CASE(ILS_E_SERVER_NAME); STRING_CASE(ILS_E_TIMEOUT); STRING_CASE(ILS_E_BIND); STRING_CASE(ILS_E_THREAD); STRING_CASE(ILS_E_SERVER_EXEC); STRING_CASE(ILS_E_WINSOCK); STRING_CASE(ILS_E_NO_MORE); STRING_CASE(ILS_E_NOT_INITIALIZED); STRING_CASE(ILS_E_NOTIFY_ID); STRING_CASE(ILS_E_NO_SUCH_OBJECT); STRING_CASE(ILS_E_NEED_RELOGON); STRING_CASE(ILS_E_NAME_CONFLICTS);
// LDAP specific error codes
//
STRING_CASE(ILS_E_LDAP_OPERATIONS_ERROR); STRING_CASE(ILS_E_LDAP_PROTOCOL_ERROR); STRING_CASE(ILS_E_LDAP_TIMELIMIT_EXCEEDED); STRING_CASE(ILS_E_LDAP_SIZELIMIT_EXCEEDED); STRING_CASE(ILS_E_LDAP_COMPARE_FALSE); STRING_CASE(ILS_E_LDAP_COMPARE_TRUE); STRING_CASE(ILS_E_LDAP_AUTH_METHOD_NOT_SUPPORTED); STRING_CASE(ILS_E_LDAP_STRONG_AUTH_REQUIRED); STRING_CASE(ILS_E_LDAP_REFERRAL_V2); STRING_CASE(ILS_E_LDAP_PARTIAL_RESULTS); STRING_CASE(ILS_E_LDAP_REFERRAL); STRING_CASE(ILS_E_LDAP_ADMIN_LIMIT_EXCEEDED); STRING_CASE(ILS_E_LDAP_UNAVAILABLE_CRIT_EXTENSION); STRING_CASE(ILS_E_LDAP_NO_SUCH_ATTRIBUTE); STRING_CASE(ILS_E_LDAP_UNDEFINED_TYPE); STRING_CASE(ILS_E_LDAP_INAPPROPRIATE_MATCHING); STRING_CASE(ILS_E_LDAP_CONSTRAINT_VIOLATION); STRING_CASE(ILS_E_LDAP_ATTRIBUTE_OR_VALUE_EXISTS); STRING_CASE(ILS_E_LDAP_INVALID_SYNTAX); STRING_CASE(ILS_E_LDAP_ALIAS_PROBLEM); STRING_CASE(ILS_E_LDAP_INVALID_DN_SYNTAX); STRING_CASE(ILS_E_LDAP_IS_LEAF); STRING_CASE(ILS_E_LDAP_ALIAS_DEREF_PROBLEM); STRING_CASE(ILS_E_LDAP_INAPPROPRIATE_AUTH); STRING_CASE(ILS_E_LDAP_INVALID_CREDENTIALS); STRING_CASE(ILS_E_LDAP_INSUFFICIENT_RIGHTS); STRING_CASE(ILS_E_LDAP_BUSY); STRING_CASE(ILS_E_LDAP_UNAVAILABLE); STRING_CASE(ILS_E_LDAP_UNWILLING_TO_PERFORM); STRING_CASE(ILS_E_LDAP_LOOP_DETECT); STRING_CASE(ILS_E_LDAP_NAMING_VIOLATION); STRING_CASE(ILS_E_LDAP_OBJECT_CLASS_VIOLATION); STRING_CASE(ILS_E_LDAP_NOT_ALLOWED_ON_NONLEAF); STRING_CASE(ILS_E_LDAP_NOT_ALLOWED_ON_RDN); STRING_CASE(ILS_E_LDAP_NO_OBJECT_CLASS_MODS); STRING_CASE(ILS_E_LDAP_RESULTS_TOO_LARGE); STRING_CASE(ILS_E_LDAP_AFFECTS_MULTIPLE_DSAS); STRING_CASE(ILS_E_LDAP_OTHER); STRING_CASE(ILS_E_LDAP_SERVER_DOWN); STRING_CASE(ILS_E_LDAP_LOCAL_ERROR); STRING_CASE(ILS_E_LDAP_ENCODING_ERROR); STRING_CASE(ILS_E_LDAP_DECODING_ERROR); STRING_CASE(ILS_E_LDAP_TIMEOUT); STRING_CASE(ILS_E_LDAP_AUTH_UNKNOWN); STRING_CASE(ILS_E_LDAP_FILTER_ERROR); STRING_CASE(ILS_E_LDAP_USER_CANCELLED); STRING_CASE(ILS_E_LDAP_NO_MEMORY);
default: wsprintfA(s_rgchHRESULT, "%#lx", hr); pcsz = s_rgchHRESULT; break; }
ASSERT(IS_VALID_STRING_PTR_A(pcsz, CSTR));
return(pcsz); }
#endif /* DEBUG */
|