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.

89 lines
1.5 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. midluser.c
  5. Abstract:
  6. This file contains common functions and utilities that the API
  7. DLLs can use in making remote calls. This includes the
  8. MIDL_USER_ALLOCATE functions.
  9. Author:
  10. danl 02/06/1991
  11. Environment:
  12. User Level: Win32
  13. Revision History:
  14. --*/
  15. #include "precomp.h"
  16. PVOID
  17. MIDL_user_allocate(
  18. IN size_t NumBytes
  19. )
  20. /*++
  21. Routine Description:
  22. Allocates storage for RPC transactions. The RPC stubs will either call
  23. MIDL_user_allocate when it needs to un-marshall data into a buffer
  24. that the user must free. RPC servers will use MIDL_user_allocate to
  25. allocate storage that the RPC server stub will free after marshalling
  26. the data.
  27. Arguments:
  28. NumBytes - the number of bytes to allocate.
  29. Return Value:
  30. None.
  31. --*/
  32. {
  33. return (LocalAlloc(0,NumBytes));
  34. }
  35. VOID
  36. MIDL_user_free(
  37. IN void * MemPointer
  38. )
  39. /*++
  40. Routine Description:
  41. Frees storage used in RPC transactions. The RPC client can call this
  42. function to free buffer space that was allocated by the RPC client
  43. stub when un-marshalling data that is to be returned to the client.
  44. The Client calls MIDL_user_free when it is finished with the data and
  45. desires to free up the storage.
  46. The RPC server stub calls MIDL_user_free when it has completed
  47. marshalling server data that is to be passed back to the client.
  48. Arguments:
  49. MemPointer - pointer to the memory block that is to be released.
  50. Return Value:
  51. None.
  52. --*/
  53. {
  54. LocalFree(MemPointer);
  55. }