windows fixes

svn path=/trunk/boinc/; revision=1038
This commit is contained in:
Eric Heien 2003-03-10 19:05:25 +00:00
parent 7e9887340f
commit b9f7ffa424
5 changed files with 14 additions and 11 deletions

View File

@ -23,6 +23,7 @@
#include <winsock.h>
#include "client_types.h"
#include "hostinfo.h"
#include "util.h"
typedef BOOL (CALLBACK* FreeFn)(LPCTSTR, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER);
@ -133,7 +134,7 @@ int get_host_info(HOST_INFO& host) {
Version, "%lu.%lu", OSVersionInfo.dwMajorVersion,
OSVersionInfo.dwMinorVersion
);
strcpy( host.os_version, Version );
safe_strncpy( host.os_version, Version, sizeof(host.os_version) );
SYSTEM_INFO SystemInfo;
memset( &SystemInfo, NULL, sizeof( SystemInfo ) );
@ -186,8 +187,8 @@ int get_host_info(HOST_INFO& host) {
WSAStartup(wVersionRequested, &wsdata);
// Get host name/ip info
get_local_domain_name(host.domain_name, 256);
get_local_ip_addr_str(host.ip_addr);
get_local_domain_name(host.domain_name, sizeof(host.domain_name));
get_local_ip_addr_str(host.ip_addr, sizeof(host.ip_addr));
// Close the WinSock dll
WSACleanup();
@ -211,7 +212,7 @@ int get_host_info(HOST_INFO& host) {
nameSize = sizeof(vendorName);
retval = RegQueryValueEx(hKey, "VendorIdentifier", NULL, NULL, (LPBYTE)vendorName, &nameSize);
if(retval == ERROR_SUCCESS) {
strcpy(host.p_vendor, vendorName);
safe_strncpy(host.p_vendor, vendorName, sizeof(host.p_vendor));
}
}
RegCloseKey(hKey);

View File

@ -1,5 +1,6 @@
#include <windows.h>
#include "win_util.h"
#include "util.h"
#define OS_UNKNOWN 0
#define OS_WIN95 1
@ -75,7 +76,7 @@ int UtilGetRegKey(char *name, DWORD &keyval)
DWORD value;
HKEY boinc_key;
strcpy( str, "SOFTWARE\\BOINC\\" );
safe_strncpy( str, "SOFTWARE\\BOINC\\", sizeof(str) );
strcat( str, name );
if ( OSVersion == OS_WIN95 ) {

View File

@ -27,12 +27,12 @@ void show_message(PROJECT* p, char* message, int priority) {
if (p) {
if (strcmp(p->project_name, "")) {
strcpy( proj_name, p->project_name );
safe_strncpy( proj_name, p->project_name, sizeof(proj_name) );
} else {
strcpy( proj_name, p->master_url );
safe_strncpy( proj_name, p->master_url, sizeof(proj_name) );
}
} else {
strcpy( proj_name, "BOINC" );
safe_strncpy( proj_name, "BOINC", sizeof(proj_name) );
}
if(g_myWnd) {

View File

@ -462,7 +462,8 @@ void CProxyDialog::OnOK()
}
}
GetDlgItemText(IDC_EDIT_HTTP_ADDR, strbuf);
strcpy(gstate.proxy_server_name, strbuf.GetBuffer(0));
safe_strncpy(gstate.proxy_server_name, strbuf.GetBuffer(0),
sizeof(gstate.proxy_server_name));
GetDlgItemText(IDC_EDIT_HTTP_PORT, strbuf);
gstate.proxy_server_port = atoi(strbuf.GetBuffer(0));
CDialog::OnOK();

View File

@ -515,11 +515,11 @@ void CMainWindow::SetStatusIcon(DWORD dwMessage)
// if icon is in that state already, there is nothing to do
if(dwMessage == m_nIconState) return;
NOTIFYICONDATA icon_data;
icon_data.cbSize = sizeof(icon_data);
icon_data.cbSize = sizeof(NOTIFYICONDATA);
icon_data.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
icon_data.hWnd = GetSafeHwnd();
icon_data.uID = STATUS_ICON_ID;
strcpy(icon_data.szTip, WND_TITLE);
safe_strncpy(icon_data.szTip, WND_TITLE, sizeof(icon_data.szTip));
icon_data.uCallbackMessage = STATUS_ICON_ID;
if(dwMessage == ICON_OFF) {
icon_data.hIcon = NULL;