Revision | 1ef6f97cedf92cf96ee432f403d01d40881d3e37 (tree) |
---|---|
Zeit | 2012-03-19 05:01:40 |
Autor | qwerty2501 <qwerty2501@user...> |
Commiter | qwerty2501 |
バグレポート機能追加
@@ -14,41 +14,64 @@ EndProject | ||
14 | 14 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sqlite3", "sqlite3\sqlite3.vcxproj", "{5DE70F9B-1BE2-45FD-8829-3401A7D802EE}" |
15 | 15 | EndProject |
16 | 16 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nlite_test", "nlite_test\nlite_test.vcxproj", "{A75388F4-E60D-4B95-B04C-A576A78272CF}" |
17 | + ProjectSection(ProjectDependencies) = postProject | |
18 | + {3C061D03-B1DD-4F4F-867F-701B8B0BE8CC} = {3C061D03-B1DD-4F4F-867F-701B8B0BE8CC} | |
19 | + {2FF71818-53D8-4FB6-A4B8-E3EFCB49C217} = {2FF71818-53D8-4FB6-A4B8-E3EFCB49C217} | |
20 | + {67ACC76A-F834-4DE6-84B7-3A5F543ABDFE} = {67ACC76A-F834-4DE6-84B7-3A5F543ABDFE} | |
21 | + {5DE70F9B-1BE2-45FD-8829-3401A7D802EE} = {5DE70F9B-1BE2-45FD-8829-3401A7D802EE} | |
22 | + {6FB77F9B-EBA4-4E42-8EC7-1197CBB50C2D} = {6FB77F9B-EBA4-4E42-8EC7-1197CBB50C2D} | |
23 | + {D8F48EC3-615F-43E2-95D5-D08F9BB6A74F} = {D8F48EC3-615F-43E2-95D5-D08F9BB6A74F} | |
24 | + EndProjectSection | |
17 | 25 | EndProject |
18 | 26 | Global |
19 | 27 | GlobalSection(SolutionConfigurationPlatforms) = preSolution |
20 | 28 | Debug|Win32 = Debug|Win32 |
21 | 29 | Release|Win32 = Release|Win32 |
30 | + UnitTest|Win32 = UnitTest|Win32 | |
22 | 31 | EndGlobalSection |
23 | 32 | GlobalSection(ProjectConfigurationPlatforms) = postSolution |
24 | 33 | {3C061D03-B1DD-4F4F-867F-701B8B0BE8CC}.Debug|Win32.ActiveCfg = Debug|Win32 |
25 | 34 | {3C061D03-B1DD-4F4F-867F-701B8B0BE8CC}.Debug|Win32.Build.0 = Debug|Win32 |
26 | 35 | {3C061D03-B1DD-4F4F-867F-701B8B0BE8CC}.Release|Win32.ActiveCfg = Release|Win32 |
27 | 36 | {3C061D03-B1DD-4F4F-867F-701B8B0BE8CC}.Release|Win32.Build.0 = Release|Win32 |
37 | + {3C061D03-B1DD-4F4F-867F-701B8B0BE8CC}.UnitTest|Win32.ActiveCfg = UnitTest|Win32 | |
38 | + {3C061D03-B1DD-4F4F-867F-701B8B0BE8CC}.UnitTest|Win32.Build.0 = UnitTest|Win32 | |
28 | 39 | {2FF71818-53D8-4FB6-A4B8-E3EFCB49C217}.Debug|Win32.ActiveCfg = Debug|Win32 |
29 | 40 | {2FF71818-53D8-4FB6-A4B8-E3EFCB49C217}.Debug|Win32.Build.0 = Debug|Win32 |
30 | 41 | {2FF71818-53D8-4FB6-A4B8-E3EFCB49C217}.Release|Win32.ActiveCfg = Release|Win32 |
31 | 42 | {2FF71818-53D8-4FB6-A4B8-E3EFCB49C217}.Release|Win32.Build.0 = Release|Win32 |
43 | + {2FF71818-53D8-4FB6-A4B8-E3EFCB49C217}.UnitTest|Win32.ActiveCfg = UnitTest|Win32 | |
44 | + {2FF71818-53D8-4FB6-A4B8-E3EFCB49C217}.UnitTest|Win32.Build.0 = UnitTest|Win32 | |
32 | 45 | {D8F48EC3-615F-43E2-95D5-D08F9BB6A74F}.Debug|Win32.ActiveCfg = Debug|Win32 |
33 | 46 | {D8F48EC3-615F-43E2-95D5-D08F9BB6A74F}.Debug|Win32.Build.0 = Debug|Win32 |
34 | 47 | {D8F48EC3-615F-43E2-95D5-D08F9BB6A74F}.Release|Win32.ActiveCfg = Release|Win32 |
35 | 48 | {D8F48EC3-615F-43E2-95D5-D08F9BB6A74F}.Release|Win32.Build.0 = Release|Win32 |
49 | + {D8F48EC3-615F-43E2-95D5-D08F9BB6A74F}.UnitTest|Win32.ActiveCfg = UnitTest|Win32 | |
50 | + {D8F48EC3-615F-43E2-95D5-D08F9BB6A74F}.UnitTest|Win32.Build.0 = UnitTest|Win32 | |
36 | 51 | {6FB77F9B-EBA4-4E42-8EC7-1197CBB50C2D}.Debug|Win32.ActiveCfg = Debug|Win32 |
37 | 52 | {6FB77F9B-EBA4-4E42-8EC7-1197CBB50C2D}.Debug|Win32.Build.0 = Debug|Win32 |
38 | 53 | {6FB77F9B-EBA4-4E42-8EC7-1197CBB50C2D}.Release|Win32.ActiveCfg = Release|Win32 |
39 | 54 | {6FB77F9B-EBA4-4E42-8EC7-1197CBB50C2D}.Release|Win32.Build.0 = Release|Win32 |
55 | + {6FB77F9B-EBA4-4E42-8EC7-1197CBB50C2D}.UnitTest|Win32.ActiveCfg = UnitTest|Win32 | |
56 | + {6FB77F9B-EBA4-4E42-8EC7-1197CBB50C2D}.UnitTest|Win32.Build.0 = UnitTest|Win32 | |
40 | 57 | {67ACC76A-F834-4DE6-84B7-3A5F543ABDFE}.Debug|Win32.ActiveCfg = Debug|Win32 |
41 | 58 | {67ACC76A-F834-4DE6-84B7-3A5F543ABDFE}.Debug|Win32.Build.0 = Debug|Win32 |
42 | 59 | {67ACC76A-F834-4DE6-84B7-3A5F543ABDFE}.Release|Win32.ActiveCfg = Release|Win32 |
43 | 60 | {67ACC76A-F834-4DE6-84B7-3A5F543ABDFE}.Release|Win32.Build.0 = Release|Win32 |
61 | + {67ACC76A-F834-4DE6-84B7-3A5F543ABDFE}.UnitTest|Win32.ActiveCfg = UnitTest|Win32 | |
62 | + {67ACC76A-F834-4DE6-84B7-3A5F543ABDFE}.UnitTest|Win32.Build.0 = UnitTest|Win32 | |
44 | 63 | {5DE70F9B-1BE2-45FD-8829-3401A7D802EE}.Debug|Win32.ActiveCfg = Debug|Win32 |
45 | 64 | {5DE70F9B-1BE2-45FD-8829-3401A7D802EE}.Debug|Win32.Build.0 = Debug|Win32 |
46 | 65 | {5DE70F9B-1BE2-45FD-8829-3401A7D802EE}.Release|Win32.ActiveCfg = Release|Win32 |
47 | 66 | {5DE70F9B-1BE2-45FD-8829-3401A7D802EE}.Release|Win32.Build.0 = Release|Win32 |
67 | + {5DE70F9B-1BE2-45FD-8829-3401A7D802EE}.UnitTest|Win32.ActiveCfg = UnitTest|Win32 | |
68 | + {5DE70F9B-1BE2-45FD-8829-3401A7D802EE}.UnitTest|Win32.Build.0 = UnitTest|Win32 | |
48 | 69 | {A75388F4-E60D-4B95-B04C-A576A78272CF}.Debug|Win32.ActiveCfg = Debug|Win32 |
49 | 70 | {A75388F4-E60D-4B95-B04C-A576A78272CF}.Debug|Win32.Build.0 = Debug|Win32 |
50 | 71 | {A75388F4-E60D-4B95-B04C-A576A78272CF}.Release|Win32.ActiveCfg = Release|Win32 |
51 | 72 | {A75388F4-E60D-4B95-B04C-A576A78272CF}.Release|Win32.Build.0 = Release|Win32 |
73 | + {A75388F4-E60D-4B95-B04C-A576A78272CF}.UnitTest|Win32.ActiveCfg = UnitTest|Win32 | |
74 | + {A75388F4-E60D-4B95-B04C-A576A78272CF}.UnitTest|Win32.Build.0 = UnitTest|Win32 | |
52 | 75 | EndGlobalSection |
53 | 76 | GlobalSection(SolutionProperties) = preSolution |
54 | 77 | HideSolutionNode = FALSE |
@@ -1,31 +1,34 @@ | ||
1 | -//{{NO_DEPENDENCIES}} | |
2 | -// Microsoft Visual C++ generated include file. | |
3 | -// Used by nlite_application.rc | |
4 | -// | |
5 | - | |
6 | -#define IDS_APP_TITLE 103 | |
7 | - | |
8 | -#define IDR_MAINFRAME 128 | |
9 | -#define IDD_NLITE_APPLICATION_DIALOG 102 | |
10 | -#define IDD_ABOUTBOX 103 | |
11 | -#define IDM_ABOUT 104 | |
12 | -#define IDM_EXIT 105 | |
13 | -#define IDI_NLITE_APPLICATION 107 | |
14 | -#define IDI_SMALL 108 | |
15 | -#define IDC_NLITE_APPLICATION 109 | |
16 | -#define IDC_MYICON 2 | |
17 | 1 | #ifndef IDC_STATIC |
18 | -#define IDC_STATIC -1 | |
2 | +#define IDC_STATIC (-1) | |
19 | 3 | #endif |
20 | -// 新しいオブジェクトの次の既定値 | |
21 | -// | |
22 | -#ifdef APSTUDIO_INVOKED | |
23 | -#ifndef APSTUDIO_READONLY_SYMBOLS | |
24 | 4 | |
25 | -#define _APS_NO_MFC 130 | |
26 | -#define _APS_NEXT_RESOURCE_VALUE 129 | |
27 | -#define _APS_NEXT_COMMAND_VALUE 32771 | |
28 | -#define _APS_NEXT_CONTROL_VALUE 1000 | |
29 | -#define _APS_NEXT_SYMED_VALUE 110 | |
30 | -#endif | |
31 | -#endif | |
5 | +#define IDM_ABOUT 104 | |
6 | +#define IDM_EXIT 105 | |
7 | +#define IDI_NLITE 107 | |
8 | +#define IDI_SMALL 108 | |
9 | +#define IDC_NLITE 109 | |
10 | +#define IDD_DIALOG_BROWSERTYPE 211 | |
11 | +#define IDD_LISTENER_SETTING_DIALOG 220 | |
12 | +#define IDD_WRITE_SETTING_DIALOG 222 | |
13 | +#define IDD_MAINWINDOW_SETTING_DIALOG 224 | |
14 | +#define IDD_SPEAKER_DIALOG 227 | |
15 | +#define IDC_BUTTON_COOKIE_OK 1001 | |
16 | +#define IDC_COMMENT_SPEAK_CHECKBOX 1001 | |
17 | +#define IDC_LT_BACKCOLOR_STATIC 1001 | |
18 | +#define IDC_ZORDER_TOP_CHECKBOX 1001 | |
19 | +#define IDC_DEFAULT_BT_RADIO 1002 | |
20 | +#define IDC_USERID_STATIC 1002 | |
21 | +#define IDC_NICKNAME_EDIT 1003 | |
22 | +#define IDC_LT_NICKNAME_STATIC 1004 | |
23 | +#define IDC_RADIO_IE 1005 | |
24 | +#define IDC_BACKCOLOR_RETURN_BUTTON 1006 | |
25 | +#define IDC_NAMECOLOR_RETURN_BUTTON 1007 | |
26 | +#define IDM_COOKIE 30000 | |
27 | +#define IDM_FRONT_WINDOW_CHECK 40000 | |
28 | +#define IDS_PANE_TIME 40000 | |
29 | +#define IDM_SPEAK_COMMENT_CHECK 40001 | |
30 | +#define IDC_RADIO_FIREFOX 40005 | |
31 | +#define IDC_RADIO_CHROME 40006 | |
32 | +#define IDC_RADIO_IECM 40009 | |
33 | +#define IDC_RADIO_SAFARI 40012 | |
34 | +#define IDC_RADIO_OPERA 40013 |
@@ -0,0 +1,2 @@ | ||
1 | +} | |
2 | +#include <nlite_common\namespace_end.h> |
@@ -0,0 +1,2 @@ | ||
1 | +#include <nlite_common\namespace_start.h> | |
2 | +namespace nlite{ | |
\ No newline at end of file |
@@ -9,6 +9,10 @@ | ||
9 | 9 | <Configuration>Release</Configuration> |
10 | 10 | <Platform>Win32</Platform> |
11 | 11 | </ProjectConfiguration> |
12 | + <ProjectConfiguration Include="UnitTest|Win32"> | |
13 | + <Configuration>UnitTest</Configuration> | |
14 | + <Platform>Win32</Platform> | |
15 | + </ProjectConfiguration> | |
12 | 16 | </ItemGroup> |
13 | 17 | <PropertyGroup Label="Globals"> |
14 | 18 | <ProjectGuid>{3C061D03-B1DD-4F4F-867F-701B8B0BE8CC}</ProjectGuid> |
@@ -21,6 +25,11 @@ | ||
21 | 25 | <UseDebugLibraries>true</UseDebugLibraries> |
22 | 26 | <CharacterSet>Unicode</CharacterSet> |
23 | 27 | </PropertyGroup> |
28 | + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='UnitTest|Win32'" Label="Configuration"> | |
29 | + <ConfigurationType>Application</ConfigurationType> | |
30 | + <UseDebugLibraries>true</UseDebugLibraries> | |
31 | + <CharacterSet>Unicode</CharacterSet> | |
32 | + </PropertyGroup> | |
24 | 33 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> |
25 | 34 | <ConfigurationType>Application</ConfigurationType> |
26 | 35 | <UseDebugLibraries>false</UseDebugLibraries> |
@@ -33,6 +42,9 @@ | ||
33 | 42 | <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
34 | 43 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
35 | 44 | </ImportGroup> |
45 | + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='UnitTest|Win32'" Label="PropertySheets"> | |
46 | + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | |
47 | + </ImportGroup> | |
36 | 48 | <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
37 | 49 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
38 | 50 | </ImportGroup> |
@@ -42,9 +54,15 @@ | ||
42 | 54 | <IncludePath>$(SolutionDir);$(IncludePath)</IncludePath> |
43 | 55 | <TargetName>$(SolutionName)</TargetName> |
44 | 56 | </PropertyGroup> |
57 | + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='UnitTest|Win32'"> | |
58 | + <LinkIncremental>true</LinkIncremental> | |
59 | + <IncludePath>$(SolutionDir);$(IncludePath)</IncludePath> | |
60 | + <TargetName>$(SolutionName)</TargetName> | |
61 | + </PropertyGroup> | |
45 | 62 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
46 | 63 | <LinkIncremental>false</LinkIncremental> |
47 | 64 | <TargetName>$(SolutionName)</TargetName> |
65 | + <IncludePath>$(SolutionDir);$(IncludePath)</IncludePath> | |
48 | 66 | </PropertyGroup> |
49 | 67 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
50 | 68 | <ClCompile> |
@@ -58,6 +76,18 @@ | ||
58 | 76 | <GenerateDebugInformation>true</GenerateDebugInformation> |
59 | 77 | </Link> |
60 | 78 | </ItemDefinitionGroup> |
79 | + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='UnitTest|Win32'"> | |
80 | + <ClCompile> | |
81 | + <PrecompiledHeader>Use</PrecompiledHeader> | |
82 | + <WarningLevel>Level3</WarningLevel> | |
83 | + <Optimization>Disabled</Optimization> | |
84 | + <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> | |
85 | + </ClCompile> | |
86 | + <Link> | |
87 | + <SubSystem>Windows</SubSystem> | |
88 | + <GenerateDebugInformation>true</GenerateDebugInformation> | |
89 | + </Link> | |
90 | + </ItemDefinitionGroup> | |
61 | 91 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
62 | 92 | <ClCompile> |
63 | 93 | <WarningLevel>Level3</WarningLevel> |
@@ -75,11 +105,13 @@ | ||
75 | 105 | </Link> |
76 | 106 | </ItemDefinitionGroup> |
77 | 107 | <ItemGroup> |
78 | - <None Include="nlite_application.ico" /> | |
108 | + <None Include="nlite.ico" /> | |
79 | 109 | <None Include="ReadMe.txt" /> |
80 | 110 | <None Include="small.ico" /> |
81 | 111 | </ItemGroup> |
82 | 112 | <ItemGroup> |
113 | + <ClInclude Include="namespace_end.h" /> | |
114 | + <ClInclude Include="namespace_start.h" /> | |
83 | 115 | <ClInclude Include="nlite_application.h" /> |
84 | 116 | <ClInclude Include="Resource.h" /> |
85 | 117 | <ClInclude Include="stdafx.h" /> |
@@ -89,14 +121,15 @@ | ||
89 | 121 | <ClCompile Include="nlite_application.cpp" /> |
90 | 122 | <ClCompile Include="stdafx.cpp"> |
91 | 123 | <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> |
124 | + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='UnitTest|Win32'">Create</PrecompiledHeader> | |
92 | 125 | <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader> |
93 | 126 | </ClCompile> |
94 | 127 | </ItemGroup> |
95 | 128 | <ItemGroup> |
96 | - <ResourceCompile Include="nlite_application.rc" /> | |
129 | + <Manifest Include="nlite.exe.manifest" /> | |
97 | 130 | </ItemGroup> |
98 | 131 | <ItemGroup> |
99 | - <Manifest Include="nlite.exe.manifest" /> | |
132 | + <ResourceCompile Include="nlite.rc" /> | |
100 | 133 | </ItemGroup> |
101 | 134 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |
102 | 135 | <ImportGroup Label="ExtensionTargets"> |
@@ -19,7 +19,7 @@ | ||
19 | 19 | <None Include="small.ico"> |
20 | 20 | <Filter>リソース ファイル</Filter> |
21 | 21 | </None> |
22 | - <None Include="nlite_application.ico"> | |
22 | + <None Include="nlite.ico"> | |
23 | 23 | <Filter>リソース ファイル</Filter> |
24 | 24 | </None> |
25 | 25 | </ItemGroup> |
@@ -36,6 +36,12 @@ | ||
36 | 36 | <ClInclude Include="nlite_application.h"> |
37 | 37 | <Filter>ヘッダー ファイル</Filter> |
38 | 38 | </ClInclude> |
39 | + <ClInclude Include="namespace_start.h"> | |
40 | + <Filter>ヘッダー ファイル</Filter> | |
41 | + </ClInclude> | |
42 | + <ClInclude Include="namespace_end.h"> | |
43 | + <Filter>ヘッダー ファイル</Filter> | |
44 | + </ClInclude> | |
39 | 45 | </ItemGroup> |
40 | 46 | <ItemGroup> |
41 | 47 | <ClCompile Include="stdafx.cpp"> |
@@ -46,13 +52,13 @@ | ||
46 | 52 | </ClCompile> |
47 | 53 | </ItemGroup> |
48 | 54 | <ItemGroup> |
49 | - <ResourceCompile Include="nlite_application.rc"> | |
55 | + <Manifest Include="nlite.exe.manifest"> | |
50 | 56 | <Filter>リソース ファイル</Filter> |
51 | - </ResourceCompile> | |
57 | + </Manifest> | |
52 | 58 | </ItemGroup> |
53 | 59 | <ItemGroup> |
54 | - <Manifest Include="nlite.exe.manifest"> | |
60 | + <ResourceCompile Include="nlite.rc"> | |
55 | 61 | <Filter>リソース ファイル</Filter> |
56 | - </Manifest> | |
62 | + </ResourceCompile> | |
57 | 63 | </ItemGroup> |
58 | 64 | </Project> |
\ No newline at end of file |
@@ -1,8 +1,3 @@ | ||
1 | 1 | #pragma once |
2 | 2 | |
3 | -// SDKDDKVer.h をインクルードすると、利用できる最も上位の Windows プラットフォームが定義されます。 | |
4 | - | |
5 | -// 以前の Windows プラットフォーム用にアプリケーションをビルドする場合は、WinSDKVer.h をインクルードし、 | |
6 | -// SDKDDKVer.h をインクルードする前に、サポート対象とするプラットフォームを示すように _WIN32_WINNT マクロを設定します。 | |
7 | - | |
8 | -#include <SDKDDKVer.h> | |
3 | +#include <nlite_common\targetver.h> |
@@ -0,0 +1,142 @@ | ||
1 | +#include "stdafx.h" | |
2 | +#include <nlite_common\nexception.h> | |
3 | +#include "appinfo.h" | |
4 | + | |
5 | +#include "namespace_start.h" | |
6 | + | |
7 | + | |
8 | + | |
9 | + CApplicationInfo CApplicationInfo::APPINFO; | |
10 | + | |
11 | + CApplicationInfo::CApplicationInfo(){ | |
12 | + | |
13 | + | |
14 | + | |
15 | + | |
16 | + struct LANGANDCODEPAGE { | |
17 | + | |
18 | + WORD wLanguage; | |
19 | + WORD wCodePage; | |
20 | + } *lpTranslate; | |
21 | + TCHAR szModuleName[_MAX_PATH + 1] = {0}; //アプリケーションファイル名 | |
22 | + | |
23 | + | |
24 | + DWORD dwReserved; //ファイル情報格納用 | |
25 | + LPTSTR errMessage = NULL; //エラー発生したメッセージ | |
26 | + | |
27 | + //アプリケーションファイル名取得 | |
28 | + int nRet = GetModuleFileName(NULL,szModuleName,ARRAYSIZE(szModuleName)); | |
29 | + | |
30 | + if(nRet <= 0){ | |
31 | + | |
32 | + throw Exception(_T("アプリケーション情報取得に失敗しました"),__LINE__,TEXT(__FILE__),TEXT(__FUNCTION__)); | |
33 | + } | |
34 | + | |
35 | + //アプリケーションバージョン情報のサイズ取得 | |
36 | + DWORD dwSize = GetFileVersionInfoSize(szModuleName,&dwReserved); | |
37 | + | |
38 | + if(dwSize <= 0){ | |
39 | + | |
40 | + throw Exception(_T("アプリケーション情報取得に失敗しました"),__LINE__,TEXT(__FILE__),TEXT(__FUNCTION__)); | |
41 | + } | |
42 | + | |
43 | + block.resize(dwSize); | |
44 | + | |
45 | + | |
46 | + if(block.empty()){ | |
47 | + | |
48 | + throw Exception(_T("アプリケーション情報取得に失敗しました"),__LINE__,TEXT(__FILE__),TEXT(__FUNCTION__)); | |
49 | + } | |
50 | + // | |
51 | + //アプリケーションバージョン情報取得 | |
52 | + // | |
53 | + BOOL bRet = GetFileVersionInfo(szModuleName,0,dwSize,&block[0]); | |
54 | + | |
55 | + if(bRet != TRUE){ | |
56 | + throw Exception(_T("アプリケーション情報取得に失敗しました"),__LINE__,TEXT(__FILE__),TEXT(__FUNCTION__)); | |
57 | + } | |
58 | + | |
59 | + | |
60 | + UINT ulen; | |
61 | + if(VerQueryValue(&block[0],TEXT("\\VarFileInfo\\Translation"),(LPVOID*)&lpTranslate,&ulen) == FALSE){ | |
62 | + throw Exception(_T("アプリケーション情報取得に失敗しました"),__LINE__,TEXT(__FILE__),TEXT(__FUNCTION__)); | |
63 | + } | |
64 | + | |
65 | + TCHAR subBlock[_MAX_PATH]; | |
66 | + _stprintf(subBlock,TEXT("\\StringFileInfo\\%04x%04x\\ProductVersion"),lpTranslate->wLanguage,lpTranslate->wCodePage); | |
67 | + | |
68 | + if(VerQueryValue(&block[0],subBlock,(LPVOID *)&pProductVersion,&ulen) == FALSE){ | |
69 | + | |
70 | + throw Exception(_T("アプリケーション情報取得に失敗しました"),__LINE__,TEXT(__FILE__),TEXT(__FUNCTION__)); | |
71 | + | |
72 | + } | |
73 | + | |
74 | + _stprintf(subBlock,TEXT("\\StringFileInfo\\%04x%04x\\OriginalFilename"),lpTranslate->wLanguage,lpTranslate->wCodePage); | |
75 | + | |
76 | + if(VerQueryValue(&block[0],subBlock,(LPVOID *)&pOriginalFileName,&ulen) == FALSE){ | |
77 | + | |
78 | + throw Exception(_T("アプリケーション情報取得に失敗しました"),__LINE__,TEXT(__FILE__),TEXT(__FUNCTION__)); | |
79 | + | |
80 | + } | |
81 | + | |
82 | + _stprintf(subBlock,TEXT("\\StringFileInfo\\%04x%04x\\LegalCopyright"),lpTranslate->wLanguage,lpTranslate->wCodePage); | |
83 | + | |
84 | + if(VerQueryValue(&block[0],subBlock,(LPVOID *)&pLegalCopyright,&ulen) == FALSE){ | |
85 | + | |
86 | + throw Exception(_T("アプリケーション情報取得に失敗しました"),__LINE__,TEXT(__FILE__),TEXT(__FUNCTION__)); | |
87 | + | |
88 | + } | |
89 | + | |
90 | + _stprintf(subBlock,TEXT("\\StringFileInfo\\%04x%04x\\ProductName"),lpTranslate->wLanguage,lpTranslate->wCodePage); | |
91 | + | |
92 | + if(VerQueryValue(&block[0],subBlock,(LPVOID *)&pProductName,&ulen) == FALSE){ | |
93 | + | |
94 | + throw Exception(_T("アプリケーション情報取得に失敗しました"),__LINE__,TEXT(__FILE__),TEXT(__FUNCTION__)); | |
95 | + | |
96 | + } | |
97 | + | |
98 | + | |
99 | + | |
100 | + | |
101 | + return; | |
102 | + | |
103 | + | |
104 | + | |
105 | + } | |
106 | + | |
107 | + | |
108 | + CApplicationInfo::~CApplicationInfo(){ | |
109 | + | |
110 | + | |
111 | + | |
112 | + } | |
113 | + | |
114 | + | |
115 | + | |
116 | + | |
117 | + const LPCTSTR CApplicationInfo::getProductVersion(){ | |
118 | + | |
119 | + return APPINFO.pProductVersion; | |
120 | + | |
121 | + } | |
122 | + | |
123 | + const LPCTSTR CApplicationInfo::getOriginalFileName(){ | |
124 | + | |
125 | + return APPINFO.pOriginalFileName; | |
126 | + | |
127 | + } | |
128 | + | |
129 | + const LPCTSTR CApplicationInfo::getLegalCopyright(){ | |
130 | + | |
131 | + return APPINFO.pLegalCopyright; | |
132 | + | |
133 | + } | |
134 | + | |
135 | + const LPCTSTR CApplicationInfo::getProcuctName() { | |
136 | + | |
137 | + return APPINFO.pProductName; | |
138 | + } | |
139 | + | |
140 | + | |
141 | + | |
142 | +#include "namespace_end.h" | |
\ No newline at end of file |
@@ -0,0 +1,66 @@ | ||
1 | +#pragma once | |
2 | + | |
3 | +#include <nlite_common\define.h> | |
4 | +#include "namespace_start.h" | |
5 | + | |
6 | + | |
7 | + | |
8 | + /// | |
9 | + ///アプリケーション情報クラス(シングルトン) | |
10 | + /// | |
11 | + class CApplicationInfo{ | |
12 | + | |
13 | + | |
14 | + | |
15 | + | |
16 | + | |
17 | + private: | |
18 | + static CApplicationInfo APPINFO; | |
19 | + std::vector<Char> block; //ブロックバッファ | |
20 | + LPTSTR pProductVersion; //バージョン情報 | |
21 | + LPTSTR pOriginalFileName; //オリジナルファイル名 | |
22 | + LPTSTR pLegalCopyright; //著作権 | |
23 | + LPTSTR pProductName; //製品名 | |
24 | + private: | |
25 | + /// | |
26 | + ///コンストラクタ | |
27 | + /// | |
28 | + CApplicationInfo(); | |
29 | + | |
30 | + public: | |
31 | + | |
32 | + /// | |
33 | + ///デストラクタ | |
34 | + /// | |
35 | + ~CApplicationInfo(); | |
36 | + public: | |
37 | + /// | |
38 | + ///シングルトン | |
39 | + /// | |
40 | + static CApplicationInfo& getInstance(); | |
41 | + | |
42 | + | |
43 | + | |
44 | + | |
45 | + // | |
46 | + //ゲッター | |
47 | + // | |
48 | + static const LPCTSTR getProductVersion(); | |
49 | + | |
50 | + static const LPCTSTR getOriginalFileName(); | |
51 | + | |
52 | + static const LPCTSTR getLegalCopyright(); | |
53 | + | |
54 | + static const LPCTSTR getProcuctName(); | |
55 | + | |
56 | + | |
57 | + | |
58 | + | |
59 | + | |
60 | + }; | |
61 | + | |
62 | + | |
63 | +#include "namespace_end.h" | |
64 | + | |
65 | + | |
66 | +#pragma comment(lib,"Version.lib") | |
\ No newline at end of file |
@@ -0,0 +1,41 @@ | ||
1 | +#include "stdafx.h" | |
2 | +#include "appinfo.h" | |
3 | +#include "bugreport.h" | |
4 | + | |
5 | + | |
6 | +#include "namespace_start.h" | |
7 | + | |
8 | + | |
9 | +Bool BugTransfer::Report(BugTransfer &bug){ | |
10 | + | |
11 | + Bool rslt = false; | |
12 | + CWinHttpClient httpClient; | |
13 | + NString userId; | |
14 | + GetnliteUserId(userId); | |
15 | + nstringstream bugmessage; | |
16 | + | |
17 | + bugmessage << _T("version=") << CApplicationInfo::getProductVersion() << _T("&"); | |
18 | + bugmessage << _T("nliteUserId=") << userId << _T("&"); | |
19 | + bugmessage << _T("summary=") << bug.summary << _T("&"); | |
20 | + bugmessage << _T("function=") << bug.function << _T("&"); | |
21 | + bugmessage << _T("sourcefile=") << bug.sourcefile << _T("&"); | |
22 | + bugmessage << _T("line=") << bug.line << _T("&"); | |
23 | + bugmessage << _T("windowsErrorCode=") << bug.windowsErrorCode << _T("&"); | |
24 | + bugmessage << _T("windowsErrorMessage=") << bug.windowsErrorMessage << _T("&"); | |
25 | + bugmessage << _T("osVersion=") << GetWindowsVersion(); | |
26 | + | |
27 | + | |
28 | + nregex reg(_T("[\r|\n]")); | |
29 | + NString message(std::regex_replace(bugmessage.str(),reg,NString(_T("")))); | |
30 | + | |
31 | + //MString mmessage; | |
32 | + //ToUTF8(mmessage,message); | |
33 | + httpClient->Open(_T("POST"),_T("http://nlite.sourceforge.jp/cgi-bin/bugreport.rb")); | |
34 | + httpClient->SetRequestHeader(_T("Content-Type"),_T("application/x-www-form-urlencoded")); | |
35 | + httpClient->Send(message.c_str()); | |
36 | + std::wcout << message << std::endl; | |
37 | + return rslt; | |
38 | +} | |
39 | + | |
40 | + | |
41 | +#include "namespace_end.h" | |
\ No newline at end of file |
@@ -0,0 +1,22 @@ | ||
1 | +#pragma once | |
2 | + | |
3 | +#include "define.h" | |
4 | +#include "http.h" | |
5 | +#include "windowsAPI.h" | |
6 | +#include "namespace_start.h" | |
7 | +struct BugTransfer{ | |
8 | + NString summary; | |
9 | + NString line; | |
10 | + NString sourcefile; | |
11 | + NString function; | |
12 | + NString windowsErrorCode; | |
13 | + NString windowsErrorMessage; | |
14 | + | |
15 | + | |
16 | + | |
17 | +public: | |
18 | + static Bool Report(BugTransfer &bug); | |
19 | + | |
20 | +}; | |
21 | + | |
22 | +#include "namespace_end.h" | |
\ No newline at end of file |
@@ -0,0 +1,8 @@ | ||
1 | +#include "stdafx.h" | |
2 | +#include "define.h" | |
3 | +#include "namespace_start.h" | |
4 | + | |
5 | + | |
6 | + | |
7 | + | |
8 | +#include "namespace_end.h" | |
\ No newline at end of file |
@@ -0,0 +1,64 @@ | ||
1 | +#pragma once | |
2 | + | |
3 | + | |
4 | +#include <string> | |
5 | +#include <regex> | |
6 | +#include "namespace_start.h" | |
7 | + | |
8 | +// | |
9 | +// | |
10 | +//型定義 | |
11 | +//////////////////////////////////////////////////////////////////////////// | |
12 | + | |
13 | +typedef void Void; | |
14 | + | |
15 | +typedef char Char; | |
16 | + | |
17 | +typedef unsigned char UChar; | |
18 | + | |
19 | +typedef wchar_t CharU16; | |
20 | + | |
21 | +typedef CharU16 NChar; | |
22 | + | |
23 | +typedef short Short; | |
24 | + | |
25 | +typedef unsigned short UShort; | |
26 | + | |
27 | +typedef int Int; | |
28 | + | |
29 | +typedef unsigned int UInt; | |
30 | + | |
31 | +typedef long long int Long; | |
32 | + | |
33 | +typedef unsigned long long int ULong; | |
34 | + | |
35 | +typedef Int IntPtr; | |
36 | + | |
37 | +typedef UInt UIntPtr; | |
38 | + | |
39 | +typedef bool Bool; | |
40 | + | |
41 | +typedef std::string MString; | |
42 | + | |
43 | +typedef std::wstring U16String; | |
44 | + | |
45 | +typedef U16String NString; | |
46 | + | |
47 | +typedef std::wstringstream u16stringstream; | |
48 | + | |
49 | +typedef u16stringstream nstringstream; | |
50 | + | |
51 | + | |
52 | +typedef std::tr1::basic_regex<CharU16> u16regex; | |
53 | + | |
54 | +typedef u16regex nregex; | |
55 | + | |
56 | +// | |
57 | +//定数 | |
58 | +//////////////////////////////////////////////////////////////////////////////////////////////// | |
59 | + | |
60 | + | |
61 | + | |
62 | + | |
63 | + | |
64 | +#include "namespace_end.h" | |
\ No newline at end of file |
@@ -0,0 +1,9 @@ | ||
1 | +#include "stdafx.h" | |
2 | +#include "http.h" | |
3 | + | |
4 | + | |
5 | +CWinHttpClient::CWinHttpClient(){ | |
6 | + | |
7 | + this->CreateInstance(WinHttp::CLSID_WinHttpRequest); | |
8 | + | |
9 | +} | |
\ No newline at end of file |
@@ -0,0 +1,9 @@ | ||
1 | +#pragma once | |
2 | +#import "winhttp.dll" named_guids | |
3 | + | |
4 | +class CWinHttpClient:public WinHttp::IWinHttpRequestPtr{ | |
5 | + | |
6 | +public: | |
7 | + CWinHttpClient(); | |
8 | + | |
9 | +}; | |
\ No newline at end of file |
@@ -0,0 +1,2 @@ | ||
1 | + | |
2 | +}}} | |
\ No newline at end of file |
@@ -0,0 +1,2 @@ | ||
1 | + | |
2 | +namespace qwerty{namespace nico{namespace nlite{ | |
\ No newline at end of file |
@@ -0,0 +1,84 @@ | ||
1 | +#include "stdafx.h" | |
2 | +#include "nexception.h" | |
3 | + | |
4 | + | |
5 | + | |
6 | +#include "namespace_start.h" | |
7 | + | |
8 | + | |
9 | + | |
10 | +/// | |
11 | +///コンストラクタ | |
12 | +/// | |
13 | +Exception::Exception(const NString &errMessage,UInt in_line,const NString &in_fileName,const NString &in_function): | |
14 | + | |
15 | +errMessage(errMessage), | |
16 | +line(in_line), | |
17 | +fileName(in_fileName), | |
18 | +function(in_function), | |
19 | +std::runtime_error("") | |
20 | +{} | |
21 | + | |
22 | + | |
23 | +/// | |
24 | +///エラー文言取得 | |
25 | +/// | |
26 | +const NString &Exception::GetErrorMessage()const{ | |
27 | + | |
28 | + return errMessage; | |
29 | +} | |
30 | + | |
31 | + | |
32 | +/// | |
33 | +///エラー発生行取得 | |
34 | +/// | |
35 | +UInt Exception::getLineNo()const{ | |
36 | + | |
37 | + return line; | |
38 | +} | |
39 | + | |
40 | +/// | |
41 | +///エラー発生ファイル名取得 | |
42 | +/// | |
43 | +const NString &Exception::getFileName()const{ | |
44 | + | |
45 | + return fileName; | |
46 | +} | |
47 | + | |
48 | + | |
49 | +/// | |
50 | +///エラー発生関数名を取得 | |
51 | +/// | |
52 | +const NString &Exception::getFunctionName()const{ | |
53 | + | |
54 | + return function; | |
55 | +} | |
56 | + | |
57 | +Bool Exception:: Report(const Exception &e){ | |
58 | + | |
59 | + NChar file[_MAX_PATH]; | |
60 | + NChar ext[_MAX_PATH]; | |
61 | + _wsplitpath(e.getFileName().c_str(),(NChar*)NULL,(NChar*)NULL,file,ext); | |
62 | + DWORD lastErrorCode = ::GetLastError(); | |
63 | + | |
64 | + | |
65 | + BugTransfer bug; | |
66 | + bug.sourcefile += file; | |
67 | + bug.sourcefile += ext; | |
68 | + | |
69 | + | |
70 | + bug.summary = e.GetErrorMessage(); | |
71 | + bug.function = e.getFunctionName(); | |
72 | + bug.line = boost::lexical_cast<NString>(e.getLineNo()); | |
73 | + bug.windowsErrorCode = boost::lexical_cast<NString>(lastErrorCode); | |
74 | + GetWindowsErrorMessage(bug.windowsErrorMessage,lastErrorCode); | |
75 | + BugTransfer::Report(bug); | |
76 | + | |
77 | + | |
78 | + return false; | |
79 | + | |
80 | +} | |
81 | + | |
82 | + | |
83 | + | |
84 | +#include "namespace_end.h" |
@@ -0,0 +1,59 @@ | ||
1 | +#pragma once | |
2 | + | |
3 | + | |
4 | +#include <stdexcept> | |
5 | +#include "define.h" | |
6 | +#include "windowsAPI.h" | |
7 | +#include "bugreport.h" | |
8 | +#include "namespace_start.h" | |
9 | + | |
10 | +class Exception:public std::runtime_error{ | |
11 | + | |
12 | + private: | |
13 | + NString errMessage; | |
14 | + UInt line; | |
15 | + NString fileName; | |
16 | + NString function; | |
17 | + | |
18 | + | |
19 | + public: | |
20 | + /// | |
21 | + ///コンストラクタ | |
22 | + /// | |
23 | + Exception(const NString& errMessage,UInt in_line,const NString &in_fileName,const NString &in_function); | |
24 | + | |
25 | + | |
26 | + /// | |
27 | + ///エラー文言取得 | |
28 | + /// | |
29 | + const NString &GetErrorMessage()const; | |
30 | + | |
31 | + | |
32 | + /// | |
33 | + ///エラー発生行取得 | |
34 | + /// | |
35 | + UInt getLineNo()const; | |
36 | + | |
37 | + /// | |
38 | + ///エラー発生ファイル名取得 | |
39 | + /// | |
40 | + const NString &getFileName()const; | |
41 | + | |
42 | + | |
43 | + /// | |
44 | + ///エラー発生関数名を取得 | |
45 | + /// | |
46 | + const NString &getFunctionName()const; | |
47 | + | |
48 | + | |
49 | + /// | |
50 | + ///バグ報告関数 | |
51 | + /// | |
52 | + static Bool Report(const Exception &e); | |
53 | + | |
54 | + }; | |
55 | + | |
56 | + | |
57 | + | |
58 | + | |
59 | +#include "namespace_end.h" | |
\ No newline at end of file |
@@ -9,6 +9,10 @@ | ||
9 | 9 | <Configuration>Release</Configuration> |
10 | 10 | <Platform>Win32</Platform> |
11 | 11 | </ProjectConfiguration> |
12 | + <ProjectConfiguration Include="UnitTest|Win32"> | |
13 | + <Configuration>UnitTest</Configuration> | |
14 | + <Platform>Win32</Platform> | |
15 | + </ProjectConfiguration> | |
12 | 16 | </ItemGroup> |
13 | 17 | <PropertyGroup Label="Globals"> |
14 | 18 | <ProjectGuid>{2FF71818-53D8-4FB6-A4B8-E3EFCB49C217}</ProjectGuid> |
@@ -21,6 +25,11 @@ | ||
21 | 25 | <UseDebugLibraries>true</UseDebugLibraries> |
22 | 26 | <CharacterSet>Unicode</CharacterSet> |
23 | 27 | </PropertyGroup> |
28 | + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='UnitTest|Win32'" Label="Configuration"> | |
29 | + <ConfigurationType>StaticLibrary</ConfigurationType> | |
30 | + <UseDebugLibraries>true</UseDebugLibraries> | |
31 | + <CharacterSet>Unicode</CharacterSet> | |
32 | + </PropertyGroup> | |
24 | 33 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> |
25 | 34 | <ConfigurationType>StaticLibrary</ConfigurationType> |
26 | 35 | <UseDebugLibraries>false</UseDebugLibraries> |
@@ -33,6 +42,9 @@ | ||
33 | 42 | <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
34 | 43 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
35 | 44 | </ImportGroup> |
45 | + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='UnitTest|Win32'" Label="PropertySheets"> | |
46 | + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | |
47 | + </ImportGroup> | |
36 | 48 | <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
37 | 49 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
38 | 50 | </ImportGroup> |
@@ -40,12 +52,30 @@ | ||
40 | 52 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
41 | 53 | <IncludePath>$(SolutionDir);$(IncludePath)</IncludePath> |
42 | 54 | </PropertyGroup> |
55 | + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='UnitTest|Win32'"> | |
56 | + <IncludePath>$(SolutionDir);$(IncludePath)</IncludePath> | |
57 | + </PropertyGroup> | |
58 | + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | |
59 | + <IncludePath>$(SolutionDir);$(IncludePath)</IncludePath> | |
60 | + </PropertyGroup> | |
43 | 61 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
44 | 62 | <ClCompile> |
45 | 63 | <PrecompiledHeader>Use</PrecompiledHeader> |
46 | 64 | <WarningLevel>Level3</WarningLevel> |
47 | 65 | <Optimization>Disabled</Optimization> |
48 | - <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> | |
66 | + <PreprocessorDefinitions>WIN32;_CRT_NON_CONFORMING_SWPRINTFS=1;_CRT_SECURE_NO_WARNINGS=1;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> | |
67 | + </ClCompile> | |
68 | + <Link> | |
69 | + <SubSystem>Windows</SubSystem> | |
70 | + <GenerateDebugInformation>true</GenerateDebugInformation> | |
71 | + </Link> | |
72 | + </ItemDefinitionGroup> | |
73 | + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='UnitTest|Win32'"> | |
74 | + <ClCompile> | |
75 | + <PrecompiledHeader>Use</PrecompiledHeader> | |
76 | + <WarningLevel>Level3</WarningLevel> | |
77 | + <Optimization>Disabled</Optimization> | |
78 | + <PreprocessorDefinitions>WIN32;_CRT_NON_CONFORMING_SWPRINTFS=1;_CRT_SECURE_NO_WARNINGS=1;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> | |
49 | 79 | </ClCompile> |
50 | 80 | <Link> |
51 | 81 | <SubSystem>Windows</SubSystem> |
@@ -59,7 +89,7 @@ | ||
59 | 89 | <Optimization>MaxSpeed</Optimization> |
60 | 90 | <FunctionLevelLinking>true</FunctionLevelLinking> |
61 | 91 | <IntrinsicFunctions>true</IntrinsicFunctions> |
62 | - <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> | |
92 | + <PreprocessorDefinitions>WIN32;_CRT_NON_CONFORMING_SWPRINTFS=1;_CRT_SECURE_NO_WARNINGS=1;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> | |
63 | 93 | </ClCompile> |
64 | 94 | <Link> |
65 | 95 | <SubSystem>Windows</SubSystem> |
@@ -72,14 +102,32 @@ | ||
72 | 102 | <None Include="ReadMe.txt" /> |
73 | 103 | </ItemGroup> |
74 | 104 | <ItemGroup> |
105 | + <ClInclude Include="appinfo.h" /> | |
106 | + <ClInclude Include="bugreport.h" /> | |
107 | + <ClInclude Include="define.h" /> | |
108 | + <ClInclude Include="http.h" /> | |
109 | + <ClInclude Include="namespace_end.h" /> | |
110 | + <ClInclude Include="namespace_start.h" /> | |
111 | + <ClInclude Include="nexception.h" /> | |
75 | 112 | <ClInclude Include="stdafx.h" /> |
76 | 113 | <ClInclude Include="targetver.h" /> |
114 | + <ClInclude Include="unit_test.h" /> | |
115 | + <ClInclude Include="use_namespace.h" /> | |
116 | + <ClInclude Include="windowsAPI.h" /> | |
77 | 117 | </ItemGroup> |
78 | 118 | <ItemGroup> |
119 | + <ClCompile Include="appInfo.cpp" /> | |
120 | + <ClCompile Include="bugreport.cpp" /> | |
121 | + <ClCompile Include="define.cpp" /> | |
122 | + <ClCompile Include="http.cpp" /> | |
123 | + <ClCompile Include="nexception.cpp" /> | |
79 | 124 | <ClCompile Include="stdafx.cpp"> |
80 | 125 | <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> |
126 | + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='UnitTest|Win32'">Create</PrecompiledHeader> | |
81 | 127 | <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader> |
82 | 128 | </ClCompile> |
129 | + <ClCompile Include="unit_test.cpp" /> | |
130 | + <ClCompile Include="windowsAPI.cpp" /> | |
83 | 131 | </ItemGroup> |
84 | 132 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |
85 | 133 | <ImportGroup Label="ExtensionTargets"> |
@@ -24,10 +24,61 @@ | ||
24 | 24 | <ClInclude Include="targetver.h"> |
25 | 25 | <Filter>ヘッダー ファイル</Filter> |
26 | 26 | </ClInclude> |
27 | + <ClInclude Include="namespace_start.h"> | |
28 | + <Filter>ヘッダー ファイル</Filter> | |
29 | + </ClInclude> | |
30 | + <ClInclude Include="namespace_end.h"> | |
31 | + <Filter>ヘッダー ファイル</Filter> | |
32 | + </ClInclude> | |
33 | + <ClInclude Include="define.h"> | |
34 | + <Filter>ヘッダー ファイル</Filter> | |
35 | + </ClInclude> | |
36 | + <ClInclude Include="use_namespace.h"> | |
37 | + <Filter>ヘッダー ファイル</Filter> | |
38 | + </ClInclude> | |
39 | + <ClInclude Include="unit_test.h"> | |
40 | + <Filter>ヘッダー ファイル</Filter> | |
41 | + </ClInclude> | |
42 | + <ClInclude Include="windowsAPI.h"> | |
43 | + <Filter>ヘッダー ファイル</Filter> | |
44 | + </ClInclude> | |
45 | + <ClInclude Include="nexception.h"> | |
46 | + <Filter>ヘッダー ファイル</Filter> | |
47 | + </ClInclude> | |
48 | + <ClInclude Include="bugreport.h"> | |
49 | + <Filter>ヘッダー ファイル</Filter> | |
50 | + </ClInclude> | |
51 | + <ClInclude Include="http.h"> | |
52 | + <Filter>ヘッダー ファイル</Filter> | |
53 | + </ClInclude> | |
54 | + <ClInclude Include="appinfo.h"> | |
55 | + <Filter>ヘッダー ファイル</Filter> | |
56 | + </ClInclude> | |
27 | 57 | </ItemGroup> |
28 | 58 | <ItemGroup> |
29 | 59 | <ClCompile Include="stdafx.cpp"> |
30 | 60 | <Filter>ソース ファイル</Filter> |
31 | 61 | </ClCompile> |
62 | + <ClCompile Include="unit_test.cpp"> | |
63 | + <Filter>ソース ファイル</Filter> | |
64 | + </ClCompile> | |
65 | + <ClCompile Include="windowsAPI.cpp"> | |
66 | + <Filter>ソース ファイル</Filter> | |
67 | + </ClCompile> | |
68 | + <ClCompile Include="define.cpp"> | |
69 | + <Filter>ソース ファイル</Filter> | |
70 | + </ClCompile> | |
71 | + <ClCompile Include="nexception.cpp"> | |
72 | + <Filter>ソース ファイル</Filter> | |
73 | + </ClCompile> | |
74 | + <ClCompile Include="bugreport.cpp"> | |
75 | + <Filter>ソース ファイル</Filter> | |
76 | + </ClCompile> | |
77 | + <ClCompile Include="http.cpp"> | |
78 | + <Filter>ソース ファイル</Filter> | |
79 | + </ClCompile> | |
80 | + <ClCompile Include="appInfo.cpp"> | |
81 | + <Filter>ソース ファイル</Filter> | |
82 | + </ClCompile> | |
32 | 83 | </ItemGroup> |
33 | 84 | </Project> |
\ No newline at end of file |
@@ -4,11 +4,20 @@ | ||
4 | 4 | // |
5 | 5 | |
6 | 6 | #pragma once |
7 | - | |
7 | +#pragma warning( disable : 4995 ) | |
8 | 8 | #include "targetver.h" |
9 | 9 | |
10 | 10 | #define WIN32_LEAN_AND_MEAN // Windows ヘッダーから使用されていない部分を除外します。 |
11 | 11 | |
12 | - | |
13 | - | |
12 | +#include <Windows.h> | |
13 | +#include <wincrypt.h> | |
14 | +#include <Iphlpapi.h> | |
14 | 15 | // TODO: プログラムに必要な追加ヘッダーをここで参照してください。 |
16 | +#include <iostream> | |
17 | +#include <string> | |
18 | +#include <tchar.h> | |
19 | +#include <stdio.h> | |
20 | +#include <strsafe.h> | |
21 | +#include <regex> | |
22 | +#include <array> | |
23 | +#include <boost\lexical_cast.hpp> | |
\ No newline at end of file |
@@ -0,0 +1,55 @@ | ||
1 | +#include "stdafx.h" | |
2 | +#include "define.h" | |
3 | +#include "unit_test.h" | |
4 | +#include "windowsAPI.h" | |
5 | +#include "nexception.h" | |
6 | +#include <boost\test\unit_test.hpp> | |
7 | + | |
8 | +#include "namespace_start.h" | |
9 | + | |
10 | +Void UnitTest(){ | |
11 | + | |
12 | + | |
13 | + std::wcout << _T("osVersion:"); | |
14 | + std::wcout << GetWindowsVersion() << std::endl; | |
15 | + | |
16 | + | |
17 | + try{ | |
18 | + | |
19 | + | |
20 | + | |
21 | + throw Exception(_T("testerror"),__LINE__,_T(__FILE__),_T(__FUNCTION__)); | |
22 | + | |
23 | + } catch(Exception &e){ | |
24 | + | |
25 | + Exception::Report(e); | |
26 | + | |
27 | + } | |
28 | + | |
29 | + | |
30 | + BOOST_CHECK(GetWindowsVersion().length() > 0); | |
31 | + CHResult result; | |
32 | + | |
33 | + BOOST_CHECK(!result.IsS_OK()); | |
34 | + BOOST_CHECK(!result.IsSucceded()); | |
35 | + result= S_OK; | |
36 | + BOOST_CHECK(result.IsS_OK()); | |
37 | + BOOST_CHECK_EQUAL(result.m_hResult,S_OK); | |
38 | + BOOST_CHECK(result.IsSucceded()); | |
39 | + BOOST_CHECK(SUCCEEDED(result.m_hResult)); | |
40 | + result = OLE_E_CANT_GETMONIKER; | |
41 | + BOOST_CHECK(!result.IsS_OK()); | |
42 | + BOOST_CHECK(!result.IsSucceded()); | |
43 | + BOOST_CHECK(!result.IsS_OK()); | |
44 | + BOOST_CHECK_EQUAL(result.m_hResult,OLE_E_CANT_GETMONIKER); | |
45 | + BOOST_CHECK(!result.IsSucceded()); | |
46 | + | |
47 | + BOOST_CHECK(FAILED(result.m_hResult)); | |
48 | + | |
49 | + | |
50 | + | |
51 | +} | |
52 | + | |
53 | + | |
54 | + | |
55 | +#include "namespace_end.h" | |
\ No newline at end of file |
@@ -0,0 +1,10 @@ | ||
1 | +#pragma once | |
2 | + | |
3 | +#include "define.h" | |
4 | +#include "namespace_start.h" | |
5 | + | |
6 | +#include <nlite_test\unit_test.h> | |
7 | + | |
8 | + | |
9 | + | |
10 | +#include "namespace_end.h" | |
\ No newline at end of file |
@@ -0,0 +1 @@ | ||
1 | +using namespace qwerty::nico::nlite; | |
\ No newline at end of file |
@@ -0,0 +1,435 @@ | ||
1 | + | |
2 | +#include "stdafx.h" | |
3 | + | |
4 | + | |
5 | + | |
6 | +#include "windowsAPI.h" | |
7 | + | |
8 | + | |
9 | + | |
10 | +#include "namespace_start.h" | |
11 | + | |
12 | +const static UInt BUFSIZE = 256; | |
13 | +typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO); | |
14 | +typedef BOOL (WINAPI *PGPI)(DWORD, DWORD, DWORD, DWORD, PDWORD); | |
15 | + | |
16 | + | |
17 | + | |
18 | + | |
19 | +BOOL GetOSDisplayString( LPTSTR pszOS) | |
20 | +{ | |
21 | + | |
22 | + OSVERSIONINFOEX osvi; | |
23 | + SYSTEM_INFO si; | |
24 | + PGNSI pGNSI; | |
25 | + PGPI pGPI; | |
26 | + BOOL bOsVersionInfoEx; | |
27 | + DWORD dwType; | |
28 | + | |
29 | + ZeroMemory(&si, sizeof(SYSTEM_INFO)); | |
30 | + ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX)); | |
31 | + | |
32 | + osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); | |
33 | + bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO*) &osvi); | |
34 | + | |
35 | + if(bOsVersionInfoEx == FALSE ) return false; | |
36 | + | |
37 | + // Call GetNativeSystemInfo if supported or GetSystemInfo otherwise. | |
38 | + | |
39 | + pGNSI = (PGNSI) GetProcAddress( | |
40 | + GetModuleHandle(TEXT("kernel32.dll")), | |
41 | + "GetNativeSystemInfo"); | |
42 | + if(NULL != pGNSI) | |
43 | + pGNSI(&si); | |
44 | + else GetSystemInfo(&si); | |
45 | + | |
46 | + if ( VER_PLATFORM_WIN32_NT==osvi.dwPlatformId && | |
47 | + osvi.dwMajorVersion > 4 ) | |
48 | + { | |
49 | + StringCchCopy(pszOS, BUFSIZE, TEXT("Microsoft ")); | |
50 | + | |
51 | + // Test for the specific product. | |
52 | + | |
53 | + if ( osvi.dwMajorVersion == 6 ) | |
54 | + { | |
55 | + if( osvi.dwMinorVersion == 0 ) | |
56 | + { | |
57 | + if( osvi.wProductType == VER_NT_WORKSTATION ) | |
58 | + StringCchCat(pszOS, BUFSIZE, TEXT("Windows Vista ")); | |
59 | + else StringCchCat(pszOS, BUFSIZE, TEXT("Windows Server 2008 " )); | |
60 | + } | |
61 | + | |
62 | + if ( osvi.dwMinorVersion == 1 ) | |
63 | + { | |
64 | + if( osvi.wProductType == VER_NT_WORKSTATION ) | |
65 | + StringCchCat(pszOS, BUFSIZE, TEXT("Windows 7 ")); | |
66 | + else StringCchCat(pszOS, BUFSIZE, TEXT("Windows Server 2008 R2 " )); | |
67 | + } | |
68 | + | |
69 | + pGPI = (PGPI) GetProcAddress( | |
70 | + GetModuleHandle(TEXT("kernel32.dll")), | |
71 | + "GetProductInfo"); | |
72 | + | |
73 | + pGPI( osvi.dwMajorVersion, osvi.dwMinorVersion, 0, 0, &dwType); | |
74 | + | |
75 | + switch( dwType ) | |
76 | + { | |
77 | + case PRODUCT_ULTIMATE: | |
78 | + StringCchCat(pszOS, BUFSIZE, TEXT("Ultimate Edition" )); | |
79 | + break; | |
80 | + case PRODUCT_PROFESSIONAL: | |
81 | + StringCchCat(pszOS, BUFSIZE, TEXT("Professional" )); | |
82 | + break; | |
83 | + case PRODUCT_HOME_PREMIUM: | |
84 | + StringCchCat(pszOS, BUFSIZE, TEXT("Home Premium Edition" )); | |
85 | + break; | |
86 | + case PRODUCT_HOME_BASIC: | |
87 | + StringCchCat(pszOS, BUFSIZE, TEXT("Home Basic Edition" )); | |
88 | + break; | |
89 | + case PRODUCT_ENTERPRISE: | |
90 | + StringCchCat(pszOS, BUFSIZE, TEXT("Enterprise Edition" )); | |
91 | + break; | |
92 | + case PRODUCT_BUSINESS: | |
93 | + StringCchCat(pszOS, BUFSIZE, TEXT("Business Edition" )); | |
94 | + break; | |
95 | + case PRODUCT_STARTER: | |
96 | + StringCchCat(pszOS, BUFSIZE, TEXT("Starter Edition" )); | |
97 | + break; | |
98 | + case PRODUCT_CLUSTER_SERVER: | |
99 | + StringCchCat(pszOS, BUFSIZE, TEXT("Cluster Server Edition" )); | |
100 | + break; | |
101 | + case PRODUCT_DATACENTER_SERVER: | |
102 | + StringCchCat(pszOS, BUFSIZE, TEXT("Datacenter Edition" )); | |
103 | + break; | |
104 | + case PRODUCT_DATACENTER_SERVER_CORE: | |
105 | + StringCchCat(pszOS, BUFSIZE, TEXT("Datacenter Edition (core installation)" )); | |
106 | + break; | |
107 | + case PRODUCT_ENTERPRISE_SERVER: | |
108 | + StringCchCat(pszOS, BUFSIZE, TEXT("Enterprise Edition" )); | |
109 | + break; | |
110 | + case PRODUCT_ENTERPRISE_SERVER_CORE: | |
111 | + StringCchCat(pszOS, BUFSIZE, TEXT("Enterprise Edition (core installation)" )); | |
112 | + break; | |
113 | + case PRODUCT_ENTERPRISE_SERVER_IA64: | |
114 | + StringCchCat(pszOS, BUFSIZE, TEXT("Enterprise Edition for Itanium-based Systems" )); | |
115 | + break; | |
116 | + case PRODUCT_SMALLBUSINESS_SERVER: | |
117 | + StringCchCat(pszOS, BUFSIZE, TEXT("Small Business Server" )); | |
118 | + break; | |
119 | + case PRODUCT_SMALLBUSINESS_SERVER_PREMIUM: | |
120 | + StringCchCat(pszOS, BUFSIZE, TEXT("Small Business Server Premium Edition" )); | |
121 | + break; | |
122 | + case PRODUCT_STANDARD_SERVER: | |
123 | + StringCchCat(pszOS, BUFSIZE, TEXT("Standard Edition" )); | |
124 | + break; | |
125 | + case PRODUCT_STANDARD_SERVER_CORE: | |
126 | + StringCchCat(pszOS, BUFSIZE, TEXT("Standard Edition (core installation)" )); | |
127 | + break; | |
128 | + case PRODUCT_WEB_SERVER: | |
129 | + StringCchCat(pszOS, BUFSIZE, TEXT("Web Server Edition" )); | |
130 | + break; | |
131 | + } | |
132 | + } | |
133 | + | |
134 | + if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2 ) | |
135 | + { | |
136 | + if( GetSystemMetrics(SM_SERVERR2) ) | |
137 | + StringCchCat(pszOS, BUFSIZE, TEXT( "Windows Server 2003 R2, ")); | |
138 | + else if ( osvi.wSuiteMask & VER_SUITE_STORAGE_SERVER ) | |
139 | + StringCchCat(pszOS, BUFSIZE, TEXT( "Windows Storage Server 2003")); | |
140 | + else if ( osvi.wSuiteMask & VER_SUITE_WH_SERVER ) | |
141 | + StringCchCat(pszOS, BUFSIZE, TEXT( "Windows Home Server")); | |
142 | + else if( osvi.wProductType == VER_NT_WORKSTATION && | |
143 | + si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64) | |
144 | + { | |
145 | + StringCchCat(pszOS, BUFSIZE, TEXT( "Windows XP Professional x64 Edition")); | |
146 | + } | |
147 | + else StringCchCat(pszOS, BUFSIZE, TEXT("Windows Server 2003, ")); | |
148 | + | |
149 | + // Test for the server type. | |
150 | + if ( osvi.wProductType != VER_NT_WORKSTATION ) | |
151 | + { | |
152 | + if ( si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_IA64 ) | |
153 | + { | |
154 | + if( osvi.wSuiteMask & VER_SUITE_DATACENTER ) | |
155 | + StringCchCat(pszOS, BUFSIZE, TEXT( "Datacenter Edition for Itanium-based Systems" )); | |
156 | + else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE ) | |
157 | + StringCchCat(pszOS, BUFSIZE, TEXT( "Enterprise Edition for Itanium-based Systems" )); | |
158 | + } | |
159 | + | |
160 | + else if ( si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64 ) | |
161 | + { | |
162 | + if( osvi.wSuiteMask & VER_SUITE_DATACENTER ) | |
163 | + StringCchCat(pszOS, BUFSIZE, TEXT( "Datacenter x64 Edition" )); | |
164 | + else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE ) | |
165 | + StringCchCat(pszOS, BUFSIZE, TEXT( "Enterprise x64 Edition" )); | |
166 | + else StringCchCat(pszOS, BUFSIZE, TEXT( "Standard x64 Edition" )); | |
167 | + } | |
168 | + | |
169 | + else | |
170 | + { | |
171 | + if ( osvi.wSuiteMask & VER_SUITE_COMPUTE_SERVER ) | |
172 | + StringCchCat(pszOS, BUFSIZE, TEXT( "Compute Cluster Edition" )); | |
173 | + else if( osvi.wSuiteMask & VER_SUITE_DATACENTER ) | |
174 | + StringCchCat(pszOS, BUFSIZE, TEXT( "Datacenter Edition" )); | |
175 | + else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE ) | |
176 | + StringCchCat(pszOS, BUFSIZE, TEXT( "Enterprise Edition" )); | |
177 | + else if ( osvi.wSuiteMask & VER_SUITE_BLADE ) | |
178 | + StringCchCat(pszOS, BUFSIZE, TEXT( "Web Edition" )); | |
179 | + else StringCchCat(pszOS, BUFSIZE, TEXT( "Standard Edition" )); | |
180 | + } | |
181 | + } | |
182 | + } | |
183 | + | |
184 | + if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1 ) | |
185 | + { | |
186 | + StringCchCat(pszOS, BUFSIZE, TEXT("Windows XP ")); | |
187 | + if( osvi.wSuiteMask & VER_SUITE_PERSONAL ) | |
188 | + StringCchCat(pszOS, BUFSIZE, TEXT( "Home Edition" )); | |
189 | + else StringCchCat(pszOS, BUFSIZE, TEXT( "Professional" )); | |
190 | + } | |
191 | + | |
192 | + if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0 ) | |
193 | + { | |
194 | + StringCchCat(pszOS, BUFSIZE, TEXT("Windows 2000 ")); | |
195 | + | |
196 | + if ( osvi.wProductType == VER_NT_WORKSTATION ) | |
197 | + { | |
198 | + StringCchCat(pszOS, BUFSIZE, TEXT( "Professional" )); | |
199 | + } | |
200 | + else | |
201 | + { | |
202 | + if( osvi.wSuiteMask & VER_SUITE_DATACENTER ) | |
203 | + StringCchCat(pszOS, BUFSIZE, TEXT( "Datacenter Server" )); | |
204 | + else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE ) | |
205 | + StringCchCat(pszOS, BUFSIZE, TEXT( "Advanced Server" )); | |
206 | + else StringCchCat(pszOS, BUFSIZE, TEXT( "Server" )); | |
207 | + } | |
208 | + } | |
209 | + | |
210 | + // Include service pack (if any) and build number. | |
211 | + | |
212 | + if( _tcslen(osvi.szCSDVersion) > 0 ) | |
213 | + { | |
214 | + StringCchCat(pszOS, BUFSIZE, TEXT(" ") ); | |
215 | + StringCchCat(pszOS, BUFSIZE, osvi.szCSDVersion); | |
216 | + } | |
217 | + | |
218 | + TCHAR buf[80]; | |
219 | + | |
220 | + StringCchPrintf( buf, 80, TEXT(" (build %d)"), osvi.dwBuildNumber); | |
221 | + StringCchCat(pszOS, BUFSIZE, buf); | |
222 | + | |
223 | + if ( osvi.dwMajorVersion >= 6 ) | |
224 | + { | |
225 | + if ( si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64 ) | |
226 | + StringCchCat(pszOS, BUFSIZE, TEXT( ", 64-bit" )); | |
227 | + else if (si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_INTEL ) | |
228 | + StringCchCat(pszOS, BUFSIZE, TEXT(", 32-bit")); | |
229 | + } | |
230 | + | |
231 | + return TRUE; | |
232 | + } | |
233 | + | |
234 | + else | |
235 | + { | |
236 | + | |
237 | + return FALSE; | |
238 | + } | |
239 | + | |
240 | +} | |
241 | + | |
242 | +static const NChar* GetVersionStr(){ | |
243 | + | |
244 | + static NChar versionString[256]; | |
245 | + GetOSDisplayString(versionString); | |
246 | + return versionString; | |
247 | + | |
248 | +} | |
249 | + | |
250 | +const NString &GetWindowsVersion(){ | |
251 | + | |
252 | + static NString versionString(GetVersionStr()); | |
253 | + return versionString; | |
254 | +} | |
255 | + | |
256 | + | |
257 | + | |
258 | +CHResult::CHResult(){} | |
259 | + | |
260 | +CHResult::CHResult(HRESULT hResult):m_hResult(hResult){} | |
261 | + | |
262 | +HRESULT CHResult::operator=(HRESULT hResult){ | |
263 | + | |
264 | + return m_hResult = hResult; | |
265 | + | |
266 | +} | |
267 | + | |
268 | +CHResult::operator HRESULT(){ | |
269 | + | |
270 | + return this->m_hResult; | |
271 | +} | |
272 | + | |
273 | +Bool CHResult::IsS_OK(){ | |
274 | + | |
275 | + return m_hResult == S_OK; | |
276 | + | |
277 | +} | |
278 | + | |
279 | +Bool CHResult::IsSucceded(){ | |
280 | + | |
281 | + return SUCCEEDED(m_hResult); | |
282 | +} | |
283 | + | |
284 | + | |
285 | +Bool operator==(const CHResult &result,HRESULT hResult){ | |
286 | + | |
287 | + return result.m_hResult == hResult; | |
288 | + | |
289 | +} | |
290 | + | |
291 | +Bool operator==(HRESULT hResult,const CHResult &result){ | |
292 | + | |
293 | + return hResult == result.m_hResult; | |
294 | +} | |
295 | + | |
296 | +Void GetWindowsErrorMessage(NString &buf,DWORD lastErrorCode){ | |
297 | + | |
298 | + NChar *lpMsgBuf; | |
299 | + NString rslt; | |
300 | + FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, lastErrorCode,MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpMsgBuf,0,(va_list*)NULL); | |
301 | + | |
302 | + buf = lpMsgBuf; | |
303 | + LocalFree(lpMsgBuf); | |
304 | + | |
305 | + return; | |
306 | +} | |
307 | + | |
308 | + | |
309 | + | |
310 | + | |
311 | + | |
312 | + | |
313 | + | |
314 | + | |
315 | + | |
316 | + | |
317 | + | |
318 | +Void GetnliteUserId(NString &id) | |
319 | +{ | |
320 | + ULONG ulOutBufLen; | |
321 | + DWORD dwRet; | |
322 | + std::vector<BYTE> buff; | |
323 | + PIP_ADAPTER_INFO pAdapterInfo; | |
324 | + | |
325 | + ulOutBufLen = 0; | |
326 | + // 必要バッファサイズ取得 | |
327 | + ::GetAdaptersInfo(NULL, &ulOutBufLen); | |
328 | + // 必要なバッファサイズで取得用の構造体を用意する。 | |
329 | + buff.resize(ulOutBufLen); | |
330 | + pAdapterInfo = (PIP_ADAPTER_INFO)&buff[0]; | |
331 | + // 実際にネットワークアダプタの情報を取得する。 | |
332 | + dwRet = ::GetAdaptersInfo(pAdapterInfo, &ulOutBufLen); | |
333 | + // ネットワークアダプターの情報取得をチェック | |
334 | + if(dwRet == ERROR_SUCCESS) { | |
335 | + // 取得が成功したら最後のアダプタ情報を採用 | |
336 | + while (1) { | |
337 | + // 現状NICの正しいMacアドレスを割り出すことが出来ない。 | |
338 | + // 最後に取得されたアダプタを採用。必ずしもNICのMacアドレスとは限らない! | |
339 | + if (pAdapterInfo->Next == NULL) {// MIB_IF_TYPE_ETHERNETでは判定不可! | |
340 | + std::array<TCHAR,256> buffer; | |
341 | + DWORD bufSize = buffer.size(); | |
342 | + CryptBinaryToString(pAdapterInfo->Address,sizeof(pAdapterInfo->Address),CRYPT_STRING_BASE64,&buffer[0],&bufSize); | |
343 | + | |
344 | + | |
345 | + id = &buffer[0]; | |
346 | + return; | |
347 | + | |
348 | + } | |
349 | + | |
350 | + pAdapterInfo = pAdapterInfo->Next; | |
351 | + } | |
352 | + | |
353 | + } | |
354 | +} | |
355 | + | |
356 | + | |
357 | + | |
358 | + | |
359 | + | |
360 | + | |
361 | + | |
362 | + | |
363 | +Bool ToMStr(UInt cp,MString &buf,const CharU16 *target,UInt targetSize){ | |
364 | + Int rslt = 0; | |
365 | + | |
366 | + buf.resize(::WideCharToMultiByte(cp,0,target,targetSize,NULL,0,0,NULL)); | |
367 | + | |
368 | + rslt = ::WideCharToMultiByte(cp,0,target,targetSize,&buf[0],buf.size(),0,NULL); | |
369 | + | |
370 | + return rslt > 0; | |
371 | + | |
372 | +} | |
373 | + | |
374 | + | |
375 | +Bool ToU16Str(UInt cp,U16String &buf,const Char *target,UInt targetSize){ | |
376 | + Int rslt = 0; | |
377 | + | |
378 | + buf.resize(::MultiByteToWideChar(cp,0,target,targetSize,NULL,0)); | |
379 | + | |
380 | + rslt = ::MultiByteToWideChar(cp,0,target,targetSize,&buf[0],buf.size()); | |
381 | + | |
382 | + | |
383 | + return rslt > 0; | |
384 | + | |
385 | +} | |
386 | + | |
387 | +Bool ToSJIS(MString &buf,const U16String &target){ | |
388 | + | |
389 | + | |
390 | + return ToSJIS(buf,target.c_str(),target.size()); | |
391 | + | |
392 | +} | |
393 | + | |
394 | +Bool ToSJIS(MString &buf,const CharU16 *target,UInt targetSize){ | |
395 | + | |
396 | + return ToMStr(CP_THREAD_ACP,buf,target,targetSize); | |
397 | +} | |
398 | + | |
399 | +Bool ToUTF8(MString &buf,const U16String &target){ | |
400 | + | |
401 | + return ToUTF8(buf,target.c_str(),target.size()); | |
402 | + | |
403 | +} | |
404 | + | |
405 | +Bool ToUTF8(MString &buf,const CharU16 *target,UInt targetSize){ | |
406 | + | |
407 | + return ToMStr(CP_UTF8,buf,target,targetSize); | |
408 | + | |
409 | +} | |
410 | + | |
411 | +Bool UTF8ToUTF16(U16String &buf,const MString &target){ | |
412 | + | |
413 | + | |
414 | + return UTF8ToUTF16(buf,target.c_str(),target.size()); | |
415 | +} | |
416 | + | |
417 | + Bool UTF8ToUTF16(U16String &buf,const Char *target,UInt targetSize){ | |
418 | + | |
419 | + | |
420 | + return ToU16Str(CP_UTF8,buf,target,targetSize); | |
421 | + | |
422 | + } | |
423 | + | |
424 | + | |
425 | + Bool SJISToUTF16(U16String &buf,const MString &target){ | |
426 | + | |
427 | + return SJISToUTF16(buf,target.c_str(),target.size()); | |
428 | + } | |
429 | + | |
430 | +Bool SJISToUTF16(U16String &buf,const Char *target,UInt targetSize){ | |
431 | + | |
432 | + return ToU16Str(CP_THREAD_ACP,buf,target,targetSize); | |
433 | +} | |
434 | + | |
435 | +#include "namespace_end.h" |
@@ -0,0 +1,77 @@ | ||
1 | +#pragma once | |
2 | + | |
3 | +#include "unit_test.h" | |
4 | +#include "define.h" | |
5 | + | |
6 | + | |
7 | +#include "namespace_start.h" | |
8 | + | |
9 | + | |
10 | + | |
11 | +class CHResult{ | |
12 | + friend bool operator==(const CHResult &result,HRESULT hResult); | |
13 | + friend bool operator==(HRESULT hResult,const CHResult &result); | |
14 | + friend Void UnitTest(); | |
15 | +private: | |
16 | + HRESULT m_hResult; | |
17 | + | |
18 | + /// | |
19 | + ///コンストラクタ | |
20 | + /// | |
21 | +public: | |
22 | + CHResult(); | |
23 | + | |
24 | + CHResult(HRESULT hResult); | |
25 | + | |
26 | + HRESULT operator=(HRESULT hResult); | |
27 | + | |
28 | + operator HRESULT(); | |
29 | + | |
30 | + Bool IsS_OK(); | |
31 | + | |
32 | + Bool IsSucceded(); | |
33 | + | |
34 | +}; | |
35 | + | |
36 | + | |
37 | + | |
38 | +extern Bool operator==(const CHResult &result,HRESULT hResult); | |
39 | + | |
40 | +extern Bool operator==(HRESULT hResult,const CHResult &result); | |
41 | + | |
42 | + | |
43 | + | |
44 | +/// | |
45 | +///OSバージョン取得 | |
46 | +/// | |
47 | +extern const NString &GetWindowsVersion(); | |
48 | + | |
49 | + | |
50 | +extern VOID GetWindowsErrorMessage(NString &buf,DWORD lastErrorCode); | |
51 | + | |
52 | + | |
53 | +/// | |
54 | +///ユーザID取得 | |
55 | +/// | |
56 | +extern Void GetnliteUserId(NString &id); | |
57 | + | |
58 | +extern Bool ToSJIS(MString &buf,const U16String &target); | |
59 | + | |
60 | +extern Bool ToSJIS(MString &buf,const CharU16 *target,UInt targetSize); | |
61 | + | |
62 | +extern Bool ToUTF8(MString &buf,const U16String &target); | |
63 | + | |
64 | +extern Bool ToUTF8(MString &buf,const CharU16 *target,UInt targetSize); | |
65 | + | |
66 | +extern Bool UTF8ToUTF16(U16String &buf,const MString &target); | |
67 | + | |
68 | +extern Bool UTF8ToUTF16(U16String &buf,const Char *target,UInt targetSize); | |
69 | + | |
70 | +extern Bool SJISToUTF16(U16String &buf,const MString &target); | |
71 | + | |
72 | +extern Bool SJISToUTF16(U16String &buf,const Char *target,UInt targetSize); | |
73 | + | |
74 | +#include "namespace_end.h" | |
75 | + | |
76 | +#pragma comment(lib,"Iphlpapi.lib") | |
77 | +#pragma comment(lib,"Crypt32.lib") | |
\ No newline at end of file |
@@ -9,6 +9,10 @@ | ||
9 | 9 | <Configuration>Release</Configuration> |
10 | 10 | <Platform>Win32</Platform> |
11 | 11 | </ProjectConfiguration> |
12 | + <ProjectConfiguration Include="UnitTest|Win32"> | |
13 | + <Configuration>UnitTest</Configuration> | |
14 | + <Platform>Win32</Platform> | |
15 | + </ProjectConfiguration> | |
12 | 16 | </ItemGroup> |
13 | 17 | <PropertyGroup Label="Globals"> |
14 | 18 | <ProjectGuid>{67ACC76A-F834-4DE6-84B7-3A5F543ABDFE}</ProjectGuid> |
@@ -21,6 +25,11 @@ | ||
21 | 25 | <UseDebugLibraries>true</UseDebugLibraries> |
22 | 26 | <CharacterSet>Unicode</CharacterSet> |
23 | 27 | </PropertyGroup> |
28 | + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='UnitTest|Win32'" Label="Configuration"> | |
29 | + <ConfigurationType>StaticLibrary</ConfigurationType> | |
30 | + <UseDebugLibraries>true</UseDebugLibraries> | |
31 | + <CharacterSet>Unicode</CharacterSet> | |
32 | + </PropertyGroup> | |
24 | 33 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> |
25 | 34 | <ConfigurationType>StaticLibrary</ConfigurationType> |
26 | 35 | <UseDebugLibraries>false</UseDebugLibraries> |
@@ -33,6 +42,9 @@ | ||
33 | 42 | <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
34 | 43 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
35 | 44 | </ImportGroup> |
45 | + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='UnitTest|Win32'" Label="PropertySheets"> | |
46 | + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | |
47 | + </ImportGroup> | |
36 | 48 | <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
37 | 49 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
38 | 50 | </ImportGroup> |
@@ -40,6 +52,9 @@ | ||
40 | 52 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
41 | 53 | <IncludePath>$(SolutionDir);$(IncludePath)</IncludePath> |
42 | 54 | </PropertyGroup> |
55 | + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='UnitTest|Win32'"> | |
56 | + <IncludePath>$(SolutionDir);$(IncludePath)</IncludePath> | |
57 | + </PropertyGroup> | |
43 | 58 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
44 | 59 | <IncludePath>$(SolutionDir);$(IncludePath)</IncludePath> |
45 | 60 | </PropertyGroup> |
@@ -55,6 +70,18 @@ | ||
55 | 70 | <GenerateDebugInformation>true</GenerateDebugInformation> |
56 | 71 | </Link> |
57 | 72 | </ItemDefinitionGroup> |
73 | + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='UnitTest|Win32'"> | |
74 | + <ClCompile> | |
75 | + <PrecompiledHeader>Use</PrecompiledHeader> | |
76 | + <WarningLevel>Level3</WarningLevel> | |
77 | + <Optimization>Disabled</Optimization> | |
78 | + <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> | |
79 | + </ClCompile> | |
80 | + <Link> | |
81 | + <SubSystem>Windows</SubSystem> | |
82 | + <GenerateDebugInformation>true</GenerateDebugInformation> | |
83 | + </Link> | |
84 | + </ItemDefinitionGroup> | |
58 | 85 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
59 | 86 | <ClCompile> |
60 | 87 | <WarningLevel>Level3</WarningLevel> |
@@ -81,6 +108,7 @@ | ||
81 | 108 | <ItemGroup> |
82 | 109 | <ClCompile Include="stdafx.cpp"> |
83 | 110 | <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> |
111 | + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='UnitTest|Win32'">Create</PrecompiledHeader> | |
84 | 112 | <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader> |
85 | 113 | </ClCompile> |
86 | 114 | </ItemGroup> |
@@ -1,8 +1,3 @@ | ||
1 | 1 | #pragma once |
2 | 2 | |
3 | -// SDKDDKVer.h をインクルードすると、利用できる最も上位の Windows プラットフォームが定義されます。 | |
4 | - | |
5 | -// 以前の Windows プラットフォーム用にアプリケーションをビルドする場合は、WinSDKVer.h をインクルードし、 | |
6 | -// SDKDDKVer.h をインクルードする前に、サポート対象とするプラットフォームを示すように _WIN32_WINNT マクロを設定します。 | |
7 | - | |
8 | -#include <SDKDDKVer.h> | |
3 | +#include <nlite_common\targetver.h> | |
\ No newline at end of file |
@@ -9,6 +9,10 @@ | ||
9 | 9 | <Configuration>Release</Configuration> |
10 | 10 | <Platform>Win32</Platform> |
11 | 11 | </ProjectConfiguration> |
12 | + <ProjectConfiguration Include="UnitTest|Win32"> | |
13 | + <Configuration>UnitTest</Configuration> | |
14 | + <Platform>Win32</Platform> | |
15 | + </ProjectConfiguration> | |
12 | 16 | </ItemGroup> |
13 | 17 | <PropertyGroup Label="Globals"> |
14 | 18 | <ProjectGuid>{6FB77F9B-EBA4-4E42-8EC7-1197CBB50C2D}</ProjectGuid> |
@@ -21,6 +25,11 @@ | ||
21 | 25 | <UseDebugLibraries>true</UseDebugLibraries> |
22 | 26 | <CharacterSet>Unicode</CharacterSet> |
23 | 27 | </PropertyGroup> |
28 | + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='UnitTest|Win32'" Label="Configuration"> | |
29 | + <ConfigurationType>StaticLibrary</ConfigurationType> | |
30 | + <UseDebugLibraries>true</UseDebugLibraries> | |
31 | + <CharacterSet>Unicode</CharacterSet> | |
32 | + </PropertyGroup> | |
24 | 33 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> |
25 | 34 | <ConfigurationType>StaticLibrary</ConfigurationType> |
26 | 35 | <UseDebugLibraries>false</UseDebugLibraries> |
@@ -33,6 +42,9 @@ | ||
33 | 42 | <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
34 | 43 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
35 | 44 | </ImportGroup> |
45 | + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='UnitTest|Win32'" Label="PropertySheets"> | |
46 | + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | |
47 | + </ImportGroup> | |
36 | 48 | <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
37 | 49 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
38 | 50 | </ImportGroup> |
@@ -40,6 +52,9 @@ | ||
40 | 52 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
41 | 53 | <IncludePath>$(SolutionDir);$(IncludePath)</IncludePath> |
42 | 54 | </PropertyGroup> |
55 | + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='UnitTest|Win32'"> | |
56 | + <IncludePath>$(SolutionDir);$(IncludePath)</IncludePath> | |
57 | + </PropertyGroup> | |
43 | 58 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
44 | 59 | <IncludePath>$(SolutionDir);$(IncludePath)</IncludePath> |
45 | 60 | </PropertyGroup> |
@@ -55,6 +70,18 @@ | ||
55 | 70 | <GenerateDebugInformation>true</GenerateDebugInformation> |
56 | 71 | </Link> |
57 | 72 | </ItemDefinitionGroup> |
73 | + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='UnitTest|Win32'"> | |
74 | + <ClCompile> | |
75 | + <PrecompiledHeader>Use</PrecompiledHeader> | |
76 | + <WarningLevel>Level3</WarningLevel> | |
77 | + <Optimization>Disabled</Optimization> | |
78 | + <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> | |
79 | + </ClCompile> | |
80 | + <Link> | |
81 | + <SubSystem>Windows</SubSystem> | |
82 | + <GenerateDebugInformation>true</GenerateDebugInformation> | |
83 | + </Link> | |
84 | + </ItemDefinitionGroup> | |
58 | 85 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
59 | 86 | <ClCompile> |
60 | 87 | <WarningLevel>Level3</WarningLevel> |
@@ -81,6 +108,7 @@ | ||
81 | 108 | <ItemGroup> |
82 | 109 | <ClCompile Include="stdafx.cpp"> |
83 | 110 | <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> |
111 | + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='UnitTest|Win32'">Create</PrecompiledHeader> | |
84 | 112 | <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader> |
85 | 113 | </ClCompile> |
86 | 114 | </ItemGroup> |
@@ -0,0 +1,30 @@ | ||
1 | +#pragma once | |
2 | + | |
3 | +#include <boost\test\unit_test.hpp> | |
4 | +#include <nlite_common\unit_test.h> | |
5 | +#include <nlite_common\use_namespace.h> | |
6 | + | |
7 | + | |
8 | + | |
9 | + | |
10 | +BOOST_AUTO_TEST_SUITE(common_test_suite) | |
11 | + | |
12 | + BOOST_AUTO_TEST_CASE(init_nlite_test_common){ | |
13 | + | |
14 | + ::CoInitialize(NULL); | |
15 | + | |
16 | + } | |
17 | + | |
18 | + BOOST_AUTO_TEST_CASE(unit_test){ | |
19 | + | |
20 | + UnitTest(); | |
21 | + | |
22 | + } | |
23 | + | |
24 | + | |
25 | + BOOST_AUTO_TEST_CASE(finalize_test_common){ | |
26 | + | |
27 | + ::CoUninitialize(); | |
28 | + } | |
29 | + | |
30 | +BOOST_AUTO_TEST_SUITE_END() | |
\ No newline at end of file |
@@ -2,8 +2,34 @@ | ||
2 | 2 | // |
3 | 3 | |
4 | 4 | #include "stdafx.h" |
5 | -int _tmain(int argc, _TCHAR* argv[]) | |
6 | -{ | |
7 | - return 0; | |
8 | -} | |
5 | +#include <nlite_application\Resource.h> | |
6 | +#include <nlite_common\define.h> | |
7 | +#include <nlite_common\unit_test.h> | |
8 | + | |
9 | + | |
10 | +#define BOOST_TEST_MODULE SimpleTest | |
11 | + | |
12 | +#include "commontest.h" | |
13 | + | |
14 | +BOOST_AUTO_TEST_SUITE(end_test_suite) | |
15 | + | |
16 | + | |
17 | + | |
18 | + BOOST_AUTO_TEST_CASE(end_test){ | |
19 | + | |
20 | + | |
21 | + std::string s; | |
22 | + | |
23 | + do{ | |
24 | + std::cout << "終了するにはexitをタイプしてださい:"; | |
25 | + | |
26 | + | |
27 | + std::cin >> s; | |
28 | + }while(s != "exit"); | |
29 | + | |
30 | + } | |
31 | + | |
32 | +BOOST_AUTO_TEST_SUITE_END() | |
33 | + | |
34 | +#pragma comment(lib,"nlite_common.lib") | |
9 | 35 |
@@ -9,6 +9,10 @@ | ||
9 | 9 | <Configuration>Release</Configuration> |
10 | 10 | <Platform>Win32</Platform> |
11 | 11 | </ProjectConfiguration> |
12 | + <ProjectConfiguration Include="UnitTest|Win32"> | |
13 | + <Configuration>UnitTest</Configuration> | |
14 | + <Platform>Win32</Platform> | |
15 | + </ProjectConfiguration> | |
12 | 16 | </ItemGroup> |
13 | 17 | <PropertyGroup Label="Globals"> |
14 | 18 | <ProjectGuid>{A75388F4-E60D-4B95-B04C-A576A78272CF}</ProjectGuid> |
@@ -21,6 +25,11 @@ | ||
21 | 25 | <UseDebugLibraries>true</UseDebugLibraries> |
22 | 26 | <CharacterSet>Unicode</CharacterSet> |
23 | 27 | </PropertyGroup> |
28 | + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='UnitTest|Win32'" Label="Configuration"> | |
29 | + <ConfigurationType>Application</ConfigurationType> | |
30 | + <UseDebugLibraries>true</UseDebugLibraries> | |
31 | + <CharacterSet>Unicode</CharacterSet> | |
32 | + </PropertyGroup> | |
24 | 33 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> |
25 | 34 | <ConfigurationType>Application</ConfigurationType> |
26 | 35 | <UseDebugLibraries>false</UseDebugLibraries> |
@@ -33,6 +42,9 @@ | ||
33 | 42 | <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
34 | 43 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
35 | 44 | </ImportGroup> |
45 | + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='UnitTest|Win32'" Label="PropertySheets"> | |
46 | + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | |
47 | + </ImportGroup> | |
36 | 48 | <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
37 | 49 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
38 | 50 | </ImportGroup> |
@@ -41,11 +53,19 @@ | ||
41 | 53 | <LinkIncremental>true</LinkIncremental> |
42 | 54 | <ReferencePath>$(ReferencePath)</ReferencePath> |
43 | 55 | <IncludePath>$(SolutionDir);$(IncludePath)</IncludePath> |
56 | + <LibraryPath>$(SolutionDir)$(Configuration);$(LibraryPath)</LibraryPath> | |
57 | + </PropertyGroup> | |
58 | + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='UnitTest|Win32'"> | |
59 | + <LinkIncremental>true</LinkIncremental> | |
60 | + <ReferencePath>$(ReferencePath)</ReferencePath> | |
61 | + <IncludePath>$(SolutionDir);$(IncludePath)</IncludePath> | |
62 | + <LibraryPath>$(SolutionDir)$(Configuration);$(LibraryPath)</LibraryPath> | |
44 | 63 | </PropertyGroup> |
45 | 64 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
46 | 65 | <LinkIncremental>false</LinkIncremental> |
47 | 66 | <ReferencePath>$(ReferencePath)</ReferencePath> |
48 | 67 | <IncludePath>$(SolutionDir);$(IncludePath)</IncludePath> |
68 | + <LibraryPath>$(SolutionDir)$(Configuration);$(LibraryPath)</LibraryPath> | |
49 | 69 | </PropertyGroup> |
50 | 70 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
51 | 71 | <ClCompile> |
@@ -59,6 +79,18 @@ | ||
59 | 79 | <GenerateDebugInformation>true</GenerateDebugInformation> |
60 | 80 | </Link> |
61 | 81 | </ItemDefinitionGroup> |
82 | + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='UnitTest|Win32'"> | |
83 | + <ClCompile> | |
84 | + <PrecompiledHeader>Use</PrecompiledHeader> | |
85 | + <WarningLevel>Level3</WarningLevel> | |
86 | + <Optimization>Disabled</Optimization> | |
87 | + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> | |
88 | + </ClCompile> | |
89 | + <Link> | |
90 | + <SubSystem>Console</SubSystem> | |
91 | + <GenerateDebugInformation>true</GenerateDebugInformation> | |
92 | + </Link> | |
93 | + </ItemDefinitionGroup> | |
62 | 94 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
63 | 95 | <ClCompile> |
64 | 96 | <WarningLevel>Level3</WarningLevel> |
@@ -76,19 +108,30 @@ | ||
76 | 108 | </Link> |
77 | 109 | </ItemDefinitionGroup> |
78 | 110 | <ItemGroup> |
111 | + <None Include="..\nlite_application\nlite_application.ico" /> | |
112 | + <None Include="..\nlite_application\small.ico" /> | |
79 | 113 | <None Include="ReadMe.txt" /> |
80 | 114 | </ItemGroup> |
81 | 115 | <ItemGroup> |
116 | + <ClInclude Include="commontest.h" /> | |
82 | 117 | <ClInclude Include="stdafx.h" /> |
83 | 118 | <ClInclude Include="targetver.h" /> |
119 | + <ClInclude Include="unit_test.h" /> | |
84 | 120 | </ItemGroup> |
85 | 121 | <ItemGroup> |
86 | 122 | <ClCompile Include="nlite_test.cpp" /> |
87 | 123 | <ClCompile Include="stdafx.cpp"> |
88 | 124 | <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> |
125 | + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='UnitTest|Win32'">Create</PrecompiledHeader> | |
89 | 126 | <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader> |
90 | 127 | </ClCompile> |
91 | 128 | </ItemGroup> |
129 | + <ItemGroup> | |
130 | + <ResourceCompile Include="..\nlite_application\nlite.rc" /> | |
131 | + </ItemGroup> | |
132 | + <ItemGroup> | |
133 | + <Manifest Include="..\nlite_application\nlite.exe.manifest" /> | |
134 | + </ItemGroup> | |
92 | 135 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |
93 | 136 | <ImportGroup Label="ExtensionTargets"> |
94 | 137 | </ImportGroup> |
@@ -16,6 +16,12 @@ | ||
16 | 16 | </ItemGroup> |
17 | 17 | <ItemGroup> |
18 | 18 | <None Include="ReadMe.txt" /> |
19 | + <None Include="..\nlite_application\nlite_application.ico"> | |
20 | + <Filter>リソース ファイル</Filter> | |
21 | + </None> | |
22 | + <None Include="..\nlite_application\small.ico"> | |
23 | + <Filter>リソース ファイル</Filter> | |
24 | + </None> | |
19 | 25 | </ItemGroup> |
20 | 26 | <ItemGroup> |
21 | 27 | <ClInclude Include="stdafx.h"> |
@@ -24,6 +30,12 @@ | ||
24 | 30 | <ClInclude Include="targetver.h"> |
25 | 31 | <Filter>ヘッダー ファイル</Filter> |
26 | 32 | </ClInclude> |
33 | + <ClInclude Include="unit_test.h"> | |
34 | + <Filter>ヘッダー ファイル</Filter> | |
35 | + </ClInclude> | |
36 | + <ClInclude Include="commontest.h"> | |
37 | + <Filter>ヘッダー ファイル</Filter> | |
38 | + </ClInclude> | |
27 | 39 | </ItemGroup> |
28 | 40 | <ItemGroup> |
29 | 41 | <ClCompile Include="stdafx.cpp"> |
@@ -33,4 +45,14 @@ | ||
33 | 45 | <Filter>ソース ファイル</Filter> |
34 | 46 | </ClCompile> |
35 | 47 | </ItemGroup> |
48 | + <ItemGroup> | |
49 | + <ResourceCompile Include="..\nlite_application\nlite.rc"> | |
50 | + <Filter>リソース ファイル</Filter> | |
51 | + </ResourceCompile> | |
52 | + </ItemGroup> | |
53 | + <ItemGroup> | |
54 | + <Manifest Include="..\nlite_application\nlite.exe.manifest"> | |
55 | + <Filter>リソース ファイル</Filter> | |
56 | + </Manifest> | |
57 | + </ItemGroup> | |
36 | 58 | </Project> |
\ No newline at end of file |
@@ -7,9 +7,12 @@ | ||
7 | 7 | |
8 | 8 | #include "targetver.h" |
9 | 9 | |
10 | +#include <Windows.h> | |
10 | 11 | #include <stdio.h> |
11 | 12 | #include <tchar.h> |
13 | +#include <malloc.h> | |
12 | 14 | |
13 | - | |
15 | +#include <iostream> | |
14 | 16 | |
15 | 17 | // TODO: プログラムに必要な追加ヘッダーをここで参照してください。 |
18 | + |
@@ -1,8 +1,3 @@ | ||
1 | 1 | #pragma once |
2 | 2 | |
3 | -// SDKDDKVer.h をインクルードすると、利用できる最も上位の Windows プラットフォームが定義されます。 | |
4 | - | |
5 | -// 以前の Windows プラットフォーム用にアプリケーションをビルドする場合は、WinSDKVer.h をインクルードし、 | |
6 | -// SDKDDKVer.h をインクルードする前に、サポート対象とするプラットフォームを示すように _WIN32_WINNT マクロを設定します。 | |
7 | - | |
8 | -#include <SDKDDKVer.h> | |
3 | +#include <nlite_common\targetver.h> |
@@ -0,0 +1,3 @@ | ||
1 | + | |
2 | + | |
3 | +extern Void UnitTest(); | |
\ No newline at end of file |
@@ -9,6 +9,10 @@ | ||
9 | 9 | <Configuration>Release</Configuration> |
10 | 10 | <Platform>Win32</Platform> |
11 | 11 | </ProjectConfiguration> |
12 | + <ProjectConfiguration Include="UnitTest|Win32"> | |
13 | + <Configuration>UnitTest</Configuration> | |
14 | + <Platform>Win32</Platform> | |
15 | + </ProjectConfiguration> | |
12 | 16 | </ItemGroup> |
13 | 17 | <PropertyGroup Label="Globals"> |
14 | 18 | <ProjectGuid>{D8F48EC3-615F-43E2-95D5-D08F9BB6A74F}</ProjectGuid> |
@@ -21,6 +25,11 @@ | ||
21 | 25 | <UseDebugLibraries>true</UseDebugLibraries> |
22 | 26 | <CharacterSet>Unicode</CharacterSet> |
23 | 27 | </PropertyGroup> |
28 | + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='UnitTest|Win32'" Label="Configuration"> | |
29 | + <ConfigurationType>StaticLibrary</ConfigurationType> | |
30 | + <UseDebugLibraries>true</UseDebugLibraries> | |
31 | + <CharacterSet>Unicode</CharacterSet> | |
32 | + </PropertyGroup> | |
24 | 33 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> |
25 | 34 | <ConfigurationType>StaticLibrary</ConfigurationType> |
26 | 35 | <UseDebugLibraries>false</UseDebugLibraries> |
@@ -33,6 +42,9 @@ | ||
33 | 42 | <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
34 | 43 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
35 | 44 | </ImportGroup> |
45 | + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='UnitTest|Win32'" Label="PropertySheets"> | |
46 | + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | |
47 | + </ImportGroup> | |
36 | 48 | <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
37 | 49 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
38 | 50 | </ImportGroup> |
@@ -40,6 +52,9 @@ | ||
40 | 52 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
41 | 53 | <IncludePath>$(SolutionDir);$(IncludePath)</IncludePath> |
42 | 54 | </PropertyGroup> |
55 | + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='UnitTest|Win32'"> | |
56 | + <IncludePath>$(SolutionDir);$(IncludePath)</IncludePath> | |
57 | + </PropertyGroup> | |
43 | 58 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
44 | 59 | <IncludePath>$(SolutionDir);$(IncludePath)</IncludePath> |
45 | 60 | </PropertyGroup> |
@@ -55,6 +70,18 @@ | ||
55 | 70 | <GenerateDebugInformation>true</GenerateDebugInformation> |
56 | 71 | </Link> |
57 | 72 | </ItemDefinitionGroup> |
73 | + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='UnitTest|Win32'"> | |
74 | + <ClCompile> | |
75 | + <PrecompiledHeader>Use</PrecompiledHeader> | |
76 | + <WarningLevel>Level3</WarningLevel> | |
77 | + <Optimization>Disabled</Optimization> | |
78 | + <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> | |
79 | + </ClCompile> | |
80 | + <Link> | |
81 | + <SubSystem>Windows</SubSystem> | |
82 | + <GenerateDebugInformation>true</GenerateDebugInformation> | |
83 | + </Link> | |
84 | + </ItemDefinitionGroup> | |
58 | 85 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
59 | 86 | <ClCompile> |
60 | 87 | <WarningLevel>Level3</WarningLevel> |
@@ -81,6 +108,7 @@ | ||
81 | 108 | <ItemGroup> |
82 | 109 | <ClCompile Include="stdafx.cpp"> |
83 | 110 | <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> |
111 | + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='UnitTest|Win32'">Create</PrecompiledHeader> | |
84 | 112 | <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader> |
85 | 113 | </ClCompile> |
86 | 114 | </ItemGroup> |
@@ -6,3 +6,5 @@ | ||
6 | 6 | // SDKDDKVer.h をインクルードする前に、サポート対象とするプラットフォームを示すように _WIN32_WINNT マクロを設定します。 |
7 | 7 | |
8 | 8 | #include <SDKDDKVer.h> |
9 | + | |
10 | +#include <nlite_common\targetver.h> |
@@ -9,6 +9,10 @@ | ||
9 | 9 | <Configuration>Release</Configuration> |
10 | 10 | <Platform>Win32</Platform> |
11 | 11 | </ProjectConfiguration> |
12 | + <ProjectConfiguration Include="UnitTest|Win32"> | |
13 | + <Configuration>UnitTest</Configuration> | |
14 | + <Platform>Win32</Platform> | |
15 | + </ProjectConfiguration> | |
12 | 16 | </ItemGroup> |
13 | 17 | <PropertyGroup Label="Globals"> |
14 | 18 | <ProjectGuid>{5DE70F9B-1BE2-45FD-8829-3401A7D802EE}</ProjectGuid> |
@@ -21,6 +25,11 @@ | ||
21 | 25 | <UseDebugLibraries>true</UseDebugLibraries> |
22 | 26 | <CharacterSet>Unicode</CharacterSet> |
23 | 27 | </PropertyGroup> |
28 | + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='UnitTest|Win32'" Label="Configuration"> | |
29 | + <ConfigurationType>StaticLibrary</ConfigurationType> | |
30 | + <UseDebugLibraries>true</UseDebugLibraries> | |
31 | + <CharacterSet>Unicode</CharacterSet> | |
32 | + </PropertyGroup> | |
24 | 33 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> |
25 | 34 | <ConfigurationType>StaticLibrary</ConfigurationType> |
26 | 35 | <UseDebugLibraries>false</UseDebugLibraries> |
@@ -33,6 +42,9 @@ | ||
33 | 42 | <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
34 | 43 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
35 | 44 | </ImportGroup> |
45 | + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='UnitTest|Win32'" Label="PropertySheets"> | |
46 | + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | |
47 | + </ImportGroup> | |
36 | 48 | <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
37 | 49 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
38 | 50 | </ImportGroup> |
@@ -51,6 +63,19 @@ | ||
51 | 63 | <GenerateDebugInformation>true</GenerateDebugInformation> |
52 | 64 | </Link> |
53 | 65 | </ItemDefinitionGroup> |
66 | + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='UnitTest|Win32'"> | |
67 | + <ClCompile> | |
68 | + <PrecompiledHeader> | |
69 | + </PrecompiledHeader> | |
70 | + <WarningLevel>Level3</WarningLevel> | |
71 | + <Optimization>Disabled</Optimization> | |
72 | + <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> | |
73 | + </ClCompile> | |
74 | + <Link> | |
75 | + <SubSystem>Windows</SubSystem> | |
76 | + <GenerateDebugInformation>true</GenerateDebugInformation> | |
77 | + </Link> | |
78 | + </ItemDefinitionGroup> | |
54 | 79 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
55 | 80 | <ClCompile> |
56 | 81 | <WarningLevel>Level3</WarningLevel> |