mirror of https://github.com/BOINC/boinc.git
parent
e64014bdc0
commit
2f2e02985c
793
client/app.C
793
client/app.C
File diff suppressed because it is too large
Load Diff
|
@ -1,298 +1,150 @@
|
||||||
// The contents of this file are subject to the Mozilla Public License
|
// The contents of this file are subject to the Mozilla Public License
|
||||||
|
|
||||||
// Version 1.0 (the "License"); you may not use this file except in
|
// Version 1.0 (the "License"); you may not use this file except in
|
||||||
|
|
||||||
// compliance with the License. You may obtain a copy of the License at
|
// compliance with the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
// http://www.mozilla.org/MPL/
|
// http://www.mozilla.org/MPL/
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
// Software distributed under the License is distributed on an "AS IS"
|
// Software distributed under the License is distributed on an "AS IS"
|
||||||
|
|
||||||
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||||
|
|
||||||
// License for the specific language governing rights and limitations
|
// License for the specific language governing rights and limitations
|
||||||
|
|
||||||
// under the License.
|
// under the License.
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
// The Initial Developer of the Original Code is the SETI@home project.
|
// The Initial Developer of the Original Code is the SETI@home project.
|
||||||
|
|
||||||
// Portions created by the SETI@home project are Copyright (C) 2002
|
// Portions created by the SETI@home project are Copyright (C) 2002
|
||||||
|
|
||||||
// University of California at Berkeley. All Rights Reserved.
|
// University of California at Berkeley. All Rights Reserved.
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
// Contributor(s):
|
// Contributor(s):
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <afxwin.h>
|
#include <afxwin.h>
|
||||||
|
|
||||||
#include "client_types.h"
|
#include "client_types.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
extern int get_local_domain_name(char* p);
|
extern int get_local_domain_name(char* p);
|
||||||
|
|
||||||
extern int get_local_ip_addr_str(char* p);
|
extern int get_local_ip_addr_str(char* p);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Gets windows specific host information (not complete)
|
// Gets windows specific host information (not complete)
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
int get_host_info2(HOST_INFO& host) {
|
int get_host_info2(HOST_INFO& host) {
|
||||||
|
|
||||||
OSVERSIONINFO OSVersionInfo;
|
OSVERSIONINFO OSVersionInfo;
|
||||||
|
|
||||||
memset( &OSVersionInfo, NULL, sizeof( OSVersionInfo ) );
|
memset( &OSVersionInfo, NULL, sizeof( OSVersionInfo ) );
|
||||||
|
|
||||||
OSVersionInfo.dwOSVersionInfoSize = sizeof( OSVersionInfo );
|
OSVersionInfo.dwOSVersionInfoSize = sizeof( OSVersionInfo );
|
||||||
|
|
||||||
::GetVersionEx( &OSVersionInfo );
|
::GetVersionEx( &OSVersionInfo );
|
||||||
|
|
||||||
switch ( OSVersionInfo.dwPlatformId ) {
|
switch ( OSVersionInfo.dwPlatformId ) {
|
||||||
|
|
||||||
case VER_PLATFORM_WIN32s:
|
case VER_PLATFORM_WIN32s:
|
||||||
|
|
||||||
strcpy( host.os_name, "Windows 3.1/Win32s" ); // does ANYBODY use this anymore?
|
strcpy( host.os_name, "Windows 3.1/Win32s" ); // does ANYBODY use this anymore?
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VER_PLATFORM_WIN32_WINDOWS:
|
case VER_PLATFORM_WIN32_WINDOWS:
|
||||||
|
|
||||||
if ( OSVersionInfo.dwMajorVersion > 4
|
if ( OSVersionInfo.dwMajorVersion > 4
|
||||||
|
|
||||||
|| ( OSVersionInfo.dwMajorVersion == 4
|
|| ( OSVersionInfo.dwMajorVersion == 4
|
||||||
|
|
||||||
&& OSVersionInfo.dwMinorVersion >= 90 ) )
|
&& OSVersionInfo.dwMinorVersion >= 90 ) )
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
strcpy( host.os_name, "Windows Me" );
|
strcpy( host.os_name, "Windows Me" );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ( OSVersionInfo.dwMajorVersion == 4
|
else if ( OSVersionInfo.dwMajorVersion == 4
|
||||||
|
|
||||||
&& OSVersionInfo.dwMinorVersion >= 10 )
|
&& OSVersionInfo.dwMinorVersion >= 10 )
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
strcpy( host.os_name, "Windows 98" );
|
strcpy( host.os_name, "Windows 98" );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
strcpy( host.os_name, "Windows 95" );
|
strcpy( host.os_name, "Windows 95" );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
case VER_PLATFORM_WIN32_NT:
|
case VER_PLATFORM_WIN32_NT:
|
||||||
|
|
||||||
if ( OSVersionInfo.dwMajorVersion > 5
|
if ( OSVersionInfo.dwMajorVersion > 5
|
||||||
|
|
||||||
|| (OSVersionInfo.dwMajorVersion == 5
|
|| (OSVersionInfo.dwMajorVersion == 5
|
||||||
|
|
||||||
&& OSVersionInfo.dwMinorVersion >= 2) )
|
&& OSVersionInfo.dwMinorVersion >= 2) )
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
strcpy( host.os_name, "Windows .NET Server" );
|
strcpy( host.os_name, "Windows .NET Server" );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (OSVersionInfo.dwMajorVersion == 5
|
else if (OSVersionInfo.dwMajorVersion == 5
|
||||||
|
|
||||||
&& OSVersionInfo.dwMinorVersion == 1)
|
&& OSVersionInfo.dwMinorVersion == 1)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
strcpy( host.os_name, "Windows XP" );
|
strcpy( host.os_name, "Windows XP" );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (OSVersionInfo.dwMajorVersion == 5
|
else if (OSVersionInfo.dwMajorVersion == 5
|
||||||
|
|
||||||
&& OSVersionInfo.dwMinorVersion == 0)
|
&& OSVersionInfo.dwMinorVersion == 0)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
strcpy( host.os_name, "Windows 2000" );
|
strcpy( host.os_name, "Windows 2000" );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (OSVersionInfo.dwMajorVersion == 4
|
else if (OSVersionInfo.dwMajorVersion == 4
|
||||||
|
|
||||||
&& OSVersionInfo.dwMinorVersion == 0)
|
&& OSVersionInfo.dwMinorVersion == 0)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
strcpy( host.os_name, "Windows NT 4.0" );
|
strcpy( host.os_name, "Windows NT 4.0" );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (OSVersionInfo.dwMajorVersion == 3
|
else if (OSVersionInfo.dwMajorVersion == 3
|
||||||
|
|
||||||
&& OSVersionInfo.dwMinorVersion == 51)
|
&& OSVersionInfo.dwMinorVersion == 51)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
strcpy( host.os_name, "Windows NT 3.51" );
|
strcpy( host.os_name, "Windows NT 3.51" );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
strcpy( host.os_name, "Windows NT" );
|
strcpy( host.os_name, "Windows NT" );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
sprintf( host.os_name, "Unknown Win32 (%ld)", OSVersionInfo.dwPlatformId );
|
sprintf( host.os_name, "Unknown Win32 (%ld)", OSVersionInfo.dwPlatformId );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
char Version[ 25 ];
|
char Version[ 25 ];
|
||||||
|
|
||||||
Version[ 0 ] = NULL;
|
Version[ 0 ] = NULL;
|
||||||
|
|
||||||
sprintf(
|
sprintf(
|
||||||
|
|
||||||
Version, ": %lu.%lu", OSVersionInfo.dwMajorVersion,
|
Version, ": %lu.%lu", OSVersionInfo.dwMajorVersion,
|
||||||
|
|
||||||
OSVersionInfo.dwMinorVersion
|
OSVersionInfo.dwMinorVersion
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
strcat( host.os_name, Version );
|
strcat( host.os_name, Version );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SYSTEM_INFO SystemInfo;
|
SYSTEM_INFO SystemInfo;
|
||||||
|
|
||||||
memset( &SystemInfo, NULL, sizeof( SystemInfo ) );
|
memset( &SystemInfo, NULL, sizeof( SystemInfo ) );
|
||||||
|
|
||||||
::GetSystemInfo( &SystemInfo );
|
::GetSystemInfo( &SystemInfo );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
host.p_ncpus = SystemInfo.dwNumberOfProcessors;
|
host.p_ncpus = SystemInfo.dwNumberOfProcessors;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
switch ( SystemInfo.wProcessorArchitecture ) {
|
switch ( SystemInfo.wProcessorArchitecture ) {
|
||||||
|
|
||||||
case PROCESSOR_ARCHITECTURE_INTEL:
|
case PROCESSOR_ARCHITECTURE_INTEL:
|
||||||
|
|
||||||
switch ( SystemInfo.dwProcessorType ) {
|
switch ( SystemInfo.dwProcessorType ) {
|
||||||
|
|
||||||
case PROCESSOR_INTEL_386:
|
case PROCESSOR_INTEL_386:
|
||||||
|
|
||||||
strcpy( host.p_model, "Intel 80386" );
|
strcpy( host.p_model, "Intel 80386" );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROCESSOR_INTEL_486:
|
case PROCESSOR_INTEL_486:
|
||||||
|
|
||||||
strcpy( host.p_model, "Intel 80486" );
|
strcpy( host.p_model, "Intel 80486" );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROCESSOR_INTEL_PENTIUM:
|
case PROCESSOR_INTEL_PENTIUM:
|
||||||
|
|
||||||
strcpy( host.p_model, "Intel Pentium" );
|
strcpy( host.p_model, "Intel Pentium" );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
strcpy( host.p_model, "Intel x86" );
|
strcpy( host.p_model, "Intel x86" );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
case PROCESSOR_ARCHITECTURE_MIPS:
|
case PROCESSOR_ARCHITECTURE_MIPS:
|
||||||
|
|
||||||
strcpy( host.p_model, "MIPS" );
|
strcpy( host.p_model, "MIPS" );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
case PROCESSOR_ARCHITECTURE_ALPHA:
|
case PROCESSOR_ARCHITECTURE_ALPHA:
|
||||||
|
|
||||||
strcpy( host.p_model, "Alpha" );
|
strcpy( host.p_model, "Alpha" );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
case PROCESSOR_ARCHITECTURE_PPC:
|
case PROCESSOR_ARCHITECTURE_PPC:
|
||||||
|
|
||||||
strcpy( host.p_model, "Power PC" );
|
strcpy( host.p_model, "Power PC" );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
case PROCESSOR_ARCHITECTURE_UNKNOWN:
|
case PROCESSOR_ARCHITECTURE_UNKNOWN:
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
strcpy( host.p_model, "Unknown" );
|
strcpy( host.p_model, "Unknown" );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
memset(&host, 0, sizeof(host));
|
memset(&host, 0, sizeof(host));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
get_local_domain_name(host.domain_name);
|
get_local_domain_name(host.domain_name);
|
||||||
|
|
||||||
get_local_ip_addr_str(host.ip_addr);
|
get_local_ip_addr_str(host.ip_addr);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,93 +1,47 @@
|
||||||
// The contents of this file are subject to the Mozilla Public License
|
// The contents of this file are subject to the Mozilla Public License
|
||||||
|
|
||||||
// Version 1.0 (the "License"); you may not use this file except in
|
// Version 1.0 (the "License"); you may not use this file except in
|
||||||
|
|
||||||
// compliance with the License. You may obtain a copy of the License at
|
// compliance with the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
// http://www.mozilla.org/MPL/
|
// http://www.mozilla.org/MPL/
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
// Software distributed under the License is distributed on an "AS IS"
|
// Software distributed under the License is distributed on an "AS IS"
|
||||||
|
|
||||||
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||||
|
|
||||||
// License for the specific language governing rights and limitations
|
// License for the specific language governing rights and limitations
|
||||||
|
|
||||||
// under the License.
|
// under the License.
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
// The Initial Developer of the Original Code is the SETI@home project.
|
// The Initial Developer of the Original Code is the SETI@home project.
|
||||||
|
|
||||||
// Portions created by the SETI@home project are Copyright (C) 2002
|
// Portions created by the SETI@home project are Copyright (C) 2002
|
||||||
|
|
||||||
// University of California at Berkeley. All Rights Reserved.
|
// University of California at Berkeley. All Rights Reserved.
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
// Contributor(s):
|
// Contributor(s):
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <afxwin.h>
|
#include <afxwin.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "win_net.h"
|
#include "win_net.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef WIN_CLI
|
#ifdef WIN_CLI
|
||||||
|
|
||||||
extern int main(int argc, char** argv);
|
extern int main(int argc, char** argv);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int WINAPI WinMain( HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR Args, int WinMode )
|
int WINAPI WinMain( HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR Args, int WinMode )
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
LPWSTR command_line;
|
LPWSTR command_line;
|
||||||
|
|
||||||
LPWSTR *args;
|
LPWSTR *args;
|
||||||
|
|
||||||
char* argv[100];
|
char* argv[100];
|
||||||
|
|
||||||
int i, argc;
|
int i, argc;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
NetOpen();
|
NetOpen();
|
||||||
|
|
||||||
command_line = GetCommandLineW();
|
command_line = GetCommandLineW();
|
||||||
|
|
||||||
args = CommandLineToArgvW(command_line, &argc);
|
args = CommandLineToArgvW(command_line, &argc);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// uh, why did MS have to "improve" on char*?
|
// uh, why did MS have to "improve" on char*?
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for (i=0; i<argc; i++) {
|
for (i=0; i<argc; i++) {
|
||||||
|
|
||||||
argv[i] = (char*)args[i];
|
argv[i] = (char*)args[i];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
main(argc, argv);
|
main(argc, argv);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif
|
|
||||||
|
|
Loading…
Reference in New Issue