21 #pragma warning( disable : 4996 )
36 char *next, *tmp1, *tmp2;
37 for ( LPTSTR cmd = ::GetCommandLine(); *cmd; cmd = next ) {
38 ::memset( exe, 0,
sizeof( exe ) );
39 while ( *cmd ==
' ' ) cmd++;
40 next = ::strchr( cmd,
' ' );
41 if ( !next ) next = cmd + ::strlen( cmd );
42 if ( ( tmp1 = ::strchr( cmd,
'\"' ) ) > 0 && tmp1 < next ) {
43 tmp2 = ::strchr( ++tmp1,
'\"' );
46 if ( cmd < tmp1 ) ::strncpy( exe, cmd, tmp1 - cmd - 1 );
47 ::strncpy( &exe[strlen( exe )], tmp1, tmp2 - tmp1 - 1 );
53 ::strncpy( exe, cmd, next - cmd );
67 if ( ::strncmp( class_name,
"class ", 6 ) == 0 ) {
71 if ( ::strncmp( class_name,
"struct ", 7 ) == 0 ) {
78 while ( ( loc = tmp.
find(
"class " ) ) > 0 ) { tmp.
erase( loc, 6 ); }
80 while ( ( loc = tmp.
find(
"struct " ) ) > 0 ) { tmp.
erase( loc, 7 ); }
86 while ( ( off = result.
find(
" *" ) ) != std::string::npos ) { result.
replace( off, 2,
"*" ); }
88 while ( ( off = result.
find(
" &" ) ) != std::string::npos ) { result.
replace( off, 2,
"&" ); }
95 static const size_t STRING_SIZE = 512;
96 char hname[STRING_SIZE];
97 size_t strlen = STRING_SIZE;
98 if ( !::GetComputerName( hname, &strlen ) ) {
return "UNKNOWN"; }
107 ut.dwOSVersionInfoSize =
sizeof( OSVERSIONINFO );
108 if ( !::GetVersionEx( &ut ) ) {
return "UNKNOWN"; }
110 ver << ut.dwMajorVersion <<
'.' << ut.dwMinorVersion;
117 ::GetSystemInfo( &ut );
119 arch << ut.wProcessorArchitecture;
125 static const size_t STRING_SIZE = 512;
126 char uname[STRING_SIZE];
127 size_t strlen = STRING_SIZE;
128 if ( !::GetUserName( uname, &strlen ) ) {
return "UNKNOWN"; }