- client (win): bug fixes to yesterday's checkin

svn path=/trunk/boinc/; revision=15178
This commit is contained in:
David Anderson 2008-05-12 20:29:57 +00:00
parent dc8f7b0f3e
commit 4f184cb9ef
4 changed files with 20 additions and 15 deletions

View File

@ -3885,3 +3885,11 @@ Rom May 12 2008
win_build/installerv2/redist/Windows/src/boinccas/ win_build/installerv2/redist/Windows/src/boinccas/
CAMigrateBOINCData.cpp, .h CAMigrateBOINCData.cpp, .h
David May 12 2008
- client (win): bug fixes to yesterday's checkin
client/
app_start.C
lib/
shmem.C,h

View File

@ -113,8 +113,8 @@ int ACTIVE_TASK::get_shmem_seg_name() {
for (i=0; i<1024; i++) { for (i=0; i<1024; i++) {
sprintf(seg_name, "%sboinc_%d", SHM_PREFIX, i); sprintf(seg_name, "%sboinc_%d", SHM_PREFIX, i);
hSharedMemoryHandle = create_shmem( h = create_shmem(
seg_name, sizeof(SHARED_MEM), (void**)&app_client_shm.shm, false seg_name, sizeof(SHARED_MEM), (void**)&app_client_shm.shm
); );
if (h) break; if (h) break;
} }

View File

@ -71,9 +71,7 @@ extern "C" int debug_printf(const char *fmt, ...);
#ifdef _WIN32 #ifdef _WIN32
HANDLE create_shmem( HANDLE create_shmem(LPCTSTR seg_name, int size, void** pp) {
LPCTSTR seg_name, int size, void** pp, bool disable_mapview
) {
HANDLE hMap = NULL; HANDLE hMap = NULL;
DWORD dwError = 0; DWORD dwError = 0;
DWORD dwRes = 0; DWORD dwRes = 0;
@ -120,8 +118,7 @@ HANDLE create_shmem(
// Create a new ACL that contains the new ACEs. // Create a new ACL that contains the new ACEs.
dwRes = SetEntriesInAcl(1, &ea, NULL, &pACL); dwRes = SetEntriesInAcl(1, &ea, NULL, &pACL);
if (ERROR_SUCCESS != dwRes) if (ERROR_SUCCESS != dwRes) {
{
fprintf(stderr, "SetEntriesInAcl Error %u\n", GetLastError()); fprintf(stderr, "SetEntriesInAcl Error %u\n", GetLastError());
goto Cleanup; goto Cleanup;
} }
@ -179,13 +176,13 @@ HANDLE create_shmem(
} }
} }
if (disable_mapview && (NULL != hMap) && (ERROR_ALREADY_EXISTS == dwError)) { if (hMap) {
CloseHandle(hMap); if (GetLastError() == ERROR_ALREADY_EXISTS) {
hMap = NULL; CloseHandle(hMap);
} hMap = NULL;
} else {
if (!disable_mapview && (NULL != hMap) && pp) { *pp = MapViewOfFile( hMap, FILE_MAP_ALL_ACCESS, 0, 0, 0 );
*pp = MapViewOfFile( hMap, FILE_MAP_ALL_ACCESS, 0, 0, 0 ); }
} }
Cleanup: Cleanup:

View File

@ -34,7 +34,7 @@
// The above with _mmap: V6 mmap() shared memory for Unix/Linux/Mac // The above with _mmap: V6 mmap() shared memory for Unix/Linux/Mac
#ifdef _WIN32 #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); HANDLE attach_shmem(LPCTSTR seg_name, void** pp);
int detach_shmem(HANDLE hSharedMem, void* p); int detach_shmem(HANDLE hSharedMem, void* p);
#else #else