Merged regedit from winehq cvs.

Moved to new home in reactos tree.
 - I know I said I was on vacation

svn path=/trunk/; revision=5738
This commit is contained in:
Steven Edwards 2003-08-22 05:55:14 +00:00
parent cd80ac4da7
commit f6d8e666a9
36 changed files with 2215 additions and 2357 deletions

View file

@ -0,0 +1,232 @@
/*
* Regedit resources
*
* Copyright 2002 Robert Dickenson
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(850)
/*
* Menu
*/
IDC_REGEDIT MENU DISCARDABLE
BEGIN
POPUP "&File"
BEGIN
MENUITEM "E&xit", ID_REGISTRY_EXIT
END
POPUP "&Help"
BEGIN
MENUITEM "&About ...", ID_HELP_ABOUT
END
END
IDR_REGEDIT_MENU MENU DISCARDABLE
BEGIN
POPUP "&Registry"
BEGIN
MENUITEM "&Import Registry File...", ID_REGISTRY_IMPORTREGISTRYFILE
MENUITEM "&Export Registry File...", ID_REGISTRY_EXPORTREGISTRYFILE
MENUITEM SEPARATOR
MENUITEM "&Connect Network Registry...",
ID_REGISTRY_CONNECTNETWORKREGISTRY
, GRAYED
MENUITEM "&Disconnect Network Registry...",
ID_REGISTRY_DISCONNECTNETWORKREGISTRY
, GRAYED
MENUITEM SEPARATOR
MENUITEM "&Print\tCtrl+P", ID_REGISTRY_PRINT, GRAYED
MENUITEM SEPARATOR
MENUITEM "E&xit", ID_REGISTRY_EXIT
END
POPUP "&Edit"
BEGIN
MENUITEM "&Modify", ID_EDIT_MODIFY
MENUITEM SEPARATOR
POPUP "&New"
BEGIN
MENUITEM "&Key", ID_EDIT_NEW_KEY
MENUITEM SEPARATOR
MENUITEM "&String Value", ID_EDIT_NEW_STRINGVALUE
MENUITEM "&Binary Value", ID_EDIT_NEW_BINARYVALUE
MENUITEM "&DWORD Value", ID_EDIT_NEW_DWORDVALUE
END
MENUITEM SEPARATOR
MENUITEM "&Delete\tDel", ID_EDIT_DELETE
MENUITEM "&Rename", ID_EDIT_RENAME
MENUITEM SEPARATOR
MENUITEM "&Copy Key Name", ID_EDIT_COPYKEYNAME
MENUITEM SEPARATOR
MENUITEM "&Find\tCtrl+F", ID_EDIT_FIND, GRAYED
MENUITEM "Find Ne&xt\tF3", ID_EDIT_FINDNEXT, GRAYED
END
POPUP "&View"
BEGIN
MENUITEM "Status &Bar", ID_VIEW_STATUSBAR
MENUITEM SEPARATOR
MENUITEM "Sp&lit", ID_VIEW_SPLIT
MENUITEM SEPARATOR
MENUITEM "&Refresh\tF5", ID_VIEW_REFRESH
END
POPUP "&Favourites"
BEGIN
MENUITEM "&Add to Favourites", ID_FAVOURITES_ADDTOFAVOURITES
, GRAYED
MENUITEM "&Remove Favourite", ID_FAVOURITES_REMOVEFAVOURITE
, GRAYED
END
POPUP "&Help"
BEGIN
/*
* MENUITEM "&Help Topics", ID_HELP_HELPTOPICS
* MENUITEM SEPARATOR
*/
MENUITEM "&About Registry Editor", ID_HELP_ABOUT
END
END
/*
* Dialog
*/
IDD_ABOUTBOX DIALOG DISCARDABLE 22, 17, 230, 75
STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
CAPTION "About"
FONT 8, "System"
BEGIN
ICON IDI_REGEDIT,IDI_REGEDIT,14,9,16,16
LTEXT "ReactOS regedit Version 1.0",IDC_STATIC,49,10,119,8,
SS_NOPREFIX
LTEXT "Copyright (C) 2002 ReactOS Team",IDC_STATIC,49,20,119,8
DEFPUSHBUTTON "OK",IDOK,195,6,30,11,WS_GROUP
END
/*
* String Table
*/
STRINGTABLE DISCARDABLE
BEGIN
IDS_LIST_COLUMN_NAME "Name"
IDS_LIST_COLUMN_TYPE "Type"
IDS_LIST_COLUMN_DATA "Data"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_APP_TITLE "Registry Editor"
IDC_REGEDIT "REGEDIT"
IDC_REGEDIT_FRAME "REGEDIT_FRAME"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_REGISTRY_MENU "Contains commands for working with the whole registry"
ID_EDIT_MENU "Contains commands for editing values or keys"
ID_VIEW_MENU "Contains commands for customising the registry window"
ID_FAVOURITES_MENU "Contains commands for accessing frequently used keys"
ID_HELP_MENU "Contains commands for displaying help and information about registry editor"
ID_EDIT_NEW_MENU "Contains commands for creating new keys or values"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_EDIT_MODIFY "Modifies the value's data"
ID_EDIT_NEW_KEY "Adds a new key"
ID_EDIT_NEW_STRINGVALUE "Adds a new string value"
ID_EDIT_NEW_BINARYVALUE "Adds a new binary value"
ID_EDIT_NEW_DWORDVALUE "Adds a new double word value"
ID_REGISTRY_IMPORTREGISTRYFILE "Imports a text file into the registry"
ID_REGISTRY_EXPORTREGISTRYFILE
"Exports all or part of the registry to a text file"
ID_REGISTRY_CONNECTNETWORKREGISTRY
"Connects to a remote computer's registry"
ID_REGISTRY_DISCONNECTNETWORKREGISTRY
"Disconnects from a remote computer's registry"
ID_REGISTRY_PRINT "Prints all or part of the registry"
/* ID_HELP_HELPTOPICS "Opens registry editor help" */
ID_HELP_ABOUT "Displays program information, version number and copyright"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_REGISTRY_EXIT "Quits the registry editor"
ID_FAVOURITES_ADDTOFAVOURITES "Adds keys to the favourites list"
ID_FAVOURITES_REMOVEFAVOURITE "Removes keys from the favourites list"
ID_VIEW_STATUSBAR "Shows or hides the status bar"
ID_VIEW_SPLIT "Change position of split between two panes"
ID_VIEW_REFRESH "Refreshes the window"
ID_EDIT_DELETE "Deletes the selection"
ID_EDIT_RENAME "Renames the selection"
ID_EDIT_COPYKEYNAME "Copies the name of the selected key to the clipboard"
ID_EDIT_FIND "Finds a text string in a key, value or data"
ID_EDIT_FINDNEXT "Finds next occurrence of text specified in previous search"
END
/*****************************************************************/
/*
* Dialog
*/
IDD_DIALOG1 DIALOG DISCARDABLE 50, 50, 268, 98
STYLE DS_3DLOOK | DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS |
WS_BORDER
FONT 8, "MS Sans Serif"
BEGIN
END
IDD_DIALOG2 DIALOG DISCARDABLE 0, 0, 187, 95
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Dialog"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,130,7,50,14
PUSHBUTTON "Cancel",IDCANCEL,130,24,50,14
END
/*
* TEXTINCLUDE
*/
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
/*
* String Table
*/
/*
*STRINGTABLE DISCARDABLE
*BEGIN
* ID_HELP_HELPTOPICS "Opens Registry Editor Help."
* ID_HELP_ABOUT "Displays program information, version number, and copyright."
*END
*/
/*****************************************************************/

View file

@ -0,0 +1,206 @@
/*
* Regedit resources
*
* Copyright 2003 Marcelo Duarte
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
LANGUAGE LANG_PORTUGUESE, SUBLANG_DEFAULT
/*
* Menu
*/
IDC_REGEDIT MENU DISCARDABLE
BEGIN
POPUP "&Arquivo"
BEGIN
MENUITEM "Sai&r", ID_REGISTRY_EXIT
END
POPUP "Aj&uda"
BEGIN
MENUITEM "&Sobre...", ID_HELP_ABOUT
END
END
IDR_REGEDIT_MENU MENU DISCARDABLE
BEGIN
POPUP "&Registro"
BEGIN
MENUITEM "&Importar arquivo do Registro...", ID_REGISTRY_IMPORTREGISTRYFILE
MENUITEM "&Exportar arquivo do Registro...", ID_REGISTRY_EXPORTREGISTRYFILE
MENUITEM SEPARATOR
MENUITEM "&Conectar Registro da rede...", ID_REGISTRY_CONNECTNETWORKREGISTRY, GRAYED
MENUITEM "&Desconectar Registro da rede...", ID_REGISTRY_DISCONNECTNETWORKREGISTRY, GRAYED
MENUITEM SEPARATOR
MENUITEM "Im&primir\tCtrl+P", ID_REGISTRY_PRINT, GRAYED
MENUITEM SEPARATOR
MENUITEM "Sai&r", ID_REGISTRY_EXIT
END
POPUP "&Editar"
BEGIN
MENUITEM "&Modificar", ID_EDIT_MODIFY
MENUITEM SEPARATOR
POPUP "&Novo"
BEGIN
MENUITEM "&Chave", ID_EDIT_NEW_KEY
MENUITEM SEPARATOR
MENUITEM "Valor &Texto", ID_EDIT_NEW_STRINGVALUE
MENUITEM "Valor &Binário", ID_EDIT_NEW_BINARYVALUE
MENUITEM "Valor &DWORD", ID_EDIT_NEW_DWORDVALUE
END
MENUITEM SEPARATOR
MENUITEM "&Excluir\tDel", ID_EDIT_DELETE
MENUITEM "&Renomear", ID_EDIT_RENAME
MENUITEM SEPARATOR
MENUITEM "&Copiar nome da chave", ID_EDIT_COPYKEYNAME
MENUITEM SEPARATOR
MENUITEM "&Localizar\tCtrl+F", ID_EDIT_FIND, GRAYED
MENUITEM "L&ocalizar próxima\tF3", ID_EDIT_FINDNEXT, GRAYED
END
POPUP "E&xibir"
BEGIN
MENUITEM "&Barra de status", ID_VIEW_STATUSBAR
MENUITEM SEPARATOR
MENUITEM "&Dividir", ID_VIEW_SPLIT
MENUITEM SEPARATOR
MENUITEM "&Atualizar\tF5", ID_VIEW_REFRESH
END
POPUP "&Favoritos"
BEGIN
MENUITEM "&Add to Favourites", ID_FAVOURITES_ADDTOFAVOURITES
, GRAYED
MENUITEM "&Remove Favourite", ID_FAVOURITES_REMOVEFAVOURITE
, GRAYED
END
POPUP "Aj&uda"
BEGIN
/*
* MENUITEM "&Topics da Ajuda", ID_HELP_HELPTOPICS
* MENUITEM SEPARATOR
*/
MENUITEM "&Sobre o Editor do Registro", ID_HELP_ABOUT
END
END
/*
* Dialog
*/
IDD_ABOUTBOX DIALOG DISCARDABLE 22, 17, 230, 75
STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
CAPTION "Sobre"
FONT 8, "System"
BEGIN
ICON IDI_REGEDIT,IDI_REGEDIT,14,9,16,16
LTEXT "ReactOS regedit Version 1.0",IDC_STATIC,49,10,119,8,
SS_NOPREFIX
LTEXT "Copyright (C) 2002 ReactOS Team",IDC_STATIC,49,20,119,8
DEFPUSHBUTTON "OK",IDOK,195,6,30,11,WS_GROUP
END
/*
* String Table
*/
STRINGTABLE DISCARDABLE
BEGIN
IDS_LIST_COLUMN_NAME "Nome"
IDS_LIST_COLUMN_TYPE "Tipo"
IDS_LIST_COLUMN_DATA "Dados"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_APP_TITLE "Editor do Registro"
IDC_REGEDIT "REGEDIT"
IDC_REGEDIT_FRAME "REGEDIT_FRAME"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_REGISTRY_MENU "Contém comandos para trabalhar com o Registro inteiro."
ID_EDIT_MENU "Contém comandos para a edição de valores ou chaves."
ID_VIEW_MENU "Contém comandos para a personalização da janela do Registro."
ID_FAVOURITES_MENU "Contém comandos para acessar chaves frequentemente usadas."
ID_HELP_MENU "Contém comandos para a exibição da ajuda e informações sobre o Editor do Registro."
ID_EDIT_NEW_MENU "Contém comandos para a creação de novas chaves ou valores"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_EDIT_MODIFY "Modifica os dados do valor."
ID_EDIT_NEW_KEY "Adiciona uma nova chave"
ID_EDIT_NEW_STRINGVALUE "Adiciona um novo valor texto."
ID_EDIT_NEW_BINARYVALUE "Adiciona um novo valor binário."
ID_EDIT_NEW_DWORDVALUE "Adiciona um novo valor DWORD."
ID_REGISTRY_IMPORTREGISTRYFILE "Importa um arquivo texto para o registro."
ID_REGISTRY_EXPORTREGISTRYFILE
"Exporta todo ou parte do registro para um arquivo texto."
ID_REGISTRY_CONNECTNETWORKREGISTRY
"Conecta a um registro em um computador remoto."
ID_REGISTRY_DISCONNECTNETWORKREGISTRY
"Desconecta de um registro um computador remoto."
ID_REGISTRY_PRINT "Imprime todo ou parte do registro."
/* ID_HELP_HELPTOPICS "Abre a ajuda do Editor do Registro." */
ID_HELP_ABOUT "Exibe informações do programa, número da versão e copyright."
END
STRINGTABLE DISCARDABLE
BEGIN
ID_REGISTRY_EXIT "Encerra o Editor do Registro."
ID_FAVOURITES_ADDTOFAVOURITES "Adiciona chaves a lista de favoritos."
ID_FAVOURITES_REMOVEFAVOURITE "Remove chaves da lista de favoritos."
ID_VIEW_STATUSBAR "Mostra ou oculta a barra de status."
ID_VIEW_SPLIT "Altera a posição da divisão entre os painéis."
ID_VIEW_REFRESH "Atualiza a janela."
ID_EDIT_DELETE "Exclui a selecão."
ID_EDIT_RENAME "Renomeia a selecão."
ID_EDIT_COPYKEYNAME "Copia o nome da chave selecionada para a Área de transferência."
ID_EDIT_FIND "Localiza um texto em uma chave, valor ou dado."
ID_EDIT_FINDNEXT "Localiza a próxima ocorrência do texto especificado na pesquisa anterior."
END
/*
* Dialog
*/
IDD_DIALOG1 DIALOG DISCARDABLE 50, 50, 268, 98
STYLE DS_3DLOOK | DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS |
WS_BORDER
FONT 8, "MS Sans Serif"
BEGIN
END
IDD_DIALOG2 DIALOG DISCARDABLE 0, 0, 187, 95
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Dialog"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,130,7,50,14
PUSHBUTTON "Cancelar",IDCANCEL,130,24,50,14
END
/*
* TEXTINCLUDE
*/
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END

View file

