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.

103 lines
1.9 KiB

  1. /*++
  2. Copyright (c) 1990,91 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. Dan Lafferty danl 06-Feb-1991
  11. Environment:
  12. User Mode - Win32
  13. Revision History:
  14. 06-Feb-1991 danl
  15. Created
  16. 25-Apr-1991 JohnRo
  17. Split out MIDL user (allocate,free) into seperate source file, so
  18. linker doesn't get confused.
  19. --*/
  20. #include "precomp.h"
  21. #pragma hdrstop
  22. #include "client.h"
  23. PVOID
  24. MIDL_user_allocate (
  25. IN size_t NumBytes
  26. )
  27. /*++
  28. Routine Description:
  29. Allocates storage for RPC transactions. The RPC stubs will either call
  30. MIDL_user_allocate when it needs to un-marshall data into a buffer
  31. that the user must free. RPC servers will use MIDL_user_allocate to
  32. allocate storage that the RPC server stub will free after marshalling
  33. the data.
  34. Arguments:
  35. NumBytes - The number of bytes to allocate.
  36. Return Value:
  37. none
  38. Note:
  39. --*/
  40. {
  41. return (LocalAlloc(0,NumBytes));
  42. }
  43. VOID
  44. MIDL_user_free (
  45. IN void *MemPointer
  46. )
  47. /*++
  48. Routine Description:
  49. Frees storage used in RPC transactions. The RPC client can call this
  50. function to free buffer space that was allocated by the RPC client
  51. stub when un-marshalling data that is to be returned to the client.
  52. The Client calls MIDL_user_free when it is finished with the data and
  53. desires to free up the storage.
  54. The RPC server stub calls MIDL_user_free when it has completed
  55. marshalling server data that is to be passed back to the client.
  56. Arguments:
  57. MemPointer - This points to the memory block that is to be released.
  58. Return Value:
  59. none.
  60. Note:
  61. --*/
  62. {
  63. LocalFree(MemPointer);
  64. }