[Progress Communities] [Progress OpenEdge ABL] Forum Post: Reading the name of the client using Wtsapi32.dll does not work on OE 11.7.2

Status
Not open for further replies.
T

Toni Perätalo

Guest
Hi, We are using wtsapi32.dll to get name of the client. Needed when running the application on Remote Desktop Server. This has worked for years, but now when we upgraded to OE 11.7.2 (hotfix 4), OE crashes when using that. Here is the code, to clarify this: PROCEDURE WTSQuerySessionInformationA EXTERNAL "wtsapi32.dll": DEFINE INPUT PARAMETER hServer AS LONG. DEFINE INPUT PARAMETER SessionId AS LONG. DEFINE INPUT PARAMETER WTSInfoClass AS LONG. DEFINE OUTPUT PARAMETER ppBuffer AS LONG. DEFINE OUTPUT PARAMETER pBytesReturned AS LONG. DEFINE RETURN PARAMETER intResult AS LONG. END PROCEDURE. FUNCTION FuncClientName RETURNS CHARACTER( ) : DEFINE VARIABLE lpInfoClass AS INT64 NO-UNDO. DEFINE VARIABLE lpName AS MEMPTR NO-UNDO. DEFINE VARIABLE ws-client-name AS CHARACTER NO-UNDO. DEFINE VARIABLE BytesReturned AS INT64 NO-UNDO. DEFINE VARIABLE intResult AS INT64 NO-UNDO. RUN WTSQuerySessionInformation(INPUT 0, /* {&WTS_CURRNET_SERVER_HANDLE} */ INPUT -1, /* {&WTS_CURRENT_SESSION} */ INPUT 10, /* {&WTS_CLASS_INFO} 10 = WTSClientName */ OUTPUT lpInfoClass, OUTPUT BytesReturned, OUTPUT intResult). SET-POINTER-VALUE(lpName) = lpInfoClass. // this crashes the OE ASSIGN ws-client-name = GET-STRING(lpName,1). SET-SIZE(lpName) = 0. RETURN (ws-client-name). /* Function return value. */ END FUNCTION. So, WTSQuerySessionInformation returns lpInfoClass value that is used to get the information needed. When executing the SET-POINTER-VALUE, OE crashes "OpenEdge Graphical client has stopped working" and generates protrace. I noticed that when running this on OE 11.7, it sometimes returns negative values. But that's not the case. Even if lpInfoClass is positive, the system crashes. So the value is not valid somehow. And the problem is only when running on OE 11.7. Using OE 11.6.3 with same source code, same db, same platform, everything works fine. How can this external dll call return a wrong memory pointer(?) on OE 11.7 but on OE 11.6 it is returned correctly? Has anyone else noticed this kind of behavior? Are there any better resolutions to get the client name on Remote desktop server? And no, the IP address stored in _Connect is not enough. Could this be a bug in OE? Tested platforms: Windows 10 64 bit (Local databases, local OE, not RDC but still crashes on OE 11.7. works with OE 11.6), Windows Server 2012 R2 Standard (RDS) 64 bit. OE 11.7.2 hotfix 004. Any ideas are highly appreciated. Regards, Toni

Continue reading...
 
Status
Not open for further replies.
Top