home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 8 / CDACTUAL8.iso / progs / ite / ite10d1.exe / DATA.Z / STRUCMEM.JS < prev    next >
Encoding:
Text File  |  1996-09-07  |  9.1 KB  |  151 lines

  1. /****************************************************************************\
  2. *                                                                            *
  3. * StrucMem.js  --  A collection of structure member functions                *
  4. *                                                                            *
  5. * This script prototypes several functions that are contained in the file    *
  6. * StrucMem.dll. Once the functions have been prototyped, they can be used    *
  7. * just like an IntraBuilder function itself. These are intended to be used   *
  8. * to construct and/or parse structure strings. These structure strings can   *
  9. * then be exchanged with external DLLs or with the Windows API. To exchange  *
  10. * a structure with an external function, prototype that function with the    *
  11. * void* type. Then create a string variable and exchange the string.         *
  12. *                                                                            *
  13. * Functions prototyped are:                                                  *
  14. *                                                                            *
  15. *   GetStructNumber(<string>, <offset>, <type>)                              *
  16. *        where <string> - is a string var representing a structure           *
  17. *              <offset> - is the offset in the structure of the number that  *
  18. *                         you want to get.                                   *
  19. *              <type>   - indicates the datatype of the member. Types are    *
  20. *                         defined in the SECURITY.H header file.             *
  21. *        return value   - the number at offset <offset>                      *
  22. *                                                                            *
  23. *   SetStructNumber(<string>, <offset>, <type>, <length>, <value>)           *
  24. *        where <string> - is a string var representing a structure           *
  25. *              <offset> - is the offset in the structure of the number that  *
  26. *                         you want to set.                                   *
  27. *              <type>   - indicates the datatype of the member. Types are    *
  28. *                         defined in the SECURITY.H header file.             *
  29. *              <length> - is the length of <string>                          *
  30. *              <value>  - is the numeric value that you want to write to the *
  31. *                         string.                                            *
  32. *        return value   - is the number of bytes written to the string       *
  33. *                                                                            *
  34. *   GetStructString(<string>, <offset>, <length>, <target>, <target len>)    *
  35. *        where <string> - is a string var representing a structure           *
  36. *              <offset> - is the offset in the structure of the string that  *
  37. *                         you want to get.                                   *
  38. *              <length>     - is the number of bytes to get                  *
  39. *              <target>     - this string variable should be blank. It will  *
  40. *                             be written to.                                 *
  41. *              <target len> - is the length of <target>                      *
  42. *        return value   - is the number of bytes written to the target       *
  43. *                                                                            *
  44. *   SetStructString(<string>, <offset>, <string len>, <value>, <value len>)  *
  45. *        where <string> - is a string var representing a structure           *
  46. *              <offset> - is the offset in the structure of the string that  *
  47. *                         you want to get.                                   *
  48. *              <string len>  - is the length of the <string>                 *
  49. *              <value>       - this is the string that is written to <string>*
  50. *              <value len>   - is the length of <value>                      *
  51. *        return value   - is the number of bytes written to the string       *
  52. *                                                                            *
  53. *   GetStructPointer(<string>, <offset>, <length>, <target>, <target len>)   *
  54. *        where <string> - is a string var representing a structure           *
  55. *              <offset> - is the offset in the structure of the string that  *
  56. *                         you want to get.                                   *
  57. *              <length>     - is the number of bytes pointed to. This many   *
  58. *                             bytes will be copied to <target>. If the       *
  59. *                             pointer points to a null terminated string,    *
  60. *                             you can use -1 as the length.                  *
  61. *              <target>     - this string variable should be blank. It will  *
  62. *                             be written to.                                 *
  63. *              <target len> - is the length of <target>                      *
  64. *        return value   - is the number of bytes written to the target       *
  65. *                                                                            *
  66. *   SetStructPointer(<string>, <offset>, <length>, <value>)                  *
  67. *        where <string> - is a string var representing a structure           *
  68. *              <offset> - is the offset in the structure of the string that  *
  69. *                         you want to get.                                   *
  70. *              <length> - is the length of the <string>                      *
  71. *              <value>  - is a string. A pointer to this string is written   *
  72. *                         to the structure at the specified offset. Make     *
  73. *                         sure that the <value> variable remains in scope    *
  74. *                         during the entire time that you are using the      *
  75. *                         structure.                                         *
  76. *        return value   - is the number of bytes written to the string       *
  77. *                                                                            *
  78. * Example:                                                                   *
  79. *    See the file StrucSam.js for an example.                                *
  80. *                                                                            *
  81. * Updated 8/18/96 by IntraBuilder Samples Group                              *
  82. * $Revision:   1.0  $                                                        *
  83. *                                                                            *
  84. * Copyright (c) 1996, Borland International, Inc. All rights reserved.       *
  85. *                                                                            *
  86. \****************************************************************************/
  87. // GetStructNumber()
  88. // Parameters:
  89. //     void*  -  Structure string
  90. //     int    -  Offset
  91. //     int    -  Type (see strucmem.h for types)
  92. // Return value:
  93. //     returns the numeric value of specified type at offset.
  94. extern long double GetStructNumber(void*, int, int) "strucmem.dll";
  95.  
  96. // SetStructNumber()
  97. // Parameters:
  98. //     void*       -  Structure string
  99. //     int         -  Offset
  100. //     int         -  Type (see strucmem.h for types)
  101. //     int         -  Length of structure string
  102. //     long double -  Numeric value to be written to string
  103. // Return value:
  104. //     returns the number of bytes that were written to the
  105. //     structure string.
  106. extern int SetStructNumber(void*, int, int, int, long double) "strucmem.dll";
  107.  
  108. // GetStructString()
  109. // Parameters:
  110. //     void*  -  Structure string
  111. //     int    -  Offset
  112. //     int    -  Length of string to retrieve
  113. //     void*  -  Destination string
  114. //     int    -  Length of destination string
  115. // Return value:
  116. //     returns the number of bytes written to destination string.
  117. extern int GetStructString(void*, int, int, void*, int) "strucmem.dll";
  118.  
  119. // SetStructString()
  120. // Parameters:
  121. //     void*  -  Structure string
  122. //     int    -  Offset
  123. //     int    -  Length of structure string
  124. //     void*  -  Source string to be written to structure string
  125. //     int    -  Length of source string
  126. // Return value:
  127. //     returns the number of bytes that were written to the
  128. //     structure string.
  129. extern int SetStructString(void*, int, int, void*, int) "strucmem.dll";
  130.  
  131. // GetStructPointer()
  132. // Parameters:
  133. //     void*  -  Structure string
  134. //     int    -  Offset
  135. //     int    -  Length of data that is pointed to (0 if null terminated string)
  136. //     void*  -  Destination string
  137. //     int    -  Length of destination string
  138. // Return value:
  139. //     returns the number of bytes written to destination string.
  140. extern int GetStructPointer(void*, int, int, void*, int) "strucmem.dll";
  141.  
  142. // SetStructPointer()
  143. // Parameters:
  144. //     void*  -  Structure string
  145. //     int    -  Offset
  146. //     int    -  Length of structure string
  147. //     void*  -  Source string whose pointer is written to structure string
  148. // Return value:
  149. //     returns the number of bytes that were written to the
  150. //     structure string (should be 4).
  151. extern int SetStructPointer(void*, int, int, void*) "strucmem.dll";