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.

145 lines
4.6 KiB

  1. /*
  2. * shlvalid.c - Shell validation functions module.
  3. */
  4. /* Headers
  5. **********/
  6. #include "project.h"
  7. #pragma hdrstop
  8. #include "olestock.h"
  9. #include "olevalid.h"
  10. #include "shlstock.h"
  11. #include "shlvalid.h"
  12. #ifdef DEBUG
  13. /****************************** Public Functions *****************************/
  14. PUBLIC_CODE BOOL IsValidPCIExtractIcon(PCIExtractIcon pciei)
  15. {
  16. return(IS_VALID_READ_PTR(pciei, CIExtractIcon) &&
  17. IS_VALID_INTERFACE_PTR((PCIUnknown)pciei, IUnknown) &&
  18. IS_VALID_METHOD(pciei, GetIconLocation) &&
  19. IS_VALID_METHOD(pciei, Extract));
  20. }
  21. PUBLIC_CODE BOOL IsValidPCINewShortcutHook(PCINewShortcutHook pcinshhk)
  22. {
  23. return(IS_VALID_READ_PTR(pcinshhk, CINewShortcutHook) &&
  24. IS_VALID_INTERFACE_PTR((PCIUnknown)pcinshhk, IUnknown) &&
  25. IS_VALID_METHOD(pcinshhk, SetReferent) &&
  26. IS_VALID_METHOD(pcinshhk, GetReferent) &&
  27. IS_VALID_METHOD(pcinshhk, SetFolder) &&
  28. IS_VALID_METHOD(pcinshhk, GetFolder) &&
  29. IS_VALID_METHOD(pcinshhk, GetName) &&
  30. IS_VALID_METHOD(pcinshhk, GetExtension));
  31. }
  32. PUBLIC_CODE BOOL IsValidPCIShellExecuteHook(PCIShellExecuteHook pciseh)
  33. {
  34. return(IS_VALID_READ_PTR(pciseh, CIShellExecuteHook) &&
  35. IS_VALID_INTERFACE_PTR((PCIUnknown)pciseh, IUnknown) &&
  36. IS_VALID_METHOD(pciseh, Execute));
  37. }
  38. PUBLIC_CODE BOOL IsValidPCIShellExtInit(PCIShellExtInit pcisei)
  39. {
  40. return(IS_VALID_READ_PTR(pcisei, CIShellExtInit) &&
  41. IS_VALID_INTERFACE_PTR((PCIUnknown)pcisei, IUnknown) &&
  42. IS_VALID_METHOD(pcisei, Initialize));
  43. }
  44. PUBLIC_CODE BOOL IsValidPCIShellLink(PCIShellLink pcisl)
  45. {
  46. return(IS_VALID_READ_PTR(pcisl, CIShellLink) &&
  47. IS_VALID_READ_PTR(pcisl->lpVtbl, sizeof(*(pcisl->lpVtbl))) &&
  48. IS_VALID_INTERFACE_PTR((PCIUnknown)pcisl, IUnknown) &&
  49. IS_VALID_METHOD(pcisl, SetPath) &&
  50. IS_VALID_METHOD(pcisl, GetPath) &&
  51. IS_VALID_METHOD(pcisl, SetRelativePath) &&
  52. IS_VALID_METHOD(pcisl, SetIDList) &&
  53. IS_VALID_METHOD(pcisl, GetIDList) &&
  54. IS_VALID_METHOD(pcisl, SetDescription) &&
  55. IS_VALID_METHOD(pcisl, GetDescription) &&
  56. IS_VALID_METHOD(pcisl, SetArguments) &&
  57. IS_VALID_METHOD(pcisl, GetArguments) &&
  58. IS_VALID_METHOD(pcisl, SetWorkingDirectory) &&
  59. IS_VALID_METHOD(pcisl, GetWorkingDirectory) &&
  60. IS_VALID_METHOD(pcisl, SetHotkey) &&
  61. IS_VALID_METHOD(pcisl, GetHotkey) &&
  62. IS_VALID_METHOD(pcisl, SetShowCmd) &&
  63. IS_VALID_METHOD(pcisl, GetShowCmd) &&
  64. IS_VALID_METHOD(pcisl, SetIconLocation) &&
  65. IS_VALID_METHOD(pcisl, GetIconLocation) &&
  66. IS_VALID_METHOD(pcisl, Resolve));
  67. }
  68. PUBLIC_CODE BOOL IsValidPCIShellPropSheetExt(PCIShellPropSheetExt pcispse)
  69. {
  70. return(IS_VALID_READ_PTR(pcispse, CIShellPropSheetExt) &&
  71. IS_VALID_INTERFACE_PTR((PCIUnknown)pcispse, IUnknown) &&
  72. IS_VALID_METHOD(pcispse, AddPages) &&
  73. IS_VALID_METHOD(pcispse, ReplacePage));
  74. }
  75. PUBLIC_CODE BOOL IsValidPCITEMIDLIST(PCITEMIDLIST pcidl)
  76. {
  77. /* FEATURE: Fill me in. */
  78. return(IS_VALID_READ_PTR(pcidl, CITEMIDLIST));
  79. }
  80. PUBLIC_CODE BOOL IsValidPCPROPSHEETPAGE(PCPROPSHEETPAGE pcpsp)
  81. {
  82. /* FEATURE: Fill me in. */
  83. return(IS_VALID_READ_PTR(pcpsp, CPROPSHEETPAGE));
  84. }
  85. PUBLIC_CODE BOOL IsValidPCSHELLEXECUTEINFO(PCSHELLEXECUTEINFO pcei)
  86. {
  87. /* hInstApp may be any value. */
  88. /* dwHotKey may be any value. */
  89. return(IS_VALID_READ_PTR(pcei, CSHELLEXECUTEINFO) &&
  90. pcei->cbSize >= sizeof(*pcei) &&
  91. FLAGS_ARE_VALID(pcei->fMask, SEE_MASK_VALID) &&
  92. (! pcei->hwnd ||
  93. IS_VALID_HANDLE(pcei->hwnd, WND)) &&
  94. (! pcei->lpVerb ||
  95. IS_VALID_STRING_PTR(pcei->lpVerb, CSTR)) &&
  96. (! pcei->lpFile ||
  97. IS_VALID_STRING_PTR(pcei->lpFile, CSTR)) &&
  98. (! pcei->lpParameters ||
  99. IS_VALID_STRING_PTR(pcei->lpParameters, CSTR)) &&
  100. (! pcei->lpDirectory ||
  101. IS_VALID_STRING_PTR(pcei->lpDirectory, CSTR)) &&
  102. EVAL(IsValidShowCmd(pcei->nShow)) &&
  103. (IS_FLAG_CLEAR(pcei->fMask, SEE_MASK_IDLIST) ||
  104. IS_VALID_STRUCT_PTR(pcei->lpIDList, CITEMIDLIST)) &&
  105. ((pcei->fMask & SEE_MASK_CLASSKEY) == SEE_MASK_CLASSKEY ||
  106. IS_FLAG_CLEAR(pcei->fMask, SEE_MASK_CLASSNAME) ||
  107. IS_VALID_STRING_PTR(pcei->lpClass, CSTR)) &&
  108. (IS_FLAG_CLEAR(pcei->fMask, SEE_MASK_CLASSKEY) ||
  109. IS_VALID_HANDLE(pcei->hkeyClass, KEY)) &&
  110. (! pcei->hIcon ||
  111. IS_VALID_HANDLE(pcei->hIcon, ICON)) &&
  112. (! pcei->hProcess ||
  113. IS_VALID_HANDLE(pcei->hProcess, PROCESS)));
  114. }
  115. #endif /* DEBUG */