@ -1,9 +1,7 @@
/* /*
* ReactOS About Dialog Box * Regedit About Dialog Box
* *
* about.c * Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -19,23 +17,20 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers //#define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
#include <windows.h> #include <windows.h>
#include <commctrl.h> #include <commctrl.h>
#include <stdlib.h> #include <stdlib.h>
#include <tchar.h> #include <tchar.h>
#include <process.h> #include <process.h>
#include <stdio.h> #include <stdio.h>
#include "main.h"
#include "about.h"
#include "main.h"
extern HINSTANCE hInst; extern HINSTANCE hInst;
static INT_PTR CALLBACK AboutDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
LRESULT CALLBACK AboutDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{ {
HWND hLicenseEditWnd; HWND hLicenseEditWnd;
TCHAR strLicense[0x1000]; TCHAR strLicense[0x1000];
@ -58,6 +53,5 @@ LRESULT CALLBACK AboutDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPAR
void ShowAboutBox(HWND hWnd) void ShowAboutBox(HWND hWnd)
{ {
DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, (DLGPROC)AboutDialogWndProc); DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, AboutDialogWndProc);
} }

View file

@ -1,9 +1,7 @@
/* /*
* ReactOS regedit * Regedit child window
* *
* childwnd.c * Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -20,7 +18,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
#include <windows.h> #include <windows.h>
#include <tchar.h> #include <tchar.h>
#include <commctrl.h> #include <commctrl.h>
@ -28,15 +26,11 @@
#define ASSERT assert #define ASSERT assert
#include "main.h" #include "main.h"
#include "framewnd.h"
#include "childwnd.h"
#include "treeview.h"
#include "listview.h"
//////////////////////////////////////////////////////////////////////////////// /*******************************************************************************
// Local module support methods * Local module support methods
// */
static void MakeFullRegPath(HWND hwndTV, HTREEITEM hItem, LPTSTR keyPath, int* pPathLen, int max) static void MakeFullRegPath(HWND hwndTV, HTREEITEM hItem, LPTSTR keyPath, int* pPathLen, int max)
{ {
@ -45,7 +39,7 @@ static void MakeFullRegPath(HWND hwndTV, HTREEITEM hItem, LPTSTR keyPath, int* p
item.hItem = hItem; item.hItem = hItem;
if (TreeView_GetItem(hwndTV, &item)) { if (TreeView_GetItem(hwndTV, &item)) {
if (item.hItem != TreeView_GetRoot(hwndTV)) { if (item.hItem != TreeView_GetRoot(hwndTV)) {
// recurse /* recurse */
MakeFullRegPath(hwndTV, TreeView_GetParent(hwndTV, hItem), keyPath, pPathLen, max); MakeFullRegPath(hwndTV, TreeView_GetParent(hwndTV, hItem), keyPath, pPathLen, max);
keyPath[*pPathLen] = _T('\\'); keyPath[*pPathLen] = _T('\\');
++(*pPathLen); ++(*pPathLen);
@ -95,23 +89,23 @@ static void OnPaint(HWND hWnd)
EndPaint(hWnd, &ps); EndPaint(hWnd, &ps);
} }
//////////////////////////////////////////////////////////////////////////////// /*******************************************************************************
// *
// FUNCTION: _CmdWndProc(HWND, unsigned, WORD, LONG) * FUNCTION: _CmdWndProc(HWND, unsigned, WORD, LONG)
// *
// PURPOSE: Processes WM_COMMAND messages for the main frame window. * PURPOSE: Processes WM_COMMAND messages for the main frame window.
// *
// */
static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
switch (LOWORD(wParam)) { switch (LOWORD(wParam)) {
// Parse the menu selections: /* Parse the menu selections: */
case ID_REGISTRY_EXIT: case ID_REGISTRY_EXIT:
DestroyWindow(hWnd); DestroyWindow(hWnd);
break; break;
case ID_VIEW_REFRESH: case ID_VIEW_REFRESH:
// TODO: /* TODO */
break; break;
default: default:
return FALSE; return FALSE;
@ -119,21 +113,21 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
return TRUE; return TRUE;
} }
//////////////////////////////////////////////////////////////////////////////// /*******************************************************************************
// *
// FUNCTION: ChildWndProc(HWND, unsigned, WORD, LONG) * FUNCTION: ChildWndProc(HWND, unsigned, WORD, LONG)
// *
// PURPOSE: Processes messages for the child windows. * PURPOSE: Processes messages for the child windows.
// *
// WM_COMMAND - process the application menu * WM_COMMAND - process the application menu
// WM_PAINT - Paint the main window * WM_PAINT - Paint the main window
// WM_DESTROY - post a quit message and return * WM_DESTROY - post a quit message and return
// *
// */
LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
static int last_split; static int last_split;
// ChildWnd* pChildWnd = (ChildWnd*)GetWindowLong(hWnd, GWL_USERDATA); /* ChildWnd* pChildWnd = (ChildWnd*)GetWindowLong(hWnd, GWL_USERDATA); */
static ChildWnd* pChildWnd; static ChildWnd* pChildWnd;
switch (message) { switch (message) {
@ -236,8 +230,8 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
case WM_NOTIFY: case WM_NOTIFY:
if ((int)wParam == TREE_WINDOW) { if ((int)wParam == TREE_WINDOW) {
switch (((LPNMHDR)lParam)->code) { switch (((LPNMHDR)lParam)->code) {
case TVN_ITEMEXPANDING: case TVN_ITEMEXPANDING:
return !OnTreeExpanding(pChildWnd->hTreeWnd, (NMTREEVIEW*)lParam); return !OnTreeExpanding(pChildWnd->hTreeWnd, (NMTREEVIEW*)lParam);
case TVN_SELCHANGED: case TVN_SELCHANGED:
{ {
@ -269,7 +263,7 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
if (wParam != SIZE_MINIMIZED && pChildWnd != NULL) { if (wParam != SIZE_MINIMIZED && pChildWnd != NULL) {
ResizeWnd(pChildWnd, LOWORD(lParam), HIWORD(lParam)); ResizeWnd(pChildWnd, LOWORD(lParam), HIWORD(lParam));
} }
// fall through /* fall through */
default: def: default: def:
return DefWindowProc(hWnd, message, wParam, lParam); return DefWindowProc(hWnd, message, wParam, lParam);
} }

View file

@ -1,9 +1,7 @@
/* /*
* ReactOS regedit * Regedit frame window
* *
* framewnd.c * Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -20,34 +18,31 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
//#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
#include <windows.h> #include <windows.h>
#include <tchar.h> #include <tchar.h>
#include <commctrl.h> #include <commctrl.h>
#include <commdlg.h> #include <commdlg.h>
#include <cderr.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include "main.h"
#include "about.h"
#include "framewnd.h"
#include "treeview.h"
#include "listview.h"
#include <shellapi.h> #include <shellapi.h>
#include "main.h"
#include "regproc.h" #include "regproc.h"
//////////////////////////////////////////////////////////////////////////////// /********************************************************************************
// Global and Local Variables: * Global and Local Variables:
// */
static BOOL bInMenuLoop = FALSE; // Tells us if we are in the menu loop static BOOL bInMenuLoop = FALSE; /* Tells us if we are in the menu loop */
static HWND hChildWnd; static HWND hChildWnd;
//////////////////////////////////////////////////////////////////////////////// /*******************************************************************************
// Local module support methods * Local module support methods
// */
static void resize_frame_rect(HWND hWnd, PRECT prect) static void resize_frame_rect(HWND hWnd, PRECT prect)
{ {
@ -76,13 +71,13 @@ void resize_frame_client(HWND hWnd)
resize_frame_rect(hWnd, &rect); resize_frame_rect(hWnd, &rect);
} }
//////////////////////////////////////////////////////////////////////////////// /********************************************************************************/
static void OnEnterMenuLoop(HWND hWnd) static void OnEnterMenuLoop(HWND hWnd)
{ {
int nParts; int nParts;
// Update the status bar pane sizes /* Update the status bar pane sizes */
nParts = -1; nParts = -1;
SendMessage(hStatusBar, SB_SETPARTS, 1, (long)&nParts); SendMessage(hStatusBar, SB_SETPARTS, 1, (long)&nParts);
bInMenuLoop = TRUE; bInMenuLoop = TRUE;
@ -92,7 +87,7 @@ static void OnEnterMenuLoop(HWND hWnd)
static void OnExitMenuLoop(HWND hWnd) static void OnExitMenuLoop(HWND hWnd)
{ {
bInMenuLoop = FALSE; bInMenuLoop = FALSE;
// Update the status bar pane sizes /* Update the status bar pane sizes*/
SetupStatusBar(hWnd, TRUE); SetupStatusBar(hWnd, TRUE);
UpdateStatusBar(); UpdateStatusBar();
} }
@ -108,9 +103,9 @@ static void OnMenuSelect(HWND hWnd, UINT nItemID, UINT nFlags, HMENU hSysMenu)
} }
} }
if (LoadString(hInst, nItemID, str, 100)) { if (LoadString(hInst, nItemID, str, 100)) {
// load appropriate string /* load appropriate string*/
LPTSTR lpsz = str; LPTSTR lpsz = str;
// first newline terminates actual string /* first newline terminates actual string*/
lpsz = _tcschr(lpsz, '\n'); lpsz = _tcschr(lpsz, '\n');
if (lpsz != NULL) if (lpsz != NULL)
*lpsz = '\0'; *lpsz = '\0';
@ -124,7 +119,7 @@ void SetupStatusBar(HWND hWnd, BOOL bResize)
int nParts; int nParts;
GetClientRect(hWnd, &rc); GetClientRect(hWnd, &rc);
nParts = rc.right; nParts = rc.right;
// nParts = -1; /* nParts = -1;*/
if (bResize) if (bResize)
SendMessage(hStatusBar, WM_SIZE, 0, 0); SendMessage(hStatusBar, WM_SIZE, 0, 0);
SendMessage(hStatusBar, SB_SETPARTS, 1, (LPARAM)&nParts); SendMessage(hStatusBar, SB_SETPARTS, 1, (LPARAM)&nParts);
@ -230,18 +225,18 @@ static BOOL InitOpenFileName(HWND hWnd, OPENFILENAME* pofn)
pofn->nMaxFile = _MAX_PATH; pofn->nMaxFile = _MAX_PATH;
pofn->lpstrFileTitle = FileTitleBuffer; pofn->lpstrFileTitle = FileTitleBuffer;
pofn->nMaxFileTitle = _MAX_PATH; pofn->nMaxFileTitle = _MAX_PATH;
// pofn->lpstrInitialDir = _T(""); /* pofn->lpstrInitialDir = _T("");*/
// pofn->lpstrTitle = _T("Import Registry File"); /* pofn->lpstrTitle = _T("Import Registry File");*/
// pofn->Flags = OFN_ENABLETEMPLATE + OFN_EXPLORER + OFN_ENABLESIZING; /* pofn->Flags = OFN_ENABLETEMPLATE + OFN_EXPLORER + OFN_ENABLESIZING;*/
pofn->Flags = OFN_HIDEREADONLY; pofn->Flags = OFN_HIDEREADONLY;
// pofn->nFileOffset = ; /* pofn->nFileOffset = ;*/
// pofn->nFileExtension = ; /* pofn->nFileExtension = ;*/
// pofn->lpstrDefExt = _T(""); /* pofn->lpstrDefExt = _T("");*/
// pofn->lCustData = ; /* pofn->lCustData = ;*/
// pofn->lpfnHook = ImportRegistryFile_OFNHookProc; /* pofn->lpfnHook = ImportRegistryFile_OFNHookProc;*/
// pofn->lpTemplateName = _T("ID_DLG_IMPORT_REGFILE"); /* pofn->lpTemplateName = _T("ID_DLG_IMPORT_REGFILE");*/
// pofn->lpTemplateName = MAKEINTRESOURCE(IDD_DIALOG1); /* pofn->lpTemplateName = MAKEINTRESOURCE(IDD_DIALOG1);*/
// pofn->FlagsEx = ; /* pofn->FlagsEx = ;*/
return TRUE; return TRUE;
} }
@ -251,29 +246,29 @@ static BOOL ImportRegistryFile(HWND hWnd)
InitOpenFileName(hWnd, &ofn); InitOpenFileName(hWnd, &ofn);
ofn.lpstrTitle = _T("Import Registry File"); ofn.lpstrTitle = _T("Import Registry File");
// ofn.lCustData = ; /* ofn.lCustData = ;*/
if (GetOpenFileName(&ofn)) { if (GetOpenFileName(&ofn)) {
if (!import_registry_file(ofn.lpstrFile)) { if (!import_registry_file(ofn.lpstrFile)) {
//printf("Can't open file \"%s\"\n", ofn.lpstrFile); /*printf("Can't open file \"%s\"\n", ofn.lpstrFile);*/
return FALSE; return FALSE;
} }
/* #if 0
get_file_name(&s, filename, MAX_PATH); get_file_name(&s, filename, MAX_PATH);
if (!filename[0]) { if (!filename[0]) {
printf("No file name is specified\n%s", usage); printf("No file name is specified\n%s", usage);
return FALSE; return FALSE;
//exit(1); /*exit(1);*/
} }
while (filename[0]) { while (filename[0]) {
if (!import_registry_file(filename)) { if (!import_registry_file(filename)) {
perror(""); perror("");
printf("Can't open file \"%s\"\n", filename); printf("Can't open file \"%s\"\n", filename);
return FALSE; return FALSE;
//exit(1); /*exit(1);*/
} }
get_file_name(&s, filename, MAX_PATH); get_file_name(&s, filename, MAX_PATH);
} }
*/ #endif
} else { } else {
CheckCommDlgError(hWnd); CheckCommDlgError(hWnd);
} }
@ -289,27 +284,27 @@ static BOOL ExportRegistryFile(HWND hWnd)
ExportKeyPath[0] = _T('\0'); ExportKeyPath[0] = _T('\0');
InitOpenFileName(hWnd, &ofn); InitOpenFileName(hWnd, &ofn);
ofn.lpstrTitle = _T("Export Registry File"); ofn.lpstrTitle = _T("Export Registry File");
// ofn.lCustData = ; /* ofn.lCustData = ;*/
ofn.Flags = OFN_ENABLETEMPLATE + OFN_EXPLORER; ofn.Flags = OFN_ENABLETEMPLATE + OFN_EXPLORER;
ofn.lpfnHook = ImportRegistryFile_OFNHookProc; ofn.lpfnHook = ImportRegistryFile_OFNHookProc;
ofn.lpTemplateName = MAKEINTRESOURCE(IDD_DIALOG1); ofn.lpTemplateName = MAKEINTRESOURCE(IDD_DIALOG1);
if (GetSaveFileName(&ofn)) { if (GetSaveFileName(&ofn)) {
BOOL result; BOOL result;
result = export_registry_key(ofn.lpstrFile, ExportKeyPath); result = export_registry_key(ofn.lpstrFile, ExportKeyPath);
//result = export_registry_key(ofn.lpstrFile, NULL); /*result = export_registry_key(ofn.lpstrFile, NULL);*/
//if (!export_registry_key(ofn.lpstrFile, NULL)) { /*if (!export_registry_key(ofn.lpstrFile, NULL)) {*/
if (!result) { if (!result) {
//printf("Can't open file \"%s\"\n", ofn.lpstrFile); /*printf("Can't open file \"%s\"\n", ofn.lpstrFile);*/
return FALSE; return FALSE;
} }
/* #if 0
TCHAR filename[MAX_PATH]; TCHAR filename[MAX_PATH];
filename[0] = '\0'; filename[0] = '\0';
get_file_name(&s, filename, MAX_PATH); get_file_name(&s, filename, MAX_PATH);
if (!filename[0]) { if (!filename[0]) {
printf("No file name is specified\n%s", usage); printf("No file name is specified\n%s", usage);
return FALSE; return FALSE;
//exit(1); /*exit(1);*/
} }
if (s[0]) { if (s[0]) {
TCHAR reg_key_name[KEY_MAX_LEN]; TCHAR reg_key_name[KEY_MAX_LEN];
@ -318,7 +313,7 @@ static BOOL ExportRegistryFile(HWND hWnd)
} else { } else {
export_registry_key(filename, NULL); export_registry_key(filename, NULL);
} }
*/ #endif
} else { } else {
CheckCommDlgError(hWnd); CheckCommDlgError(hWnd);
} }
@ -333,19 +328,19 @@ BOOL PrintRegistryHive(HWND hWnd, LPTSTR path)
ZeroMemory(&pd, sizeof(PRINTDLG)); ZeroMemory(&pd, sizeof(PRINTDLG));
pd.lStructSize = sizeof(PRINTDLG); pd.lStructSize = sizeof(PRINTDLG);
pd.hwndOwner = hWnd; pd.hwndOwner = hWnd;
pd.hDevMode = NULL; // Don't forget to free or store hDevMode pd.hDevMode = NULL; /* Don't forget to free or store hDevMode*/
pd.hDevNames = NULL; // Don't forget to free or store hDevNames pd.hDevNames = NULL; /* Don't forget to free or store hDevNames*/
pd.Flags = PD_USEDEVMODECOPIESANDCOLLATE | PD_RETURNDC; pd.Flags = PD_USEDEVMODECOPIESANDCOLLATE | PD_RETURNDC;
pd.nCopies = 1; pd.nCopies = 1;
pd.nFromPage = 0xFFFF; pd.nFromPage = 0xFFFF;
pd.nToPage = 0xFFFF; pd.nToPage = 0xFFFF;
pd.nMinPage = 1; pd.nMinPage = 1;
pd.nMaxPage = 0xFFFF; pd.nMaxPage = 0xFFFF;
if (PrintDlg(&pd) == TRUE) { if (PrintDlg(&pd) == TRUE) {
// GDI calls to render output. /* GDI calls to render output. */
DeleteDC(pd.hDC); // Delete DC when done. DeleteDC(pd.hDC); /* Delete DC when done.*/
} }
#else #else
HRESULT hResult; HRESULT hResult;
PRINTDLGEX pd; PRINTDLGEX pd;
@ -353,13 +348,13 @@ BOOL PrintRegistryHive(HWND hWnd, LPTSTR path)
if (hResult == S_OK) { if (hResult == S_OK) {
switch (pd.dwResultAction) { switch (pd.dwResultAction) {
case PD_RESULT_APPLY: case PD_RESULT_APPLY:
//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. /*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. */
break; break;
case PD_RESULT_CANCEL: case PD_RESULT_CANCEL:
//The user clicked the Cancel button. The information in the PRINTDLGEX structure is unchanged. /*The user clicked the Cancel button. The information in the PRINTDLGEX structure is unchanged. */
break; break;
case PD_RESULT_PRINT: case PD_RESULT_PRINT:
//The user clicked the Print button. The PRINTDLGEX structure contains the information specified by the user. /*The user clicked the Print button. The PRINTDLGEX structure contains the information specified by the user. */
break; break;
default: default:
break; break;
@ -367,19 +362,19 @@ BOOL PrintRegistryHive(HWND hWnd, LPTSTR path)
} else { } else {
switch (hResult) { switch (hResult) {
case E_OUTOFMEMORY: case E_OUTOFMEMORY:
//Insufficient memory. /*Insufficient memory. */
break; break;
case E_INVALIDARG: case E_INVALIDARG:
// One or more arguments are invalid. /* One or more arguments are invalid. */
break; break;
case E_POINTER: case E_POINTER:
//Invalid pointer. /*Invalid pointer. */
break; break;
case E_HANDLE: case E_HANDLE:
//Invalid handle. /*Invalid handle. */
break; break;
case E_FAIL: case E_FAIL:
//Unspecified error. /*Unspecified error. */
break; break;
default: default:
break; break;
@ -393,33 +388,36 @@ BOOL PrintRegistryHive(HWND hWnd, LPTSTR path)
BOOL CopyKeyName(HWND hWnd, LPTSTR keyName) BOOL CopyKeyName(HWND hWnd, LPTSTR keyName)
{ {
BOOL result; BOOL result;
result = OpenClipboard(hWnd); result = OpenClipboard(hWnd);
if (result) { if (result) {
result = EmptyClipboard(); result = EmptyClipboard();
if (result) { if (result) {
//HANDLE hClipData; /*HANDLE hClipData;*/
//hClipData = SetClipboardData(UINT uFormat, HANDLE hMem); /*hClipData = SetClipboardData(UINT uFormat, HANDLE hMem);*/
} else { } else {
// error emptying clipboard /* error emptying clipboard*/
DWORD dwError = GetLastError(); /* DWORD dwError = GetLastError(); */
;
} }
if (!CloseClipboard()) { if (!CloseClipboard()) {
// error closing clipboard /* error closing clipboard*/
DWORD dwError = GetLastError(); /* DWORD dwError = GetLastError(); */
;
} }
} else { } else {
// error opening clipboard /* error opening clipboard*/
DWORD dwError = GetLastError(); /* DWORD dwError = GetLastError(); */
;
} }
return result; return result;
} }
BOOL RefreshView(HWND hWnd) BOOL RefreshView(HWND hWnd)
{ {
// TODO: /* TODO:*/
MessageBeep(-1); MessageBeep(-1);
MessageBeep(MB_ICONASTERISK); MessageBeep(MB_ICONASTERISK);
MessageBeep(MB_ICONEXCLAMATION); MessageBeep(MB_ICONEXCLAMATION);
@ -429,17 +427,17 @@ BOOL RefreshView(HWND hWnd)
return TRUE; return TRUE;
} }
//////////////////////////////////////////////////////////////////////////////// /*******************************************************************************
// *
// FUNCTION: _CmdWndProc(HWND, unsigned, WORD, LONG) * FUNCTION: _CmdWndProc(HWND, unsigned, WORD, LONG)
// *
// PURPOSE: Processes WM_COMMAND messages for the main frame window. * PURPOSE: Processes WM_COMMAND messages for the main frame window.
// *
// */
static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
switch (LOWORD(wParam)) { switch (LOWORD(wParam)) {
// Parse the menu selections: /* Parse the menu selections:*/
case ID_REGISTRY_IMPORTREGISTRYFILE: case ID_REGISTRY_IMPORTREGISTRYFILE:
ImportRegistryFile(hWnd); ImportRegistryFile(hWnd);
break; break;
@ -457,10 +455,10 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
CopyKeyName(hWnd, _T("")); CopyKeyName(hWnd, _T(""));
break; break;
case ID_REGISTRY_PRINTERSETUP: case ID_REGISTRY_PRINTERSETUP:
//PRINTDLG pd; /*PRINTDLG pd;*/
//PrintDlg(&pd); /*PrintDlg(&pd);*/
//PAGESETUPDLG psd; /*PAGESETUPDLG psd;*/
//PageSetupDlg(&psd); /*PageSetupDlg(&psd);*/
break; break;
case ID_REGISTRY_OPENLOCAL: case ID_REGISTRY_OPENLOCAL:
break; break;
@ -470,19 +468,19 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case ID_VIEW_REFRESH: case ID_VIEW_REFRESH:
RefreshView(hWnd); RefreshView(hWnd);
break; break;
// case ID_OPTIONS_TOOLBAR: /* case ID_OPTIONS_TOOLBAR:*/
// toggle_child(hWnd, LOWORD(wParam), hToolBar); /* toggle_child(hWnd, LOWORD(wParam), hToolBar);*/
// break; /* break;*/
case ID_VIEW_STATUSBAR: case ID_VIEW_STATUSBAR:
toggle_child(hWnd, LOWORD(wParam), hStatusBar); toggle_child(hWnd, LOWORD(wParam), hStatusBar);
break; break;
case ID_HELP_HELPTOPICS: case ID_HELP_HELPTOPICS:
// WinHelp(hWnd, _T("regedit"), HELP_CONTENTS, 0); /* WinHelp(hWnd, _T("regedit"), HELP_CONTENTS, 0);*/
WinHelp(hWnd, _T("regedit"), HELP_FINDER, 0); WinHelp(hWnd, _T("regedit"), HELP_FINDER, 0);
break; break;
case ID_HELP_ABOUT: case ID_HELP_ABOUT:
#ifdef WINSHELLAPI #ifdef WINSHELLAPI
// ShellAbout(hWnd, szTitle, _T(""), LoadIcon(hInst, (LPCTSTR)IDI_REGEDIT)); /* ShellAbout(hWnd, szTitle, _T(""), LoadIcon(hInst, (LPCTSTR)IDI_REGEDIT));*/
#else #else
ShowAboutBox(hWnd); ShowAboutBox(hWnd);
#endif #endif
@ -493,16 +491,16 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
return TRUE; return TRUE;
} }
//////////////////////////////////////////////////////////////////////////////// /********************************************************************************
// *
// FUNCTION: FrameWndProc(HWND, unsigned, WORD, LONG) * FUNCTION: FrameWndProc(HWND, unsigned, WORD, LONG)
// *
// PURPOSE: Processes messages for the main frame window. * PURPOSE: Processes messages for the main frame window.
// *
// WM_COMMAND - process the application menu * WM_COMMAND - process the application menu
// WM_DESTROY - post a quit message and return * WM_DESTROY - post a quit message and return
// *
// */
LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
@ -514,7 +512,7 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
pChildWnd = HeapAlloc(GetProcessHeap(), 0, sizeof(ChildWnd)); pChildWnd = HeapAlloc(GetProcessHeap(), 0, sizeof(ChildWnd));
_tcsncpy(pChildWnd->szPath, _T("My Computer"), MAX_PATH); _tcsncpy(pChildWnd->szPath, _T("My Computer"), MAX_PATH);
hChildWnd = CreateWindowEx(0, szChildClass, _T("regedit child window"), hChildWnd = CreateWindowEx(0, szChildClass, _T("regedit child window"),
// WS_CHILD|WS_CLIPCHILDREN|WS_VISIBLE|WS_BORDER, /* WS_CHILD|WS_CLIPCHILDREN|WS_VISIBLE|WS_BORDER,*/
WS_CHILD|WS_VISIBLE | WS_EX_CLIENTEDGE, WS_CHILD|WS_VISIBLE | WS_EX_CLIENTEDGE,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
hWnd, (HMENU)0, hInst, pChildWnd); hWnd, (HMENU)0, hInst, pChildWnd);
@ -522,9 +520,9 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
break; break;
case WM_COMMAND: case WM_COMMAND:
if (!_CmdWndProc(hWnd, message, wParam, lParam)) { if (!_CmdWndProc(hWnd, message, wParam, lParam)) {
return DefWindowProc(hWnd, message, wParam, lParam); return DefWindowProc(hWnd, message, wParam, lParam);
} }
break; break;
case WM_SIZE: case WM_SIZE:
resize_frame_client(hWnd); resize_frame_client(hWnd);
break; break;
@ -544,7 +542,7 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
HeapFree(GetProcessHeap(), 0, pChildWnd); HeapFree(GetProcessHeap(), 0, pChildWnd);
pChildWnd = NULL; pChildWnd = NULL;
} }
WinHelp(hWnd, _T("regedit"), HELP_QUIT, 0); WinHelp(hWnd, _T("regedit"), HELP_QUIT, 0);
PostQuitMessage(0); PostQuitMessage(0);
default: default:
return DefWindowProc(hWnd, message, wParam, lParam); return DefWindowProc(hWnd, message, wParam, lParam);

View file

@ -1,9 +1,7 @@
/* /*
* ReactOS regedit * Regedit listviews
* *
* listview.c * Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -20,25 +18,22 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h> #include <windows.h>
#include <commctrl.h> #include <commctrl.h>
#include <stdlib.h> #include <stdlib.h>
#include <tchar.h> #include <tchar.h>
#include <process.h> #include <process.h>
#include <stdio.h> #include <stdio.h>
#include "commctrl.h" #include "commctrl.h"
#include <windowsx.h> #include <windowsx.h>
#include "main.h" #include "main.h"
#include "listview.h"
#include "hex_str.h"
//////////////////////////////////////////////////////////////////////////////// /*******************************************************************************
// Global and Local Variables: * Global and Local Variables:
// */
static WNDPROC g_orgListWndProc; static WNDPROC g_orgListWndProc;
@ -47,35 +42,33 @@ static int default_column_widths[MAX_LIST_COLUMNS] = { 200, 175, 400 };
static int column_alignment[MAX_LIST_COLUMNS] = { LVCFMT_LEFT, LVCFMT_LEFT, LVCFMT_LEFT }; static int column_alignment[MAX_LIST_COLUMNS] = { LVCFMT_LEFT, LVCFMT_LEFT, LVCFMT_LEFT };
//////////////////////////////////////////////////////////////////////////////// /*******************************************************************************
// Local module support methods * Local module support methods
// */
extern unsigned char AsciiTable[256][3];
static void AddEntryToList(HWND hwndLV, LPTSTR Name, DWORD dwValType, void* ValBuf, DWORD dwCount) static void AddEntryToList(HWND hwndLV, LPTSTR Name, DWORD dwValType, void* ValBuf, DWORD dwCount)
{ {
LVITEM item; LVITEM item;
int index; int index;
item.mask = LVIF_TEXT | LVIF_PARAM; item.mask = LVIF_TEXT | LVIF_PARAM;
item.iItem = 0;//idx; item.iItem = 0;/*idx; */
item.iSubItem = 0; item.iSubItem = 0;
item.state = 0; item.state = 0;
item.stateMask = 0; item.stateMask = 0;
item.pszText = Name; item.pszText = Name;
item.cchTextMax = _tcslen(item.pszText); item.cchTextMax = _tcslen(item.pszText);
if (item.cchTextMax == 0) if (item.cchTextMax == 0)
item.pszText = LPSTR_TEXTCALLBACK; item.pszText = LPSTR_TEXTCALLBACK;
item.iImage = 0; item.iImage = 0;
item.lParam = (LPARAM)dwValType; item.lParam = (LPARAM)dwValType;
// item.lParam = (LPARAM)ValBuf; /* item.lParam = (LPARAM)ValBuf; */
#if (_WIN32_IE >= 0x0300) #if (_WIN32_IE >= 0x0300)
item.iIndent = 0; item.iIndent = 0;
#endif #endif
index = ListView_InsertItem(hwndLV, &item); index = ListView_InsertItem(hwndLV, &item);
if (index != -1) { if (index != -1) {
// LPTSTR pszText = NULL; /* LPTSTR pszText = NULL; */
LPTSTR pszText = _T("value"); LPTSTR pszText = _T("value");
switch (dwValType) { switch (dwValType) {
case REG_SZ: case REG_SZ:
@ -88,28 +81,22 @@ static void AddEntryToList(HWND hwndLV, LPTSTR Name, DWORD dwValType, void* ValB
wsprintf(buf, _T("0x%08X (%d)"), *(DWORD*)ValBuf, *(DWORD*)ValBuf); wsprintf(buf, _T("0x%08X (%d)"), *(DWORD*)ValBuf, *(DWORD*)ValBuf);
ListView_SetItemText(hwndLV, index, 2, buf); ListView_SetItemText(hwndLV, index, 2, buf);
} }
// lpsRes = convertHexToDWORDStr(lpbData, dwLen); /* lpsRes = convertHexToDWORDStr(lpbData, dwLen); */
break; break;
case REG_BINARY: case REG_BINARY:
{ {
unsigned int i; unsigned int i;
LPTSTR pData = (LPTSTR)ValBuf; LPBYTE pData = (LPBYTE)ValBuf;
LPTSTR strBinary = HeapAlloc(GetProcessHeap(), 0, dwCount * sizeof(TCHAR) * 3 + 1); LPTSTR strBinary = HeapAlloc(GetProcessHeap(), 0, dwCount * sizeof(TCHAR) * 3 + 1);
memset(strBinary, _T(' '), dwCount * sizeof(TCHAR) * 3); for (i = 0; i < dwCount; i++)
strBinary[dwCount * sizeof(TCHAR) * 3] = _T('\0'); wsprintf( strBinary + i*3, _T("%02X "), pData[i] );
for (i = 0; i < dwCount; i++) { strBinary[dwCount * 3] = 0;
unsigned short* pShort;
pShort = (unsigned short*)&(strBinary[i*3]);
// strBinary[i*3] = Byte2Hex((LPTSTR)ValBuf+i);
// *pShort++ = Byte2Hex(*(pData+i));
*pShort = Byte2Hex(*(pData+i));
}
ListView_SetItemText(hwndLV, index, 2, strBinary); ListView_SetItemText(hwndLV, index, 2, strBinary);
HeapFree(GetProcessHeap(), 0, strBinary); HeapFree(GetProcessHeap(), 0, strBinary);
} }
break; break;
default: default:
// lpsRes = convertHexToHexCSV(lpbData, dwLen); /* lpsRes = convertHexToHexCSV(lpbData, dwLen); */
ListView_SetItemText(hwndLV, index, 2, pszText); ListView_SetItemText(hwndLV, index, 2, pszText);
break; break;
} }
@ -121,32 +108,32 @@ static void CreateListColumns(HWND hWndListView)
TCHAR szText[50]; TCHAR szText[50];
int index; int index;
LV_COLUMN lvC; LV_COLUMN lvC;
// Create columns. /* Create columns. */
lvC.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; lvC.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
lvC.pszText = szText; lvC.pszText = szText;
// Load the column labels from the resource file. /* Load the column labels from the resource file. */
for (index = 0; index < MAX_LIST_COLUMNS; index++) { for (index = 0; index < MAX_LIST_COLUMNS; index++) {
lvC.iSubItem = index; lvC.iSubItem = index;
lvC.cx = default_column_widths[index]; lvC.cx = default_column_widths[index];
lvC.fmt = column_alignment[index]; lvC.fmt = column_alignment[index];
LoadString(hInst, IDS_LIST_COLUMN_FIRST + index, szText, sizeof(szText)/sizeof(TCHAR)); LoadString(hInst, IDS_LIST_COLUMN_FIRST + index, szText, sizeof(szText)/sizeof(TCHAR));
if (ListView_InsertColumn(hWndListView, index, &lvC) == -1) { if (ListView_InsertColumn(hWndListView, index, &lvC) == -1) {
// TODO: handle failure condition... /* TODO: handle failure condition... */
break; break;
} }
} }
} }
// OnGetDispInfo - processes the LVN_GETDISPINFO notification message. /* OnGetDispInfo - processes the LVN_GETDISPINFO notification message. */
static void OnGetDispInfo(NMLVDISPINFO* plvdi) static void OnGetDispInfo(NMLVDISPINFO* plvdi)
{ {
static TCHAR buffer[200]; static TCHAR buffer[200];
plvdi->item.pszText = NULL; plvdi->item.pszText = NULL;
plvdi->item.cchTextMax = 0; plvdi->item.cchTextMax = 0;
switch (plvdi->item.iSubItem) { switch (plvdi->item.iSubItem) {
case 0: case 0:
@ -166,9 +153,9 @@ static void OnGetDispInfo(NMLVDISPINFO* plvdi)
case REG_DWORD: case REG_DWORD:
plvdi->item.pszText = _T("REG_DWORD"); plvdi->item.pszText = _T("REG_DWORD");
break; break;
// case REG_DWORD_LITTLE_ENDIAN: /* case REG_DWORD_LITTLE_ENDIAN: */
// plvdi->item.pszText = _T("REG_DWORD_LITTLE_ENDIAN"); /* plvdi->item.pszText = _T("REG_DWORD_LITTLE_ENDIAN"); */
// break; /* break; */
case REG_DWORD_BIG_ENDIAN: case REG_DWORD_BIG_ENDIAN:
plvdi->item.pszText = _T("REG_DWORD_BIG_ENDIAN"); plvdi->item.pszText = _T("REG_DWORD_BIG_ENDIAN");
break; break;
@ -197,7 +184,7 @@ static void OnGetDispInfo(NMLVDISPINFO* plvdi)
plvdi->item.pszText = _T(""); plvdi->item.pszText = _T("");
break; break;
} }
} }
#if 0 #if 0
static int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) static int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
@ -218,8 +205,8 @@ static void ListViewPopUpMenu(HWND hWnd, POINT pt)
static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
switch (LOWORD(wParam)) { switch (LOWORD(wParam)) {
// case ID_FILE_OPEN: /* case ID_FILE_OPEN: */
// break; /* break; */
default: default:
return FALSE; return FALSE;
} }
@ -235,27 +222,27 @@ static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
} }
break; break;
case WM_NOTIFY: case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code) { switch (((LPNMHDR)lParam)->code) {
case LVN_GETDISPINFO: case LVN_GETDISPINFO:
OnGetDispInfo((NMLVDISPINFO*)lParam); OnGetDispInfo((NMLVDISPINFO*)lParam);
break; break;
case NM_DBLCLK: case NM_DBLCLK:
{ {
NMITEMACTIVATE* nmitem = (LPNMITEMACTIVATE)lParam; NMITEMACTIVATE* nmitem = (LPNMITEMACTIVATE)lParam;
LVHITTESTINFO info; LVHITTESTINFO info;
if (nmitem->hdr.hwndFrom != hWnd) break; if (nmitem->hdr.hwndFrom != hWnd) break;
// if (nmitem->hdr.idFrom != IDW_LISTVIEW) break; /* if (nmitem->hdr.idFrom != IDW_LISTVIEW) break; */
// if (nmitem->hdr.code != ???) break; /* if (nmitem->hdr.code != ???) break; */
#ifdef _MSC_VER #ifdef _MSC_VER
switch (nmitem->uKeyFlags) { switch (nmitem->uKeyFlags) {
case LVKF_ALT: // The ALT key is pressed. case LVKF_ALT: /* The ALT key is pressed. */
// properties dialog box ? /* properties dialog box ? */
break; break;
case LVKF_CONTROL: // The CTRL key is pressed. case LVKF_CONTROL: /* The CTRL key is pressed. */
// run dialog box for providing parameters... /* run dialog box for providing parameters... */
break; break;
case LVKF_SHIFT: // The SHIFT key is pressed. case LVKF_SHIFT: /* The SHIFT key is pressed. */
break; break;
} }
#endif #endif
@ -277,7 +264,7 @@ static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
LV_HITTESTINFO lvH; LV_HITTESTINFO lvH;
NM_LISTVIEW* pNm = (NM_LISTVIEW*)lParam; NM_LISTVIEW* pNm = (NM_LISTVIEW*)lParam;
lvH.pt.x = pNm->ptAction.x; lvH.pt.x = pNm->ptAction.x;
lvH.pt.y = pNm->ptAction.y; lvH.pt.y = pNm->ptAction.y;
idx = ListView_HitTest(hWnd, &lvH); idx = ListView_HitTest(hWnd, &lvH);
if (idx != -1) { if (idx != -1) {
POINT pt; POINT pt;
@ -294,10 +281,10 @@ static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
break; break;
case WM_KEYDOWN: case WM_KEYDOWN:
if (wParam == VK_TAB) { if (wParam == VK_TAB) {
//TODO: SetFocus(Globals.hDriveBar) /*TODO: SetFocus(Globals.hDriveBar) */
//SetFocus(child->nFocusPanel? child->left.hWnd: child->right.hWnd); /*SetFocus(child->nFocusPanel? child->left.hWnd: child->right.hWnd); */
} }
// fall thru... /* fall thru... */
default: default:
return CallWindowProc(g_orgListWndProc, hWnd, message, wParam, lParam); return CallWindowProc(g_orgListWndProc, hWnd, message, wParam, lParam);
break; break;
@ -307,33 +294,33 @@ static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
HWND CreateListView(HWND hwndParent, int id) HWND CreateListView(HWND hwndParent, int id)
{ {
RECT rcClient; RECT rcClient;
HWND hwndLV; HWND hwndLV;
// Get the dimensions of the parent window's client area, and create the list view control. /* Get the dimensions of the parent window's client area, and create the list view control. */
GetClientRect(hwndParent, &rcClient); GetClientRect(hwndParent, &rcClient);
hwndLV = CreateWindowEx(WS_EX_CLIENTEDGE, WC_LISTVIEW, _T("List View"), hwndLV = CreateWindowEx(WS_EX_CLIENTEDGE, WC_LISTVIEW, _T("List View"),
WS_VISIBLE | WS_CHILD | LVS_REPORT, WS_VISIBLE | WS_CHILD | LVS_REPORT,
0, 0, rcClient.right, rcClient.bottom, 0, 0, rcClient.right, rcClient.bottom,
hwndParent, (HMENU)id, hInst, NULL); hwndParent, (HMENU)id, hInst, NULL);
ListView_SetExtendedListViewStyle(hwndLV, LVS_EX_FULLROWSELECT); ListView_SetExtendedListViewStyle(hwndLV, LVS_EX_FULLROWSELECT);
// Initialize the image list, and add items to the control. /* Initialize the image list, and add items to the control. */
/* /*
if (!InitListViewImageLists(hwndLV) || if (!InitListViewImageLists(hwndLV) ||
!InitListViewItems(hwndLV, szName)) { !InitListViewItems(hwndLV, szName)) {
DestroyWindow(hwndLV); DestroyWindow(hwndLV);
return FALSE; return FALSE;
} }
*/ */
CreateListColumns(hwndLV); CreateListColumns(hwndLV);
g_orgListWndProc = SubclassWindow(hwndLV, ListWndProc); g_orgListWndProc = SubclassWindow(hwndLV, ListWndProc);
return hwndLV; return hwndLV;
} }
BOOL RefreshListView(HWND hwndLV, HKEY hKey, LPTSTR keyPath) BOOL RefreshListView(HWND hwndLV, HKEY hKey, LPTSTR keyPath)
{ {
if (hwndLV != NULL) { if (hwndLV != NULL) {
ListView_DeleteAllItems(hwndLV); ListView_DeleteAllItems(hwndLV);
} }
@ -351,7 +338,7 @@ BOOL RefreshListView(HWND hwndLV, HKEY hKey, LPTSTR keyPath)
errCode = RegQueryInfoKey(hNewKey, NULL, NULL, NULL, NULL, errCode = RegQueryInfoKey(hNewKey, NULL, NULL, NULL, NULL,
&max_sub_key_len, NULL, &val_count, &max_val_name_len, &max_val_size, NULL, NULL); &max_sub_key_len, NULL, &val_count, &max_val_name_len, &max_val_size, NULL, NULL);
#define BUF_HEAD_SPACE 2 // TODO: check why this is required with ROS ??? #define BUF_HEAD_SPACE 2 /* TODO: check why this is required with ROS ??? */
if (errCode == ERROR_SUCCESS) { if (errCode == ERROR_SUCCESS) {
TCHAR* ValName = HeapAlloc(GetProcessHeap(), 0, ++max_val_name_len * sizeof(TCHAR) + BUF_HEAD_SPACE); TCHAR* ValName = HeapAlloc(GetProcessHeap(), 0, ++max_val_name_len * sizeof(TCHAR) + BUF_HEAD_SPACE);
@ -360,10 +347,10 @@ BOOL RefreshListView(HWND hwndLV, HKEY hKey, LPTSTR keyPath)
DWORD dwValSize = max_val_size; DWORD dwValSize = max_val_size;
DWORD dwIndex = 0L; DWORD dwIndex = 0L;
DWORD dwValType; DWORD dwValType;
// if (RegQueryValueEx(hNewKey, NULL, NULL, &dwValType, ValBuf, &dwValSize) == ERROR_SUCCESS) { /* if (RegQueryValueEx(hNewKey, NULL, NULL, &dwValType, ValBuf, &dwValSize) == ERROR_SUCCESS) { */
// AddEntryToList(hwndLV, _T("(Default)"), dwValType, ValBuf, dwValSize); /* AddEntryToList(hwndLV, _T("(Default)"), dwValType, ValBuf, dwValSize); */
// } /* } */
// dwValSize = max_val_size; /* dwValSize = max_val_size; */
while (RegEnumValue(hNewKey, dwIndex, ValName, &dwValNameLen, NULL, &dwValType, ValBuf, &dwValSize) == ERROR_SUCCESS) { while (RegEnumValue(hNewKey, dwIndex, ValName, &dwValNameLen, NULL, &dwValType, ValBuf, &dwValSize) == ERROR_SUCCESS) {
ValBuf[dwValSize] = 0; ValBuf[dwValSize] = 0;
AddEntryToList(hwndLV, ValName, dwValType, ValBuf, dwValSize); AddEntryToList(hwndLV, ValName, dwValType, ValBuf, dwValSize);
@ -375,12 +362,11 @@ BOOL RefreshListView(HWND hwndLV, HKEY hKey, LPTSTR keyPath)
HeapFree(GetProcessHeap(), 0, ValBuf); HeapFree(GetProcessHeap(), 0, ValBuf);
HeapFree(GetProcessHeap(), 0, ValName); HeapFree(GetProcessHeap(), 0, ValName);
} }
//ListView_SortItemsEx(hwndLV, CompareFunc, hwndLV); /*ListView_SortItemsEx(hwndLV, CompareFunc, hwndLV); */
// SendMessage(hwndLV, LVM_SORTITEMSEX, (WPARAM)CompareFunc, (LPARAM)hwndLV); /* SendMessage(hwndLV, LVM_SORTITEMSEX, (WPARAM)CompareFunc, (LPARAM)hwndLV); */
ShowWindow(hwndLV, SW_SHOW); ShowWindow(hwndLV, SW_SHOW);
RegCloseKey(hNewKey); RegCloseKey(hNewKey);
} }
} }
return TRUE; return TRUE;
} }

View file

@ -1,9 +1,7 @@
/* /*
* ReactOS regedit * Regedit main function
* *
* main.c * Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -20,7 +18,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
#include <windows.h> #include <windows.h>
#include <commctrl.h> #include <commctrl.h>
#include <stdlib.h> #include <stdlib.h>
@ -28,18 +26,17 @@
#include <process.h> #include <process.h>
#include <stdio.h> #include <stdio.h>
#include <fcntl.h> #include <fcntl.h>
#define REGEDIT_DECLARE_FUNCTIONS
#include "main.h" #include "main.h"
#include "framewnd.h"
#include "childwnd.h"
BOOL ProcessCmdLine(LPSTR lpCmdLine); BOOL ProcessCmdLine(LPSTR lpCmdLine);
//////////////////////////////////////////////////////////////////////////////// /*******************************************************************************
// Global Variables: * Global Variables:
// */
HINSTANCE hInst; HINSTANCE hInst;
HWND hFrameWnd; HWND hFrameWnd;
@ -54,18 +51,128 @@ TCHAR szFrameClass[MAX_LOADSTRING];
TCHAR szChildClass[MAX_LOADSTRING]; TCHAR szChildClass[MAX_LOADSTRING];
//////////////////////////////////////////////////////////////////////////////// /*******************************************************************************
// *
// * FUNCTION: DynamicBind( void )
// FUNCTION: InitInstance(HANDLE, int) *
// * PURPOSE: Binds all functions dependent on user32.dll
// PURPOSE: Saves instance handle and creates main window */
// static BOOL DynamicBind( void )
// COMMENTS: {
// HMODULE dll;
// In this function, we save the instance handle in a global variable and
// create and display the main program window. #define d(x) \
// p##x = (typeof (x) ) GetProcAddress( dll, #x ); \
if( ! p##x ) \
{ \
fprintf(stderr,"failed to bind function at line %d\n",__LINE__); \
return FALSE; \
} \
dll = LoadLibrary("user32");
if( !dll )
return FALSE;
d(BeginDeferWindowPos)
d(BeginPaint)
d(CallWindowProcA)
d(CheckMenuItem)
d(CloseClipboard)
d(CreateWindowExA)
d(DefWindowProcA)
d(DeferWindowPos)
d(DestroyMenu)
d(DestroyWindow)
d(DialogBoxParamA)
d(DispatchMessageA)
d(EmptyClipboard)
d(EndDeferWindowPos)
d(EndDialog)
d(EndPaint)
d(FillRect)
d(GetCapture)
d(GetClientRect)
d(GetCursorPos)
d(GetDC)
d(GetDlgItem)
d(GetMenu)
d(GetMessageA)
d(GetSubMenu)
d(GetSystemMetrics)
d(InvertRect)
d(IsWindowVisible)
d(LoadAcceleratorsA)
d(LoadBitmapA)
d(LoadCursorA)
d(LoadIconA)
d(LoadImageA)
d(LoadMenuA)
d(LoadStringA)
d(MessageBeep)
d(MoveWindow)
d(OpenClipboard)
d(PostQuitMessage)
d(RegisterClassExA)
d(RegisterClipboardFormatA)
d(ReleaseCapture)
d(ReleaseDC)
d(ScreenToClient)
d(SendMessageA)
d(SetCapture)
d(SetCursor)
d(SetFocus)
d(SetWindowLongA)
d(SetWindowTextA)
d(ShowWindow)
d(TranslateAccelerator)
d(TranslateMessage)
d(UpdateWindow)
d(WinHelpA)
d(wsprintfA)
dll = LoadLibrary("gdi32");
if( !dll )
return FALSE;
d(DeleteDC)
d(DeleteObject)
d(GetStockObject)
dll = LoadLibrary("comctl32");
if( !dll )
return FALSE;
d(CreateStatusWindowA)
d(ImageList_Add)
d(ImageList_Create)
d(ImageList_GetImageCount)
d(InitCommonControls)
dll = LoadLibrary("comdlg32");
if( !dll )
return FALSE;
d(CommDlgExtendedError)
d(GetOpenFileNameA)
d(GetSaveFileNameA)
d(PrintDlgA)
return TRUE;
}
/*******************************************************************************
*
*
* FUNCTION: InitInstance(HANDLE, int)
*
* PURPOSE: Saves instance handle and creates main window
*
* COMMENTS:
*
* In this function, we save the instance handle in a global variable and
* create and display the main program window.
*/
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{ {
@ -84,7 +191,7 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
(HICON)LoadImage(hInstance, MAKEINTRESOURCE(IDI_REGEDIT), IMAGE_ICON, (HICON)LoadImage(hInstance, MAKEINTRESOURCE(IDI_REGEDIT), IMAGE_ICON,
GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED) GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED)
}; };
ATOM hFrameWndClass = RegisterClassEx(&wcFrame); // register frame window class ATOM hFrameWndClass = RegisterClassEx(&wcFrame); /* register frame window class */
WNDCLASSEX wcChild = { WNDCLASSEX wcChild = {
sizeof(WNDCLASSEX), sizeof(WNDCLASSEX),
@ -102,18 +209,18 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED) GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED)
}; };
ATOM hChildWndClass = RegisterClassEx(&wcChild); // register child windows class ATOM hChildWndClass = RegisterClassEx(&wcChild); /* register child windows class */
hChildWndClass = hChildWndClass; // warning eater hChildWndClass = hChildWndClass; /* warning eater */
hMenuFrame = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_REGEDIT_MENU)); hMenuFrame = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_REGEDIT_MENU));
// Initialize the Windows Common Controls DLL /* Initialize the Windows Common Controls DLL */
InitCommonControls(); InitCommonControls();
nClipboardFormat = RegisterClipboardFormat(strClipboardFormat); nClipboardFormat = RegisterClipboardFormat(strClipboardFormat);
if (nClipboardFormat == 0) { /* if (nClipboardFormat == 0) {
DWORD dwError = GetLastError(); DWORD dwError = GetLastError();
} } */
hFrameWnd = CreateWindowEx(0, (LPCTSTR)(int)hFrameWndClass, szTitle, hFrameWnd = CreateWindowEx(0, (LPCTSTR)(int)hFrameWndClass, szTitle,
WS_OVERLAPPEDWINDOW | WS_EX_CLIENTEDGE, WS_OVERLAPPEDWINDOW | WS_EX_CLIENTEDGE,
@ -124,11 +231,11 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
return FALSE; return FALSE;
} }
// Create the status bar /* Create the status bar */
hStatusBar = CreateStatusWindow(WS_VISIBLE|WS_CHILD|WS_CLIPSIBLINGS|SBT_NOBORDERS, hStatusBar = CreateStatusWindow(WS_VISIBLE|WS_CHILD|WS_CLIPSIBLINGS|SBT_NOBORDERS,
_T(""), hFrameWnd, STATUS_WINDOW); _T(""), hFrameWnd, STATUS_WINDOW);
if (hStatusBar) { if (hStatusBar) {
// Create the status bar panes /* Create the status bar panes */
SetupStatusBar(hFrameWnd, FALSE); SetupStatusBar(hFrameWnd, FALSE);
CheckMenuItem(GetSubMenu(hMenuFrame, ID_VIEW_MENU), ID_VIEW_STATUSBAR, MF_BYCOMMAND|MF_CHECKED); CheckMenuItem(GetSubMenu(hMenuFrame, ID_VIEW_MENU), ID_VIEW_STATUSBAR, MF_BYCOMMAND|MF_CHECKED);
} }
@ -137,7 +244,7 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
return TRUE; return TRUE;
} }
//////////////////////////////////////////////////////////////////////////////// /******************************************************************************/
void ExitInstance(void) void ExitInstance(void)
{ {
@ -158,7 +265,7 @@ int APIENTRY WinMain(HINSTANCE hInstance,
hCrt = _open_osfhandle((long)GetStdHandle(STD_OUTPUT_HANDLE), _O_TEXT); hCrt = _open_osfhandle((long)GetStdHandle(STD_OUTPUT_HANDLE), _O_TEXT);
hf = _fdopen(hCrt, "w"); hf = _fdopen(hCrt, "w");
*stdout = *hf; *stdout = *hf;
setvbuf(stdout, NULL, _IONBF, 0); setvbuf(stdout, NULL, _IONBF, 0);
wprintf(L"command line exit, hInstance = %d\n", hInstance); wprintf(L"command line exit, hInstance = %d\n", hInstance);
getch(); getch();
@ -170,21 +277,25 @@ int APIENTRY WinMain(HINSTANCE hInstance,
return 0; return 0;
} }
// Initialize global strings if (!DynamicBind()) {
return 0;
}
/* Initialize global strings */
LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
LoadString(hInstance, IDC_REGEDIT_FRAME, szFrameClass, MAX_LOADSTRING); LoadString(hInstance, IDC_REGEDIT_FRAME, szFrameClass, MAX_LOADSTRING);
LoadString(hInstance, IDC_REGEDIT, szChildClass, MAX_LOADSTRING); LoadString(hInstance, IDC_REGEDIT, szChildClass, MAX_LOADSTRING);
// Store instance handle in our global variable /* Store instance handle in our global variable */
hInst = hInstance; hInst = hInstance;
// Perform application initialization: /* Perform application initialization */
if (!InitInstance(hInstance, nCmdShow)) { if (!InitInstance(hInstance, nCmdShow)) {
return FALSE; return FALSE;
} }
hAccel = LoadAccelerators(hInstance, (LPCTSTR)IDC_REGEDIT); hAccel = LoadAccelerators(hInstance, (LPCTSTR)IDC_REGEDIT);
// Main message loop: /* Main message loop */
while (GetMessage(&msg, (HWND)NULL, 0, 0)) { while (GetMessage(&msg, (HWND)NULL, 0, 0)) {
if (!TranslateAccelerator(msg.hwnd, hAccel, &msg)) { if (!TranslateAccelerator(msg.hwnd, hAccel, &msg)) {
TranslateMessage(&msg); TranslateMessage(&msg);

View file

@ -0,0 +1,256 @@
/*
* Regedit definitions
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __MAIN_H__
#define __MAIN_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "resource.h"
#define STATUS_WINDOW 2001
#define TREE_WINDOW 2002
#define LIST_WINDOW 2003
#define MAX_LOADSTRING 100
#define SPLIT_WIDTH 5
#define MAX_NAME_LEN 500
/******************************************************************************/
enum OPTION_FLAGS {
OPTIONS_AUTO_REFRESH = 0x01,
OPTIONS_READ_ONLY_MODE = 0x02,
OPTIONS_CONFIRM_ON_DELETE = 0x04,
OPTIONS_SAVE_ON_EXIT = 0x08,
OPTIONS_DISPLAY_BINARY_DATA = 0x10,
OPTIONS_VIEW_TREE_ONLY = 0x20,
OPTIONS_VIEW_DATA_ONLY = 0x40,
};
typedef struct {
HWND hWnd;
HWND hTreeWnd;
HWND hListWnd;
int nFocusPanel; /* 0: left 1: right */
int nSplitPos;
WINDOWPLACEMENT pos;
TCHAR szPath[MAX_PATH];
} ChildWnd;
/*******************************************************************************
* Global Variables:
*/
extern HINSTANCE hInst;
extern HWND hFrameWnd;
extern HMENU hMenuFrame;
extern HWND hStatusBar;
extern HFONT hFont;
extern enum OPTION_FLAGS Options;
extern TCHAR szTitle[];
extern TCHAR szFrameClass[];
extern TCHAR szChildClass[];
/*******************************************************************************
* Dynamically load all things that depend on user32.dll
*/
#include "winuser.h"
#include "wingdi.h"
#include "commctrl.h"
#include "commdlg.h"
#ifdef REGEDIT_DECLARE_FUNCTIONS
#define d(x) typeof(x) *p##x = NULL;
#else
#define d(x) extern typeof(x) *p##x;
#endif
d(BeginDeferWindowPos)
d(BeginPaint)
d(CallWindowProcA)
d(CheckMenuItem)
d(CloseClipboard)
d(CommDlgExtendedError)
d(CreateStatusWindowA)
d(CreateWindowExA)
d(DefWindowProcA)
d(DeferWindowPos)
d(DeleteDC)
d(DeleteObject)
d(DestroyMenu)
d(DestroyWindow)
d(DialogBoxParamA)
d(DispatchMessageA)
d(EmptyClipboard)
d(EndDeferWindowPos)
d(EndPaint)
d(EndDialog)
d(FillRect)
d(GetCapture)
d(GetClientRect)
d(GetCursorPos)
d(GetDC)
d(GetDlgItem)
d(GetMenu)
d(GetMessageA)
d(GetOpenFileNameA)
d(GetSaveFileNameA)
d(GetStockObject)
d(GetSubMenu)
d(GetSystemMetrics)
d(ImageList_Add)
d(ImageList_Create)
d(ImageList_GetImageCount)
d(InitCommonControls)
d(InvertRect)
d(IsWindowVisible)
d(LoadAcceleratorsA)
d(LoadBitmapA)
d(LoadCursorA)
d(LoadIconA)
d(LoadImageA)
d(LoadMenuA)
d(LoadStringA)
d(MessageBeep)
d(MoveWindow)
d(OpenClipboard)
d(PostQuitMessage)
d(PrintDlgA)
d(RegisterClassExA)
d(RegisterClipboardFormatA)
d(ReleaseCapture)
d(ReleaseDC)
d(ScreenToClient)
d(SendMessageA)
d(SetCapture)
d(SetCursor)
d(SetFocus)
d(SetWindowLongA)
d(SetWindowTextA)
d(ShowWindow)
d(TranslateAccelerator)
d(TranslateMessage)
d(UpdateWindow)
d(WinHelpA)
d(wsprintfA)
#undef d
#define BeginDeferWindowPos pBeginDeferWindowPos
#define BeginPaint pBeginPaint
#define CallWindowProcA pCallWindowProcA
#define CheckMenuItem pCheckMenuItem
#define CloseClipboard pCloseClipboard
#define CommDlgExtendedError pCommDlgExtendedError
#define CreateStatusWindowA pCreateStatusWindowA
#define CreateWindowExA pCreateWindowExA
#define DefWindowProcA pDefWindowProcA
#define DeferWindowPos pDeferWindowPos
#define DeleteDC pDeleteDC
#define DeleteObject pDeleteObject
#define DestroyMenu pDestroyMenu
#define DestroyWindow pDestroyWindow
#define DialogBoxParamA pDialogBoxParamA
#define DispatchMessageA pDispatchMessageA
#define EmptyClipboard pEmptyClipboard
#define EndDeferWindowPos pEndDeferWindowPos
#define EndDialog pEndDialog
#define EndPaint pEndPaint
#define FillRect pFillRect
#define GetCapture pGetCapture
#define GetClientRect pGetClientRect
#define GetCursorPos pGetCursorPos
#define GetDC pGetDC
#define GetDlgItem pGetDlgItem
#define GetMenu pGetMenu
#define GetMessageA pGetMessageA
#define GetOpenFileNameA pGetOpenFileNameA
#define GetSaveFileNameA pGetSaveFileNameA
#define GetStockObject pGetStockObject
#define GetSubMenu pGetSubMenu
#define GetSystemMetrics pGetSystemMetrics
#define ImageList_Add pImageList_Add
#define ImageList_Create pImageList_Create
#define ImageList_GetImageCount pImageList_GetImageCount
#define InitCommonControls pInitCommonControls
#define InvertRect pInvertRect
#define IsWindowVisible pIsWindowVisible
#define LoadAcceleratorsA pLoadAcceleratorsA
#define LoadBitmapA pLoadBitmapA
#define LoadCursorA pLoadCursorA
#define LoadIconA pLoadIconA
#define LoadImageA pLoadImageA
#define LoadMenuA pLoadMenuA
#define LoadStringA pLoadStringA
#define MessageBeep pMessageBeep
#define MoveWindow pMoveWindow
#define OpenClipboard pOpenClipboard
#define PostQuitMessage pPostQuitMessage
#define PrintDlgA pPrintDlgA
#define RegisterClassExA pRegisterClassExA
#define RegisterClipboardFormatA pRegisterClipboardFormatA
#define ReleaseCapture pReleaseCapture
#define ReleaseDC pReleaseDC
#define ScreenToClient pScreenToClient
#define SendMessageA pSendMessageA
#define SetCapture pSetCapture
#define SetCursor pSetCursor
#define SetFocus pSetFocus
#define SetWindowLongA pSetWindowLongA
#define SetWindowTextA pSetWindowTextA
#define ShowWindow pShowWindow
#undef TranslateAccelerator
#define TranslateAccelerator pTranslateAccelerator
#define TranslateMessage pTranslateMessage
#define UpdateWindow pUpdateWindow
#define WinHelpA pWinHelpA
#define wsprintfA pwsprintfA
#ifdef __cplusplus
};
#endif
/* about.c */
extern void ShowAboutBox(HWND hWnd);
/* childwnd.c */
extern LRESULT CALLBACK ChildWndProc(HWND, UINT, WPARAM, LPARAM);
/* framewnd.c */
extern LRESULT CALLBACK FrameWndProc(HWND, UINT, WPARAM, LPARAM);
extern void SetupStatusBar(HWND hWnd, BOOL bResize);
extern void UpdateStatusBar(void);
/* listview.c */
extern HWND CreateListView(HWND hwndParent, int id);
extern BOOL RefreshListView(HWND hwndTV, HKEY hKey, LPTSTR keyPath);
/* treeview.c */
extern HWND CreateTreeView(HWND hwndParent, LPTSTR pHostName, int id);
extern BOOL OnTreeExpanding(HWND hWnd, NMTREEVIEW* pnmtv);
extern HKEY FindRegRoot(HWND hwndTV, HTREEITEM hItem, LPTSTR keyPath, int* pPathLen, int max);
#endif /* __MAIN_H__ */

View file

@ -0,0 +1,33 @@
#
# ReactOS regedit
#
# Makefile
#
PATH_TO_TOP = ../../..
TARGET_TYPE = program
TARGET_APPTYPE = windows
TARGET_NAME = regedit
TARGET_CFLAGS = -D_WIN32_IE=0x0501 -D_WIN32_WINNT=0x0501 -D__USE_W32API
TARGET_GCCLIBS = msvcrt advapi32 kernel32
TARGET_OBJECTS = \
about.o \
childwnd.o \
framewnd.o \
listview.o \
main.o \
regedit.o \
regproc.o \
treeview.o
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
# EOF

View file

@ -1,12 +1,7 @@
/* $Id: regcmds.c,v 1.4 2003/01/07 18:06:16 robd Exp $ /*
* Windows regedit.exe registry editor implementation.
* *
* ReactOS regedit * Copyright 2002 Andriy Palamarchuk
*
* regcmds.c
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* Original Work Copyright 2002 Andriy Palamarchuk
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -23,23 +18,11 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <tchar.h>
#include <stdio.h>
#ifdef WIN32_REGDBG
#else
#include <ctype.h> #include <ctype.h>
#endif #include <stdio.h>
#include <windows.h>
#include "regproc.h" #include "regproc.h"
////////////////////////////////////////////////////////////////////////////////
// Global Variables:
//
static char *usage = static char *usage =
"Usage:\n" "Usage:\n"
" regedit filename\n" " regedit filename\n"
@ -55,7 +38,6 @@ static char *usage =
"Switches:\n" "Switches:\n"
" /E - exports contents of the specified registry key to the specified\n" " /E - exports contents of the specified registry key to the specified\n"
" file. Exports the whole registry if no key is specified.\n" " file. Exports the whole registry if no key is specified.\n"
" /P - same as /E (export) however prints output to console.\n"
" /D - deletes specified registry key\n" " /D - deletes specified registry key\n"
" /S - silent execution, can be used with any other switch.\n" " /S - silent execution, can be used with any other switch.\n"
" The only existing mode, exists for compatibility with Windows regedit.\n" " The only existing mode, exists for compatibility with Windows regedit.\n"
@ -74,9 +56,11 @@ static char *usage =
"command-line interface only.\n"; "command-line interface only.\n";
typedef enum { typedef enum {
ACTION_UNDEF, ACTION_ADD, ACTION_EXPORT, ACTION_DELETE, ACTION_PRINT ACTION_UNDEF, ACTION_ADD, ACTION_EXPORT, ACTION_DELETE
} REGEDIT_ACTION; } REGEDIT_ACTION;
BOOL PerformRegAction(REGEDIT_ACTION action, LPSTR s);
/** /**
* Process unknown switch. * Process unknown switch.
* *
@ -86,75 +70,14 @@ typedef enum {
*/ */
void error_unknown_switch(char chu, char *s) void error_unknown_switch(char chu, char *s)
{ {
if (isalpha(chu)) { if (isalpha(chu))
printf("Undefined switch /%c!\n", chu); {
printf("%s: Undefined switch /%c!\n", getAppName(), chu);
} else { } else {
printf("Alphabetic character is expected after '%c' " printf("%s: Alphabetic character is expected after '%c' "
"in switch specification\n", *(s - 1)); "in switch specification\n", getAppName(), *(s - 1));
} }
//exit(1); exit(1);
}
BOOL PerformRegAction(REGEDIT_ACTION action, LPSTR s)
{
TCHAR filename[MAX_PATH];
TCHAR reg_key_name[KEY_MAX_LEN];
switch (action) {
case ACTION_ADD:
get_file_name(&s, filename, MAX_PATH);
if (!filename[0]) {
printf("No file name is specified\n%s", usage);
return FALSE;
//exit(1);
}
while (filename[0]) {
if (!import_registry_file(filename)) {
perror("");
printf("Can't open file \"%s\"\n", filename);
return FALSE;
//exit(1);
}
get_file_name(&s, filename, MAX_PATH);
}
break;
case ACTION_DELETE:
get_file_name(&s, reg_key_name, KEY_MAX_LEN);
if (!reg_key_name[0]) {
printf("No registry key is specified for removal\n%s", usage);
return FALSE;
//exit(1);
}
delete_registry_key(reg_key_name);
break;
case ACTION_EXPORT:
filename[0] = '\0';
get_file_name(&s, filename, MAX_PATH);
if (!filename[0]) {
printf("No file name is specified\n%s", usage);
return FALSE;
//exit(1);
}
if (s[0]) {
get_file_name(&s, reg_key_name, KEY_MAX_LEN);
export_registry_key(filename, reg_key_name);
} else {
export_registry_key(filename, NULL);
}
break;
case ACTION_PRINT:
if (s[0]) {
get_file_name(&s, reg_key_name, KEY_MAX_LEN);
export_registry_key(NULL, reg_key_name);
} else {
export_registry_key(NULL, NULL);
}
break;
default:
printf("Unhandled action!\n");
return FALSE;
}
return TRUE;
} }
BOOL ProcessCmdLine(LPSTR lpCmdLine) BOOL ProcessCmdLine(LPSTR lpCmdLine)
@ -163,7 +86,9 @@ BOOL ProcessCmdLine(LPSTR lpCmdLine)
LPSTR s = lpCmdLine; /* command line pointer */ LPSTR s = lpCmdLine; /* command line pointer */
CHAR ch = *s; /* current character */ CHAR ch = *s; /* current character */
while (ch && ((ch == '-') || (ch == '/'))) { setAppName("regedit");
while (ch && ((ch == '-') || (ch == '/')))
{
char chu; char chu;
char ch2; char ch2;
@ -171,46 +96,46 @@ BOOL ProcessCmdLine(LPSTR lpCmdLine)
ch = *s; ch = *s;
ch2 = *(s+1); ch2 = *(s+1);
chu = toupper(ch); chu = toupper(ch);
if (!ch2 || isspace(ch2)) { if (!ch2 || isspace(ch2))
if (chu == 'S' || chu == 'V') { {
if (chu == 'S' || chu == 'V')
{
/* ignore these switches */ /* ignore these switches */
} else { } else {
switch (chu) { switch (chu)
{
case 'D': case 'D':
action = ACTION_DELETE; action = ACTION_DELETE;
break; break;
case 'E': case 'E':
action = ACTION_EXPORT; action = ACTION_EXPORT;
break; break;
case 'P':
action = ACTION_PRINT;
break;
case '?': case '?':
printf(usage); printf(usage);
return FALSE; exit(0);
//exit(0);
break; break;
default: default:
error_unknown_switch(chu, s); error_unknown_switch(chu, s);
return FALSE;
break; break;
} }
} }
s++; s++;
} else { } else {
if (ch2 == ':') { if (ch2 == ':')
switch (chu) { {
switch (chu)
{
case 'L': case 'L':
/* fall through */ /* fall through */
case 'R': case 'R':
s += 2; s += 2;
while (*s && !isspace(*s)) { while (*s && !isspace(*s))
{
s++; s++;
} }
break; break;
default: default:
error_unknown_switch(chu, s); error_unknown_switch(chu, s);
return FALSE;
break; break;
} }
} else { } else {
@ -221,13 +146,97 @@ BOOL ProcessCmdLine(LPSTR lpCmdLine)
} }
/* skip spaces to the next parameter */ /* skip spaces to the next parameter */
ch = *s; ch = *s;
while (ch && isspace(ch)) { while (ch && isspace(ch))
{
s++; s++;
ch = *s; ch = *s;
} }
} }
if (action == ACTION_UNDEF) {
if (*s && action == ACTION_UNDEF)
action = ACTION_ADD; action = ACTION_ADD;
}
if (action == ACTION_UNDEF)
return FALSE;
return PerformRegAction(action, s); return PerformRegAction(action, s);
} }
BOOL PerformRegAction(REGEDIT_ACTION action, LPSTR s)
{
switch (action)
{
case ACTION_ADD:
{
CHAR filename[MAX_PATH];
FILE *reg_file;
get_file_name(&s, filename);
if (!filename[0])
{
printf("%s: No file name is specified\n", getAppName());
printf(usage);
exit(1);
}
while(filename[0])
{
reg_file = fopen(filename, "r");
if (reg_file)
{
processRegLines(reg_file, doSetValue);
} else {
perror("");
printf("%s: Can't open file \"%s\"\n", getAppName(), filename);
exit(1);
}
get_file_name(&s, filename);
}
break;
}
case ACTION_DELETE:
{
CHAR reg_key_name[KEY_MAX_LEN];
get_file_name(&s, reg_key_name);
if (!reg_key_name[0])
{
printf("%s: No registry key is specified for removal\n",
getAppName());
printf(usage);
exit(1);
}
delete_registry_key(reg_key_name);
break;
}
case ACTION_EXPORT:
{
CHAR filename[MAX_PATH];
filename[0] = '\0';
get_file_name(&s, filename);
if (!filename[0])
{
printf("%s: No file name is specified\n", getAppName());
printf(usage);
exit(1);
}
if (s[0])
{
CHAR reg_key_name[KEY_MAX_LEN];
get_file_name(&s, reg_key_name);
export_registry_key(filename, reg_key_name);
} else {
export_registry_key(filename, NULL);
}
break;
}
default:
printf("%s: Unhandled action!\n", getAppName());
exit(1);
break;
}
return TRUE;
}

View file

@ -1,9 +1,7 @@
/* /*
* ReactOS Application Debug Routines * Regedit resources
* *
* debug.h * Copyright 2002 Robert Dickenson
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -19,19 +17,8 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#ifndef __DEBUG_H__
#define __DEBUG_H__
#ifdef __cplusplus #include "windows.h"
extern "C" { #include "resource.h"
#endif
#include "rsrc.rc"
#ifdef __cplusplus
};
#endif
#endif // __DEBUG_H__

View file

@ -0,0 +1,73 @@
/*
* Copyright 1999 Sylvain St-Germain
* Copyright 2002 Andriy Palamarchuk
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/******************************************************************************
* Defines and consts
*/
#define KEY_MAX_LEN 1024
/* Return values */
#define SUCCESS 0
#define KEY_VALUE_ALREADY_SET 2
typedef void (*CommandAPI)(LPSTR lpsLine);
void doSetValue(LPSTR lpsLine);
void doDeleteValue(LPSTR lpsLine);
void doCreateKey(LPSTR lpsLine);
void doDeleteKey(LPSTR lpsLine);
void doQueryValue(LPSTR lpsLine);
void doRegisterDLL(LPSTR lpsLine);
void doUnregisterDLL(LPSTR lpsLine);
BOOL export_registry_key(CHAR *file_name, CHAR *reg_key_name);
BOOL import_registry_file(LPTSTR filename);
void delete_registry_key(CHAR *reg_key_name);
void setAppName(CHAR *name);
CHAR *getAppName();
void processRegLines(FILE *in, CommandAPI command);
/*
* Generic prototypes
*/
char* getToken(char** str, const char* delims);
void get_file_name(CHAR **command_line, CHAR *filename);
DWORD convertHexToDWord(char *str, BYTE *buf);
DWORD convertHexCSVToHex(char *str, BYTE *buf, ULONG bufLen);
LPSTR convertHexToHexCSV( BYTE *buf, ULONG len);
LPSTR convertHexToDWORDStr( BYTE *buf, ULONG len);
LPSTR getRegKeyName(LPSTR lpLine);
HKEY getRegClass(LPSTR lpLine);
DWORD getDataType(LPSTR *lpValue, DWORD* parse_type);
LPSTR getArg(LPSTR arg);
HRESULT openKey(LPSTR stdInput);
void closeKey();
/*
* api setValue prototypes
*/
void processSetValue(LPSTR cmdline);
HRESULT setValue(LPSTR val_name, LPSTR val_data);
/*
* api queryValue prototypes
*/
void processQueryValue(LPSTR cmdline);

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

View file

@ -1,7 +1,23 @@
//{{NO_DEPENDENCIES}} /*
// Microsoft Developer Studio generated include file. * Regedit resource definitions
// Used by regedit.rc *
// * Copyright 2002 Robert Dickenson
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define ID_REGISTRY_MENU 0 #define ID_REGISTRY_MENU 0
#define ID_EDIT_MENU 1 #define ID_EDIT_MENU 1
#define ID_VIEW_MENU 2 #define ID_VIEW_MENU 2
@ -87,14 +103,3 @@
#define ID_REGISTRY_SAVESUBTREEAS 32834 #define ID_REGISTRY_SAVESUBTREEAS 32834
#define IDS_LICENSE 32835 #define IDS_LICENSE 32835
#define IDC_STATIC -1 #define IDC_STATIC -1
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 133
#define _APS_NEXT_COMMAND_VALUE 32836
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 110
#endif
#endif

View file

@ -0,0 +1,98 @@
/*
* Regedit resources
*
* Copyright 2002 Robert Dickenson
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
IDB_OPEN_FILE BITMAP DISCARDABLE
#ifndef __WINE__
"res/folder3.bmp"
#else
/* BINRES folder3.bmp */
{
'42 4D F6 00 00 00 00 00 00 00 76 00 00 00 28 00'
'00 00 10 00 00 00 10 00 00 00 01 00 04 00 00 00'
'00 00 80 00 00 00 00 00 00 00 00 00 00 00 00 00'
'00 00 00 00 00 00 00 00 00 00 00 00 80 00 00 80'
'00 00 00 80 80 00 80 00 00 00 80 00 80 00 80 80'
'00 00 80 80 80 00 FF FF FF 00 00 00 FF 00 00 FF'
'00 00 00 FF FF 00 FF 00 00 00 FF 00 FF 00 FF FF'
'00 00 FF FF FF 00 88 88 88 88 88 88 88 88 88 88'
'88 88 88 88 88 88 88 88 88 88 88 88 88 88 80 00'
'00 00 00 00 88 88 80 33 33 33 33 33 08 88 80 03'
'33 33 33 33 38 88 80 B3 33 33 33 33 30 88 80 B0'
'33 33 33 33 33 88 80 BB 33 33 33 33 33 08 80 BB'
'00 00 00 00 00 08 80 BB BB BB BB BB 08 88 80 BB'
'BB BB BB BB 08 88 80 BB B0 00 00 00 08 88 80 00'
'00 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88'
'88 88 88 88 88 88'
}
#endif
IDB_CLOSED_FILE BITMAP DISCARDABLE
#ifndef __WINE__
"res/folder2.bmp"
#else
/* BINRES folder2.bmp */
{
'42 4D F6 00 00 00 00 00 00 00 76 00 00 00 28 00'
'00 00 10 00 00 00 10 00 00 00 01 00 04 00 00 00'
'00 00 80 00 00 00 12 0B 00 00 12 0B 00 00 10 00'
'00 00 10 00 00 00 00 00 00 00 00 00 80 00 00 80'
'00 00 00 80 80 00 80 00 00 00 80 00 80 00 80 80'
'00 00 C0 C0 C0 00 80 80 80 00 00 00 FF 00 00 FF'
'00 00 00 00 FF 00 FF 00 00 00 FF 00 FF 00 FF FF'
'00 00 FF FF FF 00 FF FF FF FF FF FF FF FF FF FF'
'FF FF FF FF FF FF FF 00 00 00 00 00 00 00 F8 88'
'88 88 88 88 88 80 F8 FB 7B 7B 7B 7B 7B 80 F8 F7'
'B7 B7 B7 B7 B7 80 F8 FB 7B 7B 7B 7B 7B 80 F8 F7'
'B7 B7 B7 B7 B7 80 F8 FB 7B 7B 7B 7B 7B 80 F8 F7'
'B7 B7 B7 B7 B7 80 F8 FB 7B 7B 7B 7B 7B 80 F8 FF'
'FF FF FF FF FF 80 F8 B7 B7 B7 B8 88 88 8F FF 8B'
'7B 7B 8F FF FF FF FF F8 88 88 FF FF FF FF FF FF'
'FF FF FF FF FF FF'
}
#endif
IDB_ROOT BITMAP DISCARDABLE
#ifndef __WINE__
"res/folder1.bmp"
#else
/* BINRES folder1.bmp */
{
'42 4D F6 00 00 00 00 00 00 00 76 00 00 00 28 00'
'00 00 10 00 00 00 10 00 00 00 01 00 04 00 00 00'
'00 00 80 00 00 00 00 00 00 00 00 00 00 00 10 00'
'00 00 10 00 00 00 00 00 00 00 00 00 80 00 00 80'
'00 00 00 80 80 00 80 00 00 00 80 00 80 00 80 80'
'00 00 C0 C0 C0 00 80 80 80 00 00 00 FF 00 00 FF'
'00 00 00 FF FF 00 FF 00 00 00 FF 00 FF 00 FF FF'
'00 00 FF FF FF 00 FF FF FF FF FF FF FF FF FF FF'
'FF FF FF FF FF FF FF 00 00 00 00 00 00 00 F8 88'
'88 88 88 88 88 80 F8 FB 7B 7B 7B 7B 7B 80 F8 F7'
'B7 B7 B7 B7 B7 80 F8 FB 7B 7B 7B 7B 7B 80 F8 F7'
'B7 B7 B7 B7 B7 80 F8 FB 7B 7B 7B 7B 7B 80 F8 F7'
'B7 B7 B7 B7 B7 80 F8 FB 7B 7B 7B 7B 7B 80 F8 FF'
'FF FF FF FF FF 80 F8 B7 B7 B7 B8 88 88 8F FF 8B'
'7B 7B 8F FF FF FF FF F8 88 88 FF FF FF FF FF FF'
'FF FF FF FF FF FF'
}
#endif
#ifdef __WINE__
#include "wine/wine_common_ver.rc"
#endif

View file

@ -1,9 +1,7 @@
/* /*
* ReactOS About Dialog Box * Regedit resources
* *
* about.h * Copyright 2002 Robert Dickenson
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -19,19 +17,17 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#ifndef __ABOUT_H__
#define __ABOUT_H__
#ifdef __cplusplus #include "windows.h"
extern "C" { #include "resource.h"
#endif
void ShowAboutBox(HWND hWnd); /* define language neutral resources */
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
#ifdef __cplusplus #include "resource.rc"
};
#endif
#endif // __ABOUT_H__ /* include localised resources */
#include "En.rc"
#include "Pt.rc"

View file

@ -1,9 +1,7 @@
/* /*
* ReactOS regedit * Regedit treeview
* *
* treeview.c * Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -20,25 +18,26 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include <windows.h> #include <windows.h>
#include <commctrl.h> #include <commctrl.h>
#include <stdlib.h> #include <stdlib.h>
#include <tchar.h> #include <tchar.h>
#include <process.h> #include <process.h>
#include <stdio.h> #include <stdio.h>
#include "main.h" #include "main.h"
#include "treeview.h"
/* Global variables and constants */
// Global variables and constants /* Image_Open, Image_Closed, and Image_Root - integer variables for indexes of the images. */
// Image_Open, Image_Closed, and Image_Root - integer variables for indexes of the images. /* CX_BITMAP and CY_BITMAP - width and height of an icon. */
// CX_BITMAP and CY_BITMAP - width and height of an icon. /* NUM_BITMAPS - number of bitmaps to add to the image list. */
// NUM_BITMAPS - number of bitmaps to add to the image list. int Image_Open;
int Image_Open; int Image_Closed;
int Image_Closed; int Image_Root;
int Image_Root;
#define CX_BITMAP 16 #define CX_BITMAP 16
#define CY_BITMAP 16 #define CY_BITMAP 16
@ -54,7 +53,7 @@ HKEY FindRegRoot(HWND hwndTV, HTREEITEM hItem, LPTSTR keyPath, int* pPathLen, in
if (TreeView_GetItem(hwndTV, &item)) { if (TreeView_GetItem(hwndTV, &item)) {
if (item.lParam == 0) { if (item.lParam == 0) {
// recurse /* recurse */
hKey = FindRegRoot(hwndTV, item.hItem, keyPath, pPathLen, max); hKey = FindRegRoot(hwndTV, item.hItem, keyPath, pPathLen, max);
keyPath[*pPathLen] = _T('\\'); keyPath[*pPathLen] = _T('\\');
++(*pPathLen); ++(*pPathLen);
@ -66,11 +65,11 @@ HKEY FindRegRoot(HWND hwndTV, HTREEITEM hItem, LPTSTR keyPath, int* pPathLen, in
*pPathLen += _tcslen(item.pszText); *pPathLen += _tcslen(item.pszText);
} }
} else { } else {
// found root key with valid key value /* found root key with valid key value */
hKey = (HKEY)item.lParam; hKey = (HKEY)item.lParam;
item.mask = TVIF_TEXT; item.mask = TVIF_TEXT;
item.hItem = hItem; item.hItem = hItem;
// item.pszText = &keyPath[*pPathLen]; /* item.pszText = &keyPath[*pPathLen]; */
item.pszText = keyPath; item.pszText = keyPath;
item.cchTextMax = max; item.cchTextMax = max;
if (TreeView_GetItem(hwndTV, &item)) { if (TreeView_GetItem(hwndTV, &item)) {
@ -82,48 +81,48 @@ HKEY FindRegRoot(HWND hwndTV, HTREEITEM hItem, LPTSTR keyPath, int* pPathLen, in
} }
static HTREEITEM AddEntryToTree(HWND hwndTV, HTREEITEM hParent, LPTSTR label, HKEY hKey, DWORD dwChildren) static HTREEITEM AddEntryToTree(HWND hwndTV, HTREEITEM hParent, LPTSTR label, HKEY hKey, DWORD dwChildren)
{ {
HTREEITEM hItem = 0; HTREEITEM hItem = 0;
TVITEM tvi; TVITEM tvi;
TVINSERTSTRUCT tvins; TVINSERTSTRUCT tvins;
tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_CHILDREN | TVIF_PARAM; tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_CHILDREN | TVIF_PARAM;
tvi.pszText = label; tvi.pszText = label;
tvi.cchTextMax = lstrlen(tvi.pszText); tvi.cchTextMax = lstrlen(tvi.pszText);
tvi.iImage = Image_Closed; tvi.iImage = Image_Closed;
tvi.iSelectedImage = Image_Open; tvi.iSelectedImage = Image_Open;
tvi.cChildren = dwChildren; tvi.cChildren = dwChildren;
tvi.lParam = (LPARAM)hKey; tvi.lParam = (LPARAM)hKey;
tvins.item = tvi; tvins.u.item = tvi;
if (hKey) tvins.hInsertAfter = (HTREEITEM)TVI_LAST; if (hKey) tvins.hInsertAfter = (HTREEITEM)TVI_LAST;
else tvins.hInsertAfter = (HTREEITEM)TVI_SORT; else tvins.hInsertAfter = (HTREEITEM)TVI_SORT;
tvins.hParent = hParent; tvins.hParent = hParent;
hItem = (HTREEITEM)SendMessage(hwndTV, TVM_INSERTITEM, 0, (LPARAM)(LPTVINSERTSTRUCT)&tvins); hItem = (HTREEITEM)SendMessage(hwndTV, TVM_INSERTITEM, 0, (LPARAM)(LPTVINSERTSTRUCT)&tvins);
return hItem; return hItem;
} }
static BOOL InitTreeViewItems(HWND hwndTV, LPTSTR pHostName) static BOOL InitTreeViewItems(HWND hwndTV, LPTSTR pHostName)
{ {
TVITEM tvi; TVITEM tvi;
TVINSERTSTRUCT tvins; TVINSERTSTRUCT tvins;
HTREEITEM hRoot; HTREEITEM hRoot;
tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_CHILDREN | TVIF_PARAM; tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_CHILDREN | TVIF_PARAM;
// Set the text of the item. /* Set the text of the item. */
tvi.pszText = pHostName; tvi.pszText = pHostName;
tvi.cchTextMax = lstrlen(tvi.pszText); tvi.cchTextMax = lstrlen(tvi.pszText);
// Assume the item is not a parent item, so give it an image. /* Assume the item is not a parent item, so give it an image. */
tvi.iImage = Image_Root; tvi.iImage = Image_Root;
tvi.iSelectedImage = Image_Root; tvi.iSelectedImage = Image_Root;
tvi.cChildren = 5; tvi.cChildren = 5;
// Save the heading level in the item's application-defined data area. /* Save the heading level in the item's application-defined data area. */
tvi.lParam = (LPARAM)NULL; tvi.lParam = (LPARAM)NULL;
tvins.item = tvi; tvins.u.item = tvi;
tvins.hInsertAfter = (HTREEITEM)TVI_FIRST; tvins.hInsertAfter = (HTREEITEM)TVI_FIRST;
tvins.hParent = TVI_ROOT; tvins.hParent = TVI_ROOT;
// Add the item to the tree view control. /* Add the item to the tree view control. */
hRoot = (HTREEITEM)SendMessage(hwndTV, TVM_INSERTITEM, 0, (LPARAM)(LPTVINSERTSTRUCT)&tvins); hRoot = (HTREEITEM)SendMessage(hwndTV, TVM_INSERTITEM, 0, (LPARAM)(LPTVINSERTSTRUCT)&tvins);
AddEntryToTree(hwndTV, hRoot, _T("HKEY_CLASSES_ROOT"), HKEY_CLASSES_ROOT, 1); AddEntryToTree(hwndTV, hRoot, _T("HKEY_CLASSES_ROOT"), HKEY_CLASSES_ROOT, 1);
AddEntryToTree(hwndTV, hRoot, _T("HKEY_CURRENT_USER"), HKEY_CURRENT_USER, 1); AddEntryToTree(hwndTV, hRoot, _T("HKEY_CURRENT_USER"), HKEY_CURRENT_USER, 1);
@ -131,49 +130,51 @@ static BOOL InitTreeViewItems(HWND hwndTV, LPTSTR pHostName)
AddEntryToTree(hwndTV, hRoot, _T("HKEY_USERS"), HKEY_USERS, 1); AddEntryToTree(hwndTV, hRoot, _T("HKEY_USERS"), HKEY_USERS, 1);
AddEntryToTree(hwndTV, hRoot, _T("HKEY_CURRENT_CONFIG"), HKEY_CURRENT_CONFIG, 1); AddEntryToTree(hwndTV, hRoot, _T("HKEY_CURRENT_CONFIG"), HKEY_CURRENT_CONFIG, 1);
return TRUE; return TRUE;
} }
// InitTreeViewImageLists - creates an image list, adds three bitmaps /*
// to it, and associates the image list with a tree view control. * InitTreeViewImageLists - creates an image list, adds three bitmaps
// Returns TRUE if successful, or FALSE otherwise. * to it, and associates the image list with a tree view control.
// hwndTV - handle to the tree view control. * Returns TRUE if successful, or FALSE otherwise.
* hwndTV - handle to the tree view control.
*/
static BOOL InitTreeViewImageLists(HWND hwndTV) static BOOL InitTreeViewImageLists(HWND hwndTV)
{ {
HIMAGELIST himl; // handle to image list HIMAGELIST himl; /* handle to image list */
HBITMAP hbmp; // handle to bitmap HBITMAP hbmp; /* handle to bitmap */
// Create the image list. /* Create the image list. */
if ((himl = ImageList_Create(CX_BITMAP, CY_BITMAP, if ((himl = ImageList_Create(CX_BITMAP, CY_BITMAP,
FALSE, NUM_BITMAPS, 0)) == NULL) FALSE, NUM_BITMAPS, 0)) == NULL)
return FALSE; return FALSE;
// Add the open file, closed file, and document bitmaps. /* Add the open file, closed file, and document bitmaps. */
hbmp = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_OPEN_FILE)); hbmp = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_OPEN_FILE));
Image_Open = ImageList_Add(himl, hbmp, (HBITMAP) NULL); Image_Open = ImageList_Add(himl, hbmp, (HBITMAP) NULL);
DeleteObject(hbmp); DeleteObject(hbmp);
hbmp = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_CLOSED_FILE)); hbmp = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_CLOSED_FILE));
Image_Closed = ImageList_Add(himl, hbmp, (HBITMAP) NULL); Image_Closed = ImageList_Add(himl, hbmp, (HBITMAP) NULL);
DeleteObject(hbmp); DeleteObject(hbmp);
hbmp = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_ROOT)); hbmp = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_ROOT));
Image_Root = ImageList_Add(himl, hbmp, (HBITMAP) NULL); Image_Root = ImageList_Add(himl, hbmp, (HBITMAP) NULL);
DeleteObject(hbmp); DeleteObject(hbmp);
// Fail if not all of the images were added. /* Fail if not all of the images were added. */
if (ImageList_GetImageCount(himl) < 3) if (ImageList_GetImageCount(himl) < 3)
return FALSE; return FALSE;
// Associate the image list with the tree view control. /* Associate the image list with the tree view control. */
TreeView_SetImageList(hwndTV, himl, TVSIL_NORMAL); TreeView_SetImageList(hwndTV, himl, TVSIL_NORMAL);
return TRUE; return TRUE;
} }
BOOL OnTreeExpanding(HWND hwndTV, NMTREEVIEW* pnmtv) BOOL OnTreeExpanding(HWND hwndTV, NMTREEVIEW* pnmtv)
{ {
HKEY hKey; HKEY hKey;
TCHAR keyPath[1000]; TCHAR keyPath[1000];
int keyPathLen = 0; int keyPathLen = 0;
@ -185,7 +186,7 @@ BOOL OnTreeExpanding(HWND hwndTV, NMTREEVIEW* pnmtv)
} }
expanding = TRUE; expanding = TRUE;
// check if this is either the root or a subkey item... /* check if this is either the root or a subkey item... */
if ((HKEY)pnmtv->itemNew.lParam == NULL) { if ((HKEY)pnmtv->itemNew.lParam == NULL) {
keyPath[0] = _T('\0'); keyPath[0] = _T('\0');
hKey = FindRegRoot(hwndTV, pnmtv->itemNew.hItem, keyPath, &keyPathLen, sizeof(keyPath)/sizeof(TCHAR)); hKey = FindRegRoot(hwndTV, pnmtv->itemNew.hItem, keyPath, &keyPathLen, sizeof(keyPath)/sizeof(TCHAR));
@ -202,14 +203,14 @@ BOOL OnTreeExpanding(HWND hwndTV, NMTREEVIEW* pnmtv)
DWORD cName = MAX_NAME_LEN; DWORD cName = MAX_NAME_LEN;
FILETIME LastWriteTime; FILETIME LastWriteTime;
DWORD dwIndex = 0L; DWORD dwIndex = 0L;
//ShowWindow(hwndTV, SW_HIDE); /*ShowWindow(hwndTV, SW_HIDE); */
while (RegEnumKeyEx(hNewKey, dwIndex, Name, &cName, NULL, NULL, NULL, &LastWriteTime) == ERROR_SUCCESS) { while (RegEnumKeyEx(hNewKey, dwIndex, Name, &cName, NULL, NULL, NULL, &LastWriteTime) == ERROR_SUCCESS) {
DWORD dwCount = 0L; DWORD dwCount = 0L;
errCode = RegOpenKeyEx(hNewKey, Name, 0, KEY_READ, &hKey); errCode = RegOpenKeyEx(hNewKey, Name, 0, KEY_READ, &hKey);
if (errCode == ERROR_SUCCESS) { if (errCode == ERROR_SUCCESS) {
TCHAR SubName[MAX_NAME_LEN]; TCHAR SubName[MAX_NAME_LEN];
DWORD cSubName = MAX_NAME_LEN; DWORD cSubName = MAX_NAME_LEN;
// if (RegEnumKeyEx(hKey, 0, SubName, &cSubName, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) { /* if (RegEnumKeyEx(hKey, 0, SubName, &cSubName, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) { */
while (RegEnumKeyEx(hKey, dwCount, SubName, &cSubName, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) { while (RegEnumKeyEx(hKey, dwCount, SubName, &cSubName, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) {
++dwCount; ++dwCount;
} }
@ -219,34 +220,36 @@ BOOL OnTreeExpanding(HWND hwndTV, NMTREEVIEW* pnmtv)
cName = MAX_NAME_LEN; cName = MAX_NAME_LEN;
++dwIndex; ++dwIndex;
} }
//ShowWindow(hwndTV, SW_SHOWNOACTIVATE); /*ShowWindow(hwndTV, SW_SHOWNOACTIVATE); */
RegCloseKey(hNewKey); RegCloseKey(hNewKey);
} }
} else { } else {
} }
expanding = FALSE; expanding = FALSE;
return TRUE; return TRUE;
} }
// CreateTreeView - creates a tree view control. /*
// Returns the handle to the new control if successful, or NULL otherwise. * CreateTreeView - creates a tree view control.
// hwndParent - handle to the control's parent window. * Returns the handle to the new control if successful, or NULL otherwise.
* hwndParent - handle to the control's parent window.
*/
HWND CreateTreeView(HWND hwndParent, LPTSTR pHostName, int id) HWND CreateTreeView(HWND hwndParent, LPTSTR pHostName, int id)
{ {
RECT rcClient; RECT rcClient;
HWND hwndTV; HWND hwndTV;
// Get the dimensions of the parent window's client area, and create the tree view control. /* Get the dimensions of the parent window's client area, and create the tree view control. */
GetClientRect(hwndParent, &rcClient); GetClientRect(hwndParent, &rcClient);
hwndTV = CreateWindowEx(WS_EX_CLIENTEDGE, WC_TREEVIEW, _T("Tree View"), hwndTV = CreateWindowEx(WS_EX_CLIENTEDGE, WC_TREEVIEW, _T("Tree View"),
WS_VISIBLE | WS_CHILD | TVS_HASLINES | TVS_HASBUTTONS | TVS_LINESATROOT, WS_VISIBLE | WS_CHILD | TVS_HASLINES | TVS_HASBUTTONS | TVS_LINESATROOT,
0, 0, rcClient.right, rcClient.bottom, 0, 0, rcClient.right, rcClient.bottom,
hwndParent, (HMENU)id, hInst, NULL); hwndParent, (HMENU)id, hInst, NULL);
// Initialize the image list, and add items to the control. /* Initialize the image list, and add items to the control. */
if (!InitTreeViewImageLists(hwndTV) || !InitTreeViewItems(hwndTV, pHostName)) { if (!InitTreeViewImageLists(hwndTV) || !InitTreeViewItems(hwndTV, pHostName)) {
DestroyWindow(hwndTV); DestroyWindow(hwndTV);
return NULL; return NULL;
} }
return hwndTV; return hwndTV;
} }

