Unable to Read Return Value From DLL Using eScript (Doc ID 1964302.1)

Last updated on MARCH 02, 2017

Applies to:

Siebel CRM - Version 8.2.2 SIA[22320] and later
Information in this document applies to any platform.

Symptoms

 Per definition of kernel32.dll api GetComputerName (http://msdn.microsoft.com/en-us/library/windows/desktop/ms724295%28v=vs.85%29.aspx) the first argument (which is input and output), is a pointer to a buffer.

The code below produces an output, but this only seems to be an adress, not the entire value. (example output: 1006156848)

Below is the sample code :-

function Service_PreInvokeMethod (MethodName, Inputs, Outputs)
{

var maxchars = 1000;
var buffer = new Buffer(maxchars);

var be = SElib.dynamicLink("kernel32","GetComputerName", STDCALL, buffer.data,maxchars);

Outputs.SetProperty("ComputerName",buffer.data);

return (CancelOperation);
}

 Using Siebel VB with following example code, the computer name was returned as expected :-

(declarations)
Declare Function GetComputerName Lib 'kernel32' Alias  "GetComputerNameA"
(ByVal lpBuffer As String, nSize As Long) As Long
 
Function Service_PreInvokeMethod (MethodName As String, Inputs As
PropertySet, Outputs As PropertySet) As Integer
 
Dim ComputerName as String
Dim buffer As String * 512
Dim length As Long
Dim ret As Long
 
length = Len(buffer)
ret=GetComputerName(buffer, length)
ComputerName = Left$(buffer, length)
 
Outputs.SetProperty 'ComputerName', ComputerName
 
Service_PreInvokeMethod = CancelOperation
End Function

 

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms