applied patch #1340255 - nicer registry commands log

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4415 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2005-11-24 16:45:04 +00:00
parent 2a70ad3052
commit d0f1bae314
3 changed files with 72 additions and 6 deletions

View file

@ -760,6 +760,53 @@ void NSISCALL log_write(int close)
}
#endif//!NSIS_CONFIG_LOG_ODS
const char * _RegKeyHandleToName(HKEY hKey)
{
if (hKey == HKEY_CLASSES_ROOT)
return "HKEY_CLASSES_ROOT";
else if (hKey == HKEY_CURRENT_USER)
return "HKEY_CURRENT_USER";
else if (hKey == HKEY_LOCAL_MACHINE)
return "HKEY_LOCAL_MACHINE";
else if (hKey == HKEY_USERS)
return "HKEY_USERS";
else if (hKey == HKEY_PERFORMANCE_DATA)
return "HKEY_PERFORMANCE_DATA";
else if (hKey == HKEY_CURRENT_CONFIG)
return "HKEY_CURRENT_CONFIG";
else if (hKey == HKEY_DYN_DATA)
return "HKEY_DYN_DATA";
else
return "invalid registry key";
}
void _LogData2Hex(char *buf, size_t buflen, unsigned char *data, size_t datalen)
{
char *p = buf;
size_t i;
int dots = 0;
size_t bufbytes = buflen / 3; // 2 hex digits, one space/null
if (datalen > bufbytes)
{
bufbytes--;
dots = 1;
}
else
bufbytes = datalen;
for (i = 0; i < bufbytes; i++)
{
wsprintf(p, "%02x%c", data[i], (i == bufbytes - 1) ? '\0' : ' ');
p += 3;
}
if (dots)
mystrcat(buf, "...");
}
void log_printf(char *format, ...)
{
va_list val;