添加项目文件。
This commit is contained in:
		
							
								
								
									
										102
									
								
								CCEXPipe/CCEXPipe.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										102
									
								
								CCEXPipe/CCEXPipe.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,102 @@ | ||||
| // CCEXPipe.cpp : <20><><EFBFBD><EFBFBD> DLL Ӧ<>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ㡣 | ||||
| // | ||||
|  | ||||
| #include "stdafx.h" | ||||
| #include "CCEXPipe.h" | ||||
|  | ||||
|  | ||||
| #ifdef _MANAGED | ||||
| #pragma managed(push, off) | ||||
| #endif | ||||
|  | ||||
| BOOL APIENTRY DllMain( HMODULE hModule, | ||||
|                        DWORD  ul_reason_for_call, | ||||
|                        LPVOID lpReserved | ||||
| 					 ) | ||||
| { | ||||
| 	WSADATA wsaData; | ||||
| 	WORD wVersionRequested=MAKEWORD(2, 2); | ||||
| 	if( 0 == WSAStartup (wVersionRequested, &wsaData)) | ||||
| 	{ | ||||
| 		; | ||||
| 	} | ||||
| 	LogOutToFile("Pipe Load succ"); | ||||
|     return TRUE; | ||||
| } | ||||
|  | ||||
| #ifdef _MANAGED | ||||
| #pragma managed(pop) | ||||
| #endif | ||||
|  | ||||
|  | ||||
| BOOL ReadPipePacket(SOCKET rsocket, char* pcReadBuf, int lMaxSize, int& lRead) | ||||
| { | ||||
| 	lRead = 0; | ||||
| 	int lLen = 0; | ||||
| 	//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD> | ||||
| 	int lNeedRead = sizeof(lLen); | ||||
| 	int lReadPos = 0; | ||||
| 	while (lNeedRead > 0) | ||||
| 	{ | ||||
| 		int lReadTemp = recv(rsocket, ((char*)&lLen)+lReadPos, lNeedRead, 0); | ||||
| 		if(lReadTemp <= 0) | ||||
| 		{ | ||||
| 			LogOutToFile("ReadPipePacket recv len error.[%d] [%d]", GetLastError(), lReadTemp); | ||||
| 			return FALSE; | ||||
| 		} | ||||
| 		lNeedRead -= lReadTemp; | ||||
| 		lReadPos += lReadTemp; | ||||
| 	} | ||||
|  | ||||
| 	lRead = lLen; | ||||
|  | ||||
| 	if (lLen >= lMaxSize) | ||||
| 	{ | ||||
| 		LogOutToFile("ReadPipePacket limit max.[%d] recv[%d]", GetLastError(), lMaxSize, lLen); | ||||
| 		return FALSE; | ||||
| 	} | ||||
|  | ||||
| 	//<2F><>ȡ<EFBFBD><C8A1><EFBFBD>ݰ<EFBFBD> | ||||
| 	lNeedRead = lLen; | ||||
| 	lReadPos = 0; | ||||
| 	while (lNeedRead > 0) | ||||
| 	{ | ||||
| 		int lReadTemp = recv(rsocket, pcReadBuf+lReadPos, lNeedRead, 0); | ||||
| 		if(lReadTemp <= 0) | ||||
| 		{ | ||||
| 			LogOutToFile("ReadPipePacket recv body error.[%d] [%d]", GetLastError(), lReadTemp); | ||||
| 			return FALSE; | ||||
| 		} | ||||
| 		lNeedRead -= lReadTemp; | ||||
| 		lReadPos += lReadTemp; | ||||
| 	} | ||||
|  | ||||
| 	return TRUE; | ||||
| } | ||||
|  | ||||
| BOOL SendeData(SOCKET wsocket, const char* pData, int lLen) | ||||
| { | ||||
| 	if (-1 == wsocket) | ||||
| 	{ | ||||
| 		return FALSE; | ||||
| 	} | ||||
|  | ||||
| 	int            lSend = -1; | ||||
|  | ||||
| 	//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD><DCB5><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||
| 	lSend = send(wsocket, (const char*)&lLen, sizeof(lLen), 0); | ||||
| 	if(sizeof(lLen) != lSend) | ||||
| 	{ | ||||
| 		LogOutToFile("д<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>,Ԥ<><D4A4>д<EFBFBD><D0B4>[%d]<5D><>ʵ<EFBFBD><CAB5>д<EFBFBD><D0B4>[%d]\r\n", (int)sizeof(lLen), lSend); | ||||
| 		return FALSE; | ||||
| 	} | ||||
|  | ||||
| 	lSend = send(wsocket, pData, lLen, 0); | ||||
| 	if(lLen != lSend) | ||||
| 	{ | ||||
| 		LogOutToFile("д<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>,Ԥ<><D4A4>д<EFBFBD><D0B4>[%d]<5D><>ʵ<EFBFBD><CAB5>д<EFBFBD><D0B4>[%d]\r\n", lLen, lSend); | ||||
| 		return FALSE; | ||||
| 	} | ||||
|  | ||||
| 	return TRUE; | ||||
| } | ||||
							
								
								
									
										6
									
								
								CCEXPipe/CCEXPipe.def
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								CCEXPipe/CCEXPipe.def
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,6 @@ | ||||
| ; DataBaseManager.def : <EFBFBD><EFBFBD><EFBFBD><EFBFBD> DLL <EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||
|  | ||||
| LIBRARY      "CCEXPipe" | ||||
|  | ||||
| EXPORTS | ||||
|     ; <EFBFBD>˴<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||
							
								
								
									
										9
									
								
								CCEXPipe/CCEXPipe.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								CCEXPipe/CCEXPipe.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| #ifndef _CCEX_PIPE_H__ | ||||
