Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

110 lines
2.9 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. TotalSiz.c
  5. Abstract:
  6. This module contains RapTotalSize.
  7. Author:
  8. John Rogers (JohnRo) 05-Jun-1991
  9. Environment:
  10. Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
  11. Requires ANSI C extensions: slash-slash comments, long external names.
  12. Revision History:
  13. 05-Jun-1991 JohnRo
  14. Created RapTotalSize().
  15. --*/
  16. // These must be included first:
  17. #include <windef.h> // IN, LPDWORD, NULL, OPTIONAL, DWORD, etc.
  18. #include <lmcons.h> // NET_API_STATUS
  19. // These may be included in any order:
  20. #include <lmerr.h>
  21. #include <netdebug.h> // NetpKdPrint(()), FORMAT_ equates.
  22. #include <rap.h> // My prototype, RapConvertSingleEntry(), etc.
  23. #include <rapdebug.h> // IF_DEBUG().
  24. DWORD
  25. RapTotalSize (
  26. IN LPBYTE InStructure,
  27. IN LPDESC InStructureDesc,
  28. IN LPDESC OutStructureDesc,
  29. IN BOOL MeaninglessInputPointers,
  30. IN RAP_TRANSMISSION_MODE TransmissionMode,
  31. IN RAP_CONVERSION_MODE ConversionMode
  32. )
  33. /*++
  34. Routine Description:
  35. This routine computes the total size (fixed and string) of a given
  36. structure.
  37. Arguments:
  38. InStructure - a pointer to the input structure.
  39. InStructureDesc - the descriptor string for the input structure.
  40. OutStructureDesc - the descriptor string for the output structure.
  41. (May be the same as input, in many cases.)
  42. MeaninglessInputPointers - if TRUE, then all pointers in the input
  43. structure are meaningless. This routine should assume that
  44. the first variable data immediately follows the input structure,
  45. and the rest of the variable data follows in order.
  46. Transmission Mode - Indicates whether this structure is part of a response,
  47. a request, or both.
  48. Conversion Mode - Indicates whether this is a RAP-to-native, native-to-RAP,
  49. or native-to-native conversion.
  50. Return Value:
  51. DWORD - number of bytes required for the structure
  52. --*/
  53. {
  54. NET_API_STATUS status;
  55. DWORD BytesRequired = 0;
  56. status = RapConvertSingleEntry (
  57. InStructure,
  58. InStructureDesc,
  59. MeaninglessInputPointers,
  60. NULL, // no output buffer start
  61. NULL, // no output buffer
  62. OutStructureDesc, // out desc (may be same as input)
  63. FALSE, // don't want offsets (doesn't matter)
  64. NULL, // no string location
  65. & BytesRequired, // size needed (updated)
  66. TransmissionMode,
  67. ConversionMode);
  68. NetpAssert( status == NERR_Success );
  69. IF_DEBUG(TOTALSIZ) {
  70. NetpKdPrint(("RapTotalSize: size is " FORMAT_DWORD ".\n",
  71. BytesRequired));
  72. }
  73. return (BytesRequired);
  74. }