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.

775 lines
22 KiB

  1. /*++
  2. Copyright (c) 1994 Microsoft Corporation
  3. Module Name:
  4. FindClnt.C
  5. Abstract:
  6. Displays the Searching for clients dialog box and looks for the selected
  7. client distribution tree returning the path and type of path found.
  8. Author:
  9. Bob Watson (a-robw)
  10. Revision History:
  11. 24 Jun 94 Written
  12. --*/
  13. //
  14. // Windows Include Files
  15. //
  16. #include <windows.h>
  17. #include <stdio.h>
  18. #include <malloc.h>
  19. #include <tchar.h> // unicode macros
  20. #include <lmcons.h> // lanman API constants
  21. #include <lmerr.h> // lanman error returns
  22. #include <lmshare.h> // sharing API prototypes
  23. #include <lmapibuf.h> // lanman buffer API prototypes
  24. //
  25. // app include files
  26. //
  27. #include "otnboot.h"
  28. #include "otnbtdlg.h"
  29. //
  30. // local dialog box messages
  31. //
  32. #define NCDU_SEARCH_FOR_CLIENTS (WM_USER+101)
  33. //
  34. // Search Phases
  35. #define SEARCH_REGISTRY (0x00000001)
  36. #define SEARCH_SHARED_DIRS (0x00000002)
  37. #define SEARCH_HARD_DRIVES (0x00000004)
  38. #define SEARCH_CD_ROM (0x00000008)
  39. #define SEARCH_LAST_PHASE SEARCH_CD_ROM
  40. //
  41. // module static variables
  42. //
  43. static BOOL bSearchForClients; // flag to trip out of search
  44. static HCURSOR hOrigCursor = NULL; // cursor to save/restore
  45. LONG
  46. GetDistributionPath (
  47. IN HWND hwndDlg, // handle to dialog box window
  48. IN DWORD dwSearchType, // type of dir to find: Client/tools
  49. IN OUT LPTSTR szPath, // buffer to return path in (Req'd)
  50. IN DWORD dwPathLen, // size of path buffer in chars
  51. IN PLONG plPathType // pointer to buffer recieving path type (opt)
  52. )
  53. /*++
  54. Routine Description:
  55. Gets the default distribution file path for loading the dialog box
  56. entries with.
  57. Arguments:
  58. IN HWND hwndDlg
  59. handle to parent dialog box window
  60. IN DWORD dwSearchType
  61. type of dir to find: Client/tools
  62. IN OUT LPTSTR szPath
  63. buffer to return path in (Req'd)
  64. IN DWORD dwPathLen
  65. size of path buffer in chars
  66. IN PLONG plPathType
  67. pointer to buffer recieving path type (opt)
  68. Return Value:
  69. ERROR_SUCCESS if file found
  70. ERROR_FILE_NOT_FOUND if unable to find file
  71. --*/
  72. {
  73. FDT_DATA Fdt;
  74. UINT nDBReturn;
  75. // build data structure for search
  76. Fdt.szPathBuffer = szPath;
  77. Fdt.dwPathBufferLen = dwPathLen;
  78. Fdt.plPathType = plPathType;
  79. Fdt.dwSearchType = dwSearchType;
  80. nDBReturn = (UINT)DialogBoxParam (
  81. (HINSTANCE)GetWindowLongPtr(hwndDlg, GWLP_HINSTANCE),
  82. MAKEINTRESOURCE(NCDU_FINDING_CLIENT_DIRS_DLG),
  83. hwndDlg,
  84. FindClientsDlgProc,
  85. (LPARAM)&Fdt);
  86. if (nDBReturn == IDOK) {
  87. return ERROR_SUCCESS;
  88. } else {
  89. return ERROR_FILE_NOT_FOUND;
  90. }
  91. }
  92. static
  93. LPCTSTR
  94. GetLastPathFromRegistry (
  95. IN DWORD dwSearchType
  96. )
  97. /*++
  98. Routine Description:
  99. looks up the last path (server\share) for either the tools directory
  100. or the client tree as it appears in the registry. If unable to
  101. find both components of the selected search, then an empty string
  102. is returned.
  103. Arguments:
  104. IN DWORD dwSearchType
  105. FDT_TOOLS_TREE for server tools path
  106. FDT_CLIENT_TREE for client distribution path
  107. Return Value:
  108. pointer to a read only string that contains the desired path if
  109. one was stored in the registry or an empty string if not.
  110. --*/
  111. {
  112. static TCHAR szLastPath[MAX_PATH];
  113. HKEY hkeyUserInfo;
  114. HKEY hkeyAppInfo;
  115. LONG lStatus;
  116. DWORD dwBufLen;
  117. // open registry key containing net apps
  118. lStatus = RegOpenKeyEx (
  119. HKEY_CURRENT_USER,
  120. cszUserInfoKey,
  121. 0L,
  122. KEY_READ,
  123. &hkeyUserInfo);
  124. if (lStatus != ERROR_SUCCESS) {
  125. // unable to open key so return an empty buffer
  126. szLastPath[0] = 0;
  127. } else {
  128. // open registry key containing this app's info
  129. lStatus = RegOpenKeyEx (
  130. hkeyUserInfo,
  131. szAppName,
  132. 0L,
  133. KEY_READ,
  134. &hkeyAppInfo);
  135. if (lStatus != ERROR_SUCCESS) {
  136. // unable to open key so return an empty buffer
  137. szLastPath[0] = 0;
  138. } else {
  139. // initialize path variable
  140. lstrcpy (szLastPath, cszDoubleBackslash);
  141. // get server name from registry
  142. dwBufLen = MAX_COMPUTERNAME_LENGTH + 1;
  143. lStatus = RegQueryValueEx (
  144. hkeyAppInfo,
  145. (LPTSTR)(dwSearchType == FDT_TOOLS_TREE ? cszLastToolsServer : cszLastClientServer),
  146. (LPDWORD)NULL,
  147. (LPDWORD)NULL,
  148. (LPBYTE)&szLastPath[lstrlen(szLastPath)],
  149. &dwBufLen);
  150. if (lStatus != ERROR_SUCCESS) {
  151. // unable to read value so return an empty buffer
  152. szLastPath[0] = 0;
  153. } else {
  154. // get sharepoint name from registry
  155. lstrcat (szLastPath, cszBackslash);
  156. dwBufLen = MAX_SHARENAME + 1;
  157. lStatus = RegQueryValueEx (
  158. hkeyAppInfo,
  159. (LPTSTR)(dwSearchType == FDT_TOOLS_TREE ? cszLastToolsSharepoint : cszLastClientSharepoint),
  160. (LPDWORD)NULL,
  161. (LPDWORD)NULL,
  162. (LPBYTE)&szLastPath[lstrlen(szLastPath)],
  163. &dwBufLen);
  164. if (lStatus != ERROR_SUCCESS) {
  165. // unable to read value so return an empty buffer
  166. szLastPath[0] = 0;
  167. }
  168. }
  169. RegCloseKey (hkeyAppInfo);
  170. }
  171. RegCloseKey (hkeyUserInfo);
  172. }
  173. return (LPCTSTR)&szLastPath[0];
  174. }
  175. static
  176. LONG
  177. SearchForDistPath (
  178. IN OUT LPTSTR szPath, // buffer to return path in (Req'd)
  179. IN DWORD dwPathLen, // size of path buffer in chars
  180. IN PLONG plPathType, // pointer to buffer recieving path type (opt)
  181. IN DWORD dwSearchType, // type of tree to look for
  182. IN DWORD dwPhase // phase(s) to search
  183. )
  184. /*++
  185. Routine Description:
  186. function that looks for the desired directory tree in the following
  187. locations:
  188. a) the registry, for the stored server\share
  189. b) the shared directories on the system
  190. c) the local and redirected drives
  191. d) the CD-Rom
  192. The search is divided into phases to allow the user to cancel the
  193. search.
  194. Arguments:
  195. IN OUT LPTSTR szPath, // buffer to return path in (Req'd)
  196. IN DWORD dwPathLen, // size of path buffer in chars
  197. IN PLONG plPathType, // pointer to buffer recieving path type (opt)
  198. IN DWORD dwSearchType, // type of tree to look for
  199. IN DWORD dwPhase // phase(s) to search
  200. Return Value:
  201. ERROR_SUCCESS
  202. --*/
  203. {
  204. LONG lStatus = ERROR_SUCCESS;
  205. LONG lPathType = NCDU_NO_CLIENT_PATH_FOUND;
  206. LPTSTR szLocalPath = NULL;
  207. NET_API_STATUS naStatus = NERR_Success;
  208. DWORD dwTotalEntries;
  209. DWORD dwEntriesRead;
  210. DWORD dwEntriesProcessed;
  211. DWORD dwResumeHandle;
  212. DWORD dwIndex;
  213. DWORD dwBufLen;
  214. BOOL bFound;
  215. UINT nDriveType;
  216. TCHAR szRootDir[32];
  217. PSHARE_INFO_2 psi2Data;
  218. UINT nErrorMode;
  219. BOOL bValidPath;
  220. if (szPath == NULL) {
  221. // the pointer to the path is required
  222. return ERROR_INVALID_PARAMETER;
  223. }
  224. // allocate temp buffers
  225. szLocalPath = GlobalAlloc (GPTR, MAX_PATH_BYTES);
  226. if (szLocalPath == NULL) {
  227. return ERROR_OUTOFMEMORY;
  228. }
  229. // disable windows error message popup
  230. nErrorMode = SetErrorMode (SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
  231. bFound = FALSE;
  232. if ((dwPhase & SEARCH_REGISTRY) == SEARCH_REGISTRY) {
  233. // check registry for saved server/sharepoint
  234. // if server/share found in registry, make into a UNC path
  235. // and validate that it's really a client tree. return path if valid
  236. lstrcpy (szLocalPath, GetLastPathFromRegistry(dwSearchType));
  237. if (szLocalPath[lstrlen(szLocalPath)] != cBackslash) lstrcat (szLocalPath, cszBackslash);
  238. if (dwSearchType == FDT_TOOLS_TREE){
  239. bValidPath = (BOOL)(ValidSrvToolsPath (szLocalPath) == 0);
  240. } else {
  241. bValidPath = (BOOL)(ValidSharePath (szLocalPath) == 0);
  242. }
  243. if (bValidPath) {
  244. // it's there so save it in user's buffer and leave
  245. lstrcpy (szPath, szLocalPath);
  246. lPathType = NCDU_PATH_FROM_REGISTRY;
  247. lStatus = ERROR_SUCCESS;
  248. goto GDP_ExitPoint;
  249. }
  250. }
  251. if ((dwPhase & SEARCH_SHARED_DIRS) == SEARCH_SHARED_DIRS) {
  252. // if here, then no valid server/share was found in registry, so
  253. // look at shared dir's on this machine and see if any of them are
  254. // valid client trees. If one is found, return the path in UNC form
  255. // search all current shares on this system
  256. dwEntriesProcessed = 0;
  257. dwEntriesRead = 0;
  258. dwTotalEntries = 0;
  259. dwResumeHandle = 0;
  260. while ((naStatus = NetShareEnum(
  261. NULL,
  262. 2,
  263. (LPBYTE *)&psi2Data,
  264. 0x00010000,
  265. &dwEntriesRead,
  266. &dwTotalEntries,
  267. &dwResumeHandle)) == NERR_Success) {
  268. if (dwEntriesRead == 0) break; // then it'd done
  269. for (dwIndex = 0; dwIndex < dwEntriesRead; dwIndex++){
  270. // don't check shares that translate to floppy drives A: & B:
  271. if ((_tcsnicmp(psi2Data[dwIndex].shi2_path, cszADriveRoot, 3) != 0) &&
  272. (_tcsnicmp(psi2Data[dwIndex].shi2_path, cszBDriveRoot, 3) != 0)) {
  273. if (dwSearchType == FDT_TOOLS_TREE){
  274. bValidPath = (BOOL)(ValidSrvToolsPath (psi2Data[dwIndex].shi2_path) == 0);
  275. } else {
  276. bValidPath = (BOOL)(ValidSharePath (psi2Data[dwIndex].shi2_path) == 0);
  277. }
  278. if (bValidPath) {
  279. // make a UNC name out of share name
  280. lstrcpy (szLocalPath, cszDoubleBackslash);
  281. dwBufLen = MAX_COMPUTERNAME_LENGTH+1;
  282. GetComputerName (&szLocalPath[2], &dwBufLen);
  283. lstrcat (szLocalPath, cszBackslash);
  284. lstrcat (szLocalPath, psi2Data[dwIndex].shi2_netname);
  285. lstrcat (szLocalPath, cszBackslash);
  286. if (lstrlen(szLocalPath) < (LONG)dwPathLen) {
  287. // save path string in user's buffer and leave
  288. lstrcpy (szPath, szLocalPath);
  289. lPathType = NCDU_LOCAL_SHARE_PATH;
  290. lStatus = ERROR_SUCCESS;
  291. bFound = TRUE;
  292. }
  293. break;
  294. }
  295. }
  296. }
  297. // free buffer created by Net API
  298. if (psi2Data != NULL) NetApiBufferFree (psi2Data);
  299. // update entry counters to know when to stop looping
  300. dwEntriesProcessed += dwEntriesRead;
  301. if ((dwEntriesProcessed >= dwTotalEntries) || bFound) {
  302. break; // out of while loop
  303. }
  304. }
  305. if (bFound) goto GDP_ExitPoint;
  306. }
  307. if ((dwPhase & SEARCH_HARD_DRIVES) == SEARCH_HARD_DRIVES) {
  308. // if here, then no shared path was found, so search hard drives for
  309. // a client tree in the root directory and return the DOS path if one
  310. // is found
  311. szRootDir[0] = 0;
  312. szRootDir[1] = cColon;
  313. szRootDir[2] = cBackslash;
  314. szRootDir[3] = 0;
  315. for (szRootDir[0] = cC; szRootDir[0] <= cZ; szRootDir[0]++) {
  316. // if it's local or remote drive look for a clients dir.
  317. // don't check CD_ROM, RAM Disks or Removable drive
  318. nDriveType = GetDriveType(szRootDir);
  319. if ((nDriveType == DRIVE_FIXED) || (nDriveType == DRIVE_REMOTE)) {
  320. // see if this is drive has the appropriate sub-dir on it
  321. if (dwSearchType == FDT_TOOLS_TREE){
  322. lstrcpy (&szRootDir[3], cszToolsDir);
  323. bValidPath = (BOOL)(ValidSrvToolsPath (szRootDir) == 0);
  324. } else {
  325. lstrcpy (&szRootDir[3], cszClientsDir);
  326. bValidPath = (BOOL)(ValidSharePath (szRootDir) == 0);
  327. }
  328. if (bValidPath) {
  329. // a valid path was found
  330. if (nDriveType == DRIVE_REMOTE) {
  331. // then this drive is shared on another machine
  332. // so return the UNC version of the path
  333. dwBufLen = MAX_PATH * sizeof(TCHAR);
  334. if (LookupRemotePath (szRootDir, szLocalPath, &dwBufLen)) {
  335. // save path string in user's buffer and leave
  336. lstrcpy (szPath, szLocalPath);
  337. lPathType = NCDU_LOCAL_SHARE_PATH;
  338. lStatus = ERROR_SUCCESS;
  339. } else {
  340. // unable to look up redirected drive so return dos
  341. // version of path (this shouldn't happen);
  342. lstrcpy (szPath, szRootDir);
  343. lPathType = NCDU_HARD_DRIVE_PATH;
  344. lStatus = ERROR_SUCCESS;
  345. }
  346. } else {
  347. // this is a Local drive so return the DOS
  348. // version of path
  349. lstrcpy (szPath, szRootDir);
  350. lPathType = NCDU_HARD_DRIVE_PATH;
  351. lStatus = ERROR_SUCCESS;
  352. }
  353. bFound = TRUE;
  354. break;
  355. }
  356. } // else ignore if not a local or remote hard drive
  357. szRootDir[3] = 0; // reset string back to a drive only
  358. } // end of for loop
  359. if (bFound) goto GDP_ExitPoint;
  360. }
  361. if ((dwPhase & SEARCH_CD_ROM) == SEARCH_CD_ROM) {
  362. // if here, then no client tree was found on a hard drive, so see if
  363. // they have a CD-ROM with the client tree on it. If they do, then
  364. // return the DOS path of the dir.
  365. // find CD-ROM drive
  366. szRootDir[0] = 0;
  367. szRootDir[1] = cColon;
  368. szRootDir[2] = cBackslash;
  369. szRootDir[3] = 0;
  370. for (szRootDir[0] = cC; szRootDir[0] <= cZ; szRootDir[0]++) {
  371. if (GetDriveType(szRootDir) == DRIVE_CDROM) break;
  372. }
  373. if (szRootDir[0] <= cZ) {
  374. // then a CD-ROM must have been found, so append the "clients" dir
  375. // and see if this is a valid client tree
  376. if (dwSearchType == FDT_TOOLS_TREE){
  377. lstrcat (szRootDir, cszToolsDir);
  378. bValidPath = (BOOL)(ValidSrvToolsPath (szRootDir) == 0);
  379. } else {
  380. lstrcat (szRootDir, cszClientsDir);
  381. bValidPath = (BOOL)(ValidSharePath (szRootDir) == 0);
  382. }
  383. if (bValidPath) {
  384. // found one on the CD so return the DOS
  385. // version of path
  386. lstrcpy (szPath, szRootDir);
  387. lPathType = NCDU_CDROM_PATH;
  388. lStatus = ERROR_SUCCESS;
  389. bFound = TRUE;
  390. }
  391. }
  392. goto GDP_ExitPoint;
  393. }
  394. // if here, then NO client tree was found. so return an empty string
  395. // bufffer and error code.
  396. lStatus = ERROR_SUCCESS;
  397. lPathType = NCDU_NO_CLIENT_PATH_FOUND;
  398. *szPath = 0; // make string buffer empty
  399. GDP_ExitPoint:
  400. if (plPathType != NULL) {
  401. *plPathType = lPathType;
  402. }
  403. FREE_IF_ALLOC (szLocalPath);
  404. SetErrorMode (nErrorMode); // restore old error mode
  405. return lStatus;
  406. }
  407. static
  408. BOOL
  409. FindClientsDlg_WM_INITDIALOG (
  410. IN HWND hwndDlg,
  411. IN WPARAM wParam,
  412. IN LPARAM lParam
  413. )
  414. /*++
  415. Routine Description:
  416. Dialog Box initialization routine:
  417. calls routines that format the currently selected options
  418. for display in the static text fields of the dialog box
  419. Arguments:
  420. IN HWND hwndDlg
  421. Handle to dialog box window
  422. IN WPARAM wParam
  423. Not Used
  424. IN LPARAM lParam
  425. pointer to client search data strucutre
  426. Return Value:
  427. FALSE because focus is set in this routine to the CANCEL button
  428. --*/
  429. {
  430. PFDT_DATA pFdt = (PFDT_DATA)lParam;
  431. LPTSTR szTitle;
  432. // locate windw
  433. PositionWindow (hwndDlg);
  434. // set global flag
  435. bSearchForClients = TRUE;
  436. // clear dialog box text
  437. SetDlgItemText (hwndDlg, NCDU_CLIENT_SEARCH_PHASE, cszEmptyString);
  438. // display Tools Tree search string if appropriate
  439. szTitle = GlobalAlloc (GPTR, MAX_PATH_BYTES);
  440. if (szTitle != NULL) {
  441. if (pFdt->dwSearchType == FDT_TOOLS_TREE) {
  442. if (LoadString (
  443. (HINSTANCE)GetWindowLongPtr(hwndDlg, GWLP_HINSTANCE),
  444. NCDU_FINDING_TOOLS_PATH,
  445. szTitle,
  446. 80) > 0) {
  447. SetDlgItemText (hwndDlg, NCDU_SEARCH_TYPE_TITLE, szTitle);
  448. }
  449. }
  450. FREE_IF_ALLOC (szTitle);
  451. }
  452. // start 1st phase of search
  453. PostMessage (hwndDlg, NCDU_SEARCH_FOR_CLIENTS, (WPARAM)SEARCH_REGISTRY, lParam);
  454. // set focus
  455. SetFocus (GetDlgItem(hwndDlg, IDCANCEL));
  456. // need an arrow cursor to cancel out of dialog box.
  457. hOrigCursor = SetCursor (LoadCursor(NULL, IDC_ARROW));
  458. return FALSE;
  459. }
  460. static
  461. BOOL
  462. FindClientsDlg_SEARCH_FOR_CLIENTS (
  463. IN HWND hwndDlg, // dlg window handle
  464. IN WPARAM wParam, // search phase
  465. IN LPARAM lParam // search data structure
  466. )
  467. /*++
  468. Routine Description:
  469. message processing routine to perform client tree search in phases
  470. Arguments:
  471. IN HWND hwndDlg
  472. dlg window handle
  473. IN WPARAM wParam
  474. search phase
  475. IN LPARAM lParam
  476. search data structure
  477. Return Value:
  478. TRUE
  479. --*/
  480. {
  481. UINT nPhaseName;
  482. PFDT_DATA pFdt;
  483. if (bSearchForClients) {
  484. // perform this phase of the search
  485. // set dlg box text
  486. switch (wParam) {
  487. case SEARCH_REGISTRY:
  488. nPhaseName = CSZ_SYSTEM_REGISTRY;
  489. break;
  490. case SEARCH_SHARED_DIRS:
  491. nPhaseName = CSZ_SHARED_DIRS;
  492. break;
  493. case SEARCH_HARD_DRIVES:
  494. nPhaseName = CSZ_HARD_DISK_DIRS;
  495. break;
  496. case SEARCH_CD_ROM:
  497. nPhaseName = CSZ_CD_ROM;
  498. break;
  499. default:
  500. nPhaseName = CSZ_LOCAL_MACHINE;
  501. break;
  502. }
  503. SetDlgItemText (hwndDlg, NCDU_CLIENT_SEARCH_PHASE,
  504. GetStringResource (nPhaseName));
  505. pFdt = (PFDT_DATA)lParam;
  506. // search for clients
  507. SearchForDistPath (
  508. pFdt->szPathBuffer,
  509. pFdt->dwPathBufferLen,
  510. pFdt->plPathType,
  511. pFdt->dwSearchType,
  512. (DWORD)wParam);
  513. if (*pFdt->plPathType != NCDU_NO_CLIENT_PATH_FOUND) {
  514. // client found, so end here
  515. EndDialog (hwndDlg, IDOK);
  516. } else {
  517. // try next phase
  518. if (wParam != SEARCH_LAST_PHASE) {
  519. wParam <<= 1; // go to next phase
  520. PostMessage (hwndDlg, NCDU_SEARCH_FOR_CLIENTS,
  521. wParam, lParam);
  522. } else {
  523. // this is the last phase so exit
  524. EndDialog (hwndDlg, (bSearchForClients ? IDOK : IDCANCEL));
  525. }
  526. }
  527. }
  528. return TRUE;
  529. }
  530. static
  531. BOOL
  532. FindClientsDlg_WM_COMMAND (
  533. IN HWND hwndDlg,
  534. IN WPARAM wParam,
  535. IN LPARAM lParam
  536. )
  537. /*++
  538. Routine Description:
  539. WM_COMMAND message dispatching routine.
  540. Dispatches IDCANCEL and IDOK button messages, sends all others
  541. to the DefDlgProc.
  542. Arguments:
  543. IN HWND hwndDlg
  544. Handle to dialog box window
  545. IN WPARAM wParam
  546. windows message wParam arg
  547. IN LPARAM lParam
  548. windows message lParam arg
  549. Return Value:
  550. TRUE if message is not dispatched (i.e. not processed)
  551. othewise the value returned by the called routine.
  552. --*/
  553. {
  554. switch (LOWORD(wParam)) {
  555. case IDCANCEL:
  556. switch (HIWORD(wParam)) {
  557. case BN_CLICKED:
  558. bSearchForClients = FALSE;
  559. return TRUE;
  560. default:
  561. return FALSE;
  562. }
  563. default:
  564. return FALSE;
  565. }
  566. }
  567. static
  568. BOOL
  569. FindClientsDlg_WM_DESTROY (
  570. IN HWND hwndDlg,
  571. IN WPARAM wParam,
  572. IN LPARAM lParam
  573. )
  574. /*++
  575. Routine Description:
  576. restores original cursor when dialog box exits
  577. Arguments:
  578. std. windows message args
  579. Return Value:
  580. TRUE
  581. --*/
  582. {
  583. if (hOrigCursor != NULL) SetCursor (hOrigCursor);
  584. hOrigCursor = NULL;
  585. return TRUE;
  586. }
  587. static
  588. INT_PTR CALLBACK
  589. FindClientsDlgProc (
  590. IN HWND hwndDlg,
  591. IN UINT message,
  592. IN WPARAM wParam,
  593. IN LPARAM lParam
  594. )
  595. /*++
  596. Routine Description:
  597. main dialog proc for this dialog box.
  598. Processes the following messages:
  599. WM_INITDIALOG: dialog box initialization
  600. WM_COMMAND: command button/item selected
  601. WM_DESTROY: restore cursor on exit
  602. NCDU_SEARCH_FOR_CLIENTS: execute search message
  603. Arguments:
  604. IN HWND hwndDlg
  605. handle to dialog box window
  606. IN UINT message
  607. message id
  608. IN WPARAM wParam
  609. message wParam arg
  610. IN LPARAM lParam
  611. message lParam arg
  612. Return Value:
  613. FALSE if message not processed by this module, otherwise the
  614. value returned by the message processing routine.
  615. --*/
  616. {
  617. switch (message) {
  618. // windows messages
  619. case WM_INITDIALOG: return (FindClientsDlg_WM_INITDIALOG (hwndDlg, wParam, lParam));
  620. case WM_COMMAND: return (FindClientsDlg_WM_COMMAND (hwndDlg, wParam, lParam));
  621. case WM_DESTROY: return (FindClientsDlg_WM_DESTROY (hwndDlg, wParam, lParam));
  622. // local messages
  623. case NCDU_SEARCH_FOR_CLIENTS: return (FindClientsDlg_SEARCH_FOR_CLIENTS (hwndDlg, wParam, lParam));
  624. default: return FALSE;
  625. }
  626. }