├── .gitignore ├── License ├── README.md ├── build ├── dllmain.cpp ├── slogger-dynamic.vcxproj ├── slogger-dynamic.vcxproj.filters ├── slogger-static.vcxproj ├── slogger-static.vcxproj.filters ├── slogger.common.props ├── stdafx.cpp ├── stdafx.h └── targetver.h ├── sLogger.sln ├── sample └── sLoggerClientDemo │ ├── sLoggerClientDemo.cpp │ ├── sLoggerClientDemo.vcxproj │ ├── sLoggerClientDemo.vcxproj.filters │ ├── stdafx.cpp │ ├── stdafx.h │ └── targetver.h ├── src ├── Include │ └── Logger.h ├── Interface │ ├── ISLogMessageProcessor.h │ └── ISLoggerMessage.h ├── Logger.cpp ├── Message │ ├── SLoggerMessage.cpp │ └── SLoggerMessage.h ├── Processor │ ├── Output │ │ ├── SLoggerSystemOutput.cpp │ │ └── SLoggerSystemOutput.h │ ├── Sender │ │ ├── SLoggerSender.cpp │ │ └── SLoggerSender.h │ └── Storage │ │ ├── SLoggerFileStorage.cpp │ │ └── SLoggerFileStorage.h ├── SLogger │ ├── SLogger.cpp │ └── SLogger.h ├── common.h ├── sLogger.vcxitems ├── sLogger.vcxitems.filters ├── sLoggerMessage.vcxitems └── sLoggerMessage.vcxitems.filters └── tools └── sLogViewer ├── AboutDlg.h ├── FilterRulesDlg.cpp ├── FilterRulesDlg.h ├── GPLogViewer.h ├── MainFrm.cpp ├── MainFrm.h ├── SLogFilterManager.cpp ├── SLogFilterManager.h ├── SLogItemDetailView.cpp ├── SLogItemDetailView.h ├── SLogItemListView.cpp ├── SLogItemListView.h ├── SLogMessageManager.cpp ├── SLogMessageManager.h ├── SLogReceiver.cpp ├── SLogReceiver.h ├── SLogViewer.cpp ├── SLogViewer.rc ├── SLoggerViewer.vcxproj ├── SLoggerViewer.vcxproj.filters ├── WTL └── Include │ ├── atlapp.h │ ├── atlcrack.h │ ├── atlctrls.h │ ├── atlctrlw.h │ ├── atlctrlx.h │ ├── atlddx.h │ ├── atldlgs.h │ ├── atldwm.h │ ├── atlfind.h │ ├── atlframe.h │ ├── atlgdi.h │ ├── atlmisc.h │ ├── atlprint.h │ ├── atlres.h │ ├── atlresce.h │ ├── atlribbon.h │ ├── atlscrl.h │ ├── atlsplit.h │ ├── atltheme.h │ ├── atluser.h │ ├── atlwince.h │ └── atlwinx.h ├── res ├── SLogViewer.ico ├── Toolbar.bmp └── toolbar_res.bmp ├── resource.h ├── stdafx.cpp └── stdafx.h /.gitignore: -------------------------------------------------------------------------------- 1 | *.user 2 | *.aps 3 | /.vs 4 | /sLogger.VC.db 5 | /output 6 | /temp 7 | -------------------------------------------------------------------------------- /License: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Sheen 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # sLogger 2 | 3 | A simple logger for client application 4 | 5 | Last build status: 6 | ![build-status](https://tishion.visualstudio.com/_apis/public/build/definitions/26071245-d50d-4615-850e-47f4d41231b9/13/badge) 7 | -------------------------------------------------------------------------------- /build/dllmain.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include 3 | 4 | BOOL APIENTRY DllMain(HMODULE /* hModule */, DWORD ul_reason_for_call, LPVOID /* lpReserved */) 5 | { 6 | switch (ul_reason_for_call) 7 | { 8 | case DLL_PROCESS_ATTACH: 9 | case DLL_THREAD_ATTACH: 10 | case DLL_THREAD_DETACH: 11 | case DLL_PROCESS_DETACH: 12 | break; 13 | } 14 | return TRUE; 15 | } 16 | -------------------------------------------------------------------------------- /build/slogger-dynamic.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | {E2B4979A-9548-4E77-9E09-698A76E0EC9D} 23 | Win32Proj 24 | sloggerdynamic 25 | 10.0.10586.0 26 | 27 | 28 | 29 | DynamicLibrary 30 | true 31 | v141 32 | Unicode 33 | 34 | 35 | DynamicLibrary 36 | false 37 | v141 38 | true 39 | Unicode 40 | 41 | 42 | DynamicLibrary 43 | true 44 | v141 45 | Unicode 46 | 47 | 48 | DynamicLibrary 49 | false 50 | v141 51 | true 52 | Unicode 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | true 80 | $(SolutionDir)output\$(Platform)\$(Configuration)\$(SolutionName)\bin\ 81 | 82 | 83 | true 84 | $(SolutionDir)output\$(Platform)\$(Configuration)\$(SolutionName)\bin\ 85 | 86 | 87 | false 88 | $(SolutionDir)output\$(Platform)\$(Configuration)\$(SolutionName)\bin\ 89 | 90 | 91 | false 92 | $(SolutionDir)output\$(Platform)\$(Configuration)\$(SolutionName)\bin\ 93 | 94 | 95 | 96 | Use 97 | Level3 98 | Disabled 99 | WIN32;_DEBUG;_WINDOWS;_USRDLL;SLOGGERDYNAMIC;SLOGGERDYNAMIC_EXPORTS;%(PreprocessorDefinitions); 100 | 101 | 102 | Windows 103 | true 104 | 105 | 106 | xcopy /y /s /i "$(SolutionDir)src\include\*" "$(SolutionDir)output\$(Platform)\$(Configuration)\$(SolutionName)\include\" 107 | 108 | 109 | 110 | 111 | Use 112 | Level3 113 | Disabled 114 | _DEBUG;_WINDOWS;_USRDLL;SLOGGERDYNAMIC;SLOGGERDYNAMIC_EXPORTS;%(PreprocessorDefinitions); 115 | 116 | 117 | Windows 118 | true 119 | 120 | 121 | xcopy /y /s /i "$(SolutionDir)src\include\*" "$(SolutionDir)output\$(Platform)\$(Configuration)\$(SolutionName)\include\" 122 | 123 | 124 | 125 | 126 | Level3 127 | Use 128 | MaxSpeed 129 | true 130 | true 131 | WIN32;NDEBUG;_WINDOWS;_USRDLL;SLOGGERDYNAMIC;SLOGGERDYNAMIC_EXPORTS;%(PreprocessorDefinitions); 132 | 133 | 134 | Windows 135 | true 136 | true 137 | true 138 | 139 | 140 | xcopy /y /s /i "$(SolutionDir)src\include\*" "$(SolutionDir)output\$(Platform)\$(Configuration)\$(SolutionName)\include\" 141 | 142 | 143 | 144 | 145 | Level3 146 | Use 147 | MaxSpeed 148 | true 149 | true 150 | NDEBUG;_WINDOWS;_USRDLL;SLOGGERDYNAMIC;SLOGGERDYNAMIC_EXPORTS;%(PreprocessorDefinitions); 151 | 152 | 153 | Windows 154 | true 155 | true 156 | true 157 | 158 | 159 | xcopy /y /s /i "$(SolutionDir)src\include\*" "$(SolutionDir)output\$(Platform)\$(Configuration)\$(SolutionName)\include\" 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | false 169 | 170 | 171 | false 172 | 173 | 174 | false 175 | 176 | 177 | false 178 | 179 | 180 | 181 | 182 | Create 183 | Create 184 | Create 185 | Create 186 | 187 | 188 | 189 | 190 | 191 | -------------------------------------------------------------------------------- /build/slogger-dynamic.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | 26 | 27 | Source Files 28 | 29 | 30 | Source Files 31 | 32 | 33 | -------------------------------------------------------------------------------- /build/slogger-static.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | {DD69B015-3805-443E-8369-A39F00E19168} 23 | Win32Proj 24 | sloggerstatic 25 | 10.0.10586.0 26 | 27 | 28 | 29 | StaticLibrary 30 | true 31 | v141 32 | Unicode 33 | 34 | 35 | StaticLibrary 36 | false 37 | v141 38 | true 39 | Unicode 40 | 41 | 42 | StaticLibrary 43 | true 44 | v141 45 | Unicode 46 | 47 | 48 | StaticLibrary 49 | false 50 | v141 51 | true 52 | Unicode 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | $(SolutionDir)output\$(Platform)\$(Configuration)\$(SolutionName)\lib\ 80 | 81 | 82 | $(SolutionDir)output\$(Platform)\$(Configuration)\$(SolutionName)\lib\ 83 | 84 | 85 | $(SolutionDir)output\$(Platform)\$(Configuration)\$(SolutionName)\lib\ 86 | 87 | 88 | $(SolutionDir)output\$(Platform)\$(Configuration)\$(SolutionName)\lib\ 89 | 90 | 91 | 92 | Use 93 | Level3 94 | Disabled 95 | SLOGGERSTATIC;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) 96 | 97 | 98 | Windows 99 | 100 | 101 | xcopy /y /s /i "$(SolutionDir)src\include\*" "$(SolutionDir)output\$(Platform)\$(Configuration)\$(SolutionName)\include\" 102 | 103 | 104 | 105 | 106 | Use 107 | Level3 108 | Disabled 109 | SLOGGERSTATIC;_DEBUG;_LIB;%(PreprocessorDefinitions) 110 | 111 | 112 | Windows 113 | 114 | 115 | xcopy /y /s /i "$(SolutionDir)src\include\*" "$(SolutionDir)output\$(Platform)\$(Configuration)\$(SolutionName)\include\" 116 | 117 | 118 | 119 | 120 | Level3 121 | Use 122 | MaxSpeed 123 | true 124 | true 125 | SLOGGERSTATIC;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) 126 | 127 | 128 | Windows 129 | true 130 | true 131 | 132 | 133 | xcopy /y /s /i "$(SolutionDir)src\include\*" "$(SolutionDir)output\$(Platform)\$(Configuration)\$(SolutionName)\include\" 134 | 135 | 136 | 137 | 138 | Level3 139 | Use 140 | MaxSpeed 141 | true 142 | true 143 | SLOGGERSTATIC;NDEBUG;_LIB;%(PreprocessorDefinitions) 144 | 145 | 146 | Windows 147 | true 148 | true 149 | 150 | 151 | xcopy /y /s /i "$(SolutionDir)src\include\*" "$(SolutionDir)output\$(Platform)\$(Configuration)\$(SolutionName)\include\" 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | Create 161 | Create 162 | Create 163 | Create 164 | 165 | 166 | 167 | 168 | 169 | -------------------------------------------------------------------------------- /build/slogger-static.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | 26 | 27 | Source Files 28 | 29 | 30 | -------------------------------------------------------------------------------- /build/slogger.common.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | $(SolutionDir)output\$(Platform)\$(Configuration)\ 7 | $(SolutionDir)temp\$(Platform)\$(Configuration)\$(ProjectName)\ 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /build/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // slogger-static.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /build/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #if defined(_WIN32) 9 | 10 | #include "targetver.h" 11 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 12 | 13 | #include 14 | #include 15 | 16 | #endif 17 | 18 | // TODO: reference additional headers your program requires here 19 | -------------------------------------------------------------------------------- /build/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /sLogger.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{0363010C-EBD2-4306-91DB-55EA041B313E}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{9B122E54-DB51-4023-978F-C3D520C183D1}" 9 | EndProject 10 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{4AB11EC4-B573-4537-A897-B024123AD5BF}" 11 | EndProject 12 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sample", "sample", "{10BC8C10-4A3E-4637-AE28-42C7A10B30D6}" 13 | EndProject 14 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "slogger-dynamic", "build\slogger-dynamic.vcxproj", "{E2B4979A-9548-4E77-9E09-698A76E0EC9D}" 15 | EndProject 16 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "slogger-static", "build\slogger-static.vcxproj", "{DD69B015-3805-443E-8369-A39F00E19168}" 17 | EndProject 18 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sLoggerClientDemo", "sample\sLoggerClientDemo\sLoggerClientDemo.vcxproj", "{EACBB550-CB1F-4E00-926A-2B30A3DBC5AB}" 19 | ProjectSection(ProjectDependencies) = postProject 20 | {DD69B015-3805-443E-8369-A39F00E19168} = {DD69B015-3805-443E-8369-A39F00E19168} 21 | {E2B4979A-9548-4E77-9E09-698A76E0EC9D} = {E2B4979A-9548-4E77-9E09-698A76E0EC9D} 22 | EndProjectSection 23 | EndProject 24 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SLogViewer", "tools\sLogViewer\SLoggerViewer.vcxproj", "{5CEBF4BF-A964-444A-88C2-2A3EDA07E607}" 25 | ProjectSection(ProjectDependencies) = postProject 26 | {DD69B015-3805-443E-8369-A39F00E19168} = {DD69B015-3805-443E-8369-A39F00E19168} 27 | {E2B4979A-9548-4E77-9E09-698A76E0EC9D} = {E2B4979A-9548-4E77-9E09-698A76E0EC9D} 28 | EndProjectSection 29 | EndProject 30 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sLogger", "src\sLogger.vcxitems", "{45D41ACC-2C3C-43D2-BC10-02AA73FFC7C7}" 31 | EndProject 32 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sLoggerMessage", "src\sLoggerMessage.vcxitems", "{1B74DB0B-29E4-4160-BC67-AFB30CBC4362}" 33 | EndProject 34 | Global 35 | GlobalSection(SharedMSBuildProjectFiles) = preSolution 36 | src\sLoggerMessage.vcxitems*{1b74db0b-29e4-4160-bc67-afb30cbc4362}*SharedItemsImports = 9 37 | src\sLogger.vcxitems*{45d41acc-2c3c-43d2-bc10-02aa73ffc7c7}*SharedItemsImports = 9 38 | src\sLoggerMessage.vcxitems*{5cebf4bf-a964-444a-88c2-2a3eda07e607}*SharedItemsImports = 4 39 | src\sLogger.vcxitems*{dd69b015-3805-443e-8369-a39f00e19168}*SharedItemsImports = 4 40 | src\sLoggerMessage.vcxitems*{dd69b015-3805-443e-8369-a39f00e19168}*SharedItemsImports = 4 41 | src\sLogger.vcxitems*{e2b4979a-9548-4e77-9e09-698a76e0ec9d}*SharedItemsImports = 4 42 | src\sLoggerMessage.vcxitems*{e2b4979a-9548-4e77-9e09-698a76e0ec9d}*SharedItemsImports = 4 43 | EndGlobalSection 44 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 45 | Debug|x64 = Debug|x64 46 | Debug|x86 = Debug|x86 47 | Release|x64 = Release|x64 48 | Release|x86 = Release|x86 49 | EndGlobalSection 50 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 51 | {E2B4979A-9548-4E77-9E09-698A76E0EC9D}.Debug|x64.ActiveCfg = Debug|x64 52 | {E2B4979A-9548-4E77-9E09-698A76E0EC9D}.Debug|x64.Build.0 = Debug|x64 53 | {E2B4979A-9548-4E77-9E09-698A76E0EC9D}.Debug|x86.ActiveCfg = Debug|Win32 54 | {E2B4979A-9548-4E77-9E09-698A76E0EC9D}.Debug|x86.Build.0 = Debug|Win32 55 | {E2B4979A-9548-4E77-9E09-698A76E0EC9D}.Release|x64.ActiveCfg = Release|x64 56 | {E2B4979A-9548-4E77-9E09-698A76E0EC9D}.Release|x64.Build.0 = Release|x64 57 | {E2B4979A-9548-4E77-9E09-698A76E0EC9D}.Release|x86.ActiveCfg = Release|Win32 58 | {E2B4979A-9548-4E77-9E09-698A76E0EC9D}.Release|x86.Build.0 = Release|Win32 59 | {DD69B015-3805-443E-8369-A39F00E19168}.Debug|x64.ActiveCfg = Debug|x64 60 | {DD69B015-3805-443E-8369-A39F00E19168}.Debug|x64.Build.0 = Debug|x64 61 | {DD69B015-3805-443E-8369-A39F00E19168}.Debug|x86.ActiveCfg = Debug|Win32 62 | {DD69B015-3805-443E-8369-A39F00E19168}.Debug|x86.Build.0 = Debug|Win32 63 | {DD69B015-3805-443E-8369-A39F00E19168}.Release|x64.ActiveCfg = Release|x64 64 | {DD69B015-3805-443E-8369-A39F00E19168}.Release|x64.Build.0 = Release|x64 65 | {DD69B015-3805-443E-8369-A39F00E19168}.Release|x86.ActiveCfg = Release|Win32 66 | {DD69B015-3805-443E-8369-A39F00E19168}.Release|x86.Build.0 = Release|Win32 67 | {EACBB550-CB1F-4E00-926A-2B30A3DBC5AB}.Debug|x64.ActiveCfg = Debug|x64 68 | {EACBB550-CB1F-4E00-926A-2B30A3DBC5AB}.Debug|x64.Build.0 = Debug|x64 69 | {EACBB550-CB1F-4E00-926A-2B30A3DBC5AB}.Debug|x86.ActiveCfg = Debug|Win32 70 | {EACBB550-CB1F-4E00-926A-2B30A3DBC5AB}.Debug|x86.Build.0 = Debug|Win32 71 | {EACBB550-CB1F-4E00-926A-2B30A3DBC5AB}.Release|x64.ActiveCfg = Release|x64 72 | {EACBB550-CB1F-4E00-926A-2B30A3DBC5AB}.Release|x64.Build.0 = Release|x64 73 | {EACBB550-CB1F-4E00-926A-2B30A3DBC5AB}.Release|x86.ActiveCfg = Release|Win32 74 | {EACBB550-CB1F-4E00-926A-2B30A3DBC5AB}.Release|x86.Build.0 = Release|Win32 75 | {5CEBF4BF-A964-444A-88C2-2A3EDA07E607}.Debug|x64.ActiveCfg = Debug|x64 76 | {5CEBF4BF-A964-444A-88C2-2A3EDA07E607}.Debug|x86.ActiveCfg = Debug|Win32 77 | {5CEBF4BF-A964-444A-88C2-2A3EDA07E607}.Debug|x86.Build.0 = Debug|Win32 78 | {5CEBF4BF-A964-444A-88C2-2A3EDA07E607}.Release|x64.ActiveCfg = Release|Win32 79 | {5CEBF4BF-A964-444A-88C2-2A3EDA07E607}.Release|x86.ActiveCfg = Release|Win32 80 | {5CEBF4BF-A964-444A-88C2-2A3EDA07E607}.Release|x86.Build.0 = Release|Win32 81 | EndGlobalSection 82 | GlobalSection(SolutionProperties) = preSolution 83 | HideSolutionNode = FALSE 84 | EndGlobalSection 85 | GlobalSection(NestedProjects) = preSolution 86 | {E2B4979A-9548-4E77-9E09-698A76E0EC9D} = {9B122E54-DB51-4023-978F-C3D520C183D1} 87 | {DD69B015-3805-443E-8369-A39F00E19168} = {9B122E54-DB51-4023-978F-C3D520C183D1} 88 | {EACBB550-CB1F-4E00-926A-2B30A3DBC5AB} = {10BC8C10-4A3E-4637-AE28-42C7A10B30D6} 89 | {5CEBF4BF-A964-444A-88C2-2A3EDA07E607} = {4AB11EC4-B573-4537-A897-B024123AD5BF} 90 | {45D41ACC-2C3C-43D2-BC10-02AA73FFC7C7} = {0363010C-EBD2-4306-91DB-55EA041B313E} 91 | {1B74DB0B-29E4-4160-BC67-AFB30CBC4362} = {0363010C-EBD2-4306-91DB-55EA041B313E} 92 | EndGlobalSection 93 | EndGlobal 94 | -------------------------------------------------------------------------------- /sample/sLoggerClientDemo/sLoggerClientDemo.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tishion/sLogger/23dbafd16ef8aae37526e6d53156f554f0e2142f/sample/sLoggerClientDemo/sLoggerClientDemo.cpp -------------------------------------------------------------------------------- /sample/sLoggerClientDemo/sLoggerClientDemo.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | {EACBB550-CB1F-4E00-926A-2B30A3DBC5AB} 23 | Win32Proj 24 | sLoggerClientDemo 25 | 10.0.10586.0 26 | 27 | 28 | 29 | Application 30 | true 31 | v141 32 | Unicode 33 | 34 | 35 | Application 36 | false 37 | v141 38 | true 39 | Unicode 40 | 41 | 42 | Application 43 | true 44 | v141 45 | Unicode 46 | 47 | 48 | Application 49 | false 50 | v141 51 | true 52 | Unicode 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | true 74 | $(SolutionDir)output\$(Platform)\$(Configuration)\$(SolutionName)\include\;$(VC_IncludePath);$(WindowsSDK_IncludePath); 75 | $(SolutionDir)output\$(Platform)\$(Configuration)\$(SolutionName)\lib\;$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86 76 | $(SolutionDir)output\$(Platform)\$(Configuration)\sample\ 77 | $(SolutionDir)temp\$(Platform)\$(Configuration)\$(SolutionName)\ 78 | 79 | 80 | true 81 | $(SolutionDir)output\$(Platform)\$(Configuration)\$(SolutionName)\include\;$(VC_IncludePath);$(WindowsSDK_IncludePath); 82 | $(SolutionDir)output\$(Platform)\$(Configuration)\$(SolutionName)\lib\;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64 83 | $(SolutionDir)output\$(Platform)\$(Configuration)\sample\ 84 | $(SolutionDir)temp\$(Platform)\$(Configuration)\$(SolutionName)\ 85 | 86 | 87 | false 88 | $(SolutionDir)output\$(Platform)\$(Configuration)\$(SolutionName)\include\;$(VC_IncludePath);$(WindowsSDK_IncludePath); 89 | $(SolutionDir)output\$(Platform)\$(Configuration)\$(SolutionName)\lib\;$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86 90 | $(SolutionDir)output\$(Platform)\$(Configuration)\sample\ 91 | $(SolutionDir)temp\$(Platform)\$(Configuration)\$(SolutionName)\ 92 | 93 | 94 | false 95 | $(SolutionDir)output\$(Platform)\$(Configuration)\$(SolutionName)\include\;$(VC_IncludePath);$(WindowsSDK_IncludePath); 96 | $(SolutionDir)output\$(Platform)\$(Configuration)\$(SolutionName)\lib\;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64 97 | $(SolutionDir)output\$(Platform)\$(Configuration)\sample\ 98 | $(SolutionDir)temp\$(Platform)\$(Configuration)\$(SolutionName)\ 99 | 100 | 101 | 102 | Use 103 | Level3 104 | Disabled 105 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 106 | 107 | 108 | Console 109 | true 110 | 111 | 112 | 113 | 114 | Use 115 | Level3 116 | Disabled 117 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions) 118 | 119 | 120 | Console 121 | true 122 | 123 | 124 | 125 | 126 | Level3 127 | Use 128 | MaxSpeed 129 | true 130 | true 131 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 132 | 133 | 134 | Console 135 | true 136 | true 137 | true 138 | 139 | 140 | 141 | 142 | Level3 143 | Use 144 | MaxSpeed 145 | true 146 | true 147 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 148 | 149 | 150 | Console 151 | true 152 | true 153 | true 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | Create 164 | Create 165 | Create 166 | Create 167 | 168 | 169 | 170 | 171 | 172 | -------------------------------------------------------------------------------- /sample/sLoggerClientDemo/sLoggerClientDemo.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | 26 | 27 | Source Files 28 | 29 | 30 | Source Files 31 | 32 | 33 | -------------------------------------------------------------------------------- /sample/sLoggerClientDemo/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // sLoggerClientDemo.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /sample/sLoggerClientDemo/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #include "targetver.h" 9 | 10 | #include 11 | #include 12 | 13 | 14 | #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit 15 | 16 | #include 17 | #include 18 | 19 | // TODO: reference additional headers your program requires here 20 | -------------------------------------------------------------------------------- /sample/sLoggerClientDemo/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /src/Include/Logger.h: -------------------------------------------------------------------------------- 1 | #ifndef LOGGER_H 2 | #define LOGGER_H 3 | 4 | #include 5 | 6 | // For building of dynamic module 7 | #if defined(SLOGGERDYNAMIC) 8 | #if defined(SLOGGERDYNAMIC_EXPORTS) 9 | #define SLOGGER_API __declspec(dllexport) 10 | #else 11 | #define SLOGGER_API __declspec(dllimport) 12 | #endif 13 | #endif 14 | 15 | // For building of using of static module 16 | #if defined(SLOGGERSTATIC) 17 | #define SLOGGER_API 18 | #endif 19 | 20 | /// 21 | /// The sLogger namespace. 22 | /// 23 | namespace sLogger 24 | { 25 | /// 26 | /// The log levels. 27 | /// 28 | enum LOG_LEVEL 29 | { 30 | /// 31 | /// The debug log level. 32 | /// 33 | eLogLvl_Debug = 0, 34 | 35 | /// 36 | /// The release log level. 37 | /// 38 | eLogLvl_Release, 39 | }; 40 | 41 | /// 42 | /// Initializes the logger. 43 | /// 44 | /// 45 | /// 46 | bool SLOGGER_API Initialize(const std::string& parameter = ""); 47 | 48 | /// 49 | /// Logs UTF-8 message. 50 | /// 51 | /// The log level. 52 | /// The log filter in UTF-8 string. 53 | /// The format in UTF-8 string. 54 | void SLOGGER_API LogA(int nLevel, const std::string& strFilter, const std::string strFormat, ...); 55 | 56 | /// 57 | /// Logs UTF-16 message. 58 | /// 59 | /// The log level. 60 | /// The log filter in UTF-16 string. 61 | /// The format in UTF-16 string. 62 | void SLOGGER_API LogW(int nLevel, const std::wstring& strFilter, const std::wstring strFormat, ...); 63 | 64 | /// 65 | /// Logs UTF-8 message. 66 | /// 67 | /// The log level. 68 | /// The log filter in UTF-8 string. 69 | /// The log text content in UTF-8 string. 70 | void SLOGGER_API LogA(int nLevel, const std::string& strFilter, const std::string& strText); 71 | 72 | /// 73 | /// Logs UTF-16 message. 74 | /// 75 | /// The log level. 76 | /// The log filter in UTF-16 string. 77 | /// The log text content int UTF-16 string. 78 | void SLOGGER_API LogW(int nLevel, const std::wstring& strFilter, const std::wstring& strText); 79 | 80 | /// 81 | /// Logs UTF-8 message. 82 | /// 83 | /// The log level. 84 | /// The log filter in UTF-8 string. 85 | /// The log text content int UTF-8 string stream. 86 | void SLOGGER_API LogA(int nLevel, const std::string& strFilter, const std::ostringstream& strText); 87 | 88 | /// 89 | /// Logs UTF-16 message. 90 | /// 91 | /// The log level. 92 | /// The log filter in UTF-8 string. 93 | /// The log text content int UTF-16 string stream. 94 | void SLOGGER_API LogW(int nLevel, const std::wstring& strFilter, const std::wostringstream& strText); 95 | }; 96 | 97 | /* 98 | * Log Macros 99 | * use log macros rather than log functions 100 | */ 101 | 102 | /// 103 | /// 104 | /// 105 | #define SLogDA(filter, format, ...) sLogger::LogA(sLogger::eLogLvl_Debug, filter, format, ##__VA_ARGS__) 106 | 107 | /// 108 | /// 109 | /// 110 | #define SLogDW(filter, format, ...) sLogger::LogW(sLogger::eLogLvl_Debug, filter, format, ##__VA_ARGS__) 111 | 112 | /// 113 | /// 114 | /// 115 | #define SLogRA(filter, format, ...) sLogger::LogA(sLogger::eLogLvl_Release, filter, format, ##__VA_ARGS__) 116 | 117 | /// 118 | /// 119 | /// 120 | #define SLogRW(filter, format, ...) sLogger::LogW(sLogger::eLogLvl_Release, filter, format, ##__VA_ARGS__) 121 | 122 | /* 123 | * Output log string with RELEASE level 124 | * This macro can use variable number of arguments. 125 | */ 126 | //#if defined(_UNICODE) || defined(UNICODE) 127 | //#define SLogD SLogDW 128 | //#define SLogR SLogRW 129 | //#else 130 | //#define SLogD SLogDA 131 | //#define SLogR SLogRA 132 | //#endif 133 | 134 | #endif -------------------------------------------------------------------------------- /src/Interface/ISLogMessageProcessor.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../common.h" 3 | #include "ISLoggerMessage.h" 4 | 5 | /// 6 | /// The inferface of log message processor. 7 | /// 8 | class ISLogMessageProcessor 9 | { 10 | public: 11 | /// 12 | /// Destructor. 13 | /// 14 | virtual ~ISLogMessageProcessor(void) {}; 15 | 16 | /// 17 | /// Initializes the processor. 18 | /// 19 | /// The parameter. 20 | /// True if successful; otherwise false. 21 | virtual bool Initialize(const SLUtf8String& parameter) = 0; 22 | 23 | /// 24 | /// Uninitializes the processor. 25 | /// 26 | /// True if successful; otherwise false. 27 | virtual bool UnInitialize(void) = 0; 28 | 29 | /// 30 | /// Processes the log message. 31 | /// 32 | /// The log message object. 33 | virtual void ProcessLogMessage(const SLoggerMessagePtr& msg) = 0; 34 | }; 35 | 36 | /// 37 | /// Smart pointer of . 38 | /// 39 | typedef std::shared_ptr SLogMessageProcessorPtr; 40 | 41 | /// 42 | /// The processor list type. 43 | /// 44 | typedef std::vector SLogMessageProcessorList; -------------------------------------------------------------------------------- /src/Interface/ISLoggerMessage.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | /// 6 | /// Declare property 7 | /// 8 | #define DECLARE_PROPERTY(Type, Name) \ 9 | public: \ 10 | virtual void Set##Name(const Type& value) = 0; \ 11 | virtual Type Get##Name() const = 0; 12 | 13 | 14 | /// 15 | /// The interface of log message. 16 | /// 17 | class ISLoggerMessage 18 | { 19 | public: 20 | /// 21 | /// Destructor. 22 | /// 23 | virtual ~ISLoggerMessage(void) {}; 24 | 25 | /// 26 | /// Time stamp. 27 | /// 28 | DECLARE_PROPERTY(int64_t, TimeStamp); 29 | 30 | /// 31 | /// Tick count. 32 | /// 33 | DECLARE_PROPERTY(uint32_t, TickCount); 34 | 35 | /// 36 | /// Log level. 37 | /// 38 | DECLARE_PROPERTY(uint32_t, LogLevel); 39 | 40 | /// 41 | /// Process ID. 42 | /// 43 | DECLARE_PROPERTY(uint32_t, ProcessId); 44 | 45 | /// 46 | /// Thread ID. 47 | /// 48 | DECLARE_PROPERTY(uint32_t, ThreadId); 49 | 50 | /// 51 | /// Log filter Utf16 string. 52 | /// 53 | DECLARE_PROPERTY(std::wstring, LogFilter); 54 | 55 | /// 56 | /// Log text utf16 string. 57 | /// 58 | DECLARE_PROPERTY(std::wstring, LogText); 59 | 60 | /// 61 | /// Formats the log message as UTF-16 string. 62 | /// 63 | /// The log message string. 64 | virtual std::wstring FormatLogMessage() = 0; 65 | 66 | /// 67 | /// Deserializes the bytes array data to message object. 68 | /// 69 | /// The bytes array buffer. 70 | /// True if successful; otherwise false. 71 | virtual bool FromBytesArray(const std::vector& buffer) = 0; 72 | 73 | /// 74 | /// Serializes the message object to bytes array. 75 | /// 76 | /// The bytes array buffer to recieve the data. 77 | /// True if successful; otherwise false. 78 | virtual bool ToBytesArray(std::vector& buffer) const = 0; 79 | }; 80 | 81 | /// 82 | /// The smart pointer of . 83 | /// 84 | typedef std::shared_ptr SLoggerMessagePtr; -------------------------------------------------------------------------------- /src/Logger.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "common.h" 3 | #include "Include/Logger.h" 4 | #include "SLogger/SLogger.h" 5 | 6 | static SLUtf16StringConvert s_SLUtf16StringConvert; 7 | 8 | bool SLOGGER_API sLogger::Initialize(const std::string& parameter) 9 | { 10 | return CSLogger::getInstance().Initialize(parameter); 11 | } 12 | 13 | void SLOGGER_API sLogger::LogA(int nLevel, const std::string& strFilter, const std::string strFormat, ...) 14 | { 15 | if (strFormat.empty()) 16 | return; 17 | 18 | va_list arglist; 19 | char szText[LOG_STRING_MAX_LEN] = { 0 }; 20 | int nBufLen = -1; 21 | 22 | va_start(arglist, strFormat); 23 | nBufLen = vsprintf_s((char*)szText, LOG_STRING_MAX_LEN, strFormat.c_str(), arglist); 24 | va_end(arglist); 25 | if (nBufLen <= 0) 26 | return; 27 | 28 | SLUtf16String strFlt = s_SLUtf16StringConvert.from_bytes(strFilter); 29 | SLUtf16String strText = s_SLUtf16StringConvert.from_bytes(szText); 30 | 31 | CSLogger::getInstance().Log(nLevel, strFlt, strText); 32 | } 33 | 34 | void SLOGGER_API sLogger::LogW(int nLevel, const std::wstring& strFilter, const std::wstring strFormat, ...) 35 | { 36 | if (strFormat.empty()) 37 | return; 38 | 39 | va_list arglist; 40 | wchar_t wszText[LOG_STRING_MAX_LEN] = { 0 }; 41 | int nBufLen = -1; 42 | 43 | va_start(arglist, strFormat); 44 | nBufLen = vswprintf_s((wchar_t *)wszText, LOG_STRING_MAX_LEN, strFormat.c_str(), arglist); 45 | va_end(arglist); 46 | if (nBufLen <= 0) 47 | return; 48 | 49 | SLUtf16String strText = wszText; 50 | 51 | CSLogger::getInstance().Log(nLevel, strFilter, strText); 52 | } 53 | 54 | void SLOGGER_API sLogger::LogA(int nLevel, const std::string& strFilter, const std::string& strText) 55 | { 56 | SLUtf16String filter = s_SLUtf16StringConvert.from_bytes(strFilter); 57 | SLUtf16String text = s_SLUtf16StringConvert.from_bytes(strText); 58 | 59 | CSLogger::getInstance().Log(nLevel, filter, text); 60 | } 61 | 62 | void SLOGGER_API sLogger::LogW(int nLevel, const std::wstring& strFilter, const std::wstring& strText) 63 | { 64 | CSLogger::getInstance().Log(nLevel, strFilter, strText); 65 | } 66 | 67 | void SLOGGER_API sLogger::LogA(int nLevel, const std::string& strFilter, const std::ostringstream& strText) 68 | { 69 | SLUtf16String filter = s_SLUtf16StringConvert.from_bytes(strFilter); 70 | SLUtf16String text = s_SLUtf16StringConvert.from_bytes(strText.str()); 71 | 72 | CSLogger::getInstance().Log(nLevel, filter, text); 73 | } 74 | 75 | void SLOGGER_API sLogger::LogW(int nLevel, const std::wstring& strFilter, const std::wostringstream& strText) 76 | { 77 | CSLogger::getInstance().Log(nLevel, strFilter, strText.str()); 78 | } -------------------------------------------------------------------------------- /src/Message/SLoggerMessage.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include 3 | #include "../common.h" 4 | #include "SLoggerMessage.h" 5 | 6 | CSLoggerMessage::CSLoggerMessage(void) 7 | { 8 | } 9 | 10 | CSLoggerMessage::~CSLoggerMessage(void) 11 | { 12 | } 13 | 14 | std::wstring CSLoggerMessage::FormatLogMessage() 15 | { 16 | SLOUtf16StringStream oss; 17 | 18 | char timeStampText[32]; 19 | if (std::strftime(timeStampText, sizeof(timeStampText), "%Y-%m-%d %H:%M:%S", std::localtime(&m_TimeStamp))) 20 | oss << std::setw(19) << timeStampText << " "; 21 | else 22 | oss << std::setw(19) << m_TimeStamp << " "; 23 | 24 | oss << std::setw(10) << std::left << m_TickCount << " "; 25 | 26 | if (0 == m_LogLevel) 27 | oss << L"DEBUG " << " "; 28 | else 29 | oss << L"RELEASE" << " "; 30 | 31 | oss << std::setw(10) << m_ProcessId << " "; 32 | oss << std::setw(10) << m_ThreadId << " "; 33 | oss << m_LogFilter << " "; 34 | oss << m_LogText; 35 | oss << std::endl; 36 | 37 | return oss.str(); 38 | } 39 | 40 | bool CSLoggerMessage::FromBytesArray(const std::vector& buffer) 41 | { 42 | SLUtf16StringConvert Utf16StringConvert; 43 | 44 | m_TimeStamp = 0; 45 | m_TickCount = 0; 46 | m_ProcessId = 0; 47 | m_ThreadId = 0; 48 | m_LogLevel = 0; 49 | 50 | uint8_t* p = (uint8_t*)buffer.data(); 51 | uint8_t* pLimit = p + buffer.size(); 52 | 53 | if (p >= pLimit) return false; 54 | memcpy(&m_TimeStamp, p, sizeof(m_TimeStamp)); 55 | p += sizeof(m_TimeStamp); 56 | 57 | if (p >= pLimit) return false; 58 | memcpy(&m_TickCount, p, sizeof(m_TickCount)); 59 | p += sizeof(m_TickCount); 60 | 61 | if (p >= pLimit) return false; 62 | memcpy(&m_LogLevel, p, sizeof(m_LogLevel)); 63 | p += sizeof(m_LogLevel); 64 | 65 | if (p >= pLimit) return false; 66 | memcpy(&m_ProcessId, p, sizeof(m_ProcessId)); 67 | p += sizeof(m_ProcessId); 68 | 69 | if (p >= pLimit) return false; 70 | memcpy(&m_ThreadId, p, sizeof(m_ThreadId)); 71 | p += sizeof(m_ThreadId); 72 | 73 | uint32_t len = 0; 74 | 75 | if (p >= pLimit) return false; 76 | memcpy(&len, p, sizeof(len)); 77 | p += sizeof(len); 78 | 79 | if (p >= pLimit) return false; 80 | m_LogFilter = Utf16StringConvert.from_bytes((char*)p, (char*)(p + len)); 81 | p += len; 82 | 83 | if (p >= pLimit) return false; 84 | memcpy(&len, p, sizeof(len)); 85 | p += sizeof(len); 86 | 87 | if (p >= pLimit) return false; 88 | m_LogText = Utf16StringConvert.from_bytes((char*)p, (char*)(p + len)); 89 | p += len; 90 | 91 | return true; 92 | } 93 | 94 | bool CSLoggerMessage::ToBytesArray(std::vector& buffer) const 95 | { 96 | buffer.clear(); 97 | 98 | SLUtf16StringConvert Utf16StringConvert; 99 | 100 | int32_t totalSize = 0; 101 | totalSize += sizeof(m_TimeStamp); 102 | totalSize += sizeof(m_TickCount); 103 | totalSize += sizeof(m_LogLevel); 104 | totalSize += sizeof(m_ProcessId); 105 | totalSize += sizeof(m_ThreadId); 106 | totalSize *= 2; 107 | 108 | // Convert to UTF8 string 109 | auto utf8Filter = Utf16StringConvert.to_bytes(m_LogFilter); 110 | totalSize += utf8Filter.size(); 111 | 112 | // Convert to UTF8 string 113 | auto utf8Text = Utf16StringConvert.to_bytes(m_LogText); 114 | totalSize += utf8Text.size(); 115 | 116 | buffer.resize(totalSize); 117 | auto it = buffer.begin(); 118 | uint8_t* p = nullptr; 119 | 120 | // We don't consider about the byte order, because this is not designed for network transfer 121 | p = (uint8_t*)&m_TimeStamp; 122 | it = buffer.insert(it, p, p + sizeof(m_TimeStamp)); 123 | it += sizeof(m_TimeStamp); 124 | 125 | p = (uint8_t*)&m_TickCount; 126 | it = buffer.insert(it, p, p + sizeof(m_TickCount)); 127 | it += sizeof(m_TickCount); 128 | 129 | p = (uint8_t*)&m_LogLevel; 130 | it = buffer.insert(it, p, p + sizeof(m_LogLevel)); 131 | it += sizeof(m_LogLevel); 132 | 133 | p = (uint8_t*)&m_ProcessId; 134 | it = buffer.insert(it, p, p + sizeof(m_ProcessId)); 135 | it += sizeof(m_ProcessId); 136 | 137 | p = (uint8_t*)&m_ThreadId; 138 | it = buffer.insert(it, p, p + sizeof(m_ThreadId)); 139 | it += sizeof(m_ThreadId); 140 | 141 | uint32_t len = 0; 142 | 143 | len = utf8Filter.size(); 144 | p = (uint8_t*)&len; 145 | it = buffer.insert(it, p, p + sizeof(len)); 146 | it += sizeof(len); 147 | 148 | it = buffer.insert(it, utf8Filter.begin(), utf8Filter.end()); 149 | it += utf8Filter.size(); 150 | 151 | len = utf8Text.size(); 152 | p = (uint8_t*)&len; 153 | it = buffer.insert(it, p, p + sizeof(len)); 154 | it += sizeof(len); 155 | 156 | it = buffer.insert(it, utf8Text.begin(), utf8Text.end()); 157 | it += utf8Filter.size(); 158 | 159 | return true; 160 | } 161 | -------------------------------------------------------------------------------- /src/Message/SLoggerMessage.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../Interface/ISLoggerMessage.h" 4 | 5 | // Implements property 6 | #define IMPLEMENT_PROPERTY(Type, Name) \ 7 | protected: \ 8 | Type m_##Name; \ 9 | public: \ 10 | void Set##Name(const Type& value) { m_##Name = value; } \ 11 | Type Get##Name() const { return m_##Name; } 12 | 13 | /// 14 | /// The log message object. 15 | /// 16 | class CSLoggerMessage : public ISLoggerMessage 17 | { 18 | public: 19 | /// 20 | /// Constructor. 21 | /// 22 | CSLoggerMessage(void); 23 | 24 | /// 25 | /// Destructor. 26 | /// 27 | ~CSLoggerMessage(void); 28 | 29 | /// 30 | /// Time stamp. 31 | /// 32 | IMPLEMENT_PROPERTY(int64_t, TimeStamp); 33 | 34 | /// 35 | /// Tick count. 36 | /// 37 | IMPLEMENT_PROPERTY(uint32_t, TickCount); 38 | 39 | /// 40 | /// Log level. 41 | /// 42 | IMPLEMENT_PROPERTY(uint32_t, LogLevel); 43 | 44 | /// 45 | /// Process ID. 46 | /// 47 | IMPLEMENT_PROPERTY(uint32_t, ProcessId); 48 | 49 | /// 50 | /// Thread ID. 51 | /// 52 | IMPLEMENT_PROPERTY(uint32_t, ThreadId); 53 | 54 | /// 55 | /// Log filter Utf16 string. 56 | /// 57 | IMPLEMENT_PROPERTY(std::wstring, LogFilter); 58 | /// 59 | /// Log text utf16 string. 60 | /// 61 | IMPLEMENT_PROPERTY(std::wstring, LogText); 62 | 63 | /// 64 | /// Formats the log message as UTF-16 string. 65 | /// 66 | /// The log message string. 67 | virtual std::wstring FormatLogMessage() override; 68 | 69 | /// 70 | /// Deserializes the bytes array data to message object. 71 | /// 72 | /// The bytes array buffer. 73 | /// True if successful; otherwise false. 74 | virtual bool FromBytesArray(const std::vector& buffer) override; 75 | 76 | /// 77 | /// Serializes the message object to bytes array. 78 | /// 79 | /// The bytes array buffer to recieve the data. 80 | /// True if successful; otherwise false. 81 | virtual bool ToBytesArray(std::vector& buffer) const override; 82 | }; 83 | -------------------------------------------------------------------------------- /src/Processor/Output/SLoggerSystemOutput.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "SLoggerSystemOutput.h" 3 | 4 | CSLoggerSystemOutput::CSLoggerSystemOutput(void) 5 | { 6 | } 7 | 8 | CSLoggerSystemOutput::~CSLoggerSystemOutput(void) 9 | { 10 | } 11 | 12 | bool CSLoggerSystemOutput::Initialize(const SLUtf8String& parameter) 13 | { 14 | return true; 15 | } 16 | 17 | bool CSLoggerSystemOutput::UnInitialize() 18 | { 19 | return true; 20 | } 21 | 22 | void CSLoggerSystemOutput::ProcessLogMessage(const SLoggerMessagePtr& msg) 23 | { 24 | if (!msg) return; 25 | 26 | #if defined(_WIN32) 27 | std::wstring message = msg->FormatLogMessage(); 28 | ::OutputDebugStringW(message.c_str()); 29 | #endif 30 | } 31 | -------------------------------------------------------------------------------- /src/Processor/Output/SLoggerSystemOutput.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Interface/ISLogMessageProcessor.h" 3 | 4 | /// 5 | /// The log message output. 6 | /// 7 | class CSLoggerSystemOutput : public ISLogMessageProcessor 8 | { 9 | public: 10 | /// 11 | /// Constructor. 12 | /// 13 | CSLoggerSystemOutput(void); 14 | 15 | /// 16 | /// Destructor. 17 | /// 18 | ~CSLoggerSystemOutput(void); 19 | 20 | /// 21 | /// Initializes the processor. 22 | /// 23 | /// The string parameter. 24 | /// True if successful; otherwise false. 25 | virtual bool Initialize(const SLUtf8String& parameter); 26 | 27 | /// 28 | /// Initializes the processor. 29 | /// 30 | /// True if successful; otherwise false. 31 | virtual bool UnInitialize(void); 32 | 33 | /// 34 | /// Output the log message to system debug buffer. 35 | /// 36 | /// The log message. 37 | virtual void ProcessLogMessage(const SLoggerMessagePtr& msg); 38 | }; 39 | 40 | -------------------------------------------------------------------------------- /src/Processor/Sender/SLoggerSender.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "SLoggerSender.h" 3 | 4 | CSLoggerSender::CSLoggerSender(void) 5 | { 6 | } 7 | 8 | 9 | CSLoggerSender::~CSLoggerSender(void) 10 | { 11 | } 12 | 13 | bool CSLoggerSender::Initialize(const SLUtf8String& parameter) 14 | { 15 | return true; 16 | } 17 | 18 | bool CSLoggerSender::UnInitialize() 19 | { 20 | return true; 21 | } 22 | 23 | void CSLoggerSender::ProcessLogMessage(const SLoggerMessagePtr& msg) 24 | { 25 | if (!msg) return; 26 | 27 | std::vector buffer; 28 | msg->ToBytesArray(buffer); 29 | 30 | #if defined(_WIN32) 31 | #define LOG_VIEWER_WNDCLASS_NAME L"SLOGGERVIEWER_WNDCLASS_{16a0cd54-f03b-4244-98a4-fffdb085fda2}" 32 | #define LOG_VIEWER_WNDTITLE_NAME L"SLOGGERVIEWER_WNDTITLE_{e408d8b6-8a74-4331-9ccb-b76c4ab825fe}" 33 | HWND hWndLogViewer = ::FindWindowExW(HWND_MESSAGE, NULL, LOG_VIEWER_WNDCLASS_NAME, LOG_VIEWER_WNDTITLE_NAME); 34 | if (hWndLogViewer && ::IsWindow(hWndLogViewer)) 35 | { 36 | COPYDATASTRUCT cds; 37 | cds.dwData = 0; 38 | cds.cbData = buffer.size(); 39 | cds.lpData = buffer.data(); 40 | ::SendMessage(hWndLogViewer, WM_COPYDATA, (WPARAM)(NULL), (LPARAM)(&cds)); 41 | } 42 | #endif 43 | } -------------------------------------------------------------------------------- /src/Processor/Sender/SLoggerSender.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Interface/ISLogMessageProcessor.h" 3 | 4 | /// 5 | /// The log message sender. 6 | /// 7 | class CSLoggerSender : public ISLogMessageProcessor 8 | { 9 | public: 10 | /// 11 | /// Constructor. 12 | /// 13 | CSLoggerSender(void); 14 | 15 | /// 16 | /// Destructor. 17 | /// 18 | ~CSLoggerSender(void); 19 | 20 | /// 21 | /// Initializes the processor. 22 | /// 23 | /// The string parameter. 24 | /// True if successful; otherwise false. 25 | virtual bool Initialize(const SLUtf8String& parameter); 26 | 27 | /// 28 | /// Initializes the processor. 29 | /// 30 | /// True if successful; otherwise false. 31 | virtual bool UnInitialize(); 32 | 33 | /// 34 | /// Send the log message to the log viewer. 35 | /// 36 | /// The log message. 37 | virtual void ProcessLogMessage(const SLoggerMessagePtr& msg); 38 | }; 39 | 40 | -------------------------------------------------------------------------------- /src/Processor/Storage/SLoggerFileStorage.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "SLoggerFileStorage.h" 3 | 4 | CSLoggerFileStorage::CSLoggerFileStorage(void) 5 | { 6 | } 7 | 8 | CSLoggerFileStorage::~CSLoggerFileStorage(void) 9 | { 10 | } 11 | 12 | bool CSLoggerFileStorage::Initialize(const SLUtf8String& parameter) 13 | { 14 | #if defined(_WIN32) 15 | CAtlStringW exeFilePath; 16 | ::GetModuleFileNameW(NULL, exeFilePath.GetBuffer(MAX_PATH), MAX_PATH); 17 | exeFilePath.ReleaseBuffer(); 18 | 19 | if (!parameter.empty()) 20 | { 21 | CAtlStringW logFolderPath = CA2W(parameter.c_str(), CP_UTF8); 22 | auto pFileName = ::PathFindFileNameW(exeFilePath); 23 | ::PathCombine(exeFilePath.GetBuffer(MAX_PATH), logFolderPath, pFileName); 24 | exeFilePath.ReleaseBuffer(); 25 | } 26 | 27 | //CAtlStringW binaryFilePath = exeFilePath + L".slg"; 28 | //m_hBinaryFile = ::CreateFileW(binaryFilePath, FILE_APPEND_DATA, 29 | // FILE_SHARE_WRITE | FILE_SHARE_READ, NULL, CREATE_ALWAYS, NULL, NULL); 30 | //if (INVALID_HANDLE_VALUE == m_hBinaryFile || NULL == m_hBinaryFile) 31 | //{ 32 | // m_hBinaryFile = NULL; 33 | // return false; 34 | //} 35 | 36 | CAtlStringW textFilePath = exeFilePath + L".log"; 37 | m_hTextFile = ::CreateFileW(textFilePath, FILE_APPEND_DATA, 38 | FILE_SHARE_WRITE | FILE_SHARE_READ, NULL, CREATE_ALWAYS, NULL, NULL); 39 | if (INVALID_HANDLE_VALUE == m_hTextFile || NULL == m_hTextFile) 40 | { 41 | //::CloseHandle(m_hBinaryFile); 42 | //m_hBinaryFile = NULL; 43 | m_hTextFile = NULL; 44 | return false; 45 | } 46 | 47 | #endif 48 | return true; 49 | } 50 | 51 | bool CSLoggerFileStorage::UnInitialize() 52 | { 53 | #if defined(_WIN32) 54 | //if (m_hBinaryFile) 55 | // ::CloseHandle(m_hBinaryFile); 56 | 57 | if (m_hTextFile) 58 | ::CloseHandle(m_hTextFile); 59 | #endif 60 | return true; 61 | } 62 | 63 | void CSLoggerFileStorage::ProcessLogMessage(const SLoggerMessagePtr& msg) 64 | { 65 | if (!msg) return; 66 | 67 | #if !defined(DEBUG) && !defined(_DEBUG) 68 | // For non-debug version, we don't save the debug log message into file 69 | if (msg->GetLogLevel() <= 0) return; 70 | #endif 71 | 72 | //if (m_hBinaryFile) 73 | //{ 74 | // //std::vector buffer; 75 | // //msg->ToBytesArray(buffer); 76 | //} 77 | 78 | if (m_hTextFile) 79 | { 80 | auto logMessage = msg->FormatLogMessage(); 81 | SLUtf16StringConvert Utf16StringConvert; 82 | auto utf8LogMessage = Utf16StringConvert.to_bytes(logMessage); 83 | AppendToFile(m_hTextFile, utf8LogMessage.data(), utf8LogMessage.size()); 84 | } 85 | } 86 | 87 | #if defined(_WIN32) 88 | bool CSLoggerFileStorage::AppendToFile(HANDLE hFile, LPCVOID pData, DWORD dwBytesToWrite) 89 | { 90 | DWORD dwNumberOfBytesWritten = 0; 91 | DWORD dwNumberOfBytesToWrite = dwBytesToWrite; 92 | 93 | static OVERLAPPED overlapped = { 0, -1, 0 }; 94 | ::LockFileEx(hFile, LOCKFILE_EXCLUSIVE_LOCK, 0, -1, -1, &overlapped); 95 | do 96 | { 97 | if (!::WriteFile(hFile, pData, dwBytesToWrite, &dwNumberOfBytesWritten, NULL)) 98 | break; 99 | 100 | dwNumberOfBytesToWrite -= dwNumberOfBytesWritten; 101 | } while (dwNumberOfBytesToWrite > 0); 102 | ::UnlockFileEx(hFile, 0, -1, -1, &overlapped); 103 | 104 | return dwNumberOfBytesToWrite == 0; 105 | } 106 | #endif 107 | -------------------------------------------------------------------------------- /src/Processor/Storage/SLoggerFileStorage.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Interface/ISLogMessageProcessor.h" 3 | 4 | /* This is the design of the binary storage file. */ 5 | /* Header 6 | * /-------------------\ 7 | * | MagicNo: int32 | 8 | * |-------------------| /--------------\ 9 | * | VersionNo: int32 | / | Length:int32 | 10 | * |-------------------| / |--------------| 11 | * |Chunk[0] |-------| | Data: xxxxxx | 12 | * |-------------------| \ |--------------| 13 | * |Chunk[1] | \ | xxxxxxxxxxxx | 14 | * |-------------------| \--------------/ 15 | * |Chunk[2] | 16 | * |-------------------| 17 | */ 18 | 19 | /// 20 | /// The log message file storage. 21 | /// 22 | class CSLoggerFileStorage : public ISLogMessageProcessor 23 | { 24 | private: 25 | ///// 26 | ///// The magic number of the binary file. 27 | ///// 28 | //static const int32_t SLoggerFileMagicNumber = 'SLOG'; 29 | 30 | ///// 31 | ///// The header of binary file. 32 | ///// 33 | //typedef struct _tagSLoggerFileHeader 34 | //{ 35 | // /// 36 | // /// The magic number. 37 | // /// 38 | // __int32 magic; 39 | 40 | // /// 41 | // /// The version. 42 | // /// 43 | // __int32 ver; 44 | 45 | // /// 46 | // /// Reserved fields. 47 | // /// 48 | // __int32 reserved0; 49 | // __int32 reserved1; 50 | // __int32 reserved2; 51 | // __int32 reserved3; 52 | // __int32 reserved4; 53 | // __int32 reserved5; 54 | 55 | // _tagSLoggerFileHeader() 56 | // { 57 | // magic = CSLoggerFileStorage::SLoggerFileMagicNumber; 58 | // ver = 0; 59 | // reserved0 = 0; 60 | // reserved1 = 0; 61 | // reserved2 = 0; 62 | // reserved3 = 0; 63 | // reserved4 = 0; 64 | // reserved5 = 0; 65 | // } 66 | 67 | // ~_tagSLoggerFileHeader() 68 | // { 69 | // magic = 0; 70 | // ver = 0; 71 | // reserved0 = 0; 72 | // reserved1 = 0; 73 | // reserved2 = 0; 74 | // reserved3 = 0; 75 | // reserved4 = 0; 76 | // reserved5 = 0; 77 | // } 78 | //} SLoggerFileHeader, *PSLoggerFileHeader; 79 | 80 | public: 81 | /// 82 | /// Constructor. 83 | /// 84 | CSLoggerFileStorage(void); 85 | 86 | /// 87 | /// Destructor. 88 | /// 89 | ~CSLoggerFileStorage(void); 90 | 91 | /// 92 | /// Initializes the processor. 93 | /// 94 | /// The folder path to save the log file. 95 | /// True if successful; otherwise false. 96 | virtual bool Initialize(const SLUtf8String& parameter); 97 | 98 | /// 99 | /// Initializes the processor. 100 | /// 101 | /// True if successful; otherwise false. 102 | virtual bool UnInitialize(void); 103 | 104 | /// 105 | /// Save the log message to the file. 106 | /// 107 | /// The log message. 108 | virtual void ProcessLogMessage(const SLoggerMessagePtr& msg); 109 | 110 | protected: 111 | #if defined(_WIN32) 112 | /// 113 | /// Appends the content to the file. 114 | /// 115 | /// The file handle. 116 | /// The pointer to the data buffer. 117 | /// The size to write. 118 | /// True if successful; otherwise false. 119 | bool AppendToFile(HANDLE hFile, LPCVOID pData, DWORD dwBytesToWrite); 120 | #endif 121 | 122 | private: 123 | ///// 124 | ///// The header for binary file. 125 | ///// 126 | //SLoggerFileHeader m_Header; 127 | 128 | #if defined(_WIN32) 129 | ///// 130 | ///// The file handle of binary file. 131 | ///// 132 | //HANDLE m_hBinaryFile; 133 | 134 | /// 135 | /// The file handle of text file. 136 | /// 137 | HANDLE m_hTextFile; 138 | #endif 139 | }; 140 | 141 | -------------------------------------------------------------------------------- /src/SLogger/SLogger.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include 3 | #include 4 | 5 | #include "SLogger.h" 6 | #include "../Message/SLoggerMessage.h" 7 | #include "../Processor/Output/SLoggerSystemOutput.h" 8 | #include "../Processor/Sender/SLoggerSender.h" 9 | #include "../Processor/Storage/SLoggerFileStorage.h" 10 | 11 | CSLogger& CSLogger::getInstance() 12 | { 13 | static CSLogger s_instance; 14 | return s_instance; 15 | } 16 | 17 | CSLogger::CSLogger(void) 18 | { 19 | m_nPid = 0; 20 | m_processorList.clear(); 21 | } 22 | 23 | CSLogger::~CSLogger(void) 24 | { 25 | Uninitialize(); 26 | } 27 | 28 | bool CSLogger::Initialize(const SLUtf8String& parameter) 29 | { 30 | if (0 != m_nPid) 31 | return true; 32 | 33 | SLogMessageProcessorPtr pProcessor; 34 | pProcessor = std::make_shared(); 35 | if (!pProcessor->Initialize(parameter)) 36 | return false; 37 | m_processorList.push_back(pProcessor); 38 | 39 | pProcessor = std::make_shared(); 40 | if (!pProcessor->Initialize(parameter)) 41 | return false; 42 | m_processorList.push_back(pProcessor); 43 | 44 | pProcessor = std::make_shared(); 45 | if (!pProcessor->Initialize(parameter)) 46 | return false; 47 | m_processorList.push_back(pProcessor); 48 | 49 | m_nPid = _getpid(); 50 | 51 | return true; 52 | } 53 | 54 | void CSLogger::Log(int nLevel, const SLUtf16String& strFilter, const SLUtf16String& strText) 55 | { 56 | std::shared_ptr msg = std::make_shared(); 57 | 58 | #if defined(_WIN32) 59 | msg->SetThreadId(::GetCurrentThreadId()); 60 | msg->SetTickCount(::GetTickCount()); 61 | #endif 62 | 63 | msg->SetProcessId(m_nPid); 64 | msg->SetTimeStamp(std::time(nullptr)); 65 | msg->SetLogLevel(nLevel); 66 | msg->SetLogFilter(strFilter); 67 | msg->SetLogText(strText); 68 | 69 | 70 | for (auto const p : m_processorList) 71 | p->ProcessLogMessage(msg); 72 | } 73 | 74 | void CSLogger::Uninitialize() 75 | { 76 | for (auto const p : m_processorList) 77 | p->UnInitialize(); 78 | 79 | m_processorList.clear(); 80 | } 81 | -------------------------------------------------------------------------------- /src/SLogger/SLogger.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../common.h" 4 | #include "../Interface/ISLogMessageProcessor.h" 5 | 6 | /// 7 | /// The logger object. 8 | /// 9 | class CSLogger 10 | { 11 | public: 12 | /// 13 | /// The log level. 14 | /// 15 | enum LogLevel 16 | { 17 | eLogLvl_Debug = 0, 18 | eLogLvl_Release, 19 | }; 20 | 21 | /// 22 | /// Gets the instance of the logger object. 23 | /// 24 | /// The reference of the logger instance. 25 | static CSLogger& getInstance(); 26 | 27 | /// 28 | /// Logs the message. 29 | /// 30 | /// The log level. 31 | /// The log filter. 32 | /// The log text content. 33 | void Log(int nLevel, const SLUtf16String& strFilter, const SLUtf16String& strText); 34 | 35 | /// 36 | /// Initializes the logger. 37 | /// 38 | /// True if successful; otherwise false. 39 | bool Initialize(const SLUtf8String& parameter = ""); 40 | 41 | /// 42 | /// Unintializes the logger. 43 | /// 44 | void Uninitialize(); 45 | 46 | protected: 47 | /// 48 | /// Constructor. 49 | /// 50 | CSLogger(void); 51 | 52 | /// 53 | /// Destructor. 54 | /// 55 | ~CSLogger(void); 56 | 57 | private: 58 | /// 59 | /// The process id. 60 | /// 61 | int m_nPid; 62 | 63 | /// 64 | /// The processor list. 65 | /// 66 | SLogMessageProcessorList m_processorList; 67 | }; -------------------------------------------------------------------------------- /src/common.h: -------------------------------------------------------------------------------- 1 | #ifndef COMMON_H 2 | #define COMMON_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #define LOG_STRING_MAX_LEN 4096 13 | 14 | /// 15 | /// The UTF-8 string type. 16 | /// 17 | typedef std::string SLUtf8String; 18 | 19 | /// 20 | /// The UTF-16 string type. 21 | /// 22 | typedef std::wstring SLUtf16String; 23 | 24 | /// 25 | /// The UTF-8 output string stream. 26 | /// 27 | typedef std::basic_ostringstream SLOUtf8StringStream; 28 | 29 | /// 30 | /// The UTF-16 output string stream. 31 | /// 32 | typedef std::basic_ostringstream SLOUtf16StringStream; 33 | 34 | /// 35 | /// The UTF-8 and UTF16 converter type. 36 | /// 37 | typedef std::wstring_convert, wchar_t> SLUtf16StringConvert; 38 | 39 | #endif -------------------------------------------------------------------------------- /src/sLogger.vcxitems: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 5 | true 6 | {45d41acc-2c3c-43d2-bc10-02aa73ffc7c7} 7 | sLogger 8 | 9 | 10 | 11 | %(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory) 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/sLogger.vcxitems.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {1922ea91-05e8-48d4-b40b-5d58e9a97b9a} 6 | 7 | 8 | {a1754c40-bf14-479d-8489-a70cf29ff5df} 9 | 10 | 11 | {8dfed296-129b-40aa-9f1b-cab782df5d54} 12 | 13 | 14 | {9de48b3c-4423-4a9e-a8f7-39b0e1977f77} 15 | 16 | 17 | {8128f800-27a9-4b68-b715-a748ffb7eda8} 18 | 19 | 20 | {542fe75d-8692-462d-bebd-2f2059a31760} 21 | 22 | 23 | {e6a27c50-5bc1-477e-89b3-fea91cda09de} 24 | 25 | 26 | 27 | 28 | 29 | SLogger 30 | 31 | 32 | Include 33 | 34 | 35 | Interface 36 | 37 | 38 | Processor\Output 39 | 40 | 41 | Processor\Sender 42 | 43 | 44 | Processor\Storage 45 | 46 | 47 | 48 | 49 | SLogger 50 | 51 | 52 | 53 | Processor\Output 54 | 55 | 56 | Processor\Sender 57 | 58 | 59 | Processor\Storage 60 | 61 | 62 | -------------------------------------------------------------------------------- /src/sLoggerMessage.vcxitems: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 5 | true 6 | {1B74DB0B-29E4-4160-BC67-AFB30CBC4362} 7 | 8 | 9 | 10 | %(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory) 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/sLoggerMessage.vcxitems.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {6a7795d0-d9f5-4dc9-9ab6-7a89ff23c03b} 6 | 7 | 8 | {238d8ef7-cf3f-47d2-84c9-f20437e1ce2f} 9 | 10 | 11 | 12 | 13 | Message 14 | 15 | 16 | 17 | 18 | Message 19 | 20 | 21 | Interface 22 | 23 | 24 | -------------------------------------------------------------------------------- /tools/sLogViewer/AboutDlg.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class CAboutDlg 4 | : public CDialogImpl 5 | { 6 | public: 7 | enum { IDD = IDD_ABOUTBOX }; 8 | 9 | BEGIN_MSG_MAP(CAboutDlg) 10 | MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) 11 | COMMAND_ID_HANDLER(IDOK, OnCloseCmd) 12 | COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd) 13 | END_MSG_MAP() 14 | 15 | // Handler prototypes (uncomment arguments if needed): 16 | // LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) 17 | // LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) 18 | // LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/) 19 | 20 | LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) 21 | { 22 | CenterWindow(GetParent()); 23 | return TRUE; 24 | } 25 | 26 | LRESULT OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) 27 | { 28 | EndDialog(wID); 29 | return 0; 30 | } 31 | }; 32 | -------------------------------------------------------------------------------- /tools/sLogViewer/FilterRulesDlg.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "FilterRulesDlg.h" 3 | #include "SLogFilterManager.h" 4 | 5 | TCHAR* gItemName[] = 6 | { 7 | _T("Pid"), 8 | _T("Tid"), 9 | _T("Tick"), 10 | _T("Filter"), 11 | _T("Message") 12 | }; 13 | 14 | TCHAR* gCompareName[] = 15 | { 16 | _T("is"), 17 | _T("not is"), 18 | _T("contain"), 19 | _T("not contain"), 20 | _T("less than"), 21 | _T("more than") 22 | }; 23 | 24 | TCHAR* gCategoryName[] = 25 | { 26 | _T("Include"), 27 | _T("Exclude") 28 | }; 29 | 30 | int findIndex(LPCTSTR k, TCHAR* a[], int n) 31 | { 32 | for (int i = 0; i < n; i++) 33 | { 34 | if (0 == _tcscmp(a[i], k)) 35 | { 36 | return i; 37 | } 38 | } 39 | return -1; 40 | } 41 | 42 | LRESULT CFilterRulesDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) 43 | { 44 | m_ItemList = GetDlgItem(IDC_COMBO_ITEM); 45 | for (int i = 0; i < _countof(gItemName); i++) 46 | { 47 | m_ItemList.AddString(gItemName[i]); 48 | } 49 | m_ItemList.SetCurSel(0); 50 | 51 | m_CompareList = GetDlgItem(IDC_COMBO_COMPARE); 52 | for (int i = 0; i < _countof(gCompareName); i++) 53 | { 54 | m_CompareList.AddString(gCompareName[i]); 55 | } 56 | m_CompareList.SetCurSel(0); 57 | 58 | m_CategoryList = GetDlgItem(IDC_COMBO_CATEGORY); 59 | m_CategoryList.AddString(gCategoryName[0]); 60 | m_CategoryList.AddString(gCategoryName[1]); 61 | m_CategoryList.SetCurSel(0); 62 | 63 | m_RulesList = GetDlgItem(IDC_LIST_RULES); 64 | m_RulesList.SetExtendedListViewStyle( 65 | LVS_EX_FULLROWSELECT | LVS_EX_UNDERLINEHOT | LVS_EX_GRIDLINES); 66 | m_RulesList.InsertColumn(0, _T("Column"), LVCFMT_LEFT, 60); 67 | m_RulesList.InsertColumn(1, _T("Compare"), LVCFMT_LEFT, 60); 68 | m_RulesList.InsertColumn(2, _T("Value"), LVCFMT_LEFT, 380); 69 | m_RulesList.InsertColumn(3, _T("Action"), LVCFMT_LEFT, 60); 70 | 71 | m_Value = GetDlgItem(IDC_EDIT_VALUE); 72 | 73 | InitRulesListItems(); 74 | 75 | CenterWindow(GetParent()); 76 | return TRUE; 77 | } 78 | 79 | LRESULT CFilterRulesDlg::OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) 80 | { 81 | ShowWindow(SW_HIDE); 82 | return 0; 83 | } 84 | 85 | LRESULT CFilterRulesDlg::OnAddCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) 86 | { 87 | CString value; 88 | m_Value.GetWindowText(value.GetBuffer(MAX_PATH), MAX_PATH); 89 | value.ReleaseBuffer(); 90 | 91 | if (value.IsEmpty()) 92 | { 93 | return 0; 94 | } 95 | 96 | Attribute attr = (Attribute)(m_ItemList.GetCurSel()); 97 | CString strAttr; 98 | m_ItemList.GetWindowText(strAttr.GetBuffer(MAX_PATH), MAX_PATH); 99 | strAttr.ReleaseBuffer(); 100 | 101 | Operator opr = (Operator)(m_CompareList.GetCurSel()); 102 | CString strOpr; 103 | m_CompareList.GetWindowText(strOpr.GetBuffer(MAX_PATH), MAX_PATH); 104 | strOpr.ReleaseBuffer(); 105 | 106 | Category cat = (Category)(m_CategoryList.GetCurSel()); 107 | CString strCat; 108 | m_CategoryList.GetWindowText(strCat.GetBuffer(MAX_PATH), MAX_PATH); 109 | strCat.ReleaseBuffer(); 110 | 111 | if (SLogFilterManager::GetInstance().AddRule(attr, opr, value, cat)) 112 | { 113 | int nListIndex = 0; 114 | 115 | if (cat == 0) 116 | { 117 | nListIndex = m_RulesList.InsertItem(0, strAttr); 118 | } 119 | else 120 | { 121 | nListIndex = m_RulesList.InsertItem(m_RulesList.GetItemCount(), strAttr); 122 | } 123 | 124 | m_RulesList.SetItemText(nListIndex, 1, strOpr); 125 | m_RulesList.SetItemText(nListIndex, 2, value); 126 | m_RulesList.SetItemText(nListIndex, 3, strCat); 127 | } 128 | 129 | return 0; 130 | } 131 | 132 | LRESULT CFilterRulesDlg::OnRemoveCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) 133 | { 134 | int nListIndex = m_RulesList.GetSelectedIndex(); 135 | if (nListIndex >= 0) 136 | { 137 | CString strAttr; 138 | m_RulesList.GetItemText(nListIndex, 0, strAttr); 139 | CString strOpr; 140 | m_RulesList.GetItemText(nListIndex, 1, strOpr); 141 | CString value; 142 | m_RulesList.GetItemText(nListIndex, 2, value); 143 | CString strCat; 144 | m_RulesList.GetItemText(nListIndex, 3, strCat); 145 | 146 | Attribute attr = (Attribute)findIndex(strAttr.GetString(), gItemName, _countof(gItemName)); 147 | Operator opr = (Operator)findIndex(strOpr.GetString(), gCompareName, _countof(gCompareName)); 148 | Category cat = (Category)findIndex(strCat.GetString(), gCategoryName, _countof(gCategoryName)); 149 | 150 | SLogFilterManager::GetInstance().DelRule(attr, opr, value, cat); 151 | 152 | m_RulesList.DeleteItem(nListIndex); 153 | } 154 | return 0; 155 | } 156 | 157 | LRESULT CFilterRulesDlg::OnApplyCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) 158 | { 159 | ::PostMessage(GetParent(), SLVM_APPLY_FILTER_RULES, 0, 0); 160 | return 0; 161 | } 162 | 163 | LRESULT CFilterRulesDlg::OnClearCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) 164 | { 165 | m_RulesList.DeleteAllItems(); 166 | SLogFilterManager::GetInstance().ClearRules(); 167 | return 0; 168 | } 169 | 170 | void CFilterRulesDlg::InitRulesListItems() 171 | { 172 | FilterRuleList includeList; 173 | FilterRuleList excludeList; 174 | SLogFilterManager::GetInstance().GetRulesLists(includeList, excludeList); 175 | 176 | for (auto it = includeList.begin(); 177 | it != includeList.end(); 178 | it++) 179 | { 180 | FilterRule rule = *it; 181 | 182 | Attribute attr = (Attribute)(rule.attr); 183 | CString strAttr = gItemName[attr]; 184 | 185 | Operator opr = (Operator)(rule.opr); 186 | CString strOpr = gCompareName[opr]; 187 | 188 | int nListIndex = m_RulesList.InsertItem(0, strAttr); 189 | m_RulesList.SetItemText(nListIndex, 1, strOpr); 190 | m_RulesList.SetItemText(nListIndex, 2, rule.value); 191 | m_RulesList.SetItemText(nListIndex, 3, _T("Include")); 192 | 193 | uint32_t category = (0 << 31); 194 | } 195 | 196 | for (auto it = excludeList.begin(); 197 | it != excludeList.end(); 198 | it++) 199 | { 200 | FilterRule rule = *it; 201 | 202 | Attribute attr = (Attribute)(rule.attr); 203 | CString strAttr = gItemName[attr]; 204 | 205 | Operator opr = (Operator)(rule.opr); 206 | CString strOpr = gCompareName[opr]; 207 | 208 | int nListIndex = m_RulesList.InsertItem(m_RulesList.GetItemCount(), strAttr); 209 | m_RulesList.SetItemText(nListIndex, 1, strOpr); 210 | m_RulesList.SetItemText(nListIndex, 2, rule.value); 211 | m_RulesList.SetItemText(nListIndex, 3, _T("Exclude")); 212 | 213 | uint32_t category = (1 << 31); 214 | } 215 | } -------------------------------------------------------------------------------- /tools/sLogViewer/FilterRulesDlg.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | class CFilterRulesDlg : 6 | public CDialogImpl 7 | { 8 | public: 9 | enum { IDD = IDD_DIALOGFILTERRULE }; 10 | 11 | BEGIN_MSG_MAP(CFilterRulesDlg) 12 | MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) 13 | COMMAND_ID_HANDLER(IDOK, OnCloseCmd) 14 | COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd) 15 | COMMAND_ID_HANDLER(IDC_BUTTON_ADD, OnAddCmd) 16 | COMMAND_ID_HANDLER(IDC_BUTTON_DEL, OnRemoveCmd) 17 | COMMAND_ID_HANDLER(IDC_BUTTON_CLEAR, OnClearCmd) 18 | COMMAND_ID_HANDLER(IDC_BUTTON_APPLY, OnCloseCmd) 19 | END_MSG_MAP() 20 | 21 | // Handler prototypes (uncomment arguments if needed): 22 | // LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) 23 | // LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) 24 | // LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/) 25 | 26 | LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); 27 | 28 | LRESULT OnAddCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/); 29 | 30 | LRESULT OnRemoveCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/); 31 | 32 | LRESULT OnApplyCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/); 33 | 34 | LRESULT OnClearCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/); 35 | 36 | LRESULT OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/); 37 | 38 | protected: 39 | void InitRulesListItems(); 40 | 41 | private: 42 | CComboBox m_ItemList; 43 | 44 | CComboBox m_CompareList; 45 | 46 | CComboBox m_CategoryList; 47 | 48 | CListViewCtrl m_RulesList; 49 | 50 | CEdit m_Value; 51 | }; 52 | -------------------------------------------------------------------------------- /tools/sLogViewer/GPLogViewer.h: -------------------------------------------------------------------------------- 1 | // GPLogViewer.h 2 | -------------------------------------------------------------------------------- /tools/sLogViewer/MainFrm.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "aboutdlg.h" 3 | #include "MainFrm.h" 4 | #include "SLogFilterManager.h" 5 | #include "SLogMessageManager.h" 6 | #include "FilterRulesDlg.h" 7 | 8 | BOOL CMainFrame::PreTranslateMessage(MSG* pMsg) 9 | { 10 | if(CFrameWindowImpl::PreTranslateMessage(pMsg)) 11 | return TRUE; 12 | 13 | return m_LogItemListView.PreTranslateMessage(pMsg); 14 | } 15 | 16 | BOOL CMainFrame::OnIdle() 17 | { 18 | UIUpdateToolBar(); 19 | return FALSE; 20 | } 21 | 22 | LRESULT CMainFrame::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) 23 | { 24 | BOOL bCapture = FALSE; 25 | BOOL bAutoScroll = TRUE; 26 | 27 | CreateSimpleReBar(ATL_SIMPLE_REBAR_NOBORDER_STYLE); 28 | 29 | // initialize toolbar 30 | { 31 | HWND hWndToolBar = CreateSimpleToolBarCtrl(m_hWnd, IDR_MAINFRAME, 32 | FALSE, ATL_SIMPLE_TOOLBAR_PANE_STYLE); 33 | 34 | m_ToolBar.Attach(hWndToolBar); 35 | 36 | m_ToolBarImageList.CreateFromImage( 37 | IDB_TOOBARIMAGELIST, 17, 1, CLR_DEFAULT, IMAGE_BITMAP); 38 | m_ToolBar.SetImageList(m_ToolBarImageList); 39 | 40 | m_ToolBar.ChangeBitmap(ID_FILE_OPEN, IMAGE_INDEX_OPEN); 41 | m_ToolBar.ChangeBitmap(ID_FILE_CLOSE, IMAGE_INDEX_CLOSE); 42 | m_ToolBar.ChangeBitmap(ID_CAPTURE_CAPTURE, IMAGE_INDEX_DISABLE_CAPTURE); 43 | m_ToolBar.ChangeBitmap(ID_CAPTURE_AUTOSCROLL, IMAGE_INDEX_ENABLE_AUTOSCROLL); 44 | m_ToolBar.ChangeBitmap(ID_CAPTURE_CLEAR, IMAGE_INDEX_CLEAR); 45 | m_ToolBar.ChangeBitmap(ID_CAPTURE_FILTER, IMAGE_INDEX_FILTER); 46 | 47 | AddSimpleReBarBand(hWndToolBar, NULL, TRUE); 48 | 49 | UIAddToolBar(hWndToolBar); 50 | 51 | UISetCheck(ID_CAPTURE_CAPTURE, bCapture); 52 | UISetCheck(ID_CAPTURE_AUTOSCROLL, bAutoScroll); 53 | UISetCheck(ID_VIEW_TOOLBAR, TRUE); 54 | 55 | UIEnable(ID_FILE_OPEN, FALSE); 56 | UIEnable(ID_FILE_CLOSE, FALSE); 57 | m_ToolBar.EnableButton(ID_FILE_OPEN, FALSE); 58 | m_ToolBar.EnableButton(ID_FILE_CLOSE, FALSE); 59 | } 60 | 61 | // initialize splitter window 62 | { 63 | CRect rcClient; 64 | GetClientRect(rcClient); 65 | 66 | m_hWndClient = m_Splitter.Create(m_hWnd, rcClient, NULL, 67 | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN); 68 | 69 | m_LogItemListView.Create(m_hWndClient, rcDefault, NULL, 70 | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VSCROLL | 71 | LVS_REPORT | LVS_NOSORTHEADER | LVS_SHOWSELALWAYS | LVS_SINGLESEL, 72 | WS_EX_CLIENTEDGE); 73 | 74 | m_LogItemDetailView.Create(m_hWndClient, rcDefault, NULL, 75 | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VSCROLL | 76 | ES_MULTILINE, 77 | WS_EX_CLIENTEDGE); 78 | 79 | 80 | m_LogItemListView.Initialize(); 81 | 82 | 83 | m_Splitter.SetSplitterPanes(m_LogItemListView, m_LogItemDetailView); 84 | m_Splitter.SetSplitterPos(((rcClient.bottom - rcClient.top) / 4) * 3); 85 | } 86 | 87 | // register object for message filtering and idle updates 88 | { 89 | CMessageLoop* pLoop = _Module.GetMessageLoop(); 90 | ATLASSERT(pLoop != NULL); 91 | pLoop->AddMessageFilter(this); 92 | pLoop->AddIdleHandler(this); 93 | } 94 | 95 | // initialize log message object receiver 96 | { 97 | m_Receiver.Start(); 98 | m_Receiver.SetProcessorWindow(m_hWnd); 99 | m_Receiver.EnableReceive(bCapture); 100 | } 101 | 102 | return 0; 103 | } 104 | 105 | LRESULT CMainFrame::OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) 106 | { 107 | m_Receiver.Stop(); 108 | 109 | // unregister message filtering and idle updated 110 | CMessageLoop* pLoop = _Module.GetMessageLoop(); 111 | ATLASSERT(pLoop != NULL); 112 | pLoop->RemoveMessageFilter(this); 113 | pLoop->RemoveIdleHandler(this); 114 | 115 | bHandled = FALSE; 116 | return 1; 117 | } 118 | 119 | LRESULT CMainFrame::OnAppExit(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) 120 | { 121 | PostMessage(WM_CLOSE); 122 | return 0; 123 | } 124 | 125 | LRESULT CMainFrame::OnAppAbout(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) 126 | { 127 | CAboutDlg dlg; 128 | dlg.DoModal(); 129 | return 0; 130 | } 131 | 132 | LRESULT CMainFrame::OnFileOpen(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) 133 | { 134 | 135 | return 0; 136 | } 137 | 138 | LRESULT CMainFrame::OnFileClose(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) 139 | { 140 | 141 | return 0; 142 | } 143 | 144 | LRESULT CMainFrame::OnCaptureCapture(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) 145 | { 146 | BOOL bEnable = !(UPDUI_CHECKED & UIGetState(ID_CAPTURE_CAPTURE)); 147 | m_Receiver.EnableReceive(bEnable); 148 | 149 | UISetCheck(ID_CAPTURE_CAPTURE, bEnable); 150 | 151 | if (bEnable) 152 | { 153 | m_ToolBar.ChangeBitmap(ID_CAPTURE_CAPTURE, IMAGE_INDEX_ENABLE_CAPTURE); 154 | } 155 | else 156 | { 157 | m_ToolBar.ChangeBitmap(ID_CAPTURE_CAPTURE, IMAGE_INDEX_DISABLE_CAPTURE); 158 | } 159 | 160 | UpdateLayout(); 161 | 162 | return 0; 163 | } 164 | 165 | LRESULT CMainFrame::OnCaptureAutoscroll(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) 166 | { 167 | BOOL bEnable = !(UPDUI_CHECKED & UIGetState(ID_CAPTURE_AUTOSCROLL)); 168 | m_LogItemListView.EnableAutoScroll(bEnable); 169 | 170 | UISetCheck(ID_CAPTURE_AUTOSCROLL, bEnable); 171 | 172 | if (bEnable) 173 | { 174 | m_ToolBar.ChangeBitmap(ID_CAPTURE_AUTOSCROLL, IMAGE_INDEX_ENABLE_AUTOSCROLL); 175 | } 176 | else 177 | { 178 | m_ToolBar.ChangeBitmap(ID_CAPTURE_AUTOSCROLL, IMAGE_INDEX_DISABLE_AUTOSCROLL); 179 | } 180 | 181 | UpdateLayout(); 182 | 183 | return 0; 184 | } 185 | 186 | LRESULT CMainFrame::OnCaptureClear(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) 187 | { 188 | m_LogItemListView.ClearLogItems(); 189 | m_LogItemDetailView.SetWindowTextW(NULL); 190 | 191 | UpdateLayout(); 192 | 193 | return 0; 194 | } 195 | 196 | LRESULT CMainFrame::OnCaptureFilter(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) 197 | { 198 | //CFilterRulesDlg dlg; 199 | //dlg.DoModal(); 200 | 201 | if (!m_FilterRulesDlg.IsWindow()) 202 | { 203 | m_FilterRulesDlg.Create(m_hWnd); 204 | } 205 | 206 | m_FilterRulesDlg.ShowWindow(SW_SHOWNORMAL); 207 | return 0; 208 | } 209 | 210 | LRESULT CMainFrame::OnViewToolBar(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) 211 | { 212 | BOOL bVisible = !::IsWindowVisible(m_hWndToolBar); 213 | ::ShowWindow(m_hWndToolBar, bVisible ? SW_SHOWNOACTIVATE : SW_HIDE); 214 | UISetCheck(ID_VIEW_TOOLBAR, bVisible); 215 | UpdateLayout(); 216 | return 0; 217 | } 218 | 219 | LRESULT CMainFrame::OnLogMsgObj(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) 220 | { 221 | DWORD nIndex = (DWORD)(wParam); 222 | auto pLogMsg = SLogMessageManager::GetInstance().Get(nIndex); 223 | 224 | if (pLogMsg && SLogFilterManager::GetInstance().ShouldDisplayThisItem(pLogMsg)) 225 | m_LogItemListView.AppendLogItem(pLogMsg, nIndex); 226 | 227 | return 0; 228 | } 229 | 230 | LRESULT CMainFrame::OnLVNItemChanged(int wParam, LPNMHDR lParam, BOOL& /*bHandled*/) 231 | { 232 | if (lParam) 233 | { 234 | if (lParam->hwndFrom == m_LogItemListView.m_hWnd) 235 | { 236 | LPNMLISTVIEW lpNMListView = (LPNMLISTVIEW)(lParam); 237 | 238 | if (lpNMListView && (lpNMListView->uNewState & LVIS_SELECTED)) 239 | { 240 | DWORD nIndex = (DWORD) 241 | m_LogItemListView.GetItemData(lpNMListView->iItem); 242 | 243 | auto pLogMsg = SLogMessageManager::GetInstance().Get(nIndex); 244 | m_LogItemDetailView.ShowDetails((LPCTSTR)(pLogMsg->GetLogText().c_str())); 245 | } 246 | } 247 | } 248 | 249 | return 0; 250 | } 251 | 252 | LRESULT CMainFrame::OnApplyFilterRules(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) 253 | { 254 | return 0; 255 | } 256 | -------------------------------------------------------------------------------- /tools/sLogViewer/MainFrm.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "SLogItemListView.h" 9 | #include "SLogItemDetailView.h" 10 | #include "SLogReceiver.h" 11 | #include "FilterRulesDlg.h" 12 | 13 | class CMainFrame : 14 | public CFrameWindowImpl, 15 | public CUpdateUI, 16 | public CMessageFilter, public CIdleHandler 17 | { 18 | public: 19 | DECLARE_FRAME_WND_CLASS(SLV_MAIN_WNDCLS_NAME, IDR_MAINFRAME) 20 | 21 | virtual BOOL PreTranslateMessage(MSG* pMsg); 22 | virtual BOOL OnIdle(); 23 | 24 | BEGIN_UPDATE_UI_MAP(CMainFrame) 25 | UPDATE_ELEMENT(ID_FILE_OPEN, UPDUI_MENUPOPUP) 26 | UPDATE_ELEMENT(ID_FILE_CLOSE, UPDUI_MENUPOPUP) 27 | UPDATE_ELEMENT(ID_CAPTURE_CAPTURE, UPDUI_MENUPOPUP) 28 | UPDATE_ELEMENT(ID_CAPTURE_AUTOSCROLL, UPDUI_MENUPOPUP) 29 | UPDATE_ELEMENT(ID_CAPTURE_CLEAR, UPDUI_MENUPOPUP) 30 | UPDATE_ELEMENT(ID_VIEW_TOOLBAR, UPDUI_MENUPOPUP) 31 | END_UPDATE_UI_MAP() 32 | 33 | BEGIN_MSG_MAP(CMainFrame) 34 | // message for main window 35 | MESSAGE_HANDLER(WM_CREATE, OnCreate) 36 | MESSAGE_HANDLER(WM_DESTROY, OnDestroy) 37 | // message for command button 38 | COMMAND_ID_HANDLER(ID_FILE_OPEN, OnFileOpen) 39 | COMMAND_ID_HANDLER(ID_FILE_CLOSE, OnFileClose) 40 | COMMAND_ID_HANDLER(ID_APP_EXIT, OnAppExit) 41 | COMMAND_ID_HANDLER(ID_CAPTURE_CAPTURE, OnCaptureCapture) 42 | COMMAND_ID_HANDLER(ID_CAPTURE_AUTOSCROLL, OnCaptureAutoscroll) 43 | COMMAND_ID_HANDLER(ID_CAPTURE_CLEAR, OnCaptureClear) 44 | COMMAND_ID_HANDLER(ID_CAPTURE_FILTER, OnCaptureFilter) 45 | COMMAND_ID_HANDLER(ID_VIEW_TOOLBAR, OnViewToolBar) 46 | COMMAND_ID_HANDLER(ID_APP_ABOUT, OnAppAbout) 47 | // message for log message coming 48 | MESSAGE_HANDLER(SLVM_NEW_LOGMSGOBJ, OnLogMsgObj) 49 | MESSAGE_HANDLER(SLVM_APPLY_FILTER_RULES, OnApplyFilterRules) 50 | // message for item selected changed 51 | NOTIFY_CODE_HANDLER(LVN_ITEMCHANGED, OnLVNItemChanged) 52 | CHAIN_MSG_MAP(CUpdateUI) 53 | CHAIN_MSG_MAP(CFrameWindowImpl) 54 | END_MSG_MAP() 55 | 56 | // Handler prototypes (uncomment arguments if needed): 57 | // LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) 58 | // LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) 59 | // LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/) 60 | 61 | LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); 62 | 63 | LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); 64 | 65 | LRESULT OnFileOpen(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/); 66 | 67 | LRESULT OnFileClose(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/); 68 | 69 | LRESULT OnAppExit(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/); 70 | 71 | LRESULT OnCaptureCapture(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/); 72 | 73 | LRESULT OnCaptureAutoscroll(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/); 74 | 75 | LRESULT OnCaptureClear(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/); 76 | 77 | LRESULT OnCaptureFilter(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/); 78 | 79 | LRESULT OnViewToolBar(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/); 80 | 81 | LRESULT OnAppAbout(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/); 82 | 83 | LRESULT OnLogMsgObj(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); 84 | 85 | LRESULT OnApplyFilterRules(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); 86 | 87 | LRESULT OnLVNItemChanged(int wParam, LPNMHDR lParam, BOOL& /*bHandled*/); 88 | 89 | private: 90 | CImageList m_ToolBarImageList; 91 | 92 | CToolBarCtrl m_ToolBar; 93 | 94 | CHorSplitterWindow m_Splitter; 95 | 96 | SLogItemListView m_LogItemListView; 97 | 98 | SLogItemDetailView m_LogItemDetailView; 99 | 100 | SLogReceiver m_Receiver; 101 | 102 | CFilterRulesDlg m_FilterRulesDlg; 103 | }; -------------------------------------------------------------------------------- /tools/sLogViewer/SLogFilterManager.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "SLogFilterManager.h" 3 | 4 | typedef std::pair InsertResult; 5 | 6 | SLogFilterManager::SLogFilterManager() 7 | { 8 | m_bDebugLvlEnable = TRUE; 9 | m_bReleaseLvlEnable = TRUE; 10 | } 11 | 12 | SLogFilterManager::~SLogFilterManager() 13 | { 14 | 15 | } 16 | 17 | SLogFilterManager& SLogFilterManager::GetInstance() 18 | { 19 | static SLogFilterManager s_instance; 20 | return s_instance; 21 | } 22 | 23 | BOOL SLogFilterManager::ShouldDisplayThisItem(const SLoggerMessagePtr& pLogMsg) 24 | { 25 | BOOL bInclude = MatchIncludeFilterRules(pLogMsg); 26 | BOOL bExclude = MatchExcludeFilterRules(pLogMsg); 27 | 28 | if (bExclude) 29 | { 30 | // bExclude = TRUE 31 | // bInclude = FALSE or bInclude = TRUE 32 | return FALSE; 33 | } 34 | else 35 | { 36 | if (bInclude) 37 | { 38 | // bExclude = FALSE && bInclude = TRUE 39 | return TRUE; 40 | } 41 | else 42 | { 43 | // bExclude = FALSE && bInclude = FALSE 44 | return FALSE; 45 | } 46 | } 47 | } 48 | 49 | bool SLogFilterManager::AddRule(Attribute attr, Operator opr, CString& value, Category cat) 50 | { 51 | FilterRule rule; 52 | rule.attr = attr; 53 | rule.opr = opr; 54 | rule.value = value; 55 | 56 | InsertResult r; 57 | m_cs.Enter(); 58 | if (eInclude == cat) 59 | { 60 | r = m_includeList.insert(rule); 61 | } 62 | else if (eExclued == cat) 63 | { 64 | 65 | r = m_excludeList.insert(rule); 66 | } 67 | m_cs.Leave(); 68 | 69 | return r.second; 70 | } 71 | 72 | void SLogFilterManager::DelRule(Attribute attr, Operator opr, CString& value, Category cat) 73 | { 74 | FilterRule rule; 75 | rule.attr = attr; 76 | rule.opr = opr; 77 | rule.value = value; 78 | 79 | m_cs.Enter(); 80 | if (eInclude == cat) 81 | { 82 | m_includeList.erase(rule); 83 | } 84 | else if (eExclued == cat) 85 | { 86 | m_excludeList.erase(rule); 87 | } 88 | m_cs.Leave(); 89 | } 90 | 91 | void SLogFilterManager::ClearRules() 92 | { 93 | m_cs.Enter(); 94 | m_includeList.clear(); 95 | m_excludeList.clear(); 96 | m_cs.Leave(); 97 | } 98 | 99 | BOOL SLogFilterManager::MatchIncludeFilterRules(const SLoggerMessagePtr& pLogMsg) 100 | { 101 | if (0 == m_includeList.size()) 102 | { 103 | return TRUE; 104 | } 105 | 106 | BOOL bInclude = FALSE; 107 | m_cs.Enter(); 108 | for (auto it = m_includeList.begin(); 109 | it != m_includeList.end(); 110 | it++) 111 | { 112 | FilterRule rule = *it; 113 | switch (rule.attr) 114 | { 115 | case ePid: 116 | { 117 | DWORD ruleValue = ::StrToInt(rule.value.GetString()); 118 | bInclude = Compare(pLogMsg->GetProcessId(), rule.opr, ruleValue); 119 | } 120 | break; 121 | case eTid: 122 | { 123 | DWORD ruleValue = ::StrToInt(rule.value.GetString()); 124 | bInclude = Compare(pLogMsg->GetThreadId(), rule.opr, ruleValue); 125 | } 126 | break; 127 | case eTick: 128 | { 129 | DWORD ruleValue = ::StrToInt(rule.value.GetString()); 130 | bInclude = Compare(pLogMsg->GetTickCount(), rule.opr, ruleValue); 131 | } 132 | break; 133 | case eFilter: 134 | { 135 | bInclude = Compare((LPCTSTR)(pLogMsg->GetLogFilter().c_str()), rule.opr, rule.value.GetString()); 136 | } 137 | break; 138 | case eMessage: 139 | { 140 | bInclude = Compare((LPCTSTR)(pLogMsg->GetLogText().c_str()), rule.opr, rule.value.GetString()); 141 | } 142 | break; 143 | default: 144 | break; 145 | } 146 | 147 | if (TRUE == bInclude) 148 | { 149 | break; 150 | } 151 | } 152 | m_cs.Leave(); 153 | 154 | return bInclude; 155 | } 156 | 157 | BOOL SLogFilterManager::MatchExcludeFilterRules(const SLoggerMessagePtr& pLogMsg) 158 | { 159 | if (0 == m_excludeList.size()) 160 | { 161 | return FALSE; 162 | } 163 | 164 | BOOL bExclude = FALSE; 165 | m_cs.Enter(); 166 | for (auto it = m_excludeList.begin(); 167 | it != m_excludeList.end(); 168 | it++) 169 | { 170 | FilterRule rule = *it; 171 | switch (rule.attr) 172 | { 173 | case ePid: 174 | { 175 | DWORD ruleValue = ::StrToInt(rule.value.GetString()); 176 | bExclude = Compare(pLogMsg->GetProcessId(), rule.opr, ruleValue); 177 | } 178 | break; 179 | case eTid: 180 | { 181 | DWORD ruleValue = ::StrToInt(rule.value.GetString()); 182 | bExclude = Compare(pLogMsg->GetThreadId(), rule.opr, ruleValue); 183 | } 184 | break; 185 | case eTick: 186 | { 187 | DWORD ruleValue = ::StrToInt(rule.value.GetString()); 188 | bExclude = Compare(pLogMsg->GetTickCount(), rule.opr, ruleValue); 189 | } 190 | break; 191 | case eFilter: 192 | { 193 | bExclude = Compare((LPCTSTR)(pLogMsg->GetLogFilter().c_str()), rule.opr, rule.value.GetString()); 194 | } 195 | break; 196 | case eMessage: 197 | { 198 | bExclude = Compare((LPCTSTR)(pLogMsg->GetLogText().c_str()), rule.opr, rule.value.GetString()); 199 | } 200 | break; 201 | default: 202 | break; 203 | } 204 | 205 | if (TRUE == bExclude) 206 | { 207 | break; 208 | } 209 | } 210 | m_cs.Leave(); 211 | return bExclude; 212 | } 213 | 214 | BOOL SLogFilterManager::Compare(DWORD left, Operator opr, DWORD right) 215 | { 216 | BOOL bRet = FALSE; 217 | switch (opr) 218 | { 219 | case eIs: 220 | { 221 | bRet = (left == right); 222 | } 223 | break; 224 | case eNotIs: 225 | { 226 | bRet = (left != right); 227 | } 228 | break; 229 | case eContains: 230 | { 231 | return FALSE; 232 | } 233 | break; 234 | case eNotContains: 235 | { 236 | return FALSE; 237 | } 238 | break; 239 | case eLessThan: 240 | { 241 | bRet = (left < right); 242 | } 243 | break; 244 | case eMoreThan: 245 | { 246 | bRet = (left > right); 247 | } 248 | break; 249 | default: 250 | break; 251 | } 252 | 253 | return bRet; 254 | } 255 | 256 | BOOL SLogFilterManager::Compare(LPCTSTR left, Operator opr, LPCTSTR right) 257 | { 258 | BOOL bRet = FALSE; 259 | 260 | CString strLeft = left; 261 | CString strRight = right; 262 | 263 | switch (opr) 264 | { 265 | case eIs: 266 | { 267 | bRet = (0 == strLeft.CompareNoCase(right)); 268 | } 269 | break; 270 | case eNotIs: 271 | { 272 | return FALSE; 273 | } 274 | break; 275 | case eContains: 276 | { 277 | bRet = (strLeft.Find(right) != -1); 278 | } 279 | break; 280 | case eNotContains: 281 | { 282 | bRet = (strLeft.Find(right) == 1); 283 | } 284 | break; 285 | case eLessThan: 286 | { 287 | bRet = (strLeft.CompareNoCase(right) < 0); 288 | } 289 | break; 290 | case eMoreThan: 291 | { 292 | bRet = (strLeft.CompareNoCase(right) > 0); 293 | } 294 | break; 295 | default: 296 | break; 297 | } 298 | 299 | return bRet; 300 | } 301 | 302 | void SLogFilterManager::GetRulesLists(FilterRuleList& inclist, FilterRuleList& exclist) 303 | { 304 | m_cs.Enter(); 305 | inclist = m_includeList; 306 | exclist = m_excludeList; 307 | m_cs.Leave(); 308 | } 309 | 310 | -------------------------------------------------------------------------------- /tools/sLogViewer/SLogFilterManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | typedef enum Attribute 6 | { 7 | ePid = 0, 8 | eTid, 9 | eTick, 10 | eFilter, 11 | eMessage, 12 | }; 13 | 14 | typedef enum Operator 15 | { 16 | eIs = 0, 17 | eNotIs, 18 | eContains, 19 | eNotContains, 20 | eLessThan, 21 | eMoreThan, 22 | }; 23 | 24 | typedef enum Category 25 | { 26 | eInclude = 0, 27 | eExclued, 28 | }; 29 | 30 | class FilterRule 31 | { 32 | public: 33 | Attribute attr; 34 | Operator opr; 35 | CString value; 36 | 37 | bool operator==(const FilterRule& other) const 38 | { 39 | if (attr != other.attr 40 | || opr != other.opr 41 | || 0 != value.Compare(other.value)) 42 | { 43 | return false; 44 | } 45 | 46 | return true; 47 | } 48 | 49 | bool operator!=(const FilterRule& other) const 50 | { 51 | if (attr != other.attr 52 | || opr != other.opr 53 | || 0 != value.Compare(other.value)) 54 | { 55 | return true; 56 | } 57 | 58 | return false; 59 | } 60 | 61 | bool operator<(const FilterRule& other) const 62 | { 63 | if (attr != other.attr) 64 | { 65 | return (attr < other.attr); 66 | } 67 | 68 | if (opr != other.opr) 69 | { 70 | return (opr < other.opr); 71 | } 72 | 73 | int n = value.Compare(other.value); 74 | return (n < 0); 75 | } 76 | 77 | }; 78 | 79 | typedef std::set FilterRuleList; 80 | 81 | class SLogFilterManager 82 | { 83 | public: 84 | static SLogFilterManager& GetInstance(); 85 | 86 | BOOL ShouldDisplayThisItem(const SLoggerMessagePtr& pLogMsg); 87 | 88 | bool AddRule(Attribute attr, Operator opr, CString& value, Category cat); 89 | 90 | void DelRule(Attribute attr, Operator opr, CString& value, Category cat); 91 | 92 | void ClearRules(); 93 | 94 | void GetRulesLists(FilterRuleList& inclist, FilterRuleList& exclist); 95 | 96 | protected: 97 | SLogFilterManager(); 98 | 99 | ~SLogFilterManager(); 100 | 101 | BOOL Compare(DWORD left, Operator opr, DWORD right); 102 | 103 | BOOL Compare(LPCTSTR left, Operator opr, LPCTSTR right); 104 | 105 | BOOL MatchIncludeFilterRules(const SLoggerMessagePtr& pLogMsg); 106 | 107 | BOOL MatchExcludeFilterRules(const SLoggerMessagePtr& pLogMsg); 108 | 109 | private: 110 | BOOL m_bDebugLvlEnable; 111 | 112 | BOOL m_bReleaseLvlEnable; 113 | 114 | FilterRuleList m_includeList; 115 | 116 | FilterRuleList m_excludeList; 117 | 118 | CCriticalSection m_cs; 119 | }; 120 | 121 | -------------------------------------------------------------------------------- /tools/sLogViewer/SLogItemDetailView.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "SLogItemDetailView.h" 3 | 4 | BOOL SLogItemDetailView::PreTranslateMessage(MSG* pMsg) 5 | { 6 | UNREFERENCED_PARAMETER(pMsg); 7 | return FALSE; 8 | } 9 | 10 | void SLogItemDetailView::ShowDetails(LPCTSTR pDetails) 11 | { 12 | if (pDetails) 13 | { 14 | SetWindowText(pDetails); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /tools/sLogViewer/SLogItemDetailView.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | class SLogItemDetailView : 6 | public CWindowImpl 7 | { 8 | public: 9 | DECLARE_WND_SUPERCLASS(NULL, CEdit::GetWndClassName()) 10 | 11 | BOOL PreTranslateMessage(MSG* pMsg); 12 | 13 | BEGIN_MSG_MAP(SLogItemDetailView) 14 | END_MSG_MAP() 15 | 16 | // Handler prototypes (uncomment arguments if needed): 17 | // LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) 18 | // LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) 19 | // LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/) 20 | 21 | void ShowDetails(LPCTSTR pDetails); 22 | }; 23 | 24 | -------------------------------------------------------------------------------- /tools/sLogViewer/SLogItemListView.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "SLogItemListView.h" 3 | #include "SLogMessageManager.h" 4 | 5 | SLogItemListView::SLogItemListView() 6 | { 7 | m_bAutoScroll = TRUE; 8 | } 9 | 10 | SLogItemListView::~SLogItemListView() 11 | { 12 | } 13 | 14 | BOOL SLogItemListView::PreTranslateMessage(MSG* pMsg) 15 | { 16 | UNREFERENCED_PARAMETER(pMsg); 17 | return FALSE; 18 | } 19 | 20 | typedef struct _tagColumn 21 | { 22 | DWORD i; 23 | TCHAR* n; 24 | DWORD w; 25 | DWORD f; 26 | } Column, *PColumn; 27 | 28 | enum ColumnIndex 29 | { 30 | eCI_Time = 0, 31 | eCI_Tick, 32 | eCI_Level, 33 | eCI_Pid, 34 | eCI_Tid, 35 | eCI_Filter, 36 | eCI_Message 37 | }; 38 | 39 | Column ColumnDefine[] = 40 | { 41 | { eCI_Time, _T("Time"), 120, LVCFMT_LEFT }, 42 | { eCI_Tick, _T("Tick"), 80, LVCFMT_LEFT }, 43 | { eCI_Level, _T("Level"), 80, LVCFMT_LEFT }, 44 | { eCI_Pid, _T("Process"), 80, LVCFMT_LEFT }, 45 | { eCI_Tid, _T("Thread"), 80, LVCFMT_LEFT }, 46 | { eCI_Filter, _T("Filter"), 150, LVCFMT_LEFT }, 47 | { eCI_Message, _T("Message"), 500, LVCFMT_LEFT }, 48 | }; 49 | 50 | #define InsertColumnMacro(i) InsertColumn(i, ColumnDefine[i].n, ColumnDefine[i].f, ColumnDefine[i].w) 51 | 52 | VOID SLogItemListView::Initialize() 53 | { 54 | SetExtendedListViewStyle(LVS_EX_FULLROWSELECT | LVS_EX_UNDERLINEHOT | LVS_EX_GRIDLINES); 55 | 56 | InsertColumnMacro(eCI_Time); 57 | InsertColumnMacro(eCI_Tick); 58 | InsertColumnMacro(eCI_Level); 59 | InsertColumnMacro(eCI_Pid); 60 | InsertColumnMacro(eCI_Tid); 61 | InsertColumnMacro(eCI_Filter); 62 | InsertColumnMacro(eCI_Message); 63 | } 64 | 65 | VOID SLogItemListView::AppendLogItem(const SLoggerMessagePtr& pLogMessage, size_t nIndex) 66 | { 67 | int i = GetItemCount(); 68 | 69 | __time64_t t = pLogMessage->GetTimeStamp(); 70 | tm localtm; 71 | _localtime64_s(&localtm, &t); 72 | 73 | CString strTemp; 74 | _tcsftime(strTemp.GetBuffer(32), 32, _T("%Y-%m-%d %H:%M:%S"), &localtm); 75 | strTemp.ReleaseBuffer(); 76 | 77 | InsertItem(i, strTemp); 78 | 79 | strTemp.Format(_T("%d"), pLogMessage->GetTickCount()); 80 | SetItemText(i, eCI_Tick, strTemp); 81 | 82 | if (0 == pLogMessage->GetLogLevel()) 83 | SetItemText(i, eCI_Level, _T("DEBUG")); 84 | else if (1 == pLogMessage->GetLogLevel()) 85 | SetItemText(i, eCI_Level, _T("RELEASE")); 86 | else 87 | SetItemText(i, eCI_Level, _T("Unknown")); 88 | 89 | strTemp.Format(_T("%d"), pLogMessage->GetProcessId()); 90 | SetItemText(i, eCI_Pid, strTemp); 91 | 92 | strTemp.Format(_T("%d"), pLogMessage->GetThreadId()); 93 | SetItemText(i, eCI_Tid, strTemp); 94 | 95 | SetItemText(i, eCI_Filter, (TCHAR*)(pLogMessage->GetLogFilter().c_str())); 96 | SetItemText(i, eCI_Message, (TCHAR*)(pLogMessage->GetLogText().c_str())); 97 | SetItemData(i, (DWORD_PTR)nIndex); 98 | 99 | if (m_bAutoScroll) 100 | SelectItem(i); 101 | 102 | return ; 103 | } 104 | 105 | VOID SLogItemListView::ClearLogItems() 106 | { 107 | DeleteAllItems(); 108 | 109 | SLogMessageManager::GetInstance().Clear(); 110 | 111 | return; 112 | } 113 | 114 | VOID SLogItemListView::EnableAutoScroll(BOOL bEnable) 115 | { 116 | m_bAutoScroll = bEnable; 117 | } 118 | -------------------------------------------------------------------------------- /tools/sLogViewer/SLogItemListView.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | class SLogItemListView : 8 | public CWindowImpl 9 | { 10 | public: 11 | DECLARE_WND_SUPERCLASS(NULL, CListViewCtrl::GetWndClassName()) 12 | 13 | SLogItemListView(); 14 | 15 | ~SLogItemListView(); 16 | 17 | BOOL PreTranslateMessage(MSG* pMsg); 18 | 19 | BEGIN_MSG_MAP(SLogItemListView) 20 | END_MSG_MAP() 21 | 22 | // Handler prototypes (uncomment arguments if needed): 23 | // LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) 24 | // LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) 25 | // LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/) 26 | 27 | public: 28 | VOID Initialize(); 29 | 30 | VOID EnableAutoScroll(BOOL bEnable); 31 | 32 | VOID AppendLogItem(const SLoggerMessagePtr& pLogMessage, size_t nIndex); 33 | 34 | VOID ClearLogItems(); 35 | 36 | private: 37 | BOOL m_bAutoScroll; 38 | }; 39 | 40 | -------------------------------------------------------------------------------- /tools/sLogViewer/SLogMessageManager.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "SLogMessageManager.h" 3 | 4 | SLogMessageManager::SLogMessageManager() 5 | { 6 | Clear(); 7 | } 8 | 9 | SLogMessageManager::~SLogMessageManager() 10 | { 11 | Clear(); 12 | } 13 | 14 | SLogMessageManager& SLogMessageManager::GetInstance() 15 | { 16 | static SLogMessageManager s_instance; 17 | return s_instance; 18 | } 19 | 20 | DWORD SLogMessageManager::Append(const SLoggerMessagePtr& pLogMsg) 21 | { 22 | DWORD nIndex = 0; 23 | m_cs.Enter(); 24 | nIndex =m_list.Add(pLogMsg); 25 | m_cs.Leave(); 26 | return nIndex; 27 | } 28 | 29 | VOID SLogMessageManager::Remove(DWORD nIndex) 30 | { 31 | m_cs.Enter(); 32 | m_list.RemoveAt(nIndex); 33 | m_cs.Leave(); 34 | } 35 | 36 | VOID SLogMessageManager::Clear() 37 | { 38 | m_cs.Enter(); 39 | m_list.RemoveAll(); 40 | m_cs.Leave(); 41 | } 42 | 43 | const SLoggerMessagePtr SLogMessageManager::Get(DWORD nIndex) 44 | { 45 | SLoggerMessagePtr pMsgLog; 46 | m_cs.Enter(); 47 | pMsgLog = m_list.GetAt(nIndex); 48 | m_cs.Leave(); 49 | return pMsgLog; 50 | } 51 | -------------------------------------------------------------------------------- /tools/sLogViewer/SLogMessageManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | class SLogMessageManager 6 | { 7 | public: 8 | static SLogMessageManager& GetInstance(); 9 | 10 | protected: 11 | SLogMessageManager(); 12 | 13 | ~SLogMessageManager(); 14 | 15 | public: 16 | 17 | DWORD Append(const SLoggerMessagePtr& pLogMsg); 18 | 19 | VOID Remove(DWORD nIndex); 20 | 21 | VOID Clear(); 22 | 23 | const SLoggerMessagePtr Get(DWORD nIndex); 24 | 25 | private: 26 | CAtlArray m_list; 27 | 28 | CCriticalSection m_cs; 29 | }; 30 | 31 | -------------------------------------------------------------------------------- /tools/sLogViewer/SLogReceiver.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "SLogMessageManager.h" 3 | #include "SLogReceiver.h" 4 | 5 | SLogReceiver::SLogReceiver() 6 | { 7 | m_hWndProcessor = NULL; 8 | m_bEnable = FALSE; 9 | m_workThread = NULL; 10 | } 11 | 12 | SLogReceiver::~SLogReceiver() 13 | { 14 | 15 | } 16 | 17 | LRESULT SLogReceiver::OnCopyData(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) 18 | { 19 | if (m_bEnable) 20 | { 21 | PCOPYDATASTRUCT pCds = (PCOPYDATASTRUCT)(lParam); 22 | if (pCds) 23 | { 24 | PVOID pData = pCds->lpData; 25 | DWORD nLen = pCds->cbData; 26 | 27 | std::vector buf(nLen, 0); 28 | RtlCopyMemory(buf.data(), pData, nLen); 29 | 30 | SLoggerMessagePtr pLogMsg = std::make_shared(); 31 | pLogMsg->FromBytesArray(buf); 32 | 33 | DWORD nIndex = SLogMessageManager::GetInstance().Append(pLogMsg); 34 | ::PostMessage(m_hWndProcessor, SLVM_NEW_LOGMSGOBJ, (WPARAM)nIndex, 0); 35 | } 36 | } 37 | return 0; 38 | } 39 | 40 | LRESULT SLogReceiver::OnTimer(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) 41 | { 42 | return 0; 43 | } 44 | 45 | LRESULT SLogReceiver::OnClose(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) 46 | { 47 | DestroyWindow(); 48 | return 0; 49 | } 50 | 51 | LRESULT SLogReceiver::OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) 52 | { 53 | PostQuitMessage(0); 54 | return 0; 55 | } 56 | 57 | DWORD SLogReceiver::WorkThreadProc() 58 | { 59 | HWND hWnd = Create(HWND_MESSAGE, 0, LOG_VIEWER_WNDTITLE_NAME); 60 | 61 | if (!hWnd) 62 | { 63 | return 0; 64 | } 65 | 66 | CMessageLoop MsgLoop; 67 | int nRet = MsgLoop.Run(); 68 | 69 | return nRet; 70 | } 71 | 72 | BOOL SLogReceiver::Start() 73 | { 74 | m_workThread = std::make_shared( 75 | &SLogReceiver::WorkThreadProc, this); 76 | 77 | if (m_workThread->native_handle()) 78 | { 79 | return TRUE; 80 | } 81 | 82 | return FALSE; 83 | } 84 | 85 | BOOL SLogReceiver::Stop() 86 | { 87 | PostMessage(WM_CLOSE); 88 | 89 | if (m_workThread) 90 | { 91 | m_workThread->join(); 92 | } 93 | return TRUE; 94 | } 95 | 96 | BOOL SLogReceiver::EnableReceive(BOOL bEnable) 97 | { 98 | m_bEnable = bEnable; 99 | return TRUE; 100 | } 101 | 102 | VOID SLogReceiver::SetProcessorWindow(HWND hWnd) 103 | { 104 | m_hWndProcessor = hWnd; 105 | } 106 | -------------------------------------------------------------------------------- /tools/sLogViewer/SLogReceiver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | 6 | #define LOG_VIEWER_WNDCLASS_NAME L"SLOGGERVIEWER_WNDCLASS_{16a0cd54-f03b-4244-98a4-fffdb085fda2}" 7 | #define LOG_VIEWER_WNDTITLE_NAME L"SLOGGERVIEWER_WNDTITLE_{e408d8b6-8a74-4331-9ccb-b76c4ab825fe}" 8 | 9 | class SLogReceiver : 10 | public CWindowImpl> 11 | { 12 | typedef std::thread WorkThread; 13 | typedef std::shared_ptr WorkThreadPtr; 14 | public: 15 | SLogReceiver(); 16 | 17 | ~SLogReceiver(); 18 | 19 | DECLARE_WND_CLASS(LOG_VIEWER_WNDCLASS_NAME) 20 | 21 | BEGIN_MSG_MAP(SLogReceiver) 22 | MESSAGE_HANDLER(WM_CLOSE, OnClose) 23 | MESSAGE_HANDLER(WM_DESTROY, OnDestroy) 24 | MESSAGE_HANDLER(WM_COPYDATA, OnCopyData); 25 | MESSAGE_HANDLER(WM_TIMER, OnTimer) 26 | END_MSG_MAP() 27 | 28 | VOID SetProcessorWindow(HWND hWnd); 29 | 30 | BOOL Start(); 31 | 32 | BOOL Stop(); 33 | 34 | BOOL EnableReceive(BOOL bEnable); 35 | 36 | protected: 37 | LRESULT OnCopyData(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); 38 | 39 | LRESULT OnTimer(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); 40 | 41 | LRESULT OnClose(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); 42 | 43 | LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); 44 | 45 | DWORD WorkThreadProc(); 46 | 47 | private: 48 | HWND m_hWndProcessor; 49 | 50 | BOOL m_bEnable; 51 | 52 | WorkThreadPtr m_workThread; 53 | }; 54 | 55 | -------------------------------------------------------------------------------- /tools/sLogViewer/SLogViewer.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "MainFrm.h" 3 | 4 | CAppModule _Module; 5 | 6 | int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT) 7 | { 8 | CMessageLoop theLoop; 9 | _Module.AddMessageLoop(&theLoop); 10 | 11 | CMainFrame wndMain; 12 | 13 | if(wndMain.CreateEx() == NULL) 14 | { 15 | ATLTRACE(_T("Main window creation failed!\n")); 16 | return 0; 17 | } 18 | 19 | wndMain.ShowWindow(nCmdShow); 20 | 21 | int nRet = theLoop.Run(); 22 | 23 | _Module.RemoveMessageLoop(); 24 | return nRet; 25 | } 26 | 27 | int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int nCmdShow) 28 | { 29 | HWND hWnd = ::FindWindowEx(NULL, NULL, 30 | SLV_MAIN_WNDCLS_NAME, NULL); 31 | 32 | if (hWnd && ::IsWindow(hWnd)) 33 | { 34 | ::ShowWindow(hWnd, SW_NORMAL); 35 | ::SetForegroundWindow(hWnd); 36 | return 0; 37 | } 38 | 39 | HRESULT hRes = ::CoInitialize(NULL); 40 | // If you are running on NT 4.0 or higher you can use the following call instead to 41 | // make the EXE free threaded. This means that calls come in on a random RPC thread. 42 | // HRESULT hRes = ::CoInitializeEx(NULL, COINIT_MULTITHREADED); 43 | ATLASSERT(SUCCEEDED(hRes)); 44 | 45 | // this resolves ATL window thunking problem when Microsoft Layer for Unicode (MSLU) is used 46 | ::DefWindowProc(NULL, 0, 0, 0L); 47 | 48 | AtlInitCommonControls(ICC_BAR_CLASSES); // add flags to support other controls 49 | 50 | hRes = _Module.Init(NULL, hInstance); 51 | ATLASSERT(SUCCEEDED(hRes)); 52 | 53 | int nRet = Run(lpstrCmdLine, nCmdShow); 54 | 55 | _Module.Term(); 56 | ::CoUninitialize(); 57 | 58 | return nRet; 59 | } 60 | -------------------------------------------------------------------------------- /tools/sLogViewer/SLogViewer.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #include "atlres.h" 11 | 12 | ///////////////////////////////////////////////////////////////////////////// 13 | #undef APSTUDIO_READONLY_SYMBOLS 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | // English (United States) resources 17 | 18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 19 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 20 | #pragma code_page(1252) 21 | 22 | #ifdef APSTUDIO_INVOKED 23 | ///////////////////////////////////////////////////////////////////////////// 24 | // 25 | // TEXTINCLUDE 26 | // 27 | 28 | 1 TEXTINCLUDE 29 | BEGIN 30 | "resource.h\0" 31 | END 32 | 33 | 2 TEXTINCLUDE 34 | BEGIN 35 | "#include ""atlres.h""\r\n" 36 | "\0" 37 | END 38 | 39 | 3 TEXTINCLUDE 40 | BEGIN 41 | "\0" 42 | END 43 | 44 | #endif // APSTUDIO_INVOKED 45 | 46 | #endif // English (United States) resources 47 | ///////////////////////////////////////////////////////////////////////////// 48 | 49 | 50 | ///////////////////////////////////////////////////////////////////////////// 51 | // English (Singapore) resources 52 | 53 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENE) 54 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_SINGAPORE 55 | #pragma code_page(1252) 56 | 57 | ///////////////////////////////////////////////////////////////////////////// 58 | // 59 | // Toolbar 60 | // 61 | 62 | IDR_MAINFRAME TOOLBAR 17, 15 63 | BEGIN 64 | BUTTON ID_FILE_OPEN 65 | BUTTON ID_FILE_CLOSE 66 | SEPARATOR 67 | BUTTON ID_CAPTURE_CAPTURE 68 | BUTTON ID_CAPTURE_AUTOSCROLL 69 | BUTTON ID_CAPTURE_CLEAR 70 | SEPARATOR 71 | BUTTON ID_CAPTURE_FILTER 72 | END 73 | 74 | 75 | ///////////////////////////////////////////////////////////////////////////// 76 | // 77 | // Bitmap 78 | // 79 | 80 | IDR_MAINFRAME BITMAP "res\\Toolbar.bmp" 81 | 82 | IDB_TOOBARIMAGELIST BITMAP "res\\toolbar_res.bmp" 83 | 84 | 85 | ///////////////////////////////////////////////////////////////////////////// 86 | // 87 | // Menu 88 | // 89 | 90 | IDR_MAINFRAME MENU 91 | BEGIN 92 | POPUP "&File" 93 | BEGIN 94 | MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN 95 | MENUITEM "&Close\tCtrl+C", ID_FILE_CLOSE 96 | MENUITEM SEPARATOR 97 | MENUITEM "E&xit", ID_APP_EXIT 98 | END 99 | POPUP "&View" 100 | BEGIN 101 | MENUITEM "&Toolbar", ID_VIEW_TOOLBAR 102 | END 103 | POPUP "&Capture" 104 | BEGIN 105 | MENUITEM SEPARATOR 106 | MENUITEM "Capture", ID_CAPTURE_CAPTURE, CHECKED 107 | MENUITEM "Autoscroll", ID_CAPTURE_AUTOSCROLL, CHECKED 108 | MENUITEM "Clear", ID_CAPTURE_CLEAR 109 | MENUITEM SEPARATOR 110 | MENUITEM "Filter...", ID_CAPTURE_FILTER 111 | END 112 | POPUP "&Help" 113 | BEGIN 114 | MENUITEM "&About...", ID_APP_ABOUT 115 | END 116 | END 117 | 118 | 119 | ///////////////////////////////////////////////////////////////////////////// 120 | // 121 | // Icon 122 | // 123 | 124 | // Icon with lowest ID value placed first to ensure application icon 125 | // remains consistent on all systems. 126 | IDR_MAINFRAME ICON "res\\SLogViewer.ico" 127 | 128 | 129 | ///////////////////////////////////////////////////////////////////////////// 130 | // 131 | // Dialog 132 | // 133 | 134 | IDD_ABOUTBOX DIALOGEX 0, 0, 129, 129 135 | STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU 136 | CAPTION "About" 137 | FONT 8, "MS Shell Dlg", 0, 0, 0x0 138 | BEGIN 139 | DEFPUSHBUTTON "OK",IDOK,40,103,50,14 140 | CTEXT "SLogViewer Application v1.0\n\n(C) Copyright 2017",IDC_STATIC,25,57,78,32 141 | ICON IDR_MAINFRAME,IDC_STATIC,54,26,21,20 142 | GROUPBOX "",IDC_STATIC,7,7,115,92 143 | END 144 | 145 | IDD_DIALOGFILTERRULE DIALOGEX 0, 0, 383, 178 146 | STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU 147 | EXSTYLE WS_EX_TOPMOST | WS_EX_WINDOWEDGE 148 | CAPTION "Filter Rules" 149 | FONT 8, "MS Shell Dlg", 400, 0, 0x1 150 | BEGIN 151 | DEFPUSHBUTTON "OK",IDOK,198,155,50,14 152 | PUSHBUTTON "Cancel",IDCANCEL,262,155,50,14 153 | GROUPBOX "",IDC_STATIC,0,0,382,174 154 | COMBOBOX IDC_COMBO_ITEM,28,12,43,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP 155 | COMBOBOX IDC_COMBO_COMPARE,108,12,61,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP 156 | EDITTEXT IDC_EDIT_VALUE,196,12,99,14,ES_AUTOHSCROLL 157 | LTEXT "Item",IDC_STATIC,8,15,16,10 158 | LTEXT "Compare",IDC_STATIC,74,15,30,10 159 | LTEXT "Value",IDC_STATIC,172,15,18,10 160 | LTEXT "Category",IDC_STATIC,299,15,34,10 161 | COMBOBOX IDC_COMBO_CATEGORY,333,12,42,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP 162 | PUSHBUTTON "Apply",IDC_BUTTON_APPLY,326,155,50,14 163 | PUSHBUTTON "Clear",IDC_BUTTON_CLEAR,7,31,50,14 164 | PUSHBUTTON "Remove",IDC_BUTTON_DEL,326,31,50,14 165 | PUSHBUTTON "Add",IDC_BUTTON_ADD,262,31,50,14 166 | CONTROL "",IDC_LIST_RULES,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,4,48,375,105 167 | END 168 | 169 | 170 | ///////////////////////////////////////////////////////////////////////////// 171 | // 172 | // DESIGNINFO 173 | // 174 | 175 | #ifdef APSTUDIO_INVOKED 176 | GUIDELINES DESIGNINFO 177 | BEGIN 178 | IDD_ABOUTBOX, DIALOG 179 | BEGIN 180 | LEFTMARGIN, 7 181 | RIGHTMARGIN, 122 182 | TOPMARGIN, 7 183 | BOTTOMMARGIN, 122 184 | END 185 | 186 | IDD_DIALOGFILTERRULE, DIALOG 187 | BEGIN 188 | BOTTOMMARGIN, 177 189 | END 190 | END 191 | #endif // APSTUDIO_INVOKED 192 | 193 | 194 | ///////////////////////////////////////////////////////////////////////////// 195 | // 196 | // Version 197 | // 198 | 199 | VS_VERSION_INFO VERSIONINFO 200 | FILEVERSION 1,0,0,1 201 | PRODUCTVERSION 1,0,0,1 202 | FILEFLAGSMASK 0x3fL 203 | #ifdef _DEBUG 204 | FILEFLAGS 0x1L 205 | #else 206 | FILEFLAGS 0x0L 207 | #endif 208 | FILEOS 0x4L 209 | FILETYPE 0x2L 210 | FILESUBTYPE 0x0L 211 | BEGIN 212 | BLOCK "StringFileInfo" 213 | BEGIN 214 | BLOCK "040904B0" 215 | BEGIN 216 | VALUE "FileDescription", "SLogViewer Module" 217 | VALUE "FileVersion", "1, 0, 0, 1" 218 | VALUE "InternalName", "SLogViewer" 219 | VALUE "LegalCopyright", "Copyright 2014" 220 | VALUE "OriginalFilename", "SLogViewer.exe" 221 | VALUE "ProductName", "SLogViewer Module" 222 | VALUE "ProductVersion", "1, 0, 0, 1" 223 | END 224 | END 225 | BLOCK "VarFileInfo" 226 | BEGIN 227 | VALUE "Translation", 0x409, 1200 228 | END 229 | END 230 | 231 | 232 | ///////////////////////////////////////////////////////////////////////////// 233 | // 234 | // Dialog Info 235 | // 236 | 237 | IDD_DIALOGFILTERRULE DLGINIT 238 | BEGIN 239 | IDC_COMBO_ITEM, 0x403, 4, 0 240 | 0x6950, 0x0064, 241 | IDC_COMBO_ITEM, 0x403, 4, 0 242 | 0x6954, 0x0064, 243 | IDC_COMBO_ITEM, 0x403, 5, 0 244 | 0x6954, 0x6b63, "\000" 245 | IDC_COMBO_ITEM, 0x403, 7, 0 246 | 0x6946, 0x746c, 0x7265, "\000" 247 | IDC_COMBO_ITEM, 0x403, 8, 0 248 | 0x654d, 0x7373, 0x6761, 0x0065, 249 | IDC_COMBO_CATEGORY, 0x403, 8, 0 250 | 0x6e49, 0x6c63, 0x6475, 0x0065, 251 | IDC_COMBO_CATEGORY, 0x403, 8, 0 252 | 0x7845, 0x6c63, 0x6475, 0x0065, 253 | 0 254 | END 255 | 256 | 257 | ///////////////////////////////////////////////////////////////////////////// 258 | // 259 | // AFX_DIALOG_LAYOUT 260 | // 261 | 262 | IDD_ABOUTBOX AFX_DIALOG_LAYOUT 263 | BEGIN 264 | 0 265 | END 266 | 267 | 268 | ///////////////////////////////////////////////////////////////////////////// 269 | // 270 | // String Table 271 | // 272 | 273 | STRINGTABLE 274 | BEGIN 275 | IDR_MAINFRAME "SLogViewer" 276 | END 277 | 278 | STRINGTABLE 279 | BEGIN 280 | ID_FILE_OPEN "Open an existing log file\nOpen" 281 | ID_FILE_CLOSE "Close the active log file\nClose" 282 | END 283 | 284 | STRINGTABLE 285 | BEGIN 286 | ID_APP_ABOUT "Display program information, version number and copyright\nAbout" 287 | ID_APP_EXIT "Quit the application; prompts to save documents\nExit" 288 | END 289 | 290 | STRINGTABLE 291 | BEGIN 292 | ID_VIEW_TOOLBAR "Show or hide the toolbar\nToggle ToolBar" 293 | END 294 | 295 | STRINGTABLE 296 | BEGIN 297 | ID_CAPTURE_CLEAR "Clear all log itmes\nClear" 298 | ID_CAPTURE_CAPTURE "Enable/Disable capturing\nCapture" 299 | ID_CAPTURE_AUTOSCROLL "Enable/Disable autosrolling\nAutoscroll" 300 | END 301 | 302 | #endif // English (Singapore) resources 303 | ///////////////////////////////////////////////////////////////////////////// 304 | 305 | 306 | -------------------------------------------------------------------------------- /tools/sLogViewer/SLoggerViewer.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Release 14 | Win32 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | {5CEBF4BF-A964-444A-88C2-2A3EDA07E607} 23 | SLogViewer 24 | 25 | 26 | 27 | Application 28 | true 29 | Unicode 30 | v141_xp 31 | 32 | 33 | Application 34 | true 35 | Unicode 36 | v141_xp 37 | 38 | 39 | Application 40 | false 41 | Unicode 42 | v141_xp 43 | 44 | 45 | Application 46 | false 47 | Unicode 48 | v141_xp 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | true 59 | $(ProjectDir)WTL\include\;$(IncludePath) 60 | $(SolutionDir)output\$(Platform)\$(Configuration)\$(SolutionName)\tools\ 61 | $(SolutionDir)temp\$(Platform)\$(Configuration)\$(ProjectName)\ 62 | 63 | 64 | true 65 | $(ProjectDir)WTL\include\;$(IncludePath) 66 | $(SolutionDir)output\$(Platform)\$(Configuration)\$(SolutionName)\tools\ 67 | $(SolutionDir)temp\$(Platform)\$(Configuration)\$(ProjectName)\ 68 | 69 | 70 | false 71 | $(ProjectDir)WTL\include\;$(IncludePath) 72 | $(SolutionDir)output\$(Platform)\$(Configuration)\$(SolutionName)\tools\ 73 | $(SolutionDir)temp\$(Platform)\$(Configuration)\$(ProjectName)\ 74 | 75 | 76 | false 77 | $(ProjectDir)WTL\include\;$(IncludePath) 78 | $(SolutionDir)output\$(Platform)\$(Configuration)\$(SolutionName)\tools\ 79 | $(SolutionDir)temp\$(Platform)\$(Configuration)\$(ProjectName)\ 80 | 81 | 82 | 83 | Use 84 | Level3 85 | MultiThreadedDebugDLL 86 | true 87 | EditAndContinue 88 | EnableFastChecks 89 | Disabled 90 | WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions) 91 | 92 | 93 | Windows 94 | MachineX86 95 | true 96 | 97 | 98 | 0x0409 99 | $(IntDir);%(AdditionalIncludeDirectories) 100 | _DEBUG;%(PreprocessorDefinitions) 101 | 102 | 103 | false 104 | Win32 105 | _DEBUG;%(PreprocessorDefinitions) 106 | GPLogViewer.h 107 | GPLogViewer_i.c 108 | GPLogViewer_p.c 109 | true 110 | $(IntDir)/GPLogViewer.tlb 111 | 112 | 113 | 114 | 115 | 116 | 117 | Use 118 | Level3 119 | MultiThreadedDebugDLL 120 | ProgramDatabase 121 | EnableFastChecks 122 | Disabled 123 | WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions) 124 | 125 | 126 | Windows 127 | true 128 | 129 | 130 | 0x0409 131 | $(IntDir);%(AdditionalIncludeDirectories) 132 | _DEBUG;%(PreprocessorDefinitions) 133 | 134 | 135 | false 136 | _DEBUG;%(PreprocessorDefinitions) 137 | GPLogViewer.h 138 | GPLogViewer_i.c 139 | GPLogViewer_p.c 140 | true 141 | $(IntDir)/GPLogViewer.tlb 142 | 143 | 144 | 145 | 146 | 147 | 148 | Use 149 | Level3 150 | MultiThreadedDLL 151 | Sync 152 | ProgramDatabase 153 | WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions) 154 | Disabled 155 | 156 | 157 | Windows 158 | MachineX86 159 | true 160 | 161 | 162 | 0x0409 163 | $(IntDir);%(AdditionalIncludeDirectories) 164 | NDEBUG;%(PreprocessorDefinitions) 165 | 166 | 167 | false 168 | Win32 169 | NDEBUG;%(PreprocessorDefinitions) 170 | GPLogViewer.h 171 | GPLogViewer_i.c 172 | GPLogViewer_p.c 173 | true 174 | $(IntDir)/GPLogViewer.tlb 175 | 176 | 177 | 178 | 179 | 180 | 181 | Use 182 | Level3 183 | MultiThreadedDLL 184 | Sync 185 | ProgramDatabase 186 | WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions) 187 | Disabled 188 | 189 | 190 | Windows 191 | true 192 | 193 | 194 | 0x0409 195 | $(IntDir);%(AdditionalIncludeDirectories) 196 | NDEBUG;%(PreprocessorDefinitions) 197 | 198 | 199 | false 200 | NDEBUG;%(PreprocessorDefinitions) 201 | GPLogViewer.h 202 | GPLogViewer_i.c 203 | GPLogViewer_p.c 204 | true 205 | $(IntDir)/GPLogViewer.tlb 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | Create 221 | Create 222 | Create 223 | Create 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | -------------------------------------------------------------------------------- /tools/sLogViewer/SLoggerViewer.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {1a930512-cbe1-4827-9be8-65bdbfe87886} 6 | cpp;c;cxx;def;odl;idl;hpj;bat;asm 7 | 8 | 9 | {f96f5aaa-ec56-4657-961c-abb064b92f58} 10 | h;hpp;hxx;hm;inl;inc 11 | 12 | 13 | {5ac06322-c7ad-487b-ba70-0fc1ecb1150f} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;jpg;jpeg;jpe;manifest 15 | 16 | 17 | {a261d9be-7fbf-431e-a825-b12d5f190036} 18 | 19 | 20 | {6fbc842c-8be4-4d78-ac7e-8619137e91a3} 21 | 22 | 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files\UI 29 | 30 | 31 | Source Files\UI 32 | 33 | 34 | Source Files\Logical 35 | 36 | 37 | Source Files\UI 38 | 39 | 40 | Source Files\UI 41 | 42 | 43 | Source Files 44 | 45 | 46 | Source Files\Logical 47 | 48 | 49 | Source Files\Logical 50 | 51 | 52 | 53 | 54 | Header Files 55 | 56 | 57 | Header Files 58 | 59 | 60 | Header Files 61 | 62 | 63 | Source Files\UI 64 | 65 | 66 | Source Files\UI 67 | 68 | 69 | Source Files\Logical 70 | 71 | 72 | Source Files\UI 73 | 74 | 75 | Source Files\UI 76 | 77 | 78 | Source Files\Logical 79 | 80 | 81 | Source Files\Logical 82 | 83 | 84 | 85 | 86 | Resource Files 87 | 88 | 89 | Resource Files 90 | 91 | 92 | 93 | 94 | Resource Files 95 | 96 | 97 | 98 | 99 | Resource Files 100 | 101 | 102 | -------------------------------------------------------------------------------- /tools/sLogViewer/WTL/Include/atlddx.h: -------------------------------------------------------------------------------- 1 | // Windows Template Library - WTL version 8.1 2 | // Copyright (C) Microsoft Corporation. All rights reserved. 3 | // 4 | // This file is a part of the Windows Template Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) 7 | // which can be found in the file CPL.TXT at the root of this distribution. 8 | // By using this software in any fashion, you are agreeing to be bound by 9 | // the terms of this license. You must not remove this notice, or 10 | // any other, from this software. 11 | 12 | #ifndef __ATLDDX_H__ 13 | #define __ATLDDX_H__ 14 | 15 | #pragma once 16 | 17 | #ifndef __ATLAPP_H__ 18 | #error atlddx.h requires atlapp.h to be included first 19 | #endif 20 | 21 | #if defined(_ATL_USE_DDX_FLOAT) && defined(_ATL_MIN_CRT) 22 | #error Cannot use floating point DDX with _ATL_MIN_CRT defined 23 | #endif // defined(_ATL_USE_DDX_FLOAT) && defined(_ATL_MIN_CRT) 24 | 25 | #ifdef _ATL_USE_DDX_FLOAT 26 | #include 27 | #endif // _ATL_USE_DDX_FLOAT 28 | 29 | 30 | /////////////////////////////////////////////////////////////////////////////// 31 | // Classes in this file: 32 | // 33 | // CWinDataExchange 34 | 35 | 36 | namespace WTL 37 | { 38 | 39 | // Constants 40 | #define DDX_LOAD FALSE 41 | #define DDX_SAVE TRUE 42 | 43 | // DDX map macros 44 | #define BEGIN_DDX_MAP(thisClass) \ 45 | BOOL DoDataExchange(BOOL bSaveAndValidate = FALSE, UINT nCtlID = (UINT)-1) \ 46 | { \ 47 | bSaveAndValidate; \ 48 | nCtlID; 49 | 50 | #define DDX_TEXT(nID, var) \ 51 | if(nCtlID == (UINT)-1 || nCtlID == nID) \ 52 | { \ 53 | if(!DDX_Text(nID, var, sizeof(var), bSaveAndValidate)) \ 54 | return FALSE; \ 55 | } 56 | 57 | #define DDX_TEXT_LEN(nID, var, len) \ 58 | if(nCtlID == (UINT)-1 || nCtlID == nID) \ 59 | { \ 60 | if(!DDX_Text(nID, var, sizeof(var), bSaveAndValidate, TRUE, len)) \ 61 | return FALSE; \ 62 | } 63 | 64 | #define DDX_INT(nID, var) \ 65 | if(nCtlID == (UINT)-1 || nCtlID == nID) \ 66 | { \ 67 | if(!DDX_Int(nID, var, TRUE, bSaveAndValidate)) \ 68 | return FALSE; \ 69 | } 70 | 71 | #define DDX_INT_RANGE(nID, var, min, max) \ 72 | if(nCtlID == (UINT)-1 || nCtlID == nID) \ 73 | { \ 74 | if(!DDX_Int(nID, var, TRUE, bSaveAndValidate, TRUE, min, max)) \ 75 | return FALSE; \ 76 | } 77 | 78 | #define DDX_UINT(nID, var) \ 79 | if(nCtlID == (UINT)-1 || nCtlID == nID) \ 80 | { \ 81 | if(!DDX_Int(nID, var, FALSE, bSaveAndValidate)) \ 82 | return FALSE; \ 83 | } 84 | 85 | #define DDX_UINT_RANGE(nID, var, min, max) \ 86 | if(nCtlID == (UINT)-1 || nCtlID == nID) \ 87 | { \ 88 | if(!DDX_Int(nID, var, FALSE, bSaveAndValidate, TRUE, min, max)) \ 89 | return FALSE; \ 90 | } 91 | 92 | #ifdef _ATL_USE_DDX_FLOAT 93 | #define DDX_FLOAT(nID, var) \ 94 | if(nCtlID == (UINT)-1 || nCtlID == nID) \ 95 | { \ 96 | if(!DDX_Float(nID, var, bSaveAndValidate)) \ 97 | return FALSE; \ 98 | } 99 | 100 | #define DDX_FLOAT_RANGE(nID, var, min, max) \ 101 | if(nCtlID == (UINT)-1 || nCtlID == nID) \ 102 | { \ 103 | if(!DDX_Float(nID, var, bSaveAndValidate, TRUE, min, max)) \ 104 | return FALSE; \ 105 | } 106 | #define DDX_FLOAT_P(nID, var, precision) \ 107 | if(nCtlID == (UINT)-1 || nCtlID == nID) \ 108 | { \ 109 | if(!DDX_Float(nID, var, bSaveAndValidate, FALSE, 0, 0, precision)) \ 110 | return FALSE; \ 111 | } 112 | 113 | #define DDX_FLOAT_P_RANGE(nID, var, min, max, precision) \ 114 | if(nCtlID == (UINT)-1 || nCtlID == nID) \ 115 | { \ 116 | if(!DDX_Float(nID, var, bSaveAndValidate, TRUE, min, max, precision)) \ 117 | return FALSE; \ 118 | } 119 | #endif // _ATL_USE_DDX_FLOAT 120 | 121 | #define DDX_CONTROL(nID, obj) \ 122 | if(nCtlID == (UINT)-1 || nCtlID == nID) \ 123 | DDX_Control(nID, obj, bSaveAndValidate); 124 | 125 | #define DDX_CONTROL_HANDLE(nID, obj) \ 126 | if(nCtlID == (UINT)-1 || nCtlID == nID) \ 127 | DDX_Control_Handle(nID, obj, bSaveAndValidate); 128 | 129 | #define DDX_CHECK(nID, var) \ 130 | if(nCtlID == (UINT)-1 || nCtlID == nID) \ 131 | DDX_Check(nID, var, bSaveAndValidate); 132 | 133 | #define DDX_RADIO(nID, var) \ 134 | if(nCtlID == (UINT)-1 || nCtlID == nID) \ 135 | DDX_Radio(nID, var, bSaveAndValidate); 136 | 137 | #define END_DDX_MAP() \ 138 | return TRUE; \ 139 | } 140 | 141 | // DDX support for Tab, Combo, ListBox and ListView selection index 142 | // Note: Specialized versions require atlctrls.h to be included first 143 | #if (_MSC_VER >= 1300) 144 | 145 | #define DDX_INDEX(CtrlClass, nID, var) \ 146 | if(nCtlID == (UINT)-1 || nCtlID == nID) \ 147 | DDX_Index(nID, var, bSaveAndValidate); 148 | 149 | #ifdef __ATLCTRLS_H__ 150 | #define DDX_TAB_INDEX(nID, var) DDX_INDEX(WTL::CTabCtrl, nID, var) 151 | #define DDX_COMBO_INDEX(nID, var) DDX_INDEX(WTL::CComboBox, nID, var) 152 | #define DDX_LISTBOX_INDEX(nID, var) DDX_INDEX(WTL::CListBox, nID, var) 153 | #define DDX_LISTVIEW_INDEX(nID, var) DDX_INDEX(WTL::CListViewCtrl, nID, var) 154 | #endif // __ATLCTRLS_H__ 155 | 156 | #endif // (_MSC_VER >= 1300) 157 | 158 | 159 | /////////////////////////////////////////////////////////////////////////////// 160 | // CWinDataExchange - provides support for DDX 161 | 162 | template 163 | class CWinDataExchange 164 | { 165 | public: 166 | // Data exchange method - override in your derived class 167 | BOOL DoDataExchange(BOOL /*bSaveAndValidate*/ = FALSE, UINT /*nCtlID*/ = (UINT)-1) 168 | { 169 | // this one should never be called, override it in 170 | // your derived class by implementing DDX map 171 | ATLASSERT(FALSE); 172 | return FALSE; 173 | } 174 | 175 | // Helpers for validation error reporting 176 | enum _XDataType 177 | { 178 | ddxDataNull = 0, 179 | ddxDataText = 1, 180 | ddxDataInt = 2, 181 | ddxDataFloat = 3, 182 | ddxDataDouble = 4 183 | }; 184 | 185 | struct _XTextData 186 | { 187 | int nLength; 188 | int nMaxLength; 189 | }; 190 | 191 | struct _XIntData 192 | { 193 | long nVal; 194 | long nMin; 195 | long nMax; 196 | }; 197 | 198 | struct _XFloatData 199 | { 200 | double nVal; 201 | double nMin; 202 | double nMax; 203 | }; 204 | 205 | struct _XData 206 | { 207 | _XDataType nDataType; 208 | union 209 | { 210 | _XTextData textData; 211 | _XIntData intData; 212 | _XFloatData floatData; 213 | }; 214 | }; 215 | 216 | // Text exchange 217 | BOOL DDX_Text(UINT nID, LPTSTR lpstrText, int cbSize, BOOL bSave, BOOL bValidate = FALSE, int nLength = 0) 218 | { 219 | T* pT = static_cast(this); 220 | BOOL bSuccess = TRUE; 221 | 222 | if(bSave) 223 | { 224 | HWND hWndCtrl = pT->GetDlgItem(nID); 225 | int nRetLen = ::GetWindowText(hWndCtrl, lpstrText, cbSize / sizeof(TCHAR)); 226 | if(nRetLen < ::GetWindowTextLength(hWndCtrl)) 227 | bSuccess = FALSE; 228 | } 229 | else 230 | { 231 | ATLASSERT(!bValidate || lstrlen(lpstrText) <= nLength); 232 | bSuccess = pT->SetDlgItemText(nID, lpstrText); 233 | } 234 | 235 | if(!bSuccess) 236 | { 237 | pT->OnDataExchangeError(nID, bSave); 238 | } 239 | else if(bSave && bValidate) // validation 240 | { 241 | ATLASSERT(nLength > 0); 242 | if(lstrlen(lpstrText) > nLength) 243 | { 244 | _XData data = { ddxDataText }; 245 | data.textData.nLength = lstrlen(lpstrText); 246 | data.textData.nMaxLength = nLength; 247 | pT->OnDataValidateError(nID, bSave, data); 248 | bSuccess = FALSE; 249 | } 250 | } 251 | return bSuccess; 252 | } 253 | 254 | BOOL DDX_Text(UINT nID, BSTR& bstrText, int /*cbSize*/, BOOL bSave, BOOL bValidate = FALSE, int nLength = 0) 255 | { 256 | T* pT = static_cast(this); 257 | BOOL bSuccess = TRUE; 258 | 259 | if(bSave) 260 | { 261 | bSuccess = pT->GetDlgItemText(nID, bstrText); 262 | } 263 | else 264 | { 265 | USES_CONVERSION; 266 | LPTSTR lpstrText = OLE2T(bstrText); 267 | ATLASSERT(!bValidate || lstrlen(lpstrText) <= nLength); 268 | bSuccess = pT->SetDlgItemText(nID, lpstrText); 269 | } 270 | 271 | if(!bSuccess) 272 | { 273 | pT->OnDataExchangeError(nID, bSave); 274 | } 275 | else if(bSave && bValidate) // validation 276 | { 277 | ATLASSERT(nLength > 0); 278 | if((int)::SysStringLen(bstrText) > nLength) 279 | { 280 | _XData data = { ddxDataText }; 281 | data.textData.nLength = (int)::SysStringLen(bstrText); 282 | data.textData.nMaxLength = nLength; 283 | pT->OnDataValidateError(nID, bSave, data); 284 | bSuccess = FALSE; 285 | } 286 | } 287 | return bSuccess; 288 | } 289 | 290 | BOOL DDX_Text(UINT nID, ATL::CComBSTR& bstrText, int /*cbSize*/, BOOL bSave, BOOL bValidate = FALSE, int nLength = 0) 291 | { 292 | T* pT = static_cast(this); 293 | BOOL bSuccess = TRUE; 294 | 295 | if(bSave) 296 | { 297 | bSuccess = pT->GetDlgItemText(nID, (BSTR&)bstrText); 298 | } 299 | else 300 | { 301 | USES_CONVERSION; 302 | LPTSTR lpstrText = OLE2T(bstrText); 303 | ATLASSERT(!bValidate || lstrlen(lpstrText) <= nLength); 304 | bSuccess = pT->SetDlgItemText(nID, lpstrText); 305 | } 306 | 307 | if(!bSuccess) 308 | { 309 | pT->OnDataExchangeError(nID, bSave); 310 | } 311 | else if(bSave && bValidate) // validation 312 | { 313 | ATLASSERT(nLength > 0); 314 | if((int)bstrText.Length() > nLength) 315 | { 316 | _XData data = { ddxDataText }; 317 | data.textData.nLength = (int)bstrText.Length(); 318 | data.textData.nMaxLength = nLength; 319 | pT->OnDataValidateError(nID, bSave, data); 320 | bSuccess = FALSE; 321 | } 322 | } 323 | return bSuccess; 324 | } 325 | 326 | #if defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) 327 | BOOL DDX_Text(UINT nID, _CSTRING_NS::CString& strText, int /*cbSize*/, BOOL bSave, BOOL bValidate = FALSE, int nLength = 0) 328 | { 329 | T* pT = static_cast(this); 330 | BOOL bSuccess = TRUE; 331 | 332 | if(bSave) 333 | { 334 | HWND hWndCtrl = pT->GetDlgItem(nID); 335 | int nLen = ::GetWindowTextLength(hWndCtrl); 336 | int nRetLen = -1; 337 | LPTSTR lpstr = strText.GetBufferSetLength(nLen); 338 | if(lpstr != NULL) 339 | { 340 | nRetLen = ::GetWindowText(hWndCtrl, lpstr, nLen + 1); 341 | strText.ReleaseBuffer(); 342 | } 343 | if(nRetLen < nLen) 344 | bSuccess = FALSE; 345 | } 346 | else 347 | { 348 | bSuccess = pT->SetDlgItemText(nID, strText); 349 | } 350 | 351 | if(!bSuccess) 352 | { 353 | pT->OnDataExchangeError(nID, bSave); 354 | } 355 | else if(bSave && bValidate) // validation 356 | { 357 | ATLASSERT(nLength > 0); 358 | if(strText.GetLength() > nLength) 359 | { 360 | _XData data = { ddxDataText }; 361 | data.textData.nLength = strText.GetLength(); 362 | data.textData.nMaxLength = nLength; 363 | pT->OnDataValidateError(nID, bSave, data); 364 | bSuccess = FALSE; 365 | } 366 | } 367 | return bSuccess; 368 | } 369 | #endif // defined(_WTL_USE_CSTRING) || defined(__ATLSTR_H__) 370 | 371 | // Numeric exchange 372 | template 373 | BOOL DDX_Int(UINT nID, Type& nVal, BOOL bSigned, BOOL bSave, BOOL bValidate = FALSE, Type nMin = 0, Type nMax = 0) 374 | { 375 | T* pT = static_cast(this); 376 | BOOL bSuccess = TRUE; 377 | 378 | if(bSave) 379 | { 380 | nVal = (Type)pT->GetDlgItemInt(nID, &bSuccess, bSigned); 381 | } 382 | else 383 | { 384 | ATLASSERT(!bValidate || nVal >= nMin && nVal <= nMax); 385 | bSuccess = pT->SetDlgItemInt(nID, nVal, bSigned); 386 | } 387 | 388 | if(!bSuccess) 389 | { 390 | pT->OnDataExchangeError(nID, bSave); 391 | } 392 | else if(bSave && bValidate) // validation 393 | { 394 | ATLASSERT(nMin != nMax); 395 | if(nVal < nMin || nVal > nMax) 396 | { 397 | _XData data = { ddxDataInt }; 398 | data.intData.nVal = (long)nVal; 399 | data.intData.nMin = (long)nMin; 400 | data.intData.nMax = (long)nMax; 401 | pT->OnDataValidateError(nID, bSave, data); 402 | bSuccess = FALSE; 403 | } 404 | } 405 | return bSuccess; 406 | } 407 | 408 | // Float exchange 409 | #ifdef _ATL_USE_DDX_FLOAT 410 | static BOOL _AtlSimpleFloatParse(LPCTSTR lpszText, double& d) 411 | { 412 | ATLASSERT(lpszText != NULL); 413 | while (*lpszText == _T(' ') || *lpszText == _T('\t')) 414 | lpszText++; 415 | 416 | TCHAR chFirst = lpszText[0]; 417 | d = _tcstod(lpszText, (LPTSTR*)&lpszText); 418 | if (d == 0.0 && chFirst != _T('0')) 419 | return FALSE; // could not convert 420 | while (*lpszText == _T(' ') || *lpszText == _T('\t')) 421 | lpszText++; 422 | 423 | if (*lpszText != _T('\0')) 424 | return FALSE; // not terminated properly 425 | 426 | return TRUE; 427 | } 428 | 429 | BOOL DDX_Float(UINT nID, float& nVal, BOOL bSave, BOOL bValidate = FALSE, float nMin = 0.F, float nMax = 0.F, int nPrecision = FLT_DIG) 430 | { 431 | T* pT = static_cast(this); 432 | BOOL bSuccess = TRUE; 433 | const int cchBuff = 32; 434 | TCHAR szBuff[cchBuff] = { 0 }; 435 | 436 | if(bSave) 437 | { 438 | pT->GetDlgItemText(nID, szBuff, cchBuff); 439 | double d = 0; 440 | if(_AtlSimpleFloatParse(szBuff, d)) 441 | nVal = (float)d; 442 | else 443 | bSuccess = FALSE; 444 | } 445 | else 446 | { 447 | ATLASSERT(!bValidate || nVal >= nMin && nVal <= nMax); 448 | SecureHelper::sprintf_x(szBuff, cchBuff, _T("%.*g"), nPrecision, nVal); 449 | bSuccess = pT->SetDlgItemText(nID, szBuff); 450 | } 451 | 452 | if(!bSuccess) 453 | { 454 | pT->OnDataExchangeError(nID, bSave); 455 | } 456 | else if(bSave && bValidate) // validation 457 | { 458 | ATLASSERT(nMin != nMax); 459 | if(nVal < nMin || nVal > nMax) 460 | { 461 | _XData data = { ddxDataFloat }; 462 | data.floatData.nVal = (double)nVal; 463 | data.floatData.nMin = (double)nMin; 464 | data.floatData.nMax = (double)nMax; 465 | pT->OnDataValidateError(nID, bSave, data); 466 | bSuccess = FALSE; 467 | } 468 | } 469 | return bSuccess; 470 | } 471 | 472 | BOOL DDX_Float(UINT nID, double& nVal, BOOL bSave, BOOL bValidate = FALSE, double nMin = 0., double nMax = 0., int nPrecision = DBL_DIG) 473 | { 474 | T* pT = static_cast(this); 475 | BOOL bSuccess = TRUE; 476 | const int cchBuff = 32; 477 | TCHAR szBuff[cchBuff] = { 0 }; 478 | 479 | if(bSave) 480 | { 481 | pT->GetDlgItemText(nID, szBuff, cchBuff); 482 | double d = 0; 483 | if(_AtlSimpleFloatParse(szBuff, d)) 484 | nVal = d; 485 | else 486 | bSuccess = FALSE; 487 | } 488 | else 489 | { 490 | ATLASSERT(!bValidate || nVal >= nMin && nVal <= nMax); 491 | SecureHelper::sprintf_x(szBuff, cchBuff, _T("%.*g"), nPrecision, nVal); 492 | bSuccess = pT->SetDlgItemText(nID, szBuff); 493 | } 494 | 495 | if(!bSuccess) 496 | { 497 | pT->OnDataExchangeError(nID, bSave); 498 | } 499 | else if(bSave && bValidate) // validation 500 | { 501 | ATLASSERT(nMin != nMax); 502 | if(nVal < nMin || nVal > nMax) 503 | { 504 | _XData data = { ddxDataFloat }; 505 | data.floatData.nVal = nVal; 506 | data.floatData.nMin = nMin; 507 | data.floatData.nMax = nMax; 508 | pT->OnDataValidateError(nID, bSave, data); 509 | bSuccess = FALSE; 510 | } 511 | } 512 | return bSuccess; 513 | } 514 | #endif // _ATL_USE_DDX_FLOAT 515 | 516 | // Full control subclassing (for CWindowImpl derived controls) 517 | template 518 | void DDX_Control(UINT nID, TControl& ctrl, BOOL bSave) 519 | { 520 | if(!bSave && ctrl.m_hWnd == NULL) 521 | { 522 | T* pT = static_cast(this); 523 | ctrl.SubclassWindow(pT->GetDlgItem(nID)); 524 | } 525 | } 526 | 527 | // Simple control attaching (for HWND wrapper controls) 528 | template 529 | void DDX_Control_Handle(UINT nID, TControl& ctrl, BOOL bSave) 530 | { 531 | if(!bSave && ctrl.m_hWnd == NULL) 532 | { 533 | T* pT = static_cast(this); 534 | ctrl = pT->GetDlgItem(nID); 535 | } 536 | } 537 | 538 | // Control state 539 | void DDX_Check(UINT nID, int& nValue, BOOL bSave) 540 | { 541 | T* pT = static_cast(this); 542 | HWND hWndCtrl = pT->GetDlgItem(nID); 543 | if(bSave) 544 | { 545 | nValue = (int)::SendMessage(hWndCtrl, BM_GETCHECK, 0, 0L); 546 | ATLASSERT(nValue >= 0 && nValue <= 2); 547 | } 548 | else 549 | { 550 | if(nValue < 0 || nValue > 2) 551 | { 552 | ATLTRACE2(atlTraceUI, 0, _T("ATL: Warning - dialog data checkbox value (%d) out of range.\n"), nValue); 553 | nValue = 0; // default to off 554 | } 555 | ::SendMessage(hWndCtrl, BM_SETCHECK, nValue, 0L); 556 | } 557 | } 558 | 559 | // variant that supports bool (checked/not-checked, no intermediate state) 560 | void DDX_Check(UINT nID, bool& bCheck, BOOL bSave) 561 | { 562 | int nValue = bCheck ? 1 : 0; 563 | DDX_Check(nID, nValue, bSave); 564 | 565 | if(bSave) 566 | { 567 | if(nValue == 2) 568 | ATLTRACE2(atlTraceUI, 0, _T("ATL: Warning - checkbox state (%d) out of supported range.\n"), nValue); 569 | bCheck = (nValue == 1); 570 | } 571 | } 572 | 573 | void DDX_Radio(UINT nID, int& nValue, BOOL bSave) 574 | { 575 | T* pT = static_cast(this); 576 | HWND hWndCtrl = pT->GetDlgItem(nID); 577 | ATLASSERT(hWndCtrl != NULL); 578 | 579 | // must be first in a group of auto radio buttons 580 | ATLASSERT(::GetWindowLong(hWndCtrl, GWL_STYLE) & WS_GROUP); 581 | ATLASSERT(::SendMessage(hWndCtrl, WM_GETDLGCODE, 0, 0L) & DLGC_RADIOBUTTON); 582 | 583 | if(bSave) 584 | nValue = -1; // value if none found 585 | 586 | // walk all children in group 587 | int nButton = 0; 588 | do 589 | { 590 | if(::SendMessage(hWndCtrl, WM_GETDLGCODE, 0, 0L) & DLGC_RADIOBUTTON) 591 | { 592 | // control in group is a radio button 593 | if(bSave) 594 | { 595 | if(::SendMessage(hWndCtrl, BM_GETCHECK, 0, 0L) != 0) 596 | { 597 | ATLASSERT(nValue == -1); // only set once 598 | nValue = nButton; 599 | } 600 | } 601 | else 602 | { 603 | // select button 604 | ::SendMessage(hWndCtrl, BM_SETCHECK, (nButton == nValue), 0L); 605 | } 606 | nButton++; 607 | } 608 | else 609 | { 610 | ATLTRACE2(atlTraceUI, 0, _T("ATL: Warning - skipping non-radio button in group.\n")); 611 | } 612 | hWndCtrl = ::GetWindow(hWndCtrl, GW_HWNDNEXT); 613 | } 614 | while (hWndCtrl != NULL && !(GetWindowLong(hWndCtrl, GWL_STYLE) & WS_GROUP)); 615 | } 616 | 617 | // DDX support for Tab, Combo, ListBox and ListView selection index 618 | #if (_MSC_VER >= 1300) 619 | template 620 | INT _getSel(TCtrl& tCtrl) 621 | { 622 | return tCtrl.GetCurSel(); 623 | } 624 | 625 | template 626 | void _setSel(TCtrl& tCtrl, INT iSel) 627 | { 628 | if(iSel < 0) 629 | tCtrl.SetCurSel(-1); 630 | else 631 | tCtrl.SetCurSel(iSel); 632 | } 633 | 634 | #ifdef __ATLCTRLS_H__ 635 | // ListViewCtrl specialization 636 | template <> 637 | INT _getSel(WTL::CListViewCtrl& tCtrl) 638 | { 639 | return tCtrl.GetSelectedIndex(); 640 | } 641 | 642 | template <> 643 | void _setSel(WTL::CListViewCtrl& tCtrl, INT iSel) 644 | { 645 | if(iSel < 0) 646 | tCtrl.SelectItem(-1); 647 | else 648 | tCtrl.SelectItem(iSel); 649 | } 650 | #endif // __ATLCTRLS_H__ 651 | 652 | template 653 | void DDX_Index(UINT nID, INT& nVal, BOOL bSave) 654 | { 655 | T* pT = static_cast(this); 656 | TCtrl ctrl(pT->GetDlgItem(nID)); 657 | 658 | if(bSave) 659 | nVal = _getSel(ctrl); 660 | else 661 | _setSel(ctrl, nVal); 662 | } 663 | #endif // (_MSC_VER >= 1300) 664 | 665 | // Overrideables 666 | void OnDataExchangeError(UINT nCtrlID, BOOL /*bSave*/) 667 | { 668 | // Override to display an error message 669 | ::MessageBeep((UINT)-1); 670 | T* pT = static_cast(this); 671 | ::SetFocus(pT->GetDlgItem(nCtrlID)); 672 | } 673 | 674 | void OnDataValidateError(UINT nCtrlID, BOOL /*bSave*/, _XData& /*data*/) 675 | { 676 | // Override to display an error message 677 | ::MessageBeep((UINT)-1); 678 | T* pT = static_cast(this); 679 | ::SetFocus(pT->GetDlgItem(nCtrlID)); 680 | } 681 | }; 682 | 683 | }; // namespace WTL 684 | 685 | #endif // __ATLDDX_H__ 686 | -------------------------------------------------------------------------------- /tools/sLogViewer/WTL/Include/atldwm.h: -------------------------------------------------------------------------------- 1 | // Windows Template Library - WTL version 8.1 2 | // Copyright (C) Microsoft Corporation. All rights reserved. 3 | // 4 | // This file is a part of the Windows Template Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) 7 | // which can be found in the file CPL.TXT at the root of this distribution. 8 | // By using this software in any fashion, you are agreeing to be bound by 9 | // the terms of this license. You must not remove this notice, or 10 | // any other, from this software. 11 | 12 | #ifndef __ATLDWM_H__ 13 | #define __ATLDWM_H__ 14 | 15 | #pragma once 16 | 17 | #ifdef _WIN32_WCE 18 | #error atldwm.h is not supported on Windows CE 19 | #endif 20 | 21 | #ifndef __ATLAPP_H__ 22 | #error atldwm.h requires atlapp.h to be included first 23 | #endif 24 | 25 | #ifndef __ATLWIN_H__ 26 | #error atldwm.h requires atlwin.h to be included first 27 | #endif 28 | 29 | #if (_WIN32_WINNT < 0x0600) 30 | #error atldwm.h requires _WIN32_WINNT >= 0x0600 31 | #endif // (_WIN32_WINNT < 0x0600) 32 | 33 | #ifndef _DWMAPI_H_ 34 | #include 35 | #endif // _DWMAPI_H_ 36 | #pragma comment(lib, "dwmapi.lib") 37 | 38 | // Note: To create an application that also runs on older versions of Windows, 39 | // use delay load of dwmapi.dll and ensure that no calls to the DWM API are 40 | // Delay load is NOT AUTOMATIC for VC++ 7, you have to link to delayimp.lib, 41 | // and add dwmapi.dll in the Linker.Input.Delay Loaded DLLs section of the 42 | // project properties. 43 | #if (_MSC_VER < 1300) && !defined(_WTL_NO_DWMAPI_DELAYLOAD) 44 | #pragma comment(lib, "delayimp.lib") 45 | #pragma comment(linker, "/delayload:dwmapi.dll") 46 | #endif // (_MSC_VER < 1300) && !defined(_WTL_NO_DWMAPI_DELAYLOAD) 47 | 48 | /////////////////////////////////////////////////////////////////////////////// 49 | // Classes in this file: 50 | // 51 | // CDwm 52 | // CDwmImpl 53 | // CDwmWindowT - CDwmWindow 54 | // CDwmThumbnailT 55 | // CDwmThumbnail 56 | // CDwmThumbnailHandle 57 | // CAeroControlImpl 58 | 59 | 60 | namespace WTL 61 | { 62 | 63 | /////////////////////////////////////////////////////////////////////////////// 64 | // CDwm - wrapper for DWM handle 65 | 66 | class CDwm 67 | { 68 | public: 69 | // Data members 70 | static int m_nIsDwmSupported; 71 | 72 | // Constructor 73 | CDwm() 74 | { 75 | IsDwmSupported(); 76 | } 77 | 78 | // Dwm support helper 79 | static bool IsDwmSupported() 80 | { 81 | if(m_nIsDwmSupported == -1) 82 | { 83 | CStaticDataInitCriticalSectionLock lock; 84 | if(FAILED(lock.Lock())) 85 | { 86 | ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CDwm::IsDwmSupported.\n")); 87 | ATLASSERT(FALSE); 88 | return false; 89 | } 90 | 91 | if(m_nIsDwmSupported == -1) 92 | { 93 | HMODULE hDwmDLL = ::LoadLibrary(_T("dwmapi.dll")); 94 | m_nIsDwmSupported = (hDwmDLL != NULL) ? 1 : 0; 95 | if(hDwmDLL != NULL) 96 | ::FreeLibrary(hDwmDLL); 97 | } 98 | 99 | lock.Unlock(); 100 | } 101 | 102 | ATLASSERT(m_nIsDwmSupported != -1); 103 | return (m_nIsDwmSupported == 1); 104 | } 105 | 106 | // Operations 107 | BOOL DwmIsCompositionEnabled() const 108 | { 109 | if(!IsDwmSupported()) return FALSE; 110 | BOOL bRes = FALSE; 111 | return SUCCEEDED(::DwmIsCompositionEnabled(&bRes)) && bRes; 112 | } 113 | 114 | BOOL DwmEnableComposition(UINT fEnable) 115 | { 116 | if(!IsDwmSupported()) return FALSE; 117 | return SUCCEEDED(::DwmEnableComposition(fEnable)); 118 | } 119 | 120 | BOOL DwmEnableMMCSS(BOOL fEnableMMCSS) 121 | { 122 | if(!IsDwmSupported()) return FALSE; 123 | return SUCCEEDED(::DwmEnableMMCSS(fEnableMMCSS)); 124 | } 125 | 126 | HRESULT DwmGetColorizationColor(DWORD* pcrColorization, BOOL* pfOpaqueBlend) 127 | { 128 | if(!IsDwmSupported()) return E_NOTIMPL; 129 | return ::DwmGetColorizationColor(pcrColorization, pfOpaqueBlend); 130 | } 131 | 132 | HRESULT DwmFlush() 133 | { 134 | if(!IsDwmSupported()) return E_NOTIMPL; 135 | return ::DwmFlush(); 136 | } 137 | }; 138 | 139 | __declspec(selectany) int CDwm::m_nIsDwmSupported = -1; 140 | 141 | 142 | /////////////////////////////////////////////////////////////////////////////// 143 | // CDwmImpl - DWM window support 144 | 145 | template 146 | class CDwmImpl : public TBase 147 | { 148 | public: 149 | HRESULT DwmEnableBlurBehindWindow(const DWM_BLURBEHIND* pBB) 150 | { 151 | if(!IsDwmSupported()) return E_NOTIMPL; 152 | T* pT = static_cast(this); 153 | ATLASSERT(::IsWindow(pT->m_hWnd)); 154 | return ::DwmEnableBlurBehindWindow(pT->m_hWnd, pBB); 155 | } 156 | 157 | HRESULT DwmExtendFrameIntoClientArea(const MARGINS* pMargins) 158 | { 159 | if(!IsDwmSupported()) return E_NOTIMPL; 160 | T* pT = static_cast(this); 161 | ATLASSERT(::IsWindow(pT->m_hWnd)); 162 | return ::DwmExtendFrameIntoClientArea(pT->m_hWnd, pMargins); 163 | } 164 | 165 | HRESULT DwmExtendFrameIntoEntireClientArea() 166 | { 167 | MARGINS margins = { -1 }; 168 | return DwmExtendFrameIntoClientArea(&margins); 169 | } 170 | 171 | HRESULT DwmGetCompositionTimingInfo(DWM_TIMING_INFO* pTimingInfo) 172 | { 173 | if(!IsDwmSupported()) return E_NOTIMPL; 174 | T* pT = static_cast(this); 175 | ATLASSERT(::IsWindow(pT->m_hWnd)); 176 | return ::DwmGetCompositionTimingInfo(pT->m_hWnd, pTimingInfo); 177 | } 178 | 179 | HRESULT DwmGetWindowAttribute(DWORD dwAttribute, PVOID pvAttribute, DWORD cbAttribute) 180 | { 181 | if(!IsDwmSupported()) return E_NOTIMPL; 182 | T* pT = static_cast(this); 183 | ATLASSERT(::IsWindow(pT->m_hWnd)); 184 | return ::DwmGetWindowAttribute(pT->m_hWnd, dwAttribute, pvAttribute, cbAttribute); 185 | } 186 | 187 | HRESULT DwmModifyPreviousDxFrameDuration(INT cRefreshes, BOOL fRelative) 188 | { 189 | if(!IsDwmSupported()) return E_NOTIMPL; 190 | T* pT = static_cast(this); 191 | ATLASSERT(::IsWindow(pT->m_hWnd)); 192 | return ::DwmModifyPreviousDxFrameDuration(pT->m_hWnd, cRefreshes, fRelative); 193 | } 194 | 195 | HRESULT DwmSetDxFrameDuration(INT cRefreshes) 196 | { 197 | if(!IsDwmSupported()) return E_NOTIMPL; 198 | T* pT = static_cast(this); 199 | ATLASSERT(::IsWindow(pT->m_hWnd)); 200 | return ::DwmSetDxFrameDuration(pT->m_hWnd, cRefreshes); 201 | } 202 | 203 | HRESULT DwmSetPresentParameters(DWM_PRESENT_PARAMETERS* pPresentParams) 204 | { 205 | if(!IsDwmSupported()) return E_NOTIMPL; 206 | T* pT = static_cast(this); 207 | ATLASSERT(::IsWindow(pT->m_hWnd)); 208 | return ::DwmSetPresentParameters(pT->m_hWnd, pPresentParams); 209 | } 210 | 211 | HRESULT DwmSetWindowAttribute(DWORD dwAttribute, LPCVOID pvAttribute, DWORD cbAttribute) 212 | { 213 | if(!IsDwmSupported()) return E_NOTIMPL; 214 | T* pT = static_cast(this); 215 | ATLASSERT(::IsWindow(pT->m_hWnd)); 216 | return ::DwmSetWindowAttribute(pT->m_hWnd, dwAttribute, pvAttribute, cbAttribute); 217 | } 218 | 219 | HRESULT DwmAttachMilContent() 220 | { 221 | if(!IsDwmSupported()) return E_NOTIMPL; 222 | T* pT = static_cast(this); 223 | ATLASSERT(::IsWindow(pT->m_hWnd)); 224 | return ::DwmAttachMilContent(pT->m_hWnd); 225 | } 226 | 227 | HRESULT DwmDetachMilContent() 228 | { 229 | if(!IsDwmSupported()) return E_NOTIMPL; 230 | T* pT = static_cast(this); 231 | ATLASSERT(::IsWindow(pT->m_hWnd)); 232 | return ::DwmDetachMilContent(pT->m_hWnd); 233 | } 234 | }; 235 | 236 | template 237 | class CDwmWindowT : public TBase, public CDwmImpl > 238 | { 239 | public: 240 | CDwmWindowT(HWND hWnd = NULL) : TBase(hWnd) 241 | { } 242 | 243 | CDwmWindowT< TBase >& operator =(HWND hWnd) 244 | { 245 | m_hWnd = hWnd; 246 | return *this; 247 | } 248 | }; 249 | 250 | typedef CDwmWindowT CDwmWindow; 251 | 252 | 253 | /////////////////////////////////////////////////////////////////////////////// 254 | // CDwmThumbnail - provides DWM thumbnail support 255 | 256 | template 257 | class CDwmThumbnailT : public TBase 258 | { 259 | public: 260 | // Data members 261 | HTHUMBNAIL m_hThumbnail; 262 | 263 | // Constructor 264 | CDwmThumbnailT(HTHUMBNAIL hThumbnail = NULL) : m_hThumbnail(hThumbnail) 265 | { 266 | } 267 | 268 | ~CDwmThumbnailT() 269 | { 270 | if(t_bManaged && m_hThumbnail != NULL) 271 | Unregister(); 272 | } 273 | 274 | // Operations 275 | CDwmThumbnailT& operator =(HTHUMBNAIL hThumbnail) 276 | { 277 | Attach(hThumbnail); 278 | return *this; 279 | } 280 | 281 | void Attach(HTHUMBNAIL hThumbnailNew) 282 | { 283 | if(t_bManaged && m_hThumbnail != NULL && m_hThumbnail != hThumbnailNew) 284 | Unregister(); 285 | m_hThumbnail = hThumbnailNew; 286 | } 287 | 288 | HTHUMBNAIL Detach() 289 | { 290 | HTHUMBNAIL hThumbnail = m_hThumbnail; 291 | m_hThumbnail = NULL; 292 | return hThumbnail; 293 | } 294 | 295 | HRESULT Register(HWND hwndDestination, HWND hwndSource) 296 | { 297 | ATLASSERT(::IsWindow(hwndDestination)); 298 | ATLASSERT(::IsWindow(hwndSource)); 299 | ATLASSERT(m_hThumbnail==NULL); 300 | if(!IsDwmSupported()) return E_NOTIMPL; 301 | return ::DwmRegisterThumbnail(hwndDestination, hwndSource, &m_hThumbnail); 302 | } 303 | 304 | HRESULT Unregister() 305 | { 306 | if(!IsDwmSupported()) return E_NOTIMPL; 307 | if(m_hThumbnail == NULL) return S_FALSE; 308 | HRESULT Hr = ::DwmUnregisterThumbnail(m_hThumbnail); 309 | if(SUCCEEDED(Hr)) m_hThumbnail = NULL; 310 | return Hr; 311 | } 312 | 313 | operator HTHUMBNAIL() const { return m_hThumbnail; } 314 | 315 | bool IsNull() const { return (m_hThumbnail == NULL); } 316 | 317 | HRESULT UpdateProperties(const DWM_THUMBNAIL_PROPERTIES* ptnProperties) 318 | { 319 | if(!IsDwmSupported()) return E_NOTIMPL; 320 | ATLASSERT(m_hThumbnail != NULL); 321 | return ::DwmUpdateThumbnailProperties(m_hThumbnail, ptnProperties); 322 | } 323 | 324 | // Attributes 325 | HRESULT QuerySourceSize(PSIZE pSize) 326 | { 327 | if(!IsDwmSupported()) return E_NOTIMPL; 328 | ATLASSERT(m_hThumbnail != NULL); 329 | return ::DwmQueryThumbnailSourceSize(m_hThumbnail, pSize); 330 | } 331 | }; 332 | 333 | typedef CDwmThumbnailT CDwmThumbnail; 334 | typedef CDwmThumbnailT CDwmThumbnailHandle; 335 | 336 | 337 | #ifdef __ATLTHEME_H__ 338 | 339 | /////////////////////////////////////////////////////////////////////////////// 340 | // CAeroControlImpl - Base class for controls on Glass 341 | 342 | template 343 | class CAeroControlImpl : 344 | public CThemeImpl, 345 | public CBufferedPaintImpl, 346 | public ATL::CWindowImpl 347 | { 348 | public: 349 | typedef CThemeImpl _themeClass; 350 | typedef CBufferedPaintImpl _baseClass; 351 | typedef ATL::CWindowImpl _windowClass; 352 | 353 | CAeroControlImpl() 354 | { 355 | m_PaintParams.dwFlags = BPPF_ERASE; 356 | } 357 | 358 | static LPCWSTR GetThemeName() 359 | { 360 | #ifdef _UNICODE 361 | return TBase::GetWndClassName(); 362 | #else 363 | ATLASSERT(!_T("Return UNICODE string of window classname / theme class")); 364 | return NULL; 365 | #endif // _UNICODE 366 | } 367 | 368 | // Message map and handlers 369 | BEGIN_MSG_MAP(CAeroControlImpl) 370 | MESSAGE_HANDLER(WM_CREATE, OnCreate) 371 | MESSAGE_HANDLER(WM_ACTIVATE, OnActivate) 372 | CHAIN_MSG_MAP(_themeClass) 373 | CHAIN_MSG_MAP(_baseClass) 374 | END_MSG_MAP() 375 | 376 | LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) 377 | { 378 | T* pT = static_cast(this); 379 | pT->Init(); 380 | bHandled = FALSE; 381 | return 0; 382 | } 383 | 384 | LRESULT OnActivate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) 385 | { 386 | if(IsThemingSupported()) Invalidate(FALSE); 387 | bHandled = FALSE; 388 | return 0; 389 | } 390 | 391 | // Operations 392 | BOOL SubclassWindow(HWND hWnd) 393 | { 394 | ATLASSERT(m_hWnd == NULL); 395 | ATLASSERT(::IsWindow(hWnd)); 396 | BOOL bRet = _windowClass::SubclassWindow(hWnd); 397 | if(bRet) { 398 | T* pT = static_cast(this); 399 | pT->Init(); 400 | } 401 | return bRet; 402 | } 403 | 404 | // Implementation 405 | LRESULT DefWindowProc() 406 | { 407 | const _ATL_MSG* pMsg = m_pCurrentMsg; 408 | LRESULT lRes = 0; 409 | if(pMsg != NULL) 410 | lRes = DefWindowProc(pMsg->message, pMsg->wParam, pMsg->lParam); 411 | return lRes; 412 | } 413 | 414 | LRESULT DefWindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam) 415 | { 416 | T* pT = static_cast(this); 417 | LRESULT lRes = 0; 418 | if( ::DwmDefWindowProc(pT->m_hWnd, uMsg, wParam, lParam, &lRes) ) return lRes; 419 | return _windowClass::DefWindowProc(uMsg, wParam, lParam); 420 | } 421 | 422 | void DoBufferedPaint(HDC hDC, RECT& rcPaint) 423 | { 424 | T* pT = static_cast(this); 425 | HDC hDCPaint = NULL; 426 | RECT rcClient = { 0 }; 427 | GetClientRect(&rcClient); 428 | m_BufferedPaint.Begin(hDC, &rcClient, m_dwFormat, &m_PaintParams, &hDCPaint); 429 | ATLASSERT(hDCPaint != NULL); 430 | pT->DoAeroPaint(hDCPaint, rcClient, rcPaint); 431 | m_BufferedPaint.End(); 432 | } 433 | 434 | void DoPaint(HDC /*hdc*/, RECT& /*rcClient*/) 435 | { 436 | DefWindowProc(); 437 | } 438 | 439 | // Overridables 440 | void Init() 441 | { 442 | T* pT = static_cast(this); 443 | SetThemeClassList(pT->GetThemeName()); 444 | if(m_lpstrThemeClassList != NULL) 445 | OpenThemeData(); 446 | } 447 | 448 | void DoAeroPaint(HDC hDC, RECT& /*rcClient*/, RECT& rcPaint) 449 | { 450 | DefWindowProc(WM_PAINT, (WPARAM) hDC, 0L); 451 | m_BufferedPaint.MakeOpaque(&rcPaint); 452 | } 453 | }; 454 | 455 | #endif // __ATLTHEME_H__ 456 | 457 | 458 | }; // namespace WTL 459 | 460 | 461 | #endif // __ATLDWM_H__ 462 | -------------------------------------------------------------------------------- /tools/sLogViewer/WTL/Include/atlres.h: -------------------------------------------------------------------------------- 1 | // Windows Template Library - WTL version 8.1 2 | // Copyright (C) Microsoft Corporation. All rights reserved. 3 | // 4 | // This file is a part of the Windows Template Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) 7 | // which can be found in the file CPL.TXT at the root of this distribution. 8 | // By using this software in any fashion, you are agreeing to be bound by 9 | // the terms of this license. You must not remove this notice, or 10 | // any other, from this software. 11 | 12 | #ifndef __ATLRES_H__ 13 | #define __ATLRES_H__ 14 | 15 | #pragma once 16 | 17 | #if defined(_WIN32_WCE) && !defined(__ATLRESCE_H__) 18 | #error Use atlresCE.h instead of atlres.h for Windows CE 19 | #endif 20 | 21 | 22 | #ifdef RC_INVOKED 23 | #ifndef _INC_WINDOWS 24 | 25 | #define _INC_WINDOWS 26 | 27 | #ifndef _WIN32_WCE 28 | #define VS_VERSION_INFO 1 29 | 30 | #ifdef APSTUDIO_INVOKED 31 | #define APSTUDIO_HIDDEN_SYMBOLS // Ignore following symbols 32 | #endif // APSTUDIO_INVOKED 33 | 34 | #ifndef WINVER 35 | #define WINVER 0x0400 // default to Windows Version 4.0 36 | #endif // !WINVER 37 | 38 | #include 39 | 40 | // operation messages sent to DLGINIT 41 | #define LB_ADDSTRING (WM_USER+1) 42 | #define CB_ADDSTRING (WM_USER+3) 43 | #endif // !_WIN32_WCE 44 | 45 | #ifdef APSTUDIO_INVOKED 46 | #undef APSTUDIO_HIDDEN_SYMBOLS 47 | #endif // APSTUDIO_INVOKED 48 | 49 | #ifdef IDC_STATIC 50 | #undef IDC_STATIC 51 | #endif // IDC_STATIC 52 | #define IDC_STATIC (-1) 53 | 54 | #endif // !_INC_WINDOWS 55 | #endif // RC_INVOKED 56 | 57 | #ifdef APSTUDIO_INVOKED 58 | #define APSTUDIO_HIDDEN_SYMBOLS 59 | #endif // APSTUDIO_INVOKED 60 | 61 | /////////////////////////////////////////////////////////////////////////////// 62 | // ATL resource types 63 | 64 | #ifndef RC_INVOKED 65 | #define RT_DLGINIT MAKEINTRESOURCE(240) 66 | #define RT_TOOLBAR MAKEINTRESOURCE(241) 67 | #endif // RC_INVOKED 68 | 69 | /////////////////////////////////////////////////////////////////////////////// 70 | 71 | #ifdef APSTUDIO_INVOKED 72 | #undef APSTUDIO_HIDDEN_SYMBOLS 73 | #endif // APSTUDIO_INVOKED 74 | 75 | /////////////////////////////////////////////////////////////////////////////// 76 | // Standard window components 77 | 78 | #define ID_SEPARATOR 0 // special separator value 79 | #define ID_DEFAULT_PANE 0 // default status bar pane 80 | 81 | #ifndef RC_INVOKED // code only 82 | // standard control bars (IDW = window ID) 83 | #define ATL_IDW_TOOLBAR 0xE800 // main Toolbar for window 84 | #define ATL_IDW_STATUS_BAR 0xE801 // Status bar window 85 | #define ATL_IDW_COMMAND_BAR 0xE802 // Command bar window 86 | 87 | // parts of a frame window 88 | #define ATL_IDW_CLIENT 0xE900 89 | #define ATL_IDW_PANE_FIRST 0xE900 // first pane (256 max) 90 | #define ATL_IDW_PANE_LAST 0xE9FF 91 | #define ATL_IDW_HSCROLL_FIRST 0xEA00 // first Horz scrollbar (16 max) 92 | #define ATL_IDW_VSCROLL_FIRST 0xEA10 // first Vert scrollbar (16 max) 93 | 94 | #define ATL_IDW_SIZE_BOX 0xEA20 // size box for splitters 95 | #define ATL_IDW_PANE_SAVE 0xEA21 // to shift ATL_IDW_PANE_FIRST 96 | 97 | // bands for a rebar 98 | #define ATL_IDW_BAND_FIRST 0xEB00 99 | #define ATL_IDW_BAND_LAST 0xEBFF 100 | #endif // !RC_INVOKED 101 | 102 | /////////////////////////////////////////////////////////////////////////////// 103 | // Standard Commands 104 | 105 | // File commands 106 | #define ID_FILE_NEW 0xE100 107 | #define ID_FILE_OPEN 0xE101 108 | #define ID_FILE_CLOSE 0xE102 109 | #define ID_FILE_SAVE 0xE103 110 | #define ID_FILE_SAVE_AS 0xE104 111 | #define ID_FILE_PAGE_SETUP 0xE105 112 | #define ID_FILE_PRINT_SETUP 0xE106 113 | #define ID_FILE_PRINT 0xE107 114 | #define ID_FILE_PRINT_DIRECT 0xE108 115 | #define ID_FILE_PRINT_PREVIEW 0xE109 116 | #define ID_FILE_UPDATE 0xE10A 117 | #define ID_FILE_SAVE_COPY_AS 0xE10B 118 | #define ID_FILE_SEND_MAIL 0xE10C 119 | 120 | #define ID_FILE_MRU_FIRST 0xE110 121 | #define ID_FILE_MRU_FILE1 0xE110 // range - 16 max 122 | #define ID_FILE_MRU_FILE2 0xE111 123 | #define ID_FILE_MRU_FILE3 0xE112 124 | #define ID_FILE_MRU_FILE4 0xE113 125 | #define ID_FILE_MRU_FILE5 0xE114 126 | #define ID_FILE_MRU_FILE6 0xE115 127 | #define ID_FILE_MRU_FILE7 0xE116 128 | #define ID_FILE_MRU_FILE8 0xE117 129 | #define ID_FILE_MRU_FILE9 0xE118 130 | #define ID_FILE_MRU_FILE10 0xE119 131 | #define ID_FILE_MRU_FILE11 0xE11A 132 | #define ID_FILE_MRU_FILE12 0xE11B 133 | #define ID_FILE_MRU_FILE13 0xE11C 134 | #define ID_FILE_MRU_FILE14 0xE11D 135 | #define ID_FILE_MRU_FILE15 0xE11E 136 | #define ID_FILE_MRU_FILE16 0xE11F 137 | #define ID_FILE_MRU_LAST 0xE11F 138 | 139 | // Edit commands 140 | #define ID_EDIT_CLEAR 0xE120 141 | #define ID_EDIT_CLEAR_ALL 0xE121 142 | #define ID_EDIT_COPY 0xE122 143 | #define ID_EDIT_CUT 0xE123 144 | #define ID_EDIT_FIND 0xE124 145 | #define ID_EDIT_PASTE 0xE125 146 | #define ID_EDIT_PASTE_LINK 0xE126 147 | #define ID_EDIT_PASTE_SPECIAL 0xE127 148 | #define ID_EDIT_REPEAT 0xE128 149 | #define ID_EDIT_REPLACE 0xE129 150 | #define ID_EDIT_SELECT_ALL 0xE12A 151 | #define ID_EDIT_UNDO 0xE12B 152 | #define ID_EDIT_REDO 0xE12C 153 | 154 | // Window commands 155 | #define ID_WINDOW_NEW 0xE130 156 | #define ID_WINDOW_ARRANGE 0xE131 157 | #define ID_WINDOW_CASCADE 0xE132 158 | #define ID_WINDOW_TILE_HORZ 0xE133 159 | #define ID_WINDOW_TILE_VERT 0xE134 160 | #define ID_WINDOW_SPLIT 0xE135 161 | #ifndef RC_INVOKED // code only 162 | #define ATL_IDM_WINDOW_FIRST 0xE130 163 | #define ATL_IDM_WINDOW_LAST 0xE13F 164 | #define ATL_IDM_FIRST_MDICHILD 0xFF00 // window list starts here 165 | #define ATL_IDM_LAST_MDICHILD 0xFFFD 166 | #endif // !RC_INVOKED 167 | // TabView 168 | #define ID_WINDOW_TABFIRST 0xFF00 // = ATL_IDM_FIRST_MDICHILD 169 | #define ID_WINDOW_TABLAST 0xFFFD 170 | #define ID_WINDOW_SHOWTABLIST 0xFFFE 171 | 172 | // Help and App commands 173 | #define ID_APP_ABOUT 0xE140 174 | #define ID_APP_EXIT 0xE141 175 | #define ID_HELP_INDEX 0xE142 176 | #define ID_HELP_FINDER 0xE143 177 | #define ID_HELP_USING 0xE144 178 | #define ID_CONTEXT_HELP 0xE145 // shift-F1 179 | // special commands for processing help 180 | #define ID_HELP 0xE146 // first attempt for F1 181 | #define ID_DEFAULT_HELP 0xE147 // last attempt 182 | 183 | // Misc 184 | #define ID_NEXT_PANE 0xE150 185 | #define ID_PREV_PANE 0xE151 186 | #define ID_PANE_CLOSE 0xE152 187 | 188 | // Format 189 | #define ID_FORMAT_FONT 0xE160 190 | 191 | // Scroll 192 | #define ID_SCROLL_UP 0xE170 193 | #define ID_SCROLL_DOWN 0xE171 194 | #define ID_SCROLL_PAGE_UP 0xE172 195 | #define ID_SCROLL_PAGE_DOWN 0xE173 196 | #define ID_SCROLL_TOP 0xE174 197 | #define ID_SCROLL_BOTTOM 0xE175 198 | #define ID_SCROLL_LEFT 0xE176 199 | #define ID_SCROLL_RIGHT 0xE177 200 | #define ID_SCROLL_PAGE_LEFT 0xE178 201 | #define ID_SCROLL_PAGE_RIGHT 0xE179 202 | #define ID_SCROLL_ALL_LEFT 0xE17A 203 | #define ID_SCROLL_ALL_RIGHT 0xE17B 204 | 205 | // OLE commands 206 | #define ID_OLE_INSERT_NEW 0xE200 207 | #define ID_OLE_EDIT_LINKS 0xE201 208 | #define ID_OLE_EDIT_CONVERT 0xE202 209 | #define ID_OLE_EDIT_CHANGE_ICON 0xE203 210 | #define ID_OLE_EDIT_PROPERTIES 0xE204 211 | #define ID_OLE_VERB_FIRST 0xE210 // range - 16 max 212 | #ifndef RC_INVOKED // code only 213 | #define ID_OLE_VERB_LAST 0xE21F 214 | #endif // !RC_INVOKED 215 | 216 | // View commands (same number used as IDW used for toolbar and status bar) 217 | #define ID_VIEW_TOOLBAR 0xE800 218 | #define ID_VIEW_STATUS_BAR 0xE801 219 | #define ID_VIEW_REFRESH 0xE803 220 | #define ID_VIEW_RIBBON 0xE804 // Ribbon 221 | 222 | /////////////////////////////////////////////////////////////////////////////// 223 | // Standard control IDs 224 | 225 | #ifdef IDC_STATIC 226 | #undef IDC_STATIC 227 | #endif // IDC_STATIC 228 | #define IDC_STATIC (-1) // all static controls 229 | 230 | /////////////////////////////////////////////////////////////////////////////// 231 | // Standard string error/warnings 232 | 233 | // idle status bar message 234 | #define ATL_IDS_IDLEMESSAGE 0xE001 235 | 236 | #ifndef RC_INVOKED // code only 237 | #define ATL_IDS_SCFIRST 0xEF00 238 | #endif // !RC_INVOKED 239 | 240 | #define ATL_IDS_SCSIZE 0xEF00 241 | #define ATL_IDS_SCMOVE 0xEF01 242 | #define ATL_IDS_SCMINIMIZE 0xEF02 243 | #define ATL_IDS_SCMAXIMIZE 0xEF03 244 | #define ATL_IDS_SCNEXTWINDOW 0xEF04 245 | #define ATL_IDS_SCPREVWINDOW 0xEF05 246 | #define ATL_IDS_SCCLOSE 0xEF06 247 | #define ATL_IDS_SCRESTORE 0xEF12 248 | #define ATL_IDS_SCTASKLIST 0xEF13 249 | 250 | #define ATL_IDS_MDICHILD 0xEF1F 251 | #define ATL_IDS_MRU_FILE 0xEFDA 252 | 253 | /////////////////////////////////////////////////////////////////////////////// 254 | // Misc. control IDs 255 | 256 | // Property Sheet control id's (determined with Spy++) 257 | #define ID_APPLY_NOW 0x3021 258 | #define ID_WIZBACK 0x3023 259 | #define ID_WIZNEXT 0x3024 260 | #define ID_WIZFINISH 0x3025 261 | #define ATL_IDC_TAB_CONTROL 0x3020 262 | 263 | #endif // __ATLRES_H__ 264 | -------------------------------------------------------------------------------- /tools/sLogViewer/WTL/Include/atlresce.h: -------------------------------------------------------------------------------- 1 | // Windows Template Library - WTL version 8.1 2 | // Copyright (C) Microsoft Corporation. All rights reserved. 3 | // 4 | // This file is a part of the Windows Template Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) 7 | // which can be found in the file CPL.TXT at the root of this distribution. 8 | // By using this software in any fashion, you are agreeing to be bound by 9 | // the terms of this license. You must not remove this notice, or 10 | // any other, from this software. 11 | 12 | #ifndef __ATLRESCE_H__ 13 | #define __ATLRESCE_H__ 14 | 15 | #pragma once 16 | 17 | #ifndef _WIN32_WCE 18 | #error atlresCE.h is only for Windows CE 19 | #endif 20 | 21 | 22 | #ifdef RC_INVOKED 23 | #ifndef _INC_WINDOWS 24 | 25 | #define VS_VERSION_INFO 1 26 | 27 | #ifdef APSTUDIO_INVOKED 28 | #define APSTUDIO_HIDDEN_SYMBOLS // Ignore following symbols 29 | #endif // APSTUDIO_INVOKED 30 | 31 | #ifndef WINVER 32 | #define WINVER 0x0400 // default to Windows Version 4.0 33 | #endif // !WINVER 34 | 35 | #if !defined(WCEOLE_ENABLE_DIALOGEX) 36 | #define DIALOGEX DIALOG DISCARDABLE 37 | #endif 38 | 39 | #include 40 | #define SHMENUBAR RCDATA 41 | 42 | #if defined(SHELLSDK_MODULES_AYGSHELL) 43 | #include 44 | #else 45 | #define NOMENU 0xFFFF 46 | #define IDS_SHNEW 1 47 | #define IDM_SHAREDNEW 10 48 | #define IDM_SHAREDNEWDEFAULT 11 49 | #endif 50 | #ifndef I_IMAGENONE 51 | #define I_IMAGENONE (-2) 52 | #endif 53 | 54 | #include 55 | 56 | #endif // !_INC_WINDOWS 57 | #endif // RC_INVOKED 58 | 59 | #include "atlres.h" 60 | 61 | #ifdef APSTUDIO_INVOKED 62 | #undef APSTUDIO_HIDDEN_SYMBOLS 63 | #endif // APSTUDIO_INVOKED 64 | 65 | // Visual Studio dialog editor bug fix 66 | #ifndef DS_FIXEDSYS 67 | #define DS_FIXEDSYS 0 68 | #endif 69 | 70 | #define IDC_INFOSTATIC 0xFFFE // == IDC_STATIC -1 71 | 72 | /////////////////////////////////////////////////////////////////////////////// 73 | // Smartphone and PPC 2005 Resource IDs 74 | 75 | // Command and associated string resource IDs 76 | #define ID_MENU_OK 0xE790 77 | #define ID_MENU_CANCEL 0xE791 78 | #define ID_MENU 0xE792 79 | #define ID_ACTION 0xE793 80 | #define ID_VIEW_FULLSCREEN 0xE802 81 | 82 | // MenuBar resource IDs 83 | #define ATL_IDM_MENU_DONE 0xE701 84 | #define ATL_IDM_MENU_CANCEL 0xE702 85 | #define ATL_IDM_MENU_DONECANCEL 0xE703 86 | 87 | // Default device MenuBar control ID and MenuBar resource ID 88 | #define ATL_IDW_MENU_BAR 0xE802 89 | 90 | // SmartPhone spinned controls ID offset for CSpinCtrl 91 | #define ATL_IDW_SPIN_ID 9999 92 | 93 | #endif // __ATLRESCE_H__ 94 | -------------------------------------------------------------------------------- /tools/sLogViewer/WTL/Include/atlwinx.h: -------------------------------------------------------------------------------- 1 | // Windows Template Library - WTL version 8.1 2 | // Copyright (C) Microsoft Corporation. All rights reserved. 3 | // 4 | // This file is a part of the Windows Template Library. 5 | // The use and distribution terms for this software are covered by the 6 | // Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) 7 | // which can be found in the file CPL.TXT at the root of this distribution. 8 | // By using this software in any fashion, you are agreeing to be bound by 9 | // the terms of this license. You must not remove this notice, or 10 | // any other, from this software. 11 | 12 | #ifndef __ATLWINX_H__ 13 | #define __ATLWINX_H__ 14 | 15 | #pragma once 16 | 17 | #ifndef __ATLAPP_H__ 18 | #error atlwinx.h requires atlapp.h to be included first 19 | #endif 20 | 21 | #if (_ATL_VER >= 0x0700) 22 | #include 23 | #endif // (_ATL_VER >= 0x0700) 24 | 25 | 26 | /////////////////////////////////////////////////////////////////////////////// 27 | // Classes in this file: 28 | // 29 | // _U_RECT 30 | // _U_MENUorID 31 | // _U_STRINGorID 32 | 33 | 34 | /////////////////////////////////////////////////////////////////////////////// 35 | // Command Chaining Macros 36 | 37 | #define CHAIN_COMMANDS(theChainClass) \ 38 | if(uMsg == WM_COMMAND) \ 39 | CHAIN_MSG_MAP(theChainClass) 40 | 41 | #define CHAIN_COMMANDS_ALT(theChainClass, msgMapID) \ 42 | if(uMsg == WM_COMMAND) \ 43 | CHAIN_MSG_MAP_ALT(theChainClass, msgMapID) 44 | 45 | #define CHAIN_COMMANDS_MEMBER(theChainMember) \ 46 | if(uMsg == WM_COMMAND) \ 47 | CHAIN_MSG_MAP_MEMBER(theChainMember) 48 | 49 | #define CHAIN_COMMANDS_ALT_MEMBER(theChainMember, msgMapID) \ 50 | if(uMsg == WM_COMMAND) \ 51 | CHAIN_MSG_MAP_ALT_MEMBER(theChainMember, msgMapID) 52 | 53 | 54 | /////////////////////////////////////////////////////////////////////////////// 55 | // Macros for parent message map to selectively reflect control messages 56 | 57 | // NOTE: ReflectNotifications is a member of ATL's CWindowImplRoot 58 | // (and overridden in 2 cases - CContainedWindowT and CAxHostWindow) 59 | // Since we can't modify ATL, we'll provide the needed additions 60 | // in a separate function (that is not a member of CWindowImplRoot) 61 | 62 | namespace WTL 63 | { 64 | 65 | inline LRESULT WtlReflectNotificationsFiltered(HWND hWndParent, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled, 66 | UINT uMsgFilter = WM_NULL, UINT_PTR idFromFilter = 0, HWND hWndChildFilter = NULL) 67 | { 68 | if((uMsgFilter != WM_NULL) && (uMsgFilter != uMsg)) 69 | { 70 | // The notification message doesn't match the filter. 71 | bHandled = FALSE; 72 | return 1; 73 | } 74 | 75 | HWND hWndChild = NULL; 76 | UINT_PTR idFrom = 0; 77 | 78 | switch(uMsg) 79 | { 80 | case WM_COMMAND: 81 | if(lParam != NULL) // not from a menu 82 | { 83 | hWndChild = (HWND)lParam; 84 | idFrom = (UINT_PTR)LOWORD(wParam); 85 | } 86 | break; 87 | case WM_NOTIFY: 88 | hWndChild = ((LPNMHDR)lParam)->hwndFrom; 89 | idFrom = ((LPNMHDR)lParam)->idFrom; 90 | break; 91 | #ifndef _WIN32_WCE 92 | case WM_PARENTNOTIFY: 93 | switch(LOWORD(wParam)) 94 | { 95 | case WM_CREATE: 96 | case WM_DESTROY: 97 | hWndChild = (HWND)lParam; 98 | idFrom = (UINT_PTR)HIWORD(wParam); 99 | break; 100 | default: 101 | hWndChild = ::GetDlgItem(hWndParent, HIWORD(wParam)); 102 | idFrom = (UINT_PTR)::GetDlgCtrlID(hWndChild); 103 | break; 104 | } 105 | break; 106 | #endif // !_WIN32_WCE 107 | case WM_DRAWITEM: 108 | if(wParam) // not from a menu 109 | { 110 | hWndChild = ((LPDRAWITEMSTRUCT)lParam)->hwndItem; 111 | idFrom = (UINT_PTR)wParam; 112 | } 113 | break; 114 | case WM_MEASUREITEM: 115 | if(wParam) // not from a menu 116 | { 117 | hWndChild = ::GetDlgItem(hWndParent, ((LPMEASUREITEMSTRUCT)lParam)->CtlID); 118 | idFrom = (UINT_PTR)wParam; 119 | } 120 | break; 121 | case WM_COMPAREITEM: 122 | if(wParam) // not from a menu 123 | { 124 | hWndChild = ((LPCOMPAREITEMSTRUCT)lParam)->hwndItem; 125 | idFrom = (UINT_PTR)wParam; 126 | } 127 | break; 128 | case WM_DELETEITEM: 129 | if(wParam) // not from a menu 130 | { 131 | hWndChild = ((LPDELETEITEMSTRUCT)lParam)->hwndItem; 132 | idFrom = (UINT_PTR)wParam; 133 | } 134 | break; 135 | case WM_VKEYTOITEM: 136 | case WM_CHARTOITEM: 137 | case WM_HSCROLL: 138 | case WM_VSCROLL: 139 | hWndChild = (HWND)lParam; 140 | idFrom = (UINT_PTR)::GetDlgCtrlID(hWndChild); 141 | break; 142 | case WM_CTLCOLORBTN: 143 | case WM_CTLCOLORDLG: 144 | case WM_CTLCOLOREDIT: 145 | case WM_CTLCOLORLISTBOX: 146 | case WM_CTLCOLORMSGBOX: 147 | case WM_CTLCOLORSCROLLBAR: 148 | case WM_CTLCOLORSTATIC: 149 | hWndChild = (HWND)lParam; 150 | idFrom = (UINT_PTR)::GetDlgCtrlID(hWndChild); 151 | break; 152 | default: 153 | break; 154 | } 155 | 156 | if((hWndChild == NULL) || 157 | ((hWndChildFilter != NULL) && (hWndChildFilter != hWndChild))) 158 | { 159 | // Either hWndChild isn't valid, or 160 | // hWndChild doesn't match the filter. 161 | bHandled = FALSE; 162 | return 1; 163 | } 164 | 165 | if((idFromFilter != 0) && (idFromFilter != idFrom)) 166 | { 167 | // The dialog control id doesn't match the filter. 168 | bHandled = FALSE; 169 | return 1; 170 | } 171 | 172 | ATLASSERT(::IsWindow(hWndChild)); 173 | LRESULT lResult = ::SendMessage(hWndChild, OCM__BASE + uMsg, wParam, lParam); 174 | if((lResult == 0) && (uMsg >= WM_CTLCOLORMSGBOX) && (uMsg <= WM_CTLCOLORSTATIC)) 175 | { 176 | // Try to prevent problems with WM_CTLCOLOR* messages when 177 | // the message wasn't really handled 178 | bHandled = FALSE; 179 | } 180 | 181 | return lResult; 182 | } 183 | 184 | }; // namespace WTL 185 | 186 | // Try to prevent problems with WM_CTLCOLOR* messages when 187 | // the message wasn't really handled 188 | #define REFLECT_NOTIFICATIONS_EX() \ 189 | { \ 190 | bHandled = TRUE; \ 191 | lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ 192 | if((lResult == 0) && (uMsg >= WM_CTLCOLORMSGBOX) && (uMsg <= WM_CTLCOLORSTATIC)) \ 193 | bHandled = FALSE; \ 194 | if(bHandled) \ 195 | return TRUE; \ 196 | } 197 | 198 | #define REFLECT_NOTIFICATIONS_MSG_FILTERED(uMsgFilter) \ 199 | { \ 200 | bHandled = TRUE; \ 201 | lResult = WTL::WtlReflectNotificationsFiltered(m_hWnd, uMsg, wParam, lParam, bHandled, uMsgFilter, 0, NULL); \ 202 | if(bHandled) \ 203 | return TRUE; \ 204 | } 205 | 206 | #define REFLECT_NOTIFICATIONS_ID_FILTERED(idFromFilter) \ 207 | { \ 208 | bHandled = TRUE; \ 209 | lResult = WTL::WtlReflectNotificationsFiltered(m_hWnd, uMsg, wParam, lParam, bHandled, WM_NULL, idFromFilter, NULL); \ 210 | if(bHandled) \ 211 | return TRUE; \ 212 | } 213 | 214 | #define REFLECT_NOTIFICATIONS_HWND_FILTERED(hWndChildFilter) \ 215 | { \ 216 | bHandled = TRUE; \ 217 | lResult = WTL::WtlReflectNotificationsFiltered(m_hWnd, uMsg, wParam, lParam, bHandled, WM_NULL, 0, hWndChildFilter); \ 218 | if(bHandled) \ 219 | return TRUE; \ 220 | } 221 | 222 | #define REFLECT_NOTIFICATIONS_MSG_ID_FILTERED(uMsgFilter, idFromFilter) \ 223 | { \ 224 | bHandled = TRUE; \ 225 | lResult = WTL::WtlReflectNotificationsFiltered(m_hWnd, uMsg, wParam, lParam, bHandled, uMsgFilter, idFromFilter, NULL); \ 226 | if(bHandled) \ 227 | return TRUE; \ 228 | } 229 | 230 | #define REFLECT_NOTIFICATIONS_MSG_HWND_FILTERED(uMsgFilter, hWndChildFilter) \ 231 | { \ 232 | bHandled = TRUE; \ 233 | lResult = WTL::WtlReflectNotificationsFiltered(m_hWnd, uMsg, wParam, lParam, bHandled, uMsgFilter, 0, hWndChildFilter); \ 234 | if(bHandled) \ 235 | return TRUE; \ 236 | } 237 | 238 | #define REFLECT_COMMAND(id, code) \ 239 | if(uMsg == WM_COMMAND && id == LOWORD(wParam) && code == HIWORD(wParam)) \ 240 | { \ 241 | bHandled = TRUE; \ 242 | lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ 243 | if(bHandled) \ 244 | return TRUE; \ 245 | } 246 | 247 | #define REFLECT_COMMAND_ID(id) \ 248 | if(uMsg == WM_COMMAND && id == LOWORD(wParam)) \ 249 | { \ 250 | bHandled = TRUE; \ 251 | lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ 252 | if(bHandled) \ 253 | return TRUE; \ 254 | } 255 | 256 | #define REFLECT_COMMAND_CODE(code) \ 257 | if(uMsg == WM_COMMAND && code == HIWORD(wParam)) \ 258 | { \ 259 | bHandled = TRUE; \ 260 | lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ 261 | if(bHandled) \ 262 | return TRUE; \ 263 | } 264 | 265 | #define REFLECT_COMMAND_RANGE(idFirst, idLast) \ 266 | if(uMsg == WM_COMMAND && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \ 267 | { \ 268 | bHandled = TRUE; \ 269 | lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ 270 | if(bHandled) \ 271 | return TRUE; \ 272 | } 273 | 274 | #define REFLECT_COMMAND_RANGE_CODE(idFirst, idLast, code) \ 275 | if(uMsg == WM_COMMAND && code == HIWORD(wParam) && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \ 276 | { \ 277 | bHandled = TRUE; \ 278 | lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ 279 | if(bHandled) \ 280 | return TRUE; \ 281 | } 282 | 283 | #define REFLECT_NOTIFY(id, cd) \ 284 | if(uMsg == WM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom && cd == ((LPNMHDR)lParam)->code) \ 285 | { \ 286 | bHandled = TRUE; \ 287 | lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ 288 | if(bHandled) \ 289 | return TRUE; \ 290 | } 291 | 292 | #define REFLECT_NOTIFY_ID(id) \ 293 | if(uMsg == WM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom) \ 294 | { \ 295 | bHandled = TRUE; \ 296 | lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ 297 | if(bHandled) \ 298 | return TRUE; \ 299 | } 300 | 301 | #define REFLECT_NOTIFY_CODE(cd) \ 302 | if(uMsg == WM_NOTIFY && cd == ((LPNMHDR)lParam)->code) \ 303 | { \ 304 | bHandled = TRUE; \ 305 | lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ 306 | if(bHandled) \ 307 | return TRUE; \ 308 | } 309 | 310 | #define REFLECT_NOTIFY_RANGE(idFirst, idLast) \ 311 | if(uMsg == WM_NOTIFY && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \ 312 | { \ 313 | bHandled = TRUE; \ 314 | lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ 315 | if(bHandled) \ 316 | return TRUE; \ 317 | } 318 | 319 | #define REFLECT_NOTIFY_RANGE_CODE(idFirst, idLast, cd) \ 320 | if(uMsg == WM_NOTIFY && cd == ((LPNMHDR)lParam)->code && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \ 321 | { \ 322 | bHandled = TRUE; \ 323 | lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled); \ 324 | if(bHandled) \ 325 | return TRUE; \ 326 | } 327 | 328 | 329 | /////////////////////////////////////////////////////////////////////////////// 330 | // Reflected message handler macros for message maps (for ATL 3.0) 331 | 332 | #if (_ATL_VER < 0x0700) 333 | 334 | #define REFLECTED_COMMAND_HANDLER(id, code, func) \ 335 | if(uMsg == OCM_COMMAND && id == LOWORD(wParam) && code == HIWORD(wParam)) \ 336 | { \ 337 | bHandled = TRUE; \ 338 | lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \ 339 | if(bHandled) \ 340 | return TRUE; \ 341 | } 342 | 343 | #define REFLECTED_COMMAND_ID_HANDLER(id, func) \ 344 | if(uMsg == OCM_COMMAND && id == LOWORD(wParam)) \ 345 | { \ 346 | bHandled = TRUE; \ 347 | lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \ 348 | if(bHandled) \ 349 | return TRUE; \ 350 | } 351 | 352 | #define REFLECTED_COMMAND_CODE_HANDLER(code, func) \ 353 | if(uMsg == OCM_COMMAND && code == HIWORD(wParam)) \ 354 | { \ 355 | bHandled = TRUE; \ 356 | lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \ 357 | if(bHandled) \ 358 | return TRUE; \ 359 | } 360 | 361 | #define REFLECTED_COMMAND_RANGE_HANDLER(idFirst, idLast, func) \ 362 | if(uMsg == OCM_COMMAND && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \ 363 | { \ 364 | bHandled = TRUE; \ 365 | lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \ 366 | if(bHandled) \ 367 | return TRUE; \ 368 | } 369 | 370 | #define REFLECTED_COMMAND_RANGE_CODE_HANDLER(idFirst, idLast, code, func) \ 371 | if(uMsg == OCM_COMMAND && code == HIWORD(wParam) && LOWORD(wParam) >= idFirst && LOWORD(wParam) <= idLast) \ 372 | { \ 373 | bHandled = TRUE; \ 374 | lResult = func(HIWORD(wParam), LOWORD(wParam), (HWND)lParam, bHandled); \ 375 | if(bHandled) \ 376 | return TRUE; \ 377 | } 378 | 379 | #define REFLECTED_NOTIFY_HANDLER(id, cd, func) \ 380 | if(uMsg == OCM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom && cd == ((LPNMHDR)lParam)->code) \ 381 | { \ 382 | bHandled = TRUE; \ 383 | lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \ 384 | if(bHandled) \ 385 | return TRUE; \ 386 | } 387 | 388 | #define REFLECTED_NOTIFY_ID_HANDLER(id, func) \ 389 | if(uMsg == OCM_NOTIFY && id == ((LPNMHDR)lParam)->idFrom) \ 390 | { \ 391 | bHandled = TRUE; \ 392 | lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \ 393 | if(bHandled) \ 394 | return TRUE; \ 395 | } 396 | 397 | #define REFLECTED_NOTIFY_CODE_HANDLER(cd, func) \ 398 | if(uMsg == OCM_NOTIFY && cd == ((LPNMHDR)lParam)->code) \ 399 | { \ 400 | bHandled = TRUE; \ 401 | lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \ 402 | if(bHandled) \ 403 | return TRUE; \ 404 | } 405 | 406 | #define REFLECTED_NOTIFY_RANGE_HANDLER(idFirst, idLast, func) \ 407 | if(uMsg == OCM_NOTIFY && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \ 408 | { \ 409 | bHandled = TRUE; \ 410 | lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \ 411 | if(bHandled) \ 412 | return TRUE; \ 413 | } 414 | 415 | #define REFLECTED_NOTIFY_RANGE_CODE_HANDLER(idFirst, idLast, cd, func) \ 416 | if(uMsg == OCM_NOTIFY && cd == ((LPNMHDR)lParam)->code && ((LPNMHDR)lParam)->idFrom >= idFirst && ((LPNMHDR)lParam)->idFrom <= idLast) \ 417 | { \ 418 | bHandled = TRUE; \ 419 | lResult = func((int)wParam, (LPNMHDR)lParam, bHandled); \ 420 | if(bHandled) \ 421 | return TRUE; \ 422 | } 423 | 424 | #endif // (_ATL_VER < 0x0700) 425 | 426 | 427 | /////////////////////////////////////////////////////////////////////////////// 428 | // Dual argument helper classes (for ATL 3.0) 429 | 430 | #if (_ATL_VER < 0x0700) 431 | 432 | namespace ATL 433 | { 434 | 435 | class _U_RECT 436 | { 437 | public: 438 | _U_RECT(LPRECT lpRect) : m_lpRect(lpRect) 439 | { } 440 | _U_RECT(RECT& rc) : m_lpRect(&rc) 441 | { } 442 | LPRECT m_lpRect; 443 | }; 444 | 445 | class _U_MENUorID 446 | { 447 | public: 448 | _U_MENUorID(HMENU hMenu) : m_hMenu(hMenu) 449 | { } 450 | _U_MENUorID(UINT nID) : m_hMenu((HMENU)LongToHandle(nID)) 451 | { } 452 | HMENU m_hMenu; 453 | }; 454 | 455 | class _U_STRINGorID 456 | { 457 | public: 458 | _U_STRINGorID(LPCTSTR lpString) : m_lpstr(lpString) 459 | { } 460 | _U_STRINGorID(UINT nID) : m_lpstr(MAKEINTRESOURCE(nID)) 461 | { } 462 | LPCTSTR m_lpstr; 463 | }; 464 | 465 | }; // namespace ATL 466 | 467 | #endif // (_ATL_VER < 0x0700) 468 | 469 | 470 | namespace WTL 471 | { 472 | 473 | /////////////////////////////////////////////////////////////////////////////// 474 | // Forward notifications support for message maps (for ATL 3.0) 475 | 476 | #if (_ATL_VER < 0x0700) 477 | 478 | // forward notifications support 479 | #define FORWARD_NOTIFICATIONS() \ 480 | { \ 481 | bHandled = TRUE; \ 482 | lResult = WTL::Atl3ForwardNotifications(m_hWnd, uMsg, wParam, lParam, bHandled); \ 483 | if(bHandled) \ 484 | return TRUE; \ 485 | } 486 | 487 | static LRESULT Atl3ForwardNotifications(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) 488 | { 489 | LRESULT lResult = 0; 490 | switch(uMsg) 491 | { 492 | case WM_COMMAND: 493 | case WM_NOTIFY: 494 | #ifndef _WIN32_WCE 495 | case WM_PARENTNOTIFY: 496 | #endif // !_WIN32_WCE 497 | case WM_DRAWITEM: 498 | case WM_MEASUREITEM: 499 | case WM_COMPAREITEM: 500 | case WM_DELETEITEM: 501 | case WM_VKEYTOITEM: 502 | case WM_CHARTOITEM: 503 | case WM_HSCROLL: 504 | case WM_VSCROLL: 505 | case WM_CTLCOLORBTN: 506 | case WM_CTLCOLORDLG: 507 | case WM_CTLCOLOREDIT: 508 | case WM_CTLCOLORLISTBOX: 509 | case WM_CTLCOLORMSGBOX: 510 | case WM_CTLCOLORSCROLLBAR: 511 | case WM_CTLCOLORSTATIC: 512 | lResult = ::SendMessage(::GetParent(hWnd), uMsg, wParam, lParam); 513 | break; 514 | default: 515 | bHandled = FALSE; 516 | break; 517 | } 518 | return lResult; 519 | } 520 | 521 | #endif // (_ATL_VER < 0x0700) 522 | 523 | }; // namespace WTL 524 | 525 | #endif // __ATLWINX_H__ 526 | -------------------------------------------------------------------------------- /tools/sLogViewer/res/SLogViewer.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tishion/sLogger/23dbafd16ef8aae37526e6d53156f554f0e2142f/tools/sLogViewer/res/SLogViewer.ico -------------------------------------------------------------------------------- /tools/sLogViewer/res/Toolbar.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tishion/sLogger/23dbafd16ef8aae37526e6d53156f554f0e2142f/tools/sLogViewer/res/Toolbar.bmp -------------------------------------------------------------------------------- /tools/sLogViewer/res/toolbar_res.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tishion/sLogger/23dbafd16ef8aae37526e6d53156f554f0e2142f/tools/sLogViewer/res/toolbar_res.bmp -------------------------------------------------------------------------------- /tools/sLogViewer/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by SLogViewer.rc 4 | // 5 | #define IMAGE_INDEX_OPEN 0 6 | #define IMAGE_INDEX_CLOSE 1 7 | #define IMAGE_INDEX_ENABLE_CAPTURE 2 8 | #define IMAGE_INDEX_DISABLE_CAPTURE 3 9 | #define IMAGE_INDEX_ENABLE_AUTOSCROLL 4 10 | #define IMAGE_INDEX_DISABLE_AUTOSCROLL 5 11 | #define IMAGE_INDEX_CLEAR 6 12 | #define IMAGE_INDEX_FILTER 7 13 | #define IDD_ABOUTBOX 100 14 | #define IDR_MAINFRAME 128 15 | #define IDB_TOOBARIMAGELIST 206 16 | #define IDD_DIALOGFILTERRULE 207 17 | #define IDC_COMBO_ITEM 1000 18 | #define IDC_COMBO_COMPARE 1001 19 | #define IDC_EDIT_VALUE 1002 20 | #define IDC_LIST_RULES 1003 21 | #define IDC_COMBO_CATEGORY 1004 22 | #define IDC_BUTTON_APPLY 1005 23 | #define IDC_BUTTON_CLEAR 1006 24 | #define IDC_BUTTON_DEL 1007 25 | #define IDC_BUTTON_ADD 1008 26 | #define ID_CAPTURE_CLEAR 32779 27 | #define ID_CAPTURE_CAPTURE 32780 28 | #define ID_CAPTURE_AUTOSCROLL 32781 29 | #define ID_CAPTURE_FILTER 32782 30 | 31 | // Next default values for new objects 32 | // 33 | #ifdef APSTUDIO_INVOKED 34 | #ifndef APSTUDIO_READONLY_SYMBOLS 35 | #define _APS_NEXT_RESOURCE_VALUE 209 36 | #define _APS_NEXT_COMMAND_VALUE 32788 37 | #define _APS_NEXT_CONTROL_VALUE 1004 38 | #define _APS_NEXT_SYMED_VALUE 101 39 | #endif 40 | #endif 41 | -------------------------------------------------------------------------------- /tools/sLogViewer/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // SLogViewer.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | #if (_ATL_VER < 0x0700) 8 | #include 9 | #endif //(_ATL_VER < 0x0700) 10 | -------------------------------------------------------------------------------- /tools/sLogViewer/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | // Change these values to use different versions 9 | #define WINVER 0x0500 10 | #define _WIN32_WINNT 0x0501 11 | #define _WIN32_IE 0x0501 12 | #define _RICHEDIT_VER 0x0500 13 | 14 | #pragma warning (disable: 4091 4302 4838 4996) 15 | 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include "resource.h" 21 | #include "Message/SLoggerMessage.h" 22 | 23 | #define SLV_MAIN_WNDCLS_NAME _T("SLV_MAIN_WNDCLS_{aad382db-9c46-4f1e-8e2c-a7d573c9e587}") 24 | 25 | #define SLVM_NEW_LOGMSGOBJ (WM_USER+0x100) 26 | 27 | #define SLVM_APPLY_FILTER_RULES (WM_USER+0x101) 28 | 29 | #if defined _M_IX86 30 | #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") 31 | #elif defined _M_IA64 32 | #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"") 33 | #elif defined _M_X64 34 | #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"") 35 | #else 36 | #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") 37 | #endif 38 | 39 | extern CAppModule _Module; 40 | --------------------------------------------------------------------------------