I think this is a simple problem
, but Ill include full source to help explain it better.
Im porting some C source over to PB, Ive basically finished and am proud to say its working well so far but it was frustrating to find a barrier at the very end! - it successfully opens a mapped file and gets the correct address etc, now all I need to do is display the result. It looks very simple to do in C, but my attempts to do it in PB have not been successful
The part im stuck on is highlighted in bold. I need to retrieve the data (a resultcode), each piece of data is in an array of that type though so Im not sure how to access it!
Can anybody help me to get this port finished please? This is all I need to do now
Also, I should mention that I used MoveMemory rather than the memcpy asm version in the C source, is that ok to use?
Many thanks!
[This message has been edited by Wayne Diamond (edited October 16, 2001).]

Im porting some C source over to PB, Ive basically finished and am proud to say its working well so far but it was frustrating to find a barrier at the very end! - it successfully opens a mapped file and gets the correct address etc, now all I need to do is display the result. It looks very simple to do in C, but my attempts to do it in PB have not been successful
The part im stuck on is highlighted in bold. I need to retrieve the data (a resultcode), each piece of data is in an array of that type though so Im not sure how to access it!
Can anybody help me to get this port finished please? This is all I need to do now

Code:
typedef struct _SHARED_INFO { LONG lResultCode; } SHARED_INFO; typedef SHARED_INFO * PSHARED_INFO; typedef SHARED_INFO * LPSHARED_INFO; void DisplayResultCode(PSHARED_INFO pElement) { kprintf("%d", pElement->lResultCode); } void _cdecl mainCRTStartup(void) { HANDLE hEventGuard = OpenEvent(EVENT_ALL_ACCESS, FALSE, SHAREDINFO_EVENT_NAME); HANDLE hFileMapping = OpenFileMapping(FILE_MAP_READ, FALSE, SHAREDINFO_NAME); if(hEventGuard == NULL | | hFileMapping == NULL) { kprintf("Error: Program not started. Start and try again.\n"); CloseHandle(hEventGuard); CloseHandle(hFileMapping); return; } PSHARED_INFO pLocalInformation = (PSHARED_INFO)HeapAlloc(GetProcessHeap(), 0, SHAREDINFO_BASE_SIZE); if(pLocalInformation) { PVOID pRemoteInformation = MapViewOfFile(hFileMapping, FILE_MAP_READ, 0, 0, 0); if(pRemoteInformation) { if(WaitForSingleObject(hEventGuard, INFINITE) == WAIT_OBJECT_0) { ResetEvent(hEventGuard); // // here is a replacement of RTL memcpy(..) // memcpy(pLocalInformation, pRemoteInformation, SHAREDINFO_BASE_SIZE); // __asm { align 4 mov ecx, SOCKETMON_BASE_SIZE mov ebx, ecx and ebx, 3 shr ecx, 2 mov esi, pRemoteInformation mov edi, pLocalInformation cld rep movsd mov ecx, ebx rep movsb } SetEvent(hEventGuard); } UnmapViewOfFile(pRemoteInformation); } [b]for(int i = 0; i < SHAREDINFO_BASE_COUNT; i++) { DisplayResultCode(&pLocalInformation[i]); }[/b] HeapFree(GetProcessHeap(), 0, pLocalInformation); } else kprint("Error allocating memory.\n"); CloseHandle(hEventGuard); CloseHandle(hFileMapping); }
Many thanks!
[This message has been edited by Wayne Diamond (edited October 16, 2001).]
Comment