bufferMemoryAddress
bufferMemoryAddress(): MemoryAddress;
The bufferMemoryAddress method of the Binary primitive type returns a memory address containing the value of the pointer to the internal buffer that contains the binary. This value may be required when a JADE Binary primitive type value is being mapped to a structured record type for a call to an external function.
Call the bufferMemoryAddress method to determine the address of the buffer when an external function requires a data structure to contain a pointer to a second structure.
Do not use this method to pass the address of a binary to an external function that will be executed by a presentation client. If an external function is called from an application server method and executed by a different process (the presentation client), the memory address is not valid and will almost certainly result in a jade.exe (thin client) fault in the called function.
The method in the following example shows the use of the bufferMemoryAddress method to initialize the Windows SECURITY_DESCRIPTOR and SECURITY_ATTRIBUTES structures.
constants // Current security descriptor revision value SECURITY_DESCRIPTOR_REVISION = 1; vars result : Boolean; securityDescriptor : Binary[20]; securityAttributes : Binary[9]; begin ... // Call the Windows API to initialize the security descriptor result := call initializeSecurityDescriptor(securityDescriptor, SECURITY_DESCRIPTOR_REVISION); // Return Windows error if unable to initialize security descriptor if not result then return call getLastError; endif; // The first field (DWORD) in the security attributes structure is the // size (in bytes) of the structure securityAttributes[1:4] := securityAttributes.length.Binary; // The second field (LPVOID) points to the security descriptor // Set the value to the actual address of the buffer securityAttributes[5:4] := securityDescriptor.bufferMemoryAddress.asBinary32; end;