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.

108 lines
2.0 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997.
  5. //
  6. // File: N C B A S E . H
  7. //
  8. // Contents: Basic common code.
  9. //
  10. // Notes: Pollute this under penalty of death.
  11. //
  12. // Author: shaunco 20 Sep 1997
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. #ifndef _NCBASE_H_
  17. #define _NCBASE_H_
  18. #include "ncdefine.h" // for NOTHROW
  19. #include "ncstring.h" // For string functions
  20. #include <unknwn.h> // For IUnknown
  21. NOTHROW
  22. ULONG
  23. AddRefObj (
  24. IUnknown* punk);
  25. NOTHROW
  26. ULONG
  27. ReleaseObj (
  28. IUnknown* punk);
  29. #define SAFE_RELEASE(pObject) \
  30. if ((pObject) != NULL) \
  31. { \
  32. (pObject)->Release(); \
  33. (pObject) = NULL; \
  34. }
  35. NOTHROW
  36. DWORD
  37. DwWin32ErrorFromHr (
  38. HRESULT hr);
  39. inline
  40. BOOL
  41. FDwordWithinRange (
  42. DWORD dwLower,
  43. DWORD dw,
  44. DWORD dwUpper)
  45. {
  46. return ((dw >= dwLower) && (dw <= dwUpper));
  47. }
  48. NOTHROW
  49. HRESULT
  50. HrFromLastWin32Error ();
  51. HRESULT
  52. HrGetProcAddress (
  53. HMODULE hModule,
  54. PCSTR pszaFunction,
  55. FARPROC* ppfn);
  56. HRESULT
  57. HrLoadLibAndGetProcs (
  58. PCTSTR pszLibPath,
  59. UINT cFunctions,
  60. const PCSTR* apszaFunctionNames,
  61. HMODULE* phmod,
  62. FARPROC* apfn);
  63. inline
  64. HRESULT
  65. HrLoadLibAndGetProc (
  66. PCTSTR pszLibPath,
  67. PCSTR pszaFunctionName,
  68. HMODULE* phmod,
  69. FARPROC* ppfn)
  70. {
  71. return HrLoadLibAndGetProcs (pszLibPath, 1, &pszaFunctionName, phmod, ppfn);
  72. }
  73. HRESULT
  74. HrGetProcAddressesV(
  75. HMODULE hModule, ...);
  76. HRESULT
  77. HrLoadLibAndGetProcsV(
  78. PCTSTR pszLibPath,
  79. HMODULE* phModule,
  80. ...);
  81. HRESULT
  82. HrCreateEventWithWorldAccess(PCWSTR pszName, BOOL fManualReset,
  83. BOOL fInitialState, BOOL* pfAlreadyExists, HANDLE* phEvent);
  84. HRESULT
  85. HrCreateMutexWithWorldAccess(PCWSTR pszName, BOOL fInitialOwner,
  86. BOOL* pfAlreadyExists, HANDLE* phMutex);
  87. BOOL FFileExists(LPTSTR pszFileName, BOOL fDirectory);
  88. #endif // _NCBASE_H_