| #define _CCEX_PIPE_H__ | ||||
| #include "CCEXPipeLib.h" | ||||
| #include <WinSock2.h> | ||||
|  | ||||
| BOOL ReadPipePacket(SOCKET rsocket, char* pcReadBuf, int lMaxSize, int& lRead); | ||||
| BOOL SendeData(SOCKET wsocket, const char* pData, int lLen); | ||||
|  | ||||
| #endif | ||||
							
								
								
									
										234
									
								
								CCEXPipe/CCEXPipe.vcproj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										234
									
								
								CCEXPipe/CCEXPipe.vcproj
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,234 @@ | ||||
| <?xml version="1.0" encoding="gb2312"?> | ||||
| <VisualStudioProject | ||||
| 	ProjectType="Visual C++" | ||||
| 	Version="8.00" | ||||
| 	Name="CCEXPipe" | ||||
| 	ProjectGUID="{548705F2-AF3E-45B7-A716-578791B1ECBE}" | ||||
| 	RootNamespace="CCEXPipe" | ||||
| 	Keyword="Win32Proj" | ||||
| 	> | ||||
| 	<Platforms> | ||||
| 		<Platform | ||||
| 			Name="Win32" | ||||
| 		/> | ||||
| 	</Platforms> | ||||
| 	<ToolFiles> | ||||
| 	</ToolFiles> | ||||
| 	<Configurations> | ||||
| 		<Configuration | ||||
| 			Name="Debug|Win32" | ||||
| 			OutputDirectory="$(SolutionDir)bin" | ||||
| 			IntermediateDirectory="$(ConfigurationName)" | ||||
| 			ConfigurationType="2" | ||||
| 			CharacterSet="1" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;CCEXPIPE_EXPORTS;CEX_PIPE_DLL" | ||||
| 				MinimalRebuild="true" | ||||
| 				BasicRuntimeChecks="3" | ||||
| 				RuntimeLibrary="3" | ||||
| 				UsePrecompiledHeader="2" | ||||
| 				WarningLevel="3" | ||||
| 				Detect64BitPortabilityProblems="true" | ||||
| 				DebugInformationFormat="4" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				OutputFile="$(OutDir)\$(ProjectName)D.dll" | ||||
| 				LinkIncremental="2" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				SubSystem="2" | ||||
| 				TargetMachine="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManifestTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCAppVerifierTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebDeploymentTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release|Win32" | ||||
| 			OutputDirectory="$(SolutionDir)$(ConfigurationName)" | ||||
| 			IntermediateDirectory="$(ConfigurationName)" | ||||
| 			ConfigurationType="2" | ||||
| 			CharacterSet="1" | ||||
| 			WholeProgramOptimization="1" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;CCEXPIPE_EXPORTS" | ||||
| 				RuntimeLibrary="2" | ||||
| 				UsePrecompiledHeader="2" | ||||
| 				WarningLevel="3" | ||||
| 				Detect64BitPortabilityProblems="true" | ||||
| 				DebugInformationFormat="3" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				LinkIncremental="1" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				SubSystem="2" | ||||
| 				OptimizeReferences="2" | ||||
| 				EnableCOMDATFolding="2" | ||||
| 				TargetMachine="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManifestTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCAppVerifierTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebDeploymentTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 	</Configurations> | ||||
| 	<References> | ||||
| 	</References> | ||||
| 	<Files> | ||||
| 		<Filter | ||||
| 			Name="Դ<>ļ<EFBFBD>" | ||||
| 			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" | ||||
| 			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" | ||||
| 			> | ||||
| 			<File | ||||
| 				RelativePath=".\CCEXPipe.cpp" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\stdafx.cpp" | ||||
| 				> | ||||
| 				<FileConfiguration | ||||
| 					Name="Debug|Win32" | ||||
| 					> | ||||
| 					<Tool | ||||
| 						Name="VCCLCompilerTool" | ||||
| 						UsePrecompiledHeader="1" | ||||
| 					/> | ||||
| 				</FileConfiguration> | ||||
| 				<FileConfiguration | ||||
| 					Name="Release|Win32" | ||||
| 					> | ||||
| 					<Tool | ||||
| 						Name="VCCLCompilerTool" | ||||
| 						UsePrecompiledHeader="1" | ||||
| 					/> | ||||
| 				</FileConfiguration> | ||||
| 			</File> | ||||
| 		</Filter> | ||||
| 		<Filter | ||||
| 			Name="ͷ<>ļ<EFBFBD>" | ||||
| 			Filter="h;hpp;hxx;hm;inl;inc;xsd" | ||||
| 			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" | ||||
| 			> | ||||
| 			<File | ||||
| 				RelativePath=".\CCEXPipe.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\CCEXPipeLib.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath=".\stdafx.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 		</Filter> | ||||
| 		<Filter | ||||
| 			Name="<22><>Դ<EFBFBD>ļ<EFBFBD>" | ||||
| 			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" | ||||
| 			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" | ||||
| 			> | ||||
| 		</Filter> | ||||
| 		<File | ||||
| 			RelativePath=".\ReadMe.txt" | ||||
| 			> | ||||
| 		</File> | ||||
| 	</Files> | ||||
| 	<Globals> | ||||
| 	</Globals> | ||||
| </VisualStudioProject> | ||||
							
								
								
									
										196
									
								
								CCEXPipe/CCEXPipe.vcxproj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										196
									
								
								CCEXPipe/CCEXPipe.vcxproj
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,196 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||||
|   <ItemGroup Label="ProjectConfigurations"> | ||||
|     <ProjectConfiguration Include="Debug|Win32"> | ||||
|       <Configuration>Debug</Configuration> | ||||
|       <Platform>Win32</Platform> | ||||
|     </ProjectConfiguration> | ||||
|     <ProjectConfiguration Include="Debug|x64"> | ||||
|       <Configuration>Debug</Configuration> | ||||
|       <Platform>x64</Platform> | ||||
|     </ProjectConfiguration> | ||||
|     <ProjectConfiguration Include="Release|Win32"> | ||||
|       <Configuration>Release</Configuration> | ||||
|       <Platform>Win32</Platform> | ||||
|     </ProjectConfiguration> | ||||
|     <ProjectConfiguration Include="Release|x64"> | ||||
|       <Configuration>Release</Configuration> | ||||
|       <Platform>x64</Platform> | ||||
|     </ProjectConfiguration> | ||||
|   </ItemGroup> | ||||
|   <PropertyGroup Label="Globals"> | ||||
|     <ProjectGuid>{548705F2-AF3E-45B7-A716-578791B1ECBE}</ProjectGuid> | ||||
|     <RootNamespace>CCEXPipe</RootNamespace> | ||||
|     <Keyword>Win32Proj</Keyword> | ||||
|     <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> | ||||
|   </PropertyGroup> | ||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | ||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> | ||||
|     <ConfigurationType>DynamicLibrary</ConfigurationType> | ||||
|     <CharacterSet>MultiByte</CharacterSet> | ||||
|     <WholeProgramOptimization>true</WholeProgramOptimization> | ||||
|     <PlatformToolset>v143</PlatformToolset> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> | ||||
|     <ConfigurationType>DynamicLibrary</ConfigurationType> | ||||
|     <CharacterSet>MultiByte</CharacterSet> | ||||
|     <WholeProgramOptimization>true</WholeProgramOptimization> | ||||
|     <PlatformToolset>v143</PlatformToolset> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> | ||||
|     <ConfigurationType>DynamicLibrary</ConfigurationType> | ||||
|     <CharacterSet>MultiByte</CharacterSet> | ||||
|     <PlatformToolset>v143</PlatformToolset> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> | ||||
|     <ConfigurationType>DynamicLibrary</ConfigurationType> | ||||
|     <CharacterSet>MultiByte</CharacterSet> | ||||
|     <PlatformToolset>v143</PlatformToolset> | ||||
|   </PropertyGroup> | ||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | ||||
|   <ImportGroup Label="ExtensionSettings"> | ||||
|   </ImportGroup> | ||||
|   <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> | ||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||||
|   </ImportGroup> | ||||
|   <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> | ||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||||
|   </ImportGroup> | ||||
|   <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> | ||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||||
|   </ImportGroup> | ||||
|   <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> | ||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||||
|   </ImportGroup> | ||||
|   <PropertyGroup Label="UserMacros" /> | ||||
|   <PropertyGroup> | ||||
|     <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion> | ||||
|     <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> | ||||
|     <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> | ||||
|     <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir> | ||||
|     <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> | ||||
|     <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> | ||||
|     <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> | ||||
|     <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir> | ||||
|     <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> | ||||
|     <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental> | ||||
|     <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> | ||||
|     <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> | ||||
|     <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> | ||||
|     <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> | ||||
|     <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> | ||||
|     <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> | ||||
|     <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> | ||||
|     <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> | ||||
|     <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> | ||||
|     <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> | ||||
|     <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> | ||||
|     <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> | ||||
|     <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectName)D</TargetName> | ||||
|     <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectName)D</TargetName> | ||||
|   </PropertyGroup> | ||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||||
|     <ClCompile> | ||||
|       <Optimization>Disabled</Optimization> | ||||
|       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;CCEXPIPE_EXPORTS;CEX_PIPE_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <MinimalRebuild>true</MinimalRebuild> | ||||
|       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> | ||||
|       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> | ||||
|       <PrecompiledHeader>Use</PrecompiledHeader> | ||||
|       <WarningLevel>Level3</WarningLevel> | ||||
|       <DebugInformationFormat>EditAndContinue</DebugInformationFormat> | ||||
|     </ClCompile> | ||||
|     <Link> | ||||
|       <OutputFile>$(OutDir)$(ProjectName)D.dll</OutputFile> | ||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> | ||||
|       <SubSystem>Windows</SubSystem> | ||||
|       <TargetMachine>MachineX86</TargetMachine> | ||||
|       <ModuleDefinitionFile>.\CCEXPipeD.def</ModuleDefinitionFile> | ||||
|       <ImportLibrary>../../build/library/lib/$(TargetName).lib</ImportLibrary> | ||||
|       <AdditionalDependencies>Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> | ||||
|     </Link> | ||||
|   </ItemDefinitionGroup> | ||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||||
|     <ClCompile> | ||||
|       <Optimization>Disabled</Optimization> | ||||
|       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;CCEXPIPE_EXPORTS;CEX_PIPE_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> | ||||
|       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> | ||||
|       <PrecompiledHeader>Use</PrecompiledHeader> | ||||
|       <WarningLevel>Level3</WarningLevel> | ||||
|       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | ||||
|     </ClCompile> | ||||
|     <Link> | ||||
|       <OutputFile>$(OutDir)$(ProjectName)D.dll</OutputFile> | ||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> | ||||
|       <SubSystem>Windows</SubSystem> | ||||
|       <ModuleDefinitionFile>.\CCEXPipeD.def</ModuleDefinitionFile> | ||||
|       <ImportLibrary>$(SolutionDir)$(Platform)\$(Configuration)\$(TargetName).lib</ImportLibrary> | ||||
|       <AdditionalDependencies>Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> | ||||
|     </Link> | ||||
|   </ItemDefinitionGroup> | ||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||||
|     <ClCompile> | ||||
|       <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;CCEXPIPE_EXPORTS;CEX_PIPE_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> | ||||
|       <PrecompiledHeader>Use</PrecompiledHeader> | ||||
|       <WarningLevel>Level3</WarningLevel> | ||||
|       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | ||||
|     </ClCompile> | ||||
|     <Link> | ||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> | ||||
|       <SubSystem>Windows</SubSystem> | ||||
|       <OptimizeReferences>true</OptimizeReferences> | ||||
|       <EnableCOMDATFolding>true</EnableCOMDATFolding> | ||||
|       <TargetMachine>MachineX86</TargetMachine> | ||||
|       <AdditionalDependencies>Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> | ||||
|       <ModuleDefinitionFile>.\CCEXPipe.def</ModuleDefinitionFile> | ||||
|       <ImportLibrary>../../build/library/lib/$(TargetName).lib</ImportLibrary> | ||||
|     </Link> | ||||
|   </ItemDefinitionGroup> | ||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||||
|     <ClCompile> | ||||
|       <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;CCEXPIPE_EXPORTS;CEX_PIPE_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> | ||||
|       <PrecompiledHeader>Use</PrecompiledHeader> | ||||
|       <WarningLevel>Level3</WarningLevel> | ||||
|       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | ||||
|     </ClCompile> | ||||
|     <Link> | ||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> | ||||
|       <SubSystem>Windows</SubSystem> | ||||
|       <OptimizeReferences>true</OptimizeReferences> | ||||
|       <EnableCOMDATFolding>true</EnableCOMDATFolding> | ||||
|       <AdditionalDependencies>Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> | ||||
|       <ModuleDefinitionFile>.\CCEXPipe.def</ModuleDefinitionFile> | ||||
|       <ImportLibrary>$(SolutionDir)$(Platform)\$(Configuration)\$(TargetName).lib</ImportLibrary> | ||||
|       <OutputFile>$(OutDir)$(ProjectName).dll</OutputFile> | ||||
|     </Link> | ||||
|   </ItemDefinitionGroup> | ||||
|   <ItemGroup> | ||||
|     <ClCompile Include="CCEXPipe.cpp" /> | ||||
|     <ClCompile Include="CCEXPipeClient.cpp" /> | ||||
|     <ClCompile Include="CCEXPipeServer.cpp" /> | ||||
|     <ClCompile Include="stdafx.cpp"> | ||||
|       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> | ||||
|       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader> | ||||
|       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader> | ||||
|       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader> | ||||
|     </ClCompile> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <ClInclude Include="CCEXPipe.h" /> | ||||
|     <ClInclude Include="CCEXPipeClient.h" /> | ||||
|     <ClInclude Include="CCEXPipeLib.h" /> | ||||
|     <ClInclude Include="CCEXPipeServer.h" /> | ||||
|     <ClInclude Include="stdafx.h" /> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <None Include="CCEXPipe.def" /> | ||||
|     <None Include="CCEXPipeD.def" /> | ||||
|     <None Include="ReadMe.txt" /> | ||||
|   </ItemGroup> | ||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||||
|   <ImportGroup Label="ExtensionTargets"> | ||||
|   </ImportGroup> | ||||
| </Project> | ||||
							
								
								
									
										57
									
								
								CCEXPipe/CCEXPipe.vcxproj.filters
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								CCEXPipe/CCEXPipe.vcxproj.filters
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,57 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||||
|   <ItemGroup> | ||||
|     <Filter Include="源文件"> | ||||
|       <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> | ||||
|       <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> | ||||
|     </Filter> | ||||
|     <Filter Include="头文件"> | ||||
|       <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> | ||||
|       <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> | ||||
|     </Filter> | ||||
|     <Filter Include="资源文件"> | ||||
|       <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> | ||||
|       <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions> | ||||
|     </Filter> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <ClCompile Include="CCEXPipe.cpp"> | ||||
|       <Filter>源文件</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="stdafx.cpp"> | ||||
|       <Filter>源文件</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="CCEXPipeClient.cpp"> | ||||
|       <Filter>源文件</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="CCEXPipeServer.cpp"> | ||||
|       <Filter>源文件</Filter> | ||||
|     </ClCompile> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <ClInclude Include="CCEXPipe.h"> | ||||
|       <Filter>头文件</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="CCEXPipeLib.h"> | ||||
|       <Filter>头文件</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="stdafx.h"> | ||||
|       <Filter>头文件</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="CCEXPipeClient.h"> | ||||
|       <Filter>头文件</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="CCEXPipeServer.h"> | ||||
|       <Filter>头文件</Filter> | ||||
|     </ClInclude> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <None Include="ReadMe.txt" /> | ||||
|     <None Include="CCEXPipe.def"> | ||||
|       <Filter>源文件</Filter> | ||||
|     </None> | ||||
|     <None Include="CCEXPipeD.def"> | ||||
|       <Filter>源文件</Filter> | ||||
|     </None> | ||||
|   </ItemGroup> | ||||
| </Project> | ||||
							
								
								
									
										144
									
								
								CCEXPipe/CCEXPipeClient.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										144
									
								
								CCEXPipe/CCEXPipeClient.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,144 @@ | ||||
