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.

38 lines
744 B

  1. #include "pch.h"
  2. #pragma hdrstop
  3. #include "mod.h"
  4. #include "ncstring.h"
  5. //static
  6. HRESULT
  7. CModule::HrCreateInstance (
  8. IN PCSTR pszFileName,
  9. IN ULONG cbFileSize,
  10. OUT CModule** ppMod)
  11. {
  12. HRESULT hr;
  13. ULONG cbFileName;
  14. CModule* pMod;
  15. Assert (pszFileName && *pszFileName);
  16. Assert (ppMod);
  17. cbFileName = CbOfSzaAndTerm (pszFileName);
  18. hr = E_OUTOFMEMORY;
  19. pMod = new(extrabytes, cbFileName) CModule;
  20. if (pMod)
  21. {
  22. hr = S_OK;
  23. ZeroMemory (pMod, sizeof(CModule));
  24. pMod->m_pszFileName = (PSTR)(pMod + 1);
  25. strcpy (pMod->m_pszFileName, pszFileName);
  26. pMod->m_cbFileSize = cbFileSize;
  27. }
  28. *ppMod = pMod;
  29. return hr;
  30. }