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.

167 lines
4.4 KiB

  1. #include "pch.h"
  2. #pragma hdrstop
  3. /*-----------------------------------------------------------------------------
  4. / Local functions / data
  5. /----------------------------------------------------------------------------*/
  6. static WCHAR c_szQueryPrefix[] = L"(uncName=*)(objectCategory=volume)";
  7. static LPWSTR c_szClassList[] =
  8. {
  9. L"volume",
  10. };
  11. static PAGECTRL ctrls[] =
  12. {
  13. IDC_VOLNAME, c_szName, FILTER_CONTAINS,
  14. IDC_VOLKEYWORDS, c_szKeywords, FILTER_CONTAINS,
  15. };
  16. static COLUMNINFO columns[] =
  17. {
  18. 0, 0, IDS_CN, 0, c_szName,
  19. 0, 0, IDS_UNCNAME, 0, c_szUNCName,
  20. 0, 0, IDS_KEYWORDS, 0, c_szKeywords,
  21. };
  22. //
  23. // Control help meppings
  24. //
  25. static DWORD const aFormHelpIDs[] =
  26. {
  27. IDC_VOLNAME, IDH_SHARED_FOLDER_NAMED,
  28. IDC_VOLKEYWORDS, IDH_KEYWORDS,
  29. 0, 0
  30. };
  31. /*-----------------------------------------------------------------------------
  32. / PageProc_Volume
  33. / ---------------
  34. / PageProc for handling the messages for this object.
  35. /
  36. / In:
  37. / pForm -> instance data for this form
  38. / hwnd = window handle for the form dialog
  39. / uMsg, wParam, lParam = message parameters
  40. /
  41. / Out:
  42. / HRESULT (E_NOTIMPL) if not handled
  43. /----------------------------------------------------------------------------*/
  44. HRESULT CALLBACK PageProc_Volume(LPCQPAGE pForm, HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
  45. {
  46. HRESULT hr = S_OK;
  47. LPWSTR pQuery = NULL;
  48. TraceEnter(TRACE_FORMS, "PageProc_Volume");
  49. switch ( uMsg )
  50. {
  51. case CQPM_INITIALIZE:
  52. case CQPM_RELEASE:
  53. break;
  54. case CQPM_ENABLE:
  55. EnablePageControls(hwnd, ctrls, ARRAYSIZE(ctrls), (BOOL)wParam);
  56. break;
  57. case CQPM_GETPARAMETERS:
  58. {
  59. hr = GetQueryString(&pQuery, c_szQueryPrefix, hwnd, ctrls, ARRAYSIZE(ctrls));
  60. if ( SUCCEEDED(hr) )
  61. {
  62. hr = QueryParamsAlloc((LPDSQUERYPARAMS*)lParam, pQuery, GLOBAL_HINSTANCE, ARRAYSIZE(columns), columns);
  63. LocalFreeStringW(&pQuery);
  64. }
  65. FailGracefully(hr, "Failed to build DS argument block");
  66. break;
  67. }
  68. case CQPM_CLEARFORM:
  69. ResetPageControls(hwnd, ctrls, ARRAYSIZE(ctrls));
  70. break;
  71. case CQPM_PERSIST:
  72. {
  73. BOOL fRead = (BOOL)wParam;
  74. IPersistQuery* pPersistQuery = (IPersistQuery*)lParam;
  75. hr = PersistQuery(pPersistQuery, fRead, c_szMsVolume, hwnd, ctrls, ARRAYSIZE(ctrls));
  76. FailGracefully(hr, "Failed to persist page");
  77. break;
  78. }
  79. case CQPM_HELP:
  80. {
  81. LPHELPINFO pHelpInfo = (LPHELPINFO)lParam;
  82. WinHelp((HWND)pHelpInfo->hItemHandle,
  83. DSQUERY_HELPFILE,
  84. HELP_WM_HELP,
  85. (DWORD_PTR)aFormHelpIDs);
  86. break;
  87. }
  88. case DSQPM_GETCLASSLIST:
  89. {
  90. hr = ClassListAlloc((LPDSQUERYCLASSLIST*)lParam, c_szClassList, ARRAYSIZE(c_szClassList));
  91. FailGracefully(hr, "Failed to allocate class list");
  92. break;
  93. }
  94. case DSQPM_HELPTOPICS:
  95. {
  96. HWND hwndFrame = (HWND)lParam;
  97. HtmlHelp(hwndFrame, TEXT("omc.chm"), HH_HELP_FINDER, 0);
  98. break;
  99. }
  100. default:
  101. hr = E_NOTIMPL;
  102. break;
  103. }
  104. exit_gracefully:
  105. TraceLeaveResult(hr);
  106. }
  107. /*-----------------------------------------------------------------------------
  108. / DlgProc_Volume
  109. / --------------
  110. / Handle dialog specific message for the volume page.
  111. /
  112. / In:
  113. / hwnd, uMsg, wParam, lParam = standard parameters
  114. /
  115. / Out:
  116. / INT_PTR
  117. /----------------------------------------------------------------------------*/
  118. INT_PTR CALLBACK DlgProc_Volume(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
  119. {
  120. INT_PTR fResult = 0;
  121. LPCQPAGE pQueryPage;
  122. if ( uMsg == WM_INITDIALOG )
  123. {
  124. pQueryPage = (LPCQPAGE)lParam;
  125. SetWindowLongPtr(hwnd, DWLP_USER, (LONG_PTR)pQueryPage);
  126. Edit_LimitText(GetDlgItem(hwnd, IDC_VOLNAME), MAX_PATH);
  127. Edit_LimitText(GetDlgItem(hwnd, IDC_VOLKEYWORDS), MAX_PATH);
  128. }
  129. else if ( uMsg == WM_CONTEXTMENU )
  130. {
  131. WinHelp((HWND)wParam, DSQUERY_HELPFILE, HELP_CONTEXTMENU, (DWORD_PTR)aFormHelpIDs);
  132. fResult = TRUE;
  133. }
  134. return fResult;
  135. }