| // CCEXPipe.cpp : <20><><EFBFBD><EFBFBD> DLL Ӧ<>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ㡣 | ||||
| // | ||||
|  | ||||
| #include "stdafx.h" | ||||
| #include "CCEXPipeClient.h" | ||||
| #include <process.h> | ||||
| #include <stdlib.h> | ||||
|  | ||||
|  | ||||
| CCEXPipeClientBase* CCEXPipeClientBase::CreateObj() | ||||
| { | ||||
| 	return new CCEXPipeClient(); | ||||
| } | ||||
|  | ||||
| CCEXPipeClient::CCEXPipeClient() | ||||
| { | ||||
| 	m_hClientThr = NULL; | ||||
| 	m_bConnect = FALSE; | ||||
| 	m_lPort = -1; | ||||
| 	m_socket = SOCKET_ERROR; | ||||
| 	InitializeCriticalSection(&m_cySocket); | ||||
| } | ||||
|  | ||||
| CCEXPipeClient::~CCEXPipeClient() | ||||
| { | ||||
| 	DeleteCriticalSection(&m_cySocket); | ||||
| } | ||||
|  | ||||
| unsigned int __stdcall g_PipClientThr(void* pPara) | ||||
| { | ||||
| 	return ((CCEXPipeClient*)pPara)->ClientThr(); | ||||
| } | ||||
|  | ||||
| BOOL CCEXPipeClient::SendeData(const char* pData, int lLen) | ||||
| { | ||||
| 	EnterCriticalSection(&m_cySocket); | ||||
| 	if (-1 == m_socket) | ||||
| 	{ | ||||
| 		LeaveCriticalSection(&m_cySocket); | ||||
| 		return FALSE; | ||||
| 	} | ||||
|  | ||||
| 	BOOL bRes = ::SendeData(m_socket, pData, lLen); | ||||
|  | ||||
| 	LeaveCriticalSection(&m_cySocket); | ||||
|  | ||||
| 	return bRes; | ||||
| } | ||||
|  | ||||
| BOOL CCEXPipeClient::SendeMsg(int lMsgId, const char* pData, int lLen) | ||||
| { | ||||
| 	PIPE_DATA_STRUCT* pstSend = (PIPE_DATA_STRUCT*)new char[sizeof(PIPE_DATA_STRUCT) + lLen - sizeof(char[4])]; | ||||
| 	pstSend->lMsgId = lMsgId; | ||||
| 	pstSend->lDataLen = lLen; | ||||
| 	if (NULL != pData) | ||||
| 	{ | ||||
| 		memcpy(&pstSend->acData, pData, lLen); | ||||
| 	} | ||||
| 	BOOL bRes = SendeData((const char*)pstSend, sizeof(PIPE_DATA_STRUCT) + lLen - sizeof(char[4])); | ||||
| 	delete [] (char*)pstSend; | ||||
| 	pstSend = NULL; | ||||
|  | ||||
| 	return bRes; | ||||
| } | ||||
|  | ||||
| BOOL CCEXPipeClient::Connect(const char* pPipeName) | ||||
| { | ||||
| 	if (NULL != m_hClientThr) | ||||
| 	{ | ||||
| 		return FALSE; | ||||
| 	} | ||||
| 	m_lPort = atoi(pPipeName); | ||||
| 	m_bConnect = TRUE; | ||||
| 	m_hClientThr = (HANDLE)_beginthreadex(NULL, 0, g_PipClientThr, this, 0, NULL); | ||||
|  | ||||
| 	return TRUE; | ||||
| } | ||||
|  | ||||
| BOOL CCEXPipeClient::DisConnect() | ||||
| { | ||||
| 	if (NULL == m_hClientThr) | ||||
| 	{ | ||||
| 		return FALSE; | ||||
| 	} | ||||
| 	m_bConnect = FALSE; | ||||
| 	if (SOCKET_ERROR != m_socket) | ||||
| 	{ | ||||
| 		closesocket(m_socket); | ||||
| 		m_socket = SOCKET_ERROR; | ||||
| 	} | ||||
| 	if (WAIT_TIMEOUT == WaitForSingleObject(m_hClientThr, 2000)) | ||||
| 	{ | ||||
| 		LogOutToFile("ERROR: CCEXPipeClient::DisConnect\r\n"); | ||||
| 		TerminateThread(m_hClientThr, 0); | ||||
| 	} | ||||
|  | ||||
| 	return TRUE; | ||||
| } | ||||
|  | ||||
|  | ||||
| unsigned int CCEXPipeClient::ClientThr() | ||||
| { | ||||
| 	char *pReadBuf = new char[MAX_PIP_BUF]; | ||||
| 	for (;TRUE == m_bConnect;) | ||||
| 	{ | ||||
| 		SOCKET socket_lisent = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); | ||||
| 		SOCKADDR_IN stAddr; | ||||
| 		ZeroMemory(&stAddr, sizeof(stAddr));                /*<2A>ռ<EFBFBD><D5BC><EFBFBD>ַ<EFBFBD>ṹ<EFBFBD><E1B9B9><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5>ڴ<EFBFBD><DAB4>ռ䡣*/ | ||||
| 		stAddr.sin_family=AF_INET;                /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>˿ڵ<CBBF><DAB5><EFBFBD>Ϣ<EFBFBD><CFA2>*/ | ||||
| 		stAddr.sin_port=htons(m_lPort);        /*<2A>˿ڡ<CBBF>*/ | ||||
| 		stAddr.sin_addr.s_addr=inet_addr("127.0.0.1"); | ||||
|  | ||||
| 		if (SOCKET_ERROR == connect(socket_lisent, (SOCKADDR*)&stAddr, sizeof(SOCKADDR_IN))) | ||||
| 		{ | ||||
| 			LogOutToFile("CCEXPipeClient::ClientThr connect error.[%d]", GetLastError()); | ||||
| 			closesocket(socket_lisent); | ||||
| 			break; | ||||
| 		} | ||||
| 		m_socket = socket_lisent; | ||||
| 		m_pCallBackFun(m_pCallBackObj, CEXPIPE_CONNECT_OK, NULL, NULL); | ||||
| 		for (;;) | ||||
| 		{ | ||||
| 			int lPacketLen = 0; | ||||
| 			memset(pReadBuf, 0, MAX_PIP_BUF); | ||||
| 			if (FALSE == ReadPipePacket(m_socket, pReadBuf, MAX_PIP_BUF, lPacketLen)) | ||||
| 			{ | ||||
| 				LogOutToFile("<EFBFBD><EFBFBD>ȡ<EFBFBD>ܵ<EFBFBD>ʧ<EFBFBD><EFBFBD>1[%d] [%d]", GetLastError(), lPacketLen); | ||||
| 				break; | ||||
| 			} | ||||
|  | ||||
| 			pReadBuf[lPacketLen] = '\0'; | ||||
|  | ||||
| 			m_pCallBackFun(m_pCallBackObj, CEXPIPE_NEW_DATA, (WPARAM)pReadBuf, (LPARAM)lPacketLen); | ||||
| 		} | ||||
| 		closesocket(socket_lisent); | ||||
| 		break;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7> | ||||
| 	} | ||||
|  | ||||
| 	delete [] pReadBuf; | ||||
| 	m_pCallBackFun(m_pCallBackObj, CEXPIPE_DIS_CLIENT, NULL, NULL); | ||||
|  | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
							
								
								
									
										37
									
								
								CCEXPipe/CCEXPipeClient.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								CCEXPipe/CCEXPipeClient.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,37 @@ | ||||
