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.

52 lines
969 B

  1. /*
  2. * S O F . C P P
  3. *
  4. * IStream on file implementation.
  5. *
  6. * Copyright 1986-1997 Microsoft Corporation, All Rights Reserved
  7. */
  8. #include "_davfs.h"
  9. #include "_sof.h"
  10. HRESULT STDMETHODCALLTYPE
  11. StmOnFile::Read (void __RPC_FAR * pb,
  12. ULONG cb,
  13. ULONG __RPC_FAR * pcb)
  14. {
  15. SCODE sc = S_OK;
  16. ULONG cbr;
  17. // Read from the file
  18. //
  19. if (!ReadFile (m_hf, pb, cb, &cbr, NULL))
  20. {
  21. DebugTrace ("StmOnFile: failed to read (%ld)\n", GetLastError());
  22. sc = HRESULT_FROM_WIN32 (GetLastError());
  23. }
  24. if (pcb)
  25. *pcb = cbr;
  26. return sc;
  27. }
  28. HRESULT STDMETHODCALLTYPE
  29. StmOnFile::Write (const void __RPC_FAR * pb,
  30. ULONG cb,
  31. ULONG __RPC_FAR * pcb)
  32. {
  33. SCODE sc = S_OK;
  34. ULONG cbw;
  35. // Write to the file
  36. //
  37. if (!WriteFile (m_hf, pb, cb, &cbw, NULL))
  38. {
  39. DebugTrace ("StmOnFile: failed to write (%ld)\n", GetLastError());
  40. sc = HRESULT_FROM_WIN32 (GetLastError());
  41. }
  42. if (pcb)
  43. *pcb = cbw;
  44. return sc;
  45. }