View file

@ -25,7 +25,6 @@ APPS = calc \
net$(SEP)finger \ net$(SEP)finger \
net$(SEP)ncftp \ net$(SEP)ncftp \
net$(SEP)ping \ net$(SEP)ping \
regedit \
regedt32 \ regedt32 \
welcome \ welcome \
# winfile # winfile

View file

@ -1,17 +0,0 @@
*.sys
*.exe
*.dll
*.cpl
*.a
*.o
*.d
*.coff
*.dsp
*.dsw
*.aps
*.ncb
*.opt
*.sym
*.plg
*.bak
*.map

View file

@ -1,48 +0,0 @@
#
# ReactOS regedit
#
# Makefile
#
PATH_TO_TOP = ../../reactos
TARGET_TYPE = program
TARGET_APPTYPE = console
TARGET_NAME = regedit
#TARGET_CFLAGS = -I$(TEST_ROOT) -DDBG -DUNICODE -D_UNICODE
#TARGET_CFLAGS = -D_WIN32_IE=0x0400
#TARGET_RCFLAGS = -D_WIN32_IE=0x0400
WINE_MODE = yes
WINE_RC = $(TARGET_NAME)
WINE_INCLUDE = ./
TARGET_SDKLIBS = \
kernel32.a \
user32.a \
gdi32.a
TARGET_GCCLIBS = comctl32 comdlg32
TARGET_OBJECTS = \
about.o \
childwnd.o \
framewnd.o \
hex_str.o \
listview.o \
main.o \
regcmds.o \
regproc.o \
treeview.o \
trace.o
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
# EOF

