User Mauri Ahtee ( posted:

I have faced this problem a few times.

The bad news is that WR does not support structures or pointer operations in
WinRunner only allows the basic data types in calls to external functions,
ie. integers, strings, etc.

The way around this is to write a DLL with a function to interface between
WR and the structure. The purpose of this function is to call the
InternetReadFileExA method to get the structure and extract the contents of
the structure into discrete variables which are passed back to WR through
the function parameters. The function itself has an interface friendly to
WR, ie. using the basic data types. A rough cut of this function follows

typedef struct _INTERNET_BUFFERS {
DWORD dwStructSize;
struct _INTERNET_BUFFERS% * Next;
LPCTSTR lpcszHeader;
DWORD dwHeadersLength;
DWORD dwHeadersTotal;
LPVOID lpvBuffer;
DWORD dwBufferLength;
DWORD dwBufferTotal;
DWORD dwOffsetLow;
DWORD dwOffsetHigh;

#define MAXBUF 1024

int WR_InternetReadFileExA(LPSTR lpsBuffer, int nBufLength)

/* Get the structure. */

/* Extract buffer length as integer, take care with word to integer
conversion because there is a limit to integer values (32 bits) */
nBufLength = int(lpBuf->dwBufferLength);
if (nBufLength > MAXBUF)
nBufLength = MAXBUF;

/* Extract the buffer as character array. */
strncpy(lpsBuffer, lpBuf->lpvBuffer, nBufLength);


Note the use of MAXBUF to limit the number of characters copied. The
external function declaration in WinRunner also specifies this value so that
WR knows how much memory to allocate for the string if it is of type out or

extern int WR_InternetReadFileExA(out string lpsBuffer <1024>,
in int

Of course this assumes that the buffer can be extracted as a character
string and there should be more error checking in this function as well.

Hope this helps.

Mauri Ahtee
Sydney, Australia
Mobile: 0412 106 679