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.

32 lines
1.1 KiB

  1. #include <precomp.h>
  2. //------------------------------------
  3. // Allocates storage for RPC transactions. The RPC stubs will either call
  4. // MIDL_user_allocate when it needs to un-marshall data into a buffer
  5. // that the user must free. RPC servers will use MIDL_user_allocate to
  6. // allocate storage that the RPC server stub will free after marshalling
  7. // the data.
  8. PVOID
  9. MIDL_user_allocate(IN size_t NumBytes)
  10. {
  11. PVOID pMem;
  12. pMem = (NumBytes > 0) ? LocalAlloc(LMEM_ZEROINIT,NumBytes) : NULL;
  13. return pMem;
  14. }
  15. //------------------------------------
  16. // Frees storage used in RPC transactions. The RPC client can call this
  17. // function to free buffer space that was allocated by the RPC client
  18. // stub when un-marshalling data that is to be returned to the client.
  19. // The Client calls MIDL_user_free when it is finished with the data and
  20. // desires to free up the storage.
  21. // The RPC server stub calls MIDL_user_free when it has completed
  22. // marshalling server data that is to be passed back to the client.
  23. VOID
  24. MIDL_user_free(IN LPVOID MemPointer)
  25. {
  26. if (MemPointer != NULL)
  27. LocalFree(MemPointer);
  28. }