home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************************\
- * *
- * StrucMem.js -- A collection of structure member functions *
- * *
- * This script prototypes several functions that are contained in the file *
- * StrucMem.dll. Once the functions have been prototyped, they can be used *
- * just like an IntraBuilder function itself. These are intended to be used *
- * to construct and/or parse structure strings. These structure strings can *
- * then be exchanged with external DLLs or with the Windows API. To exchange *
- * a structure with an external function, prototype that function with the *
- * void* type. Then create a string variable and exchange the string. *
- * *
- * Functions prototyped are: *
- * *
- * GetStructNumber(<string>, <offset>, <type>) *
- * where <string> - is a string var representing a structure *
- * <offset> - is the offset in the structure of the number that *
- * you want to get. *
- * <type> - indicates the datatype of the member. Types are *
- * defined in the SECURITY.H header file. *
- * return value - the number at offset <offset> *
- * *
- * SetStructNumber(<string>, <offset>, <type>, <length>, <value>) *
- * where <string> - is a string var representing a structure *
- * <offset> - is the offset in the structure of the number that *
- * you want to set. *
- * <type> - indicates the datatype of the member. Types are *
- * defined in the SECURITY.H header file. *
- * <length> - is the length of <string> *
- * <value> - is the numeric value that you want to write to the *
- * string. *
- * return value - is the number of bytes written to the string *
- * *
- * GetStructString(<string>, <offset>, <length>, <target>, <target len>) *
- * where <string> - is a string var representing a structure *
- * <offset> - is the offset in the structure of the string that *
- * you want to get. *
- * <length> - is the number of bytes to get *
- * <target> - this string variable should be blank. It will *
- * be written to. *
- * <target len> - is the length of <target> *
- * return value - is the number of bytes written to the target *
- * *
- * SetStructString(<string>, <offset>, <string len>, <value>, <value len>) *
- * where <string> - is a string var representing a structure *
- * <offset> - is the offset in the structure of the string that *
- * you want to get. *
- * <string len> - is the length of the <string> *
- * <value> - this is the string that is written to <string>*
- * <value len> - is the length of <value> *
- * return value - is the number of bytes written to the string *
- * *
- * GetStructCharPointer(<string>, <offset>, <length>, <target>, <target len>)*
- * where <string> - is a string var representing a structure *
- * <offset> - is the offset in the structure of the string that *
- * you want to get. *
- * <length> - is the number of bytes pointed to. This many *
- * bytes will be copied to <target>. If the *
- * pointer points to a null terminated string, *
- * you can use 0 as the length. *
- * <target> - this string variable should be blank. It will *
- * be written to. *
- * <target len> - is the length of <target> *
- * return value - is the number of bytes written to the target *
- * *
- * SetStructCharPointer(<string>, <offset>, <length>, <value>) *
- * where <string> - is a string var representing a structure *
- * <offset> - is the offset in the structure of the string that *
- * you want to get. *
- * <length> - is the length of the <string> *
- * <value> - is a string. A pointer to this string is written *
- * to the structure at the specified offset. Make *
- * sure that the <value> variable remains in scope *
- * during the entire time that you are using the *
- * structure. *
- * return value - is the number of bytes written to the string *
- * *
- * GetStructWCharPointer(<string>, <offset>, <length>, <target>, <target len>)*
- * where <string> - is a string var representing a structure *
- * <offset> - is the offset in the structure of the string that *
- * you want to get. *
- * <length> - is the number of bytes pointed to. This many *
- * bytes will be copied to <target>. If the *
- * pointer points to a null terminated string, *
- * you can use 0 as the length. *
- * <target> - this string variable should be blank. It will *
- * be written to. *
- * <target len> - is the length of <target> *
- * return value - is the number of characters written to the target *
- * *
- * The GetStructWCharPointer() function should be used when the *
- * pointer at <offset> points to a wide char string. *
- * *
- * GetStructVoidPointer(<string>, <offset>, <length>, <target>, <target len>)*
- * where <string> - is a string var representing a structure *
- * <offset> - is the offset in the structure of the string that *
- * you want to get. *
- * <length> - is the number of bytes pointed to. This many *
- * bytes will be copied to <target>. Unlike the *
- * GetStructCharPointer method, this one requires *
- * that the length be correctly set. *
- * <target> - this string variable should be blank. It will *
- * be written to. *
- * <target len> - is the length of <target> *
- * return value - is the number of bytes written to the target *
- * *
- * SetStructVoidPointer(<string>, <offset>, <length>, <value>) *
- * where <string> - is a string var representing a structure *
- * <offset> - is the offset in the structure of the string that *
- * you want to get. *
- * <length> - is the length of the <string> *
- * <value> - is a string. A pointer to this string is written *
- * to the structure at the specified offset. Make *
- * sure that the <value> variable remains in scope *
- * during the entire time that you are using the *
- * structure. *
- * return value - is the number of bytes written to the string *
- * *
- * ConvertToMultiByte(<wstring>,<string>,<length>) *
- * where <wstring> - is a wide char string *
- * <string> - is the return buffer for the multibyte string *
- * <length> - is the length of the return buffer in bytes *
- * *
- * ConvertToWideChar(<string>,<wstring>,<length>) *
- * where <string> - is a multi-byte string *
- * <wstring> - is the return buffer for the wide char string *
- * <length> - is the length of the return buffer in bytes *
- * *
- * Example: *
- * See the file StrucSam.js for an example. *
- * *
- * Updated 10/22/96 by IntraBuilder Samples Group *
- * $Revision: 1.2 $ *
- * *
- * Copyright (c) 1996, Borland International, Inc. All rights reserved. *
- * *
- \****************************************************************************/
- // GetStructNumber()
- // Parameters:
- // void* - Structure string
- // int - Offset
- // int - Type (see strucmem.h for types)
- // Return value:
- // returns the numeric value of specified type at offset.
- extern long double GetStructNumber(void*, int, int) "strucmem.dll";
-
- // SetStructNumber()
- // Parameters:
- // void* - Structure string
- // int - Offset
- // int - Type (see strucmem.h for types)
- // int - Length of structure string
- // long double - Numeric value to be written to string
- // Return value:
- // returns the number of bytes that were written to the
- // structure string.
- extern int SetStructNumber(void*, int, int, int, long double) "strucmem.dll";
-
- // GetStructString()
- // Parameters:
- // void* - Structure string
- // int - Offset
- // int - Length of string to retrieve
- // void* - Destination string
- // int - Length of destination string
- // Return value:
- // returns the number of bytes written to destination string.
- extern int GetStructString(void*, int, int, void*, int) "strucmem.dll";
-
- // SetStructString()
- // Parameters:
- // void* - Structure string
- // int - Offset
- // int - Length of structure string
- // void* - Source string to be written to structure string
- // int - Length of source string
- // Return value:
- // returns the number of bytes that were written to the
- // structure string.
- extern int SetStructString(void*, int, int, void*, int) "strucmem.dll";
-
- // GetStructCharPointer()
- // Parameters:
- // void* - Structure string
- // int - Offset
- // int - Length of data that is pointed to (0 if null terminated string)
- // char* - Destination string
- // int - Length of destination string
- // Return value:
- // returns the number of bytes written to destination string.
- extern int GetStructCharPointer(void*, int, int, char*, int) "strucmem.dll";
-
- // SetStructCharPointer()
- // Parameters:
- // void* - Structure string
- // int - Offset
- // int - Length of structure string
- // char* - Source string whose pointer is written to structure string
- // Return value:
- // returns the number of bytes that were written to the
- // structure string (should be 4).
- extern int SetStructCharPointer(void*, int, int, char*) "strucmem.dll" from "SetStructPointer";
-
- // GetStructWCharPointer()
- // Parameters:
- // void* - Structure string
- // int - Offset
- // int - Length of data that is pointed to (0 if null terminated string)
- // void* - Destination string
- // int - Length of destination string
- // Return value:
- // returns the number of bytes written to destination string.
- extern int GetStructWCharPointer(void*, int, int, void*, int) "strucmem.dll" from "GetStructWCharPointer";
-
- // GetStructVoidPointer()
- // Parameters:
- // void* - Structure string
- // int - Offset
- // int - Length of data that is pointed to
- // void* - Destination string
- // int - Length of destination string
- // Return value:
- // returns the number of bytes written to destination string.
- extern int GetStructVoidPointer(void*, int, int, void*, int) "strucmem.dll" from "GetStructCharPointer";
-
- // SetStructVoidPointer()
- // Parameters:
- // void* - Structure string
- // int - Offset
- // int - Length of structure string
- // void* - Source string whose pointer is written to structure string
- // Return value:
- // returns the number of bytes that were written to the
- // structure string (should be 4).
- extern int SetStructVoidPointer(void*, int, int, void*) "strucmem.dll" from "SetStructPointer";
-
- // ConvertToMultiByte()
- // Parameters:
- // void* - Wide char string
- // void* - Destination string buffer
- // int - Length of destination string buffer (in bytes)
- // Return value:
- // returns the number of bytes written to destination
- extern int ConvertToMultiByte(void*, void*, int) "strucmem.dll";
-
- // ConvertToWideChar()
- // Parameters:
- // void* - Multi byte string
- // void* - Destination string buffer
- // int - Length of destination string buffer (in bytes)
- // Return value:
- // returns the number of bytes written to destination
- extern int ConvertToWideChar(void*, void*, int) "strucmem.dll";
-
-
-