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 ....
WINTYPE LOCAL ....
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?
.
This looks like a corrupted entity. What is the exact code in the VO version of the app? Is it being used anywhere?
.
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu
-
- Posts: 49
- Joined: Wed Aug 11, 2021 11:03 am
WINTYPE LOCAL ....
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!
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 ....
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.
.
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.
.
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu
-
- Posts: 49
- Joined: Wed Aug 11, 2021 11:03 am
WINTYPE LOCAL ....
Thank you - that was my thinking....
Cheers, JK
Cheers, JK
WINTYPE LOCAL ....
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 ... 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
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
-
- Posts: 49
- Joined: Wed Aug 11, 2021 11:03 am
WINTYPE LOCAL ....
Hi Robert,
Wowzer you are good...
I can barely remember that far back!!!
Thank you, keep well and,
Cheers, JK
Wowzer you are good...
I can barely remember that far back!!!
Thank you, keep well and,
Cheers, JK
WINTYPE LOCAL ....
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
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
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
WINTYPE LOCAL ....
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
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
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it