Source code of Windows XP (NT5)
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.

103 lines
1.9 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. rpcclimm.c
  5. Abstract:
  6. LSA - Client RPC Memory Management Routines
  7. NOTE: These routines use windows API, so are different from
  8. their server counterparts.
  9. Author:
  10. Scott Birrell (ScottBi) May 1, 1991
  11. Environment:
  12. Revision History:
  13. --*/
  14. #include "lsaclip.h"
  15. /*
  16. #include <nt.h> // DbgPrint prototype
  17. #include <ntrtl.h> // DbgPrint prototype
  18. #include <rpc.h> // DataTypes and runtime APIs
  19. #include <lsarpc.h> // generated by the MIDL complier
  20. #include <nturtl.h> // needed for windows.h
  21. #include <windows.h> // LocalAlloc
  22. #include <string.h> // for strcpy strcat strlen memcmp
  23. */
  24. PVOID
  25. MIDL_user_allocate (
  26. unsigned int NumBytes
  27. )
  28. /*++
  29. Routine Description:
  30. Allocates storage for RPC server transactions. The RPC stubs will
  31. either call MIDL_user_allocate when it needs to un-marshall data into a
  32. buffer that the user must free. RPC servers will use MIDL_user_allocate to
  33. allocate storage that the RPC server stub will free after marshalling
  34. the data.
  35. Arguments:
  36. NumBytes - The number of bytes to allocate.
  37. Return Value:
  38. none
  39. Note:
  40. --*/
  41. {
  42. return (LocalAlloc(LMEM_FIXED,NumBytes));
  43. }
  44. VOID
  45. MIDL_user_free (
  46. void *MemPointer
  47. )
  48. /*++
  49. Routine Description:
  50. Frees storage used in RPC transactions. The RPC client can call this
  51. function to free buffer space that was allocated by the RPC client
  52. stub when un-marshalling data that is to be returned to the client.
  53. The Client calls MIDL_user_free when it is finished with the data and
  54. desires to free up the storage.
  55. The RPC server stub calls MIDL_user_free when it has completed
  56. marshalling server data that is to be passed back to the client.
  57. Arguments:
  58. MemPointer - This points to the memory block that is to be released.
  59. Return Value:
  60. none.
  61. Note:
  62. --*/
  63. {
  64. LocalFree(MemPointer);
  65. }
  66.