Author: spetreolle Date: Wed Aug 27 20:19:43 2014 New Revision: 63963
URL: http://svn.reactos.org/svn/reactos?rev=63963&view=rev Log: [ROSAUTOTEST] Report the start and end of the tests in the Application event log. This gives data for the advapi32:eventlog tests.
Added: trunk/rostests/rosautotest/misc.cpp (contents, props changed) - copied, changed from r63913, trunk/reactos/base/applications/rapps/misc.c trunk/rostests/rosautotest/rosautotest.rc (with props) trunk/rostests/rosautotest/rosautotestmsg.mc (with props) Modified: trunk/rostests/rosautotest/CMakeLists.txt trunk/rostests/rosautotest/main.cpp trunk/rostests/rosautotest/precomp.h
Modified: trunk/rostests/rosautotest/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/rostests/rosautotest/CMakeLists.txt... ============================================================================== --- trunk/rostests/rosautotest/CMakeLists.txt [iso-8859-1] (original) +++ trunk/rostests/rosautotest/CMakeLists.txt [iso-8859-1] Wed Aug 27 20:19:43 2014 @@ -15,14 +15,16 @@ CWebService.cpp CWineTest.cpp main.cpp + misc.cpp shutdown.cpp tools.cpp precomp.h)
-add_executable(rosautotest ${SOURCE}) +add_executable(rosautotest ${SOURCE} ${REACTOS_BINARY_DIR}/include/reactos/rosautotestmsg.rc)
set_module_type(rosautotest win32cui UNICODE) add_importlibs(rosautotest advapi32 shell32 user32 wininet msvcrt kernel32 ntdll) add_pch(rosautotest precomp.h SOURCE) - +add_message_headers(ANSI rosautotestmsg.mc) +add_dependencies(rosautotest rosautotestmsg) add_cd_file(TARGET rosautotest DESTINATION reactos/system32 FOR all)
Modified: trunk/rostests/rosautotest/main.cpp URL: http://svn.reactos.org/svn/reactos/trunk/rostests/rosautotest/main.cpp?rev=6... ============================================================================== --- trunk/rostests/rosautotest/main.cpp [iso-8859-1] (original) +++ trunk/rostests/rosautotest/main.cpp [iso-8859-1] Wed Aug 27 20:19:43 2014 @@ -61,6 +61,18 @@ ss << "\n\nSystem uptime " << setprecision(2) << fixed ; ss << ((float)GetTickCount()/1000) << " seconds\n"; StringOut(ss.str()); + + /* Report tests startup */ + InitLogs(); + ReportEventW(hLog, + EVENTLOG_INFORMATION_TYPE, + 0, + MSG_TESTS_STARTED, + NULL, + 0, + 0, + NULL, + NULL);
/* Run the tests */ WineTest.Run(); @@ -94,6 +106,18 @@ if(ReturnValue == 1) DbgPrint("SYSREG_ROSAUTOTEST_FAILURE\n");
+ /* Report successful end of tests */ + ReportEventW(hLog, + EVENTLOG_SUCCESS, + 0, + MSG_TESTS_SUCCESSFUL, + NULL, + 0, + 0, + NULL, + NULL); + FreeLogs(); + /* Shut down the system if requested, also in case of an exception above */ if(Configuration.DoShutdown() && !ShutdownSystem()) ReturnValue = 1;
Copied: trunk/rostests/rosautotest/misc.cpp (from r63913, trunk/reactos/base/applications/rapps/misc.c) URL: http://svn.reactos.org/svn/reactos/trunk/rostests/rosautotest/misc.cpp?p2=tr... ============================================================================== --- trunk/reactos/base/applications/rapps/misc.c [iso-8859-1] (original) +++ trunk/rostests/rosautotest/misc.cpp [iso-8859-1] Wed Aug 27 20:19:43 2014 @@ -1,305 +1,22 @@ /* - * PROJECT: ReactOS Applications Manager + * PROJECT: ReactOS Automatic Testing Utility * LICENSE: GPL - See COPYING in the top level directory * FILE: base/applications/rapps/misc.c * PURPOSE: Misc functions * PROGRAMMERS: Dmitry Chapyshev (dmitry@reactos.org) */
-#include "rapps.h" - -/* SESSION Operation */ -#define EXTRACT_FILLFILELIST 0x00000001 -#define EXTRACT_EXTRACTFILES 0x00000002 - -static HANDLE hLog = NULL; - -typedef struct -{ - int erfOper; - int erfType; - BOOL fError; -} ERF, *PERF; - -struct FILELIST -{ - LPSTR FileName; - struct FILELIST *next; - BOOL DoExtract; -}; - -typedef struct -{ - INT FileSize; - ERF Error; - struct FILELIST *FileList; - INT FileCount; - INT Operation; - CHAR Destination[MAX_PATH]; - CHAR CurrentFile[MAX_PATH]; - CHAR Reserved[MAX_PATH]; - struct FILELIST *FilterList; -} SESSION; - -HRESULT (WINAPI *pfnExtract)(SESSION *dest, LPCSTR szCabName); - - -INT -GetSystemColorDepth(VOID) -{ - DEVMODE pDevMode; - INT ColorDepth; - - pDevMode.dmSize = sizeof(DEVMODE); - pDevMode.dmDriverExtra = 0; - - if (!EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &pDevMode)) - { - /* TODO: Error message */ - return ILC_COLOR; - } - - switch (pDevMode.dmBitsPerPel) - { - case 32: ColorDepth = ILC_COLOR32; break; - case 24: ColorDepth = ILC_COLOR24; break; - case 16: ColorDepth = ILC_COLOR16; break; - case 8: ColorDepth = ILC_COLOR8; break; - case 4: ColorDepth = ILC_COLOR4; break; - default: ColorDepth = ILC_COLOR; break; - } - - return ColorDepth; -} - -int -GetWindowWidth(HWND hwnd) -{ - RECT Rect; - - GetWindowRect(hwnd, &Rect); - return (Rect.right - Rect.left); -} - -int -GetWindowHeight(HWND hwnd) -{ - RECT Rect; - - GetWindowRect(hwnd, &Rect); - return (Rect.bottom - Rect.top); -} - -int -GetClientWindowWidth(HWND hwnd) -{ - RECT Rect; - - GetClientRect(hwnd, &Rect); - return (Rect.right - Rect.left); -} - -int -GetClientWindowHeight(HWND hwnd) -{ - RECT Rect; - - GetClientRect(hwnd, &Rect); - return (Rect.bottom - Rect.top); -} - -VOID -CopyTextToClipboard(LPCWSTR lpszText) -{ - HRESULT hr; - - if (OpenClipboard(NULL)) - { - HGLOBAL ClipBuffer; - WCHAR *Buffer; - DWORD cchBuffer; - - EmptyClipboard(); - cchBuffer = wcslen(lpszText) + 1; - ClipBuffer = GlobalAlloc(GMEM_DDESHARE, cchBuffer * sizeof(WCHAR)); - Buffer = GlobalLock(ClipBuffer); - hr = StringCchCopyW(Buffer, cchBuffer, lpszText); - GlobalUnlock(ClipBuffer); - - if (SUCCEEDED(hr)) - SetClipboardData(CF_UNICODETEXT, ClipBuffer); - - CloseClipboard(); - } -} - -VOID -SetWelcomeText(VOID) -{ - WCHAR szText[MAX_STR_LEN*3]; - - LoadStringW(hInst, IDS_WELCOME_TITLE, szText, sizeof(szText) / sizeof(WCHAR)); - NewRichEditText(szText, CFE_BOLD); - - LoadStringW(hInst, IDS_WELCOME_TEXT, szText, sizeof(szText) / sizeof(WCHAR)); - InsertRichEditText(szText, 0); - - LoadStringW(hInst, IDS_WELCOME_URL, szText, sizeof(szText) / sizeof(WCHAR)); - InsertRichEditText(szText, CFM_LINK); -} - -VOID -ShowPopupMenu(HWND hwnd, UINT MenuID, UINT DefaultItem) -{ - HMENU hMenu = NULL; - HMENU hPopupMenu; - MENUITEMINFO mii; - POINT pt; - - if (MenuID) - { - hMenu = LoadMenuW(hInst, MAKEINTRESOURCEW(MenuID)); - hPopupMenu = GetSubMenu(hMenu, 0); - } - else - hPopupMenu = GetMenu(hwnd); - - ZeroMemory(&mii, sizeof(mii)); - mii.cbSize = sizeof(mii); - mii.fMask = MIIM_STATE; - GetMenuItemInfo(hPopupMenu, DefaultItem, FALSE, &mii); - if (!(mii.fState & MFS_GRAYED)) - SetMenuDefaultItem(hPopupMenu, DefaultItem, FALSE); - - GetCursorPos(&pt); - - SetForegroundWindow(hwnd); - TrackPopupMenu(hPopupMenu, 0, pt.x, pt.y, 0, hMainWnd, NULL); - - if (hMenu) - DestroyMenu(hMenu); -} - -BOOL -StartProcess(LPWSTR lpPath, BOOL Wait) -{ - PROCESS_INFORMATION pi; - STARTUPINFOW si; - DWORD dwRet; - MSG msg; - - ZeroMemory(&si, sizeof(si)); - si.cb = sizeof(si); - si.dwFlags = STARTF_USESHOWWINDOW; - si.wShowWindow = SW_SHOW; - - if (!CreateProcessW(NULL, lpPath, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) - { - return FALSE; - } - - CloseHandle(pi.hThread); - if (Wait) EnableWindow(hMainWnd, FALSE); - - while (Wait) - { - dwRet = MsgWaitForMultipleObjects(1, &pi.hProcess, FALSE, INFINITE, QS_ALLEVENTS); - if (dwRet == WAIT_OBJECT_0 + 1) - { - while (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - } - else - { - if (dwRet == WAIT_OBJECT_0 || dwRet == WAIT_FAILED) - break; - } - } - - CloseHandle(pi.hProcess); - - if (Wait) - { - EnableWindow(hMainWnd, TRUE); - SetForegroundWindow(hMainWnd); - SetFocus(hMainWnd); - } - - return TRUE; -} - -BOOL -GetStorageDirectory(PWCHAR lpDirectory, DWORD cch) -{ - if (cch < MAX_PATH) - return FALSE; - - if (!SHGetSpecialFolderPathW(NULL, lpDirectory, CSIDL_LOCAL_APPDATA, TRUE)) - return FALSE; - - if (FAILED(StringCchCatW(lpDirectory, cch, L"\rapps"))) - return FALSE; - - if (!CreateDirectoryW(lpDirectory, NULL) && - GetLastError() != ERROR_ALREADY_EXISTS) - { - return FALSE; - } - - return TRUE; -} - -BOOL -ExtractFilesFromCab(LPWSTR lpCabName, LPWSTR lpOutputPath) -{ - HINSTANCE hCabinetDll; - CHAR szCabName[MAX_PATH]; - SESSION Dest; - HRESULT Result; - - hCabinetDll = LoadLibraryW(L"cabinet.dll"); - if (hCabinetDll) - { - pfnExtract = (void *) GetProcAddress(hCabinetDll, "Extract"); - if (pfnExtract) - { - ZeroMemory(&Dest, sizeof(SESSION)); - - WideCharToMultiByte(CP_ACP, 0, lpOutputPath, -1, Dest.Destination, MAX_PATH, NULL, NULL); - WideCharToMultiByte(CP_ACP, 0, lpCabName, -1, szCabName, MAX_PATH, NULL, NULL); - Dest.Operation = EXTRACT_FILLFILELIST; - - Result = pfnExtract(&Dest, szCabName); - if (Result == S_OK) - { - Dest.Operation = EXTRACT_EXTRACTFILES; - Result = pfnExtract(&Dest, szCabName); - if (Result == S_OK) - { - FreeLibrary(hCabinetDll); - return TRUE; - } - } - } - FreeLibrary(hCabinetDll); - } - - return FALSE; -} +//static +HANDLE hLog = NULL;
VOID InitLogs(VOID) { - WCHAR szBuf[MAX_PATH] = L"SYSTEM\CurrentControlSet\Services\EventLog\Application\ReactOS Application Manager"; + WCHAR szBuf[MAX_PATH] = L"SYSTEM\CurrentControlSet\Services\EventLog\Application\RosAutotest"; WCHAR szPath[MAX_PATH]; DWORD dwCategoryNum = 1; DWORD dwDisp, dwData; HKEY hKey; - - if (!SettingsInfo.bLogEnabled) return;
if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, szBuf, 0, NULL, @@ -361,7 +78,7 @@
RegCloseKey(hKey);
- hLog = RegisterEventSourceW(NULL, L"ReactOS Application Manager"); + hLog = RegisterEventSourceW(NULL, L"RosAutotest"); }
@@ -375,8 +92,6 @@ BOOL WriteLogMessage(WORD wType, DWORD dwEventID, LPWSTR lpMsg) { - if (!SettingsInfo.bLogEnabled) return TRUE; - if (!ReportEventW(hLog, wType, 0,
Propchange: trunk/rostests/rosautotest/misc.cpp ------------------------------------------------------------------------------ svn:eol-style = native
Propchange: trunk/rostests/rosautotest/misc.cpp ------------------------------------------------------------------------------ --- svn:mergeinfo (added) +++ svn:mergeinfo Wed Aug 27 20:19:43 2014 @@ -0,0 +1,20 @@ +/branches/GSoC_2011/GSoC_Network/base/applications/rapps/misc.c:51548 +/branches/GSoC_2011/GSoC_TcpIpDriver/base/applications/rapps/misc.c:51550 +/branches/GSoC_2011/TcpIpDriver/base/applications/rapps/misc.c:51551-53074,53076-53119 +/branches/GSoC_Network/base/applications/rapps/misc.c:51545-51546 +/branches/cmake-bringup/base/applications/rapps/misc.c:50484,50693,50719,51544-52564 +/branches/condrv_restructure/base/applications/rapps/misc.c:63104-63885 +/branches/header-work/base/applications/rapps/misc.c:45691-47721 +/branches/kd++/base/applications/rapps/misc.c:58883-58973 +/branches/ntvdm/base/applications/rapps/misc.c:59241-63176 +/branches/reactos-yarotows/base/applications/rapps/misc.c:45219-46371,46373-48025,48027-49273 +/branches/reactx/reactos/base/applications/rapps/misc.c:49994-49995 +/branches/ros-amd64-bringup/base/applications/rapps/misc.c:36852 +/branches/ros-amd64-bringup/reactos/base/applications/rapps/misc.c:34711-34712,34741,34743,34770,34780-34782,34803,34812,34839,34842,34864,34870,34874,34877,34908-34909,34917,34965,35323-35324,35347-35348,35361,35436,35509,35515,35588,35655,35683,35739,35746,35762,35771,35777,35781,35789,35805,35823,35827,35902,35904-35906,35942,35947-35949,35952-35953,35966,36011-36013,36172,36360,36380,36388-36389,36393,36397,36443,36445,36475,36502-36503,36505,36570,36614,36852,36898-36899,36930,36936,36949,36951,36958,36961,36964,36969,36972,36987-36988,36990,36992,37019,37322-37323,37333-37334,37434,37472,37475,37536,37820-37821,37868-37869,37873,37990-37991,38013-38014,38092,38100,38148-38151,38264-38265,38268,38355,39151,39333,39335,39345,39639,40120,40122-40123,40125,40127-40128,40155,40247,40324,40608,40753,40926-40928,40986-40987,40989,40991,40993,40995-40996,41000-41001,41027-41030,41044-41045,41047-41050,41052,41070,41082-41086,41097-41098,41101,41449,41479-41480,41483-41485,41499-41500,41502,41531,41536,41540,41546-41547,41549,43080,43426,43451,43454,43506,43566,43574,43598,43600-43602,43604-43605,43677,43682,43757,43775,43836,43838-43840,43852,43857-43858,43860,43905-43907,43952,43954,43965,43969,43979,43981,43992,44002,44036-44037,44039-44040,44044-44045,44053,44065,44095,44123,44143-44144,44205,44238,44257,44259,44294,44338-44339,44385,44389,44391,44426,44460,44467-44468,44470-44471,44499,44501,44503-44504,44506,44510-44512,44521,44523-44526,44530,44540,44601,44634,44639,44772,44818,45124,45126-45127,45430,46394,46404,46478,46511,46523-46524,46526,46534-46535,46537-46539,46589,46805,46868,47472,47846-47847,47878,47882 +/branches/ros-branch-0_3_15-lt2013/base/applications/rapps/misc.c:59059 +/branches/ros-csrss/base/applications/rapps/misc.c:57561-58762 +/branches/shell32_new-bringup/base/applications/rapps/misc.c:51893-53652,53661,53700 +/branches/tcp-rewrite-branch/base/applications/rapps/misc.c:48720,48840-48841,49424-49426,49454 +/branches/usb-bringup/base/applications/rapps/misc.c:51335,51337,51341-51343,51348,51350,51353,51355,51365-51369,51372,51384-54388,54396-54398,54736-54737,54752-54754,54756-54760,54762,54764-54765,54767-54768,54772,54774-54777,54781,54787,54790-54792,54797-54798,54806,54808,54834-54838,54843,54850,54852,54856,54858-54859 +/branches/usb-bringup-trunk/base/applications/rapps/misc.c:55019-55543,55548-55554,55556-55567 +/branches/wlan-bringup/base/applications/rapps/misc.c:54809-54998
Modified: trunk/rostests/rosautotest/precomp.h URL: http://svn.reactos.org/svn/reactos/trunk/rostests/rosautotest/precomp.h?rev=... ============================================================================== --- trunk/rostests/rosautotest/precomp.h [iso-8859-1] (original) +++ trunk/rostests/rosautotest/precomp.h [iso-8859-1] Wed Aug 27 20:19:43 2014 @@ -20,6 +20,7 @@ #include <reason.h> #include <shlobj.h> #include <wininet.h> +#include <winreg.h>
#include <ndk/rtlfuncs.h> #include <reactos/buildno.h> @@ -39,6 +40,8 @@ #include "CWebService.h" #include "CWineTest.h"
+#include <rosautotestmsg.h> + /* Useful macros */ #define EXCEPTION(Message) throw CSimpleException(Message) #define FATAL(Message) throw CFatalException(__FILE__, __LINE__, Message) @@ -46,6 +49,11 @@
/* main.c */ extern CConfiguration Configuration; + +/* misc.c */ +VOID FreeLogs(VOID); +VOID InitLogs(VOID); +extern HANDLE hLog;
/* shutdown.c */ bool ShutdownSystem();
Added: trunk/rostests/rosautotest/rosautotest.rc URL: http://svn.reactos.org/svn/reactos/trunk/rostests/rosautotest/rosautotest.rc... ============================================================================== --- trunk/rostests/rosautotest/rosautotest.rc (added) +++ trunk/rostests/rosautotest/rosautotest.rc [iso-8859-1] Wed Aug 27 20:19:43 2014 @@ -0,0 +1 @@ +#include <rosautotestmsg.rc>
Propchange: trunk/rostests/rosautotest/rosautotest.rc ------------------------------------------------------------------------------ svn:eol-style = native
Propchange: trunk/rostests/rosautotest/rosautotest.rc ------------------------------------------------------------------------------ svn:mime-type = text/plain
Added: trunk/rostests/rosautotest/rosautotestmsg.mc URL: http://svn.reactos.org/svn/reactos/trunk/rostests/rosautotest/rosautotestmsg... ============================================================================== --- trunk/rostests/rosautotest/rosautotestmsg.mc (added) +++ trunk/rostests/rosautotest/rosautotestmsg.mc [iso-8859-1] Wed Aug 27 20:19:43 2014 @@ -0,0 +1,27 @@ +MessageIdTypedef=ULONG + +SeverityNames=(Success=0x0:STATUS_SEVERITY_SUCCESS +Informational=0x1:STATUS_SEVERITY_INFORMATIONAL +Warning=0x2:STATUS_SEVERITY_WARNING +Error=0x3:STATUS_SEVERITY_ERROR) + +FacilityNames=(System=0x0:FACILITY_SYSTEM Application=0xFFF) + +LanguageNames=(English=0x409:MSG00409) + +MessageId=1 +Severity=Informational +Facility=Application +SymbolicName=MSG_TESTS_STARTED +Language=English +ReactOS Automatic Testing Utility is started. +. + +MessageId=2 +Severity=Success +Facility=Application +SymbolicName=MSG_TESTS_SUCCESSFUL +Language=English +ReactOS Automatic Testing Utility is successful. +. +
Propchange: trunk/rostests/rosautotest/rosautotestmsg.mc ------------------------------------------------------------------------------ svn:eol-style = native
Propchange: trunk/rostests/rosautotest/rosautotestmsg.mc ------------------------------------------------------------------------------ svn:mime-type = text/plain