├── .gitignore
├── LICENSE
├── README.md
├── SysBase
├── SysBase.sln
└── SysBase
│ ├── SysBase.vcxproj
│ ├── SysBase.vcxproj.filters
│ ├── SysBase.vcxproj.user
│ ├── SysBase_Interface.h
│ ├── include
│ ├── AutoPtr.h
│ ├── Buffer.h
│ ├── BufferPool.h
│ ├── BufferQueue.h
│ ├── CMD5.h
│ ├── CSHA1.h
│ ├── Config.h
│ ├── DataWarpper.h
│ ├── DateTime.h
│ ├── Directory.h
│ ├── Dump.h
│ ├── FastFileCache.h
│ ├── FastFileQueue.h
│ ├── File.h
│ ├── FileBase.h
│ ├── FileMonitorWorker.h
│ ├── HMAC_SHA1.h
│ ├── HW_CPU.h
│ ├── HW_Disk.h
│ ├── HW_EthernetAdapter.h
│ ├── HW_Memory.h
│ ├── HW_Volume.h
│ ├── Log.h
│ ├── MsgWaitPool.h
│ ├── PerformanceCounter.h
│ ├── Process.h
│ ├── ProcessHelper.h
│ ├── ProcessInfo.h
│ ├── Service.h
│ ├── ServicesHelper.h
│ ├── SingleMgr.h
│ ├── SlowFileQueue.h
│ ├── SlowReadFileQueue.h
│ ├── SlowWriteFileQueue.h
│ ├── Socket.h
│ ├── SocketCommon.h
│ ├── SocketLoader.h
│ ├── SqlServerHelper.h
│ ├── StatisticsWorker.h
│ ├── SysBase.h
│ ├── SysEventLog.h
│ ├── SysUser.h
│ ├── SysUserGroup.h
│ ├── SystemInfo.h
│ ├── SystemNetInfo.h
│ ├── SystemPerformanceCollecter.h
│ ├── SystemPerformanceInfo.h
│ ├── SystemShutdown.h
│ ├── SystemTime.h
│ ├── TcpClient.h
│ ├── TcpMultiClient.h
│ ├── TcpServer.h
│ ├── TcpSocket.h
│ ├── Template.h
│ ├── Thread.h
│ ├── ThreadSync.h
│ ├── Utility.h
│ ├── WAdvancedFirewall.h
│ ├── WUpdateAgent.h
│ └── base64.h
│ └── source
│ ├── Buffer.cpp
│ ├── BufferPool.cpp
│ ├── BufferQueue.cpp
│ ├── CMD5.cpp
│ ├── CSHA1.cpp
│ ├── Config.cpp
│ ├── DataWarpper.cpp
│ ├── DateTime.cpp
│ ├── Directory.cpp
│ ├── Dump.cpp
│ ├── FastFileCache.cpp
│ ├── FastFileQueue.cpp
│ ├── File.cpp
│ ├── FileBase.cpp
│ ├── FileMonitorWorker.cpp
│ ├── HMAC_SHA1.cpp
│ ├── HW_CPU.cpp
│ ├── HW_Disk.cpp
│ ├── HW_EthernetAdapter.cpp
│ ├── HW_Memory.cpp
│ ├── HW_Volume.cpp
│ ├── Log.cpp
│ ├── MsgWaitPool.cpp
│ ├── NTService.cpp
│ ├── NTService.h
│ ├── PerformanceCounter.cpp
│ ├── Process.cpp
│ ├── ProcessHelper.cpp
│ ├── Service.cpp
│ ├── ServicesHelper.cpp
│ ├── SingleMgr.cpp
│ ├── SlowFileQueue.cpp
│ ├── SlowReadFileQueue.cpp
│ ├── SlowWriteFileQueue.cpp
│ ├── Socket.cpp
│ ├── SocketLoader.cpp
│ ├── SqlServerHelper.cpp
│ ├── StatisticsWorker.cpp
│ ├── SysEventLog.cpp
│ ├── SysUser.cpp
│ ├── SysUserGroup.cpp
│ ├── SystemInfo.cpp
│ ├── SystemNetInfo.cpp
│ ├── SystemPerformanceCollecter.cpp
│ ├── SystemShutdown.cpp
│ ├── SystemTime.cpp
│ ├── TcpClient.cpp
│ ├── TcpMultiClient.cpp
│ ├── TcpServer.cpp
│ ├── TcpSocket.cpp
│ ├── Thread.cpp
│ ├── ThreadSync.cpp
│ ├── Utility.cpp
│ ├── WAdvancedFirewall.cpp
│ ├── WUpdateAgent.cpp
│ └── base64.cpp
├── demo
├── DemoServer
│ ├── DemoServer.sln
│ ├── DemoServer
│ │ ├── Config
│ │ │ └── system.ini
│ │ ├── DS_AppService.cpp
│ │ ├── DS_AppService.h
│ │ ├── DS_Common.h
│ │ ├── DS_Config.cpp
│ │ ├── DS_Config.h
│ │ ├── DS_ConfigMoniter.cpp
│ │ ├── DS_ConfigMoniter.h
│ │ ├── DS_ContentHandler.cpp
│ │ ├── DS_ContentHandler.h
│ │ ├── DS_ContentHandler_BL.cpp
│ │ ├── DS_Log.cpp
│ │ ├── DS_Log.h
│ │ ├── DS_NetServer.cpp
│ │ ├── DS_NetServer.h
│ │ ├── DS_Protocol_Common.h
│ │ ├── DS_ReloadThread.cpp
│ │ ├── DS_ReloadThread.h
│ │ ├── DS_StatisticsThread.cpp
│ │ ├── DS_StatisticsThread.h
│ │ ├── DS_WorkThread.cpp
│ │ ├── DS_WorkThread.h
│ │ ├── DemoServer.vcxproj
│ │ ├── DemoServer.vcxproj.filters
│ │ ├── DemoServer.vcxproj.user
│ │ └── main.cpp
│ └── bin
│ │ ├── Config
│ │ └── system.ini
│ │ └── DemoServer_d.bat
└── README.md
└── example
├── MiniPerformanceCounter
├── MiniPerformanceCounter.sln
└── MiniPerformanceCounter
│ ├── MiniPerformanceCounter.aps
│ ├── MiniPerformanceCounter.cpp
│ ├── MiniPerformanceCounter.h
│ ├── MiniPerformanceCounter.rc
│ ├── MiniPerformanceCounter.vcxproj
│ ├── MiniPerformanceCounter.vcxproj.filters
│ ├── MiniPerformanceCounter.vcxproj.user
│ ├── MiniPerformanceCounterDlg.cpp
│ ├── MiniPerformanceCounterDlg.h
│ ├── ReadMe.txt
│ ├── res
│ ├── MiniPerformanceCounter.ico
│ └── MiniPerformanceCounter.rc2
│ ├── resource.h
│ ├── stdafx.cpp
│ ├── stdafx.h
│ └── targetver.h
├── README.md
├── SystemMoniter
├── SystemMoniter.sln
└── SystemMoniter
│ ├── ReadMe.txt
│ ├── SystemMoniter.aps
│ ├── SystemMoniter.cpp
│ ├── SystemMoniter.h
│ ├── SystemMoniter.rc
│ ├── SystemMoniter.vcxproj
│ ├── SystemMoniter.vcxproj.filters
│ ├── SystemMoniter.vcxproj.user
│ ├── SystemMoniterDlg.cpp
│ ├── SystemMoniterDlg.h
│ ├── res
│ ├── SystemMoniter.ico
│ └── SystemMoniter.rc2
│ ├── resource.h
│ ├── stdafx.cpp
│ ├── stdafx.h
│ └── targetver.h
├── testClient
├── SnmpThread.cpp
├── SnmpThread.h
├── TestMainApp.cpp
├── common.h
├── testClient.sln
├── testClient.vcxproj
└── testClient.vcxproj.filters
└── testServer
├── SnmpThread.cpp
├── SnmpThread.h
├── TestMainApp.cpp
├── common.h
├── testServer.sln
├── testServer.vcxproj
└── testServer.vcxproj.filters
/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled Object files
2 | *.slo
3 | *.lo
4 | *.o
5 | *.obj
6 | *.tlog
7 | *.log
8 | *.pdb
9 | *.idb
10 | *.db
11 | *.suo
12 |
13 | # Precompiled Headers
14 | *.gch
15 | *.pch
16 |
17 | # Compiled Dynamic libraries
18 | *.so
19 | *.dylib
20 | *.dll
21 |
22 | # Fortran module files
23 | *.mod
24 | *.smod
25 |
26 | # Compiled Static libraries
27 | *.lai
28 | *.la
29 | *.a
30 | *.lib
31 |
32 | # Executables
33 | *.exe
34 | *.out
35 | *.app
36 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2016 yejiansnake
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 | # windows-sys-base
2 | windows 系统API C++封装库,包含进程间通讯,互斥,内存队列等通用功能
3 | ## 使用说明
4 | - 打开 SysBase/SysBase.sln,建议使用 Visual Studio 2012/2015 版本。
5 | - 直接编译,在批量编译选项中已经设置好了四种模式(DEBUG 32:64, RELEASE 32:64)。
6 | - 64位应用程序需要在X64平台的编译选项中的预处理器定义中加上 X64 宏。
7 | - 目标程序将编译后的lib放到指定位置后,在引用文件加入如下内容:
8 | ```c++
9 | #include "../SysBase/SysBase_Interface.h"
10 |
11 | using namespace SysBase;
12 |
13 | #ifdef _DEBUG
14 | #ifdef X64
15 | #pragma comment(lib, "../SysBase/lib/SysBase_d_64.lib")
16 | #else
17 | #pragma comment(lib, "../SysBase/lib/SysBase_d.lib")
18 | #endif // !WIN32
19 | #else
20 | #ifdef X64
21 | #pragma comment(lib, "../SysBase/lib/SysBase_64.lib")
22 | #else
23 | #pragma comment(lib, "../SysBase/lib/SysBase.lib")
24 | #endif // !WIN32
25 | #endif // _DEBUG
26 | ```
27 | - 目标项目只需 inlcude SysBase_Interface.h 即可,配置好编译选型后编译目标程序即可。
28 |
--------------------------------------------------------------------------------
/SysBase/SysBase.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25123.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SysBase", "SysBase\SysBase.vcxproj", "{4AEF3BAF-4E31-4A02-A88D-A45CC1852B84}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Win32 = Debug|Win32
11 | Debug|x64 = Debug|x64
12 | Release|Win32 = Release|Win32
13 | Release|x64 = Release|x64
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {4AEF3BAF-4E31-4A02-A88D-A45CC1852B84}.Debug|Win32.ActiveCfg = Debug|Win32
17 | {4AEF3BAF-4E31-4A02-A88D-A45CC1852B84}.Debug|Win32.Build.0 = Debug|Win32
18 | {4AEF3BAF-4E31-4A02-A88D-A45CC1852B84}.Debug|x64.ActiveCfg = Debug|x64
19 | {4AEF3BAF-4E31-4A02-A88D-A45CC1852B84}.Debug|x64.Build.0 = Debug|x64
20 | {4AEF3BAF-4E31-4A02-A88D-A45CC1852B84}.Release|Win32.ActiveCfg = Release|Win32
21 | {4AEF3BAF-4E31-4A02-A88D-A45CC1852B84}.Release|Win32.Build.0 = Release|Win32
22 | {4AEF3BAF-4E31-4A02-A88D-A45CC1852B84}.Release|x64.ActiveCfg = Release|x64
23 | {4AEF3BAF-4E31-4A02-A88D-A45CC1852B84}.Release|x64.Build.0 = Release|x64
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/SysBase/SysBase/SysBase.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/SysBase/SysBase/SysBase_Interface.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/SysBase_Interface.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/AutoPtr.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/AutoPtr.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/Buffer.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/Buffer.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/BufferPool.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/BufferPool.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/BufferQueue.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/BufferQueue.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/CMD5.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/CMD5.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/CSHA1.h:
--------------------------------------------------------------------------------
1 | /*
2 | 100% free public domain implementation of the SHA-1 algorithm
3 | by Dominik Reichl
4 | Web: http://www.dominik-reichl.de/
5 |
6 | Version 1.6 - 2005-02-07 (thanks to Howard Kapustein for patches)
7 | - You can set the endianness in your files, no need to modify the
8 | header file of the CSHA1 class any more
9 | - Aligned data support
10 | - Made support/compilation of the utility functions (ReportHash
11 | and HashFile) optional (useful, if bytes count, for example in
12 | embedded environments)
13 |
14 | Version 1.5 - 2005-01-01
15 | - 64-bit compiler compatibility added
16 | - Made variable wiping optional (define SHA1_WIPE_VARIABLES)
17 | - Removed unnecessary variable initializations
18 | - ROL32 improvement for the Microsoft compiler (using _rotl)
19 |
20 | ======== Test Vectors (from FIPS PUB 180-1) ========
21 |
22 | SHA1("abc") =
23 | A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D
24 |
25 | SHA1("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq") =
26 | 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1
27 |
28 | SHA1(A million repetitions of "a") =
29 | 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F
30 | */
31 |
32 | #pragma once
33 |
34 | #if !defined(SHA1_UTILITY_FUNCTIONS) && !defined(SHA1_NO_UTILITY_FUNCTIONS)
35 | #define SHA1_UTILITY_FUNCTIONS
36 | #endif
37 |
38 | #include // Needed for memset and memcpy
39 |
40 | #ifdef SHA1_UTILITY_FUNCTIONS
41 | #include // Needed for file access and sprintf
42 | #include // Needed for strcat and strcpy
43 | #endif
44 |
45 | #ifdef _MSC_VER
46 | #include
47 | #endif
48 |
49 | // You can define the endian mode in your files, without modifying the SHA1
50 | // source files. Just #define SHA1_LITTLE_ENDIAN or #define SHA1_BIG_ENDIAN
51 | // in your files, before including the SHA1.h header file. If you don't
52 | // define anything, the class defaults to little endian.
53 |
54 | #if !defined(SHA1_LITTLE_ENDIAN) && !defined(SHA1_BIG_ENDIAN)
55 | #define SHA1_LITTLE_ENDIAN
56 | #endif
57 |
58 | // Same here. If you want variable wiping, #define SHA1_WIPE_VARIABLES, if
59 | // not, #define SHA1_NO_WIPE_VARIABLES. If you don't define anything, it
60 | // defaults to wiping.
61 |
62 | #if !defined(SHA1_WIPE_VARIABLES) && !defined(SHA1_NO_WIPE_VARIABLES)
63 | #define SHA1_WIPE_VARIABLES
64 | #endif
65 |
66 | /////////////////////////////////////////////////////////////////////////////
67 | // Define 8- and 32-bit variables
68 |
69 | #ifndef UINT_32
70 |
71 | #ifdef _MSC_VER
72 |
73 | #define UINT_8 unsigned __int8
74 | #define UINT_32 unsigned __int32
75 |
76 | #else
77 |
78 | #define UINT_8 unsigned char
79 |
80 | #if (ULONG_MAX == 0xFFFFFFFF)
81 | #define UINT_32 unsigned long
82 | #else
83 | #define UINT_32 unsigned int
84 | #endif
85 |
86 | #endif
87 | #endif
88 |
89 | //////////////////////////////////////////////////////////////////////////
90 |
91 | namespace SysBase
92 | {
93 | /////////////////////////////////////////////////////////////////////////////
94 | // Declare SHA1 workspace
95 |
96 | typedef union
97 | {
98 | UINT_8 c[64];
99 | UINT_32 l[16];
100 | } SHA1_WORKSPACE_BLOCK;
101 |
102 | class CSHA1
103 | {
104 | public:
105 | #ifdef SHA1_UTILITY_FUNCTIONS
106 | // Two different formats for ReportHash(...)
107 | enum
108 | {
109 | REPORT_HEX = 0,
110 | REPORT_DIGIT = 1
111 | };
112 | #endif
113 |
114 | // Constructor and Destructor
115 | CSHA1();
116 | ~CSHA1();
117 |
118 | UINT_32 m_state[5];
119 | UINT_32 m_count[2];
120 | UINT_32 __reserved1[1];
121 | UINT_8 m_buffer[64];
122 | UINT_8 m_digest[20];
123 | UINT_32 __reserved2[3];
124 |
125 | void Reset();
126 |
127 | // Update the hash value
128 | void Update(UINT_8 *data, UINT_32 len);
129 | #ifdef SHA1_UTILITY_FUNCTIONS
130 | bool HashFile(char *szFileName);
131 | #endif
132 |
133 | // Finalize hash and report
134 | void Final();
135 |
136 | // Report functions: as pre-formatted and raw data
137 | #ifdef SHA1_UTILITY_FUNCTIONS
138 | void ReportHash(char *szReport, unsigned char uReportType = REPORT_HEX);
139 | #endif
140 | void GetHash(UINT_8 *puDest);
141 |
142 | private:
143 | // Private SHA-1 transformation
144 | void Transform(UINT_32 *state, UINT_8 *buffer);
145 |
146 | // Member variables
147 | UINT_8 m_workspace[64];
148 | SHA1_WORKSPACE_BLOCK *m_block; // SHA1 pointer to the byte array above
149 | };
150 | }
--------------------------------------------------------------------------------
/SysBase/SysBase/include/Config.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/Config.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/DataWarpper.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/DataWarpper.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/DateTime.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/DateTime.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/Directory.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/Directory.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/Dump.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/Dump.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/FastFileCache.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/FastFileCache.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/FastFileQueue.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/FastFileQueue.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/File.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/File.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/FileBase.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/FileBase.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/FileMonitorWorker.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "Thread.h"
4 | #include "ThreadSync.h"
5 |
6 | namespace SysBase
7 | {
8 | class IFileMonitorWorkerHandler
9 | {
10 | public:
11 |
12 | IFileMonitorWorkerHandler();
13 |
14 | virtual ~IFileMonitorWorkerHandler();
15 |
16 | virtual void OnChanged(bool bChangeSize, bool bChangeAttributes, bool bChangeLastWrite) = 0;
17 | };
18 |
19 | struct TFileMonitorWorkerParam
20 | {
21 | TFileMonitorWorkerParam()
22 | {
23 | ZeroMemory(wzFilePath, sizeof(WCHAR) * MAX_PATH);
24 |
25 | bIsMonitorSize = false;
26 | bIsMonitorAttributes = false;
27 | bIsMonitorLastWrite = false;
28 |
29 | pHandler = NULL;
30 | }
31 |
32 | void SetFileName(const char* szFileName);
33 |
34 | WCHAR wzFilePath[MAX_PATH];
35 |
36 | bool bIsMonitorSize;
37 | bool bIsMonitorAttributes;
38 | bool bIsMonitorLastWrite;
39 |
40 | IFileMonitorWorkerHandler* pHandler;
41 | };
42 |
43 | class CFileMonitorWorker : protected CCustomThread
44 | {
45 | public:
46 |
47 | CFileMonitorWorker();
48 |
49 | virtual ~CFileMonitorWorker();
50 |
51 | bool Start(TFileMonitorWorkerParam& aParam);
52 |
53 | void Stop();
54 |
55 | protected:
56 |
57 | virtual void Proc();
58 |
59 | private:
60 |
61 | bool m_bStop;
62 |
63 | CEvent m_stopEvent;
64 |
65 | TFileMonitorWorkerParam m_param;
66 | };
67 | }
68 |
--------------------------------------------------------------------------------
/SysBase/SysBase/include/HMAC_SHA1.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/HMAC_SHA1.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/HW_CPU.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "SysBase.h"
4 |
5 | namespace SysBase
6 | {
7 | struct THWCpuInfo
8 | {
9 | UINT32 nProcessorCount;
10 | UINT32 nNumaNodeCount;
11 | UINT32 nProcessorCoreCount;
12 | UINT32 nLogicalProcessorCount;
13 | };
14 |
15 | struct THWCpuDesc
16 | {
17 | UINT32 nSpeed;
18 | string strName;
19 | string strIdentify;
20 | string strProductor;
21 | };
22 |
23 | class CHWCpu
24 | {
25 | public:
26 |
27 | static bool GetCpuInfo(THWCpuInfo& aCpuInfo);
28 |
29 | static bool GetCpuDesc(THWCpuDesc& aCpuDesc);
30 |
31 | private:
32 |
33 | CHWCpu();
34 |
35 | virtual ~CHWCpu();
36 | };
37 | }
38 |
--------------------------------------------------------------------------------
/SysBase/SysBase/include/HW_Disk.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/HW_Disk.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/HW_EthernetAdapter.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/HW_EthernetAdapter.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/HW_Memory.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/HW_Memory.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/HW_Volume.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/HW_Volume.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/Log.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/Log.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/MsgWaitPool.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/MsgWaitPool.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/PerformanceCounter.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/PerformanceCounter.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/Process.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/Process.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/ProcessHelper.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/ProcessHelper.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/ProcessInfo.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/ProcessInfo.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/Service.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/Service.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/ServicesHelper.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/ServicesHelper.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/SingleMgr.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/SingleMgr.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/SlowFileQueue.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/SlowFileQueue.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/SlowReadFileQueue.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/SlowReadFileQueue.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/SlowWriteFileQueue.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/SlowWriteFileQueue.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/Socket.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/Socket.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/SocketCommon.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/SocketCommon.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/SocketLoader.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/SocketLoader.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/SqlServerHelper.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/SqlServerHelper.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/StatisticsWorker.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/StatisticsWorker.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/SysBase.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/SysBase.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/SysEventLog.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/SysEventLog.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/SysUser.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/SysUser.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/SysUserGroup.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/SysUserGroup.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/SystemInfo.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/SystemInfo.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/SystemNetInfo.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/SystemNetInfo.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/SystemPerformanceCollecter.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/SystemPerformanceCollecter.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/SystemPerformanceInfo.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/SystemPerformanceInfo.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/SystemShutdown.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/SystemShutdown.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/SystemTime.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/SystemTime.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/TcpClient.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/TcpClient.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/TcpMultiClient.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/TcpMultiClient.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/TcpServer.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/TcpServer.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/TcpSocket.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/TcpSocket.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/Template.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/Template.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/Thread.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/Thread.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/ThreadSync.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/ThreadSync.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/Utility.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/Utility.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/WAdvancedFirewall.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/WAdvancedFirewall.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/WUpdateAgent.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/include/WUpdateAgent.h
--------------------------------------------------------------------------------
/SysBase/SysBase/include/base64.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "SysBase.h"
4 |
5 | namespace SysBase
6 | {
7 | class CBase64
8 | {
9 | public:
10 | static UINT32 Encode(const void* pSource, UINT32 nSourceSize, char* pDest, UINT32 nDestLen);
11 |
12 | static UINT32 Decode(char const* pSource, UINT32 nSourceLen, void* pDest, UINT32 nDestSize);
13 |
14 | static UINT32 SafeUrlEncode(const void* pSource, UINT32 nSourceSize, char* pDest, UINT32 nDestLen);
15 |
16 | static UINT32 SafeUrlDecode(char const* pSource, UINT32 nSourceLen, void* pDest, UINT32 nDestSize);
17 | };
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/SysBase/SysBase/source/Buffer.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/source/Buffer.cpp
--------------------------------------------------------------------------------
/SysBase/SysBase/source/BufferPool.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/source/BufferPool.cpp
--------------------------------------------------------------------------------
/SysBase/SysBase/source/BufferQueue.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/source/BufferQueue.cpp
--------------------------------------------------------------------------------
/SysBase/SysBase/source/CMD5.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/source/CMD5.cpp
--------------------------------------------------------------------------------
/SysBase/SysBase/source/CSHA1.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | 100% free public domain implementation of the SHA-1 algorithm
3 | by Dominik Reichl
4 | Web: http://www.dominik-reichl.de/
5 |
6 | Version 1.6 - 2005-02-07 (thanks to Howard Kapustein for patches)
7 | - You can set the endianness in your files, no need to modify the
8 | header file of the CSHA1 class any more
9 | - Aligned data support
10 | - Made support/compilation of the utility functions (ReportHash
11 | and HashFile) optional (useful, if bytes count, for example in
12 | embedded environments)
13 |
14 | Version 1.5 - 2005-01-01
15 | - 64-bit compiler compatibility added
16 | - Made variable wiping optional (define SHA1_WIPE_VARIABLES)
17 | - Removed unnecessary variable initializations
18 | - ROL32 improvement for the Microsoft compiler (using _rotl)
19 |
20 | ======== Test Vectors (from FIPS PUB 180-1) ========
21 |
22 | SHA1("abc") =
23 | A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D
24 |
25 | SHA1("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq") =
26 | 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1
27 |
28 | SHA1(A million repetitions of "a") =
29 | 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F
30 | */
31 | #include "../SysBase_Interface.h"
32 |
33 | namespace SysBase
34 | {
35 | #ifdef SHA1_UTILITY_FUNCTIONS
36 | #define SHA1_MAX_FILE_BUFFER 8000
37 | #endif
38 |
39 | // Rotate x bits to the left
40 | #ifndef ROL32
41 | #ifdef _MSC_VER
42 | #define ROL32(_val32, _nBits) _rotl(_val32, _nBits)
43 | #else
44 | #define ROL32(_val32, _nBits) (((_val32)<<(_nBits))|((_val32)>>(32-(_nBits))))
45 | #endif
46 | #endif
47 |
48 | #ifdef SHA1_LITTLE_ENDIAN
49 | #define SHABLK0(i) (m_block->l[i] = \
50 | (ROL32(m_block->l[i],24) & 0xFF00FF00) | (ROL32(m_block->l[i],8) & 0x00FF00FF))
51 | #else
52 | #define SHABLK0(i) (m_block->l[i])
53 | #endif
54 |
55 | #define SHABLK(i) (m_block->l[i&15] = ROL32(m_block->l[(i+13)&15] ^ m_block->l[(i+8)&15] \
56 | ^ m_block->l[(i+2)&15] ^ m_block->l[i&15],1))
57 |
58 | // SHA-1 rounds
59 | #define _R0(v,w,x,y,z,i) { z+=((w&(x^y))^y)+SHABLK0(i)+0x5A827999+ROL32(v,5); w=ROL32(w,30); }
60 | #define _R1(v,w,x,y,z,i) { z+=((w&(x^y))^y)+SHABLK(i)+0x5A827999+ROL32(v,5); w=ROL32(w,30); }
61 | #define _R2(v,w,x,y,z,i) { z+=(w^x^y)+SHABLK(i)+0x6ED9EBA1+ROL32(v,5); w=ROL32(w,30); }
62 | #define _R3(v,w,x,y,z,i) { z+=(((w|x)&y)|(w&x))+SHABLK(i)+0x8F1BBCDC+ROL32(v,5); w=ROL32(w,30); }
63 | #define _R4(v,w,x,y,z,i) { z+=(w^x^y)+SHABLK(i)+0xCA62C1D6+ROL32(v,5); w=ROL32(w,30); }
64 |
65 | CSHA1::CSHA1()
66 | {
67 | m_block = (SHA1_WORKSPACE_BLOCK *)m_workspace;
68 |
69 | Reset();
70 | }
71 |
72 | CSHA1::~CSHA1()
73 | {
74 | Reset();
75 | }
76 |
77 | void CSHA1::Reset()
78 | {
79 | // SHA1 initialization constants
80 | m_state[0] = 0x67452301;
81 | m_state[1] = 0xEFCDAB89;
82 | m_state[2] = 0x98BADCFE;
83 | m_state[3] = 0x10325476;
84 | m_state[4] = 0xC3D2E1F0;
85 |
86 | m_count[0] = 0;
87 | m_count[1] = 0;
88 | }
89 |
90 | void CSHA1::Transform(UINT_32 *state, UINT_8 *buffer)
91 | {
92 | // Copy state[] to working vars
93 | UINT_32 a = state[0], b = state[1], c = state[2], d = state[3], e = state[4];
94 |
95 | memcpy(m_block, buffer, 64);
96 |
97 | // 4 rounds of 20 operations each. Loop unrolled.
98 | _R0(a,b,c,d,e, 0); _R0(e,a,b,c,d, 1); _R0(d,e,a,b,c, 2); _R0(c,d,e,a,b, 3);
99 | _R0(b,c,d,e,a, 4); _R0(a,b,c,d,e, 5); _R0(e,a,b,c,d, 6); _R0(d,e,a,b,c, 7);
100 | _R0(c,d,e,a,b, 8); _R0(b,c,d,e,a, 9); _R0(a,b,c,d,e,10); _R0(e,a,b,c,d,11);
101 | _R0(d,e,a,b,c,12); _R0(c,d,e,a,b,13); _R0(b,c,d,e,a,14); _R0(a,b,c,d,e,15);
102 | _R1(e,a,b,c,d,16); _R1(d,e,a,b,c,17); _R1(c,d,e,a,b,18); _R1(b,c,d,e,a,19);
103 | _R2(a,b,c,d,e,20); _R2(e,a,b,c,d,21); _R2(d,e,a,b,c,22); _R2(c,d,e,a,b,23);
104 | _R2(b,c,d,e,a,24); _R2(a,b,c,d,e,25); _R2(e,a,b,c,d,26); _R2(d,e,a,b,c,27);
105 | _R2(c,d,e,a,b,28); _R2(b,c,d,e,a,29); _R2(a,b,c,d,e,30); _R2(e,a,b,c,d,31);
106 | _R2(d,e,a,b,c,32); _R2(c,d,e,a,b,33); _R2(b,c,d,e,a,34); _R2(a,b,c,d,e,35);
107 | _R2(e,a,b,c,d,36); _R2(d,e,a,b,c,37); _R2(c,d,e,a,b,38); _R2(b,c,d,e,a,39);
108 | _R3(a,b,c,d,e,40); _R3(e,a,b,c,d,41); _R3(d,e,a,b,c,42); _R3(c,d,e,a,b,43);
109 | _R3(b,c,d,e,a,44); _R3(a,b,c,d,e,45); _R3(e,a,b,c,d,46); _R3(d,e,a,b,c,47);
110 | _R3(c,d,e,a,b,48); _R3(b,c,d,e,a,49); _R3(a,b,c,d,e,50); _R3(e,a,b,c,d,51);
111 | _R3(d,e,a,b,c,52); _R3(c,d,e,a,b,53); _R3(b,c,d,e,a,54); _R3(a,b,c,d,e,55);
112 | _R3(e,a,b,c,d,56); _R3(d,e,a,b,c,57); _R3(c,d,e,a,b,58); _R3(b,c,d,e,a,59);
113 | _R4(a,b,c,d,e,60); _R4(e,a,b,c,d,61); _R4(d,e,a,b,c,62); _R4(c,d,e,a,b,63);
114 | _R4(b,c,d,e,a,64); _R4(a,b,c,d,e,65); _R4(e,a,b,c,d,66); _R4(d,e,a,b,c,67);
115 | _R4(c,d,e,a,b,68); _R4(b,c,d,e,a,69); _R4(a,b,c,d,e,70); _R4(e,a,b,c,d,71);
116 | _R4(d,e,a,b,c,72); _R4(c,d,e,a,b,73); _R4(b,c,d,e,a,74); _R4(a,b,c,d,e,75);
117 | _R4(e,a,b,c,d,76); _R4(d,e,a,b,c,77); _R4(c,d,e,a,b,78); _R4(b,c,d,e,a,79);
118 |
119 | // Add the working vars back into state
120 | state[0] += a;
121 | state[1] += b;
122 | state[2] += c;
123 | state[3] += d;
124 | state[4] += e;
125 |
126 | // Wipe variables
127 | #ifdef SHA1_WIPE_VARIABLES
128 | a = b = c = d = e = 0;
129 | #endif
130 | }
131 |
132 | // Use this function to hash in binary data and strings
133 | void CSHA1::Update(UINT_8 *data, UINT_32 len)
134 | {
135 | UINT_32 i, j;
136 |
137 | j = (m_count[0] >> 3) & 63;
138 |
139 | if((m_count[0] += len << 3) < (len << 3)) m_count[1]++;
140 |
141 | m_count[1] += (len >> 29);
142 |
143 | if((j + len) > 63)
144 | {
145 | i = 64 - j;
146 | memcpy(&m_buffer[j], data, i);
147 | Transform(m_state, m_buffer);
148 |
149 | for(; i + 63 < len; i += 64) Transform(m_state, &data[i]);
150 |
151 | j = 0;
152 | }
153 | else i = 0;
154 |
155 | memcpy(&m_buffer[j], &data[i], len - i);
156 | }
157 |
158 | #ifdef SHA1_UTILITY_FUNCTIONS
159 | // Hash in file contents
160 | bool CSHA1::HashFile(char *szFileName)
161 | {
162 | unsigned long ulFileSize, ulRest, ulBlocks;
163 | unsigned long i;
164 | UINT_8 uData[SHA1_MAX_FILE_BUFFER];
165 | FILE *fIn;
166 |
167 | if(szFileName == NULL) return false;
168 |
169 | fIn = fopen(szFileName, "rb");
170 | if(fIn == NULL) return false;
171 |
172 | fseek(fIn, 0, SEEK_END);
173 | ulFileSize = (unsigned long)ftell(fIn);
174 | fseek(fIn, 0, SEEK_SET);
175 |
176 | if(ulFileSize != 0)
177 | {
178 | ulBlocks = ulFileSize / SHA1_MAX_FILE_BUFFER;
179 | ulRest = ulFileSize % SHA1_MAX_FILE_BUFFER;
180 | }
181 | else
182 | {
183 | ulBlocks = 0;
184 | ulRest = 0;
185 | }
186 |
187 | for(i = 0; i < ulBlocks; i++)
188 | {
189 | fread(uData, 1, SHA1_MAX_FILE_BUFFER, fIn);
190 | Update((UINT_8 *)uData, SHA1_MAX_FILE_BUFFER);
191 | }
192 |
193 | if(ulRest != 0)
194 | {
195 | fread(uData, 1, ulRest, fIn);
196 | Update((UINT_8 *)uData, ulRest);
197 | }
198 |
199 | fclose(fIn); fIn = NULL;
200 | return true;
201 | }
202 | #endif
203 |
204 | void CSHA1::Final()
205 | {
206 | UINT_32 i;
207 | UINT_8 finalcount[8];
208 |
209 | for(i = 0; i < 8; i++)
210 | finalcount[i] = (UINT_8)((m_count[((i >= 4) ? 0 : 1)]
211 | >> ((3 - (i & 3)) * 8) ) & 255); // Endian independent
212 |
213 | Update((UINT_8 *)"\200", 1);
214 |
215 | while ((m_count[0] & 504) != 448)
216 | Update((UINT_8 *)"\0", 1);
217 |
218 | Update(finalcount, 8); // Cause a SHA1Transform()
219 |
220 | for(i = 0; i < 20; i++)
221 | {
222 | m_digest[i] = (UINT_8)((m_state[i >> 2] >> ((3 - (i & 3)) * 8) ) & 255);
223 | }
224 |
225 | // Wipe variables for security reasons
226 | #ifdef SHA1_WIPE_VARIABLES
227 | i = 0;
228 | memset(m_buffer, 0, 64);
229 | memset(m_state, 0, 20);
230 | memset(m_count, 0, 8);
231 | memset(finalcount, 0, 8);
232 | Transform(m_state, m_buffer);
233 | #endif
234 | }
235 |
236 | #ifdef SHA1_UTILITY_FUNCTIONS
237 | // Get the final hash as a pre-formatted string
238 | void CSHA1::ReportHash(char *szReport, unsigned char uReportType)
239 | {
240 | unsigned char i;
241 | char szTemp[16];
242 |
243 | if(szReport == NULL) return;
244 |
245 | if(uReportType == REPORT_HEX)
246 | {
247 | sprintf_s(szTemp, "%02X", m_digest[0]);
248 | strcat(szReport, szTemp);
249 |
250 | for(i = 1; i < 20; i++)
251 | {
252 | sprintf_s(szTemp, " %02X", m_digest[i]);
253 | strcat(szReport, szTemp);
254 | }
255 | }
256 | else if(uReportType == REPORT_DIGIT)
257 | {
258 | sprintf_s(szTemp, "%u", m_digest[0]);
259 | strcat(szReport, szTemp);
260 |
261 | for(i = 1; i < 20; i++)
262 | {
263 | sprintf_s(szTemp, " %u", m_digest[i]);
264 | strcat(szReport, szTemp);
265 | //strcat_s(szReport,strlen(szReport), szTemp);
266 | }
267 | }
268 | else strcpy(szReport, "Error: Unknown report type!");
269 | }
270 | #endif
271 |
272 | // Get the raw message digest
273 | void CSHA1::GetHash(UINT_8 *puDest)
274 | {
275 | memcpy(puDest, m_digest, 20);
276 | }
277 |
278 | }
--------------------------------------------------------------------------------
/SysBase/SysBase/source/Config.cpp:
--------------------------------------------------------------------------------
1 | #include "../SysBase_Interface.h"
2 |
3 | namespace SysBase
4 | {
5 | //////////////////////////////////////////////////////////////////////////
6 | //CIniConfig
7 |
8 | CIniConfig::CIniConfig()
9 | {
10 | ZeroMemory(m_szFilePath, MAX_PATH);
11 | }
12 |
13 | CIniConfig::~CIniConfig()
14 | {
15 | }
16 |
17 | bool CIniConfig::Load(const char* pFilePath, bool bExist)
18 | {
19 | if (!pFilePath)
20 | {
21 | return false;
22 | }
23 |
24 | if (bExist)
25 | {
26 | if (_access(pFilePath, 0) != 0)
27 | {
28 | return false;
29 | }
30 | }
31 |
32 | UINT32 nStrLen = (UINT32)strlen(pFilePath);
33 |
34 | ZeroMemory(m_szFilePath, MAX_PATH);
35 |
36 | if (nStrLen > (MAX_PATH - 1))
37 | {
38 | return false;
39 | }
40 |
41 | strncpy(m_szFilePath, pFilePath, nStrLen);
42 |
43 | return true;
44 | }
45 |
46 | UINT32 CIniConfig::GetString(const char* pSection, const char* pKey, char* pValue, UINT32 nValueSize, const char* pDefaultValue)
47 | {
48 | return (UINT32)GetPrivateProfileStringA(pSection, pKey, pDefaultValue, pValue, nValueSize, m_szFilePath);
49 | }
50 |
51 | bool CIniConfig::SetString(const char* pSection, const char* pKey, const char* pValue)
52 | {
53 | if (!WritePrivateProfileStringA(pSection, pKey, pValue, m_szFilePath))
54 | {
55 | return false;
56 | }
57 |
58 | return true;
59 | }
60 |
61 | UINT32 CIniConfig::GetInt(const char* pSection, const char* pKey, INT32 nDefault)
62 | {
63 | return GetPrivateProfileIntA(pSection, pKey, nDefault, m_szFilePath);
64 | }
65 |
66 | bool CIniConfig::SetInt(const char* pSection, const char* pKey, INT32 nValue)
67 | {
68 | char szTemp[128] = {0};
69 |
70 | sprintf_s(szTemp, 127, "%d", nValue);
71 |
72 | return this->SetString(pSection, pKey, szTemp);
73 | }
74 |
75 | const char* CIniConfig::GetFilePath()
76 | {
77 | return m_szFilePath;
78 | }
79 | }
--------------------------------------------------------------------------------
/SysBase/SysBase/source/DataWarpper.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/source/DataWarpper.cpp
--------------------------------------------------------------------------------
/SysBase/SysBase/source/DateTime.cpp:
--------------------------------------------------------------------------------
1 | #include "../SysBase_Interface.h"
2 | #include
3 | #include
4 |
5 | namespace SysBase
6 | {
7 | //////////////////////////////////////////////////////////////////////////
8 | //CDateTime
9 |
10 | CDateTime::CDateTime()
11 | {
12 | __timeb64 aTimeb64;
13 |
14 | _ftime64_s(&aTimeb64);
15 |
16 | struct tm tmLocalTime = {0};
17 | _localtime64_s(&tmLocalTime, &aTimeb64.time);
18 |
19 | m_nYear = tmLocalTime.tm_year + 1900;
20 | m_nMonth = tmLocalTime.tm_mon + 1;
21 | m_nDay = tmLocalTime.tm_mday;
22 | m_nDayOfWeek = tmLocalTime.tm_wday;
23 | m_nDayOfYear = tmLocalTime.tm_yday;
24 | m_nHour = tmLocalTime.tm_hour;
25 | m_nMinute = tmLocalTime.tm_min;
26 | m_nSecond = tmLocalTime.tm_sec;
27 | m_nMillisecond = aTimeb64.millitm;
28 |
29 | m_nTime = aTimeb64.time;
30 | }
31 |
32 | CDateTime::CDateTime(UINT16 nYear, UINT16 nMonth, UINT16 nDay)
33 | {
34 | this->Init(nYear, nMonth, nDay);
35 | }
36 |
37 | CDateTime::CDateTime(UINT16 nYear, UINT16 nMonth, UINT16 nDay, UINT16 nHour, UINT16 nMinute, UINT16 nSecond)
38 | {
39 | this->Init(nYear, nMonth, nDay, nHour, nMinute, nSecond);
40 | }
41 |
42 | CDateTime::CDateTime(UINT16 nYear, UINT16 nMonth, UINT16 nDay, UINT16 nHour, UINT16 nMinute, UINT16 nSecond, UINT16 nMillisecond)
43 | {
44 | this->Init(nYear, nMonth, nDay, nHour, nMinute, nSecond, nMillisecond);
45 | }
46 |
47 | CDateTime::CDateTime(INT64 nTime, UINT16 nMillisecond)
48 | {
49 | struct tm tmLocalTime = {0};
50 | _localtime64_s(&tmLocalTime, &nTime);
51 |
52 | m_nYear = tmLocalTime.tm_year + 1900;
53 | m_nMonth = tmLocalTime.tm_mon + 1;
54 | m_nDay = tmLocalTime.tm_mday;
55 | m_nDayOfWeek = tmLocalTime.tm_wday;
56 | m_nDayOfYear = tmLocalTime.tm_yday;
57 | m_nHour = tmLocalTime.tm_hour;
58 | m_nMinute = tmLocalTime.tm_min;
59 | m_nSecond = tmLocalTime.tm_sec;
60 | m_nMillisecond = nMillisecond;
61 |
62 | m_nTime = nTime;
63 | }
64 |
65 | CDateTime::CDateTime(SYSTEMTIME systemTime)
66 | {
67 | this->Init(systemTime.wYear, systemTime.wMonth, systemTime.wDay, systemTime.wHour, systemTime.wMinute, systemTime.wSecond, systemTime.wMilliseconds);
68 | }
69 |
70 | CDateTime::~CDateTime()
71 | {
72 |
73 | }
74 |
75 | void CDateTime::Init(UINT16 nYear, UINT16 nMonth, UINT16 nDay, UINT16 nHour, UINT16 nMinute, UINT16 nSecond, UINT16 nMillisecond)
76 | {
77 | struct tm tmLocalTime = {0};
78 | tmLocalTime.tm_year = nYear - 1900;
79 | tmLocalTime.tm_mon = nMonth - 1;
80 | tmLocalTime.tm_mday = nDay;
81 | tmLocalTime.tm_hour = nHour;
82 | tmLocalTime.tm_min = nMinute;
83 | tmLocalTime.tm_sec = nMinute;
84 |
85 | m_nTime = _mktime64(&tmLocalTime);
86 |
87 | _localtime64_s(&tmLocalTime, &m_nTime);
88 |
89 | m_nYear = tmLocalTime.tm_year + 1900;
90 | m_nMonth = tmLocalTime.tm_mon + 1;
91 | m_nDay = tmLocalTime.tm_mday;
92 | m_nDayOfWeek = tmLocalTime.tm_wday;
93 | m_nDayOfYear = tmLocalTime.tm_yday;
94 | m_nHour = tmLocalTime.tm_hour;
95 | m_nMinute = tmLocalTime.tm_min;
96 | m_nSecond = tmLocalTime.tm_sec;
97 | m_nMillisecond = nMillisecond;
98 | }
99 |
100 | UINT16 CDateTime::GetYear()
101 | {
102 | return m_nYear;
103 | }
104 |
105 | UINT16 CDateTime::GetMonth()
106 | {
107 | return m_nMonth;
108 | }
109 |
110 | UINT16 CDateTime::GetDay()
111 | {
112 | return m_nDay;
113 | }
114 |
115 | UINT16 CDateTime::GetDayOfWeek()
116 | {
117 | return m_nDayOfWeek;
118 | }
119 |
120 | UINT16 CDateTime::GetDayOfYear()
121 | {
122 | return m_nDayOfYear;
123 | }
124 |
125 | UINT16 CDateTime::GetHour()
126 | {
127 | return m_nHour;
128 | }
129 |
130 | UINT16 CDateTime::GetMinute()
131 | {
132 | return m_nMinute;
133 | }
134 |
135 | UINT16 CDateTime::GetSecond()
136 | {
137 | return m_nSecond;
138 | }
139 |
140 | UINT16 CDateTime::GetMillisecond()
141 | {
142 | return m_nMillisecond;
143 | }
144 |
145 | INT64 CDateTime::GetTime()
146 | {
147 | return m_nTime;
148 | }
149 | }
--------------------------------------------------------------------------------
/SysBase/SysBase/source/Directory.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/source/Directory.cpp
--------------------------------------------------------------------------------
/SysBase/SysBase/source/Dump.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/source/Dump.cpp
--------------------------------------------------------------------------------
/SysBase/SysBase/source/FastFileCache.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/source/FastFileCache.cpp
--------------------------------------------------------------------------------
/SysBase/SysBase/source/FastFileQueue.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/source/FastFileQueue.cpp
--------------------------------------------------------------------------------
/SysBase/SysBase/source/File.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/source/File.cpp
--------------------------------------------------------------------------------
/SysBase/SysBase/source/FileBase.cpp:
--------------------------------------------------------------------------------
1 | #include "../SysBase_Interface.h"
2 |
3 | namespace SysBase
4 | {
5 | bool CFileBase::IsExist(const char* szPath)
6 | {
7 | if (0 == _access(szPath, 0))
8 | {
9 | return true;
10 | }
11 |
12 | return false;
13 | }
14 |
15 | bool CFileBase::IsExist(const WCHAR* szPath)
16 | {
17 | if (0 == _waccess(szPath, 0))
18 | {
19 | return true;
20 | }
21 |
22 | return false;
23 | }
24 |
25 | bool CFileBase::Rename(const char* szOldName, const char* szNewName)
26 | {
27 | return rename(szOldName, szNewName) == 0 ? true : false;
28 | }
29 |
30 | bool CFileBase::Rename(const WCHAR* szOldName, const WCHAR* szNewName)
31 | {
32 | return _wrename(szOldName, szNewName) == 0 ? true : false;
33 | }
34 | }
--------------------------------------------------------------------------------
/SysBase/SysBase/source/FileMonitorWorker.cpp:
--------------------------------------------------------------------------------
1 | #include "../SysBase_Interface.h"
2 |
3 | namespace SysBase
4 | {
5 | //////////////////////////////////////////////////////////////////////////
6 |
7 | IFileMonitorWorkerHandler::IFileMonitorWorkerHandler()
8 | {
9 |
10 | }
11 |
12 | IFileMonitorWorkerHandler::~IFileMonitorWorkerHandler()
13 | {
14 |
15 | }
16 |
17 | //////////////////////////////////////////////////////////////////////////
18 |
19 | void TFileMonitorWorkerParam::SetFileName(const char* szFileName)
20 | {
21 | MultiByteToWideChar(CP_ACP, 0, szFileName, -1, wzFilePath, MAX_PATH);
22 | }
23 |
24 | //////////////////////////////////////////////////////////////////////////
25 |
26 | CFileMonitorWorker::CFileMonitorWorker()
27 | {
28 | m_bStop = true;
29 | }
30 |
31 | CFileMonitorWorker::~CFileMonitorWorker()
32 | {
33 | this->Stop();
34 | }
35 |
36 | bool CFileMonitorWorker::Start(TFileMonitorWorkerParam& aParam)
37 | {
38 | if (!m_bStop)
39 | {
40 | return true;
41 | }
42 |
43 | if (0 == wcslen(aParam.wzFilePath))
44 | {
45 | return false;
46 | }
47 |
48 | if (!aParam.bIsMonitorAttributes && !aParam.bIsMonitorLastWrite && !aParam.bIsMonitorSize)
49 | {
50 | return false;
51 | }
52 |
53 | if (!aParam.pHandler)
54 | {
55 | return false;
56 | }
57 |
58 | m_param = aParam;
59 |
60 | m_bStop = false;
61 | m_stopEvent.Reset();
62 |
63 | if (CCustomThread::ERROR_CODE_SUCCESS != CCustomThread::Start())
64 | {
65 | this->Stop();
66 |
67 | return false;
68 | }
69 |
70 | return true;
71 | }
72 |
73 | void CFileMonitorWorker::Stop()
74 | {
75 | if (m_bStop)
76 | {
77 | return;
78 | }
79 |
80 | m_bStop = true;
81 |
82 | m_stopEvent.Set();
83 |
84 | CCustomThread::Stop();
85 | }
86 |
87 | void CFileMonitorWorker::Proc()
88 | {
89 | WCHAR wzDir[MAX_PATH] = {0};
90 | WIN32_FILE_ATTRIBUTE_DATA fileData = {0};
91 |
92 | swprintf_s(wzDir,MAX_PATH, m_param.wzFilePath);
93 |
94 | WCHAR* pPtr = wcsrchr(wzDir, L'\\');
95 |
96 | if (pPtr)
97 | {
98 | *pPtr = NULL;
99 | }
100 |
101 | DWORD dwNotify = 0;
102 |
103 | if (m_param.bIsMonitorAttributes)
104 | {
105 | dwNotify |= FILE_NOTIFY_CHANGE_ATTRIBUTES;
106 | }
107 |
108 | if (m_param.bIsMonitorLastWrite)
109 | {
110 | dwNotify |= FILE_NOTIFY_CHANGE_LAST_WRITE;
111 | }
112 |
113 | if (m_param.bIsMonitorSize)
114 | {
115 | dwNotify |= FILE_NOTIFY_CHANGE_SIZE;
116 | }
117 |
118 | HANDLE hChangeHandle = FindFirstChangeNotificationW(wzDir, FALSE, dwNotify);
119 |
120 | if (INVALID_HANDLE_VALUE == hChangeHandle)
121 | {
122 | return;
123 | }
124 |
125 | if (!GetFileAttributesExW(m_param.wzFilePath, GetFileExInfoStandard, (LPVOID)&fileData))
126 | {
127 | return;
128 | }
129 |
130 | const int nCount = 2;
131 | const int nStopEventIndex = 0;
132 | const int nChangeHandleIndex = 1;
133 |
134 | HANDLE hHandles[nCount] = {0};
135 | hHandles[nStopEventIndex] = (HANDLE)m_stopEvent.GetHandle();
136 | hHandles[nChangeHandleIndex] = hChangeHandle;
137 |
138 | while (TRUE)
139 | {
140 | switch (WaitForMultipleObjects(nCount, hHandles, FALSE, INFINITE) - WAIT_OBJECT_0)
141 | {
142 | case WAIT_FAILED :
143 | case nStopEventIndex :
144 | {
145 | FindCloseChangeNotification(hChangeHandle);
146 |
147 | return;
148 | }
149 | break;
150 | case nChangeHandleIndex :
151 | {
152 | bool bChangeSize = false;
153 | bool bChangeAttributes = false;
154 | bool bChangeLastWrite = false;
155 | WIN32_FILE_ATTRIBUTE_DATA tempfileData = {0};
156 |
157 | if (!GetFileAttributesExW(m_param.wzFilePath, GetFileExInfoStandard, (LPVOID)&tempfileData))
158 | {
159 | continue;
160 | }
161 |
162 | if (m_param.bIsMonitorSize)
163 | {
164 | if (fileData.nFileSizeHigh != tempfileData.nFileSizeHigh
165 | || fileData.nFileSizeLow != tempfileData.nFileSizeLow)
166 | {
167 | bChangeSize = true;
168 |
169 | fileData.nFileSizeHigh = tempfileData.nFileSizeHigh;
170 | fileData.nFileSizeLow = tempfileData.nFileSizeLow;
171 | }
172 | }
173 |
174 | if (m_param.bIsMonitorAttributes)
175 | {
176 | if (fileData.dwFileAttributes != tempfileData.dwFileAttributes)
177 | {
178 | bChangeAttributes = true;
179 |
180 | fileData.dwFileAttributes = tempfileData.dwFileAttributes;
181 | }
182 | }
183 |
184 | if (m_param.bIsMonitorLastWrite)
185 | {
186 | if (fileData.ftLastWriteTime.dwLowDateTime != tempfileData.ftLastWriteTime.dwLowDateTime
187 | || fileData.ftLastWriteTime.dwHighDateTime != tempfileData.ftLastWriteTime.dwHighDateTime)
188 | {
189 | bChangeLastWrite = true;
190 |
191 | fileData.ftLastWriteTime = tempfileData.ftLastWriteTime;
192 | }
193 | }
194 |
195 | if (bChangeSize || bChangeAttributes || bChangeLastWrite)
196 | {
197 | if (m_param.pHandler)
198 | {
199 | m_param.pHandler->OnChanged(bChangeSize, bChangeAttributes, bChangeLastWrite);
200 | }
201 | }
202 |
203 | FindNextChangeNotification(hChangeHandle);
204 | }
205 | break;
206 | default:
207 | return;
208 | }
209 | }
210 | }
211 | }
--------------------------------------------------------------------------------
/SysBase/SysBase/source/HMAC_SHA1.cpp:
--------------------------------------------------------------------------------
1 | //******************************************************************************
2 | //* HMAC_SHA1.cpp : Implementation of HMAC SHA1 algorithm
3 | //* Comfort to RFC 2104
4 | //*
5 | //******************************************************************************
6 |
7 | #include "../SysBase_Interface.h"
8 |
9 | namespace SysBase
10 | {
11 | void CHMAC_SHA1::HMAC_SHA1(BYTE *text, int text_len, BYTE *key, int key_len, BYTE *digest)
12 | {
13 | memset(SHA1_Key, 0, SHA1_BLOCK_SIZE);
14 |
15 | /* repeated 64 times for values in ipad and opad */
16 | memset(m_ipad, 0x36, sizeof(m_ipad));
17 | memset(m_opad, 0x5c, sizeof(m_opad));
18 |
19 | /* STEP 1 */
20 | if (key_len > SHA1_BLOCK_SIZE)
21 | {
22 | CSHA1::Reset();
23 | CSHA1::Update((UINT_8 *)key, key_len);
24 | CSHA1::Final();
25 |
26 | CSHA1::GetHash((UINT_8 *)SHA1_Key);
27 | }
28 | else
29 | memcpy(SHA1_Key, key, key_len);
30 |
31 | /* STEP 2 */
32 | for (int i=0; i
3 | #include
4 | #pragma comment(lib, "Setupapi.lib")
5 | namespace SysBase
6 | {
7 | CHWVolume::CHWVolume()
8 | {
9 |
10 | }
11 |
12 | CHWVolume::~CHWVolume()
13 | {
14 |
15 | }
16 |
17 | void CHWVolume::GetVolumeNameList(VolumeNameList& volumeNameList)
18 | {
19 | char szBuffer[10240] = {0};
20 | DWORD dwSize = 10240;
21 | DWORD dwLength = GetLogicalDriveStringsA(dwSize, szBuffer);
22 |
23 | if (0 == dwLength)
24 | {
25 | return;
26 | }
27 |
28 | char* pStart = szBuffer;
29 | char* pEnd = szBuffer + dwLength;
30 | int nLen = 0;
31 |
32 | while (pStart <= pEnd)
33 | {
34 | nLen = (int)strlen(pStart);
35 |
36 | if (nLen <= 0)
37 | {
38 | break;
39 | }
40 |
41 | UINT nFlag = GetDriveType(pStart);
42 |
43 | if (nFlag == DRIVE_FIXED)
44 | {
45 | volumeNameList.push_back(pStart);
46 | }
47 |
48 | pStart = pStart + nLen + 1;
49 | }
50 | }
51 |
52 | bool CHWVolume::GetDiskNumber(const char* szVolumeName, UINT32& nDiskNumber)
53 | {
54 | if (!szVolumeName)
55 | {
56 | return false;
57 | }
58 |
59 | HANDLE hDevice = INVALID_HANDLE_VALUE;
60 | BOOL bRes = FALSE;
61 | DWORD readed = 0;
62 | STORAGE_DEVICE_NUMBER number = {0};
63 |
64 | CHAR szPath[128] = {0};
65 | sprintf(szPath, "\\\\.\\%s", szVolumeName);
66 | char* ptr = strrchr(szPath, ':');
67 | if (ptr)
68 | {
69 | ptr += 1;
70 |
71 | if (*ptr == '\\')
72 | {
73 | *ptr = NULL;
74 | }
75 | }
76 |
77 | hDevice = CreateFile(szPath,
78 | GENERIC_READ | GENERIC_WRITE,
79 | FILE_SHARE_READ | FILE_SHARE_WRITE,
80 | NULL,
81 | OPEN_EXISTING,
82 | 0,
83 | NULL);
84 |
85 | if (hDevice == INVALID_HANDLE_VALUE)
86 | {
87 | return false;
88 | }
89 |
90 | bRes = DeviceIoControl(
91 | hDevice,
92 | IOCTL_STORAGE_GET_DEVICE_NUMBER,
93 | NULL,
94 | 0,
95 | &number,
96 | sizeof(number),
97 | &readed,
98 | NULL);
99 |
100 | CloseHandle(hDevice);
101 |
102 | if (!bRes)
103 | {
104 | return false;
105 | }
106 |
107 | nDiskNumber = number.DeviceNumber;
108 |
109 | return true;
110 | }
111 |
112 | bool CHWVolume::GetVolumeSpace(const char* szVolumeName, TVolumeSpace& volumeSpace)
113 | {
114 | if (!szVolumeName)
115 | {
116 | return false;
117 | }
118 |
119 | ULARGE_INTEGER FreeBytesAvailable = {0};
120 | ULARGE_INTEGER TotalNumberOfBytes = {0};
121 | ULARGE_INTEGER TotalNumberOfFreeBytes = {0};
122 |
123 | if (!GetDiskFreeSpaceExA(szVolumeName,
124 | &FreeBytesAvailable,
125 | &TotalNumberOfBytes,
126 | &TotalNumberOfFreeBytes))
127 | {
128 | return false;
129 | }
130 |
131 | volumeSpace.nFreeBytesAvailable = FreeBytesAvailable.QuadPart;
132 | volumeSpace.nTotalNumberOfBytes = TotalNumberOfBytes.QuadPart;
133 | volumeSpace.nTotalNumberOfFreeBytes = TotalNumberOfFreeBytes.QuadPart;
134 |
135 | return true;
136 | }
137 | }
--------------------------------------------------------------------------------
/SysBase/SysBase/source/Log.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/source/Log.cpp
--------------------------------------------------------------------------------
/SysBase/SysBase/source/MsgWaitPool.cpp:
--------------------------------------------------------------------------------
1 | #include "../SysBase_Interface.h"
2 |
3 | namespace SysBase
4 | {
5 | CMsgWaitPool::CMsgWaitPool()
6 | {
7 | m_lKeyValue = 0;
8 | }
9 |
10 | CMsgWaitPool::~CMsgWaitPool()
11 | {
12 | CREATE_SMART_MUTEX(m_lock);
13 |
14 | m_msgEventMap.clear();
15 | }
16 |
17 | CMsgWaitPool::ERROR_CODE CMsgWaitPool::Init(UINT32 nWaitObjectCount)
18 | {
19 | if (0 ==nWaitObjectCount)
20 | {
21 | return ERROR_CODE_PARAM;
22 | }
23 |
24 | if (m_MsgEventPool.Init(nWaitObjectCount))
25 | {
26 | return ERROR_CODE_SYSTEM;
27 | }
28 |
29 | return ERROR_CODE_SUCCESS;
30 | }
31 |
32 | CMsgWaitPool::ERROR_CODE CMsgWaitPool::SubmitRequest(char* recvBuffer, UINT32 nMaxRecvSize, INT32& nWaitKeyIDOut)
33 | {
34 | if (!recvBuffer || 0 == nMaxRecvSize)
35 | {
36 | return ERROR_CODE_PARAM;
37 | }
38 |
39 | INT32 nWaitKeyID = InterlockedIncrement((LONG*)&m_lKeyValue);
40 |
41 | TMsgEvent* pMsgEvent = this->GetMsgEvent(nWaitKeyID);
42 |
43 | if (!pMsgEvent)
44 | {
45 | return ERROR_CODE_OBJECT_EMPTY;
46 | }
47 | pMsgEvent->pRecvBuffer = recvBuffer;
48 | pMsgEvent->nMaxRecvSize = nMaxRecvSize;
49 |
50 | nWaitKeyIDOut = nWaitKeyID;
51 |
52 | return ERROR_CODE_SUCCESS;
53 | }
54 |
55 | void CMsgWaitPool::CancelWait(INT32 nWaitKeyID)
56 | {
57 | CREATE_SMART_MUTEX(m_lock);
58 |
59 | MsgEventMap::iterator entity = m_msgEventMap.find(nWaitKeyID);
60 |
61 | if (entity != m_msgEventMap.end())
62 | {
63 | TMsgEvent* pMsgEvent = entity->second;
64 | m_msgEventMap.erase(entity);
65 | m_MsgEventPool.Push(pMsgEvent);
66 | }
67 | }
68 |
69 | CMsgWaitPool::ERROR_CODE CMsgWaitPool::WaitResponse(INT32 nWaitKeyID, UINT32 nWaitTime, UINT32 &nRecvSizeOut)
70 | {
71 | TMsgEvent* pMsgEvent = NULL;
72 |
73 | {
74 | CREATE_SMART_MUTEX(m_lock);
75 |
76 | MsgEventMap::iterator entity = m_msgEventMap.find(nWaitKeyID);
77 |
78 | if (m_msgEventMap.end() == entity)
79 | {
80 | return ERROR_CODE_NO_OBJECT;
81 | }
82 | else
83 | {
84 | pMsgEvent = entity->second;
85 | }
86 | }
87 |
88 | bool bSuccess =false;
89 |
90 | ERROR_CODE resCode = ERROR_CODE_SUCCESS;
91 |
92 | if (pMsgEvent->event.Wait(nWaitTime))
93 | {
94 | if (ERROR_CODE_SUCCESS != pMsgEvent->errorCode)
95 | {
96 | resCode = pMsgEvent->errorCode;
97 | }
98 | else
99 | {
100 | nRecvSizeOut = pMsgEvent->nRecvSize;
101 | }
102 | }
103 | else
104 | {
105 | resCode = ERROR_CODE_TIMEOUT;
106 | }
107 |
108 | {
109 | CREATE_SMART_MUTEX(m_lock);
110 |
111 | m_msgEventMap.erase(nWaitKeyID);
112 | m_MsgEventPool.Push(pMsgEvent);
113 | }
114 |
115 | return resCode;
116 | }
117 |
118 | void CMsgWaitPool::SetResponce(INT32 nWaitKeyID, const void* pData, UINT32 nDataSize)
119 | {
120 | CREATE_SMART_MUTEX(m_lock);
121 |
122 | MsgEventMap::iterator entity = m_msgEventMap.find(nWaitKeyID);
123 |
124 | if (entity == m_msgEventMap.end())
125 | {
126 | return;
127 | }
128 |
129 | TMsgEvent* pTMsgEvent = entity->second;
130 |
131 | if (nDataSize > pTMsgEvent->nMaxRecvSize)
132 | {
133 | pTMsgEvent->nRecvSize = 0;
134 | pTMsgEvent->errorCode = ERROR_CODE_RECV_SIZE_BIG;
135 | pTMsgEvent->event.Set();
136 |
137 | return;
138 | }
139 |
140 | memcpy(pTMsgEvent->pRecvBuffer, pData, nDataSize);
141 | pTMsgEvent->nRecvSize = nDataSize;
142 | entity->second->event.Set();
143 | }
144 |
145 |
146 | CMsgWaitPool::TMsgEvent* CMsgWaitPool::GetMsgEvent(INT32 nWaitKeyID)
147 | {
148 | TMsgEvent* pMsgEvent = NULL;
149 |
150 | CREATE_SMART_MUTEX(m_lock);
151 |
152 | MsgEventMap::iterator entity = m_msgEventMap.find(nWaitKeyID);
153 |
154 | if (m_msgEventMap.end() == entity)
155 | {
156 | pMsgEvent = m_MsgEventPool.Pop();
157 |
158 | if (!pMsgEvent)
159 | {
160 | return NULL;
161 | }
162 | }
163 |
164 | pMsgEvent->event.Reset();
165 | pMsgEvent->nRecvSize = 0;
166 | pMsgEvent->pRecvBuffer = NULL;
167 |
168 | m_msgEventMap.insert(MsgEventMap::value_type(nWaitKeyID, pMsgEvent));
169 |
170 | return pMsgEvent;
171 | }
172 | }
--------------------------------------------------------------------------------
/SysBase/SysBase/source/NTService.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/source/NTService.cpp
--------------------------------------------------------------------------------
/SysBase/SysBase/source/NTService.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | namespace SysBase
6 | {
7 | class CNTService
8 | {
9 | public: // construction/destruction
10 | // If is not set, then it defaults to .
11 | CNTService(LPCSTR lpServiceName, LPCSTR lpDisplayName = NULL, LPCSTR lpDesc = NULL);
12 | virtual ~CNTService();
13 |
14 | private: // forbidden functions
15 |
16 | CNTService( const CNTService & );
17 |
18 | CNTService & operator=( const CNTService & );
19 |
20 | public: // overridables
21 | // You have to override the following two functions.
22 | // "Run()" will be called to start the real
23 | // service's activity. You must call
24 | // ReportStatus(SERVICE_RUNNING);
25 | // before you enter your main-loop !
26 | // "Stop()" will be called to stop the work of
27 | // the service. You should break out of the mainloop
28 | // and return control to the CNTService class.
29 | //
30 | // In most cases these functions look like these:
31 | //
32 | // void CMyService :: Run(DWORD argc, LPSTR* argv) {
33 | // ReportStatus(SERVICE_START_PENDING);
34 | // // do some parameter processing ...
35 | // ReportStatus(SERVICE_START_PENDING);
36 | // // do first part of initialisation ...
37 | // ReportStatus(SERVICE_START_PENDING);
38 | // // do next part of initialisation
39 | // // ...
40 | // m_hStop = CreateEvent(0, TRUE, FALSE, 0);
41 | // ReportStatus(SERVICE_RUNNING);
42 | // while( WaitForSingleObject(m_hStop, 10) != WAIT_OBJECT_0 ) {
43 | // // do something
44 | // }
45 | // if( m_hStop )
46 | // CloseHandle(m_hStop);
47 | // }
48 | //
49 | // void CMyService :: Stop() {
50 | // if( m_hStop )
51 | // SetEvent(m_hStop);
52 | // ReportStatus(SERVICE_STOP_PENDING);
53 | // }
54 |
55 | virtual void Run(DWORD argc, LPSTR* argv) = 0;
56 |
57 | virtual void Stop() = 0;
58 |
59 | // Pause() and Continue() do nothing by default.
60 | // You can override them to handle a control request.
61 | // Pause() should report the status SERVICE_PAUSED
62 | // and Continue() should report the status SERVICE_RUNNING
63 | // (see ReportStatus() below).
64 | // Note that normally these functions will never be called. If
65 | // you want a service, that accepts PAUSE and CONTINUE control
66 | // requests, you have to to add SERVICE_ACCEPT_PAUSE_CONTINUE
67 | // to the m_dwControlsAccepted data member.
68 |
69 | virtual void Pause();
70 |
71 | virtual void Continue();
72 |
73 | // Shutdown() will be called, if the service manager
74 | // requests for the SERVICE_CONTROL_SHUTDOWN control.
75 | // This control type occurs, when the system shuts down.
76 | // If you want to process this notification, you have to
77 | // add SERVICE_ACCEPT_SHUTDOWN to the m_dwControlsAccepted
78 | // data member (and to override this function). The default
79 | // implementation of Shutdown() does nothing.
80 |
81 | virtual void Shutdown();
82 |
83 | // Call "RegisterService()" after you have constructed
84 | // a CNTService object:
85 | // A typical "main()" function of a service looks like this:
86 | //
87 | // int main( int argc, char* * argv ) {
88 | // CMyService serv;
89 | // exit(serv.RegisterService(argc, argv));
90 | // }
91 | //
92 | // Where "CMyService" is a CNTService derived class.
93 | // RegisterService() checks the parameterlist. The
94 | // following parameters will be detected:
95 | // -i install the service (calls
96 | // "InstallService()" - see below)
97 | //
98 | // -l
99 | // is the name of a user,
100 | // under which the service shall run.
101 | // This option is useful with -i only.
102 | // needs to have the advanced
103 | // user-right "Log on as a service"
104 | // (see User-Manager)
105 | // should have the following
106 | // format: "\"
107 | // "EuroS2Team\jko" for instance.
108 | // The domain "." is predefined as the
109 | // local machine. So one might use
110 | // ".\jko" too.
111 | //
112 | // -p
113 | // The password of the user, under which
114 | // the service shall run. Only useful
115 | // with -i and -l together.
116 | //
117 | // -u uninstall the service (calls
118 | // "RemoveService()" - see below)
119 | //
120 | // -d debug the service (run as console
121 | // process; calls "DebugService()"
122 | // see below)
123 | //
124 | // -e end the service (if it is running)
125 | //
126 | // -s start the service (if it is not running)
127 | // (Note that* you* normally cannot start
128 | // an NT-service from the command-line.
129 | // The SCM can.)
130 | //
131 | // Do not use -l and -p, if your service is of type
132 | // SERVICE_KERNEL_DRIVER or SERVICE_FILE_SYSTEM_DRIVER.
133 | // Furthermore you canot use -i and -s together. Instead
134 | // you have to start the command twice, first you install
135 | // the service, then you start it.
136 | // If none of the flags -i, -u, -e, -s and -d is set, then the
137 | // program starts as an NT service (only the SCM can start it
138 | // this way!).
139 | // NOTE: If UNICODE is #define'd, then and
140 | // will be ignored and the original commandline
141 | // of the program will be used to parse the
142 | // arguments !
143 |
144 | virtual BOOL RegisterService(int argc, char* * argv);
145 |
146 | // "StartDispatcher()" registers one service-procedure
147 | // to the service control dispatcher (using the predefined
148 | // "ServiceMain()" function below).
149 | // Override this funtion, if you want to develop a
150 | // multithreaded NT-Service.
151 |
152 | virtual BOOL StartDispatcher();
153 |
154 | // Override "InstallService()" to manipulate the
155 | // installation behavior.
156 | // This function will only be called, if the
157 | // "-i" flag was passed to "RegisterService()"
158 | // (see above)
159 | // After "InstallService()" has completed, you
160 | // should be able to see the service in the
161 | // "services" control-panel-applet.
162 |
163 | virtual BOOL InstallService();
164 |
165 | // RemoveService() removes a service from the system's
166 | // service-table.
167 | // It first tries to stop the service.
168 | // This function will be called only if the -u
169 | // flag was passed to the program. (see "RegisterService()"
170 | // above)
171 | // After removal of the service, it should no longer
172 | // appear in the "services" control-panel-applet.
173 |
174 | virtual BOOL RemoveService();
175 |
176 |
177 | // EndService() stops a running service (if the service
178 | // is running as a service! Does not end a service
179 | // running as a console program (see DebugService()
180 | // below))
181 |
182 | virtual BOOL EndService();
183 |
184 | // Start the service. Does the same as if the
185 | // SCM launches the program. Note that this method
186 | // will create a new instance of the program.
187 |
188 | virtual BOOL StartupService();
189 |
190 | // Run a service as a console application. This makes it
191 | // easier to debug the service.
192 | // This function will be called only if the -d flag
193 | // was passed to the program(see "RegisterService()" above).
194 | // It transparently calls "Run()". You can simulate a
195 | // stop-request by pressing either Ctrl-C or Ctrl-Break (that
196 | // will call the "Stop()" method).
197 |
198 | virtual BOOL DebugService(int argc, char* *argv,BOOL faceless = FALSE); //!! TCW MOD - added FACELESS parm to allow Win95 usage.
199 |
200 | protected: // implementation
201 | // Override "RegisterApplicationLog()", if you want to register
202 | // a different message file and/or differend supported types
203 | // than the default.
204 | // The proposed message file is the application itself.
205 | // The proposed types are:
206 | // EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | EVENTLOG_INFORMATION_TYPE
207 | // This method will be called from inside "InstallService()" (see above)
208 | // Thus if you support errors only (for instance):
209 | // void CMyService :: RegisterApplicationLog(LPCSTR filename, DWORD ) {
210 | // CNTService::RegisterApplicationLog(filename, EVENTLOG_ERROR_TYPE);
211 | // }
212 | // This method will never be called on Win95.
213 |
214 | virtual void RegisterApplicationLog(
215 | LPCSTR lpszProposedMessageFile,
216 | DWORD dwProposedTypes
217 | );
218 |
219 | // "DeregisterApplicationLog()" is called from inside "RemoveService()"
220 | // (see above) to clear the registry-entries made by
221 | // "RegisterApplicationLog()"
222 |
223 | virtual void DeregisterApplicationLog();
224 |
225 | public: // helpers
226 | // Retrieve a human-readable error message. The message
227 | // will be stored in which is of size .
228 | // Returns a pointer to .
229 |
230 | LPSTR GetLastErrorText(LPSTR Buf, DWORD Size);
231 |
232 | // report status to the service-control-manager.
233 | // can be one of:
234 | // SERVICE_START_PENDING - the service is starting
235 | // SERVICE_RUNNING - the service is running
236 | // SERVICE_STOP_PENDING - the service is stopping
237 | // SERVICE_STOPPED - the service is not running
238 | // SERVICE_PAUSE_PENDING - the service pause is pending
239 | // SERVICE_PAUSE - the service is paused
240 | // SERVICE_CONTINUE_PENDING - the service is about to continue
241 |
242 | BOOL ReportStatus(
243 | DWORD CurState, // service's state
244 | DWORD WaitHint = 3000, // expected time of operation in milliseconds
245 | DWORD ErrExit = 0 //!! TCW MOD - set to nonzero to flag* FATAL* error
246 | );
247 |
248 | // AddToMessageLog() writes a message to the application event-log.
249 | // (use EventViewer from the menu "Administrative Tools" to watch the log).
250 | // The parameter can be set to one of the following values:
251 | // EVENTLOG_ERROR_TYPE Error event
252 | // EVENTLOG_WARNING_TYPE Warning event
253 | // EVENTLOG_INFORMATION_TYPE Information event
254 | // EVENTLOG_AUDIT_SUCCESS Success Audit event
255 | // EVENTLOG_AUDIT_FAILURE Failure Audit event
256 | // See "ReportEvent()" in the help-topics for further information.
257 |
258 | virtual void AddToMessageLog(
259 | LPSTR Message,
260 | WORD EventType = EVENTLOG_ERROR_TYPE,
261 | DWORD dwEventID = DWORD(-1)
262 | );
263 |
264 | public: // default handlers
265 | // The following functions will be used by default.
266 | // You can provide other handlers. If so, you have to
267 | // overload several of the "virtual"s above.
268 |
269 | static void WINAPI ServiceCtrl(DWORD CtrlCode);
270 |
271 | static void WINAPI ServiceMain(DWORD argc, LPSTR* argv);
272 |
273 | static BOOL WINAPI ControlHandler(DWORD CtrlType);
274 |
275 | //!! TCW MOD - added console support for Faceless Apps. Needed sometimes when something goes wrong.
276 | public:
277 |
278 | BOOL ChangeService(DWORD dwServiceType);
279 |
280 | BOOL OsIsWin95() const { return ! m_bWinNT; }
281 |
282 | void SetupConsole();
283 |
284 | static CNTService* GetService();
285 |
286 | protected: // data members
287 | LPCSTR m_lpServiceName;
288 | LPCSTR m_lpDisplayName;
289 | LPCSTR m_lpDesc;
290 | DWORD m_dwCheckPoint;
291 | DWORD m_dwErr;
292 | BOOL m_bDebug; // TRUE if -d was passed to the program
293 | SERVICE_STATUS m_ssStatus; // current status of the service
294 | SERVICE_STATUS_HANDLE m_sshStatusHandle;
295 | DWORD m_dwControlsAccepted; // bit-field of what control requests the
296 | // service will accept
297 | // (dflt: SERVICE_ACCEPT_STOP)
298 | PSID m_pUserSID; // the current user's security identifier
299 | BOOL m_bWinNT; // TRUE, if this is running on WinNT FALSE on Win95
300 | BOOL m_fConsoleReady;
301 |
302 | // parameters to the "CreateService()" function:
303 | DWORD m_dwDesiredAccess; // default: SERVICE_ALL_ACCESS
304 | DWORD m_dwServiceType; // default: SERVICE_WIN32_OWN_PROCESS
305 | DWORD m_dwStartType; // default: SERVICE_AUTO_START
306 | DWORD m_dwErrorControl; // default: SERVICE_ERROR_NORMAL
307 | LPCSTR m_pszLoadOrderGroup; // default: NULL
308 | DWORD m_dwTagID; // retrieves the tag identifier
309 | LPCSTR m_pszDependencies; // default: NULL
310 | LPCSTR m_pszStartName; // default: NULL
311 | LPCSTR m_pszPassword; // default: NULL
312 |
313 | static BOOL m_bInstance; // only one CNTService object per application
314 | };
315 | }
316 |
--------------------------------------------------------------------------------
/SysBase/SysBase/source/PerformanceCounter.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/source/PerformanceCounter.cpp
--------------------------------------------------------------------------------
/SysBase/SysBase/source/Process.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/source/Process.cpp
--------------------------------------------------------------------------------
/SysBase/SysBase/source/ProcessHelper.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/source/ProcessHelper.cpp
--------------------------------------------------------------------------------
/SysBase/SysBase/source/Service.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/source/Service.cpp
--------------------------------------------------------------------------------
/SysBase/SysBase/source/ServicesHelper.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/source/ServicesHelper.cpp
--------------------------------------------------------------------------------
/SysBase/SysBase/source/SingleMgr.cpp:
--------------------------------------------------------------------------------
1 | #include "../SysBase_Interface.h"
2 |
3 | namespace SysBase
4 | {
5 | CSingleMgr::CSingleMgr()
6 | {
7 | m_pCObjectList = new(std::nothrow) list();
8 |
9 | if (!m_pCObjectList)
10 | {
11 | throw "Memory Failed !";
12 | }
13 | }
14 |
15 | CSingleMgr::~CSingleMgr()
16 | {
17 | list::iterator entity = m_pCObjectList->begin();
18 |
19 | list::iterator endEntity = m_pCObjectList->end();
20 |
21 | for ( ; entity != endEntity; ++entity)
22 | {
23 | delete* entity;
24 | * entity = NULL;
25 | }
26 |
27 | delete m_pCObjectList;
28 | }
29 |
30 | void CSingleMgr::Add(CObject* pCObject)
31 | {
32 | s_CSingleManagerInstance.m_pCObjectList->push_front(pCObject);
33 | }
34 |
35 | CSingleMgr CSingleMgr::s_CSingleManagerInstance;
36 | }
--------------------------------------------------------------------------------
/SysBase/SysBase/source/SlowFileQueue.cpp:
--------------------------------------------------------------------------------
1 | #include "../SysBase_Interface.h"
2 |
3 | namespace SysBase
4 | {
5 | CSlowFileQueue::CSlowFileQueue()
6 | {
7 |
8 | }
9 |
10 | CSlowFileQueue::~CSlowFileQueue()
11 | {
12 |
13 | }
14 |
15 | CSlowFileQueue::ERROR_CODE CSlowFileQueue::Init(const char* lpFileDir, const char* lpWirteFileName, const char* lpExtName, const char* lpName, UINT32 nBlockSize, UINT32 nMaxFileSize, UINT32 nFileLiveTime)
16 | {
17 | CSlowWriteFileQueue::ERROR_CODE errorCode_Write = m_CSlowWriteFileQueue.Init(lpFileDir, lpWirteFileName, lpExtName, lpName, nBlockSize, nMaxFileSize, nFileLiveTime);
18 |
19 | if (errorCode_Write != CSlowWriteFileQueue::ERROR_CODE_NONE)
20 | {
21 | return (CSlowFileQueue::ERROR_CODE)errorCode_Write;
22 | }
23 |
24 | CSlowReadFileQueue::ERROR_CODE errorCode_Read = m_CSlowReadFileQueue.Init(lpFileDir, lpName, nBlockSize);
25 |
26 | if (errorCode_Read != CSlowReadFileQueue::ERROR_CODE_NONE)
27 | {
28 | return (CSlowFileQueue::ERROR_CODE)errorCode_Read;
29 | }
30 |
31 | return CSlowFileQueue::ERROR_CODE_NONE;
32 | }
33 |
34 | CSlowFileQueue::ERROR_CODE CSlowFileQueue::Add(const void* pData, UINT32 nDataSize)
35 | {
36 | CSlowWriteFileQueue::ERROR_CODE errorCode = m_CSlowWriteFileQueue.Add(pData, nDataSize);
37 |
38 | if (errorCode != CSlowWriteFileQueue::ERROR_CODE_NONE)
39 | {
40 | return (CSlowFileQueue::ERROR_CODE)errorCode;
41 | }
42 |
43 | return CSlowFileQueue::ERROR_CODE_NONE;
44 | }
45 |
46 | CSlowFileQueue::ERROR_CODE CSlowFileQueue::GetData(PCHAR pBuffer, UINT32 nMaxBufferSize, UINT32& nDataSize, UINT32& nDataIndex)
47 | {
48 | CSlowReadFileQueue::ERROR_CODE errorCode = m_CSlowReadFileQueue.GetData(pBuffer, nMaxBufferSize, nDataSize, nDataIndex);
49 |
50 | if (errorCode != CSlowReadFileQueue::ERROR_CODE_NONE)
51 | {
52 | return (CSlowFileQueue::ERROR_CODE)errorCode;
53 | }
54 |
55 | return CSlowFileQueue::ERROR_CODE_NONE;
56 | }
57 |
58 | CSlowFileQueue::ERROR_CODE CSlowFileQueue::FreeData(UINT32 nDataIndex)
59 | {
60 | CSlowReadFileQueue::ERROR_CODE errorCode = m_CSlowReadFileQueue.FreeData(nDataIndex);
61 |
62 | if (errorCode != CSlowReadFileQueue::ERROR_CODE_NONE)
63 | {
64 | return (CSlowFileQueue::ERROR_CODE)errorCode;
65 | }
66 |
67 | return CSlowFileQueue::ERROR_CODE_NONE;
68 | }
69 | }
--------------------------------------------------------------------------------
/SysBase/SysBase/source/SlowReadFileQueue.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/source/SlowReadFileQueue.cpp
--------------------------------------------------------------------------------
/SysBase/SysBase/source/SlowWriteFileQueue.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/source/SlowWriteFileQueue.cpp
--------------------------------------------------------------------------------
/SysBase/SysBase/source/Socket.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/source/Socket.cpp
--------------------------------------------------------------------------------
/SysBase/SysBase/source/SocketLoader.cpp:
--------------------------------------------------------------------------------
1 | #include "../SysBase_Interface.h"
2 |
3 | namespace SysBase
4 | {
5 | //////////////////////////////////////////////////////////////////////////
6 | //CSocketLoader
7 |
8 | CSocketLoader CSocketLoader::s_CSocketLoader;
9 |
10 | BOOL CSocketLoader::bInitSocket = false;
11 |
12 | CSocketLoader::CSocketLoader()
13 | {
14 | }
15 |
16 | CSocketLoader::~CSocketLoader()
17 | {
18 | WSACleanup();
19 |
20 | CSocketLoader::bInitSocket = false;
21 | }
22 |
23 | bool CSocketLoader::InitSocket()
24 | {
25 | if (CSocketLoader::bInitSocket)
26 | {
27 | return true;
28 | }
29 |
30 | WSADATA wsaData;
31 |
32 | if (WSAStartup(MAKEWORD(2,2), &wsaData) != 0)
33 | {
34 | return false;
35 | }
36 |
37 | CSocketLoader::bInitSocket = true;
38 |
39 | return true;
40 | }
41 | }
--------------------------------------------------------------------------------
/SysBase/SysBase/source/SqlServerHelper.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/source/SqlServerHelper.cpp
--------------------------------------------------------------------------------
/SysBase/SysBase/source/StatisticsWorker.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/source/StatisticsWorker.cpp
--------------------------------------------------------------------------------
/SysBase/SysBase/source/SysEventLog.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/source/SysEventLog.cpp
--------------------------------------------------------------------------------
/SysBase/SysBase/source/SysUser.cpp:
--------------------------------------------------------------------------------
1 | #include "../SysBase_Interface.h"
2 |
3 | namespace SysBase
4 | {
5 | bool CSysUser::AddUser(TSysUserParam& aParam)
6 | {
7 | if (aParam.strUserName.length() <= 0 || aParam.strPwd.length() <= 0)
8 | {
9 | return false;
10 | }
11 |
12 | USER_INFO_2 userInfo = {0};
13 | userInfo.usri2_name = (LPWSTR)aParam.strUserName.c_str();
14 | userInfo.usri2_password = (LPWSTR)aParam.strPwd.c_str();
15 | userInfo.usri2_full_name = (LPWSTR)aParam.strFullName.c_str();
16 | userInfo.usri2_comment = (LPWSTR)aParam.strDesc.c_str();
17 | userInfo.usri2_priv = USER_PRIV_USER;
18 |
19 | if (0 == aParam.nExpiresTime)
20 | {
21 | userInfo.usri2_acct_expires = TIMEQ_FOREVER;
22 | }
23 | else
24 | {
25 | userInfo.usri2_acct_expires = (UINT32)aParam.nExpiresTime;
26 | }
27 |
28 | if (aParam.nUserFlags & AccountDisable)
29 | {
30 | userInfo.usri2_flags |= UF_ACCOUNTDISABLE;
31 | }
32 |
33 | if (aParam.nUserFlags & PwdCantChange)
34 | {
35 | userInfo.usri2_flags |= UF_PASSWD_CANT_CHANGE;
36 | }
37 |
38 | if (aParam.nUserFlags & DontExpirePwd)
39 | {
40 | userInfo.usri2_flags |= UF_DONT_EXPIRE_PASSWD;
41 | }
42 |
43 | if (aParam.nUserFlags & PwdExpired)
44 | {
45 | userInfo.usri2_flags |= UF_PASSWORD_EXPIRED;
46 | }
47 |
48 | DWORD dwError = 0;
49 | DWORD dwRes = NetUserAdd(NULL, 2, (LPBYTE)&userInfo, &dwError);
50 |
51 | if (NERR_Success != dwRes)
52 | {
53 | return false;
54 | }
55 |
56 | return true;
57 | }
58 |
59 | bool CSysUser::DeleteUser(PCWCHAR szUserName)
60 | {
61 | DWORD dwRes = NetUserDel(NULL, szUserName);
62 |
63 | if (NERR_Success == dwRes)
64 | {
65 | return true;
66 | }
67 |
68 | return false;
69 | }
70 |
71 | bool CSysUser::ChangeUserPwd(PCWCHAR szUserName, PCWCHAR szOldPwd, PCWCHAR szNewPwd, UINT32* pnErrorCode)
72 | {
73 | DWORD dwRes = NetUserChangePassword(NULL, szUserName, szOldPwd, szNewPwd);
74 |
75 | if (pnErrorCode)
76 | {
77 | *pnErrorCode = dwRes;
78 | }
79 |
80 | if (NERR_Success == dwRes)
81 | {
82 | return true;
83 | }
84 |
85 | return false;
86 | }
87 |
88 | bool CSysUser::GetUserInfo(PCWCHAR szUserName, TSysUserInfo& infoOut)
89 | {
90 | LPBYTE pBuffer = NULL;
91 |
92 | DWORD dwRes = NetUserGetInfo(NULL, szUserName, 2, &pBuffer);
93 |
94 | if (NERR_Success != dwRes)
95 | {
96 | return false;
97 | }
98 |
99 | USER_INFO_2* pUserInfo = (USER_INFO_2*)pBuffer;
100 |
101 | infoOut.strUserName = szUserName;
102 |
103 | if (pUserInfo->usri2_full_name)
104 | {
105 | infoOut.strFullName = pUserInfo->usri2_full_name;
106 | }
107 |
108 | if (pUserInfo->usri2_comment)
109 | {
110 | infoOut.strDesc = pUserInfo->usri2_comment;
111 | }
112 |
113 | infoOut.nPwdAge = pUserInfo->usri2_password_age;
114 | infoOut.nPrivilege = pUserInfo->usri2_priv;
115 | infoOut.nUserFlags = pUserInfo->usri2_flags;
116 | infoOut.nLastLogonTime = pUserInfo->usri2_last_logon;
117 | infoOut.nExpiresTime = pUserInfo->usri2_acct_expires;
118 | infoOut.nBadPwdCount = pUserInfo->usri2_bad_pw_count;
119 | infoOut.nLogonCount = pUserInfo->usri2_num_logons;
120 |
121 | if (pBuffer)
122 | {
123 | NetApiBufferFree(pBuffer);
124 | pBuffer = NULL;
125 | }
126 |
127 | return true;
128 | }
129 |
130 | bool CSysUser::SetUserInfo(TSysUserInfo& aParam)
131 | {
132 | return CSysUser::SetUserInfo(aParam.strUserName.c_str(), aParam);
133 | }
134 |
135 | bool CSysUser::SetUserInfo(PCWCHAR szUserName, TSysUserInfo& aParam)
136 | {
137 | if (aParam.strUserName.length() <= 0)
138 | {
139 | return false;
140 | }
141 |
142 | LPBYTE pBuffer = NULL;
143 |
144 | DWORD dwRes = NetUserGetInfo(NULL, szUserName, 2, &pBuffer);
145 |
146 | USER_INFO_2* pUserInfo = (USER_INFO_2*)pBuffer;
147 | pUserInfo->usri2_name = (LPWSTR)aParam.strUserName.c_str();
148 | pUserInfo->usri2_full_name = (LPWSTR)aParam.strFullName.c_str();
149 | pUserInfo->usri2_comment = (LPWSTR)aParam.strDesc.c_str();
150 |
151 | if (0 == aParam.nExpiresTime)
152 | {
153 | pUserInfo->usri2_acct_expires = TIMEQ_FOREVER;
154 | }
155 | else
156 | {
157 | pUserInfo->usri2_acct_expires = (UINT32)aParam.nExpiresTime;
158 | }
159 |
160 | DWORD dwNewFlag = 0;
161 |
162 | if (aParam.nUserFlags & AccountDisable)
163 | {
164 | dwNewFlag |= UF_ACCOUNTDISABLE;
165 | }
166 |
167 | if (aParam.nUserFlags & PwdCantChange)
168 | {
169 | dwNewFlag |= UF_PASSWD_CANT_CHANGE;
170 | }
171 |
172 | if (aParam.nUserFlags & DontExpirePwd)
173 | {
174 | dwNewFlag |= UF_DONT_EXPIRE_PASSWD;
175 | }
176 |
177 | if (aParam.nUserFlags & PwdExpired)
178 | {
179 | dwNewFlag |= UF_PASSWORD_EXPIRED;
180 | }
181 |
182 | pUserInfo->usri2_flags = dwNewFlag;
183 |
184 | dwRes = NetUserSetInfo(NULL, szUserName, 2, (LPBYTE)pUserInfo, NULL);
185 |
186 | if (pBuffer)
187 | {
188 | NetApiBufferFree(pBuffer);
189 | pBuffer = NULL;
190 | }
191 |
192 | if (NERR_Success == dwRes)
193 | {
194 | return true;
195 | }
196 |
197 | return false;
198 | }
199 |
200 | bool CSysUser::GetUserAll(list& infoList)
201 | {
202 | LPBYTE pBuf = NULL;
203 | LPUSER_INFO_2 pUserInfo = NULL;
204 | DWORD dwLevel = 2;
205 | DWORD dwPrefMaxLen = MAX_PREFERRED_LENGTH;
206 | DWORD dwEntriesRead = 0;
207 | DWORD dwTotalEntries = 0;
208 | DWORD dwResumeHandle = 0;
209 | DWORD dwIndex;
210 |
211 | bool bSuccess = true;
212 | NET_API_STATUS nStatus = NERR_Success;
213 |
214 | do
215 | {
216 | nStatus = NetUserEnum(
217 | NULL,
218 | dwLevel,
219 | FILTER_NORMAL_ACCOUNT,
220 | &pBuf,
221 | dwPrefMaxLen,
222 | &dwEntriesRead,
223 | &dwTotalEntries,
224 | &dwResumeHandle);
225 |
226 | if ((nStatus == NERR_Success) || (nStatus == ERROR_MORE_DATA))
227 | {
228 | if ((pUserInfo = (LPUSER_INFO_2)pBuf) != NULL)
229 | {
230 | for (dwIndex = 0; (dwIndex < dwEntriesRead); dwIndex++)
231 | {
232 | TSysUserInfo userInfo;
233 | userInfo.strUserName = pUserInfo->usri2_name;
234 |
235 | if (pUserInfo->usri2_full_name)
236 | {
237 | userInfo.strFullName = pUserInfo->usri2_full_name;
238 | }
239 |
240 | if (pUserInfo->usri2_comment)
241 | {
242 | userInfo.strDesc = pUserInfo->usri2_comment;
243 | }
244 |
245 | userInfo.nPwdAge = pUserInfo->usri2_password_age;
246 | userInfo.nPrivilege = pUserInfo->usri2_priv;
247 | userInfo.nUserFlags = pUserInfo->usri2_flags;
248 | userInfo.nLastLogonTime = pUserInfo->usri2_last_logon;
249 | userInfo.nExpiresTime = pUserInfo->usri2_acct_expires;
250 | userInfo.nBadPwdCount = pUserInfo->usri2_bad_pw_count;
251 | userInfo.nLogonCount = pUserInfo->usri2_num_logons;
252 |
253 | infoList.push_back(userInfo);
254 |
255 | pUserInfo++;
256 | }
257 | }
258 | else
259 | {
260 | bSuccess = false;
261 | break;
262 | }
263 | }
264 | else
265 | {
266 | bSuccess = false;
267 | break;
268 | }
269 |
270 | if (pBuf)
271 | {
272 | NetApiBufferFree(pBuf);
273 | pBuf = NULL;
274 | }
275 | }
276 | while (nStatus == ERROR_MORE_DATA);
277 |
278 | if (pBuf)
279 | {
280 | NetApiBufferFree(pBuf);
281 | }
282 |
283 | return bSuccess;
284 | }
285 |
286 | bool CSysUser::GetGroupAllByUser(PCWCHAR szUserName, list& groupList)
287 | {
288 | LPLOCALGROUP_USERS_INFO_0 pGroupInfo = NULL;
289 | DWORD dwEntriesRead = 0;
290 | DWORD dwTotalEntries = 0;
291 |
292 | DWORD dwRes = NetUserGetLocalGroups(NULL, szUserName, 0, LG_INCLUDE_INDIRECT, (LPBYTE*)&pGroupInfo,
293 | MAX_PREFERRED_LENGTH, &dwEntriesRead, &dwTotalEntries);
294 |
295 | if (NERR_Success != dwRes)
296 | {
297 | if (pGroupInfo)
298 | {
299 | NetApiBufferFree(pGroupInfo);
300 | pGroupInfo = NULL;
301 | }
302 |
303 | return false;
304 | }
305 |
306 | LPLOCALGROUP_USERS_INFO_0 pGroupInfoTemp = pGroupInfo;
307 |
308 | DWORD dwIndex = 0;
309 | for (dwIndex = 0; dwIndex < dwEntriesRead; ++dwIndex)
310 | {
311 | groupList.push_back(pGroupInfoTemp->lgrui0_name);
312 |
313 | pGroupInfoTemp++;
314 | }
315 |
316 | if (pGroupInfo)
317 | {
318 | NetApiBufferFree(pGroupInfo);
319 | pGroupInfo = NULL;
320 | }
321 |
322 | return true;
323 | }
324 | }
--------------------------------------------------------------------------------
/SysBase/SysBase/source/SystemInfo.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/source/SystemInfo.cpp
--------------------------------------------------------------------------------
/SysBase/SysBase/source/SystemNetInfo.cpp:
--------------------------------------------------------------------------------
1 | #include "../SysBase_Interface.h"
2 | #include
3 | #include
4 |
5 | #pragma comment(lib, "Iphlpapi.lib")
6 |
7 | namespace SysBase
8 | {
9 | CSystemNetInfo::CSystemNetInfo()
10 | {
11 |
12 | }
13 |
14 | CSystemNetInfo::~CSystemNetInfo()
15 | {
16 |
17 | }
18 |
19 | bool CSystemNetInfo::GetTcpNetInfoList(list& tcpNetInfoList )
20 | {
21 | char szBuffer[1024 * 128] = {0};
22 | DWORD dwSize = 1024 * 128;
23 |
24 | DWORD dwError = GetExtendedTcpTable(szBuffer, &dwSize, TRUE, AF_INET,
25 | TCP_TABLE_OWNER_PID_ALL, NULL);
26 |
27 | if (NO_ERROR == dwError)
28 | {
29 | PMIB_TCPTABLE_OWNER_PID pTcpTable = (PMIB_TCPTABLE_OWNER_PID)szBuffer;
30 |
31 | for (DWORD dwIndex = 0; dwIndex < pTcpTable->dwNumEntries; ++dwIndex)
32 | {
33 | PMIB_TCPROW_OWNER_PID pTcpRow = &pTcpTable->table[dwIndex];
34 |
35 | if (pTcpRow->dwOwningPid > 0)
36 | {
37 | TTcpNetInfo aTTcpNetInfo = {0};
38 | aTTcpNetInfo.nProcessID = pTcpRow->dwOwningPid;
39 | aTTcpNetInfo.nStatus = pTcpRow->dwState;
40 | aTTcpNetInfo.nLocalIP = pTcpRow->dwLocalAddr;
41 | aTTcpNetInfo.nLocalPort = ntohs((UINT16)pTcpRow->dwLocalPort);
42 | aTTcpNetInfo.nRemoteIP = pTcpRow->dwRemoteAddr;
43 | aTTcpNetInfo.nRemotePort = ntohs((UINT16)pTcpRow->dwRemotePort);
44 |
45 | tcpNetInfoList.push_back(aTTcpNetInfo);
46 | }
47 | }
48 | }
49 | else if (ERROR_INSUFFICIENT_BUFFER == dwError)
50 | {
51 | char* pBuffer = new(std::nothrow) char[dwSize];
52 |
53 | if (!pBuffer)
54 | {
55 | return false;
56 | }
57 |
58 | DWORD dwError = GetExtendedTcpTable(pBuffer, &dwSize, TRUE, AF_INET,
59 | TCP_TABLE_OWNER_PID_ALL, NULL);
60 |
61 | PMIB_TCPTABLE_OWNER_PID pTcpTable = (PMIB_TCPTABLE_OWNER_PID)pBuffer;
62 |
63 | for (DWORD dwIndex = 0; dwIndex < pTcpTable->dwNumEntries; ++dwIndex)
64 | {
65 | PMIB_TCPROW_OWNER_PID pTcpRow = &pTcpTable->table[dwIndex];
66 |
67 | if (pTcpRow->dwOwningPid > 0)
68 | {
69 | TTcpNetInfo aTTcpNetInfo = {0};
70 | aTTcpNetInfo.nProcessID = pTcpRow->dwOwningPid;
71 | aTTcpNetInfo.nStatus = pTcpRow->dwState;
72 | aTTcpNetInfo.nLocalIP = pTcpRow->dwLocalAddr;
73 | aTTcpNetInfo.nLocalPort = ntohs((UINT16)pTcpRow->dwLocalPort);
74 | aTTcpNetInfo.nRemoteIP = pTcpRow->dwRemoteAddr;
75 | aTTcpNetInfo.nRemotePort = ntohs((UINT16)pTcpRow->dwRemotePort);
76 |
77 | tcpNetInfoList.push_back(aTTcpNetInfo);
78 | }
79 | }
80 |
81 | delete[] pBuffer;
82 | pBuffer = NULL;
83 | }
84 |
85 | return dwError == NO_ERROR ? true : false;
86 | }
87 |
88 | bool CSystemNetInfo::GetUdpNetInfoList(list& udpNetInfoList)
89 | {
90 | char szBuffer[1024 * 64] = {0};
91 | DWORD dwSize = 1024 * 64;
92 |
93 | DWORD dwError = GetExtendedUdpTable(szBuffer, &dwSize, TRUE, AF_INET,
94 | UDP_TABLE_OWNER_PID, NULL);
95 |
96 | if (NO_ERROR == dwError)
97 | {
98 | PMIB_UDPTABLE_OWNER_PID pUdpTable = (PMIB_UDPTABLE_OWNER_PID)szBuffer;
99 |
100 | for (DWORD dwIndex = 0; dwIndex < pUdpTable->dwNumEntries; ++dwIndex)
101 | {
102 | PMIB_UDPROW_OWNER_PID pUdpRow = &pUdpTable->table[dwIndex];
103 |
104 | if (pUdpRow->dwOwningPid > 0)
105 | {
106 | TUdpNetInfo aTUdpNetInfo = {0};
107 | aTUdpNetInfo.nProcessID = pUdpRow->dwOwningPid;
108 | aTUdpNetInfo.nLocalIP = pUdpRow->dwLocalAddr;
109 | aTUdpNetInfo.nLocalPort = ntohs((UINT16)pUdpRow->dwLocalPort);
110 |
111 | udpNetInfoList.push_back(aTUdpNetInfo);
112 | }
113 | }
114 | }
115 | else if (ERROR_INSUFFICIENT_BUFFER == dwError)
116 | {
117 | char* pBuffer = new(std::nothrow) char[dwSize];
118 |
119 | if (!pBuffer)
120 | {
121 | return false;
122 | }
123 |
124 | DWORD dwError = GetExtendedUdpTable(pBuffer, &dwSize, TRUE, AF_INET,
125 | UDP_TABLE_OWNER_PID, NULL);
126 |
127 | PMIB_UDPTABLE_OWNER_PID pUdpTable = (PMIB_UDPTABLE_OWNER_PID)pBuffer;
128 |
129 | for (DWORD dwIndex = 0; dwIndex < pUdpTable->dwNumEntries; ++dwIndex)
130 | {
131 | PMIB_UDPROW_OWNER_PID pUdpRow = &pUdpTable->table[dwIndex];
132 |
133 | if (pUdpRow->dwOwningPid > 0)
134 | {
135 | TUdpNetInfo aTUdpNetInfo = {0};
136 | aTUdpNetInfo.nProcessID = pUdpRow->dwOwningPid;
137 | aTUdpNetInfo.nLocalIP = pUdpRow->dwLocalAddr;
138 | aTUdpNetInfo.nLocalPort = ntohs((UINT16)pUdpRow->dwLocalPort);
139 |
140 | udpNetInfoList.push_back(aTUdpNetInfo);
141 | }
142 | }
143 |
144 | delete[] pBuffer;
145 | pBuffer = NULL;
146 | }
147 |
148 | return dwError == NO_ERROR ? true : false;
149 | }
150 | }
--------------------------------------------------------------------------------
/SysBase/SysBase/source/SystemPerformanceCollecter.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/source/SystemPerformanceCollecter.cpp
--------------------------------------------------------------------------------
/SysBase/SysBase/source/SystemShutdown.cpp:
--------------------------------------------------------------------------------
1 | #include "../SysBase_Interface.h"
2 |
3 | namespace SysBase
4 | {
5 |
6 |
7 |
8 | bool CSystemShutdown::ExitSystem(UINT32 nFlags)
9 | {
10 | UINT32 sourceFlags = 0;
11 |
12 | if (nFlags & EXIT_FLAG_LOGOFF)
13 | {
14 | sourceFlags |= EWX_LOGOFF;
15 | }
16 |
17 | if (nFlags & EXIT_FLAG_POWER_OFF)
18 | {
19 | sourceFlags |= EWX_POWEROFF;
20 | }
21 |
22 | if (nFlags & EXIT_FLAG_REBOOT)
23 | {
24 | sourceFlags |= EWX_REBOOT;
25 | }
26 |
27 | if (nFlags & EXIT_FLAG_SHUTDOWN)
28 | {
29 | sourceFlags |= EWX_SHUTDOWN;
30 | }
31 |
32 | sourceFlags |= EWX_FORCE;
33 |
34 | HANDLE hToken = INVALID_HANDLE_VALUE;
35 | TOKEN_PRIVILEGES tokenPrivileges = {0};
36 |
37 | // Get a token for this process.
38 | if (!OpenProcessToken(GetCurrentProcess(),
39 | TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))
40 | {
41 | return false;
42 | }
43 |
44 | // Get the LUID for the shutdown privilege.
45 | if (!LookupPrivilegeValueA(NULL, SE_SHUTDOWN_NAME,
46 | &tokenPrivileges.Privileges[0].Luid))
47 | {
48 | return false;
49 | }
50 |
51 | tokenPrivileges.PrivilegeCount = 1; // one privilege to set
52 | tokenPrivileges.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
53 |
54 | // Get the shutdown privilege for this process.
55 | if (!AdjustTokenPrivileges(hToken, FALSE, &tokenPrivileges, 0,
56 | (PTOKEN_PRIVILEGES)NULL, 0))
57 | {
58 | return false;
59 | }
60 |
61 | return ExitWindowsEx(nFlags, SHTDN_REASON_FLAG_PLANNED) ? true : false;
62 | }
63 |
64 | bool CSystemShutdown::ShutdownSystem(PCWCHAR szMsg, UINT32 nTimeout, bool bForceAppsClosed, bool bRebootAfterShutdown)
65 | {
66 | HANDLE hToken = INVALID_HANDLE_VALUE;
67 | TOKEN_PRIVILEGES tokenPrivileges = {0};
68 |
69 | // Get a token for this process.
70 | if (!OpenProcessToken(GetCurrentProcess(),
71 | TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))
72 | {
73 | return false;
74 | }
75 |
76 | // Get the LUID for the shutdown privilege.
77 | if (!LookupPrivilegeValueA(NULL, SE_SHUTDOWN_NAME,
78 | &tokenPrivileges.Privileges[0].Luid))
79 | {
80 | return false;
81 | }
82 |
83 | tokenPrivileges.PrivilegeCount = 1; // one privilege to set
84 | tokenPrivileges.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
85 |
86 | // Get the shutdown privilege for this process.
87 | if (!AdjustTokenPrivileges(hToken, FALSE, &tokenPrivileges, 0,
88 | (PTOKEN_PRIVILEGES)NULL, 0))
89 | {
90 | return false;
91 | }
92 |
93 | return InitiateSystemShutdownExW(NULL, (LPWSTR)szMsg, nTimeout, bForceAppsClosed, bRebootAfterShutdown, SHTDN_REASON_FLAG_PLANNED) ? true : false;
94 | }
95 |
96 | bool CSystemShutdown::CancelShutdown()
97 | {
98 | return AbortSystemShutdown(NULL) ? true : false;
99 | }
100 |
101 | bool CSystemShutdown::LockSystem()
102 | {
103 | return LockWorkStation() ? true : false;
104 | }
105 | }
--------------------------------------------------------------------------------
/SysBase/SysBase/source/SystemTime.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/source/SystemTime.cpp
--------------------------------------------------------------------------------
/SysBase/SysBase/source/TcpClient.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/source/TcpClient.cpp
--------------------------------------------------------------------------------
/SysBase/SysBase/source/TcpMultiClient.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/source/TcpMultiClient.cpp
--------------------------------------------------------------------------------
/SysBase/SysBase/source/TcpServer.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/source/TcpServer.cpp
--------------------------------------------------------------------------------
/SysBase/SysBase/source/TcpSocket.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/source/TcpSocket.cpp
--------------------------------------------------------------------------------
/SysBase/SysBase/source/Thread.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/source/Thread.cpp
--------------------------------------------------------------------------------
/SysBase/SysBase/source/ThreadSync.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/source/ThreadSync.cpp
--------------------------------------------------------------------------------
/SysBase/SysBase/source/Utility.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/source/Utility.cpp
--------------------------------------------------------------------------------
/SysBase/SysBase/source/WAdvancedFirewall.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/source/WAdvancedFirewall.cpp
--------------------------------------------------------------------------------
/SysBase/SysBase/source/WUpdateAgent.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/SysBase/SysBase/source/WUpdateAgent.cpp
--------------------------------------------------------------------------------
/demo/DemoServer/DemoServer.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("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DemoServer", "DemoServer\DemoServer.vcxproj", "{3E4D323F-E8CC-42D9-BA84-ABA7781FB30A}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {3E4D323F-E8CC-42D9-BA84-ABA7781FB30A}.Debug|x64.ActiveCfg = Debug|x64
17 | {3E4D323F-E8CC-42D9-BA84-ABA7781FB30A}.Debug|x64.Build.0 = Debug|x64
18 | {3E4D323F-E8CC-42D9-BA84-ABA7781FB30A}.Debug|x86.ActiveCfg = Debug|Win32
19 | {3E4D323F-E8CC-42D9-BA84-ABA7781FB30A}.Debug|x86.Build.0 = Debug|Win32
20 | {3E4D323F-E8CC-42D9-BA84-ABA7781FB30A}.Release|x64.ActiveCfg = Release|x64
21 | {3E4D323F-E8CC-42D9-BA84-ABA7781FB30A}.Release|x64.Build.0 = Release|x64
22 | {3E4D323F-E8CC-42D9-BA84-ABA7781FB30A}.Release|x86.ActiveCfg = Release|Win32
23 | {3E4D323F-E8CC-42D9-BA84-ABA7781FB30A}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/demo/DemoServer/DemoServer/Config/system.ini:
--------------------------------------------------------------------------------
1 | [System]
2 | IP=0.0.0.0
3 | Port=54330
4 | MaxConnectCount=100
5 | RecvBufferSize=20480
6 | RecvBufferCount=5000
7 | SendBufferSize=20480
8 | SendBufferCount=1000
9 | KeepAliveTimeSecond=30
10 | LogLevel=3
11 | IsOnStatLog=1
12 | WorkThreadCount=5
13 | ReloadTimeSecond=900
--------------------------------------------------------------------------------
/demo/DemoServer/DemoServer/DS_AppService.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/demo/DemoServer/DemoServer/DS_AppService.cpp
--------------------------------------------------------------------------------
/demo/DemoServer/DemoServer/DS_AppService.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/demo/DemoServer/DemoServer/DS_AppService.h
--------------------------------------------------------------------------------
/demo/DemoServer/DemoServer/DS_Common.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/demo/DemoServer/DemoServer/DS_Common.h
--------------------------------------------------------------------------------
/demo/DemoServer/DemoServer/DS_Config.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/demo/DemoServer/DemoServer/DS_Config.cpp
--------------------------------------------------------------------------------
/demo/DemoServer/DemoServer/DS_Config.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/demo/DemoServer/DemoServer/DS_Config.h
--------------------------------------------------------------------------------
/demo/DemoServer/DemoServer/DS_ConfigMoniter.cpp:
--------------------------------------------------------------------------------
1 | #include "DS_ConfigMoniter.h"
2 | #include "DS_Config.h"
3 | #include "DS_Log.h"
4 | #include "DS_ReloadThread.h"
5 |
6 | namespace EM
7 | {
8 | CConfigMoniter::CConfigMoniter()
9 | {
10 | m_bStop = true;
11 | }
12 |
13 | CConfigMoniter::~CConfigMoniter()
14 | {
15 | this->Stop();
16 | }
17 |
18 | bool CConfigMoniter::Start()
19 | {
20 | if (!m_bStop)
21 | {
22 | return true;
23 | }
24 |
25 | TFileMonitorWorkerParam aParam;
26 |
27 | aParam.pHandler = this;
28 | aParam.bIsMonitorLastWrite = true;
29 | aParam.SetFileName(CConfig::Instance().GetFilePath());
30 |
31 | if (!m_worker.Start(aParam))
32 | {
33 | LOG_WRITE(LOG_KEY_SYSTEM, CLog::LOG_LEVEL_ERROR, "CConfigMoniter::Start start worker failed !");
34 |
35 | return false;
36 | }
37 |
38 | return true;
39 | }
40 |
41 | void CConfigMoniter::Stop()
42 | {
43 | if (m_bStop)
44 | {
45 | return;
46 | }
47 |
48 | m_bStop = TRUE;
49 |
50 | m_stopEvent.Set();
51 |
52 | m_worker.Stop();
53 | }
54 |
55 | void CConfigMoniter::OnChanged(bool bChangeSize, bool bChangeAttributes, bool bChangeLastWrite)
56 | {
57 | if (bChangeLastWrite)
58 | {
59 | CConfig::Instance().Reload();
60 |
61 | CLogLoader::ResetLogLevelFromConfig();
62 |
63 | CReloadThread::Instance().ReloadNow();
64 | }
65 | }
66 |
67 | }
--------------------------------------------------------------------------------
/demo/DemoServer/DemoServer/DS_ConfigMoniter.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "DS_Common.h"
4 |
5 | namespace EM
6 | {
7 | class CConfigMoniter : public CSingletonT, public IFileMonitorWorkerHandler
8 | {
9 | public:
10 |
11 | CConfigMoniter();
12 |
13 | virtual ~CConfigMoniter();
14 |
15 | bool Start();
16 |
17 | void Stop();
18 |
19 | protected:
20 |
21 | void OnChanged(bool bChangeSize, bool bChangeAttributes, bool bChangeLastWrite);
22 |
23 | private:
24 |
25 | bool m_bStop;
26 |
27 | CEvent m_stopEvent;
28 |
29 | CFileMonitorWorker m_worker;
30 | };
31 | }
--------------------------------------------------------------------------------
/demo/DemoServer/DemoServer/DS_ContentHandler.cpp:
--------------------------------------------------------------------------------
1 | #include "DS_ContentHandler.h"
2 | #include "DS_Config.h"
3 |
4 | namespace EM
5 | {
6 | CContentHandler::CContentHandler()
7 | {
8 | m_pSendBuffer = new(std::nothrow) CHAR[CConfig::Instance().GetSendBufferSize()];
9 | }
10 |
11 | CContentHandler::~CContentHandler()
12 | {
13 |
14 | }
15 |
16 | bool CContentHandler::ProcData(TSocketInfo* pTSocketInfo, const char* pData)
17 | {
18 | PDS_HEAD pHaed = (PDS_HEAD)pData;
19 |
20 | switch (pHaed->sCmd)
21 | {
22 | case DS_CMD_KEEP_ALIVE:
23 | {
24 | this->ProcKeepAliveReq(pTSocketInfo, pData);
25 | }
26 | break;
27 | default:
28 | {
29 | this->ProcUnkownReq(pTSocketInfo, pData);
30 | }
31 | break;
32 | }
33 |
34 | return true;
35 | }
36 | }
--------------------------------------------------------------------------------
/demo/DemoServer/DemoServer/DS_ContentHandler.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "DS_Common.h"
4 |
5 | namespace EM
6 | {
7 | class CContentHandler
8 | {
9 | public:
10 |
11 | CContentHandler();
12 |
13 | virtual ~CContentHandler();
14 |
15 | bool ProcData(TSocketInfo* pTSocketInfo, const char* pData);
16 |
17 | //////////////////////////////////////////////////////////////////////////
18 |
19 | void ProcUnkownReq(TSocketInfo* pTSocketInfo, const char* pData);
20 |
21 | void ProcKeepAliveReq(TSocketInfo* pTSocketInfo, const char* pData);
22 |
23 | //////////////////////////////////////////////////////////////////////////
24 |
25 | private:
26 |
27 | PCHAR m_pSendBuffer;
28 |
29 | };
30 | }
--------------------------------------------------------------------------------
/demo/DemoServer/DemoServer/DS_ContentHandler_BL.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/demo/DemoServer/DemoServer/DS_ContentHandler_BL.cpp
--------------------------------------------------------------------------------
/demo/DemoServer/DemoServer/DS_Log.cpp:
--------------------------------------------------------------------------------
1 | #include "DS_Log.h"
2 | #include "DS_Config.h"
3 |
4 | namespace EM
5 | {
6 | CLogLoader::CLogLoader()
7 | {
8 |
9 | }
10 |
11 | CLogLoader::~CLogLoader()
12 | {
13 |
14 | }
15 |
16 | void CLogLoader::Init()
17 | {
18 | CAppInfo appInfo;
19 |
20 | char szFilePath[MAX_PATH] = {0};
21 |
22 | sprintf_s(szFilePath, MAX_PATH, "%s\\Log\\System\\System.log", appInfo.GetAppDirectory());
23 |
24 | LOG_INIT(LOG_KEY_SYSTEM, szFilePath, CLog::LOG_LEVEL_INFO);
25 |
26 | LOG_WRITE(LOG_KEY_SYSTEM, CLog::LOG_LEVEL_INFO, "CLogLoader::CLogLoader AppVersion:%d", APP_VER);
27 |
28 | sprintf_s(szFilePath, MAX_PATH, "%s\\Log\\Client\\Client.log", appInfo.GetAppDirectory());
29 |
30 | LOG_INIT(LOG_KEY_CLIENT, szFilePath, CLog::LOG_LEVEL_INFO);
31 |
32 | LOG_WRITE(LOG_KEY_CLIENT, CLog::LOG_LEVEL_INFO, "CLogLoader::CLogLoader AppVersion:%d", APP_VER);
33 |
34 | sprintf_s(szFilePath, MAX_PATH, "%s\\Log\\Statistics\\Statistics.log", appInfo.GetAppDirectory());
35 |
36 | LOG_INIT(LOG_KEY_STATISTICS, szFilePath, CLog::LOG_LEVEL_INFO);
37 |
38 | LOG_WRITE(LOG_KEY_STATISTICS, CLog::LOG_LEVEL_INFO, "CLogLoader::CLogLoader AppVersion:%d", APP_VER);
39 | }
40 |
41 | void CLogLoader::ResetLogLevelFromConfig()
42 | {
43 | LOG_SET_LEVEL(LOG_KEY_SYSTEM, (CLog::LOG_LEVEL)CConfig::Instance().GetLogLevel());
44 |
45 | if (CConfig::Instance().GetIsOnStatLog())
46 | {
47 | LOG_SET_LEVEL(LOG_KEY_STATISTICS, CLog::LOG_LEVEL_INFO);
48 | }
49 | else
50 | {
51 | LOG_SET_LEVEL(LOG_KEY_STATISTICS, CLog::LOG_LEVEL_NONE);
52 | }
53 |
54 | LOG_SET_LEVEL(LOG_KEY_CLIENT, (CLog::LOG_LEVEL)CConfig::Instance().GetLogLevel());
55 | }
56 | }
--------------------------------------------------------------------------------
/demo/DemoServer/DemoServer/DS_Log.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/demo/DemoServer/DemoServer/DS_Log.h
--------------------------------------------------------------------------------
/demo/DemoServer/DemoServer/DS_NetServer.cpp:
--------------------------------------------------------------------------------
1 | #include "DS_NetServer.h"
2 | #include "DS_Config.h"
3 | #include "DS_WorkThread.h"
4 | #include "DS_StatisticsThread.h"
5 |
6 | namespace EM
7 | {
8 | CNetServer::CNetServer()
9 | {
10 |
11 | }
12 |
13 | CNetServer::~CNetServer()
14 | {
15 | this->Stop();
16 | }
17 |
18 | bool CNetServer::Start()
19 | {
20 | THWCpuInfo aCpuInfo = {0};
21 |
22 | CHWCpu::GetCpuInfo(aCpuInfo);
23 |
24 | if (ERROR_CODE_SUCCESS != m_server.Start(this,
25 | CSocketAddr::ToDwordIP(CConfig::Instance().GetLocalIP()),
26 | CConfig::Instance().GetPort(),
27 | CConfig::Instance().GetMaxConnectCount(),
28 | aCpuInfo.nLogicalProcessorCount,
29 | CConfig::Instance().GetRecvBufferSize(),
30 | CConfig::Instance().GetSendBufferSize(),
31 | CConfig::Instance().GetSendBufferCount(),
32 | CTcpServer::KEEP_ALIVE_TYPE_DATA,
33 | CConfig::Instance().GetKeeAliveTimeSecond() * 1000))
34 | {
35 | return false;
36 | }
37 |
38 | return true;
39 | }
40 |
41 | void CNetServer::Stop()
42 | {
43 | m_server.Stop();
44 | }
45 |
46 | void CNetServer::Send(
47 | UINT32 nSocketID,
48 | const void* pData,
49 | UINT32 nDataSize)
50 | {
51 | m_server.Send(nSocketID, pData, nDataSize);
52 |
53 | CStatisticsThread::Instance().Increment(CStatisticsThread::ESS_SEND_COUNT);
54 | }
55 |
56 | void CNetServer::CloseSocket(UINT32 nSocketID)
57 | {
58 | m_server.CloseSocket(nSocketID);
59 | }
60 |
61 | UINT32 CNetServer::GetSocketCount()
62 | {
63 | return m_server.GetSocketCount();
64 | }
65 |
66 | UINT32 CNetServer::GetHeadSize()
67 | {
68 | return sizeof(DS_HEAD);
69 | }
70 |
71 | UINT32 CNetServer::GetMsgSize(const char* pData, UINT32 nDataSize)
72 | {
73 | PDS_HEAD pHead = (PDS_HEAD)pData;
74 |
75 | return pHead->nSize;
76 | }
77 |
78 | bool CNetServer::OnAccepted(CTcpServer* pCTcpServer, UINT32 nSocketID, UINT32 nIP, UINT16 nPort)
79 | {
80 | char szIP[50] = {0};
81 |
82 | CSocketAddr::ToStringIP(szIP, 50, nIP);
83 |
84 | LOG_WRITE(LOG_KEY_CLIENT, CLog::LOG_LEVEL_INFO, "CNetServer::OnAccepted SocketID:%lu, IP:%s, Post:%hu", nSocketID, szIP, nPort);
85 |
86 | return true;
87 | }
88 |
89 | void CNetServer::OnAcceptedError(CTcpServer* pCTcpServer, UINT32 nIP, UINT16 nPort, ERROR_CODE errorCode)
90 | {
91 | char szIP[50] = {0};
92 |
93 | CSocketAddr::ToStringIP(szIP, 50, nIP);
94 |
95 | LOG_WRITE(LOG_KEY_CLIENT, CLog::LOG_LEVEL_ERROR, "CNetServer::OnAcceptedError IP:%s, Post:%hu, ErrocCode:%d", szIP, nPort, (int)errorCode);
96 | }
97 |
98 | void CNetServer::OnReceived(CTcpServer* pCTcpServer, UINT32 nSocketID, UINT32 nIP, UINT16 nPort, const char* pData, UINT nDataSize)
99 | {
100 | CStatisticsThread::Instance().Increment(CStatisticsThread::ESS_RECV_COUNT);
101 |
102 | CWorkThread::Instance().AddData(nSocketID, nIP, nPort, pData, nDataSize);
103 | }
104 |
105 | void CNetServer::OnClosed(CTcpServer* pCTcpServer, UINT32 nSocketID, UINT32 nIP, UINT16 nPort, ERROR_CODE errorCode)
106 | {
107 | char szIP[50] = {0};
108 |
109 | CSocketAddr::ToStringIP(szIP, 50, nIP);
110 |
111 | LOG_WRITE(LOG_KEY_CLIENT, CLog::LOG_LEVEL_INFO, "CNetServer::OnClosed SocketID:%lu, IP:%s, Post:%hu, ErrocCode:%d", nSocketID, szIP, nPort, (int)errorCode);
112 | }
113 | }
--------------------------------------------------------------------------------
/demo/DemoServer/DemoServer/DS_NetServer.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "DS_Common.h"
4 |
5 | namespace EM
6 | {
7 | class CNetServer : public CSingletonT, public ITcpServerHandler
8 | {
9 | public:
10 |
11 | CNetServer();
12 |
13 | virtual ~CNetServer();
14 |
15 | bool Start();
16 |
17 | void Stop();
18 |
19 | void Send(
20 | UINT32 nSocketID,
21 | const void* pData,
22 | UINT32 nDataSize);
23 |
24 | void CloseSocket(UINT32 nSocketID);
25 |
26 | UINT32 GetSocketCount();
27 |
28 | protected:
29 |
30 | virtual UINT32 GetHeadSize();
31 |
32 | virtual UINT32 GetMsgSize(const char* pData, UINT32 nDataSize);
33 |
34 | virtual bool OnAccepted(CTcpServer* pCTcpServer, UINT32 nSocketID, UINT32 nIP, UINT16 nPort);
35 |
36 | virtual void OnAcceptedError(CTcpServer* pCTcpServer, UINT32 nIP, UINT16 nPort, ERROR_CODE errorCode);
37 |
38 | virtual void OnReceived(CTcpServer* pCTcpServer, UINT32 nSocketID, UINT32 nIP, UINT16 nPort, const char* pData, UINT nDataSize);
39 |
40 | virtual void OnClosed(CTcpServer* pCTcpServer, UINT32 nSocketID, UINT32 nIP, UINT16 nPort, ERROR_CODE errorCode);
41 |
42 | private:
43 |
44 | CTcpServer m_server;
45 | };
46 | }
--------------------------------------------------------------------------------
/demo/DemoServer/DemoServer/DS_Protocol_Common.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/demo/DemoServer/DemoServer/DS_Protocol_Common.h
--------------------------------------------------------------------------------
/demo/DemoServer/DemoServer/DS_ReloadThread.cpp:
--------------------------------------------------------------------------------
1 | #include "DS_ReloadThread.h"
2 | #include "DS_Config.h"
3 |
4 | #define SAS_RELOAD_EVENT_COUNT 2
5 | #define SAS_RELOAD_ON_TIME_EVENT 0
6 | #define SAS_RELOAD_STOP_EVENT 1
7 |
8 | #define SAS_MIN_RELOAD_TICK_COUNT 60000
9 |
10 | namespace EM
11 | {
12 | CReloadThread::CReloadThread()
13 | {
14 | m_bStop = true;
15 | }
16 |
17 | CReloadThread::~CReloadThread()
18 | {
19 | this->Stop();
20 | }
21 |
22 | bool CReloadThread::Start()
23 | {
24 | if (0 == CConfig::Instance().GetReloadTimeSecond())
25 | {
26 | return true;
27 | }
28 |
29 | m_bStop = false;
30 | m_StopEvent.Reset();
31 |
32 | if (CCustomThread::ERROR_CODE_SUCCESS != CCustomThread::Start())
33 | {
34 | LOG_WRITE(LOG_KEY_SYSTEM, CLog::LOG_LEVEL_ERROR, "CReloadThread::Start thread start failed !");
35 |
36 | return false;
37 | }
38 |
39 | return true;
40 | }
41 |
42 | void CReloadThread::Stop()
43 | {
44 | if (0 == CConfig::Instance().GetReloadTimeSecond())
45 | {
46 | return;
47 | }
48 |
49 | if (m_bStop)
50 | {
51 | return;
52 | }
53 |
54 | m_bStop = true;
55 | m_StopEvent.Set();
56 |
57 | CCustomThread::Stop(3000, 0);
58 | }
59 |
60 | void CReloadThread::ReloadNow()
61 | {
62 | if (m_bStop)
63 | {
64 | return;
65 | }
66 |
67 | m_ReLoadEvent.Set();
68 | }
69 |
70 | void CReloadThread::Proc()
71 | {
72 | HANDLE hEvents[SAS_RELOAD_EVENT_COUNT] = {0};
73 |
74 | CSyncObject* pSyncObject[SAS_RELOAD_EVENT_COUNT] = {0};
75 |
76 | pSyncObject[SAS_RELOAD_ON_TIME_EVENT] = &m_ReLoadEvent;
77 | pSyncObject[SAS_RELOAD_STOP_EVENT] = &m_StopEvent;
78 |
79 | UINT32 nCurrentTickCount = GetTickCount();
80 | UINT32 nLastReloadDBInfoTickCount = nCurrentTickCount;
81 |
82 | UINT32 nReloadWaitTime = CConfig::Instance().GetReloadTimeSecond() * 1000;
83 |
84 | if (0 == nReloadWaitTime)
85 | {
86 | nReloadWaitTime = INFINITE;
87 | }
88 |
89 | while (!m_bStop)
90 | {
91 | UINT32 nWaitIndex = 0;
92 |
93 | if (CSyncObject::WaitSyncObjects(pSyncObject, SAS_RELOAD_EVENT_COUNT, false, nReloadWaitTime, nWaitIndex))
94 | {
95 | switch (nWaitIndex)
96 | {
97 | case SAS_RELOAD_ON_TIME_EVENT:
98 | {
99 | nCurrentTickCount = GetTickCount();
100 |
101 | if (nCurrentTickCount - nLastReloadDBInfoTickCount > SAS_MIN_RELOAD_TICK_COUNT)
102 | {
103 | nLastReloadDBInfoTickCount = nCurrentTickCount;
104 | }
105 | else
106 | {
107 | }
108 | }
109 | break;
110 | case SAS_RELOAD_STOP_EVENT:
111 | {
112 | return;
113 | }
114 | }
115 | }
116 | else
117 | {
118 | m_ReLoadEvent.Set();
119 | }
120 | }
121 | }
122 | }
--------------------------------------------------------------------------------
/demo/DemoServer/DemoServer/DS_ReloadThread.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/demo/DemoServer/DemoServer/DS_ReloadThread.h
--------------------------------------------------------------------------------
/demo/DemoServer/DemoServer/DS_StatisticsThread.cpp:
--------------------------------------------------------------------------------
1 | #include "DS_StatisticsThread.h"
2 | #include "DS_Config.h"
3 | #include "DS_NetServer.h"
4 |
5 | namespace EM
6 | {
7 | CStatisticsThread::CStatisticsThread()
8 | {
9 |
10 | }
11 |
12 | CStatisticsThread::~CStatisticsThread()
13 | {
14 | this->Stop();
15 | }
16 |
17 | bool CStatisticsThread::Start()
18 | {
19 | TStatisticsParam aParam;
20 |
21 | aParam.nTypeCount = 1;
22 | aParam.pHandler = this;
23 |
24 | aParam.nStatisticsCountArray[0] = (UINT8)ESS_MAX_COUNT;
25 |
26 | return m_worker.Start(aParam);
27 | }
28 |
29 | void CStatisticsThread::Stop()
30 | {
31 | m_worker.Stop();
32 | }
33 |
34 | void CStatisticsThread::Increment(UINT8 nStatisticsIndex)
35 | {
36 | m_worker.Increment(0, nStatisticsIndex);
37 | }
38 |
39 | void CStatisticsThread::Exchange(UINT8 nStatisticsIndex, INT64 nValue)
40 | {
41 | m_worker.Exchange(0, nStatisticsIndex, nValue);
42 | }
43 |
44 | void CStatisticsThread::OnTime(INT64* nDataArray, UINT8 nDataCount, UINT8 nTypeIndex)
45 | {
46 | if (!CConfig::Instance().GetIsOnStatLog())
47 | {
48 | return;
49 | }
50 |
51 | nDataArray[ESS_CLIENT_COUNT] = CNetServer::Instance().GetSocketCount();
52 |
53 | if (0 == nTypeIndex)
54 | {
55 | LOG_WRITE(LOG_KEY_STATISTICS, CLog::LOG_LEVEL_INFO, "RecvCount:%lld, SendCount:%lld, ClientCount:%lld",
56 | nDataArray[ESS_RECV_COUNT], nDataArray[ESS_SEND_COUNT], nDataArray[ESS_CLIENT_COUNT]);
57 | }
58 |
59 | }
60 | }
--------------------------------------------------------------------------------
/demo/DemoServer/DemoServer/DS_StatisticsThread.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "DS_Common.h"
4 |
5 | namespace EM
6 | {
7 | class CStatisticsThread : protected IStatisticsWorkerHandler, public CSingletonT
8 | {
9 | public:
10 |
11 | //////////////////////////////////////////////////////////////////////////
12 |
13 | enum ESystemStatistics
14 | {
15 | ESS_RECV_COUNT = 0,
16 | ESS_SEND_COUNT,
17 | ESS_CLIENT_COUNT,
18 |
19 | ESS_MAX_COUNT,
20 | };
21 |
22 | //////////////////////////////////////////////////////////////////////////
23 |
24 | CStatisticsThread();
25 |
26 | virtual ~CStatisticsThread();
27 |
28 | bool Start();
29 |
30 | void Stop();
31 |
32 | void Increment(UINT8 nStatisticsIndex);
33 |
34 | void Exchange(UINT8 nStatisticsIndex, INT64 nValue);
35 |
36 | protected:
37 |
38 | virtual void OnTime(INT64* nDataArray, UINT8 nDataCount, UINT8 nTypeIndex);
39 |
40 | private:
41 |
42 | CStatisticsWorker m_worker;
43 | };
44 | }
45 |
--------------------------------------------------------------------------------
/demo/DemoServer/DemoServer/DS_WorkThread.cpp:
--------------------------------------------------------------------------------
1 | #include "DS_WorkThread.h"
2 | #include "DS_Config.h"
3 |
4 | namespace EM
5 | {
6 | //////////////////////////////////////////////////////////////////////////
7 |
8 | CTask::CTask()
9 | {
10 |
11 | }
12 |
13 | CTask::~CTask()
14 | {
15 |
16 | }
17 |
18 | void CTask::Proc(void* pParam)
19 | {
20 | ::CoInitialize(NULL);
21 |
22 | CWorkThread* pWorkThread = (CWorkThread*)pParam;
23 |
24 | CBufferQueue::ERROR_CODE errorCode = CBufferQueue::ERROR_CODE_SUCCESS;
25 |
26 | while (!pWorkThread->m_bStop)
27 | {
28 | CBufferRead bufferRead;
29 |
30 | errorCode = pWorkThread->m_queue.Pop(bufferRead);
31 |
32 | if (CBufferQueue::ERROR_CODE_SUCCESS != errorCode)
33 | {
34 | continue;
35 | }
36 |
37 | TSocketInfo* pTSocketInfo = (TSocketInfo*)bufferRead.GetData();
38 |
39 | const char* pData = bufferRead.GetData(sizeof(TSocketInfo));
40 |
41 | if (m_handler.ProcData(pTSocketInfo, pData))
42 | {
43 |
44 | }
45 | else
46 | {
47 |
48 | }
49 | }
50 |
51 | ::CoUninitialize();
52 | }
53 |
54 | void CTask::Stop(const TTaskInfo* pTTaskInfo)
55 | {
56 |
57 | }
58 |
59 | //////////////////////////////////////////////////////////////////////////
60 |
61 | CWorkThread::CWorkThread()
62 | {
63 | m_bStop = true;
64 | }
65 |
66 | CWorkThread::~CWorkThread()
67 | {
68 | this->Stop();
69 | }
70 |
71 | bool CWorkThread::Start()
72 | {
73 | if (!m_bStop)
74 | {
75 | return true;
76 | }
77 |
78 | m_queue.Release();
79 | if (CBufferQueue::ERROR_CODE_SUCCESS != m_queue.Init(
80 | CConfig::Instance().GetRecvBufferSize() + sizeof(TSocketInfo),
81 | CConfig::Instance().GetRecvBufferCount(),
82 | true))
83 | {
84 | return false;
85 | }
86 |
87 | m_bStop = false;
88 |
89 | if (CTaskMultiThread::ERROR_CODE_SUCCESS != m_TaskThread.Start(this,
90 | CConfig::Instance().GetWorkThreadCount(),
91 | this))
92 | {
93 | this->Stop();
94 |
95 | return false;
96 | }
97 |
98 | return true;
99 | }
100 |
101 | void CWorkThread::Stop()
102 | {
103 | if (m_bStop)
104 | {
105 | return;
106 | }
107 |
108 | m_bStop = true;
109 |
110 | m_TaskThread.Stop();
111 | }
112 |
113 | void CWorkThread::AddData(UINT32 nSocketID, UINT32 nIP, UINT16 nPort, const char* pData, UINT nDataSize)
114 | {
115 | if (m_bStop)
116 | {
117 | return;
118 | }
119 |
120 | TSocketInfo socketInfo = {0};
121 |
122 | socketInfo.nSocketID = nSocketID;
123 | socketInfo.nIP = nIP;
124 | socketInfo.nPort = nPort;
125 | socketInfo.nDataSize = nDataSize;
126 |
127 | CBufferWrite bufferWirte;
128 |
129 | CBufferQueue::ERROR_CODE errorCode = m_queue.GetBufferWrite(bufferWirte);
130 |
131 | if (CBufferQueue::ERROR_CODE_SUCCESS != errorCode)
132 | {
133 | LOG_WRITE(LOG_KEY_SYSTEM, CLog::LOG_LEVEL_ERROR, "CWorkThread::AddData queue get buffer wirte failed !");
134 |
135 | return;
136 | }
137 |
138 | bufferWirte.AddData(&socketInfo, sizeof(TSocketInfo));
139 | bufferWirte.AddData(pData, nDataSize);
140 |
141 | bufferWirte.Push();
142 | }
143 |
144 | ITaskHandler* CWorkThread::Create()
145 | {
146 | return new(std::nothrow) CTask();
147 | }
148 |
149 | void CWorkThread::Release(ITaskHandler* pITaskHandler)
150 | {
151 | if (!pITaskHandler)
152 | {
153 | return;
154 | }
155 |
156 | CTask* pTask = (CTask*)pITaskHandler;
157 |
158 | delete pTask;
159 | }
160 | }
--------------------------------------------------------------------------------
/demo/DemoServer/DemoServer/DS_WorkThread.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "DS_Common.h"
4 | #include "DS_ContentHandler.h"
5 |
6 | namespace EM
7 | {
8 | class CTask : public ITaskHandler
9 | {
10 | public:
11 |
12 | CTask();
13 |
14 | virtual ~CTask();
15 |
16 | virtual void Proc(void* pParam);
17 |
18 | virtual void Stop(const TTaskInfo* pTTaskInfo);
19 |
20 | protected:
21 | private:
22 |
23 | CContentHandler m_handler;
24 | };
25 |
26 | //////////////////////////////////////////////////////////////////////////
27 |
28 | class CWorkThread : public CSingletonT, public ITaskHandlerFactory
29 | {
30 | public:
31 |
32 | friend class CTask;
33 |
34 | CWorkThread();
35 |
36 | virtual ~CWorkThread();
37 |
38 | bool Start();
39 |
40 | void Stop();
41 |
42 | void AddData(UINT32 nSocketID, UINT32 nIP, UINT16 nPort, const char* pData, UINT nDataSize);
43 |
44 | protected:
45 |
46 | virtual ITaskHandler* Create();
47 |
48 | virtual void Release(ITaskHandler* pITaskHandler);
49 |
50 | private:
51 |
52 | bool m_bStop;
53 |
54 | CBufferQueue m_queue;
55 |
56 | CTaskMultiThread m_TaskThread;
57 | };
58 | }
--------------------------------------------------------------------------------
/demo/DemoServer/DemoServer/DemoServer.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 | {3E4D323F-E8CC-42D9-BA84-ABA7781FB30A}
23 | Win32Proj
24 | EMFileMgr
25 | DemoServer
26 |
27 |
28 |
29 |
30 |
31 | Application
32 | true
33 | v140_xp
34 | MultiByte
35 |
36 |
37 | Application
38 | true
39 | v140_xp
40 | MultiByte
41 |
42 |
43 | Application
44 | false
45 | v140_xp
46 | true
47 | MultiByte
48 |
49 |
50 | Application
51 | false
52 | v140_xp
53 | true
54 | MultiByte
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 | true
74 | $(SolutionDir)bin\
75 | $(SolutionDir)temp\$(ProjectName)\$(Platform)\$(Configuration)\
76 | $(ProjectName)_d
77 |
78 |
79 | true
80 | $(SolutionDir)bin\
81 | $(SolutionDir)temp\$(ProjectName)\$(Platform)\$(Configuration)\
82 | $(ProjectName)_d_64
83 |
84 |
85 | false
86 | $(SolutionDir)bin\
87 | $(SolutionDir)temp\$(ProjectName)\$(Platform)\$(Configuration)\
88 |
89 |
90 | false
91 | $(SolutionDir)bin\
92 | $(SolutionDir)temp\$(ProjectName)\$(Platform)\$(Configuration)\
93 | $(ProjectName)_64
94 |
95 |
96 |
97 |
98 |
99 | Level3
100 | Disabled
101 | WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)
102 | true
103 | MultiThreadedDebug
104 |
105 |
106 | Console
107 | true
108 | /SAFESEH:NO %(AdditionalOptions)
109 |
110 |
111 |
112 |
113 |
114 |
115 | Level3
116 | Disabled
117 | WIN32;X64;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)
118 | true
119 | MultiThreadedDebug
120 |
121 |
122 | Console
123 | true
124 | /SAFESEH:NO %(AdditionalOptions)
125 |
126 |
127 |
128 |
129 | Level3
130 |
131 |
132 | MaxSpeed
133 | true
134 | true
135 | WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)
136 | true
137 | MultiThreaded
138 |
139 |
140 | Console
141 | true
142 | true
143 | true
144 | /SAFESEH:NO %(AdditionalOptions)
145 |
146 |
147 |
148 |
149 | Level3
150 |
151 |
152 | MaxSpeed
153 | true
154 | true
155 | WIN32;X64;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)
156 | true
157 | MultiThreaded
158 |
159 |
160 | Console
161 | true
162 | true
163 | true
164 | /SAFESEH:NO %(AdditionalOptions)
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
--------------------------------------------------------------------------------
/demo/DemoServer/DemoServer/DemoServer.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Main
6 |
7 |
8 | BBL
9 |
10 |
11 | BBL
12 |
13 |
14 | System
15 |
16 |
17 | System
18 |
19 |
20 | System
21 |
22 |
23 | System
24 |
25 |
26 | System
27 |
28 |
29 | System
30 |
31 |
32 | Main
33 |
34 |
35 | Config
36 |
37 |
38 |
39 |
40 | BBL
41 |
42 |
43 | Common
44 |
45 |
46 | System
47 |
48 |
49 | System
50 |
51 |
52 | System
53 |
54 |
55 | System
56 |
57 |
58 | System
59 |
60 |
61 | System
62 |
63 |
64 | Main
65 |
66 |
67 | Include
68 |
69 |
70 | Config
71 |
72 |
73 |
74 |
75 | {edc4ef38-978e-4cdf-a746-2ee7f7f16e06}
76 |
77 |
78 | {61931808-3051-48a4-9cc7-60c9c0447f8e}
79 |
80 |
81 | {98ebafa0-faaa-468a-a778-e4357902d110}
82 |
83 |
84 | {036582de-60d6-4037-b281-b77708ad26e0}
85 |
86 |
87 | {485903de-f433-4b93-914f-15011428d9c6}
88 |
89 |
90 | {d344ec3c-61c9-4941-916a-cb6259347f46}
91 |
92 |
93 |
94 |
95 | Config
96 |
97 |
98 |
--------------------------------------------------------------------------------
/demo/DemoServer/DemoServer/DemoServer.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | -d
5 | WindowsLocalDebugger
6 |
7 |
8 | -d
9 | WindowsLocalDebugger
10 |
11 |
12 | -d
13 | WindowsLocalDebugger
14 |
15 |
16 | -d
17 | WindowsLocalDebugger
18 |
19 |
--------------------------------------------------------------------------------
/demo/DemoServer/DemoServer/main.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/demo/DemoServer/DemoServer/main.cpp
--------------------------------------------------------------------------------
/demo/DemoServer/bin/Config/system.ini:
--------------------------------------------------------------------------------
1 | [System]
2 | IP=0.0.0.0
3 | Port=7300
4 | MaxConnectCount=100
5 | RecvBufferSize=20480
6 | RecvBufferCount=100
7 | SendBufferSize=20480
8 | SendBufferCount=100
9 | KeepAliveTimeSecond=30
10 | LogLevel=3
11 | IsOnStatLog=1
12 | WorkThreadCount=5
13 | ReloadTimeSecond=900
--------------------------------------------------------------------------------
/demo/DemoServer/bin/DemoServer_d.bat:
--------------------------------------------------------------------------------
1 | DemoServer_d_64.exe -d
2 |
--------------------------------------------------------------------------------
/demo/README.md:
--------------------------------------------------------------------------------
1 | DEMO 程序说明
2 | ==============================
3 | # DemoServer
4 | - SOCKET IOCP 底层实现的WINDOWS网络服务程序
5 | - 网络服务框架已经成型,只需要添加业务相关代码即可成型
--------------------------------------------------------------------------------
/example/MiniPerformanceCounter/MiniPerformanceCounter.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2012
4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MiniPerformanceCounter", "MiniPerformanceCounter\MiniPerformanceCounter.vcxproj", "{82F399CD-45DD-48A1-A12D-301069C46B00}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Win32 = Debug|Win32
9 | Debug|x64 = Debug|x64
10 | Release|Win32 = Release|Win32
11 | Release|x64 = Release|x64
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {82F399CD-45DD-48A1-A12D-301069C46B00}.Debug|Win32.ActiveCfg = Debug|Win32
15 | {82F399CD-45DD-48A1-A12D-301069C46B00}.Debug|Win32.Build.0 = Debug|Win32
16 | {82F399CD-45DD-48A1-A12D-301069C46B00}.Debug|x64.ActiveCfg = Debug|x64
17 | {82F399CD-45DD-48A1-A12D-301069C46B00}.Debug|x64.Build.0 = Debug|x64
18 | {82F399CD-45DD-48A1-A12D-301069C46B00}.Release|Win32.ActiveCfg = Release|Win32
19 | {82F399CD-45DD-48A1-A12D-301069C46B00}.Release|Win32.Build.0 = Release|Win32
20 | {82F399CD-45DD-48A1-A12D-301069C46B00}.Release|x64.ActiveCfg = Release|x64
21 | {82F399CD-45DD-48A1-A12D-301069C46B00}.Release|x64.Build.0 = Release|x64
22 | EndGlobalSection
23 | GlobalSection(SolutionProperties) = preSolution
24 | HideSolutionNode = FALSE
25 | EndGlobalSection
26 | EndGlobal
27 |
--------------------------------------------------------------------------------
/example/MiniPerformanceCounter/MiniPerformanceCounter/MiniPerformanceCounter.aps:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/example/MiniPerformanceCounter/MiniPerformanceCounter/MiniPerformanceCounter.aps
--------------------------------------------------------------------------------
/example/MiniPerformanceCounter/MiniPerformanceCounter/MiniPerformanceCounter.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/example/MiniPerformanceCounter/MiniPerformanceCounter/MiniPerformanceCounter.cpp
--------------------------------------------------------------------------------
/example/MiniPerformanceCounter/MiniPerformanceCounter/MiniPerformanceCounter.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/example/MiniPerformanceCounter/MiniPerformanceCounter/MiniPerformanceCounter.h
--------------------------------------------------------------------------------
/example/MiniPerformanceCounter/MiniPerformanceCounter/MiniPerformanceCounter.rc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/example/MiniPerformanceCounter/MiniPerformanceCounter/MiniPerformanceCounter.rc
--------------------------------------------------------------------------------
/example/MiniPerformanceCounter/MiniPerformanceCounter/MiniPerformanceCounter.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 | {82F399CD-45DD-48A1-A12D-301069C46B00}
23 | MiniPerformanceCounter
24 | MFCProj
25 |
26 |
27 |
28 | Application
29 | true
30 | v140_xp
31 | MultiByte
32 | Static
33 |
34 |
35 | Application
36 | true
37 | v140_xp
38 | MultiByte
39 | Static
40 |
41 |
42 | Application
43 | false
44 | v140_xp
45 | true
46 | MultiByte
47 | Static
48 |
49 |
50 | Application
51 | false
52 | v140_xp
53 | true
54 | MultiByte
55 | Static
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 | true
75 | $(SolutionDir)\bin\
76 | $(SolutionDir)\TEMP\$(Platform)\$(Configuration)\
77 | $(ProjectName)_d
78 |
79 |
80 | true
81 | $(SolutionDir)\bin\
82 | $(SolutionDir)\TEMP\$(Platform)\$(Configuration)\
83 | $(ProjectName)_d_64
84 |
85 |
86 | false
87 | $(SolutionDir)\bin\
88 | $(SolutionDir)\TEMP\$(Platform)\$(Configuration)\
89 |
90 |
91 | false
92 | $(SolutionDir)\bin\
93 | $(SolutionDir)\TEMP\$(Platform)\$(Configuration)\
94 | $(ProjectName)_64
95 |
96 |
97 |
98 | Use
99 | Level3
100 | Disabled
101 | WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)
102 | true
103 | MultiThreadedDebug
104 |
105 |
106 | Windows
107 | true
108 | RequireAdministrator
109 |
110 |
111 | false
112 | true
113 | _DEBUG;%(PreprocessorDefinitions)
114 |
115 |
116 | 0x0804
117 | _DEBUG;%(PreprocessorDefinitions)
118 | $(IntDir);%(AdditionalIncludeDirectories)
119 |
120 |
121 |
122 |
123 | Use
124 | Level3
125 | Disabled
126 | WIN32;X64;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)
127 | true
128 |
129 |
130 | Windows
131 | true
132 | RequireAdministrator
133 |
134 |
135 | false
136 | _DEBUG;%(PreprocessorDefinitions)
137 |
138 |
139 | 0x0804
140 | _DEBUG;%(PreprocessorDefinitions)
141 | $(IntDir);%(AdditionalIncludeDirectories)
142 |
143 |
144 |
145 |
146 | Level3
147 | Use
148 | MaxSpeed
149 | true
150 | true
151 | WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)
152 | true
153 |
154 |
155 | Windows
156 | true
157 | true
158 | true
159 | RequireAdministrator
160 |
161 |
162 | false
163 | true
164 | NDEBUG;%(PreprocessorDefinitions)
165 |
166 |
167 | 0x0804
168 | NDEBUG;%(PreprocessorDefinitions)
169 | $(IntDir);%(AdditionalIncludeDirectories)
170 |
171 |
172 |
173 |
174 | Level3
175 | Use
176 | MaxSpeed
177 | true
178 | true
179 | WIN32;X64;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)
180 | true
181 |
182 |
183 | Windows
184 | true
185 | true
186 | true
187 | RequireAdministrator
188 |
189 |
190 | false
191 | NDEBUG;%(PreprocessorDefinitions)
192 |
193 |
194 | 0x0804
195 | NDEBUG;%(PreprocessorDefinitions)
196 | $(IntDir);%(AdditionalIncludeDirectories)
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 | Create
214 | Create
215 | Create
216 | Create
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
--------------------------------------------------------------------------------
/example/MiniPerformanceCounter/MiniPerformanceCounter/MiniPerformanceCounter.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;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 |
20 |
21 |
22 | 头文件
23 |
24 |
25 | 头文件
26 |
27 |
28 | 头文件
29 |
30 |
31 | 头文件
32 |
33 |
34 | 头文件
35 |
36 |
37 |
38 |
39 | 源文件
40 |
41 |
42 | 源文件
43 |
44 |
45 | 源文件
46 |
47 |
48 |
49 |
50 | 资源文件
51 |
52 |
53 |
54 |
55 | 资源文件
56 |
57 |
58 |
59 |
60 | 资源文件
61 |
62 |
63 |
--------------------------------------------------------------------------------
/example/MiniPerformanceCounter/MiniPerformanceCounter/MiniPerformanceCounter.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/example/MiniPerformanceCounter/MiniPerformanceCounter/MiniPerformanceCounterDlg.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/example/MiniPerformanceCounter/MiniPerformanceCounter/MiniPerformanceCounterDlg.cpp
--------------------------------------------------------------------------------
/example/MiniPerformanceCounter/MiniPerformanceCounter/MiniPerformanceCounterDlg.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/example/MiniPerformanceCounter/MiniPerformanceCounter/MiniPerformanceCounterDlg.h
--------------------------------------------------------------------------------
/example/MiniPerformanceCounter/MiniPerformanceCounter/ReadMe.txt:
--------------------------------------------------------------------------------
1 | ================================================================================
2 | MICROSOFT 基础类库 : MiniPerformanceCounter 项目概述
3 | ===============================================================================
4 |
5 | 应用程序向导已为您创建了此 MiniPerformanceCounter 应用程序。此应用程序不仅演示 Microsoft 基础类的基本使用方法,还可作为您编写应用程序的起点。
6 |
7 | 本文件概要介绍组成 MiniPerformanceCounter 应用程序的每个文件的内容。
8 |
9 | MiniPerformanceCounter.vcxproj
10 | 这是使用应用程序向导生成的 VC++ 项目的主项目文件,其中包含生成该文件的 Visual C++ 的版本信息,以及有关使用应用程序向导选择的平台、配置和项目功能的信息。
11 |
12 | MiniPerformanceCounter.vcxproj.filters
13 | 这是使用“应用程序向导”生成的 VC++ 项目筛选器文件。它包含有关项目文件与筛选器之间的关联信息。在 IDE 中,通过这种关联,在特定节点下以分组形式显示具有相似扩展名的文件。例如,“.cpp”文件与“源文件”筛选器关联。
14 |
15 | MiniPerformanceCounter.h
16 | 这是应用程序的主头文件。
17 | 其中包括其他项目特定的标头(包括 Resource.h),并声明 CMiniPerformanceCounterApp 应用程序类。
18 |
19 | MiniPerformanceCounter.cpp
20 | 这是包含应用程序类 CMiniPerformanceCounterApp 的主应用程序源文件。
21 |
22 | MiniPerformanceCounter.rc
23 | 这是程序使用的所有 Microsoft Windows 资源的列表。它包括 RES 子目录中存储的图标、位图和光标。此文件可以直接在 Microsoft Visual C++ 中进行编辑。项目资源包含在 2052 中。
24 |
25 | res\MiniPerformanceCounter.ico
26 | 这是用作应用程序图标的图标文件。此图标包括在主资源文件 MiniPerformanceCounter.rc 中。
27 |
28 | res\MiniPerformanceCounter.rc2
29 | 此文件包含不在 Microsoft Visual C++ 中进行编辑的资源。您应该将不可由资源编辑器编辑的所有资源放在此文件中。
30 |
31 |
32 | /////////////////////////////////////////////////////////////////////////////
33 |
34 | 应用程序向导创建一个对话框类:
35 |
36 | MiniPerformanceCounterDlg.h、MiniPerformanceCounterDlg.cpp - 对话框
37 | 这些文件包含 CMiniPerformanceCounterDlg 类。此类定义应用程序的主对话框的行为。对话框模板包含在 MiniPerformanceCounter.rc 中,该文件可以在 Microsoft Visual C++ 中编辑。
38 |
39 | /////////////////////////////////////////////////////////////////////////////
40 |
41 | 其他标准文件:
42 |
43 | StdAfx.h, StdAfx.cpp
44 | 这些文件用于生成名为 MiniPerformanceCounter.pch 的预编译头 (PCH) 文件和名为 StdAfx.obj 的预编译类型文件。
45 |
46 | Resource.h
47 | 这是标准头文件,可用于定义新的资源 ID。Microsoft Visual C++ 将读取并更新此文件。
48 |
49 | /////////////////////////////////////////////////////////////////////////////
50 |
51 | 其他注释:
52 |
53 | 应用程序向导使用“TODO:”来指示应添加或自定义的源代码部分。
54 |
55 | 如果应用程序使用共享 DLL 中的 MFC,您将需要重新分发 MFC DLL。如果应用程序所使用的语言与操作系统的区域设置不同,则还需要重新分发相应的本地化资源 mfc110XXX.DLL。
56 | 有关上述话题的更多信息,请参见 MSDN 文档中有关重新分发 Visual C++ 应用程序的部分。
57 |
58 | /////////////////////////////////////////////////////////////////////////////
59 |
--------------------------------------------------------------------------------
/example/MiniPerformanceCounter/MiniPerformanceCounter/res/MiniPerformanceCounter.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/example/MiniPerformanceCounter/MiniPerformanceCounter/res/MiniPerformanceCounter.ico
--------------------------------------------------------------------------------
/example/MiniPerformanceCounter/MiniPerformanceCounter/res/MiniPerformanceCounter.rc2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/example/MiniPerformanceCounter/MiniPerformanceCounter/res/MiniPerformanceCounter.rc2
--------------------------------------------------------------------------------
/example/MiniPerformanceCounter/MiniPerformanceCounter/resource.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/example/MiniPerformanceCounter/MiniPerformanceCounter/resource.h
--------------------------------------------------------------------------------
/example/MiniPerformanceCounter/MiniPerformanceCounter/stdafx.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/example/MiniPerformanceCounter/MiniPerformanceCounter/stdafx.cpp
--------------------------------------------------------------------------------
/example/MiniPerformanceCounter/MiniPerformanceCounter/stdafx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/example/MiniPerformanceCounter/MiniPerformanceCounter/stdafx.h
--------------------------------------------------------------------------------
/example/MiniPerformanceCounter/MiniPerformanceCounter/targetver.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/example/MiniPerformanceCounter/MiniPerformanceCounter/targetver.h
--------------------------------------------------------------------------------
/example/README.md:
--------------------------------------------------------------------------------
1 | 示例程序说明
2 | ==============================
3 | # MiniPerformanceCounter
4 | WINDOWS 性能计数器小程序
5 |
6 | # SystemMoniter
7 | 系统资源监控程序
8 |
9 | # testClient | testServer
10 | 客户端服务器的测试程序,Client端为异步Socket封装,Server端使用了IOCP的封装库
--------------------------------------------------------------------------------
/example/SystemMoniter/SystemMoniter.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25123.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SystemMoniter", "SystemMoniter\SystemMoniter.vcxproj", "{1DADAC14-AC37-401C-93C6-A6C12369BF44}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Win32 = Debug|Win32
11 | Debug|x64 = Debug|x64
12 | Release|Win32 = Release|Win32
13 | Release|x64 = Release|x64
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {1DADAC14-AC37-401C-93C6-A6C12369BF44}.Debug|Win32.ActiveCfg = Debug|Win32
17 | {1DADAC14-AC37-401C-93C6-A6C12369BF44}.Debug|Win32.Build.0 = Debug|Win32
18 | {1DADAC14-AC37-401C-93C6-A6C12369BF44}.Debug|x64.ActiveCfg = Debug|x64
19 | {1DADAC14-AC37-401C-93C6-A6C12369BF44}.Debug|x64.Build.0 = Debug|x64
20 | {1DADAC14-AC37-401C-93C6-A6C12369BF44}.Release|Win32.ActiveCfg = Release|Win32
21 | {1DADAC14-AC37-401C-93C6-A6C12369BF44}.Release|Win32.Build.0 = Release|Win32
22 | {1DADAC14-AC37-401C-93C6-A6C12369BF44}.Release|x64.ActiveCfg = Release|x64
23 | {1DADAC14-AC37-401C-93C6-A6C12369BF44}.Release|x64.Build.0 = Release|x64
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/example/SystemMoniter/SystemMoniter/ReadMe.txt:
--------------------------------------------------------------------------------
1 | ================================================================================
2 | MICROSOFT 基础类库 : SystemMoniter 项目概述
3 | ===============================================================================
4 |
5 | 应用程序向导已为您创建了此 SystemMoniter 应用程序。此应用程序不仅演示 Microsoft 基础类的基本使用方法,还可作为您编写应用程序的起点。
6 |
7 | 本文件概要介绍组成 SystemMoniter 应用程序的每个文件的内容。
8 |
9 | SystemMoniter.vcxproj
10 | 这是使用应用程序向导生成的 VC++ 项目的主项目文件,其中包含生成该文件的 Visual C++ 的版本信息,以及有关使用应用程序向导选择的平台、配置和项目功能的信息。
11 |
12 | SystemMoniter.vcxproj.filters
13 | 这是使用“应用程序向导”生成的 VC++ 项目筛选器文件。它包含有关项目文件与筛选器之间的关联信息。在 IDE 中,通过这种关联,在特定节点下以分组形式显示具有相似扩展名的文件。例如,“.cpp”文件与“源文件”筛选器关联。
14 |
15 | SystemMoniter.h
16 | 这是应用程序的主头文件。
17 | 其中包括其他项目特定的标头(包括 Resource.h),并声明 CSystemMoniterApp 应用程序类。
18 |
19 | SystemMoniter.cpp
20 | 这是包含应用程序类 CSystemMoniterApp 的主应用程序源文件。
21 |
22 | SystemMoniter.rc
23 | 这是程序使用的所有 Microsoft Windows 资源的列表。它包括 RES 子目录中存储的图标、位图和光标。此文件可以直接在 Microsoft Visual C++ 中进行编辑。项目资源包含在 2052 中。
24 |
25 | res\SystemMoniter.ico
26 | 这是用作应用程序图标的图标文件。此图标包括在主资源文件 SystemMoniter.rc 中。
27 |
28 | res\SystemMoniter.rc2
29 | 此文件包含不在 Microsoft Visual C++ 中进行编辑的资源。您应该将不可由资源编辑器编辑的所有资源放在此文件中。
30 |
31 |
32 | /////////////////////////////////////////////////////////////////////////////
33 |
34 | 应用程序向导创建一个对话框类:
35 |
36 | SystemMoniterDlg.h、SystemMoniterDlg.cpp - 对话框
37 | 这些文件包含 CSystemMoniterDlg 类。此类定义应用程序的主对话框的行为。对话框模板包含在 SystemMoniter.rc 中,该文件可以在 Microsoft Visual C++ 中编辑。
38 |
39 | /////////////////////////////////////////////////////////////////////////////
40 |
41 | 其他标准文件:
42 |
43 | StdAfx.h, StdAfx.cpp
44 | 这些文件用于生成名为 SystemMoniter.pch 的预编译头 (PCH) 文件和名为 StdAfx.obj 的预编译类型文件。
45 |
46 | Resource.h
47 | 这是标准头文件,可用于定义新的资源 ID。Microsoft Visual C++ 将读取并更新此文件。
48 |
49 | /////////////////////////////////////////////////////////////////////////////
50 |
51 | 其他注释:
52 |
53 | 应用程序向导使用“TODO:”来指示应添加或自定义的源代码部分。
54 |
55 | 如果应用程序使用共享 DLL 中的 MFC,您将需要重新分发 MFC DLL。如果应用程序所使用的语言与操作系统的区域设置不同,则还需要重新分发相应的本地化资源 mfc110XXX.DLL。
56 | 有关上述话题的更多信息,请参见 MSDN 文档中有关重新分发 Visual C++ 应用程序的部分。
57 |
58 | /////////////////////////////////////////////////////////////////////////////
59 |
--------------------------------------------------------------------------------
/example/SystemMoniter/SystemMoniter/SystemMoniter.aps:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/example/SystemMoniter/SystemMoniter/SystemMoniter.aps
--------------------------------------------------------------------------------
/example/SystemMoniter/SystemMoniter/SystemMoniter.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/example/SystemMoniter/SystemMoniter/SystemMoniter.cpp
--------------------------------------------------------------------------------
/example/SystemMoniter/SystemMoniter/SystemMoniter.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/example/SystemMoniter/SystemMoniter/SystemMoniter.h
--------------------------------------------------------------------------------
/example/SystemMoniter/SystemMoniter/SystemMoniter.rc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/example/SystemMoniter/SystemMoniter/SystemMoniter.rc
--------------------------------------------------------------------------------
/example/SystemMoniter/SystemMoniter/SystemMoniter.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 | {1DADAC14-AC37-401C-93C6-A6C12369BF44}
23 | SystemMoniter
24 | MFCProj
25 |
26 |
27 |
28 |
29 |
30 | Application
31 | true
32 | v140_xp
33 | Unicode
34 | Static
35 |
36 |
37 | Application
38 | true
39 | v140_xp
40 | Unicode
41 | Static
42 |
43 |
44 | Application
45 | false
46 | v140_xp
47 | true
48 | Unicode
49 | Static
50 |
51 |
52 | Application
53 | false
54 | v140_xp
55 | true
56 | Unicode
57 | Static
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 | true
77 | $(SolutionDir)\bin\
78 | $(SolutionDir)\TEMP\$(Platform)\$(Configuration)\
79 | $(ProjectName)_d
80 |
81 |
82 | true
83 | $(SolutionDir)\bin\
84 | $(SolutionDir)\TEMP\$(Platform)\$(Configuration)\
85 | $(ProjectName)_d_64
86 |
87 |
88 | false
89 | $(SolutionDir)\bin\
90 | $(SolutionDir)\TEMP\$(Platform)\$(Configuration)\
91 |
92 |
93 | false
94 | $(SolutionDir)\bin\
95 | $(SolutionDir)\TEMP\$(Platform)\$(Configuration)\
96 | $(ProjectName)_64
97 |
98 |
99 |
100 | Use
101 | Level3
102 | Disabled
103 | WIN32;_WINDOWS;_DEBUG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
104 | true
105 |
106 |
107 | Windows
108 | true
109 | RequireAdministrator
110 |
111 |
112 | false
113 | true
114 | _DEBUG;%(PreprocessorDefinitions)
115 |
116 |
117 | 0x0804
118 | _DEBUG;%(PreprocessorDefinitions)
119 | $(IntDir);%(AdditionalIncludeDirectories)
120 |
121 |
122 |
123 |
124 | Use
125 | Level3
126 | Disabled
127 | WIN32;X64;_WINDOWS;_DEBUG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
128 | true
129 |
130 |
131 | Windows
132 | true
133 | RequireAdministrator
134 |
135 |
136 | false
137 | _DEBUG;%(PreprocessorDefinitions)
138 |
139 |
140 | 0x0804
141 | _DEBUG;%(PreprocessorDefinitions)
142 | $(IntDir);%(AdditionalIncludeDirectories)
143 |
144 |
145 |
146 |
147 | Level3
148 | Use
149 | MaxSpeed
150 | true
151 | true
152 | WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
153 | true
154 |
155 |
156 | Windows
157 | true
158 | true
159 | true
160 | RequireAdministrator
161 |
162 |
163 | false
164 | true
165 | NDEBUG;%(PreprocessorDefinitions)
166 |
167 |
168 | 0x0804
169 | NDEBUG;%(PreprocessorDefinitions)
170 | $(IntDir);%(AdditionalIncludeDirectories)
171 |
172 |
173 |
174 |
175 | Level3
176 | Use
177 | MaxSpeed
178 | true
179 | true
180 | WIN32;X64;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)
181 | true
182 |
183 |
184 | Windows
185 | true
186 | true
187 | true
188 | RequireAdministrator
189 |
190 |
191 | false
192 | NDEBUG;%(PreprocessorDefinitions)
193 |
194 |
195 | 0x0804
196 | NDEBUG;%(PreprocessorDefinitions)
197 | $(IntDir);%(AdditionalIncludeDirectories)
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 | Create
213 | Create
214 | Create
215 | Create
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
--------------------------------------------------------------------------------
/example/SystemMoniter/SystemMoniter/SystemMoniter.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;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 |
20 |
21 |
22 | 头文件
23 |
24 |
25 | 头文件
26 |
27 |
28 | 头文件
29 |
30 |
31 | 头文件
32 |
33 |
34 | 头文件
35 |
36 |
37 |
38 |
39 | 源文件
40 |
41 |
42 | 源文件
43 |
44 |
45 | 源文件
46 |
47 |
48 |
49 |
50 | 资源文件
51 |
52 |
53 |
54 |
55 | 资源文件
56 |
57 |
58 |
59 |
60 | 资源文件
61 |
62 |
63 |
--------------------------------------------------------------------------------
/example/SystemMoniter/SystemMoniter/SystemMoniter.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | WindowsLocalDebugger
5 |
6 |
7 | WindowsLocalDebugger
8 |
9 |
--------------------------------------------------------------------------------
/example/SystemMoniter/SystemMoniter/SystemMoniterDlg.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/example/SystemMoniter/SystemMoniter/SystemMoniterDlg.cpp
--------------------------------------------------------------------------------
/example/SystemMoniter/SystemMoniter/SystemMoniterDlg.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/example/SystemMoniter/SystemMoniter/SystemMoniterDlg.h
--------------------------------------------------------------------------------
/example/SystemMoniter/SystemMoniter/res/SystemMoniter.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/example/SystemMoniter/SystemMoniter/res/SystemMoniter.ico
--------------------------------------------------------------------------------
/example/SystemMoniter/SystemMoniter/res/SystemMoniter.rc2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/example/SystemMoniter/SystemMoniter/res/SystemMoniter.rc2
--------------------------------------------------------------------------------
/example/SystemMoniter/SystemMoniter/resource.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/example/SystemMoniter/SystemMoniter/resource.h
--------------------------------------------------------------------------------
/example/SystemMoniter/SystemMoniter/stdafx.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/example/SystemMoniter/SystemMoniter/stdafx.cpp
--------------------------------------------------------------------------------
/example/SystemMoniter/SystemMoniter/stdafx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/example/SystemMoniter/SystemMoniter/stdafx.h
--------------------------------------------------------------------------------
/example/SystemMoniter/SystemMoniter/targetver.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/example/SystemMoniter/SystemMoniter/targetver.h
--------------------------------------------------------------------------------
/example/testClient/SnmpThread.cpp:
--------------------------------------------------------------------------------
1 | #include "SnmpThread.h"
2 |
3 | CSnmpThread::CSnmpThread()
4 | {
5 |
6 | }
7 |
8 | CSnmpThread::~CSnmpThread()
9 | {
10 |
11 | }
12 |
13 | void CSnmpThread::Add(SNMP_TYPE snmpType)
14 | {
15 | InterlockedIncrement(&m_Snmp[snmpType]);
16 | }
17 |
18 | void CSnmpThread::Proc()
19 | {
20 | while (TRUE)
21 | {
22 | Sleep(60 * 1000);
23 |
24 | LONG aSnmp[SNMP_TYPE_MAX] = {0};
25 |
26 | for (int nIndex = 0; nIndex < SNMP_TYPE_MAX; ++nIndex)
27 | {
28 | aSnmp[nIndex] = InterlockedExchange(&m_Snmp[nIndex], 0);
29 | }
30 |
31 | printf("Recv:%ld, Send:%ld \r\n\n", aSnmp[SNMP_TYPE_RECV], aSnmp[SNMP_TYPE_SEND]);
32 | }
33 | }
--------------------------------------------------------------------------------
/example/testClient/SnmpThread.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "common.h"
4 |
5 | class CSnmpThread : public SysBase::CCustomThread, public SysBase::CSingletonT
6 | {
7 | public:
8 |
9 | enum SNMP_TYPE
10 | {
11 | SNMP_TYPE_RECV = 0,
12 | SNMP_TYPE_SEND,
13 |
14 | SNMP_TYPE_MAX,
15 | };
16 |
17 | virtual ~CSnmpThread();
18 | friend class SysBase::CSingletonT;
19 |
20 | void Add(SNMP_TYPE snmpType);
21 |
22 | protected:
23 |
24 | virtual void Proc();
25 |
26 | private:
27 |
28 | CSnmpThread();
29 |
30 | LONG m_Snmp[SNMP_TYPE_MAX];
31 | };
--------------------------------------------------------------------------------
/example/testClient/TestMainApp.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/example/testClient/TestMainApp.cpp
--------------------------------------------------------------------------------
/example/testClient/common.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "../../SysBase/SysBase/SysBase_Interface.h"
4 |
5 | using namespace SysBase;
6 |
7 | #ifdef _DEBUG
8 | #ifdef X64
9 | #pragma comment(lib, "../../SysBase/lib/SysBase_d_64.lib")
10 | #else
11 | #pragma comment(lib, "../../SysBase/lib/SysBase_d.lib")
12 | #endif
13 | #else
14 | #ifdef X64
15 | #pragma comment(lib, "../../SysBase/lib/SysBase_64.lib")
16 | #else
17 | #pragma comment(lib, "../../SysBase/lib/SysBase.lib")
18 | #endif
19 | #endif // _DEBUG
--------------------------------------------------------------------------------
/example/testClient/testClient.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25123.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testClient", "testClient.vcxproj", "{1D884D6E-28EC-4BBD-9B38-4E378E14878A}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Win32 = Debug|Win32
11 | Release|Win32 = Release|Win32
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {1D884D6E-28EC-4BBD-9B38-4E378E14878A}.Debug|Win32.ActiveCfg = Debug|Win32
15 | {1D884D6E-28EC-4BBD-9B38-4E378E14878A}.Debug|Win32.Build.0 = Debug|Win32
16 | {1D884D6E-28EC-4BBD-9B38-4E378E14878A}.Release|Win32.ActiveCfg = Release|Win32
17 | {1D884D6E-28EC-4BBD-9B38-4E378E14878A}.Release|Win32.Build.0 = Release|Win32
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/example/testClient/testClient.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 |
14 | {1D884D6E-28EC-4BBD-9B38-4E378E14878A}
15 | testClient
16 | Win32Proj
17 | 8.1
18 |
19 |
20 |
21 | Application
22 | v140
23 | MultiByte
24 | true
25 |
26 |
27 | Application
28 | v140
29 | MultiByte
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 | <_ProjectFileVersion>14.0.25123.0
43 |
44 |
45 | $(SolutionDir)\bin\
46 | $(SolutionDir)\TEMP\$(Platform)\$(Configuration)\
47 | true
48 | $(ProjectName)_d
49 |
50 |
51 | $(SolutionDir)\bin\
52 | $(SolutionDir)\TEMP\$(Platform)\$(Configuration)\
53 | false
54 |
55 |
56 |
57 | Disabled
58 | WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;WIN32_LEAN_AND_MEAN;_CRT_NON_CONFORMING_SWPRINTFS;%(PreprocessorDefinitions)
59 | true
60 | EnableFastChecks
61 | MultiThreadedDebug
62 |
63 | Level3
64 | EditAndContinue
65 |
66 |
67 | true
68 | Console
69 | MachineX86
70 | RequireAdministrator
71 |
72 |
73 |
74 |
75 | WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;WIN32_LEAN_AND_MEAN;_CRT_NON_CONFORMING_SWPRINTFS;%(PreprocessorDefinitions)
76 | MultiThreaded
77 |
78 | Level3
79 | ProgramDatabase
80 |
81 |
82 | true
83 | Console
84 | true
85 | true
86 | MachineX86
87 | RequireAdministrator
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
--------------------------------------------------------------------------------
/example/testClient/testClient.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;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
15 |
16 |
17 |
18 |
19 | 源文件
20 |
21 |
22 | 源文件
23 |
24 |
25 |
26 |
27 | 源文件
28 |
29 |
30 | 头文件
31 |
32 |
33 |
--------------------------------------------------------------------------------
/example/testServer/SnmpThread.cpp:
--------------------------------------------------------------------------------
1 | #include "SnmpThread.h"
2 |
3 | CSnmpThread::CSnmpThread()
4 | {
5 |
6 | }
7 |
8 | CSnmpThread::~CSnmpThread()
9 | {
10 |
11 | }
12 |
13 | void CSnmpThread::Add(SNMP_TYPE snmpType)
14 | {
15 | InterlockedIncrement(&m_Snmp[snmpType]);
16 | }
17 |
18 | void CSnmpThread::Proc()
19 | {
20 | while (TRUE)
21 | {
22 | Sleep(60 * 1000);
23 |
24 | LONG aSnmp[SNMP_TYPE_MAX] = {0};
25 |
26 | for (int nIndex = 0; nIndex < SNMP_TYPE_MAX; ++nIndex)
27 | {
28 | aSnmp[nIndex] = InterlockedExchange(&m_Snmp[nIndex], 0);
29 | }
30 |
31 | printf("Recv:%ld, Send:%ld \r\n\n", aSnmp[SNMP_TYPE_RECV], aSnmp[SNMP_TYPE_SEND]);
32 | }
33 | }
--------------------------------------------------------------------------------
/example/testServer/SnmpThread.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "common.h"
4 |
5 | class CSnmpThread : public SysBase::CCustomThread, public SysBase::CSingletonT
6 | {
7 | public:
8 |
9 | enum SNMP_TYPE
10 | {
11 | SNMP_TYPE_RECV = 0,
12 | SNMP_TYPE_SEND,
13 |
14 | SNMP_TYPE_MAX,
15 | };
16 |
17 | virtual ~CSnmpThread();
18 | friend class SysBase::CSingletonT;
19 |
20 | void Add(SNMP_TYPE snmpType);
21 |
22 | protected:
23 |
24 | virtual void Proc();
25 |
26 | private:
27 |
28 | CSnmpThread();
29 |
30 | LONG m_Snmp[SNMP_TYPE_MAX];
31 | };
--------------------------------------------------------------------------------
/example/testServer/TestMainApp.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yejiansnake/windows-sys-base/569684f6a4cc86981de8250592d071f1d9d4a676/example/testServer/TestMainApp.cpp
--------------------------------------------------------------------------------
/example/testServer/common.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "../../SysBase/SysBase/SysBase_Interface.h"
4 |
5 | using namespace SysBase;
6 |
7 | #ifdef _DEBUG
8 | #ifdef X64
9 | #pragma comment(lib, "../../SysBase/lib/SysBase_d_64.lib")
10 | #else
11 | #pragma comment(lib, "../../SysBase/lib/SysBase_d.lib")
12 | #endif
13 | #else
14 | #ifdef X64
15 | #pragma comment(lib, "../../SysBase/lib/SysBase_64.lib")
16 | #else
17 | #pragma comment(lib, "../../SysBase/lib/SysBase.lib")
18 | #endif
19 | #endif // _DEBUG
--------------------------------------------------------------------------------
/example/testServer/testServer.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25123.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testServer", "testServer.vcxproj", "{CDF0C814-1D51-464F-984F-8DB5ECD1574F}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Win32 = Debug|Win32
11 | Release|Win32 = Release|Win32
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {CDF0C814-1D51-464F-984F-8DB5ECD1574F}.Debug|Win32.ActiveCfg = Debug|Win32
15 | {CDF0C814-1D51-464F-984F-8DB5ECD1574F}.Debug|Win32.Build.0 = Debug|Win32
16 | {CDF0C814-1D51-464F-984F-8DB5ECD1574F}.Release|Win32.ActiveCfg = Release|Win32
17 | {CDF0C814-1D51-464F-984F-8DB5ECD1574F}.Release|Win32.Build.0 = Release|Win32
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/example/testServer/testServer.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 |
14 | {CDF0C814-1D51-464F-984F-8DB5ECD1574F}
15 | testServer
16 | Win32Proj
17 | 8.1
18 |
19 |
20 |
21 | Application
22 | v140
23 | MultiByte
24 | true
25 |
26 |
27 | Application
28 | v140
29 | MultiByte
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 | <_ProjectFileVersion>14.0.25123.0
43 |
44 |
45 | $(SolutionDir)\bin\
46 | $(SolutionDir)\TEMP\$(Platform)\$(Configuration)\
47 | true
48 | $(ProjectName)_d
49 |
50 |
51 | $(SolutionDir)\bin\
52 | $(SolutionDir)\TEMP\$(Platform)\$(Configuration)\
53 | false
54 |
55 |
56 |
57 | Disabled
58 | WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;WIN32_LEAN_AND_MEAN;_CRT_NON_CONFORMING_SWPRINTFS;%(PreprocessorDefinitions)
59 | true
60 | EnableFastChecks
61 | MultiThreadedDebug
62 |
63 | Level3
64 | EditAndContinue
65 |
66 |
67 | true
68 | Console
69 | MachineX86
70 | RequireAdministrator
71 |
72 |
73 |
74 |
75 | WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;WIN32_LEAN_AND_MEAN;_CRT_NON_CONFORMING_SWPRINTFS;%(PreprocessorDefinitions)
76 | MultiThreaded
77 |
78 | Level3
79 | ProgramDatabase
80 |
81 |
82 | true
83 | Console
84 | true
85 | true
86 | MachineX86
87 | RequireAdministrator
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
--------------------------------------------------------------------------------
/example/testServer/testServer.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;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
15 |
16 |
17 |
18 |
19 | 源文件
20 |
21 |
22 | 源文件
23 |
24 |
25 |
26 |
27 | 源文件
28 |
29 |
30 | 头文件
31 |
32 |
33 |
--------------------------------------------------------------------------------