| #ifndef _CCEX_PIPE_CLIENT_H__ | ||||
| #define _CCEX_PIPE_CLIENT_H__ | ||||
| #include "CCEXPipe.h" | ||||
| #include "CCEXPipeLib.h" | ||||
|  | ||||
| class CCEXPipeClient :public CCEXPipeClientBase | ||||
| { | ||||
| 	friend unsigned int __stdcall g_PipClientThr(void* pPara); | ||||
|  | ||||
| public: | ||||
| 	CCEXPipeClient(); | ||||
| 	~CCEXPipeClient(); | ||||
|  | ||||
| protected: | ||||
| 	virtual BOOL SendeData(const char* pData, int lLen); | ||||
| 	virtual BOOL SendeMsg(int lMsgId, const char* pData, int lLen); | ||||
| 	virtual BOOL Connect(const char* pPipeName); | ||||
| 	virtual BOOL DisConnect(); | ||||
|  | ||||
| 	unsigned int ClientThr(); | ||||
|  | ||||
| private: | ||||
| 	HANDLE m_hClientThr; | ||||
|  | ||||
| 	BOOL m_bConnect; | ||||
|  | ||||
| 	//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӷ˿ں<CBBF> | ||||
| 	short m_lPort; | ||||
|  | ||||
| 	SOCKET m_socket; | ||||
|  | ||||
| 	//socketͬ<74><CDAC><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD> | ||||
| 	CRITICAL_SECTION m_cySocket; | ||||
| }; | ||||
|  | ||||
|  | ||||
| #endif | ||||
							
								
								
									
										6
									
								
								CCEXPipe/CCEXPipeD.def
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								CCEXPipe/CCEXPipeD.def
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,6 @@ | ||||
| ; DataBaseManager.def : <EFBFBD><EFBFBD><EFBFBD><EFBFBD> DLL <EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||
|  | ||||
| LIBRARY      "CCEXPipeD" | ||||
|  | ||||
| EXPORTS | ||||
|     ; <EFBFBD>˴<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||
							
								
								
									
										108
									
								
								CCEXPipe/CCEXPipeLib.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										108
									
								
								CCEXPipe/CCEXPipeLib.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,108 @@ | ||||
