diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2013-04-05 11:04:19 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2013-04-05 11:04:19 +0200 |
commit | 907edc1575e063946de33bf454efa41acff38182 (patch) | |
tree | 6413dcfb81e9247e97b181ebd67d7bfe1f3239a0 | |
parent | 7b5bfc4fbba37237e5a02add4b37e10e290edec5 (diff) |
Correct SHM access flags
-rw-r--r-- | compat/compat.cpp | 2 | ||||
-rw-r--r-- | freetrackclient/freetrackclient.cpp | 8 | ||||
-rw-r--r-- | ftnoir_tracker_sm/ftnoir_tracker_faceapi.cpp | 6 | ||||
-rw-r--r-- | ftnoir_tracker_sm/ftnoir_tracker_faceapi_dialog.cpp | 4 |
4 files changed, 9 insertions, 11 deletions
diff --git a/compat/compat.cpp b/compat/compat.cpp index 2263ea11..8eedc845 100644 --- a/compat/compat.cpp +++ b/compat/compat.cpp @@ -20,7 +20,7 @@ PortableLockedShm::PortableLockedShm(const char* shmName, const char* mutexName, mapSize, shmName); mem = MapViewOfFile(hMapFile, - FILE_MAP_READ | FILE_MAP_WRITE, + FILE_MAP_WRITE, 0, 0, mapSize); diff --git a/freetrackclient/freetrackclient.cpp b/freetrackclient/freetrackclient.cpp index 1a591de9..98544e2d 100644 --- a/freetrackclient/freetrackclient.cpp +++ b/freetrackclient/freetrackclient.cpp @@ -140,8 +140,7 @@ FT_EXPORT(bool) FTGetData(PFreetrackData data) // Send the ID to FaceTrackNoIR, so it can display the game-name. // This could be a FreeTrack-specific ID // - sprintf_s(pMemData->GameID, 19, "%d", gameid ); - + pMemData->GameID = gameid; } ReleaseMutex(hFTMutex); } @@ -194,7 +193,6 @@ extern "C" __declspec( dllexport ) char* FTProvider(void) bool FTCreateMapping() { bool bMappingExists = false; - PDWORD_PTR MsgResult = 0; // // Memory-mapping already exists! @@ -227,10 +225,10 @@ bool FTCreateMapping() // // Create a new FileMapping, Read/Write access // - hFTMemMap = OpenFileMappingA( FILE_MAP_ALL_ACCESS , false , (LPCSTR) FT_MM_DATA ); + hFTMemMap = OpenFileMappingA( FILE_MAP_WRITE , false , (LPCSTR) FT_MM_DATA ); if ( ( hFTMemMap != 0 ) ) { dbg_report("FTCreateMapping: Mapping opened.\n"); - pMemData = (FTMemMap *) MapViewOfFile(hFTMemMap, FILE_MAP_ALL_ACCESS, 0, 0, sizeof( FTMemMap ) ); + pMemData = (FTMemMap *) MapViewOfFile(hFTMemMap, FILE_MAP_WRITE, 0, 0, sizeof( FTMemMap ) ); hFTMutex = CreateMutexA(NULL, false, FREETRACK_MUTEX); } else { diff --git a/ftnoir_tracker_sm/ftnoir_tracker_faceapi.cpp b/ftnoir_tracker_sm/ftnoir_tracker_faceapi.cpp index 35d3a3db..6bdce889 100644 --- a/ftnoir_tracker_sm/ftnoir_tracker_faceapi.cpp +++ b/ftnoir_tracker_sm/ftnoir_tracker_faceapi.cpp @@ -191,7 +191,7 @@ bool FTNoIR_Tracker::SMCreateMapping() // Try to create a FileMapping to the Shared Memory.
// If one already exists: close it.
//
- hSMMemMap = CreateFileMappingA( INVALID_HANDLE_VALUE , 00 , PAGE_READWRITE , 0 ,
+ hSMMemMap = CreateFileMappingA( INVALID_HANDLE_VALUE , 00 , PAGE_READWRITE , 0 ,
sizeof( TFaceData ) + sizeof( HANDLE ) + 100,
(LPCSTR) SM_MM_DATA );
@@ -207,10 +207,10 @@ bool FTNoIR_Tracker::SMCreateMapping() //
// Create a new FileMapping, Read/Write access
//
- hSMMemMap = OpenFileMappingA( FILE_MAP_ALL_ACCESS , false , (LPCSTR) SM_MM_DATA );
+ hSMMemMap = OpenFileMappingA( PAGE_READWRITE , false , (LPCSTR) SM_MM_DATA );
if ( ( hSMMemMap != 0 ) ) {
qDebug() << "FTNoIR_Tracker::FTCreateMapping says: FileMapping Created again..." << hSMMemMap;
- pMemData = (SMMemMap *) MapViewOfFile(hSMMemMap, FILE_MAP_ALL_ACCESS, 0, 0, sizeof(TFaceData));
+ pMemData = (SMMemMap *) MapViewOfFile(hSMMemMap, FILE_MAP_WRITE, 0, 0, sizeof(TFaceData));
if (pMemData != NULL) {
qDebug() << "FTNoIR_Tracker::FTCreateMapping says: MapViewOfFile OK.";
// pMemData->handle = handle; // The game uses the handle, to send a message that the Program-Name was set!
diff --git a/ftnoir_tracker_sm/ftnoir_tracker_faceapi_dialog.cpp b/ftnoir_tracker_sm/ftnoir_tracker_faceapi_dialog.cpp index b62f652c..74c721dd 100644 --- a/ftnoir_tracker_sm/ftnoir_tracker_faceapi_dialog.cpp +++ b/ftnoir_tracker_sm/ftnoir_tracker_faceapi_dialog.cpp @@ -237,10 +237,10 @@ bool TrackerControls::SMCreateMapping() //
// Create a new FileMapping, Read/Write access
//
- hSMMemMap = OpenFileMappingA( FILE_MAP_ALL_ACCESS , false , (LPCSTR) SM_MM_DATA );
+ hSMMemMap = OpenFileMappingA( FILE_MAP_WRITE , false , (LPCSTR) SM_MM_DATA );
if ( ( hSMMemMap != 0 ) ) {
qDebug() << "TrackerControls::FTCreateMapping says: FileMapping Created again..." << hSMMemMap;
- pMemData = (SMMemMap *) MapViewOfFile(hSMMemMap, FILE_MAP_ALL_ACCESS, 0, 0, sizeof(TFaceData));
+ pMemData = (SMMemMap *) MapViewOfFile(hSMMemMap, FILE_MAP_WRITE, 0, 0, sizeof(TFaceData));
if (pMemData != NULL) {
qDebug() << "TrackerControls::FTCreateMapping says: MapViewOfFile OK.";
// pMemData->handle = handle; // The game uses the handle, to send a message that the Program-Name was set!
|