diff --git a/checkin_notes b/checkin_notes index 6608dae72f..4f7a00b95c 100644 --- a/checkin_notes +++ b/checkin_notes @@ -3885,3 +3885,11 @@ Rom May 12 2008 win_build/installerv2/redist/Windows/src/boinccas/ CAMigrateBOINCData.cpp, .h + +David May 12 2008 + - client (win): bug fixes to yesterday's checkin + + client/ + app_start.C + lib/ + shmem.C,h diff --git a/client/app_start.C b/client/app_start.C index 8373d0b0e9..8357ef09cf 100644 --- a/client/app_start.C +++ b/client/app_start.C @@ -113,8 +113,8 @@ int ACTIVE_TASK::get_shmem_seg_name() { for (i=0; i<1024; i++) { sprintf(seg_name, "%sboinc_%d", SHM_PREFIX, i); - hSharedMemoryHandle = create_shmem( - seg_name, sizeof(SHARED_MEM), (void**)&app_client_shm.shm, false + h = create_shmem( + seg_name, sizeof(SHARED_MEM), (void**)&app_client_shm.shm ); if (h) break; } diff --git a/lib/shmem.C b/lib/shmem.C index 7ba6c6ddcc..efc2678951 100644 --- a/lib/shmem.C +++ b/lib/shmem.C @@ -71,9 +71,7 @@ extern "C" int debug_printf(const char *fmt, ...); #ifdef _WIN32 -HANDLE create_shmem( - LPCTSTR seg_name, int size, void** pp, bool disable_mapview -) { +HANDLE create_shmem(LPCTSTR seg_name, int size, void** pp) { HANDLE hMap = NULL; DWORD dwError = 0; DWORD dwRes = 0; @@ -120,8 +118,7 @@ HANDLE create_shmem( // Create a new ACL that contains the new ACEs. dwRes = SetEntriesInAcl(1, &ea, NULL, &pACL); - if (ERROR_SUCCESS != dwRes) - { + if (ERROR_SUCCESS != dwRes) { fprintf(stderr, "SetEntriesInAcl Error %u\n", GetLastError()); goto Cleanup; } @@ -179,13 +176,13 @@ HANDLE create_shmem( } } - if (disable_mapview && (NULL != hMap) && (ERROR_ALREADY_EXISTS == dwError)) { - CloseHandle(hMap); - hMap = NULL; - } - - if (!disable_mapview && (NULL != hMap) && pp) { - *pp = MapViewOfFile( hMap, FILE_MAP_ALL_ACCESS, 0, 0, 0 ); + if (hMap) { + if (GetLastError() == ERROR_ALREADY_EXISTS) { + CloseHandle(hMap); + hMap = NULL; + } else { + *pp = MapViewOfFile( hMap, FILE_MAP_ALL_ACCESS, 0, 0, 0 ); + } } Cleanup: diff --git a/lib/shmem.h b/lib/shmem.h index c6398f4d06..82727a14c9 100644 --- a/lib/shmem.h +++ b/lib/shmem.h @@ -34,7 +34,7 @@ // The above with _mmap: V6 mmap() shared memory for Unix/Linux/Mac #ifdef _WIN32 -HANDLE create_shmem(LPCTSTR seg_name, int size, void** pp, bool disable_mapview); +HANDLE create_shmem(LPCTSTR seg_name, int size, void** pp); HANDLE attach_shmem(LPCTSTR seg_name, void** pp); int detach_shmem(HANDLE hSharedMem, void* p); #else