| #ifndef _CCEX_PIPE_LIB_H__ | ||||
| #define _CCEX_PIPE_LIB_H__ | ||||
|  | ||||
|  | ||||
| #ifdef CEX_PIPE_DLL | ||||
|  | ||||
| 	#define CEX_PIPE_API __declspec(dllexport) | ||||
|  | ||||
| #else | ||||
|  | ||||
| 	#define CEX_PIPE_API __declspec(dllimport) | ||||
|  | ||||
| 	#ifdef _DEBUG | ||||
| 		#pragma comment(lib, "CCEXPipeD.lib") | ||||
| 	#else | ||||
| 		#pragma comment(lib, "CCEXPipe.lib") | ||||
| 	#endif | ||||
|  | ||||
| #endif | ||||
|  | ||||
| typedef void(*CEXPipeCallFunType)(void*, int lMsgId, WPARAM,LPARAM); | ||||
|  | ||||
|  | ||||
| //<2F><><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD>Ϣ | ||||
| #define CEXPIPE_NEW_CLIENT	(1) | ||||
| #define CEXPIPE_DIS_CLIENT	(2) | ||||
| #define CEXPIPE_NEW_DATA	(3) | ||||
| #define CEXPIPE_CONNECT_OK	(4) | ||||
|  | ||||
| #define MAX_PIP_BUF (1024*1024) | ||||
|  | ||||
| ////////////////////////////////////////////////////////////////////////// | ||||
| //<2F><><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5>ͨѶ<CDA8><D1B6><EFBFBD>ض<EFBFBD><D8B6>壬<EFBFBD><E5A3AC><EFBFBD>ܺ<EFBFBD>ģ<EFBFBD><C4A3>ͨѶ<CDA8><D1B6>ͬʹ<CDAC>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨѶ<CDA8><D1B6><EFBFBD>з<EFBFBD><D0B7><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD>¡<EFBFBD> | ||||
| //msgid<69>ֶΣ<D6B6>WCS<43><53><EFBFBD><EFBFBD>WMS<4D><53><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>url<72><6C>ͬ<EFBFBD>ݶ<EFBFBD><DDB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||
| typedef enum | ||||
| { | ||||
| 	WCS_2_WMS_ABNORMAL = 1000, | ||||
| 	WCS_2_WMS_DATA = 1001, | ||||
|  | ||||
| 	MAIN_2_MODULE_WMS = 2000, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>WMS<4D><53>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3> | ||||
| 	MAIN_2_MODULE_SHOWWINDOW = 2001 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֪ͨģ<D6AA><C4A3><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD> | ||||
| }WCS_2_WMS_TYPE; | ||||
| ////////////////////////////////////////////////////////////////////////// | ||||
|  | ||||
| typedef struct PIPE_DATA_STRUCT  | ||||
| { | ||||
| 	int lMsgId; | ||||
| 	int lDataLen; | ||||
| 	char acData[4];//<2F><><EFBFBD><EFBFBD>--<2D><>֤<EFBFBD><D6A4><EFBFBD>ֽڶ<D6BD><DAB6>룬ʵ<EBA3AC><CAB5><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><DDB3>ȶ<EFBFBD>̬<EFBFBD>仯 | ||||
|  | ||||
| }*pPIPE_DATA_STRUCT; | ||||
|  | ||||
| class CEX_PIPE_API CCEXPipeServerBase | ||||
| { | ||||
| public: | ||||
| 	static CCEXPipeServerBase* CreateObj(); | ||||
|  | ||||
| 	CCEXPipeServerBase() | ||||
| 	{ | ||||
| 		m_pCallBackObj = NULL; | ||||
| 		m_pCallBackFun = NULL; | ||||
| 	}; | ||||
|  | ||||
| 	virtual ~CCEXPipeServerBase(){}; | ||||
| 	//ע<><D7A2><EFBFBD>ܵ<EFBFBD><DCB5><EFBFBD>Ϣ<EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD> | ||||
| 	void RegisterCall(CEXPipeCallFunType pCallBack, void* pObj){m_pCallBackFun = pCallBack; m_pCallBackObj = pObj;} | ||||
| 	//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD><DDB5>ܵ<EFBFBD> | ||||
| 	virtual BOOL SendeData(const char* pData, int lLen) = 0; | ||||
| 	virtual BOOL SendeMsg(int lMsgId, const char* pData, int lLen) = 0; | ||||
| 	virtual BOOL Start(const char* pPipeName) = 0; | ||||
| 	virtual BOOL Stop() = 0; | ||||
| 	virtual BOOL IsAcitve() = 0; | ||||
| 	virtual BOOL IsConnect() = 0; | ||||
| protected: | ||||
|  | ||||
| 	void* m_pCallBackObj; | ||||
| 	CEXPipeCallFunType m_pCallBackFun; | ||||
| }; | ||||
|   | ||||
|  | ||||
| class CEX_PIPE_API CCEXPipeClientBase | ||||
| { | ||||
| public: | ||||
| 	static CCEXPipeClientBase* CreateObj(); | ||||
|  | ||||
| 	CCEXPipeClientBase() | ||||
| 	{ | ||||
| 		m_pCallBackObj = NULL; | ||||
| 		m_pCallBackFun = NULL; | ||||
| 	}; | ||||
|  | ||||
| 	virtual ~CCEXPipeClientBase(){}; | ||||
| 	//ע<><D7A2><EFBFBD>ܵ<EFBFBD><DCB5><EFBFBD>Ϣ<EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD> | ||||
| 	void RegisterCall(CEXPipeCallFunType pCallBack, void* pObj){m_pCallBackFun = pCallBack; m_pCallBackObj = pObj;} | ||||
| 	//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD><DDB5>ܵ<EFBFBD> | ||||
| 	virtual BOOL SendeData(const char* pData, int lLen) = 0; | ||||
| 	virtual BOOL SendeMsg(int lMsgId, const char* pData, int lLen) = 0; | ||||
| 	virtual BOOL Connect(const char* pPipeName) = 0; | ||||
| 	virtual BOOL DisConnect() = 0; | ||||
|  | ||||
| protected: | ||||
| 	void* m_pCallBackObj; | ||||
| 	CEXPipeCallFunType m_pCallBackFun; | ||||
| }; | ||||
|  | ||||
|  | ||||
|  | ||||
| #endif | ||||
							
								
								
									
										189
									
								
								CCEXPipe/CCEXPipeServer.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										189
									
								
								CCEXPipe/CCEXPipeServer.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,189 @@ | ||||
