Changeset 392 for trunk/Utilities/Miscellaneous/GetModuleFileName01/Launch
- Timestamp:
- Apr 8, 2015, 4:06:48 AM (9 years ago)
- Location:
- trunk/Utilities/Miscellaneous/GetModuleFileName01/Launch
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Utilities/Miscellaneous/GetModuleFileName01/Launch/Launch.cpp
r391 r392 1 1 #include "stdafx.h" 2 #include <shlwapi.h> 2 3 3 4 int _tmain(int argc, _TCHAR* argv[]) 4 5 { 5 static LPCTSTR g_pszPath = _T("\\\\?\\D:\\Projects\\Alax.Info\\Repository-Public\\Utilities\\Miscellaneous\\GetModuleFileName01\\Debug\\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\\GetModuleFileName01.exe"); 6 TCHAR pszPath[1024] = { 0 }; 7 ATLVERIFY(GetModuleFileName(NULL, pszPath + 4, _countof(pszPath) - 4)); 8 ATLVERIFY(PathRemoveFileSpec(pszPath + 4)); 9 pszPath[0] = _T('\\'); 10 pszPath[1] = _T('\\'); 11 pszPath[2] = _T('?'); 12 pszPath[3] = _T('\\'); 13 static const LPCTSTR g_pszSubdirectory = _T("123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"); 14 _tcscat_s(pszPath, _T("\\")); 15 _tcscat_s(pszPath, g_pszSubdirectory); 16 _tcscat_s(pszPath, _T("\\")); 17 _tcscat_s(pszPath, _T("GetModuleFileName01.exe")); 18 _tprintf(_T("Path: (%d) %s\n"), _tcslen(pszPath), pszPath); 6 19 STARTUPINFO StartupInfo; 7 20 ZeroMemory(&StartupInfo, sizeof StartupInfo); 8 21 StartupInfo.cb = sizeof StartupInfo; 9 22 PROCESS_INFORMATION ProcessInformation; 10 BOOL bResult = CreateProcess( g_pszPath, NULL, NULL, NULL, TRUE, 0, NULL, NULL, &StartupInfo, &ProcessInformation);23 BOOL bResult = CreateProcess(pszPath, NULL, NULL, NULL, TRUE, 0, NULL, NULL, &StartupInfo, &ProcessInformation); 11 24 if(!bResult) 12 25 { 13 _tprintf(_T("Error: %d\n"), GetLastError()); // 122 = ERROR_INSUFFICIENT_BUFFER 26 const DWORD nLastError = GetLastError(); 27 _tprintf(_T("Error: %d\n"), nLastError); 28 if(nLastError != ERROR_INSUFFICIENT_BUFFER) 29 return 1; 14 30 TCHAR pszShortPath[MAX_PATH] = { 0 }; 15 ATLVERIFY(GetShortPathName( g_pszPath, pszShortPath, _countof(pszShortPath)));31 ATLVERIFY(GetShortPathName(pszPath, pszShortPath, _countof(pszShortPath))); 16 32 _tprintf(_T("Short Path: (%d) %s\n"), _tcslen(pszShortPath), pszShortPath); 17 33 bResult = CreateProcess(pszShortPath, NULL, NULL, NULL, TRUE, 0, NULL, NULL, &StartupInfo, &ProcessInformation); … … 24 40 25 41 /* 42 43 Win32: 44 45 Path: (279) \\?\D:\Projects\Alax.Info\Repository-Public\Utilities\Miscellaneous\GetModuleFileName01\_Bin\Win32\Debug\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\GetModuleFileName01.exe 26 46 Error: 122 27 Short Path: (90) \\?\D:\Projects\ALAX~1.INF\REPOSI~2\UTILIT~1\MISCEL~1\GETMOD~1\Debug\123456~1\GETMOD~1.EXE 28 (90) \\?\D:\Projects\ALAX~1.INF\REPOSI~2\UTILIT~1\MISCEL~1\GETMOD~1\Debug\123456~1\GETMOD~1.EXE 29 (90) \\?\D:\Projects\ALAX~1.INF\REPOSI~2\UTILIT~1\MISCEL~1\GETMOD~1\Debug\123456~1\GETMOD~1.EXE 47 Short Path: (101) \\?\D:\Projects\ALAX~1.INF\REPOSI~2\UTILIT~1\MISCEL~1\GETMOD~1\_Bin\Win32\Debug\123456~1\GETMOD~1.EXE 48 (101) \\?\D:\Projects\ALAX~1.INF\REPOSI~2\UTILIT~1\MISCEL~1\GETMOD~1\_Bin\Win32\Debug\123456~1\GETMOD~1.EXE 49 (101) \\?\D:\Projects\ALAX~1.INF\REPOSI~2\UTILIT~1\MISCEL~1\GETMOD~1\_Bin\Win32\Debug\123456~1\GETMOD~1.EXE 50 51 x64: 52 53 Path: (277) \\?\D:\Projects\Alax.Info\Repository-Public\Utilities\Miscellaneous\GetModuleFileName01\_Bin\x64\Debug\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\GetModuleFileName01.exe 54 (259) \\?\D:\Projects\Alax.Info\Repository-Public\Utilities\Miscellaneous\GetModuleFileName01\_Bin\x64\Debug\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\GetMo 55 (277) \\?\D:\Projects\Alax.Info\Repository-Public\Utilities\Miscellaneous\GetModuleFileName01\_Bin\x64\Debug\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\GetModuleFileName01.exe 56 30 57 */ -
trunk/Utilities/Miscellaneous/GetModuleFileName01/Launch/Launch.vcxproj
r391 r392 6 6 <Platform>Win32</Platform> 7 7 </ProjectConfiguration> 8 <ProjectConfiguration Include="Debug|x64"> 9 <Configuration>Debug</Configuration> 10 <Platform>x64</Platform> 11 </ProjectConfiguration> 8 12 <ProjectConfiguration Include="Release|Win32"> 9 13 <Configuration>Release</Configuration> 10 14 <Platform>Win32</Platform> 15 </ProjectConfiguration> 16 <ProjectConfiguration Include="Release|x64"> 17 <Configuration>Release</Configuration> 18 <Platform>x64</Platform> 11 19 </ProjectConfiguration> 12 20 </ItemGroup> … … 24 32 <UseOfAtl>Static</UseOfAtl> 25 33 </PropertyGroup> 34 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> 35 <ConfigurationType>Application</ConfigurationType> 36 <UseDebugLibraries>true</UseDebugLibraries> 37 <PlatformToolset>v110</PlatformToolset> 38 <CharacterSet>Unicode</CharacterSet> 39 <UseOfAtl>Static</UseOfAtl> 40 </PropertyGroup> 26 41 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> 42 <ConfigurationType>Application</ConfigurationType> 43 <UseDebugLibraries>false</UseDebugLibraries> 44 <PlatformToolset>v110</PlatformToolset> 45 <WholeProgramOptimization>true</WholeProgramOptimization> 46 <CharacterSet>Unicode</CharacterSet> 47 <UseOfAtl>Static</UseOfAtl> 48 </PropertyGroup> 49 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> 27 50 <ConfigurationType>Application</ConfigurationType> 28 51 <UseDebugLibraries>false</UseDebugLibraries> … … 38 61 <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> 39 62 </ImportGroup> 63 <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> 64 <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> 65 </ImportGroup> 40 66 <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> 67 <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> 68 </ImportGroup> 69 <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> 41 70 <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> 42 71 </ImportGroup> … … 44 73 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> 45 74 <LinkIncremental>true</LinkIncremental> 75 <OutDir>$(SolutionDir)_Bin\$(Platform)\$(Configuration)\</OutDir> 76 <IntDir>$(SolutionDir)_Bin\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> 77 </PropertyGroup> 78 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> 79 <LinkIncremental>true</LinkIncremental> 80 <OutDir>$(SolutionDir)_Bin\$(Platform)\$(Configuration)\</OutDir> 81 <IntDir>$(SolutionDir)_Bin\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> 46 82 </PropertyGroup> 47 83 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> 48 84 <LinkIncremental>false</LinkIncremental> 85 <OutDir>$(SolutionDir)_Bin\$(Platform)\$(Configuration)\</OutDir> 86 <IntDir>$(SolutionDir)_Bin\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> 87 </PropertyGroup> 88 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> 89 <LinkIncremental>false</LinkIncremental> 90 <OutDir>$(SolutionDir)_Bin\$(Platform)\$(Configuration)\</OutDir> 91 <IntDir>$(SolutionDir)_Bin\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir> 49 92 </PropertyGroup> 50 93 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> 94 <ClCompile> 95 <PrecompiledHeader>Use</PrecompiledHeader> 96 <WarningLevel>Level3</WarningLevel> 97 <Optimization>Disabled</Optimization> 98 <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> 99 <SDLCheck>true</SDLCheck> 100 </ClCompile> 101 <Link> 102 <SubSystem>Console</SubSystem> 103 <GenerateDebugInformation>true</GenerateDebugInformation> 104 </Link> 105 </ItemDefinitionGroup> 106 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> 51 107 <ClCompile> 52 108 <PrecompiledHeader>Use</PrecompiledHeader> … … 78 134 </Link> 79 135 </ItemDefinitionGroup> 136 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> 137 <ClCompile> 138 <WarningLevel>Level3</WarningLevel> 139 <PrecompiledHeader>Use</PrecompiledHeader> 140 <Optimization>MaxSpeed</Optimization> 141 <FunctionLevelLinking>true</FunctionLevelLinking> 142 <IntrinsicFunctions>true</IntrinsicFunctions> 143 <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> 144 <SDLCheck>true</SDLCheck> 145 </ClCompile> 146 <Link> 147 <SubSystem>Console</SubSystem> 148 <GenerateDebugInformation>true</GenerateDebugInformation> 149 <EnableCOMDATFolding>true</EnableCOMDATFolding> 150 <OptimizeReferences>true</OptimizeReferences> 151 </Link> 152 </ItemDefinitionGroup> 80 153 <ItemGroup> 81 154 <ClInclude Include="stdafx.h" /> … … 86 159 <ClCompile Include="stdafx.cpp"> 87 160 <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> 161 <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader> 88 162 <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader> 163 <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader> 89 164 </ClCompile> 90 165 </ItemGroup>
Note: See TracChangeset
for help on using the changeset viewer.