main.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. /*
  2. * Regedit definitions
  3. *
  4. * Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with this library; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  19. */
  20. #ifndef __MAIN_H__
  21. #define __MAIN_H__
  22. #include <stdio.h>
  23. #include "resource.h"
  24. #define STATUS_WINDOW 2001
  25. #define TREE_WINDOW 2002
  26. #define LIST_WINDOW 2003
  27. #define SPLIT_WIDTH 5
  28. #define MAX_NEW_KEY_LEN 128
  29. #define KEY_MAX_LEN 1024
  30. #define REG_FORMAT_5 1
  31. #define REG_FORMAT_4 2
  32. /* Pop-Up Menus */
  33. #define PM_COMPUTER 0
  34. #define PM_TREEVIEW 1
  35. #define PM_NEW_VALUE 2
  36. #define PM_MODIFY_VALUE 3
  37. /* HexEdit Class */
  38. #define HEM_SETDATA (WM_USER+0)
  39. #define HEM_GETDATA (WM_USER+1)
  40. /******************************************************************************/
  41. enum OPTION_FLAGS {
  42. OPTIONS_AUTO_REFRESH = 0x01,
  43. OPTIONS_READ_ONLY_MODE = 0x02,
  44. OPTIONS_CONFIRM_ON_DELETE = 0x04,
  45. OPTIONS_SAVE_ON_EXIT = 0x08,
  46. OPTIONS_DISPLAY_BINARY_DATA = 0x10,
  47. OPTIONS_VIEW_TREE_ONLY = 0x20,
  48. OPTIONS_VIEW_DATA_ONLY = 0x40,
  49. };
  50. enum SEARCH_FLAGS {
  51. SEARCH_WHOLE = 0x01,
  52. SEARCH_KEYS = 0x02,
  53. SEARCH_VALUES = 0x04,
  54. SEARCH_CONTENT = 0x08,
  55. };
  56. typedef struct {
  57. HWND hWnd;
  58. HWND hTreeWnd;
  59. HWND hListWnd;
  60. int nFocusPanel; /* 0: left 1: right */
  61. int nSplitPos;
  62. WINDOWPLACEMENT pos;
  63. WCHAR szPath[MAX_PATH];
  64. } ChildWnd;
  65. extern ChildWnd* g_pChildWnd;
  66. typedef struct tagLINE_INFO
  67. {
  68. WCHAR *name;
  69. DWORD dwValType;
  70. void *val;
  71. size_t val_len;
  72. } LINE_INFO;
  73. /*******************************************************************************
  74. * Global Variables:
  75. */
  76. extern HINSTANCE hInst;
  77. extern HWND hFrameWnd;
  78. extern HMENU hMenuFrame;
  79. extern HWND hStatusBar;
  80. extern HMENU hPopupMenus;
  81. extern HFONT hFont;
  82. extern enum OPTION_FLAGS Options;
  83. extern WCHAR szTitle[];
  84. extern const WCHAR szFrameClass[];
  85. extern const WCHAR szChildClass[];
  86. extern const WCHAR szHexEditClass[];
  87. extern WCHAR g_pszDefaultValueName[];
  88. extern DWORD g_columnToSort;
  89. extern BOOL g_invertSort;
  90. extern WCHAR *g_currentPath;
  91. extern HKEY g_currentRootKey;
  92. /* Registry class names and their indexes */
  93. extern const WCHAR* reg_class_namesW[];
  94. #define INDEX_HKEY_LOCAL_MACHINE 0
  95. #define INDEX_HKEY_USERS 1
  96. #define INDEX_HKEY_CLASSES_ROOT 2
  97. #define INDEX_HKEY_CURRENT_CONFIG 3
  98. #define INDEX_HKEY_CURRENT_USER 4
  99. #define INDEX_HKEY_DYN_DATA 5
  100. /* about.c */
  101. void ShowAboutBox(HWND hWnd);
  102. /* childwnd.c */
  103. LPWSTR GetItemFullPath(HWND hwndTV, HTREEITEM hItem, BOOL bFull);
  104. LRESULT CALLBACK ChildWndProc(HWND, UINT, WPARAM, LPARAM);
  105. /* edit.c */
  106. BOOL CreateKey(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPWSTR newKeyName);
  107. BOOL CreateValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, DWORD valueType, LPWSTR valueName);
  108. BOOL ModifyValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR valueName);
  109. BOOL DeleteKey(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath);
  110. BOOL DeleteValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR valueName);
  111. BOOL RenameValue(HWND hwnd, HKEY hRootKey, LPCWSTR keyPath, LPCWSTR oldName, LPCWSTR newName);
  112. BOOL RenameKey(HWND hwnd, HKEY hRootKey, LPCWSTR keyPath, LPCWSTR newName);
  113. int WINAPIV messagebox(HWND hwnd, int buttons, int titleId, int resId, ...);
  114. /* framewnd.c */
  115. LRESULT CALLBACK FrameWndProc(HWND, UINT, WPARAM, LPARAM);
  116. void SetupStatusBar(HWND hWnd, BOOL bResize);
  117. void UpdateStatusBar(void);
  118. /* hexedit.c */
  119. void HexEdit_Register(void);
  120. /* listview.c */
  121. BOOL update_listview_path(const WCHAR *path);
  122. void format_value_data(HWND hwndLV, int index, DWORD type, void *data, DWORD size);
  123. int AddEntryToList(HWND hwndLV, WCHAR *Name, DWORD dwValType, void *ValBuf, DWORD dwCount, int pos);
  124. void OnGetDispInfo(NMLVDISPINFOW *plvdi);
  125. HWND CreateListView(HWND hwndParent, UINT id);
  126. int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
  127. BOOL RefreshListView(HWND hwndLV, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR highlightValue);
  128. HWND StartValueRename(HWND hwndLV);
  129. LPWSTR GetItemText(HWND hwndLV, UINT item);
  130. WCHAR *GetValueName(HWND hwndLV);
  131. BOOL ListWndNotifyProc(HWND hWnd, WPARAM wParam, LPARAM lParam, BOOL *Result);
  132. BOOL IsDefaultValue(HWND hwndLV, int i);
  133. /* regedit.c */
  134. void WINAPIV output_message(unsigned int id, ...);
  135. void WINAPIV error_exit(unsigned int id, ...);
  136. /* regproc.c */
  137. void *heap_xalloc(size_t size);
  138. void *heap_xrealloc(void *buf, size_t size);
  139. char *GetMultiByteString(const WCHAR *strW);
  140. BOOL import_registry_file(FILE *reg_file);
  141. void delete_registry_key(WCHAR *reg_key_name);
  142. BOOL export_registry_key(WCHAR *file_name, WCHAR *path, DWORD format);
  143. /* treeview.c */
  144. HWND CreateTreeView(HWND hwndParent, LPWSTR pHostName, UINT id);
  145. BOOL RefreshTreeView(HWND hWndTV);
  146. BOOL OnTreeExpanding(HWND hWnd, NMTREEVIEWW* pnmtv);
  147. LPWSTR GetItemPath(HWND hwndTV, HTREEITEM hItem, HKEY* phRootKey);
  148. BOOL DeleteNode(HWND hwndTV, HTREEITEM hItem);
  149. HTREEITEM InsertNode(HWND hwndTV, HTREEITEM hItem, LPWSTR name);
  150. HWND StartKeyRename(HWND hwndTV);
  151. HTREEITEM FindPathInTree(HWND hwndTV, LPCWSTR lpKeyName);
  152. HTREEITEM FindNext(HWND hwndTV, HTREEITEM hItem, LPCWSTR sstring, int mode, int *row);
  153. #endif /* __MAIN_H__ */