| // CCEXPipe.cpp : <20><><EFBFBD><EFBFBD> DLL Ӧ<>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ㡣 | ||||
| // | ||||
|  | ||||
| #include "stdafx.h" | ||||
| #include "CCEXPipeServer.h" | ||||
| #include <process.h> | ||||
| #include <stdlib.h> | ||||
|  | ||||
|  | ||||
| CCEXPipeServerBase* CCEXPipeServerBase::CreateObj() | ||||
| { | ||||
| 	return new CCEXPipeServer(); | ||||
| } | ||||
|  | ||||
| CCEXPipeServer::CCEXPipeServer() | ||||
| { | ||||
| 	m_hServerThr = NULL; | ||||
|  | ||||
| 	m_bActive = FALSE; | ||||
|  | ||||
| 	m_lPort = 0; | ||||
| 	 | ||||
| 	m_socket = -1; | ||||
|  | ||||
| 	m_LisentSock = -1; | ||||
|  | ||||
| 	InitializeCriticalSection(&m_cySocket); | ||||
| } | ||||
|  | ||||
| CCEXPipeServer::~CCEXPipeServer() | ||||
| { | ||||
| 	DeleteCriticalSection(&m_cySocket); | ||||
| } | ||||
|  | ||||
| BOOL CCEXPipeServer::SendeData(const char* pData, int lLen) | ||||
| { | ||||
| 	EnterCriticalSection(&m_cySocket); | ||||
| 	if (-1 == m_socket) | ||||
| 	{ | ||||
| 		LeaveCriticalSection(&m_cySocket); | ||||
| 		return FALSE; | ||||
| 	} | ||||
|  | ||||
| 	BOOL bRes = ::SendeData(m_socket, pData, lLen); | ||||
|  | ||||
| 	LeaveCriticalSection(&m_cySocket); | ||||
|  | ||||
| 	return bRes; | ||||
| } | ||||
|  | ||||
| BOOL CCEXPipeServer::SendeMsg(int lMsgId, const char* pData, int lLen) | ||||
| { | ||||
| 	PIPE_DATA_STRUCT* pstSend = (PIPE_DATA_STRUCT*)new char[sizeof(PIPE_DATA_STRUCT) + lLen - sizeof(char[4])]; | ||||
| 	pstSend->lMsgId = lMsgId; | ||||
| 	pstSend->lDataLen = lLen; | ||||
| 	if (NULL != pData) | ||||
| 	{ | ||||
| 		memcpy(&pstSend->acData, pData, lLen); | ||||
| 	} | ||||
| 	BOOL bRes = SendeData((const char*)pstSend, sizeof(PIPE_DATA_STRUCT) + lLen - sizeof(char[4])); | ||||
| 	delete [] (char*)pstSend; | ||||
| 	pstSend = NULL; | ||||
|  | ||||
| 	return bRes; | ||||
| } | ||||
|  | ||||
| unsigned int __stdcall g_PipServerThr(void* pPara) | ||||
| { | ||||
| 	return ((CCEXPipeServer*)pPara)->ServerThr(); | ||||
| } | ||||
|  | ||||
| BOOL CCEXPipeServer::Start(const char* pPipeName) | ||||
| { | ||||
| 	if (TRUE == m_bActive) | ||||
| 	{ | ||||
| 		return FALSE; | ||||
| 	} | ||||
|  | ||||
| 	//<2F><><EFBFBD><EFBFBD>windows<77>ܵ<EFBFBD>Ϊ<EFBFBD><CEAA>˫<EFBFBD><CBAB><EFBFBD><EFBFBD><EFBFBD>ײ㲻ʹ<E3B2BB>ùܵ<C3B9><DCB5>ˣ<EFBFBD>ֱ<EFBFBD><D6B1>ʹ<EFBFBD><CAB9>socket | ||||
| 	m_bActive = TRUE; | ||||
| 	m_lPort = atoi(pPipeName); | ||||
| 	m_LisentSock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); | ||||
| 	int opt = 1; | ||||
| 	setsockopt(m_LisentSock, SOL_SOCKET, SO_REUSEADDR, (const char *)&opt, sizeof(opt));   | ||||
| 	SOCKADDR_IN stAddr; | ||||
| 	ZeroMemory(&stAddr, sizeof(stAddr));                /*<2A>ռ<EFBFBD><D5BC><EFBFBD>ַ<EFBFBD>ṹ<EFBFBD><E1B9B9><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5>ڴ<EFBFBD><DAB4>ռ䡣*/ | ||||
| 	stAddr.sin_family=AF_INET;                /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>˿ڵ<CBBF><DAB5><EFBFBD>Ϣ<EFBFBD><CFA2>*/ | ||||
| 	stAddr.sin_port=htons(m_lPort);        /*<2A>˿ڡ<CBBF>*/ | ||||
| 	stAddr.sin_addr.s_addr=inet_addr("127.0.0.1"); | ||||
| 	if (SOCKET_ERROR == bind(m_LisentSock, (SOCKADDR*)&stAddr, sizeof(SOCKADDR_IN))) | ||||
| 	{ | ||||
| 		LogOutToFile("CCEXPipeServer::ServerThr bind error.[%d]",GetLastError()); | ||||
| 		closesocket(m_LisentSock); | ||||
| 		return FALSE; | ||||
| 	} | ||||
|  | ||||
| 	if (SOCKET_ERROR == listen(m_LisentSock, 1))   | ||||
| 	{   | ||||
| 		LogOutToFile("CCEXPipeServer::ServerThr listen error.[%d]",GetLastError());  | ||||
| 		closesocket(m_LisentSock); //<2F>ر<EFBFBD><D8B1><EFBFBD><D7BD><EFBFBD> | ||||
| 		return FALSE; | ||||
| 	}   | ||||
|  | ||||
| 	m_hServerThr = (HANDLE)_beginthreadex(NULL, 0, g_PipServerThr, this, 0, NULL); | ||||
|  | ||||
| 	return TRUE; | ||||
| } | ||||
|  | ||||
| BOOL CCEXPipeServer::SleepForActive(int lMs) | ||||
| { | ||||
| 	for (int i = 0; i < lMs && TRUE == m_bActive; i+=20) | ||||
| 	{ | ||||
| 		Sleep(lMs); | ||||
| 	} | ||||
| 	return m_bActive; | ||||
| } | ||||
|  | ||||
| unsigned int CCEXPipeServer::ServerThr() | ||||
| { | ||||
| 	char* pReadBuf = new char[MAX_PIP_BUF]; | ||||
| 	HANDLE hEvent = NULL; | ||||
| 	for (;m_bActive;) | ||||
| 	{ | ||||
| 		//<2F>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD><EFBFBD> | ||||
| 		SOCKADDR_IN stNewAddr = {0}; | ||||
| 		int lNewAddrLen = sizeof(SOCKADDR_IN); | ||||
| 		m_socket = accept(m_LisentSock, (struct sockaddr *)&stNewAddr, &lNewAddrLen); | ||||
| 		if (SOCKET_ERROR == m_socket) | ||||
| 		{ | ||||
| 			LogOutToFile("CCEXPipeServer::ServerThr accept error.[%d]",GetLastError());  | ||||
| 			SleepForActive(2000); | ||||
| 			continue; | ||||
| 		} | ||||
|  | ||||
| 		//֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD><EFBFBD>̣߳<DFB3><CCA3>пͻ<D0BF><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||
| 		m_pCallBackFun(m_pCallBackObj, CEXPIPE_NEW_CLIENT, NULL, NULL); | ||||
|  | ||||
| 		for (;;) | ||||
| 		{ | ||||
| 			int lRead = 0; | ||||
| 			memset(pReadBuf, 0, MAX_PIP_BUF); | ||||
| 			//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD><DCB5>ж<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD> | ||||
| 			if(FALSE == ReadPipePacket(m_socket, pReadBuf, MAX_PIP_BUF-1, lRead)) | ||||
| 			{ | ||||
| 				//PostMessage(m_hWnd, WM_PIPE_DIS_CLIENT, (WPARAM)this, (LPARAM)NULL); | ||||
| 				m_pCallBackFun(m_pCallBackObj, CEXPIPE_DIS_CLIENT, (WPARAM)this, (LPARAM)NULL); | ||||
| 				break; | ||||
| 			} | ||||
|  | ||||
| 			pReadBuf[lRead] = '\0'; | ||||
|  | ||||
| 			m_pCallBackFun(m_pCallBackObj, CEXPIPE_NEW_DATA, (WPARAM)pReadBuf, (LPARAM)lRead); | ||||
| 		} | ||||
| 		closesocket(m_socket); | ||||
| 		m_socket = SOCKET_ERROR; | ||||
| 	} | ||||
|  | ||||
| 	delete [] pReadBuf; | ||||
| 	LogOutToFile("CCEXPipeServer::ServerThr <20>˳<EFBFBD>[%d]", GetLastError()); | ||||
|  | ||||
| 	m_hServerThr = NULL; | ||||
| 	 | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
| BOOL CCEXPipeServer::Stop() | ||||
| { | ||||
| 	if (NULL == m_hServerThr) | ||||
| 	{ | ||||
| 		//<2F>Ѿ<EFBFBD>ֹͣ<CDA3><D6B9> | ||||
| 		return FALSE; | ||||
| 	} | ||||
|  | ||||
| 	m_bActive = FALSE; | ||||
| 	closesocket(m_LisentSock); | ||||
| 	closesocket(m_socket); | ||||
| 	if (WAIT_TIMEOUT == WaitForSingleObject(m_hServerThr, 2000)) | ||||
| 	{ | ||||
| 		LogOutToFile("ERROR: CCEXPipeServer::Stop timeout\r\n"); | ||||
| 		TerminateThread(m_hServerThr, 0); | ||||
| 		m_hServerThr = NULL; | ||||
| 	} | ||||
| 	m_hServerThr = NULL; | ||||
| 	return TRUE; | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
							
								
								
									
										42
									
								
								CCEXPipe/CCEXPipeServer.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								CCEXPipe/CCEXPipeServer.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,42 @@ | ||||
| #ifndef _CCEX_PIPE_SERVER_H__ | ||||
| #define _CCEX_PIPE_SERVER_H__ | ||||
| #include "CCEXPipe.h" | ||||
| #include "CCEXPipeLib.h" | ||||
| #include <WinSock2.h> | ||||
|  | ||||
| class CCEXPipeServer :public CCEXPipeServerBase | ||||
| { | ||||
| 	friend unsigned int __stdcall g_PipServerThr(void* pPara); | ||||
| public: | ||||
| 	CCEXPipeServer(); | ||||
| 	~CCEXPipeServer(); | ||||
|  | ||||
| protected: | ||||
| 	virtual BOOL SendeData(const char* pData, int lLen); | ||||
| 	virtual BOOL SendeMsg(int lMsgId, const char* pData, int lLen); | ||||
| 	virtual BOOL Start(const char* pPipeName); | ||||
| 	virtual BOOL Stop(); | ||||
| 	unsigned int ServerThr(); | ||||
| 	virtual BOOL IsAcitve(){return m_bActive;} | ||||
| 	virtual BOOL IsConnect(){return m_socket != -1;} | ||||
|  | ||||
| 	//<2F><><EFBFBD><EFBFBD>״̬<D7B4><CCAC>˯<EFBFBD>ߵȴ<DFB5><C8B4><EFBFBD>ֹͣ<CDA3><D6B9><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD> | ||||
| 	BOOL SleepForActive(int lMs); | ||||
|  | ||||
| private: | ||||
|  | ||||
| 	HANDLE m_hServerThr; | ||||
| 	BOOL m_bActive; | ||||
|  | ||||
| 	//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӷ˿ں<CBBF> | ||||
| 	short m_lPort; | ||||
|  | ||||
| 	SOCKET m_LisentSock; | ||||
| 	SOCKET m_socket; | ||||
|  | ||||
| 	//socketͬ<74><CDAC><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD> | ||||
| 	CRITICAL_SECTION m_cySocket; | ||||
| }; | ||||
|  | ||||
|  | ||||
| #endif | ||||
							
								
								
									
										36
									
								
								CCEXPipe/ReadMe.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								CCEXPipe/ReadMe.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,36 @@ | ||||
| ======================================================================== | ||||
| <EFBFBD><EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD>ӿ⣺CCEXPipe <20><>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD> | ||||
| ======================================================================== | ||||
|  | ||||
| Ӧ<EFBFBD>ó<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD> CCEXPipe DLL<4C><4C>   | ||||
|  | ||||
| <EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> CCEXPipe Ӧ<>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݡ<EFBFBD> | ||||
|  | ||||
|  | ||||
| CCEXPipe.vcproj | ||||
| <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD>Ӧ<EFBFBD>ó<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɵ<EFBFBD> VC++ <20><>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>  | ||||
| <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɸ<EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD> Visual C++ <20>İ汾<C4B0><E6B1BE>Ϣ<EFBFBD><CFA2><EFBFBD>Լ<EFBFBD><D4BC>й<EFBFBD>ʹ<EFBFBD><CAB9>Ӧ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>ƽ̨<C6BD><CCA8><EFBFBD><EFBFBD><EFBFBD>ú<EFBFBD><C3BA><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD>ܵ<EFBFBD><DCB5><EFBFBD>Ϣ<EFBFBD><CFA2> | ||||
|  | ||||
| CCEXPipe.cpp | ||||
| <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> DLL Դ<>ļ<EFBFBD><C4BC><EFBFBD> | ||||
|  | ||||
| 	<09><> DLL <20>ڴ<EFBFBD><DAB4><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>κη<CEBA><CEB7>š<EFBFBD><C5A1><EFBFBD><EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD><EFBFBD><EFBFBD> | ||||
| 	<09><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> .lib <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD><CFA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ | ||||
| 	<09><>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>ij<EFBFBD><C4B3><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEA3AC>Ҫ | ||||
| 	<09><><EFBFBD>Ӵ<EFBFBD><D3B4><EFBFBD><EFBFBD>Դ<EFBFBD> DLL <20><><EFBFBD><EFBFBD>ijЩ<C4B3><D0A9><EFBFBD>ţ<EFBFBD> | ||||
| 	<09>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⣬<EFBFBD><E2A3AC>Ҳ<EFBFBD><D2B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҳ<EFBFBD><D2B3><EFBFBD>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD>е<EFBFBD> | ||||
| 	<09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>桱<EFBFBD><E6A1B1><EFBFBD><EFBFBD>ҳ<EFBFBD>ϵ<EFBFBD> | ||||
| 	<09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⡱<EFBFBD><E2A1B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD>ǡ<EFBFBD><C7A1><EFBFBD> | ||||
|  | ||||
| ///////////////////////////////////////////////////////////////////////////// | ||||
| <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD> | ||||
|  | ||||
| StdAfx.h, StdAfx.cpp | ||||
| <EFBFBD><EFBFBD>Щ<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ CCEXPipe.pch <20><>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD>ͷ (PCH) <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>Ϊ StdAfx.obj <20><>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD> | ||||
|  | ||||
| ///////////////////////////////////////////////////////////////////////////// | ||||
| <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD>ͣ<EFBFBD> | ||||
|  | ||||
| Ӧ<EFBFBD>ó<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>á<EFBFBD>TODO:<3A><>ָʾӦ<CABE><D3A6><EFBFBD>ӻ<EFBFBD><D3BB>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4><EFBFBD>벿<EFBFBD>֡<EFBFBD> | ||||
|  | ||||
| ///////////////////////////////////////////////////////////////////////////// | ||||
							
								
								
									
										66
									
								
								CCEXPipe/stdafx.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										66
									
								
								CCEXPipe/stdafx.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,66 @@ | ||||
| // stdafx.cpp : ֻ<><D6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><D7BC><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>Դ<EFBFBD>ļ<EFBFBD> | ||||
| // CCEXPipe.pch <20><><EFBFBD><EFBFBD>ΪԤ<CEAA><D4A4><EFBFBD><EFBFBD>ͷ | ||||
| // stdafx.obj <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ | ||||
|  | ||||
| #include "stdafx.h" | ||||
| #include <stdio.h> | ||||
|  | ||||
| // TODO: <20><> STDAFX.H <20><> | ||||
| // <20><><EFBFBD><EFBFBD><EFBFBD>κ<EFBFBD><CEBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | ||||
|  | ||||
|  | ||||
| void LogOutToFile(const char* fmt, ...) | ||||
| { | ||||
| 	static CRITICAL_SECTION stCritical; | ||||
| 	static BOOL bInit = FALSE; | ||||
| 	static char acLogPath[2148] = {0}; | ||||
| 	if (FALSE == bInit) | ||||
| 	{ | ||||
| 		bInit = TRUE; | ||||
| 		GetModuleFileName(NULL, acLogPath, 2047); | ||||
|  | ||||
| 		for (int i = strlen(acLogPath)-1; i > 0; i--) | ||||
| 		{ | ||||
| 			if (acLogPath[i] == '\\') | ||||
| 			{ | ||||
| 				acLogPath[i] = '\0'; | ||||
| 				break; | ||||
| 			} | ||||
| 		} | ||||
| 		strcat(acLogPath, "\\CCEXPipe.log"); | ||||
|  | ||||
| 		InitializeCriticalSection(&stCritical); | ||||
| 	} | ||||
|  | ||||
| 	EnterCriticalSection(&stCritical); | ||||
|  | ||||
| 	va_list ap; | ||||
| 	va_start(ap, fmt); | ||||
| 	char pBuffer[800] = ""; | ||||
| 	if (vsnprintf_s(pBuffer, 796,_TRUNCATE, fmt, ap) > 0) | ||||
| 	{ | ||||
| 		if (strlen(pBuffer) == 0 || pBuffer[strlen(pBuffer)-1] != '\n') | ||||
| 		{ | ||||
| 			pBuffer[strlen(pBuffer)+1] = '\0'; | ||||
| 			pBuffer[strlen(pBuffer)] = '\n'; | ||||
| 		} | ||||
| 	} | ||||
| 	va_end(ap); | ||||
|  | ||||
| 	FILE* pFile = NULL; | ||||
| 	fopen_s(&pFile, acLogPath, "ab+"); | ||||
| 	if (NULL != pFile) | ||||
| 	{ | ||||
| 		char acTime[32] = {0}; | ||||
| 		SYSTEMTIME stTime; | ||||
| 		GetLocalTime(&stTime); | ||||
| 		sprintf_s(acTime, "[%02d-%02d %02d:%02d:%02d.%03d]  ", stTime.wMonth, stTime.wDay, stTime.wHour, stTime.wMinute, stTime.wSecond, stTime.wMilliseconds); | ||||
| 		fwrite(acTime, 1, strlen(acTime), pFile); | ||||
| 		fwrite(pBuffer, 1, strlen(pBuffer), pFile); | ||||
| 		fwrite("\r\n", 1, strlen("\r\n"), pFile); | ||||
| 		fclose(pFile); | ||||
| 	} | ||||
| 	LeaveCriticalSection(&stCritical); | ||||
| } | ||||
|  | ||||
|  | ||||
							
								
								
									
										34
									
								
								CCEXPipe/stdafx.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								CCEXPipe/stdafx.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,34 @@ | ||||
| // stdafx.h : <20><>ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>İ<EFBFBD><C4B0><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD> | ||||
| // <20><><EFBFBD>Ǿ<EFBFBD><C7BE><EFBFBD>ʹ<EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD> | ||||
| // <20>ض<EFBFBD><D8B6><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD>İ<EFBFBD><C4B0><EFBFBD><EFBFBD>ļ<EFBFBD> | ||||
| // | ||||
|  | ||||
| #pragma once | ||||
|  | ||||
| // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뽫λ<EBBDAB><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>ƽ̨֮ǰ<D6AE><C7B0>ƽ̨<C6BD><CCA8>ΪĿ<CEAA>꣬<EFBFBD><EAA3AC><EFBFBD><EFBFBD><DEB8><EFBFBD><EFBFBD>ж<EFBFBD><D0B6>塣 | ||||
| // <20>йز<D0B9>ͬƽ̨<C6BD><CCA8>Ӧֵ<D3A6><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD>ο<EFBFBD> MSDN<44><4E> | ||||
| #ifndef WINVER				// <20><><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD>ض<EFBFBD><D8B6><EFBFBD> Windows XP <20><><EFBFBD><EFBFBD><EFBFBD>߰汾<DFB0>Ĺ<EFBFBD><C4B9>ܡ<EFBFBD> | ||||
| #define WINVER 0x0501		// <20><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>Ӧ<EFBFBD><D3A6>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Windows <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>汾<EFBFBD><E6B1BE> | ||||
| #endif | ||||
|  | ||||
| #ifndef _WIN32_WINNT		// <20><><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD>ض<EFBFBD><D8B6><EFBFBD> Windows XP <20><><EFBFBD><EFBFBD><EFBFBD>߰汾<DFB0>Ĺ<EFBFBD><C4B9>ܡ<EFBFBD> | ||||
| #define _WIN32_WINNT 0x0501	// <20><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>Ӧ<EFBFBD><D3A6>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Windows <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>汾<EFBFBD><E6B1BE> | ||||
| #endif						 | ||||
|  | ||||
| #ifndef _WIN32_WINDOWS		// <20><><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD>ض<EFBFBD><D8B6><EFBFBD> Windows 98 <20><><EFBFBD><EFBFBD><EFBFBD>߰汾<DFB0>Ĺ<EFBFBD><C4B9>ܡ<EFBFBD> | ||||
| #define _WIN32_WINDOWS 0x0410 // <20><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>Ϊ<EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD> Windows Me <20><><EFBFBD><EFBFBD><EFBFBD>߰汾<DFB0><E6B1BE>ΪĿ<CEAA>ꡣ | ||||
| #endif | ||||
|  | ||||
| #ifndef _WIN32_IE			// <20><><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD>ض<EFBFBD><D8B6><EFBFBD> IE 6.0 <20><><EFBFBD><EFBFBD><EFBFBD>߰汾<DFB0>Ĺ<EFBFBD><C4B9>ܡ<EFBFBD> | ||||
| #define _WIN32_IE 0x0600	// <20><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>Ӧ<EFBFBD><D3A6>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> IE <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>汾<EFBFBD><E6B1BE> | ||||
| #endif | ||||
|  | ||||
| #define WIN32_LEAN_AND_MEAN		// <20><> Windows ͷ<><CDB7><EFBFBD>ų<EFBFBD><C5B3><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD> | ||||
| // Windows ͷ<>ļ<EFBFBD>: | ||||
| #include <windows.h> | ||||
|  | ||||
|  | ||||
|  | ||||
| // TODO: <20>ڴ˴<DAB4><CBB4><EFBFBD><EFBFBD>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD> | ||||
|  | ||||
| void LogOutToFile(const char* fmt, ...); | ||||
		Reference in New Issue
	
	Block a user