Hello,
We have recently upgraded a client from an older Rumba version (7.0.0) to 9.5 and our code that handles emulation is unable to Query any sessions, which we need to do.
It seems that when we send EHLAPI function 10 (QUERYSESSIONS) an initial function 9 (SETSESSIONPARAMETERS) is also sent.
This is expected from my understand in the older version.
However when the SETSESSIONPARAMETERS is sent to Rumba, our emulation hangs.
This is what the Trace looks like:
11:32:54.767 PID: 75136 10 QUERYSESSIONS > len=192
11:32:54.768 PID: 75136 9 SETSESSIONPARAMETERS > len=98
> TO SERVER:B:NOATTRB,NOEAB,NOXLATE,NEWRET,TWAIT,SRCHALL,SRCHFRWD,FPAUSE,AUTORESET
> ,QUIET,WRITE_SUPER
Nothing is ever returned when this is sent, we should expect an APIOK or at least some error. Any guidance would be greatly appreciated.
#RumbaHi bleach,
The following Rumba script uses works for me against RUMBA 9.5 SP1
Declare Function hllapi Lib "C:\\Program Files (x86)\\Micro Focus\\RUMBA\\System\\ehlapi32.Dll" (Func%, ByVal Buffer$, bSize%, RetC%) As Long
Sub Main
Dim Astr As String
Dim Alen As Integer
Dim RetC as Integer
Dim Func As Integer
Func = 21 'Reset System
Astr = ""
Alen = 0
HLLAPI Func, Astr, Alen, RetC
Msgbox "Function 21" & Chr$(10) & "RetC = " & RetC
Func = 10 'Query Sessions
AStr = Space(48)
ALen = 48
HLLAPI Func, Astr, Alen, RetC
Msgbox "The following sessions are open: " & Chr$(10) & Mid$(Astr, 1, 1) & Chr$(10) _
& Mid$(Astr, 13, 1) _
& Chr$(10) & Mid$(Astr, 25, 1) _
& Chr$(10) & Mid$(Astr, 37, 1)
If Mid$(Astr, 1, 1) > " " then
Func = 1 'Connect PS
Astr = "D"
Alen = 1
HLLAPI Func, Astr, Alen, RetC
Msgbox "Function 1" & Chr$(10) & "RetC = " & RetC
Func = 9 'Set Session Parameters
Astr = "NOATTRB,NOEAB,NOXLATE,NEWRET,TWAIT,SRCHALL,SRCHFRWD,FPAUSE,AUTORESET,QUIET,WRITE_SUPER"
Alen = 86
HLLAPI Func, Astr, Alen, RetC
Msgbox "Function 9" & Chr$(10) & "RetC = " & RetC & Chr$(10) & "Alen = " & Alen
AStr = Space(17)
AStr = Mid$(Astr, 1, 1) & AStr
Func = 10
AStr = Space(48)
ALen = 48
HLLAPI Func, Astr, Alen, RetC
Msgbox "The following sessions are open: " & Chr$(10) & Mid$(Astr, 1, 1) & Chr$(10) _
& Mid$(Astr, 13, 1) _
& Chr$(10) & Mid$(Astr, 25, 1) _
& Chr$(10) & Mid$(Astr, 37, 1)
Func = 22 'Query Session Status
Astr = Mid$(Astr, 1, 1)
Alen = Len(Astr)
HLLAPI Func, Astr, Alen, RetC
Msgbox "Function 22" & Chr$(10) & "RetC = " & RetC & Chr$(10) & "Astr = " & AStr
Func = 2 ' disconnect PS
Astr = ""
Alen = 0
HLLAPI Func, Astr, Alen, RetC
Msgbox "Function 2" & Chr$(10) & "RetC = " & RetC
End If
Msgbox "The End"
End Sub
It looks like your Alen parameter in your Function 10 call is incorrect. You have it set to 98, when in fact the Alen should be 86, maybe you removed a couple of parameters and overlooked changing the Alen on the eHLLAPI call.
Tom
Hello,
We have recently upgraded a client from an older Rumba version (7.0.0) to 9.5 and our code that handles emulation is unable to Query any sessions, which we need to do.
It seems that when we send EHLAPI function 10 (QUERYSESSIONS) an initial function 9 (SETSESSIONPARAMETERS) is also sent.
This is expected from my understand in the older version.
However when the SETSESSIONPARAMETERS is sent to Rumba, our emulation hangs.
This is what the Trace looks like:
11:32:54.767 PID: 75136 10 QUERYSESSIONS > len=192
11:32:54.768 PID: 75136 9 SETSESSIONPARAMETERS > len=98
> TO SERVER:B:NOATTRB,NOEAB,NOXLATE,NEWRET,TWAIT,SRCHALL,SRCHFRWD,FPAUSE,AUTORESET
> ,QUIET,WRITE_SUPER
Nothing is ever returned when this is sent, we should expect an APIOK or at least some error. Any guidance would be greatly appreciated.
#RumbaTom,
I really appreciate the time you took to answer me. I was unable to get the provided script to connect to my session but was able to convert it to my C# code to test it out.
The issue is that my code is not sending a Function 9 call. It seems the 9 is sent automatically, not by me, to Rumba immediately following the 10. I have no control, it seems, over the aLen that is sent over the 9.
In my older version this happens as well but I get a response back with the data I need, in this new version it waits indefinitely.
As a note, when I send a 9 along with some data, I do get a response from Rumba:
10:38:53.771 PID: 75736 9 SETSESSIONPARAMETERS > len=86
> NOATTRB,NOEAB,NOXLATE,NEWRET,TWAIT,SRCHALL,SRCHFRWD,FPAUSE,AUTORESET,QUIET,WRITE
> _SUPER
10:38:53.771 PID: 75736 9 SETSESSIONPARAMETERS < 0 APIOK
But if a send only a 10 after:
10:39:05.520 PID: 75736 10 QUERYSESSIONS > len=192
10:39:05.520 PID: 75736 9 SETSESSIONPARAMETERS > len=98
> TO SERVER:B:NOATTRB,NOEAB,NOXLATE,NEWRET,TWAIT,SRCHALL,SRCHFRWD,FPAUSE,AUTORESET
> ,QUIET,WRITE_SUPER
Why is a 9 being appended to my request? How am I able to modify or stop it? Am I missing something?
Hello,
We have recently upgraded a client from an older Rumba version (7.0.0) to 9.5 and our code that handles emulation is unable to Query any sessions, which we need to do.
It seems that when we send EHLAPI function 10 (QUERYSESSIONS) an initial function 9 (SETSESSIONPARAMETERS) is also sent.
This is expected from my understand in the older version.
However when the SETSESSIONPARAMETERS is sent to Rumba, our emulation hangs.
This is what the Trace looks like:
11:32:54.767 PID: 75136 10 QUERYSESSIONS > len=192
11:32:54.768 PID: 75136 9 SETSESSIONPARAMETERS > len=98
> TO SERVER:B:NOATTRB,NOEAB,NOXLATE,NEWRET,TWAIT,SRCHALL,SRCHFRWD,FPAUSE,AUTORESET
> ,QUIET,WRITE_SUPER
Nothing is ever returned when this is sent, we should expect an APIOK or at least some error. Any guidance would be greatly appreciated.
#Rumbaehllapi_5F00_cs-.zip
Hi Bleach,
unfortunately you don't mention if the Rumba Basic script works of not.
I've gone ahead an created a C# app to test with and unfortunately I can't reproduce this issue which you are encountering with the QuerySessions EHLLAPI function.
Here is my EHLLAPI Wrapper class
using System;
using System.Runtime.InteropServices;
using System.Text;
namespace EHLLAPI
{
public class EhllapiFunc
{
[DllImport("C:\\\\Program Files (x86)\\\\Micro Focus\\\\RUMBA\\\\System\\\\ehlapi32.Dll")]
public static extern UInt32 hllapi(out UInt32 Func, StringBuilder Data, out UInt32 Length, out UInt32 RetC);
}
/// <summary>
///
/// </summary>
public class EhllapiWrapper
{
const UInt32 HA_CONNECT_PS = 1; /* 000 Connect PS*/
const UInt32 HA_DISCONNECT_PS = 2; /* 000 Disconnect PS*/
const UInt32 HA_SENDKEY = 3; /* 000 Sendkey function*/
const UInt32 HA_WAIT = 4; /* 000 Wait function*/
const UInt32 HA_COPY_PS = 5; /* 000 Copy PS function*/
const UInt32 HA_SEARCH_PS = 6; /* 000 Search PS function*/
const UInt32 HA_QUERY_CURSOR_LOC = 7; /* 000 Query Cursor*/
const UInt32 HA_COPY_PS_TO_STR = 8; /* 000 Copy PS to String*/
const UInt32 HA_SET_SESSION_PARMS = 9; /* 000 Set Session*/
const UInt32 HA_QUERY_SESSIONS = 10; /* 000 Query Sessions*/
const UInt32 HA_RESERVE = 11; /* 000 Reserve function*/
const UInt32 HA_RELEASE = 12; /* 000 Release function*/
const UInt32 HA_COPY_OIA = 13; /* 000 Copy OIA function*/
const UInt32 HA_QUERY_FIELD_ATTR = 14; /* 000 Query Field*/
const UInt32 HA_COPY_STR_TO_PS = 15; /* 000 Copy string to PS*/
const UInt32 HA_STORAGE_MGR = 17; /* 000 Storage Manager*/
const UInt32 HA_PAUSE = 18; /* 000 Pause function*/
const UInt32 HA_QUERY_SYSTEM = 20; /* 000 Query System*/
const UInt32 HA_RESET_SYSTEM = 21; /* 000 Reset System*/
const UInt32 HA_QUERY_SESSION_STATUS = 22; /* 000 Query Session*/
const UInt32 HA_START_HOST_NOTIFY = 23; /* 000 Start Host*/
const UInt32 HA_QUERY_HOST_UPDATE = 24; /* 000 Query Host Update*/
const UInt32 HA_STOP_HOST_NOTIFY = 25; /* 000 Stop Host*/
const UInt32 HA_SEARCH_FIELD = 30; /* 000 Search Field*/
const UInt32 HA_FIND_FIELD_POS = 31; /* 000 Find Field*/
const UInt32 HA_FIND_FIELD_LEN = 32; /* 000 Find Field Length*/
const UInt32 HA_COPY_STR_TO_FIELD = 33; /* 000 Copy String to*/
const UInt32 HA_COPY_FIELD_TO_STR = 34; /* 000 Copy Field to*/
const UInt32 HA_SET_CURSOR = 40; /* 000 Set Cursor*/
const UInt32 HA_START_CLOSE_INTERCEPT = 41; /* 000 Start Close Intercept*/
const UInt32 HA_QUERY_CLOSE_INTERCEPT = 42; /* 000 Query Close Intercept*/
const UInt32 HA_STOP_CLOSE_INTERCEPT = 43; /* 000 Stop Close Intercept*/
const UInt32 HA_START_KEY_INTERCEPT = 50; /* 000 Start Keystroke*/
const UInt32 HA_GET_KEY = 51; /* 000 Get Key function*/
const UInt32 HA_POST_INTERCEPT_STATUS = 52; /* 000 Post Intercept*/
const UInt32 HA_STOP_KEY_INTERCEPT = 53; /* 000 Stop Keystroke*/
const UInt32 HA_LOCK_PS = 60; /* 000 Lock Presentation*/
const UInt32 HA_LOCK_PMSVC = 61; /* 000 Lock PM Window*/
const UInt32
HA_SEND_FILE = 90; /* 000 Send File function*/
const UInt32
HA_RECEIVE_FILE = 91; /* 000 Receive file*/
const UInt32
HA_CONVERT_POS_ROW_COL = 99; /* 000 Convert Position*/
const UInt32
HA_CONNECT_PM_SRVCS = 101; /* 000 Connect For*/
const UInt32
HA_DISCONNECT_PM_SRVCS = 102; /* 000 Disconnect From*/
const UInt32
HA_QUERY_WINDOW_COORDS = 103; /* 000 Query Presentation*/
const UInt32
HA_PM_WINDOW_STATUS = 104; /* 000 PM Window Status*/
const UInt32
HA_CHANGE_SWITCH_NAME = 105; /* 000 Change Switch List*/
const UInt32
HA_CHANGE_WINDOW_NAME = 106; /* 000 Change PS Window*/
const UInt32
HA_START_PLAYING_MACRO = 110; /* 000 Start playing macro*/
const UInt32
HA_START_STRUCTURED_FLD = 120; /* 000 Start Structured*/
const UInt32
HA_STOP_STRUCTURED_FLD = 121; /* 000 Stop Structured*/
const UInt32
HA_QUERY_BUFFER_SIZE = 122; /* 000 Query Communications*/
const UInt32
HA_ALLOCATE_COMMO_BUFF = 123; /* 000 Allocate*/
const UInt32
HA_FREE_COMMO_BUFF = 124; /* 000 Free Communications*/
const UInt32
HA_GET_ASYNC_COMPLETION = 125; /* 000 Get Asynchronous*/
const UInt32
HA_READ_STRUCTURED_FLD = 126; /* 000 Read Structured Field*/
const UInt32
HA_WRITE_STRUCTURED_FLD = 127; /* 000 Write Structured*/
//********************************************************************/
//******************* EHLLAPI RETURN CODES***************************/
//********************************************************************/
const UInt32
HARC_SUCCESS = 0; /* 000 Good return code.*/
const UInt32
HARC99_INVALID_INP = 0; /* 000 Incorrect input*/
const UInt32
HARC_INVALID_PS = 1; /* 000 Invalid PS, Not*/
const UInt32
HARC_BAD_PARM = 2; /* 000 Bad parameter, or*/
const UInt32
HARC_BUSY = 4; /* 000 PS is busy return*/
const UInt32
HARC_LOCKED = 5; /* 000 PS is LOCKed, or*/
const UInt32
HARC_TRUNCATION = 6; /* 000 Truncation*/
const UInt32
HARC_INVALID_PS_POS = 7; /* 000 Invalid PS*/
const UInt32
HARC_NO_PRIOR_START = 8; /* 000 No prior start*/
const UInt32
HARC_SYSTEM_ERROR = 9; /* 000 A system error*/
const UInt32
HARC_UNSUPPORTED = 10; /* 000 Invalid or*/
const UInt32
HARC_UNAVAILABLE = 11; /* 000 Resource is*/
const UInt32
HARC_SESSION_STOPPED = 12; /* 000 Session has*/
const UInt32
HARC_BAD_MNEMONIC = 20; /* 000 Illegal mnemonic*/
const UInt32
HARC_OIA_UPDATE = 21; /* 000 A OIA update*/
const UInt32
HARC_PS_UPDATE = 22; /* 000 A PS update*/
const UInt32
HARC_PS_AND_OIA_UPDATE = 23; /* A PS and OIA update*/
const UInt32
HARC_STR_NOT_FOUND_UNFM_PS = 24; /* 000 String not found,*/
const UInt32
HARC_NO_KEYS_AVAIL = 25; /* 000 No keys available*/
const UInt32
HARC_HOST_UPDATE = 26; /* 000 A HOST update*/
const UInt32
HARC_FIELD_LEN_ZERO = 28; /* 000 Field length = 0*/
const UInt32
HARC_QUEUE_OVERFLOW = 31; /* 000 Keystroke queue*/
const UInt32
HARC_ANOTHER_CONNECTION = 32; /* 000 Successful. Another*/
const UInt32
HARC_INBOUND_CANCELLED = 34; /* 000 Inbound structured*/
const UInt32
HARC_OUTBOUND_CANCELLED = 35; /* 000 Outbound structured*/
const UInt32
HARC_CONTACT_LOST = 36; /* 000 Contact with the*/
const UInt32
HARC_INBOUND_DISABLED = 37; /* 000 Host structured field*/
const UInt32
HARC_FUNCTION_INCOMPLETE = 38; /* 000 Requested Asynchronous*/
const UInt32
HARC_DDM_ALREADY_EXISTS = 39; /* 000 Request for DDM*/
const UInt32
HARC_ASYNC_REQUESTS_OUT = 40; /* 000 Disconnect successful.*/
const UInt32
HARC_MEMORY_IN_USE = 41; /* 000 Memory cannot be freed*/
const UInt32
HARC_NO_MATCH = 42; /* 000 No pending*/
const UInt32
HARC_OPTION_INVALID = 43; /* 000 Option requested is*/
const UInt32
HARC99_INVALID_PS = 9998; /* 000 An invalid PS id*/
const UInt32
HARC99_INVALID_CONV_OPT = 9999; /* 000 Invalid convert*/
public static UInt32 Connect(string sessionID)
{
StringBuilder Data = new StringBuilder(4);
Data.Append(sessionID);
UInt32 rc=0;
UInt32 f=HA_CONNECT_PS;
UInt32 l=4;
return EhllapiFunc.hllapi(out f, Data, out l, out rc);
}
public static UInt32 Disconnect(string sessionID)
{
StringBuilder Data = new StringBuilder(4);
Data.Append(sessionID);
UInt32 rc=0;
UInt32 f=HA_DISCONNECT_PS;
UInt32 l=4;
return EhllapiFunc.hllapi(out f, Data, out l, out rc);
}
public static UInt32 SetCursorPos(int p)
{
StringBuilder Data = new StringBuilder(0);
UInt32 rc=(UInt32) p;
UInt32 f=HA_SET_CURSOR;
UInt32 l=0;
return EhllapiFunc.hllapi(out f, Data, out l, out rc);
}
public static UInt32 GetCursorPos(out int p)
{
StringBuilder Data = new StringBuilder(0);
UInt32 rc=0;
UInt32 f=HA_QUERY_CURSOR_LOC;
UInt32 l=0; //return position
UInt32 r = EhllapiFunc.hllapi(out f, Data, out l, out rc);
p = (int)l;
return r;
}
public static UInt32 SendStr(string cmd)
{
StringBuilder Data = new StringBuilder(cmd.Length);
Data.Append(cmd);
UInt32 rc = 0;
UInt32 f = HA_SENDKEY;
UInt32 l = (UInt32)cmd.Length;
return EhllapiFunc.hllapi(out f, Data, out l, out rc);
}
public static UInt32 ReadScreen(int position, int len, out string txt)
{
StringBuilder Data = new StringBuilder(3000);
UInt32 rc=(UInt32)position;
UInt32 f=HA_COPY_PS_TO_STR;
UInt32 l=(UInt32)len;
UInt32 r = EhllapiFunc.hllapi(out f, Data, out l, out rc);
txt = Data.ToString();
return r;
}
public static UInt32 Wait()
{
StringBuilder Data = new StringBuilder(0);
UInt32 rc=0;
UInt32 f=HA_WAIT ;
UInt32 l=0;
UInt32 r = EhllapiFunc.hllapi(out f, Data, out l, out rc);
return r;
}
public static UInt32 SetSessParams(string cmd)
{
StringBuilder Data = new StringBuilder(cmd.Length);
Data.Append(cmd);
UInt32 rc = 0;
UInt32 f = HA_SET_SESSION_PARMS;
UInt32 l = (UInt32)cmd.Length;
return EhllapiFunc.hllapi(out f, Data, out l, out rc);
}
public static UInt32 QuerySessions(out string s)
{
StringBuilder Data = new StringBuilder(48);
Data.Append(' ', 48);
UInt32 rc = 0;
UInt32 f = HA_QUERY_SESSIONS;
UInt32 l = 48;
UInt32 r = EhllapiFunc.hllapi(out f, Data, out l, out rc);
s = Data.ToString();
return r;
}
}
}
And here are the methods I am executing in my C# app
private void button1_Click_1(object sender, EventArgs e)
{ MessageBox.Show(EhllapiWrapper.SetSessParams("NOATTRB,NOEAB,NOXLATE,NEWRET,TWAIT,SRCHALL,SRCHFRWD,FPAUSE,AUTORESET,QUIET,WRITE_SUPER").ToString());
}
private void button2_Click_1(object sender, EventArgs e)
{
string s;
EhllapiWrapper.QuerySessions(out s);
this.lblReadOut.Text = s;
}
I've attached my VS2015 project(s).
Maybe you can have a play with this and let us know if you still encounter the issue using my project?
Note: I'm using 9.5 also, so this should work for you.
Tom