21#define LVM_PROGRESS (WM_APP + 1)
36#define EVENT_MESSAGE_EVENTTEXT_BUFFER (1024*10)
37#define EVENT_MESSAGE_FILE_BUFFER (1024*10)
38#define EVENT_DLL_SEPARATOR L";"
39#define EVENT_CATEGORY_MESSAGE_FILE L"CategoryMessageFile"
40#define EVENT_MESSAGE_FILE L"EventMessageFile"
41#define EVENT_PARAMETER_MESSAGE_FILE L"ParameterMessageFile"
43#define MAX_LOADSTRING 255
198 if (!lpCmdLine || !*lpCmdLine)
235 if (cbFileName > 0 &&
lpFileName[cbFileName - 1] ==
L'\"')
302 while (*lpTemp ==
L'\\')
351 DWORD dwType, cbData;
365 Settings.wpPos.showCmd = nDefCmdShow;
481 &
Settings.wpPos.rcNormalPosition.left,
482 &
Settings.wpPos.rcNormalPosition.top,
483 &
Settings.wpPos.rcNormalPosition.right,
484 &
Settings.wpPos.rcNormalPosition.bottom,
490 Settings.wpPos.showCmd = nDefCmdShow;
544 Settings.wpPos.rcNormalPosition.left,
545 Settings.wpPos.rcNormalPosition.top,
546 Settings.wpPos.rcNormalPosition.right,
547 Settings.wpPos.rcNormalPosition.bottom,
576 iccx.
dwSize =
sizeof(iccx);
706 return (
int)
msg.wParam;
716 SYSTEMTIME st1970 = { 1970, 1, 0, 1, 0, 0, 0, 0 };
724 uUCT.ft.dwHighDateTime = 0;
725 uUCT.ft.dwLowDateTime = EventTime;
727 uUCT.ll = uUCT.ll * 10000000 + u1970.ll;
755 dwFlags &= ~FORMAT_MESSAGE_FROM_STRING;
795 dwFlags &= ~FORMAT_MESSAGE_ARGUMENT_ARRAY;
858 cbLength = (
wcslen(lpMessageDllList) + 1) *
sizeof(
WCHAR);
860 if (!szMessageDllList)
862 CopyMemory(szMessageDllList, lpMessageDllList, cbLength);
905 IN BOOL bMessagePreFormatted,
916 DWORD dwParamCount = 0;
918 size_t cchParams = 0;
925 *pFinalMessage =
NULL;
928 if (bMessagePreFormatted)
930 while ((pTempMessage =
wcschr(pTempMessage,
L'%')))
942 while ((pTempMessage =
wcsstr(pTempMessage,
L"%%")))
954 if (dwParamCount == 0)
972 pTempMessage = (
LPWSTR)pMessage;
973 if (bMessagePreFormatted)
975 while ((pTempMessage =
wcschr(pTempMessage,
L'%')) && (
i < dwParamCount))
992 while ((pTempMessage =
wcsstr(pTempMessage,
L"%%")) && (
i < dwParamCount))
1000 while (
iswdigit(*++pTempMessage)) ;
1009 for (
i = 0;
i < dwParamCount;
i++)
1016 pParamData[
i].pParameterID,
1018 if (!pParamData[
i].pParameter)
1024 cchParams +=
wcslen(pParamData[
i].pParameter);
1033 if (!*pFinalMessage)
1039 pTempFinalMessage = *pFinalMessage;
1042 pTempMessage = (
LPWSTR)pMessage;
1043 for (
i = 0;
i < dwParamCount;
i++)
1050 pTempFinalMessage +=
cch;
1053 if (pParamData[
i].pParameter)
1069 pTempFinalMessage +=
cch;
1082 for (
i = 0;
i < dwParamCount;
i++)
1084 if (pParamData[
i].pParameter)
1103 WCHAR wszNumber[24];
1104 WCHAR wszDecimalSep[8], wszThousandSep[8];
1106 WCHAR wszGrouping[12];
1130 for (
i = 0;
i < cchGrouping;
i++)
1132 WCHAR wch = wszGrouping[
i];
1134 if (wch >=
L'0' && wch <=
L'9')
1136 else if (wch !=
L';')
1157 return cchResult - 1;
1163 UINT cchWritten, cchRemaining;
1165 size_t cchStringRemaining;
1168 cchWritten =
FormatInteger(cbSize, pwszResult, cchResultMax);
1173 pwszEnd = pwszResult + cchWritten;
1174 cchRemaining = cchResultMax - cchWritten;
1175 StringCchCopyExW(pwszEnd, cchRemaining,
L" ", &pwszEnd, &cchStringRemaining, 0);
1176 cchRemaining = (
UINT)cchStringRemaining;
1178 cchRemaining -= cchWritten;
1180 return cchResultMax - cchRemaining;
1186 UINT cchWritten, cchRemaining;
1188 size_t cchCopyRemaining;
1200 pwszEnd = pwszResult + cchWritten;
1201 cchRemaining = cchResultMax - cchWritten;
1203 cchRemaining = (
UINT)cchCopyRemaining;
1207 pwszEnd += cchWritten;
1208 cchRemaining -= cchWritten;
1223 UINT cchRemaining = cchResult;
1224 size_t cchCopyRemaining;
1225 LPWSTR pwszEnd = pwszResult;
1236 cchRemaining -= cchWritten;
1237 pwszEnd += cchWritten;
1240 cchRemaining = (
UINT)cchCopyRemaining;
1257 IN INT SelectedImage,
1266 Insert.hParent = hParent;
1267 Insert.item.pszText = lpText;
1268 Insert.item.iImage =
Image;
1269 Insert.item.iSelectedImage = SelectedImage;
1270 Insert.item.lParam =
lParam;
1324 if (EventLog->LogName)
1327 if (EventLog->ComputerName)
1330 if (EventLog->FileName)
1346 pStr = (
PWSTR)MultiStr;
1347 while (*pStr) pStr += (
wcslen(pStr) + 1);
1348 Length = MultiStr - pStr + 2;
1377 if (!EventLogFilter)
1381 EventLogFilter->
Warning = Warning;
1398 return EventLogFilter;
1404 if (EventLogFilter->Sources)
1407 if (EventLogFilter->Users)
1410 if (EventLogFilter->ComputerNames)
1473 if (ComputerName && *ComputerName)
1476 while (*ComputerName ==
L'\\')
1506 if (ComputerName && *ComputerName)
1511 if (*lpFullFileName && lpFullFileName[1] ==
L':')
1512 lpFullFileName[1] =
L'$';
1517 lpFullFileName[0] =
L'\\';
1518 lpFullFileName[1] =
L'\\';
1519 wcsncpy(lpFullFileName + 2, ComputerName,
wcslen(ComputerName));
1520 lpFullFileName[2 +
wcslen(ComputerName)] =
L'\\';
1606 pevlr->EventCategory,
1627 if (pevlr->EventCategory != 0)
1647 WCHAR SourceModuleName[1024];
1648 WCHAR ParameterModuleName[1024];
1651 LPWSTR szStringArray, szMessage;
1655 szStringArray = (
LPWSTR)((
LPBYTE)pevlr + pevlr->StringOffset);
1666 if (!IsParamModNameCached)
1673 if (IsParamModNameCached)
1678 szMessage = szStringArray;
1691 for (
i = 0;
i < pevlr->NumStrings;
i++)
1693 szMessage +=
wcslen(szMessage) + 1;
1695 cch = szMessage - szStringArray;
1698 szMessage = szStringArray;
1699 for (
i = 0;
i < pevlr->NumStrings;
i++)
1701 lpMsgBuf = szMessage;
1702 while ((lpMsgBuf =
wcsstr(lpMsgBuf,
L"%%")))
1706 MoveMemory(lpMsgBuf, lpMsgBuf+1, ((szStringArray +
cch) - lpMsgBuf - 1) *
sizeof(
WCHAR));
1710 szArguments[
i] = szMessage;
1711 szMessage +=
wcslen(szMessage) + 1;
1736 lpMsgBuf = szMessage;
1757 szMessage = szStringArray;
1758 for (
i = 0;
i < pevlr->NumStrings;
i++)
1762 szMessage +=
wcslen(szMessage) + 1;
1773 switch (dwEventType)
1807 WCHAR szDomain[1024];
1814 pCurrentSid = (
PSID)((
LPBYTE)pelr + pelr->UserSidOffset);
1821 else if (*pLastSid &&
EqualSid(*pLastSid, pCurrentSid))
1827 if (pelr->UserSidLength > 0)
1892 if ((pevlr->EventType ==
EVENTLOG_SUCCESS && !EventLogFilter->Information ) ||
1918 if (!*FilterString && !*
String)
1927 if ( (!*FilterString && *
String) || (*FilterString && !*
String) )
1936 pStr = FilterString;
1945 pStr += (
wcslen(pStr) + 1);
1973 DWORD dwTotalRecords = 0, dwCurrentRecord = 0;
1975 size_t cchRemaining;
1982 UINT uStep = 0, uStepAt = 0, uPos = 0;
1995 PWCHAR lpTitleTemplateEnd;
2006 EventLog = EventLogFilter->
EventLogs[0];
2018 &lpTitleTemplateEnd,
2022 dwMaxLength = (
DWORD)cchRemaining;
2029 sizeof(szStatusText),
2040 L"Many-logs filtering is not implemented yet!!",
2070 EventLog = EventLogFilter->
EventLogs[LogIndex];
2078 if (hEventLog ==
NULL)
2089 if (dwTotalRecords > 0)
2116 uStepAt = (dwTotalRecords / 100) + 1;
2135 dwWanted = dwNeeded;
2151 pEvlrBuffer = (
LPBYTE)pEvlr;
2152 pEvlrEnd = pEvlrBuffer + dwRead;
2154 while (pEvlrBuffer < pEvlrEnd)
2157 PWSTR lpszUsername, lpszCategoryName;
2162 if (uStep % uStepAt == 0)
2191 lpszUsername =
GetEventUserName(pEvlrTmp, &pLastSid, szUsername) ? szUsername : szNoUsername;
2199 lpszCategoryName =
GetEventCategory(EventLog->
LogName, lpszSourceName, pEvlrTmp, szCategory) ? szCategory : szNoCategory;
2208 lviEventItem.
iItem = 0;
2211 lviEventItem.
pszText = szEventTypeText;
2248 pEvlrBuffer += pEvlrTmp->
Length;
2279 sizeof(szStatusText),
2384 if (!EventLogFilter)
2446 tvItemEx.
hItem = hti;
2451 *phti = tvItemEx.
hItem;
2478 if (EventLog ==
NULL)
2489 if (EventLogFilter ==
NULL)
2501 cchFileName =
wcslen(lpszFileName) + 1;
2508 2, 3, (
LPARAM)EventLogFilter);
2546 if (!EventLogFilter)
2559 EventLog = EventLogFilter->EventLogs[0];
2580 if (!EventLogFilter)
2621 if (!EventLogFilter)
2649 EventLog = EventLogFilter->EventLogs[0];
2673 if (!EventLogFilter)
2686 wcex.
cbSize =
sizeof(wcex);
2718 DWORD dwType, cbData;
2719 DWORD dwMessageID = 0;
2769 cbData =
sizeof(dwMessageID);
2779 *pdwMessageID = dwMessageID;
2792 HKEY hEventLogKey, hLogKey;
2793 DWORD dwNumLogs = 0;
2794 DWORD dwIndex, dwMaxKeyLength;
2855 for (dwIndex = 0; dwIndex < dwNumLogs; dwIndex++)
2857 lpcName = dwMaxKeyLength;
2867 if (EventLog ==
NULL)
2875 if (EventLogFilter ==
NULL)
2967 2, 3, (
LPARAM)EventLogFilter);
2972 hItemDefault =
hItem;
3042 rs =
Settings.wpPos.rcNormalPosition;
3100 (rcClient.
bottom - rcClient.
top) - StatusHeight,
3156 : (rcClient.
bottom - rcClient.
top) - StatusHeight,
3318 :
cy - StatusHeight,
3373 if (pnmv->
iItem == -1)
3376 L"No selected items!",
3386#ifdef LVN_ITEMACTIVATE
3441 while (*pszText &&
iswspace(*pszText))
3529 if (EventLogFilter &&
ClearEvents(EventLogFilter))
3554 if (bNewest !=
Settings.bNewestEventsFirst)
3556 Settings.bNewestEventsFirst = bNewest;
3653 L"Help not implemented yet!",
3711 hInfo.
pt.
y = yPos - rc.
top;
3885 DWORD dwMaxSize = 0, dwRetention = 0;
3921 cbData =
sizeof(dwMaxSize);
3932 dwMaxSize = 16384 * 1024;
3937 cbData =
sizeof(dwRetention);
3951 dwRetention = (dwRetention + 24*3600 - 1) / (24*3600);
4043 if (dwRetention == 0)
4075 DWORD dwMaxSize = 0, dwRetention = 0;
4122 sizeof(dwRetention));
4173 if (EventLogFilter &&
ClearEvents(EventLogFilter))
4235 L"Help not implemented yet!",
4260 if (!EventLogFilter)
4272 psh.
dwSize =
sizeof(psh);