ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

framewnd.c
Go to the documentation of this file.
00001 /*
00002  * Regedit frame window
00003  *
00004  * Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00019  */
00020 
00021 #include <regedit.h>
00022 
00023 /********************************************************************************
00024  * Global and Local Variables:
00025  */
00026 
00027 #define FAVORITES_MENU_POSITION 3
00028 
00029 static TCHAR s_szFavoritesRegKey[] = _T("Software\\Microsoft\\Windows\\CurrentVersion\\Applets\\Regedit\\Favorites");
00030 
00031 static BOOL bInMenuLoop = FALSE;        /* Tells us if we are in the menu loop */
00032 
00033 /*******************************************************************************
00034  * Local module support methods
00035  */
00036 
00037 static void resize_frame_rect(HWND hWnd, PRECT prect)
00038 {
00039     RECT rt;
00040     /*
00041         if (IsWindowVisible(hToolBar)) {
00042             SendMessage(hToolBar, WM_SIZE, 0, 0);
00043             GetClientRect(hToolBar, &rt);
00044             prect->top = rt.bottom+3;
00045             prect->bottom -= rt.bottom+3;
00046         }
00047      */
00048     if (IsWindowVisible(hStatusBar))
00049     {
00050         SetupStatusBar(hWnd, TRUE);
00051         GetClientRect(hStatusBar, &rt);
00052         prect->bottom -= rt.bottom;
00053     }
00054     MoveWindow(g_pChildWnd->hWnd, prect->left, prect->top, prect->right, prect->bottom, TRUE);
00055 }
00056 
00057 static void resize_frame_client(HWND hWnd)
00058 {
00059     RECT rect;
00060 
00061     GetClientRect(hWnd, &rect);
00062     resize_frame_rect(hWnd, &rect);
00063 }
00064 
00065 /********************************************************************************/
00066 
00067 static void OnInitMenu(HWND hWnd)
00068 {
00069     LONG lResult;
00070     HKEY hKey = NULL;
00071     DWORD dwIndex, cbValueName, cbValueData, dwType;
00072     TCHAR szValueName[256];
00073     BYTE abValueData[256];
00074     static int s_nFavoriteMenuSubPos = -1;
00075     HMENU hMenu;
00076     BOOL bDisplayedAny = FALSE;
00077 
00078     /* Find Favorites menu and clear it out */
00079     hMenu = GetSubMenu(GetMenu(hWnd), FAVORITES_MENU_POSITION);
00080     if (!hMenu)
00081         goto done;
00082     if (s_nFavoriteMenuSubPos < 0)
00083     {
00084         s_nFavoriteMenuSubPos = GetMenuItemCount(hMenu);
00085     }
00086     else
00087     {
00088         while(RemoveMenu(hMenu, s_nFavoriteMenuSubPos, MF_BYPOSITION))
00089             ;
00090     }
00091 
00092     lResult = RegOpenKey(HKEY_CURRENT_USER, s_szFavoritesRegKey, &hKey);
00093     if (lResult != ERROR_SUCCESS)
00094         goto done;
00095 
00096     dwIndex = 0;
00097     do
00098     {
00099         cbValueName = COUNT_OF(szValueName);
00100         cbValueData = sizeof(abValueData);
00101         lResult = RegEnumValue(hKey, dwIndex, szValueName, &cbValueName, NULL, &dwType, abValueData, &cbValueData);
00102         if ((lResult == ERROR_SUCCESS) && (dwType == REG_SZ))
00103         {
00104             if (!bDisplayedAny)
00105             {
00106                 AppendMenu(hMenu, MF_SEPARATOR, 0, NULL);
00107                 bDisplayedAny = TRUE;
00108             }
00109             AppendMenu(hMenu, 0, ID_FAVORITES_MIN + GetMenuItemCount(hMenu), szValueName);
00110         }
00111         dwIndex++;
00112     }
00113     while(lResult == ERROR_SUCCESS);
00114 
00115 done:
00116     if (hKey)
00117         RegCloseKey(hKey);
00118 }
00119 
00120 static void OnEnterMenuLoop(HWND hWnd)
00121 {
00122     int nParts;
00123     UNREFERENCED_PARAMETER(hWnd);
00124 
00125     /* Update the status bar pane sizes */
00126     nParts = -1;
00127     SendMessage(hStatusBar, SB_SETPARTS, 1, (LPARAM)&nParts);
00128     bInMenuLoop = TRUE;
00129     SendMessage(hStatusBar, SB_SETTEXT, (WPARAM)0, (LPARAM)_T(""));
00130 }
00131 
00132 static void OnExitMenuLoop(HWND hWnd)
00133 {
00134     bInMenuLoop = FALSE;
00135     /* Update the status bar pane sizes*/
00136     SetupStatusBar(hWnd, TRUE);
00137     UpdateStatusBar();
00138 }
00139 
00140 static void OnMenuSelect(HWND hWnd, UINT nItemID, UINT nFlags, HMENU hSysMenu)
00141 {
00142     TCHAR str[100];
00143 
00144     _tcscpy(str, _T(""));
00145     if (nFlags & MF_POPUP)
00146     {
00147         if (hSysMenu != GetMenu(hWnd))
00148         {
00149             if (nItemID == 2) nItemID = 5;
00150         }
00151     }
00152     if (LoadString(hInst, nItemID, str, 100))
00153     {
00154         /* load appropriate string*/
00155         LPTSTR lpsz = str;
00156         /* first newline terminates actual string*/
00157         lpsz = _tcschr(lpsz, _T('\n'));
00158         if (lpsz != NULL)
00159             *lpsz = '\0';
00160     }
00161     SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)str);
00162 }
00163 
00164 void SetupStatusBar(HWND hWnd, BOOL bResize)
00165 {
00166     RECT  rc;
00167     int nParts;
00168     GetClientRect(hWnd, &rc);
00169     nParts = rc.right;
00170     /*    nParts = -1;*/
00171     if (bResize)
00172         SendMessage(hStatusBar, WM_SIZE, 0, 0);
00173     SendMessage(hStatusBar, SB_SETPARTS, 1, (LPARAM)&nParts);
00174 }
00175 
00176 void UpdateStatusBar(void)
00177 {
00178     NMHDR nmhdr;
00179     ZeroMemory(&nmhdr, sizeof(NMHDR));
00180     nmhdr.code = TVN_SELCHANGED;
00181     SendMessage(g_pChildWnd->hWnd, WM_NOTIFY, (WPARAM)TREE_WINDOW, (LPARAM)&nmhdr);
00182 }
00183 
00184 static void toggle_child(HWND hWnd, UINT cmd, HWND hchild)
00185 {
00186     BOOL vis = IsWindowVisible(hchild);
00187     HMENU hMenuView = GetSubMenu(hMenuFrame, ID_VIEW_MENU);
00188 
00189     CheckMenuItem(hMenuView, cmd, vis?MF_BYCOMMAND:MF_BYCOMMAND|MF_CHECKED);
00190     ShowWindow(hchild, vis?SW_HIDE:SW_SHOW);
00191     resize_frame_client(hWnd);
00192 }
00193 
00194 static BOOL CheckCommDlgError(HWND hWnd)
00195 {
00196     DWORD dwErrorCode = CommDlgExtendedError();
00197     UNREFERENCED_PARAMETER(hWnd);
00198     switch (dwErrorCode)
00199     {
00200     case CDERR_DIALOGFAILURE:
00201         break;
00202     case CDERR_FINDRESFAILURE:
00203         break;
00204     case CDERR_NOHINSTANCE:
00205         break;
00206     case CDERR_INITIALIZATION:
00207         break;
00208     case CDERR_NOHOOK:
00209         break;
00210     case CDERR_LOCKRESFAILURE:
00211         break;
00212     case CDERR_NOTEMPLATE:
00213         break;
00214     case CDERR_LOADRESFAILURE:
00215         break;
00216     case CDERR_STRUCTSIZE:
00217         break;
00218     case CDERR_LOADSTRFAILURE:
00219         break;
00220     case FNERR_BUFFERTOOSMALL:
00221         break;
00222     case CDERR_MEMALLOCFAILURE:
00223         break;
00224     case FNERR_INVALIDFILENAME:
00225         break;
00226     case CDERR_MEMLOCKFAILURE:
00227         break;
00228     case FNERR_SUBCLASSFAILURE:
00229         break;
00230     default:
00231         break;
00232     }
00233     return TRUE;
00234 }
00235 
00236 TCHAR FileNameBuffer[_MAX_PATH];
00237 TCHAR FileTitleBuffer[_MAX_PATH];
00238 
00239 typedef struct
00240 {
00241     UINT DisplayID;
00242     UINT FilterID;
00243 } FILTERPAIR, *PFILTERPAIR;
00244 
00245 void
00246 BuildFilterStrings(TCHAR *Filter, PFILTERPAIR Pairs, int PairCount)
00247 {
00248     int i, c;
00249 
00250     c = 0;
00251     for(i = 0; i < PairCount; i++)
00252     {
00253         c += LoadString(hInst, Pairs[i].DisplayID, &Filter[c], 255 * sizeof(TCHAR));
00254         Filter[++c] = '\0';
00255         c += LoadString(hInst, Pairs[i].FilterID, &Filter[c], 255 * sizeof(TCHAR));
00256         Filter[++c] = '\0';
00257     }
00258     Filter[++c] = '\0';
00259 }
00260 
00261 static BOOL InitOpenFileName(HWND hWnd, OPENFILENAME* pofn)
00262 {
00263     FILTERPAIR FilterPairs[3];
00264     static TCHAR Filter[1024];
00265 
00266     memset(pofn, 0, sizeof(OPENFILENAME));
00267     pofn->lStructSize = sizeof(OPENFILENAME);
00268     pofn->hwndOwner = hWnd;
00269     pofn->hInstance = hInst;
00270 
00271     /* create filter string */
00272     FilterPairs[0].DisplayID = IDS_FLT_REGFILES;
00273     FilterPairs[0].FilterID = IDS_FLT_REGFILES_FLT;
00274     FilterPairs[1].DisplayID = IDS_FLT_REGEDIT4;
00275     FilterPairs[1].FilterID = IDS_FLT_REGEDIT4_FLT;
00276     FilterPairs[2].DisplayID = IDS_FLT_ALLFILES;
00277     FilterPairs[2].FilterID = IDS_FLT_ALLFILES_FLT;
00278     BuildFilterStrings(Filter, FilterPairs, sizeof(FilterPairs) / sizeof(FILTERPAIR));
00279 
00280     pofn->lpstrFilter = Filter;
00281     pofn->lpstrFile = FileNameBuffer;
00282     pofn->nMaxFile = _MAX_PATH;
00283     pofn->lpstrFileTitle = FileTitleBuffer;
00284     pofn->nMaxFileTitle = _MAX_PATH;
00285     pofn->Flags = OFN_HIDEREADONLY;
00286     pofn->lpstrDefExt = TEXT("reg");
00287     return TRUE;
00288 }
00289 
00290 static INT_PTR CALLBACK LoadHive_KeyNameInHookProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
00291 {
00292     static LPTSTR sKey = NULL;
00293     static INT sLength = 0;
00294     switch(uMsg)
00295     {
00296     case WM_INITDIALOG:
00297         sKey = (LPTSTR)lParam;
00298         sLength = 128; /* FIXME: Ugly hack! */
00299     case WM_COMMAND:
00300         switch(LOWORD(wParam))
00301         {
00302         case IDOK:
00303             if(GetDlgItemText(hWndDlg, IDC_EDIT_KEY, sKey, sLength))
00304                 return EndDialog(hWndDlg, -1);
00305             else
00306                 return EndDialog(hWndDlg, 0);
00307         case IDCANCEL:
00308             return EndDialog(hWndDlg, 0);
00309         }
00310         break;
00311     }
00312     return FALSE;
00313 }
00314 
00315 static BOOL LoadHive(HWND hWnd)
00316 {
00317     OPENFILENAME ofn;
00318     TCHAR Caption[128];
00319     LPCTSTR pszKeyPath;
00320     TCHAR xPath[128];
00321     HKEY hRootKey;
00322     TCHAR Filter[1024];
00323     FILTERPAIR filter;
00324     /* get the item key to load the hive in */
00325     pszKeyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hRootKey);
00326     /* initialize the "open file" dialog */
00327     InitOpenFileName(hWnd, &ofn);
00328     /* build the "All Files" filter up */
00329     filter.DisplayID = IDS_FLT_ALLFILES;
00330     filter.FilterID = IDS_FLT_ALLFILES_FLT;
00331     BuildFilterStrings(Filter, &filter, sizeof(filter));
00332     ofn.lpstrFilter = Filter;
00333     /* load and set the caption and flags for dialog */
00334     LoadString(hInst, IDS_LOAD_HIVE, Caption, COUNT_OF(Caption));
00335     ofn.lpstrTitle = Caption;
00336     ofn.Flags |= OFN_ENABLESIZING;
00337     /*    ofn.lCustData = ;*/
00338     /* now load the hive */
00339     if (GetOpenFileName(&ofn))
00340     {
00341         if(DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_LOADHIVE), hWnd, &LoadHive_KeyNameInHookProc, (LPARAM)xPath))
00342         {
00343             LONG regLoadResult = RegLoadKey(hRootKey, xPath, ofn.lpstrFile);
00344             if(regLoadResult == ERROR_SUCCESS)
00345             {
00346                 /* refresh tree and list views */
00347                 RefreshTreeView(g_pChildWnd->hTreeWnd);
00348                 pszKeyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hRootKey);
00349                 RefreshListView(g_pChildWnd->hListWnd, hRootKey, pszKeyPath);
00350             }
00351             else
00352             {
00353                 ErrorMessageBox(hWnd, Caption, regLoadResult);
00354                 return FALSE;
00355             }
00356         }
00357     }
00358     else
00359     {
00360         CheckCommDlgError(hWnd);
00361     }
00362     return TRUE;
00363 }
00364 
00365 static BOOL UnloadHive(HWND hWnd)
00366 {
00367     TCHAR Caption[128];
00368     LPCTSTR pszKeyPath;
00369     HKEY hRootKey;
00370     LONG regUnloadResult;
00371 
00372     /* get the item key to unload */
00373     pszKeyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hRootKey);
00374     /* load and set the caption and flags for dialog */
00375     LoadString(hInst, IDS_UNLOAD_HIVE, Caption, COUNT_OF(Caption));
00376     /* now unload the hive */
00377     regUnloadResult = RegUnLoadKey(hRootKey, pszKeyPath);
00378     if(regUnloadResult == ERROR_SUCCESS)
00379     {
00380         /* refresh tree and list views */
00381         RefreshTreeView(g_pChildWnd->hTreeWnd);
00382         pszKeyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hRootKey);
00383         RefreshListView(g_pChildWnd->hListWnd, hRootKey, pszKeyPath);
00384     }
00385     else
00386     {
00387         ErrorMessageBox(hWnd, Caption, regUnloadResult);
00388         return FALSE;
00389     }
00390     return TRUE;
00391 }
00392 
00393 static BOOL ImportRegistryFile(HWND hWnd)
00394 {
00395     OPENFILENAME ofn;
00396     TCHAR Caption[128], szTitle[256], szText[256];
00397     LPCTSTR pszKeyPath;
00398     HKEY hRootKey;
00399 
00400     InitOpenFileName(hWnd, &ofn);
00401     LoadString(hInst, IDS_IMPORT_REG_FILE, Caption, COUNT_OF(Caption));
00402     ofn.lpstrTitle = Caption;
00403     ofn.Flags |= OFN_ENABLESIZING;
00404     /*    ofn.lCustData = ;*/
00405     if (GetOpenFileName(&ofn))
00406     {
00407         FILE *fp = _wfopen(ofn.lpstrFile, L"r");
00408         if (fp == NULL || !import_registry_file(fp))
00409         {
00410             LPSTR p = GetMultiByteString(ofn.lpstrFile);
00411             fprintf(stderr, "Can't open file \"%s\"\n", p);
00412             HeapFree(GetProcessHeap(), 0, p);
00413             if (fp != NULL)
00414                 fclose(fp);
00415             return FALSE;
00416         }
00417         LoadString(hInst, IDS_APP_TITLE, szTitle, sizeof(szTitle));
00418         LoadString(hInst, IDS_IMPORTED_OK, szText, sizeof(szTitle));
00419         /* show successful import */
00420         MessageBox(NULL, szText, szTitle, MB_OK);
00421         fclose(fp);
00422     }
00423     else
00424     {
00425         CheckCommDlgError(hWnd);
00426     }
00427 
00428     RefreshTreeView(g_pChildWnd->hTreeWnd);
00429     pszKeyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hRootKey);
00430     RefreshListView(g_pChildWnd->hListWnd, hRootKey, pszKeyPath);
00431 
00432     return TRUE;
00433 }
00434 
00435 static UINT_PTR CALLBACK ExportRegistryFile_OFNHookProc(HWND hdlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
00436 {
00437     HWND hwndExportAll;
00438     HWND hwndExportBranch;
00439     HWND hwndExportBranchText;
00440     UINT_PTR iResult = 0;
00441     OPENFILENAME *pOfn;
00442     LPTSTR pszSelectedKey;
00443     OFNOTIFY *pOfnNotify;
00444 
00445     UNREFERENCED_PARAMETER(wParam);
00446 
00447     switch(uiMsg)
00448     {
00449     case WM_INITDIALOG:
00450         pOfn = (OPENFILENAME *) lParam;
00451         pszSelectedKey = (LPTSTR) pOfn->lCustData;
00452 
00453         hwndExportAll = GetDlgItem(hdlg, IDC_EXPORT_ALL);
00454         if (hwndExportAll)
00455             SendMessage(hwndExportAll, BM_SETCHECK, pszSelectedKey ? BST_UNCHECKED : BST_CHECKED, 0);
00456 
00457         hwndExportBranch = GetDlgItem(hdlg, IDC_EXPORT_BRANCH);
00458         if (hwndExportBranch)
00459             SendMessage(hwndExportBranch, BM_SETCHECK, pszSelectedKey ? BST_CHECKED : BST_UNCHECKED, 0);
00460 
00461         hwndExportBranchText = GetDlgItem(hdlg, IDC_EXPORT_BRANCH_TEXT);
00462         if (hwndExportBranchText)
00463             SetWindowText(hwndExportBranchText, pszSelectedKey);
00464         break;
00465 
00466     case WM_NOTIFY:
00467         if (((NMHDR *) lParam)->code == CDN_FILEOK)
00468         {
00469             pOfnNotify = (OFNOTIFY *) lParam;
00470             pszSelectedKey = (LPTSTR) pOfnNotify->lpOFN->lCustData;
00471 
00472             hwndExportBranch = GetDlgItem(hdlg, IDC_EXPORT_BRANCH);
00473             hwndExportBranchText = GetDlgItem(hdlg, IDC_EXPORT_BRANCH_TEXT);
00474             if (hwndExportBranch && hwndExportBranchText
00475                     && (SendMessage(hwndExportBranch, BM_GETCHECK, 0, 0) == BST_CHECKED))
00476             {
00477                 GetWindowText(hwndExportBranchText, pszSelectedKey, _MAX_PATH);
00478             }
00479             else
00480             {
00481                 pszSelectedKey[0] = '\0';
00482             }
00483         }
00484         break;
00485     }
00486     return iResult;
00487 }
00488 
00489 BOOL ExportRegistryFile(HWND hWnd)
00490 {
00491     OPENFILENAME ofn;
00492     TCHAR ExportKeyPath[_MAX_PATH];
00493     TCHAR Caption[128];
00494     HKEY hKeyRoot;
00495     LPCTSTR pszKeyPath;
00496 
00497     /* Figure out which key path we are exporting */
00498     pszKeyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hKeyRoot);
00499     GetKeyName(ExportKeyPath, COUNT_OF(ExportKeyPath), hKeyRoot, pszKeyPath);
00500 
00501     InitOpenFileName(hWnd, &ofn);
00502     LoadString(hInst, IDS_EXPORT_REG_FILE, Caption, sizeof(Caption)/sizeof(TCHAR));
00503     ofn.lpstrTitle = Caption;
00504 
00505     /* Only set the path if a key (not the root node) is selected */
00506     if (hKeyRoot != 0)
00507     {
00508         ofn.lCustData = (LPARAM) ExportKeyPath;
00509     }
00510     ofn.Flags = OFN_ENABLETEMPLATE | OFN_EXPLORER | OFN_ENABLEHOOK | OFN_OVERWRITEPROMPT;
00511     ofn.lpfnHook = ExportRegistryFile_OFNHookProc;
00512     ofn.lpTemplateName = MAKEINTRESOURCE(IDD_EXPORTRANGE);
00513     if (GetSaveFileName(&ofn))
00514     {
00515         BOOL result;
00516         DWORD format;
00517 
00518         if (ofn.nFilterIndex == 1)
00519             format = REG_FORMAT_5;
00520         else
00521             format = REG_FORMAT_4;
00522         result = export_registry_key(ofn.lpstrFile, ExportKeyPath, format);
00523         if (!result)
00524         {
00525             LPSTR p = GetMultiByteString(ofn.lpstrFile);
00526             fprintf(stderr, "Can't open file \"%s\"\n", p);
00527             HeapFree(GetProcessHeap(), 0, p);
00528             return FALSE;
00529         }
00530     }
00531     else
00532     {
00533         CheckCommDlgError(hWnd);
00534     }
00535     return TRUE;
00536 }
00537 
00538 BOOL PrintRegistryHive(HWND hWnd, LPTSTR path)
00539 {
00540 #if 1
00541     PRINTDLG pd;
00542     UNREFERENCED_PARAMETER(path);
00543 
00544     ZeroMemory(&pd, sizeof(PRINTDLG));
00545     pd.lStructSize = sizeof(PRINTDLG);
00546     pd.hwndOwner   = hWnd;
00547     pd.hDevMode    = NULL;     /* Don't forget to free or store hDevMode*/
00548     pd.hDevNames   = NULL;     /* Don't forget to free or store hDevNames*/
00549     pd.Flags       = PD_USEDEVMODECOPIESANDCOLLATE | PD_RETURNDC;
00550     pd.nCopies     = 1;
00551     pd.nFromPage   = 0xFFFF;
00552     pd.nToPage     = 0xFFFF;
00553     pd.nMinPage    = 1;
00554     pd.nMaxPage    = 0xFFFF;
00555     if (PrintDlg(&pd))
00556     {
00557         /* GDI calls to render output. */
00558         DeleteDC(pd.hDC); /* Delete DC when done.*/
00559     }
00560 #else
00561     HRESULT hResult;
00562     PRINTDLGEX pd;
00563 
00564     hResult = PrintDlgEx(&pd);
00565     if (hResult == S_OK)
00566     {
00567         switch (pd.dwResultAction)
00568         {
00569         case PD_RESULT_APPLY:
00570             /*The user clicked the Apply button and later clicked the Cancel button. This indicates that the user wants to apply the changes made in the property sheet, but does not yet want to print. The PRINTDLGEX structure contains the information specified by the user at the time the Apply button was clicked. */
00571             break;
00572         case PD_RESULT_CANCEL:
00573             /*The user clicked the Cancel button. The information in the PRINTDLGEX structure is unchanged. */
00574             break;
00575         case PD_RESULT_PRINT:
00576             /*The user clicked the Print button. The PRINTDLGEX structure contains the information specified by the user. */
00577             break;
00578         default:
00579             break;
00580         }
00581     }
00582     else
00583     {
00584         switch (hResult)
00585         {
00586         case E_OUTOFMEMORY:
00587             /*Insufficient memory. */
00588             break;
00589         case E_INVALIDARG:
00590             /* One or more arguments are invalid. */
00591             break;
00592         case E_POINTER:
00593             /*Invalid pointer. */
00594             break;
00595         case E_HANDLE:
00596             /*Invalid handle. */
00597             break;
00598         case E_FAIL:
00599             /*Unspecified error. */
00600             break;
00601         default:
00602             break;
00603         }
00604         return FALSE;
00605     }
00606 #endif
00607     return TRUE;
00608 }
00609 
00610 static void ChooseFavorite(LPCTSTR pszFavorite)
00611 {
00612     HKEY hKey = NULL;
00613     TCHAR szFavoritePath[512];
00614     DWORD cbData, dwType;
00615 
00616     if (RegOpenKeyEx(HKEY_CURRENT_USER, s_szFavoritesRegKey, 0, KEY_QUERY_VALUE, &hKey) != ERROR_SUCCESS)
00617         goto done;
00618 
00619     cbData = (sizeof(szFavoritePath) / sizeof(szFavoritePath[0])) - 1;
00620     memset(szFavoritePath, 0, sizeof(szFavoritePath));
00621     if (RegQueryValueEx(hKey, pszFavorite, NULL, &dwType, (LPBYTE) szFavoritePath, &cbData) != ERROR_SUCCESS)
00622         goto done;
00623 
00624     if (dwType == REG_SZ)
00625         SelectNode(g_pChildWnd->hTreeWnd, szFavoritePath);
00626 
00627 done:
00628     if (hKey)
00629         RegCloseKey(hKey);
00630 }
00631 
00632 BOOL CopyKeyName(HWND hWnd, HKEY hRootKey, LPCTSTR keyName)
00633 {
00634     BOOL bClipboardOpened = FALSE;
00635     BOOL bSuccess = FALSE;
00636     TCHAR szBuffer[512];
00637     HGLOBAL hGlobal;
00638     LPTSTR s;
00639 
00640     if (!OpenClipboard(hWnd))
00641         goto done;
00642     bClipboardOpened = TRUE;
00643 
00644     if (!EmptyClipboard())
00645         goto done;
00646 
00647     if (!GetKeyName(szBuffer, COUNT_OF(szBuffer), hRootKey, keyName))
00648         goto done;
00649 
00650     hGlobal = GlobalAlloc(GMEM_MOVEABLE, (lstrlen(szBuffer) + 1) * sizeof(TCHAR));
00651     if (!hGlobal)
00652         goto done;
00653 
00654     s = GlobalLock(hGlobal);
00655     _tcscpy(s, szBuffer);
00656     GlobalUnlock(hGlobal);
00657 
00658 #ifdef UNICODE
00659     SetClipboardData(CF_UNICODETEXT, hGlobal);
00660 #else
00661     SetClipboardData(CF_TEXT, hGlobal);
00662 #endif
00663     bSuccess = TRUE;
00664 
00665 done:
00666     if (bClipboardOpened)
00667         CloseClipboard();
00668     return bSuccess;
00669 }
00670 
00671 static BOOL CreateNewValue(HKEY hRootKey, LPCTSTR pszKeyPath, DWORD dwType)
00672 {
00673     TCHAR szNewValueFormat[128];
00674     TCHAR szNewValue[128];
00675     int iIndex = 1;
00676     BYTE data[128];
00677     DWORD dwExistingType, cbData;
00678     LONG lResult;
00679     HKEY hKey;
00680     LVFINDINFO lvfi;
00681 
00682     if (RegOpenKeyEx(hRootKey, pszKeyPath, 0, KEY_QUERY_VALUE | KEY_SET_VALUE,
00683                      &hKey) != ERROR_SUCCESS)
00684         return FALSE;
00685 
00686     LoadString(hInst, IDS_NEW_VALUE, szNewValueFormat, COUNT_OF(szNewValueFormat));
00687 
00688     do
00689     {
00690         wsprintf(szNewValue, szNewValueFormat, iIndex++);
00691         cbData = sizeof(data);
00692         lResult = RegQueryValueEx(hKey, szNewValue, NULL, &dwExistingType, data, &cbData);
00693     }
00694     while(lResult == ERROR_SUCCESS);
00695 
00696     switch(dwType)
00697     {
00698     case REG_DWORD:
00699         cbData = sizeof(DWORD);
00700         break;
00701     case REG_SZ:
00702     case REG_EXPAND_SZ:
00703         cbData = sizeof(TCHAR);
00704         break;
00705     case REG_MULTI_SZ:
00706         cbData = sizeof(TCHAR) * 2;
00707         break;
00708     case REG_QWORD:
00709         cbData = sizeof(DWORD) * 2;
00710         break;
00711     default:
00712         cbData = 0;
00713         break;
00714     }
00715     memset(data, 0, cbData);
00716     lResult = RegSetValueEx(hKey, szNewValue, 0, dwType, data, cbData);
00717     RegCloseKey(hKey);
00718     if (lResult != ERROR_SUCCESS)
00719     {
00720         return FALSE;
00721     }
00722 
00723     RefreshListView(g_pChildWnd->hListWnd, hRootKey, pszKeyPath);
00724 
00725     /* locate the newly added value, and get ready to rename it */
00726     memset(&lvfi, 0, sizeof(lvfi));
00727     lvfi.flags = LVFI_STRING;
00728     lvfi.psz = szNewValue;
00729     iIndex = ListView_FindItem(g_pChildWnd->hListWnd, -1, &lvfi);
00730     if (iIndex >= 0)
00731         (void)ListView_EditLabel(g_pChildWnd->hListWnd, iIndex);
00732 
00733     return TRUE;
00734 }
00735 
00736 static HRESULT
00737 InitializeRemoteRegistryPicker(OUT IDsObjectPicker **pDsObjectPicker)
00738 {
00739     HRESULT hRet;
00740 
00741     *pDsObjectPicker = NULL;
00742 
00743     hRet = CoCreateInstance(&CLSID_DsObjectPicker,
00744                             NULL,
00745                             CLSCTX_INPROC_SERVER,
00746                             &IID_IDsObjectPicker,
00747                             (LPVOID*)pDsObjectPicker);
00748     if (SUCCEEDED(hRet))
00749     {
00750         DSOP_INIT_INFO InitInfo;
00751         static DSOP_SCOPE_INIT_INFO Scopes[] =
00752         {
00753             {
00754                 sizeof(DSOP_SCOPE_INIT_INFO),
00755                 DSOP_SCOPE_TYPE_USER_ENTERED_UPLEVEL_SCOPE | DSOP_SCOPE_TYPE_USER_ENTERED_DOWNLEVEL_SCOPE |
00756                 DSOP_SCOPE_TYPE_GLOBAL_CATALOG | DSOP_SCOPE_TYPE_EXTERNAL_UPLEVEL_DOMAIN |
00757                 DSOP_SCOPE_TYPE_EXTERNAL_DOWNLEVEL_DOMAIN | DSOP_SCOPE_TYPE_WORKGROUP |
00758                 DSOP_SCOPE_TYPE_UPLEVEL_JOINED_DOMAIN | DSOP_SCOPE_TYPE_DOWNLEVEL_JOINED_DOMAIN,
00759                 0,
00760                 {
00761                     {
00762                         DSOP_FILTER_COMPUTERS,
00763                         0,
00764                         0
00765                     },
00766                     DSOP_DOWNLEVEL_FILTER_COMPUTERS
00767                 },
00768                 NULL,
00769                 NULL,
00770                 S_OK
00771             },
00772         };
00773 
00774         InitInfo.cbSize = sizeof(InitInfo);
00775         InitInfo.pwzTargetComputer = NULL;
00776         InitInfo.cDsScopeInfos = sizeof(Scopes) / sizeof(Scopes[0]);
00777         InitInfo.aDsScopeInfos = Scopes;
00778         InitInfo.flOptions = 0;
00779         InitInfo.cAttributesToFetch = 0;
00780         InitInfo.apwzAttributeNames = NULL;
00781 
00782         hRet = (*pDsObjectPicker)->lpVtbl->Initialize(*pDsObjectPicker,
00783                 &InitInfo);
00784 
00785         if (FAILED(hRet))
00786         {
00787             /* delete the object picker in case initialization failed! */
00788             (*pDsObjectPicker)->lpVtbl->Release(*pDsObjectPicker);
00789         }
00790     }
00791 
00792     return hRet;
00793 }
00794 
00795 static HRESULT
00796 InvokeRemoteRegistryPickerDialog(IN IDsObjectPicker *pDsObjectPicker,
00797                                  IN HWND hwndParent  OPTIONAL,
00798                                  OUT LPTSTR lpBuffer,
00799                                  IN UINT uSize)
00800 {
00801     IDataObject *pdo = NULL;
00802     HRESULT hRet;
00803 
00804     hRet = pDsObjectPicker->lpVtbl->InvokeDialog(pDsObjectPicker,
00805             hwndParent,
00806             &pdo);
00807     if (hRet == S_OK)
00808     {
00809         STGMEDIUM stm;
00810         FORMATETC fe;
00811 
00812         fe.cfFormat = (CLIPFORMAT) RegisterClipboardFormat(CFSTR_DSOP_DS_SELECTION_LIST);
00813         fe.ptd = NULL;
00814         fe.dwAspect = DVASPECT_CONTENT;
00815         fe.lindex = -1;
00816         fe.tymed = TYMED_HGLOBAL;
00817 
00818         hRet = pdo->lpVtbl->GetData(pdo,
00819                                     &fe,
00820                                     &stm);
00821         if (SUCCEEDED(hRet))
00822         {
00823             PDS_SELECTION_LIST SelectionList = (PDS_SELECTION_LIST)GlobalLock(stm.hGlobal);
00824             if (SelectionList != NULL)
00825             {
00826                 if (SelectionList->cItems == 1)
00827                 {
00828                     size_t nlen = wcslen(SelectionList->aDsSelection[0].pwzName);
00829                     if (nlen >= uSize)
00830                     {
00831                         nlen = uSize - 1;
00832                     }
00833 #if UNICODE
00834                     memcpy(lpBuffer,
00835                            SelectionList->aDsSelection[0].pwzName,
00836                            nlen * sizeof(WCHAR));
00837 #else
00838                     WideCharToMultiByte(CP_ACP,
00839                                         0,
00840                                         SelectionList->aDsSelection[0].pwzName,
00841                                         nlen,
00842                                         lpBuffer,
00843                                         uSize,
00844                                         NULL,
00845                                         NULL);
00846 #endif
00847                     lpBuffer[nlen] = L'\0';
00848                 }
00849 
00850                 GlobalUnlock(stm.hGlobal);
00851             }
00852 
00853             ReleaseStgMedium(&stm);
00854         }
00855 
00856         pdo->lpVtbl->Release(pdo);
00857     }
00858 
00859     return hRet;
00860 }
00861 
00862 static VOID
00863 FreeObjectPicker(IN IDsObjectPicker *pDsObjectPicker)
00864 {
00865     pDsObjectPicker->lpVtbl->Release(pDsObjectPicker);
00866 }
00867 
00868 /*******************************************************************************
00869  *
00870  *  FUNCTION: _CmdWndProc(HWND, unsigned, WORD, LONG)
00871  *
00872  *  PURPOSE:  Processes WM_COMMAND messages for the main frame window.
00873  *
00874  */
00875 static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
00876 {
00877     HKEY hKeyRoot = 0, hKey = 0;
00878     LPCTSTR keyPath;
00879     LPCTSTR valueName;
00880     BOOL result = TRUE;
00881     REGSAM regsam = KEY_READ;
00882     LONG lRet;
00883     int item;
00884 
00885     UNREFERENCED_PARAMETER(lParam);
00886     UNREFERENCED_PARAMETER(message);
00887 
00888     switch (LOWORD(wParam))
00889     {
00890     case ID_REGISTRY_LOADHIVE:
00891         LoadHive(hWnd);
00892         return TRUE;
00893     case ID_REGISTRY_UNLOADHIVE:
00894         UnloadHive(hWnd);
00895         return TRUE;
00896     case ID_REGISTRY_IMPORTREGISTRYFILE:
00897         ImportRegistryFile(hWnd);
00898         return TRUE;
00899     case ID_REGISTRY_EXPORTREGISTRYFILE:
00900         ExportRegistryFile(hWnd);
00901         return TRUE;
00902     case ID_REGISTRY_CONNECTNETWORKREGISTRY:
00903     {
00904         IDsObjectPicker *ObjectPicker;
00905         TCHAR szComputerName[MAX_COMPUTERNAME_LENGTH + 1];
00906         HRESULT hRet;
00907 
00908         hRet = CoInitialize(NULL);
00909         if (SUCCEEDED(hRet))
00910         {
00911             hRet = InitializeRemoteRegistryPicker(&ObjectPicker);
00912             if (SUCCEEDED(hRet))
00913             {
00914                 hRet = InvokeRemoteRegistryPickerDialog(ObjectPicker,
00915                                                         hWnd,
00916                                                         szComputerName,
00917                                                         sizeof(szComputerName) / sizeof(szComputerName[0]));
00918                 if (hRet == S_OK)
00919                 {
00920                     /* FIXME - connect to the registry */
00921                 }
00922 
00923                 FreeObjectPicker(ObjectPicker);
00924             }
00925 
00926             CoUninitialize();
00927         }
00928 
00929         return TRUE;
00930     }
00931     case ID_REGISTRY_DISCONNECTNETWORKREGISTRY:
00932         return TRUE;
00933     case ID_REGISTRY_PRINT:
00934         PrintRegistryHive(hWnd, _T(""));
00935         return TRUE;
00936     case ID_REGISTRY_EXIT:
00937         DestroyWindow(hWnd);
00938         return TRUE;
00939     case ID_VIEW_STATUSBAR:
00940         toggle_child(hWnd, LOWORD(wParam), hStatusBar);
00941         return TRUE;
00942     case ID_HELP_HELPTOPICS:
00943         WinHelp(hWnd, _T("regedit"), HELP_FINDER, 0);
00944         return TRUE;
00945     case ID_HELP_ABOUT:
00946         ShowAboutBox(hWnd);
00947         return TRUE;
00948     case ID_VIEW_SPLIT:
00949     {
00950         RECT rt;
00951         POINT pt, pts;
00952         GetClientRect(g_pChildWnd->hWnd, &rt);
00953         pt.x = rt.left + g_pChildWnd->nSplitPos;
00954         pt.y = (rt.bottom / 2);
00955         pts = pt;
00956         if(ClientToScreen(g_pChildWnd->hWnd, &pts))
00957         {
00958             SetCursorPos(pts.x, pts.y);
00959             SetCursor(LoadCursor(0, IDC_SIZEWE));
00960             SendMessage(g_pChildWnd->hWnd, WM_LBUTTONDOWN, 0, MAKELPARAM(pt.x, pt.y));
00961         }
00962         return TRUE;
00963     }
00964     case ID_EDIT_RENAME:
00965     case ID_EDIT_MODIFY:
00966     case ID_EDIT_MODIFY_BIN:
00967     case ID_EDIT_DELETE:
00968         regsam |= KEY_WRITE;
00969         break;
00970     }
00971 
00972     keyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hKeyRoot);
00973     valueName = GetValueName(g_pChildWnd->hListWnd, -1);
00974     if (keyPath)
00975     {
00976         lRet = RegOpenKeyEx(hKeyRoot, keyPath, 0, regsam, &hKey);
00977         if (lRet != ERROR_SUCCESS) hKey = 0;
00978     }
00979 
00980     switch (LOWORD(wParam))
00981     {
00982     case ID_EDIT_MODIFY:
00983         if (valueName && ModifyValue(hWnd, hKey, valueName, FALSE))
00984             RefreshListView(g_pChildWnd->hListWnd, hKeyRoot, keyPath);
00985         break;
00986     case ID_EDIT_MODIFY_BIN:
00987         if (valueName && ModifyValue(hWnd, hKey, valueName, TRUE))
00988             RefreshListView(g_pChildWnd->hListWnd, hKeyRoot, keyPath);
00989         break;
00990     case ID_EDIT_RENAME:
00991         if (GetFocus() == g_pChildWnd->hListWnd)
00992         {
00993             if(ListView_GetSelectedCount(g_pChildWnd->hListWnd) == 1)
00994             {
00995                 item = ListView_GetNextItem(g_pChildWnd->hListWnd, -1, LVNI_SELECTED);
00996                 if(item > -1)
00997                 {
00998                     (void)ListView_EditLabel(g_pChildWnd->hListWnd, item);
00999                 }
01000             }
01001         }
01002         else if (GetFocus() == g_pChildWnd->hTreeWnd)
01003         {
01004             /* Get focused entry of treeview (if any) */
01005             HTREEITEM hItem = TreeView_GetSelection(g_pChildWnd->hTreeWnd);
01006             if (hItem != NULL)
01007                 (void)TreeView_EditLabel(g_pChildWnd->hTreeWnd, hItem);
01008         }
01009         break;
01010     case ID_EDIT_DELETE:
01011     {
01012         if (GetFocus() == g_pChildWnd->hListWnd)
01013         {
01014             UINT nSelected = ListView_GetSelectedCount(g_pChildWnd->hListWnd);
01015             if(nSelected >= 1)
01016             {
01017                 TCHAR msg[128], caption[128];
01018                 LoadString(hInst, IDS_QUERY_DELETE_CONFIRM, caption, sizeof(caption)/sizeof(TCHAR));
01019                 LoadString(hInst, (nSelected == 1 ? IDS_QUERY_DELETE_ONE : IDS_QUERY_DELETE_MORE), msg, sizeof(msg)/sizeof(TCHAR));
01020                 if(MessageBox(g_pChildWnd->hWnd, msg, caption, MB_ICONQUESTION | MB_YESNO) == IDYES)
01021                 {
01022                     int ni, errs;
01023 
01024                     item = -1;
01025                     errs = 0;
01026                     while((ni = ListView_GetNextItem(g_pChildWnd->hListWnd, item, LVNI_SELECTED)) > -1)
01027                     {
01028                         valueName = GetValueName(g_pChildWnd->hListWnd, item);
01029                         if(RegDeleteValue(hKey, valueName) != ERROR_SUCCESS)
01030                         {
01031                             errs++;
01032                         }
01033                         item = ni;
01034                     }
01035 
01036                     RefreshListView(g_pChildWnd->hListWnd, hKeyRoot, keyPath);
01037                     if(errs > 0)
01038                     {
01039                         LoadString(hInst, IDS_ERR_DELVAL_CAPTION, caption, sizeof(caption)/sizeof(TCHAR));
01040                         LoadString(hInst, IDS_ERR_DELETEVALUE, msg, sizeof(msg)/sizeof(TCHAR));
01041                         MessageBox(g_pChildWnd->hWnd, msg, caption, MB_ICONSTOP);
01042                     }
01043                 }
01044             }
01045         }
01046         else if (GetFocus() == g_pChildWnd->hTreeWnd)
01047         {
01048             if (keyPath == 0 || *keyPath == 0)
01049             {
01050                 MessageBeep(MB_ICONHAND);
01051             }
01052             else if (DeleteKey(hWnd, hKeyRoot, keyPath))
01053             {
01054                 DeleteNode(g_pChildWnd->hTreeWnd, 0);
01055                 RefreshTreeView(g_pChildWnd->hTreeWnd);
01056             }
01057         }
01058         break;
01059     }
01060     case ID_EDIT_NEW_STRINGVALUE:
01061         CreateNewValue(hKeyRoot, keyPath, REG_SZ);
01062         break;
01063     case ID_EDIT_NEW_BINARYVALUE:
01064         CreateNewValue(hKeyRoot, keyPath, REG_BINARY);
01065         break;
01066     case ID_EDIT_NEW_DWORDVALUE:
01067         CreateNewValue(hKeyRoot, keyPath, REG_DWORD);
01068         break;
01069     case ID_EDIT_NEW_MULTISTRINGVALUE:
01070         CreateNewValue(hKeyRoot, keyPath, REG_MULTI_SZ);
01071         break;
01072     case ID_EDIT_NEW_EXPANDABLESTRINGVALUE:
01073         CreateNewValue(hKeyRoot, keyPath, REG_EXPAND_SZ);
01074         break;
01075     case ID_EDIT_FIND:
01076         FindDialog(hWnd);
01077         break;
01078     case ID_EDIT_FINDNEXT:
01079         FindNext(hWnd);
01080         break;
01081     case ID_EDIT_COPYKEYNAME:
01082         CopyKeyName(hWnd, hKeyRoot, keyPath);
01083         break;
01084     case ID_EDIT_PERMISSIONS:
01085         RegKeyEditPermissions(hWnd, hKeyRoot, NULL, keyPath);
01086         break;
01087     case ID_REGISTRY_PRINTERSETUP:
01088         /*PRINTDLG pd;*/
01089         /*PrintDlg(&pd);*/
01090         /*PAGESETUPDLG psd;*/
01091         /*PageSetupDlg(&psd);*/
01092         break;
01093     case ID_REGISTRY_OPENLOCAL:
01094         break;
01095 
01096     case ID_VIEW_REFRESH:
01097         RefreshTreeView(g_pChildWnd->hTreeWnd);
01098         /*RefreshListView(g_pChildWnd->hListWnd, hKeyRoot, keyPath, NULL); */
01099         break;
01100         /*case ID_OPTIONS_TOOLBAR:*/
01101         /*  toggle_child(hWnd, LOWORD(wParam), hToolBar);*/
01102         /*    break;*/
01103     case ID_EDIT_NEW_KEY:
01104         CreateNewKey(g_pChildWnd->hTreeWnd, TreeView_GetSelection(g_pChildWnd->hTreeWnd));
01105         break;
01106     default:
01107         if ((LOWORD(wParam) >= ID_FAVORITES_MIN) && (LOWORD(wParam) <= ID_FAVORITES_MAX))
01108         {
01109             HMENU hMenu;
01110             MENUITEMINFO mii;
01111             TCHAR szFavorite[512];
01112 
01113             hMenu = GetSubMenu(GetMenu(hWnd), FAVORITES_MENU_POSITION);
01114 
01115             memset(&mii, 0, sizeof(mii));
01116             mii.cbSize = sizeof(mii);
01117             mii.fMask = MIIM_TYPE;
01118             mii.fType = MFT_STRING;
01119             mii.dwTypeData = szFavorite;
01120             mii.cch = sizeof(szFavorite) / sizeof(szFavorite[0]);
01121 
01122             if (GetMenuItemInfo(hMenu, LOWORD(wParam) - ID_FAVORITES_MIN, TRUE, &mii))
01123             {
01124                 ChooseFavorite(szFavorite);
01125             }
01126         }
01127         else
01128         {
01129             result = FALSE;
01130         }
01131         break;
01132     }
01133 
01134     if(hKey)
01135         RegCloseKey(hKey);
01136     return result;
01137 }
01138 
01139 /********************************************************************************
01140  *
01141  *  FUNCTION: FrameWndProc(HWND, unsigned, WORD, LONG)
01142  *
01143  *  PURPOSE:  Processes messages for the main frame window.
01144  *
01145  *  WM_COMMAND  - process the application menu
01146  *  WM_DESTROY  - post a quit message and return
01147  *
01148  */
01149 
01150 LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
01151 {
01152     switch (message)
01153     {
01154     case WM_CREATE:
01155         CreateWindowEx(0, szChildClass, NULL, WS_CHILD | WS_VISIBLE,
01156                        CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
01157                        hWnd, (HMENU)0, hInst, 0);
01158         break;
01159     case WM_COMMAND:
01160         if (!_CmdWndProc(hWnd, message, wParam, lParam))
01161             return DefWindowProc(hWnd, message, wParam, lParam);
01162         break;
01163     case WM_ACTIVATE:
01164         if (LOWORD(hWnd))
01165             SetFocus(g_pChildWnd->hWnd);
01166         break;
01167     case WM_SIZE:
01168         resize_frame_client(hWnd);
01169         break;
01170     case WM_TIMER:
01171         break;
01172     case WM_INITMENU:
01173         OnInitMenu(hWnd);
01174         break;
01175     case WM_ENTERMENULOOP:
01176         OnEnterMenuLoop(hWnd);
01177         break;
01178     case WM_EXITMENULOOP:
01179         OnExitMenuLoop(hWnd);
01180         break;
01181     case WM_MENUSELECT:
01182         OnMenuSelect(hWnd, LOWORD(wParam), HIWORD(wParam), (HMENU)lParam);
01183         break;
01184     case WM_SYSCOLORCHANGE:
01185         /* Forward WM_SYSCOLORCHANGE to common controls */
01186         SendMessage(g_pChildWnd->hListWnd, WM_SYSCOLORCHANGE, 0, 0);
01187         SendMessage(g_pChildWnd->hTreeWnd, WM_SYSCOLORCHANGE, 0, 0);
01188         break;
01189     case WM_DESTROY:
01190         WinHelp(hWnd, _T("regedit"), HELP_QUIT, 0);
01191         SaveSettings();
01192         PostQuitMessage(0);
01193     default:
01194         return DefWindowProc(hWnd, message, wParam, lParam);
01195     }
01196     return 0;
01197 }

Generated on Sun May 27 2012 04:17:41 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.