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.

61 lines
1.4 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. filestream.cpp
  5. Abstract:
  6. Minimal implementation of IStream over a Windows PE/COFF resource.
  7. Author:
  8. Jay Krell (a-JayK) May 2000
  9. Revision History:
  10. --*/
  11. #pragma once
  12. #include "CMemoryStream.h"
  13. #include "FusionHandle.h"
  14. #include "sxsp.h"
  15. class CResourceStream : public CMemoryStream
  16. {
  17. typedef CMemoryStream Base;
  18. public:
  19. SMARTTYPEDEF(CResourceStream);
  20. CResourceStream() { }
  21. // NOTE the order of type/name is 1) as you might expect 2) consistent with
  22. // FindResourceEx, 3) INconsistent with FindResource
  23. // RT_* are actually of type PCWSTR
  24. BOOL Initialize(PCWSTR file, PCWSTR type, PCWSTR name, WORD language = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL));
  25. BOOL Initialize(PCWSTR file, PCWSTR type);
  26. /*
  27. feel free to add more overloads that take, say
  28. HMODULE, HRSRC, HGLOBAL
  29. */
  30. // Override so that we can get times from the open file...
  31. HRESULT __stdcall Stat(STATSTG *pstatstg, DWORD grfStatFlag);
  32. virtual ~CResourceStream() { }
  33. private: // intentionally not implemented
  34. CResourceStream(const CResourceStream&);
  35. void operator=(const CResourceStream&);
  36. BOOL InitializeAlreadyOpen(
  37. PCWSTR type,
  38. PCWSTR name,
  39. WORD language = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL)
  40. );
  41. CDynamicLinkLibrary m_dll;
  42. CStringBuffer m_buffFilePath;
  43. };
  44. SMARTTYPE(CResourceStream);