Merge branch 'master' of localhost:boinc-v2

This commit is contained in:
David Anderson 2013-09-20 19:00:20 +00:00
commit b4594cf36c
3 changed files with 39 additions and 26 deletions

View File

@ -26,6 +26,8 @@
#endif
#include "diagnostics.h"
#include "util.h"
#include "filesys.h"
#include "win_util.h"
/**
@ -748,22 +750,23 @@ GetAccountSid(
void chdir_to_data_dir() {
LONG lReturnValue;
HKEY hkSetupHive;
LPTSTR lpszRegistryValue = NULL;
LPSTR lpszRegistryValue = NULL;
char szPath[MAX_PATH];
DWORD dwSize = 0;
// change the current directory to the boinc data directory if it exists
lReturnValue = RegOpenKeyEx(
lReturnValue = RegOpenKeyExA(
HKEY_LOCAL_MACHINE,
_T("SOFTWARE\\Space Sciences Laboratory, U.C. Berkeley\\BOINC Setup"),
"SOFTWARE\\Space Sciences Laboratory, U.C. Berkeley\\BOINC Setup",
0,
KEY_READ,
&hkSetupHive
);
if (lReturnValue == ERROR_SUCCESS) {
// How large does our buffer need to be?
lReturnValue = RegQueryValueEx(
lReturnValue = RegQueryValueExA(
hkSetupHive,
_T("DATADIR"),
"DATADIR",
NULL,
NULL,
NULL,
@ -771,20 +774,27 @@ void chdir_to_data_dir() {
);
if (lReturnValue != ERROR_FILE_NOT_FOUND) {
// Allocate the buffer space.
lpszRegistryValue = (LPTSTR) malloc(dwSize);
lpszRegistryValue = (LPSTR) malloc(dwSize);
(*lpszRegistryValue) = NULL;
// Now get the data
lReturnValue = RegQueryValueEx(
lReturnValue = RegQueryValueExA(
hkSetupHive,
_T("DATADIR"),
"DATADIR",
NULL,
NULL,
(LPBYTE)lpszRegistryValue,
&dwSize
);
SetCurrentDirectory(lpszRegistryValue);
SetCurrentDirectoryA(lpszRegistryValue);
}
} else {
if (SUCCEEDED(SHGetFolderPathA(NULL, CSIDL_COMMON_APPDATA|CSIDL_FLAG_CREATE, NULL, SHGFP_TYPE_CURRENT, szPath))) {
strncat(szPath, "\\boinc", (sizeof(szPath) - strlen(szPath)));
if (boinc_file_exists(szPath)) {
SetCurrentDirectoryA(szPath);
}
}
}

View File

@ -64,6 +64,7 @@
#include "boinc_api.h"
#include "diagnostics.h"
#include "filesys.h"
#include "md5_file.h"
#include "parse.h"
#include "str_util.h"
#include "str_replace.h"
@ -399,12 +400,26 @@ int main(int argc, char** argv) {
}
}
memset(&boinc_options, 0, sizeof(boinc_options));
boinc_options.main_program = true;
boinc_options.check_heartbeat = true;
boinc_options.handle_process_control = true;
boinc_init_options(&boinc_options);
// Prepare environment for detecting system conditions
//
boinc_get_init_data_p(&aid);
// Log banner
//
fprintf(
stderr,
"%s vboxwrapper: starting\n",
vboxwrapper_msg_prefix(buf, sizeof(buf))
);
// Log important information
//
#if defined(_WIN32) && defined(USE_WINSOCK)
WSADATA wsdata;
retval = WSAStartup( MAKEWORD( 1, 1 ), &wsdata);
@ -419,11 +434,6 @@ int main(int argc, char** argv) {
}
#endif
memset(&boinc_options, 0, sizeof(boinc_options));
boinc_options.main_program = true;
boinc_options.check_heartbeat = true;
boinc_options.handle_process_control = true;
if (trickle_period > 0.0) {
fprintf(
stderr,
@ -433,12 +443,6 @@ int main(int argc, char** argv) {
boinc_options.handle_trickle_ups = true;
}
boinc_init_options(&boinc_options);
// Prepare environment for detecting system conditions
//
boinc_get_init_data_p(&aid);
// Check for architecture incompatibilities
//
#if defined(_WIN32) && defined(_M_IX86)
@ -582,8 +586,7 @@ int main(int argc, char** argv) {
vm.floppy_image_filename = buf;
}
} else {
sprintf(buf, "_slot_%d", aid.slot);
vm.vm_master_name += buf;
vm.vm_master_name += md5_string(std::string(aid.result_name)).substr(0, 16);
vm.vm_master_description = aid.result_name;
if (vm.enable_floppyio) {
sprintf(buf, "%s_%d.%s", FLOPPY_IMAGE_FILENAME, aid.slot, FLOPPY_IMAGE_FILENAME_EXTENSION);

View File

@ -82,13 +82,13 @@
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libcmt.lib libcpmt.lib kernel32.lib user32.lib gdi32.lib ole32.lib wsock32.lib psapi.lib"
OutputFile=".\Build\$(PlatformName)\$(ConfigurationName)\vboxwrapper_26026_windows_intelx86.exe"
OutputFile=".\Build\$(PlatformName)\$(ConfigurationName)\vboxwrapper_26027_windows_intelx86.exe"
LinkIncremental="0"
SuppressStartupBanner="true"
IgnoreAllDefaultLibraries="true"
DelayLoadDLLs=""
GenerateDebugInformation="true"
ProgramDatabaseFile=".\Build\$(PlatformName)\$(ConfigurationName)\vboxwrapper_26026_windows_intelx86.pdb"
ProgramDatabaseFile=".\Build\$(PlatformName)\$(ConfigurationName)\vboxwrapper_26027_windows_intelx86.pdb"
SubSystem="2"
TargetMachine="1"
/>
@ -183,13 +183,13 @@
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libcmt.lib libcpmt.lib kernel32.lib user32.lib gdi32.lib ole32.lib wsock32.lib psapi.lib"
OutputFile=".\Build\$(PlatformName)\$(ConfigurationName)\vboxwrapper_26026_windows_x86_64.exe"
OutputFile=".\Build\$(PlatformName)\$(ConfigurationName)\vboxwrapper_26027_windows_x86_64.exe"
LinkIncremental="0"
SuppressStartupBanner="true"
IgnoreAllDefaultLibraries="true"
DelayLoadDLLs=""
GenerateDebugInformation="true"
ProgramDatabaseFile=".\Build\$(PlatformName)\$(ConfigurationName)\vboxwrapper_26026_windows_x86_64.pdb"
ProgramDatabaseFile=".\Build\$(PlatformName)\$(ConfigurationName)\vboxwrapper_26027_windows_x86_64.pdb"
SubSystem="2"
TargetMachine="17"
/>