home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / borland / ib / setups / intrabld / data.z / STRUCMEM.JS < prev    next >
Text File  |  1996-12-11  |  15KB  |  256 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. *   GetStructCharPointer(<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 0 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. *   SetStructCharPointer(<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. *   GetStructWCharPointer(<string>, <offset>, <length>, <target>, <target len>)*
  79. *        where <string> - is a string var representing a structure           *
  80. *              <offset> - is the offset in the structure of the string that  *
  81. *                         you want to get.                                   *
  82. *              <length>     - is the number of bytes pointed to. This many   *
  83. *                             bytes will be copied to <target>. If the       *
  84. *                             pointer points to a null terminated string,    *
  85. *                             you can use 0 as the length.                   *
  86. *              <target>     - this string variable should be blank. It will  *
  87. *                             be written to.                                 *
  88. *              <target len> - is the length of <target>                      *
  89. *        return value   - is the number of characters written to the target  *
  90. *                                                                            *
  91. *        The GetStructWCharPointer() function should be used when the        *
  92. *        pointer at <offset> points to a wide char string.                   *
  93. *                                                                            *
  94. *   GetStructVoidPointer(<string>, <offset>, <length>, <target>, <target len>)*
  95. *        where <string> - is a string var representing a structure           *
  96. *              <offset> - is the offset in the structure of the string that  *
  97. *                         you want to get.                                   *
  98. *              <length>     - is the number of bytes pointed to. This many   *
  99. *                             bytes will be copied to <target>. Unlike the   *
  100. *                             GetStructCharPointer method, this one requires *
  101. *                             that the length be correctly set.              *
  102. *              <target>     - this string variable should be blank. It will  *
  103. *                             be written to.                                 *
  104. *              <target len> - is the length of <target>                      *
  105. *        return value   - is the number of bytes written to the target       *
  106. *                                                                            *
  107. *   SetStructVoidPointer(<string>, <offset>, <length>, <value>)              *
  108. *        where <string> - is a string var representing a structure           *
  109. *              <offset> - is the offset in the structure of the string that  *
  110. *                         you want to get.                                   *
  111. *              <length> - is the length of the <string>                      *
  112. *              <value>  - is a string. A pointer to this string is written   *
  113. *                         to the structure at the specified offset. Make     *
  114. *                         sure that the <value> variable remains in scope    *
  115. *                         during the entire time that you are using the      *
  116. *                         structure.                                         *
  117. *        return value   - is the number of bytes written to the string       *
  118. *                                                                            *
  119. *   ConvertToMultiByte(<wstring>,<string>,<length>)                          *
  120. *        where <wstring> - is a wide char string                             *
  121. *              <string>  - is the return buffer for the multibyte string     *
  122. *              <length>  - is the length of the return buffer in bytes       *
  123. *                                                                            *
  124. *   ConvertToWideChar(<string>,<wstring>,<length>)                           *
  125. *        where <string>  - is a multi-byte string                            *
  126. *              <wstring> - is the return buffer for the wide char string     *
  127. *              <length>  - is the length of the return buffer in bytes       *
  128. *                                                                            *
  129. * Example:                                                                   *
  130. *    See the file StrucSam.js for an example.                                *
  131. *                                                                            *
  132. * Updated 10/22/96 by IntraBuilder Samples Group                             *
  133. * $Revision:   1.2  $                                                        *
  134. *                                                                            *
  135. * Copyright (c) 1996, Borland International, Inc. All rights reserved.       *
  136. *                                                                            *
  137. \****************************************************************************/
  138. // GetStructNumber()
  139. // Parameters:
  140. //     void*  -  Structure string
  141. //     int    -  Offset
  142. //     int    -  Type (see strucmem.h for types)
  143. // Return value:
  144. //     returns the numeric value of specified type at offset.
  145. extern long double GetStructNumber(void*, int, int) "strucmem.dll";
  146.  
  147. // SetStructNumber()
  148. // Parameters:
  149. //     void*       -  Structure string
  150. //     int         -  Offset
  151. //     int         -  Type (see strucmem.h for types)
  152. //     int         -  Length of structure string
  153. //     long double -  Numeric value to be written to string
  154. // Return value:
  155. //     returns the number of bytes that were written to the
  156. //     structure string.
  157. extern int SetStructNumber(void*, int, int, int, long double) "strucmem.dll";
  158.  
  159. // GetStructString()
  160. // Parameters:
  161. //     void*  -  Structure string
  162. //     int    -  Offset
  163. //     int    -  Length of string to retrieve
  164. //     void*  -  Destination string
  165. //     int    -  Length of destination string
  166. // Return value:
  167. //     returns the number of bytes written to destination string.
  168. extern int GetStructString(void*, int, int, void*, int) "strucmem.dll";
  169.  
  170. // SetStructString()
  171. // Parameters:
  172. //     void*  -  Structure string
  173. //     int    -  Offset
  174. //     int    -  Length of structure string
  175. //     void*  -  Source string to be written to structure string
  176. //     int    -  Length of source string
  177. // Return value:
  178. //     returns the number of bytes that were written to the
  179. //     structure string.
  180. extern int SetStructString(void*, int, int, void*, int) "strucmem.dll";
  181.  
  182. // GetStructCharPointer()
  183. // Parameters:
  184. //     void*  -  Structure string
  185. //     int    -  Offset
  186. //     int    -  Length of data that is pointed to (0 if null terminated string)
  187. //     char*  -  Destination string
  188. //     int    -  Length of destination string
  189. // Return value:
  190. //     returns the number of bytes written to destination string.
  191. extern int GetStructCharPointer(void*, int, int, char*, int) "strucmem.dll";
  192.  
  193. // SetStructCharPointer()
  194. // Parameters:
  195. //     void*  -  Structure string
  196. //     int    -  Offset
  197. //     int    -  Length of structure string
  198. //     char*  -  Source string whose pointer is written to structure string
  199. // Return value:
  200. //     returns the number of bytes that were written to the
  201. //     structure string (should be 4).
  202. extern int SetStructCharPointer(void*, int, int, char*) "strucmem.dll" from "SetStructPointer";
  203.  
  204. // GetStructWCharPointer()
  205. // Parameters:
  206. //     void*  -  Structure string
  207. //     int    -  Offset
  208. //     int    -  Length of data that is pointed to (0 if null terminated string)
  209. //     void*  -  Destination string
  210. //     int    -  Length of destination string
  211. // Return value:
  212. //     returns the number of bytes written to destination string.
  213. extern int GetStructWCharPointer(void*, int, int, void*, int) "strucmem.dll" from "GetStructWCharPointer";
  214.  
  215. // GetStructVoidPointer()
  216. // Parameters:
  217. //     void*  -  Structure string
  218. //     int    -  Offset
  219. //     int    -  Length of data that is pointed to
  220. //     void*  -  Destination string
  221. //     int    -  Length of destination string
  222. // Return value:
  223. //     returns the number of bytes written to destination string.
  224. extern int GetStructVoidPointer(void*, int, int, void*, int) "strucmem.dll" from "GetStructCharPointer";
  225.  
  226. // SetStructVoidPointer()
  227. // Parameters:
  228. //     void*  -  Structure string
  229. //     int    -  Offset
  230. //     int    -  Length of structure string
  231. //     void*  -  Source string whose pointer is written to structure string
  232. // Return value:
  233. //     returns the number of bytes that were written to the
  234. //     structure string (should be 4).
  235. extern int SetStructVoidPointer(void*, int, int, void*) "strucmem.dll" from "SetStructPointer";
  236.  
  237. // ConvertToMultiByte()
  238. // Parameters:
  239. //     void*   -  Wide char string
  240. //     void*   -  Destination string buffer
  241. //     int     -  Length of destination string buffer (in bytes)
  242. // Return value:
  243. //     returns the number of bytes written to destination
  244. extern int ConvertToMultiByte(void*, void*, int) "strucmem.dll";
  245.  
  246. // ConvertToWideChar()
  247. // Parameters:
  248. //     void*   -  Multi byte string
  249. //     void*   -  Destination string buffer
  250. //     int     -  Length of destination string buffer (in bytes)
  251. // Return value:
  252. //     returns the number of bytes written to destination
  253. extern int ConvertToWideChar(void*, void*, int) "strucmem.dll";
  254.  
  255.  
  256.