View file

@ -1,38 +0,0 @@
/*
* ReactOS regedit
*
* childwnd.h
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __CHILDWND_H__
#define __CHILDWND_H__
#ifdef __cplusplus
extern "C" {
#endif
LRESULT CALLBACK ChildWndProc(HWND, UINT, WPARAM, LPARAM);
#ifdef __cplusplus
};
#endif
#endif // __CHILDWND_H__

View file

@ -1,33 +0,0 @@
#ifndef __DBG_H__
#define __DBG_H__
/*
void Assert(void* assert, const char* file, int line, void* msg);
#define ASSERT Assert(void* assert, const char* file, int line, void* msg)
#define D(_x_) \
printf("(%hS:%d)(%hS) ", __FILE__, __LINE__, __FUNCTION__); \
printf _x_;
*/
#ifdef ASSERT
#undef ASSERT
#endif
#ifdef NASSERT
#define ASSERT(x)
#else /* NASSERT */
//#define ASSERT(x) if (!(x)) { printf("Assertion "#x" failed at %s:%d\n", __FILE__, __LINE__); assert(0); }
#define ASSERT(x) if (!(x)) { printf("Assertion "#x" failed at %s:%d\n", __FILE__, __LINE__); }
#endif /* NASSERT */
#ifdef __GNUC__
#else
//#define __FUNCTION__ "unknown"
#endif /*__GNUC__*/
#endif /*__DBG_H__*/

