Page 1 of 1
WINTYPE LOCAL ....
Posted: Fri Sep 24, 2021 4:08 pm
by JKCanada604
Good day everyone,
I have run into something I cannot determine how to handle.
WINTYPE LOCAL hBuffReadyEv AS HANDLE
I have gone through the Windsk, a bunch of include files as well as the VO help - nothing found!
As always, any hints appreciated...
Thank you, keep well everyone annd,
Cheers, JK
WINTYPE LOCAL ....
Posted: Fri Sep 24, 2021 4:21 pm
by Chris
Hi John,
This looks like a corrupted entity. What is the exact code in the VO version of the app? Is it being used anywhere?
.
WINTYPE LOCAL ....
Posted: Fri Sep 24, 2021 4:28 pm
by JKCanada604
Hi Chris,
Here is the code:
FUNC OutputDebugString32(pszOut AS PSZ) AS VOID PASCAL
LOCAL pCallBack AS PTR
LOCAL lRet AS LOGIC
WINTYPE LOCAL hBuffReadyEv AS HANDLE
WINTYPE LOCAL hDataReadyEv AS HANDLE
WINTYPE LOCAL hfShared AS HANDLE
LOCAL pSharedMem AS _SHAREDMEM
LOCAL nStrSize AS INT
LOCAL nSize AS INT
LOCAL OsVerInfo IS _WINOSVERSIONINFO
LOCAL cFileName AS STRING
LOCAL DIM abTemp[_MAX_PATH] AS BYTE
LOCAL pOut AS BYTE PTR
LOCAL lIDE AS LOGIC
nStrSize := PszLen(pszOut) + 1
pOut := MemAlloc(nStrSize)
IF pOut = NULL_PTR
MessageBox(NULL, ERRMSG_LOW_MEM, ERRMSG_CAPTION, MB_OK)
RETURN
ENDIF
MemCopy(pOut, PTR(_CAST,pszOut), nStrSize)
nSize := GetModuleFileName(_GetInst(),@abTemp[1], _MAX_PATH )
CharUpperBuff( @abTemp[1], nSize )
IF nSize > 4
IF MemComp( @abTemp[nSize-3], PTR(_CAST, ".DBG"), 4 ) = 0
lIDE := .T.
ENDIF
ENDIF
OsVerInfo.dwOSVersionInfoSize := _SIZEOF(_WINOSVERSIONINFO)
GetVersionEx(@OsVerInfo)
OutPutDebugString(pOut)
IF lIDE
//
// IDE swallows all OutPutDebugStrings,
// don't check fot NT, we have to care
// about the output anyway.
// Note: Check new VO 2.0 releases
// for this behaviour
//
ELSE
IF OsVerInfo.dwPlatformId == VER_PLATFORM_WIN32_NT
//
// No IDE, no Windows95, (no cry) we are done ...
//
RETURN
ENDIF
ENDIF
//
// Make sure DBWIN32.EXE is up
//
hBuffReadyEv := OpenEvent(EVENT_MODIFY_STATE, FALSE, EVENT_BUFFER_READY)
IF hBuffReadyEv = NULL_PTR
#IFDEF __DEBUG__
MessageBox(NULL, ERRMSG_NO_SYNC1, ERRMSG_CAPTION, MB_OK)
#ENDIF
RETURN
ENDIF
//
// Get a handle to the data synch objects
//
hDataReadyEv := OpenEvent( EVENT_MODIFY_STATE, FALSE, EVENT_DATA_READY)
IF hDataReadyEv = NULL_PTR
#IFDEF __DEBUG__
MessageBox(NULL, ERRMSG_NO_SYNC2, ERRMSG_CAPTION, MB_OK)
#ENDIF
CloseHandle(hBuffReadyEv)
RETURN
ENDIF
hfShared := CreateFileMapping( 0xFFFFFFFF, 0, PAGE_READWRITE, 0, 4096, BUFFER_NAME)
IF hfShared = NULL_PTR
MessageBox(NULL, ERRMSG_CREATE_MAP, ERRMSG_CAPTION, MB_OK)
CloseHandle(hBuffReadyEv)
CloseHandle(hDataReadyEv)
RETURN
ENDIF
pSharedMem := MapViewOfFile(hfShared, FILE_MAP_WRITE, 0, 0, 512)
IF pSharedMem = NULL_PTR
MessageBox(0, ERRMSG_MAP_MEM, ERRMSG_CAPTION, MB_OK)
CloseHandle(hfShared)
CloseHandle(hBuffReadyEv)
CloseHandle(hDataReadyEv)
RETURN
ENDIF
//
// Wait for buffer event
//
WaitForSingleObject(hBuffReadyEv, INFINITE)
//
// Write it to the shared memory
//
pSharedMem.nProcID := GetCurrentProcessId()
MemCopy( @pSharedMem.abInfo[1], pOut, nStrSize )
//
// Signal data ready event
//
SetEvent(hDataReadyEv)
//
// Clean up handles
//
UnmapViewOfFile(pSharedMem)
CloseHandle(hfShared)
CloseHandle(hDataReadyEv)
CloseHandle(hBuffReadyEv)
IF pOut != NULL_PTR
MemFree(pOut)
ENDIF
RETURN
As always, thank you!
WINTYPE LOCAL ....
Posted: Fri Sep 24, 2021 4:34 pm
by Chris
Hi John,
When I try your code in VO 2.8 I get errors about WINTYPE and HANDLE, but indeed it does compile without errors in 2.7, so I assume it was something of the past. You should be able to just remove the "WINTYPE" and replace "HANDLE" with PTR in all 3 lines and it should be fine.
.
WINTYPE LOCAL ....
Posted: Fri Sep 24, 2021 4:36 pm
by JKCanada604
Thank you - that was my thinking....
Cheers, JK
WINTYPE LOCAL ....
Posted: Fri Sep 24, 2021 7:37 pm
by robert
John,
WINTYPE ... HANDLE was an UDC that was used in the time when people were moving from VO 1 (where handles were numbers) to VO 2 (where handles are PTR)
Robert
WINTYPE LOCAL ....
Posted: Fri Sep 24, 2021 7:52 pm
by JKCanada604
Hi Robert,
Wowzer you are good...
I can barely remember that far back!!!
Thank you, keep well and,
Cheers, JK
WINTYPE LOCAL ....
Posted: Fri Sep 24, 2021 8:04 pm
by robert
John,
If I remember correctly there was a Windows.UDC file or something named like that, that had several UDCs that started with WINTYPE.
There should also be UDCs for the various VTrace UDCs
Robert
WINTYPE LOCAL ....
Posted: Sat Sep 25, 2021 3:39 pm
by wriedmann
Hi John,
AFAIK you can remove OutputDebugstring32() from your code.
The VO Windows API Library contains a OutputDebugString() function, or even better, a DebOut() function.
OutputDebugString32() was needed in earlier versions of VO where both other function don't were included.
Wolfgang