11 #pragma warning( disable : 4996 ) 26 char *next, *tmp1, *tmp2;
27 for ( LPTSTR cmd = ::GetCommandLine(); *cmd; cmd = next ) {
28 ::memset( exe, 0,
sizeof( exe ) );
29 while ( *cmd ==
' ' ) cmd++;
30 next = ::strchr( cmd,
' ' );
31 if ( !next ) next = cmd + ::strlen( cmd );
32 if ( ( tmp1 = ::strchr( cmd,
'\"' ) ) > 0 && tmp1 < next ) {
33 tmp2 = ::strchr( ++tmp1,
'\"' );
36 if ( cmd < tmp1 ) ::strncpy( exe, cmd, tmp1 - cmd - 1 );
37 ::strncpy( &exe[strlen( exe )], tmp1, tmp2 - tmp1 - 1 );
43 ::strncpy( exe, cmd, next - cmd );
57 if ( ::strncmp( class_name,
"class ", 6 ) == 0 ) {
61 if ( ::strncmp( class_name,
"struct ", 7 ) == 0 ) {
68 while ( ( loc = tmp.
find(
"class " ) ) > 0 ) { tmp.
erase( loc, 6 ); }
70 while ( ( loc = tmp.
find(
"struct " ) ) > 0 ) { tmp.
erase( loc, 7 ); }
76 while ( ( off = result.
find(
" *" ) ) != std::string::npos ) { result.
replace( off, 2,
"*" ); }
78 while ( ( off = result.
find(
" &" ) ) != std::string::npos ) { result.
replace( off, 2,
"&" ); }
85 static const size_t STRING_SIZE = 512;
86 char hname[STRING_SIZE];
87 size_t strlen = STRING_SIZE;
88 if ( !::GetComputerName( hname, &strlen ) ) {
return "UNKNOWN"; }
97 ut.dwOSVersionInfoSize =
sizeof( OSVERSIONINFO );
98 if ( !::GetVersionEx( &ut ) ) {
return "UNKNOWN"; }
100 ver << ut.dwMajorVersion <<
'.' << ut.dwMinorVersion;
107 ::GetSystemInfo( &ut );
109 arch << ut.wProcessorArchitecture;
115 static const size_t STRING_SIZE = 512;
116 char uname[STRING_SIZE];
117 size_t strlen = STRING_SIZE;
118 if ( !::GetUserName( uname, &strlen ) ) {
return "UNKNOWN"; }
std::string hostName()
Get the system's host name.
Note: OS specific details for environment resolution.
std::string typeinfoName(const char *class_name)
Get the human readable type name from a typeinfo name.
std::string machineType()
Get the runner machine's type.
std::string osName()
Get the operating system's name.
std::string accountName()
Get the account name of the current user.
std::string osVersion()
Get the operating system's version.
std::vector< std::string > cmdLineArgs()
Get the command line arguments of the process.