View file

@ -1,37 +0,0 @@
/*
* ReactOS Application Debug Routines
*
* debug.c
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef _MSC_VER
#include "stdafx.h"
#else
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <commctrl.h>
#include <stdlib.h>
#include <tchar.h>
#include <process.h>
#include <stdio.h>
#endif
#include "main.h"
#include "debug.h"

View file

@ -1,41 +0,0 @@
/*
* ReactOS regedit
*
* framewnd.h
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __FRAMEWND_H__
#define __FRAMEWND_H__
#ifdef __cplusplus
extern "C" {
#endif
LRESULT CALLBACK FrameWndProc(HWND, UINT, WPARAM, LPARAM);
void SetupStatusBar(HWND hWnd, BOOL bResize);
void UpdateStatusBar(void);
#ifdef __cplusplus
};
#endif
#endif // __FRAMEWND_H__

View file

@ -1,153 +0,0 @@
///////////////////////////////////////////////////////////////////////////////
// HEX_STR.C
// Copyright (c) 1995 by Robert Dickenson
//
#include "hex_str.h"
#define LOBYTE(w) ((unsigned char)(w))
#define HIBYTE(w) ((unsigned char)((unsigned short)(w) >> 8))
unsigned char AsciiTable[256][3] = {
"00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "0A", "0B", "0C", "0D", "0E", "0F",
"10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "1A", "1B", "1C", "1D", "1E", "1F",
"20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "2A", "2B", "2C", "2D", "2E", "2F",
"30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "3A", "3B", "3C", "3D", "3E", "3F",
"40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "4A", "4B", "4C", "4D", "4E", "4F",
"50", "51", "52", "53", "54", "55", "56", "57", "58", "59", "5A", "5B", "5C", "5D", "5E", "5F",
"60", "61", "62", "63", "64", "65", "66", "67", "68", "69", "6A", "6B", "6C", "6D", "6E", "6F",
"70", "71", "72", "73", "74", "75", "76", "77", "78", "79", "7A", "7B", "7C", "7D", "7E", "7F",
"80", "81", "82", "83", "84", "85", "86", "87", "88", "89", "8A", "8B", "8C", "8D", "8E", "8F",
"90", "91", "92", "93", "94", "95", "96", "97", "98", "99", "9A", "9B", "9C", "9D", "9E", "9F",
"A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "A8", "A9", "AA", "AB", "AC", "AD", "AE", "AF",
"B0", "B1", "B2", "B3", "B4", "B5", "B6", "B7", "B8", "B9", "BA", "BB", "BC", "BD", "BE", "BF",
"C0", "C1", "C2", "C3", "C4", "C5", "C6", "C7", "C8", "C9", "CA", "CB", "CC", "CD", "CE", "CF",
"D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7", "D8", "D9", "DA", "DB", "DC", "DD", "DE", "DF",
"E0", "E1", "E2", "E3", "E4", "E5", "E6", "E7", "E8", "E9", "EA", "EB", "EC", "ED", "EE", "EF",
"F0", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "FA", "FB", "FC", "FD", "FE", "FF"
};
unsigned char HexTable[24] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 10, 11, 12, 13, 14, 15, 16
};
unsigned long BinaryNibbles[] = {
(unsigned long)"0000",
(unsigned long)"0001",
(unsigned long)"0010",
(unsigned long)"0011",
(unsigned long)"0100",
(unsigned long)"0101",
(unsigned long)"0110",
(unsigned long)"0111",
(unsigned long)"1000",
(unsigned long)"1001",
(unsigned long)"1010",
(unsigned long)"1011",
(unsigned long)"1100",
(unsigned long)"1101",
(unsigned long)"1110",
(unsigned long)"1111"
};
void ByteBinStr(char* dst, unsigned char num)
{
*(unsigned long*)dst++ = BinaryNibbles[(num >> 4) & 0x07];
*(unsigned long*)dst++ = BinaryNibbles[num & 0x07];
}
void WordBinStr(char* dst, unsigned short num)
{
ByteBinStr(dst, HIBYTE(num));
ByteBinStr(dst+4, LOBYTE(num));
}
unsigned short Byte2Hex(unsigned char data)
{
register unsigned short result;
result = AsciiTable[data][1] << 8;
result += AsciiTable[data][0];
return result;
}
unsigned long Word2Hex(unsigned short data)
{
register unsigned long result;
result = (unsigned long)Byte2Hex(LOBYTE(data)) << 16;
result += Byte2Hex(HIBYTE(data));
return result;
}
unsigned char HexByte(char* str)
{
register unsigned char result;
result = HexTable[*str++ - '0'] * 16;
result += HexTable[*str++ - '0'];
return result;
}
unsigned int HexWord(char* str)
{
register unsigned int result;
result = HexByte(str) << 8;
result += HexByte(str+2);
return result;
}
unsigned long HexLong(char* str)
{
register unsigned long result;
result = HexByte(str++) << 24;
result += HexByte(str++) << 16;
result += HexByte(str++) << 8;
result += HexByte(str);
return result;
}
unsigned long HexString(char* str)
{
unsigned long temp = 0;
while ( *str )
{
temp <<= 4;
switch ( *str++ )
{
case '0': break;
case '1': temp += 1; break;
case '2': temp += 2; break;
case '3': temp += 3; break;
case '4': temp += 4; break;
case '5': temp += 5; break;
case '6': temp += 6; break;
case '7': temp += 7; break;
case '8': temp += 8; break;
case '9': temp += 9; break;
case 'A': temp += 10; break;
case 'B': temp += 11; break;
case 'C': temp += 12; break;
case 'D': temp += 13; break;
case 'E': temp += 14; break;
case 'F': temp += 15; break;
case 'a': temp += 10; break;
case 'b': temp += 11; break;
case 'c': temp += 12; break;
case 'd': temp += 13; break;
case 'e': temp += 14; break;
case 'f': temp += 15; break;
case 'X': temp = 0; break;
case 'x': temp = 0; break;
default: return temp;
}
}
return temp;
}
///////////////////////////////////////////////////////////////////////////////

View file

@ -1,30 +0,0 @@
///////////////////////////////////////////////////////////////////////////////
// HEX_STR.H
// Copyright (c) 1995 by Robert Dickenson
//
#ifndef __HEX_STR_H__
#define __HEX_STR_H__
#ifdef __cplusplus
extern "C" {
#endif
unsigned short Byte2Hex(unsigned char);
unsigned long Word2Hex(unsigned short);
unsigned char HexByte(char*);
unsigned int HexWord(char*);
unsigned long HexLong(char*);
unsigned long HexString(char*);
void ByteBinStr(char*, unsigned char);
void WordBinStr(char*, unsigned short);
unsigned long HexString(char*);
#ifdef __cplusplus
}
#endif
#endif // __HEX_STR_H__
///////////////////////////////////////////////////////////////////////////////

View file

@ -1,39 +0,0 @@
/*
* ReactOS regedit
*
* listview.h
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LISTVIEW_H__
#define __LISTVIEW_H__
#ifdef __cplusplus
extern "C" {
#endif
HWND CreateListView(HWND hwndParent, int id);
BOOL RefreshListView(HWND hwndTV, HKEY hKey, LPTSTR keyPath);
#ifdef __cplusplus
};
#endif
#endif // __LISTVIEW_H__

View file

@ -1,97 +0,0 @@
/*
* ReactOS regedit
*
* main.h
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __MAIN_H__
#define __MAIN_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "resource.h"
#define STATUS_WINDOW 2001
#define TREE_WINDOW 2002
#define LIST_WINDOW 2003
#define MAX_LOADSTRING 100
#define SPLIT_WIDTH 5
#define MAX_NAME_LEN 500
////////////////////////////////////////////////////////////////////////////////
enum OPTION_FLAGS {
OPTIONS_AUTO_REFRESH = 0x01,
OPTIONS_READ_ONLY_MODE = 0x02,
OPTIONS_CONFIRM_ON_DELETE = 0x04,
OPTIONS_SAVE_ON_EXIT = 0x08,
OPTIONS_DISPLAY_BINARY_DATA = 0x10,
OPTIONS_VIEW_TREE_ONLY = 0x20,
OPTIONS_VIEW_DATA_ONLY = 0x40,
};
typedef struct {
HWND hWnd;
HWND hTreeWnd;
HWND hListWnd;
int nFocusPanel; // 0: left 1: right
int nSplitPos;
WINDOWPLACEMENT pos;
TCHAR szPath[MAX_PATH];
} ChildWnd;
////////////////////////////////////////////////////////////////////////////////
// Global Variables:
//
extern HINSTANCE hInst;
extern HWND hFrameWnd;
extern HMENU hMenuFrame;
extern HWND hStatusBar;
extern HFONT hFont;
extern enum OPTION_FLAGS Options;
extern TCHAR szTitle[];
extern TCHAR szFrameClass[];
extern TCHAR szChildClass[];
#if __MINGW32_MAJOR_VERSION < 1
typedef struct tagNMITEMACTIVATE{
NMHDR hdr;
int iItem;
int iSubItem;
UINT uNewState;
UINT uOldState;
UINT uChanged;
POINT ptAction;
LPARAM lParam;
UINT uKeyFlags;
} NMITEMACTIVATE, FAR *LPNMITEMACTIVATE;
#endif
#ifdef __cplusplus
};
#endif
#endif // __MAIN_H__

View file

@ -1,380 +0,0 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#define APSTUDIO_HIDDEN_SYMBOLS
#include "windows.h"
#undef APSTUDIO_HIDDEN_SYMBOLS
#include "resource.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_REGEDIT ICON DISCARDABLE "res/regedit.ico"
IDI_SMALL ICON DISCARDABLE "res/small.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDB_OPEN_FILE BITMAP DISCARDABLE "res/folder3.bmp"
IDB_CLOSED_FILE BITMAP DISCARDABLE "res/folder1.bmp"
IDB_ROOT BITMAP DISCARDABLE "res/folder2.bmp"
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDC_REGEDIT MENU DISCARDABLE
BEGIN
POPUP "&File"
BEGIN
MENUITEM "E&xit", ID_REGISTRY_EXIT
END
POPUP "&Help"
BEGIN
MENUITEM "&About ...", ID_HELP_ABOUT
END
END
IDR_REGEDIT_MENU MENU DISCARDABLE
BEGIN
POPUP "&Registry"
BEGIN
MENUITEM "&Import Registry File...", ID_REGISTRY_IMPORTREGISTRYFILE
MENUITEM "&Export Registry File...", ID_REGISTRY_EXPORTREGISTRYFILE
MENUITEM SEPARATOR
MENUITEM "&Connect Network Registry...",
ID_REGISTRY_CONNECTNETWORKREGISTRY
, GRAYED
MENUITEM "&Disconnect Network Registry...",
ID_REGISTRY_DISCONNECTNETWORKREGISTRY
, GRAYED
MENUITEM SEPARATOR
MENUITEM "&Print\tCtrl+P", ID_REGISTRY_PRINT, GRAYED
MENUITEM SEPARATOR
MENUITEM "E&xit", ID_REGISTRY_EXIT
END
POPUP "&Edit"
BEGIN
MENUITEM "&Modify", ID_EDIT_MODIFY
MENUITEM SEPARATOR
POPUP "&New"
BEGIN
MENUITEM "&Key", ID_EDIT_NEW_KEY
MENUITEM SEPARATOR
MENUITEM "&String Value", ID_EDIT_NEW_STRINGVALUE
MENUITEM "&Binary Value", ID_EDIT_NEW_BINARYVALUE
MENUITEM "&DWORD Value", ID_EDIT_NEW_DWORDVALUE
END
MENUITEM SEPARATOR
MENUITEM "&Delete\tDel", ID_EDIT_DELETE
MENUITEM "&Rename", ID_EDIT_RENAME
MENUITEM SEPARATOR
MENUITEM "&Copy Key Name", ID_EDIT_COPYKEYNAME
MENUITEM SEPARATOR
MENUITEM "&Find\tCtrl+F", ID_EDIT_FIND, GRAYED
MENUITEM "Find Ne&xt\tF3", ID_EDIT_FINDNEXT, GRAYED
END
POPUP "&View"
BEGIN
MENUITEM "Status &Bar", ID_VIEW_STATUSBAR
MENUITEM SEPARATOR
MENUITEM "Sp&lit", ID_VIEW_SPLIT
MENUITEM SEPARATOR
MENUITEM "&Refresh\tF5", ID_VIEW_REFRESH
END
POPUP "&Favourites"
BEGIN
MENUITEM "&Add to Favourites", ID_FAVOURITES_ADDTOFAVOURITES
, GRAYED
MENUITEM "&Remove Favourite", ID_FAVOURITES_REMOVEFAVOURITE
, GRAYED
END
POPUP "&Help"
BEGIN
MENUITEM "&Help Topics", ID_HELP_HELPTOPICS
MENUITEM SEPARATOR
MENUITEM "&About Registry Editor", ID_HELP_ABOUT
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUTBOX DIALOG DISCARDABLE 22, 17, 230, 75
STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
CAPTION "About"
FONT 8, "System"
BEGIN
ICON IDI_REGEDIT,IDI_REGEDIT,14,9,16,16
LTEXT "ReactOS regedit Version 1.0",IDC_STATIC,49,10,119,8,
SS_NOPREFIX
LTEXT "Copyright (C) 2002 ReactOS Team",IDC_STATIC,49,20,119,8
DEFPUSHBUTTON "OK",IDOK,195,6,30,11,WS_GROUP
END
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
"#include ""windows.h""\r\n"
"#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
"#include ""resource.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
(1) VERSIONINFO
FILEVERSION 0,0,21,3
PRODUCTVERSION 0,0,21,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "Comments", "Absolutely no warranties whatsoever - Use at your own risk\0"
VALUE "CompanyName", "ReactOS Development Team\0"
VALUE "FileDescription", "ReactOS Registry Editor by Robert Dickenson\0"
VALUE "FileVersion", "1, 0, 0, 1\0"
VALUE "InternalName", "regedit\0"
VALUE "LegalCopyright", "Copyright © 2002 Robert Dickenson\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "regedit.exe\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "ReactOS Operating System\0"
VALUE "ProductVersion", "0.0.21\0"
VALUE "SpecialBuild", "Non-versioned Development Beta Release\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0xc09, 1200
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_LIST_COLUMN_NAME "Name"
IDS_LIST_COLUMN_TYPE "Type"
IDS_LIST_COLUMN_DATA "Data"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_APP_TITLE "ReactOS Registry Editor"
IDC_REGEDIT "REGEDIT"
IDC_REGEDIT_FRAME "REGEDIT_FRAME"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_REGISTRY_MENU "Contains commands for working with the whole registry"
ID_EDIT_MENU "Contains commands for editing values or keys"
ID_VIEW_MENU "Contains commands for customising the registry window"
ID_FAVOURITES_MENU "Contains commands for accessing frequently used keys"
ID_HELP_MENU "Contains commands for displaying help and information about registry editor"
ID_EDIT_NEW_MENU "Contains commands for creating new keys or values"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_EDIT_MODIFY "Modifies the value's data"
ID_EDIT_NEW_KEY "Adds a new key"
ID_EDIT_NEW_STRINGVALUE "Adds a new string value"
ID_EDIT_NEW_BINARYVALUE "Adds a new binary value"
ID_EDIT_NEW_DWORDVALUE "Adds a new double word value"
ID_REGISTRY_IMPORTREGISTRYFILE "Imports a text file into the registry"
ID_REGISTRY_EXPORTREGISTRYFILE
"Exports all or part of the registry to a text file"
ID_REGISTRY_CONNECTNETWORKREGISTRY
"Connects to a remote computer's registry"
ID_REGISTRY_DISCONNECTNETWORKREGISTRY
"Disconnects from a remote computer's registry"
ID_REGISTRY_PRINT "Prints all or part of the registry"
ID_HELP_HELPTOPICS "Opens registry editor help"
ID_HELP_ABOUT "Displays program information, version number and copyright"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_REGISTRY_EXIT "Quits the registry editor"
ID_FAVOURITES_ADDTOFAVOURITES "Adds keys to the favourites list"
ID_FAVOURITES_REMOVEFAVOURITE "Removes keys from the favourites list"
ID_VIEW_STATUSBAR "Shows or hides the status bar"
ID_VIEW_SPLIT "Change position of split between two panes"
ID_VIEW_REFRESH "Refreshes the window"
ID_EDIT_DELETE "Deletes the selection"
ID_EDIT_RENAME "Renames the selection"
ID_EDIT_COPYKEYNAME "Copies the name of the selected key to the clipboard"
ID_EDIT_FIND "Finds a text string in a key, value or data"
ID_EDIT_FINDNEXT "Finds next occurrence of text specified in previous search"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// English (Australia) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENA)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_AUS
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_DIALOG1 DIALOG DISCARDABLE 50, 50, 268, 98
STYLE DS_3DLOOK | DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS |
WS_BORDER
FONT 8, "MS Sans Serif"
BEGIN
END
IDD_DIALOG2 DIALOG DISCARDABLE 0, 0, 187, 95
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Dialog"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,130,7,50,14
PUSHBUTTON "Cancel",IDCANCEL,130,24,50,14
END
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_DIALOG1, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 261
TOPMARGIN, 7
BOTTOMMARGIN, 91
END
IDD_DIALOG2, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 180
TOPMARGIN, 7
BOTTOMMARGIN, 88
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
ID_HELP_HELPTOPICS "Opens Registry Editor Help."
ID_HELP_ABOUT "Displays program information, version number, and copyright."
END
#endif // English (Australia) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View file

@ -1,110 +0,0 @@
/*
* Copyright 1999 Sylvain St-Germain
* Copyright 2002 Andriy Palamarchuk
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/******************************************************************************
* Defines and consts
*/
#define KEY_MAX_LEN 1024
/* Return values */
#define SUCCESS 0
#define KEY_VALUE_ALREADY_SET 2
typedef void (*CommandAPI)(LPTSTR lpsLine);
void doSetValue(LPTSTR lpsLine);
void doDeleteValue(LPTSTR lpsLine);
void doCreateKey(LPTSTR lpsLine);
void doDeleteKey(LPTSTR lpsLine);
void doQueryValue(LPTSTR lpsLine);
void doRegisterDLL(LPTSTR lpsLine);
void doUnregisterDLL(LPTSTR lpsLine);
BOOL export_registry_key(TCHAR* file_name, TCHAR* reg_key_name);
BOOL import_registry_file(LPTSTR filename);
void delete_registry_key(TCHAR* reg_key_name);
void processRegLines(FILE* in, CommandAPI command);
/*
* Generic prototypes
*/
#ifdef _UNICODE
#define get_file_name get_file_nameW
#else
#define get_file_name get_file_nameA
#endif
char* getToken(char** str, const char* delims);
void get_file_nameA(CHAR** command_line, CHAR* filename, int max_filename);
void get_file_nameW(CHAR** command_line, WCHAR* filename, int max_filename);
DWORD convertHexToDWord(TCHAR* str, BYTE* buf);
DWORD convertHexCSVToHex(TCHAR* str, BYTE* buf, ULONG bufLen);
LPTSTR convertHexToHexCSV(BYTE* buf, ULONG len);
LPTSTR convertHexToDWORDStr(BYTE* buf, ULONG len);
LPTSTR getRegKeyName(LPTSTR lpLine);
HKEY getRegClass(LPTSTR lpLine);
DWORD getDataType(LPTSTR* lpValue, DWORD* parse_type);
LPTSTR getArg(LPTSTR arg);
HRESULT openKey(LPTSTR stdInput);
void closeKey(VOID);
/*
* api setValue prototypes
*/
void processSetValue(LPTSTR cmdline);
HRESULT setValue(LPTSTR val_name, LPTSTR val_data);
/*
* api queryValue prototypes
*/
void processQueryValue(LPTSTR cmdline);
#ifdef __GNUC__
#ifdef WIN32_REGDBG
//typedef UINT_PTR SIZE_T, *PSIZE_T;
//#define _MAX_PATH 260 /* max. length of full pathname */
#endif /*WIN32_REGDBG*/
#ifdef UNICODE
#define _tfopen _wfopen
#else
#define _tfopen fopen
#endif
#endif /*__GNUC__*/
LPVOID RegHeapAlloc(
HANDLE hHeap, // handle to private heap block
DWORD dwFlags, // heap allocation control
SIZE_T dwBytes // number of bytes to allocate
);
LPVOID RegHeapReAlloc(
HANDLE hHeap, // handle to heap block
DWORD dwFlags, // heap reallocation options
LPVOID lpMem, // pointer to memory to reallocate
SIZE_T dwBytes // number of bytes to reallocate
);
BOOL RegHeapFree(
HANDLE hHeap, // handle to heap
DWORD dwFlags, // heap free options
LPVOID lpMem // pointer to memory
);

