Date: Fri, 29 Mar 2024 08:31:57 -0700 (PDT) Message-ID: <402942518.541.1711726317399@wiki.srpcs.com> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_540_1967467932.1711726317398" ------=_Part_540_1967467932.1711726317398 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
Converts from OI numbers into Win32 binary types
Syntax
Win32Value =3D SRP= _Win32_To_OI(Value, Type)
The equivalent Win32 datatype represented by the OI value.
Parameter | Description |
---|---|
Value | The OI value |
Type | The Win32 type |
Some APIs require developers to pass INTs, FLOATs, and other WIn32 datat= ypes, which means we can't simply pass an OI number. This method makes it e= asy to take any OI variable containing a numerical string and convert it in= to its Win32 equivalent. All you have to do is specify the Win32 datatype y= ou are after. The following types are available for us in the Type paramete= r:
Type | Parameter Option= th> |
---|---|
16-Bit Signed Integer | "WORD", "SHORT", or "INT16" |
16-Bit Unsigned Integer | "UWORD", "USHORT", or "UINT16" |
32-Bit Signed Integer | "LONG", "INT", or "INT32" |
32-Bit Unsigned Integer | "ULONG", "UINT", "DWORD", or "UINT32" |
64-Bit Signed Integer | "LONGLONG", or "INT64" |
64-Bit Unsigned Integer | "ULONGLONG", or "UINT64" |
Float | "FLOAT" |
Double | "DOUBLE" |
The best example is when sending data on a socket, which often pass thes= e kinds of data types. In this example, the length of an string is sent fir= st as a 32-bit integer, so we have to convert into a Win32 value before pas= sing it into SRP_TcpClient.
String =3D "Hello,= World!" Length =3D Len(String) // Connect to a local socket, send data, and then close=20 TcpClientHandle =3D 0=20 If SRP_TcpClient(TcpClientHandle, "CONNECT", "127.0.0.1", "7777") then=20 // Send the string length as a 32-bit integer Win32Length =3D SRP_OI_To_Win32(Length, "INT32") SRP_TcpClient(TcpClientHandle, "SEND", Win32Length)=20 // Send the string=20 SRP_TcpClient(TcpClientHandle, "SEND", String)=20 // Close=20 SRP_TcpClient(TcpClientHandle, "CLOSE")=20 end