Skip to content

Commit

Permalink
添加项目文件。
Browse files Browse the repository at this point in the history
  • Loading branch information
code4lala committed Sep 1, 2018
1 parent d238a49 commit 2143400
Showing 24 changed files with 3,062 additions and 0 deletions.
31 changes: 31 additions & 0 deletions Login.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27703.2042
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Login", "Login\Login.vcxproj", "{81A03759-5A78-419E-B2B7-6010CB1E74E2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{81A03759-5A78-419E-B2B7-6010CB1E74E2}.Debug|x64.ActiveCfg = Debug|x64
{81A03759-5A78-419E-B2B7-6010CB1E74E2}.Debug|x64.Build.0 = Debug|x64
{81A03759-5A78-419E-B2B7-6010CB1E74E2}.Debug|x86.ActiveCfg = Debug|Win32
{81A03759-5A78-419E-B2B7-6010CB1E74E2}.Debug|x86.Build.0 = Debug|Win32
{81A03759-5A78-419E-B2B7-6010CB1E74E2}.Release|x64.ActiveCfg = Release|x64
{81A03759-5A78-419E-B2B7-6010CB1E74E2}.Release|x64.Build.0 = Release|x64
{81A03759-5A78-419E-B2B7-6010CB1E74E2}.Release|x86.ActiveCfg = Release|Win32
{81A03759-5A78-419E-B2B7-6010CB1E74E2}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {61E70EE7-4D43-4F66-B6E2-8C87AC7A3EB8}
EndGlobalSection
EndGlobal
Binary file added Login/IconJlu.ico
Binary file not shown.
Binary file added Login/IconJluSm.ico
Binary file not shown.
144 changes: 144 additions & 0 deletions Login/LogUtil.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
#include <windows.h>
#include <tchar.h>
#include <cstdio>
#include <cstdarg>
#include "LogUtil.h"

#ifdef UNICODE
const WCHAR * szDebugPrefix = szDebugPrefixW;
#elif
const char * szDebugPrefix = szDebugPrefixA;
#endif

static TCHAR szBuffer[1024];
static TCHAR szB2[1024];
static char strBuf[1024];
static char strB2[1024];
static SYSTEMTIME st;

void CDECL loge(const TCHAR * szFormat, ...) {
va_list pArgList;
va_start(pArgList, szFormat);
#ifdef UNICODE
_vsnwprintf_s(szBuffer, sizeof(szBuffer) / sizeof(TCHAR), szFormat, pArgList);
#elif
_vsnprintf_s(strBuf, sizeof(szBuffer) / sizeof(TCHAR), szFormat, pArgList);
#endif
va_end(pArgList);

GetLocalTime(&st);

wsprintf(szB2, TEXT("[ERROR] %02d:%02d:%02d.%03d [%d] %s %s\n"),
// current time
st.wHour, st.wMinute, st.wSecond, st.wMilliseconds,
// process id
GetCurrentProcessId(),
// debug log
szDebugPrefix, szBuffer);
OutputDebugString(szB2);
}

void CDECL logi(const TCHAR * szFormat, ...) {
va_list pArgList;
va_start(pArgList, szFormat);
#ifdef UNICODE
_vsnwprintf_s(szBuffer, sizeof(szBuffer) / sizeof(TCHAR), szFormat, pArgList);
#elif
_vsnprintf_s(strBuf, sizeof(szBuffer) / sizeof(TCHAR), szFormat, pArgList);
#endif
va_end(pArgList);

GetLocalTime(&st);

wsprintf(szB2, TEXT("[INFO] %02d:%02d:%02d.%03d [%d] %s %s\n"),
// current time
st.wHour, st.wMinute, st.wSecond, st.wMilliseconds,
// process id
GetCurrentProcessId(),
// debug log
szDebugPrefix, szBuffer);
OutputDebugString(szB2);
}

#ifndef _DEBUG
void CDECL logd(const TCHAR * szFormat, ...) { }
void CDECL logdA(const char * szFormat, ...) { }
#else
void CDECL logd(const TCHAR * szFormat, ...) {
va_list pArgList;
va_start(pArgList, szFormat);
#ifdef UNICODE
_vsnwprintf_s(szBuffer, sizeof(szBuffer) / sizeof(TCHAR), szFormat, pArgList);
#elif
_vsnprintf_s(strBuf, sizeof(szBuffer) / sizeof(TCHAR), szFormat, pArgList);
#endif
va_end(pArgList);

GetLocalTime(&st);

wsprintf(szB2, TEXT("[DEBUG] %02d:%02d:%02d.%03d [%d] %s %s\n"),
// current time
st.wHour, st.wMinute, st.wSecond, st.wMilliseconds,
// process id
GetCurrentProcessId(),
// debug log
szDebugPrefix, szBuffer);
OutputDebugString(szB2);
}

void CDECL logdA(const char * szFormat, ...) {
va_list pArgList;
va_start(pArgList, szFormat);
_vsnprintf_s(strBuf, sizeof(strBuf) / sizeof(char), szFormat, pArgList);
va_end(pArgList);

GetLocalTime(&st);

sprintf(strB2, "[INFO] %02d:%02d:%02d.%03d [%d] %s %s\n",
// current time
st.wHour, st.wMinute, st.wSecond, st.wMilliseconds,
// process id
GetCurrentProcessId(),
// debug log
szDebugPrefixA, strBuf);
OutputDebugStringA(strB2);
}
#endif // _DEBUG



void CDECL logeA(const char * szFormat, ...) {
va_list pArgList;
va_start(pArgList, szFormat);
_vsnprintf_s(strBuf, sizeof(strBuf) / sizeof(char), szFormat, pArgList);
va_end(pArgList);

GetLocalTime(&st);

sprintf(strB2, "[ERROR] %02d:%02d:%02d.%03d [%d] %s %s\n",
// current time
st.wHour, st.wMinute, st.wSecond, st.wMilliseconds,
// process id
GetCurrentProcessId(),
// debug log
szDebugPrefixA, strBuf);
OutputDebugStringA(strB2);
}

void CDECL logiA(const char * szFormat, ...) {
va_list pArgList;
va_start(pArgList, szFormat);
_vsnprintf_s(strBuf, sizeof(strBuf) / sizeof(char), szFormat, pArgList);
va_end(pArgList);

GetLocalTime(&st);

sprintf(strB2, "[INFO] %02d:%02d:%02d.%03d [%d] %s %s\n",
// current time
st.wHour, st.wMinute, st.wSecond, st.wMilliseconds,
// process id
GetCurrentProcessId(),
// debug log
szDebugPrefixA, strBuf);
OutputDebugStringA(strB2);
}
16 changes: 16 additions & 0 deletions Login/LogUtil.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#ifndef LOGUTIL_H
#define LOGUTIL_H

void logd(const TCHAR * szFormat, ...);
void logi(const TCHAR * szFormat, ...);
void loge(const TCHAR * szFormat, ...);
void logdA(const char * szFormat, ...);
void logiA(const char * szFormat, ...);
void logeA(const char * szFormat, ...);
//void logdW(const TCHAR * szFormat, ...);
//void logiW(const TCHAR * szFormat, ...);
//void logeW(const TCHAR * szFormat, ...);
extern const char * szDebugPrefixA;
extern const WCHAR * szDebugPrefixW;

#endif // !LOGUTIL_H
Binary file added Login/Login.rc
Binary file not shown.
177 changes: 177 additions & 0 deletions Login/Login.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.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="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{81A03759-5A78-419E-B2B7-6010CB1E74E2}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>Login</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<AdditionalManifestDependencies>type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'</AdditionalManifestDependencies>
<AdditionalDependencies>Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<AdditionalDependencies>Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalManifestDependencies>type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*';%(AdditionalManifestDependencies)</AdditionalManifestDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="dogcom\auth.cpp" />
<ClCompile Include="dogcom\configparse.cpp" />
<ClCompile Include="dogcom\keepalive.cpp" />
<ClCompile Include="dogcom\login.cpp" />
<ClCompile Include="dogcom\md4.cpp" />
<ClCompile Include="dogcom\md5.cpp" />
<ClCompile Include="dogcom\sha1.cpp" />
<ClCompile Include="WinMain.cpp" />
<ClCompile Include="LogUtil.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="dogcom\auth.h" />
<ClInclude Include="dogcom\configparse.h" />
<ClInclude Include="dogcom\keepalive.h" />
<ClInclude Include="dogcom\login.h" />
<ClInclude Include="dogcom\md4.h" />
<ClInclude Include="dogcom\md5.h" />
<ClInclude Include="dogcom\sha1.h" />
<ClInclude Include="LogUtil.h" />
<ClInclude Include="resource.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Login.rc" />
</ItemGroup>
<ItemGroup>
<Image Include="IconJlu.ico" />
<Image Include="IconJluSm.ico" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
Loading

0 comments on commit 2143400

Please sign in to comment.