View file

@ -1,53 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Diagnostic Trace
//
#include <stdio.h>
#include <stdarg.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <tchar.h>
#include "trace.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
void _DebugBreak(void)
{
DebugBreak();
}
void Trace(TCHAR* lpszFormat, ...)
{
va_list args;
int nBuf;
TCHAR szBuffer[512];
va_start(args, lpszFormat);
nBuf = _vsntprintf(szBuffer, sizeof(szBuffer)/sizeof(TCHAR), lpszFormat, args);
OutputDebugString(szBuffer);
// was there an error? was the expanded string too long?
//ASSERT(nBuf >= 0);
va_end(args);
}
void Assert(void* assert, TCHAR* file, int line, void* msg)
{
if (msg == NULL) {
printf("ASSERT -- %s occured on line %u of file %s.\n",
assert, line, file);
} else {
printf("ASSERT -- %s occured on line %u of file %s: Message = %s.\n",
assert, line, file, msg);
}
}
#else
void Trace(TCHAR* lpszFormat, ...) { };
void Assert(void* assert, TCHAR* file, int line, void* msg) { };
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////

View file

@ -1,61 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Diagnostic Trace
//
#ifndef __TRACE_H__
#define __TRACE_H__
#ifdef _DEBUG
#ifdef _X86_
#define BreakPoint() _asm { int 3h }
#else
#define BreakPoint() _DebugBreak()
#endif
#ifndef ASSERT
#define ASSERT(exp) \
{ \
if (!(exp)) { \
Assert(#exp, __FILE__, __LINE__, NULL); \
BreakPoint(); \
} \
} \
#define ASSERTMSG(exp, msg) \
{ \
if (!(exp)) { \
Assert(#exp, __FILE__, __LINE__, msg); \
BreakPoint(); \
} \
}
#endif
//=============================================================================
// MACRO: TRACE()
//=============================================================================
#define TRACE Trace
#else // _DEBUG
//=============================================================================
// Define away MACRO's ASSERT() and TRACE() in non debug builds
//=============================================================================
#ifndef ASSERT
#define ASSERT(exp)
#define ASSERTMSG(exp, msg)
#endif
#define TRACE 0 ? (void)0 : Trace
#endif // !_DEBUG
void Assert(void* assert, TCHAR* file, int line, void* msg);
void Trace(TCHAR* lpszFormat, ...);
#endif // __TRACE_H__
/////////////////////////////////////////////////////////////////////////////

View file

@ -1,40 +0,0 @@
/*
* ReactOS regedit
*
* treeview.h
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __TREEVIEW_H__
#define __TREEVIEW_H__
#ifdef __cplusplus
extern "C" {
#endif
HWND CreateTreeView(HWND hwndParent, LPTSTR pHostName, int id);
BOOL OnTreeExpanding(HWND hWnd, NMTREEVIEW* pnmtv);
HKEY FindRegRoot(HWND hwndTV, HTREEITEM hItem, LPTSTR keyPath, int* pPathLen, int max);
#ifdef __cplusplus
};
#endif
#endif // __TREEVIEW_H__