mirror of
https://github.com/reactos/wine.git
synced 2025-02-23 06:12:31 +00:00
Reformat regedit in a consistent manner.
This commit is contained in:
parent
8aef340cbd
commit
58c185ecf0
@ -56,25 +56,25 @@ static void MakeFullRegPath(HWND hwndTV, HTREEITEM hItem, LPTSTR keyPath, int* p
|
||||
|
||||
static void draw_splitbar(HWND hWnd, int x)
|
||||
{
|
||||
RECT rt;
|
||||
HDC hdc = GetDC(hWnd);
|
||||
RECT rt;
|
||||
HDC hdc = GetDC(hWnd);
|
||||
|
||||
GetClientRect(hWnd, &rt);
|
||||
rt.left = x - SPLIT_WIDTH/2;
|
||||
rt.right = x + SPLIT_WIDTH/2+1;
|
||||
InvertRect(hdc, &rt);
|
||||
ReleaseDC(hWnd, hdc);
|
||||
GetClientRect(hWnd, &rt);
|
||||
rt.left = x - SPLIT_WIDTH/2;
|
||||
rt.right = x + SPLIT_WIDTH/2+1;
|
||||
InvertRect(hdc, &rt);
|
||||
ReleaseDC(hWnd, hdc);
|
||||
}
|
||||
|
||||
static void ResizeWnd(ChildWnd* pChildWnd, int cx, int cy)
|
||||
{
|
||||
HDWP hdwp = BeginDeferWindowPos(2);
|
||||
RECT rt = {0, 0, cx, cy};
|
||||
HDWP hdwp = BeginDeferWindowPos(2);
|
||||
RECT rt = {0, 0, cx, cy};
|
||||
|
||||
cx = pChildWnd->nSplitPos + SPLIT_WIDTH/2;
|
||||
cx = pChildWnd->nSplitPos + SPLIT_WIDTH/2;
|
||||
DeferWindowPos(hdwp, pChildWnd->hTreeWnd, 0, rt.left, rt.top, pChildWnd->nSplitPos-SPLIT_WIDTH/2-rt.left, rt.bottom-rt.top, SWP_NOZORDER|SWP_NOACTIVATE);
|
||||
DeferWindowPos(hdwp, pChildWnd->hListWnd, 0, rt.left+cx , rt.top, rt.right-cx, rt.bottom-rt.top, SWP_NOZORDER|SWP_NOACTIVATE);
|
||||
EndDeferWindowPos(hdwp);
|
||||
EndDeferWindowPos(hdwp);
|
||||
}
|
||||
|
||||
static void OnPaint(HWND hWnd)
|
||||
@ -99,8 +99,8 @@ static void OnPaint(HWND hWnd)
|
||||
|
||||
static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (LOWORD(wParam)) {
|
||||
/* Parse the menu selections: */
|
||||
switch (LOWORD(wParam)) {
|
||||
/* Parse the menu selections: */
|
||||
case ID_REGISTRY_EXIT:
|
||||
DestroyWindow(hWnd);
|
||||
break;
|
||||
@ -110,7 +110,7 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
@ -127,12 +127,12 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
static int last_split;
|
||||
/* ChildWnd* pChildWnd = (ChildWnd*)GetWindowLong(hWnd, GWL_USERDATA); */
|
||||
/* ChildWnd* pChildWnd = (ChildWnd*)GetWindowLong(hWnd, GWL_USERDATA); */
|
||||
|
||||
switch (message) {
|
||||
case WM_CREATE:
|
||||
pChildWnd = (ChildWnd*)((LPCREATESTRUCT)lParam)->lpCreateParams;
|
||||
if (!pChildWnd) return 0;
|
||||
if (!pChildWnd) return 0;
|
||||
pChildWnd->nSplitPos = 250;
|
||||
pChildWnd->hTreeWnd = CreateTreeView(hWnd, pChildWnd->szPath, TREE_WINDOW);
|
||||
pChildWnd->hListWnd = CreateListView(hWnd, LIST_WINDOW/*, pChildWnd->szPath*/);
|
||||
@ -141,99 +141,99 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||
if (!_CmdWndProc(hWnd, message, wParam, lParam)) {
|
||||
goto def;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case WM_PAINT:
|
||||
OnPaint(hWnd);
|
||||
return 0;
|
||||
case WM_SETCURSOR:
|
||||
if (LOWORD(lParam) == HTCLIENT) {
|
||||
POINT pt;
|
||||
GetCursorPos(&pt);
|
||||
ScreenToClient(hWnd, &pt);
|
||||
if (pt.x>=pChildWnd->nSplitPos-SPLIT_WIDTH/2 && pt.x<pChildWnd->nSplitPos+SPLIT_WIDTH/2+1) {
|
||||
SetCursor(LoadCursor(0, IDC_SIZEWE));
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
goto def;
|
||||
case WM_SETCURSOR:
|
||||
if (LOWORD(lParam) == HTCLIENT) {
|
||||
POINT pt;
|
||||
GetCursorPos(&pt);
|
||||
ScreenToClient(hWnd, &pt);
|
||||
if (pt.x>=pChildWnd->nSplitPos-SPLIT_WIDTH/2 && pt.x<pChildWnd->nSplitPos+SPLIT_WIDTH/2+1) {
|
||||
SetCursor(LoadCursor(0, IDC_SIZEWE));
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
goto def;
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
case WM_LBUTTONDOWN: {
|
||||
RECT rt;
|
||||
int x = LOWORD(lParam);
|
||||
GetClientRect(hWnd, &rt);
|
||||
if (x>=pChildWnd->nSplitPos-SPLIT_WIDTH/2 && x<pChildWnd->nSplitPos+SPLIT_WIDTH/2+1) {
|
||||
last_split = pChildWnd->nSplitPos;
|
||||
draw_splitbar(hWnd, last_split);
|
||||
SetCapture(hWnd);
|
||||
}
|
||||
break;}
|
||||
case WM_LBUTTONDOWN: {
|
||||
RECT rt;
|
||||
int x = LOWORD(lParam);
|
||||
GetClientRect(hWnd, &rt);
|
||||
if (x>=pChildWnd->nSplitPos-SPLIT_WIDTH/2 && x<pChildWnd->nSplitPos+SPLIT_WIDTH/2+1) {
|
||||
last_split = pChildWnd->nSplitPos;
|
||||
draw_splitbar(hWnd, last_split);
|
||||
SetCapture(hWnd);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_LBUTTONUP:
|
||||
if (GetCapture() == hWnd) {
|
||||
RECT rt;
|
||||
int x = LOWORD(lParam);
|
||||
draw_splitbar(hWnd, last_split);
|
||||
last_split = -1;
|
||||
GetClientRect(hWnd, &rt);
|
||||
pChildWnd->nSplitPos = x;
|
||||
ResizeWnd(pChildWnd, rt.right, rt.bottom);
|
||||
ReleaseCapture();
|
||||
}
|
||||
break;
|
||||
case WM_LBUTTONUP:
|
||||
if (GetCapture() == hWnd) {
|
||||
RECT rt;
|
||||
int x = LOWORD(lParam);
|
||||
draw_splitbar(hWnd, last_split);
|
||||
last_split = -1;
|
||||
GetClientRect(hWnd, &rt);
|
||||
pChildWnd->nSplitPos = x;
|
||||
ResizeWnd(pChildWnd, rt.right, rt.bottom);
|
||||
ReleaseCapture();
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_CAPTURECHANGED:
|
||||
if (GetCapture()==hWnd && last_split>=0)
|
||||
draw_splitbar(hWnd, last_split);
|
||||
break;
|
||||
case WM_CAPTURECHANGED:
|
||||
if (GetCapture()==hWnd && last_split>=0)
|
||||
draw_splitbar(hWnd, last_split);
|
||||
break;
|
||||
|
||||
case WM_KEYDOWN:
|
||||
if (wParam == VK_ESCAPE)
|
||||
if (GetCapture() == hWnd) {
|
||||
RECT rt;
|
||||
draw_splitbar(hWnd, last_split);
|
||||
GetClientRect(hWnd, &rt);
|
||||
if (wParam == VK_ESCAPE)
|
||||
if (GetCapture() == hWnd) {
|
||||
RECT rt;
|
||||
draw_splitbar(hWnd, last_split);
|
||||
GetClientRect(hWnd, &rt);
|
||||
ResizeWnd(pChildWnd, rt.right, rt.bottom);
|
||||
last_split = -1;
|
||||
ReleaseCapture();
|
||||
SetCursor(LoadCursor(0, IDC_ARROW));
|
||||
}
|
||||
break;
|
||||
last_split = -1;
|
||||
ReleaseCapture();
|
||||
SetCursor(LoadCursor(0, IDC_ARROW));
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_MOUSEMOVE:
|
||||
if (GetCapture() == hWnd) {
|
||||
RECT rt;
|
||||
int x = LOWORD(lParam);
|
||||
HDC hdc = GetDC(hWnd);
|
||||
GetClientRect(hWnd, &rt);
|
||||
rt.left = last_split-SPLIT_WIDTH/2;
|
||||
rt.right = last_split+SPLIT_WIDTH/2+1;
|
||||
InvertRect(hdc, &rt);
|
||||
last_split = x;
|
||||
rt.left = x-SPLIT_WIDTH/2;
|
||||
rt.right = x+SPLIT_WIDTH/2+1;
|
||||
InvertRect(hdc, &rt);
|
||||
ReleaseDC(hWnd, hdc);
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_SETFOCUS:
|
||||
if (pChildWnd != NULL) {
|
||||
SetFocus(pChildWnd->nFocusPanel? pChildWnd->hListWnd: pChildWnd->hTreeWnd);
|
||||
case WM_MOUSEMOVE:
|
||||
if (GetCapture() == hWnd) {
|
||||
RECT rt;
|
||||
int x = LOWORD(lParam);
|
||||
HDC hdc = GetDC(hWnd);
|
||||
GetClientRect(hWnd, &rt);
|
||||
rt.left = last_split-SPLIT_WIDTH/2;
|
||||
rt.right = last_split+SPLIT_WIDTH/2+1;
|
||||
InvertRect(hdc, &rt);
|
||||
last_split = x;
|
||||
rt.left = x-SPLIT_WIDTH/2;
|
||||
rt.right = x+SPLIT_WIDTH/2+1;
|
||||
InvertRect(hdc, &rt);
|
||||
ReleaseDC(hWnd, hdc);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case WM_SETFOCUS:
|
||||
if (pChildWnd != NULL) {
|
||||
SetFocus(pChildWnd->nFocusPanel? pChildWnd->hListWnd: pChildWnd->hTreeWnd);
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_TIMER:
|
||||
break;
|
||||
|
||||
case WM_NOTIFY:
|
||||
case WM_NOTIFY:
|
||||
if ((int)wParam == TREE_WINDOW) {
|
||||
switch (((LPNMHDR)lParam)->code) {
|
||||
case TVN_ITEMEXPANDING:
|
||||
return !OnTreeExpanding(pChildWnd->hTreeWnd, (NMTREEVIEW*)lParam);
|
||||
case TVN_SELCHANGED:
|
||||
{
|
||||
case TVN_SELCHANGED: {
|
||||
HKEY hKey;
|
||||
TCHAR keyPath[1000];
|
||||
int keyPathLen = 0;
|
||||
@ -251,20 +251,20 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||
goto def;
|
||||
}
|
||||
} else
|
||||
if ((int)wParam == LIST_WINDOW) {
|
||||
if (!SendMessage(pChildWnd->hListWnd, message, wParam, lParam)) {
|
||||
goto def;
|
||||
if ((int)wParam == LIST_WINDOW) {
|
||||
if (!SendMessage(pChildWnd->hListWnd, message, wParam, lParam)) {
|
||||
goto def;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_SIZE:
|
||||
case WM_SIZE:
|
||||
if (wParam != SIZE_MINIMIZED && pChildWnd != NULL) {
|
||||
ResizeWnd(pChildWnd, LOWORD(lParam), HIWORD(lParam));
|
||||
ResizeWnd(pChildWnd, LOWORD(lParam), HIWORD(lParam));
|
||||
}
|
||||
/* fall through */
|
||||
default: def:
|
||||
default: def:
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -47,10 +47,10 @@ void error(HWND hwnd, INT resId, ...)
|
||||
hInstance = GetModuleHandle(0);
|
||||
|
||||
if (!LoadString(hInstance, IDS_ERROR, title, COUNT_OF(title)))
|
||||
lstrcpy(title, "Error");
|
||||
lstrcpy(title, "Error");
|
||||
|
||||
if (!LoadString(hInstance, resId, errfmt, COUNT_OF(errfmt)))
|
||||
lstrcpy(errfmt, "Unknown error string!");
|
||||
lstrcpy(errfmt, "Unknown error string!");
|
||||
|
||||
va_start(ap, resId);
|
||||
_vsntprintf(errstr, COUNT_OF(errstr), errfmt, ap);
|
||||
@ -66,27 +66,27 @@ INT_PTR CALLBACK modify_string_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
|
||||
int len;
|
||||
|
||||
switch(uMsg) {
|
||||
case WM_INITDIALOG:
|
||||
SetDlgItemText(hwndDlg, IDC_VALUE_NAME, editValueName);
|
||||
SetDlgItemText(hwndDlg, IDC_VALUE_DATA, stringValueData);
|
||||
return TRUE;
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam)) {
|
||||
case IDOK:
|
||||
if ((hwndValue = GetDlgItem(hwndDlg, IDC_VALUE_DATA))) {
|
||||
if ((len = GetWindowTextLength(hwndValue))) {
|
||||
if ((valueData = HeapReAlloc(GetProcessHeap(), 0, stringValueData, (len + 1) * sizeof(TCHAR)))) {
|
||||
stringValueData = valueData;
|
||||
if (!GetWindowText(hwndValue, stringValueData, len + 1))
|
||||
*stringValueData = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Fall through */
|
||||
case IDCANCEL:
|
||||
EndDialog(hwndDlg, wParam);
|
||||
return TRUE;
|
||||
}
|
||||
case WM_INITDIALOG:
|
||||
SetDlgItemText(hwndDlg, IDC_VALUE_NAME, editValueName);
|
||||
SetDlgItemText(hwndDlg, IDC_VALUE_DATA, stringValueData);
|
||||
return TRUE;
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam)) {
|
||||
case IDOK:
|
||||
if ((hwndValue = GetDlgItem(hwndDlg, IDC_VALUE_DATA))) {
|
||||
if ((len = GetWindowTextLength(hwndValue))) {
|
||||
if ((valueData = HeapReAlloc(GetProcessHeap(), 0, stringValueData, (len + 1) * sizeof(TCHAR)))) {
|
||||
stringValueData = valueData;
|
||||
if (!GetWindowText(hwndValue, stringValueData, len + 1))
|
||||
*stringValueData = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Fall through */
|
||||
case IDCANCEL:
|
||||
EndDialog(hwndDlg, wParam);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
@ -104,28 +104,28 @@ BOOL ModifyValue(HWND hwnd, HKEY hKey, LPTSTR valueName)
|
||||
|
||||
lRet = RegQueryValueEx(hKey, valueName, 0, &type, 0, &valueDataLen);
|
||||
if (lRet != ERROR_SUCCESS) {
|
||||
error(hwnd, IDS_BAD_VALUE, valueName);
|
||||
goto done;
|
||||
error(hwnd, IDS_BAD_VALUE, valueName);
|
||||
goto done;
|
||||
}
|
||||
|
||||
if ( (type == REG_SZ) || (type == REG_EXPAND_SZ) ) {
|
||||
if (!(stringValueData = HeapAlloc(GetProcessHeap(), 0, valueDataLen))) {
|
||||
error(hwnd, IDS_TOO_BIG_VALUE, valueDataLen);
|
||||
goto done;
|
||||
}
|
||||
if (!(stringValueData = HeapAlloc(GetProcessHeap(), 0, valueDataLen))) {
|
||||
error(hwnd, IDS_TOO_BIG_VALUE, valueDataLen);
|
||||
goto done;
|
||||
}
|
||||
lRet = RegQueryValueEx(hKey, valueName, 0, 0, stringValueData, &valueDataLen);
|
||||
if (lRet != ERROR_SUCCESS) {
|
||||
error(hwnd, IDS_BAD_VALUE, valueName);
|
||||
goto done;
|
||||
}
|
||||
if (DialogBox(0, MAKEINTRESOURCE(IDD_EDIT_STRING), hwnd, modify_string_dlgproc) == IDOK) {
|
||||
lRet = RegSetValueEx(hKey, valueName, 0, type, stringValueData, lstrlen(stringValueData) + 1);
|
||||
if (lRet == ERROR_SUCCESS) result = TRUE;
|
||||
}
|
||||
if (lRet != ERROR_SUCCESS) {
|
||||
error(hwnd, IDS_BAD_VALUE, valueName);
|
||||
goto done;
|
||||
}
|
||||
if (DialogBox(0, MAKEINTRESOURCE(IDD_EDIT_STRING), hwnd, modify_string_dlgproc) == IDOK) {
|
||||
lRet = RegSetValueEx(hKey, valueName, 0, type, stringValueData, lstrlen(stringValueData) + 1);
|
||||
if (lRet == ERROR_SUCCESS) result = TRUE;
|
||||
}
|
||||
} else if ( type == REG_DWORD ) {
|
||||
MessageBox(hwnd, "Can't edit dwords for now", "Error", MB_OK | MB_ICONERROR);
|
||||
MessageBox(hwnd, "Can't edit dwords for now", "Error", MB_OK | MB_ICONERROR);
|
||||
} else {
|
||||
error(hwnd, IDS_UNSUPPORTED_TYPE, type);
|
||||
error(hwnd, IDS_UNSUPPORTED_TYPE, type);
|
||||
}
|
||||
|
||||
done:
|
||||
|
@ -46,29 +46,29 @@ static HWND hChildWnd;
|
||||
|
||||
static void resize_frame_rect(HWND hWnd, PRECT prect)
|
||||
{
|
||||
RECT rt;
|
||||
/*
|
||||
if (IsWindowVisible(hToolBar)) {
|
||||
SendMessage(hToolBar, WM_SIZE, 0, 0);
|
||||
GetClientRect(hToolBar, &rt);
|
||||
prect->top = rt.bottom+3;
|
||||
prect->bottom -= rt.bottom+3;
|
||||
}
|
||||
*/
|
||||
if (IsWindowVisible(hStatusBar)) {
|
||||
SetupStatusBar(hWnd, TRUE);
|
||||
GetClientRect(hStatusBar, &rt);
|
||||
prect->bottom -= rt.bottom;
|
||||
}
|
||||
RECT rt;
|
||||
/*
|
||||
if (IsWindowVisible(hToolBar)) {
|
||||
SendMessage(hToolBar, WM_SIZE, 0, 0);
|
||||
GetClientRect(hToolBar, &rt);
|
||||
prect->top = rt.bottom+3;
|
||||
prect->bottom -= rt.bottom+3;
|
||||
}
|
||||
*/
|
||||
if (IsWindowVisible(hStatusBar)) {
|
||||
SetupStatusBar(hWnd, TRUE);
|
||||
GetClientRect(hStatusBar, &rt);
|
||||
prect->bottom -= rt.bottom;
|
||||
}
|
||||
MoveWindow(hChildWnd, prect->left, prect->top, prect->right, prect->bottom, TRUE);
|
||||
}
|
||||
|
||||
void resize_frame_client(HWND hWnd)
|
||||
{
|
||||
RECT rect;
|
||||
RECT rect;
|
||||
|
||||
GetClientRect(hWnd, &rect);
|
||||
resize_frame_rect(hWnd, &rect);
|
||||
GetClientRect(hWnd, &rect);
|
||||
resize_frame_rect(hWnd, &rect);
|
||||
}
|
||||
|
||||
/********************************************************************************/
|
||||
@ -88,8 +88,8 @@ static void OnExitMenuLoop(HWND hWnd)
|
||||
{
|
||||
bInMenuLoop = FALSE;
|
||||
/* Update the status bar pane sizes*/
|
||||
SetupStatusBar(hWnd, TRUE);
|
||||
UpdateStatusBar();
|
||||
SetupStatusBar(hWnd, TRUE);
|
||||
UpdateStatusBar();
|
||||
}
|
||||
|
||||
static void OnMenuSelect(HWND hWnd, UINT nItemID, UINT nFlags, HMENU hSysMenu)
|
||||
@ -119,70 +119,70 @@ void SetupStatusBar(HWND hWnd, BOOL bResize)
|
||||
int nParts;
|
||||
GetClientRect(hWnd, &rc);
|
||||
nParts = rc.right;
|
||||
/* nParts = -1;*/
|
||||
if (bResize)
|
||||
SendMessage(hStatusBar, WM_SIZE, 0, 0);
|
||||
SendMessage(hStatusBar, SB_SETPARTS, 1, (LPARAM)&nParts);
|
||||
/* nParts = -1;*/
|
||||
if (bResize)
|
||||
SendMessage(hStatusBar, WM_SIZE, 0, 0);
|
||||
SendMessage(hStatusBar, SB_SETPARTS, 1, (LPARAM)&nParts);
|
||||
}
|
||||
|
||||
void UpdateStatusBar(void)
|
||||
{
|
||||
TCHAR text[260];
|
||||
DWORD size;
|
||||
DWORD size;
|
||||
|
||||
size = sizeof(text)/sizeof(TCHAR);
|
||||
GetComputerName(text, &size);
|
||||
size = sizeof(text)/sizeof(TCHAR);
|
||||
GetComputerName(text, &size);
|
||||
SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)text);
|
||||
}
|
||||
|
||||
static void toggle_child(HWND hWnd, UINT cmd, HWND hchild)
|
||||
{
|
||||
BOOL vis = IsWindowVisible(hchild);
|
||||
HMENU hMenuView = GetSubMenu(hMenuFrame, ID_VIEW_MENU);
|
||||
BOOL vis = IsWindowVisible(hchild);
|
||||
HMENU hMenuView = GetSubMenu(hMenuFrame, ID_VIEW_MENU);
|
||||
|
||||
CheckMenuItem(hMenuView, cmd, vis?MF_BYCOMMAND:MF_BYCOMMAND|MF_CHECKED);
|
||||
ShowWindow(hchild, vis?SW_HIDE:SW_SHOW);
|
||||
resize_frame_client(hWnd);
|
||||
CheckMenuItem(hMenuView, cmd, vis?MF_BYCOMMAND:MF_BYCOMMAND|MF_CHECKED);
|
||||
ShowWindow(hchild, vis?SW_HIDE:SW_SHOW);
|
||||
resize_frame_client(hWnd);
|
||||
}
|
||||
|
||||
static BOOL CheckCommDlgError(HWND hWnd)
|
||||
{
|
||||
DWORD dwErrorCode = CommDlgExtendedError();
|
||||
switch (dwErrorCode) {
|
||||
case CDERR_DIALOGFAILURE:
|
||||
break;
|
||||
case CDERR_FINDRESFAILURE:
|
||||
break;
|
||||
case CDERR_NOHINSTANCE:
|
||||
break;
|
||||
case CDERR_INITIALIZATION:
|
||||
break;
|
||||
case CDERR_NOHOOK:
|
||||
break;
|
||||
case CDERR_LOCKRESFAILURE:
|
||||
break;
|
||||
case CDERR_NOTEMPLATE:
|
||||
break;
|
||||
case CDERR_LOADRESFAILURE:
|
||||
break;
|
||||
case CDERR_STRUCTSIZE:
|
||||
break;
|
||||
case CDERR_LOADSTRFAILURE:
|
||||
break;
|
||||
case FNERR_BUFFERTOOSMALL:
|
||||
break;
|
||||
case CDERR_MEMALLOCFAILURE:
|
||||
break;
|
||||
case FNERR_INVALIDFILENAME:
|
||||
break;
|
||||
case CDERR_MEMLOCKFAILURE:
|
||||
break;
|
||||
case FNERR_SUBCLASSFAILURE:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
DWORD dwErrorCode = CommDlgExtendedError();
|
||||
switch (dwErrorCode) {
|
||||
case CDERR_DIALOGFAILURE:
|
||||
break;
|
||||
case CDERR_FINDRESFAILURE:
|
||||
break;
|
||||
case CDERR_NOHINSTANCE:
|
||||
break;
|
||||
case CDERR_INITIALIZATION:
|
||||
break;
|
||||
case CDERR_NOHOOK:
|
||||
break;
|
||||
case CDERR_LOCKRESFAILURE:
|
||||
break;
|
||||
case CDERR_NOTEMPLATE:
|
||||
break;
|
||||
case CDERR_LOADRESFAILURE:
|
||||
break;
|
||||
case CDERR_STRUCTSIZE:
|
||||
break;
|
||||
case CDERR_LOADSTRFAILURE:
|
||||
break;
|
||||
case FNERR_BUFFERTOOSMALL:
|
||||
break;
|
||||
case CDERR_MEMALLOCFAILURE:
|
||||
break;
|
||||
case FNERR_INVALIDFILENAME:
|
||||
break;
|
||||
case CDERR_MEMLOCKFAILURE:
|
||||
break;
|
||||
case FNERR_SUBCLASSFAILURE:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
UINT_PTR CALLBACK ImportRegistryFile_OFNHookProc(HWND hdlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
|
||||
@ -196,8 +196,7 @@ UINT_PTR CALLBACK ImportRegistryFile_OFNHookProc(HWND hdlg, UINT uiMsg, WPARAM w
|
||||
break;
|
||||
case WM_NOTIFY:
|
||||
pOfNotify = (OFNOTIFY*)lParam;
|
||||
if (pOfNotify->hdr.code == CDN_INITDONE) {
|
||||
}
|
||||
if (pOfNotify->hdr.code == CDN_INITDONE) {}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -225,19 +224,19 @@ static BOOL InitOpenFileName(HWND hWnd, OPENFILENAME* pofn)
|
||||
pofn->nMaxFile = _MAX_PATH;
|
||||
pofn->lpstrFileTitle = FileTitleBuffer;
|
||||
pofn->nMaxFileTitle = _MAX_PATH;
|
||||
/* pofn->lpstrInitialDir = _T("");*/
|
||||
/* pofn->lpstrTitle = _T("Import Registry File");*/
|
||||
/* pofn->Flags = OFN_ENABLETEMPLATE + OFN_EXPLORER + OFN_ENABLESIZING;*/
|
||||
/* pofn->lpstrInitialDir = _T("");*/
|
||||
/* pofn->lpstrTitle = _T("Import Registry File");*/
|
||||
/* pofn->Flags = OFN_ENABLETEMPLATE + OFN_EXPLORER + OFN_ENABLESIZING;*/
|
||||
pofn->Flags = OFN_HIDEREADONLY;
|
||||
/* pofn->nFileOffset = ;*/
|
||||
/* pofn->nFileExtension = ;*/
|
||||
/* pofn->lpstrDefExt = _T("");*/
|
||||
/* pofn->lCustData = ;*/
|
||||
/* pofn->lpfnHook = ImportRegistryFile_OFNHookProc;*/
|
||||
/* pofn->lpTemplateName = _T("ID_DLG_IMPORT_REGFILE");*/
|
||||
/* pofn->lpTemplateName = MAKEINTRESOURCE(IDD_DIALOG1);*/
|
||||
/* pofn->FlagsEx = ;*/
|
||||
return TRUE;
|
||||
/* pofn->nFileOffset = ;*/
|
||||
/* pofn->nFileExtension = ;*/
|
||||
/* pofn->lpstrDefExt = _T("");*/
|
||||
/* pofn->lCustData = ;*/
|
||||
/* pofn->lpfnHook = ImportRegistryFile_OFNHookProc;*/
|
||||
/* pofn->lpTemplateName = _T("ID_DLG_IMPORT_REGFILE");*/
|
||||
/* pofn->lpTemplateName = MAKEINTRESOURCE(IDD_DIALOG1);*/
|
||||
/* pofn->FlagsEx = ;*/
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL ImportRegistryFile(HWND hWnd)
|
||||
@ -246,7 +245,7 @@ static BOOL ImportRegistryFile(HWND hWnd)
|
||||
|
||||
InitOpenFileName(hWnd, &ofn);
|
||||
ofn.lpstrTitle = _T("Import Registry File");
|
||||
/* ofn.lCustData = ;*/
|
||||
/* ofn.lCustData = ;*/
|
||||
if (GetOpenFileName(&ofn)) {
|
||||
if (!import_registry_file(ofn.lpstrFile)) {
|
||||
/*printf("Can't open file \"%s\"\n", ofn.lpstrFile);*/
|
||||
@ -269,10 +268,11 @@ static BOOL ImportRegistryFile(HWND hWnd)
|
||||
get_file_name(&s, filename, MAX_PATH);
|
||||
}
|
||||
#endif
|
||||
|
||||
} else {
|
||||
CheckCommDlgError(hWnd);
|
||||
}
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@ -284,7 +284,7 @@ static BOOL ExportRegistryFile(HWND hWnd)
|
||||
ExportKeyPath[0] = _T('\0');
|
||||
InitOpenFileName(hWnd, &ofn);
|
||||
ofn.lpstrTitle = _T("Export Registry File");
|
||||
/* ofn.lCustData = ;*/
|
||||
/* ofn.lCustData = ;*/
|
||||
ofn.Flags = OFN_ENABLETEMPLATE + OFN_EXPLORER;
|
||||
ofn.lpfnHook = ImportRegistryFile_OFNHookProc;
|
||||
ofn.lpTemplateName = MAKEINTRESOURCE(IDD_DIALOG1);
|
||||
@ -314,10 +314,11 @@ static BOOL ExportRegistryFile(HWND hWnd)
|
||||
export_registry_key(filename, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
} else {
|
||||
CheckCommDlgError(hWnd);
|
||||
}
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL PrintRegistryHive(HWND hWnd, LPTSTR path)
|
||||
@ -449,8 +450,8 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
item = ListView_GetNextItem(pChildWnd->hListWnd, -1, LVNI_FOCUSED);
|
||||
if (item != -1) ListView_GetItemText(pChildWnd->hListWnd, item, 0, valueName, sizeof(valueName)/sizeof(TCHAR));
|
||||
|
||||
switch (LOWORD(wParam)) {
|
||||
/* Parse the menu selections:*/
|
||||
switch (LOWORD(wParam)) {
|
||||
/* Parse the menu selections:*/
|
||||
case ID_REGISTRY_IMPORTREGISTRYFILE:
|
||||
ImportRegistryFile(hWnd);
|
||||
break;
|
||||
@ -465,9 +466,9 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
PrintRegistryHive(hWnd, _T(""));
|
||||
break;
|
||||
case ID_EDIT_MODIFY:
|
||||
if (ModifyValue(hWnd, hKey, valueName))
|
||||
RefreshListView(pChildWnd->hListWnd, hKeyRoot, keyPath);
|
||||
break;
|
||||
if (ModifyValue(hWnd, hKey, valueName))
|
||||
RefreshListView(pChildWnd->hListWnd, hKeyRoot, keyPath);
|
||||
break;
|
||||
case ID_EDIT_COPYKEYNAME:
|
||||
CopyKeyName(hWnd, _T(""));
|
||||
break;
|
||||
@ -485,27 +486,27 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
case ID_VIEW_REFRESH:
|
||||
RefreshView(hWnd);
|
||||
break;
|
||||
/* case ID_OPTIONS_TOOLBAR:*/
|
||||
/* toggle_child(hWnd, LOWORD(wParam), hToolBar);*/
|
||||
/* break;*/
|
||||
case ID_VIEW_STATUSBAR:
|
||||
toggle_child(hWnd, LOWORD(wParam), hStatusBar);
|
||||
/* case ID_OPTIONS_TOOLBAR:*/
|
||||
/* toggle_child(hWnd, LOWORD(wParam), hToolBar);*/
|
||||
/* break;*/
|
||||
case ID_VIEW_STATUSBAR:
|
||||
toggle_child(hWnd, LOWORD(wParam), hStatusBar);
|
||||
break;
|
||||
case ID_HELP_HELPTOPICS:
|
||||
/* WinHelp(hWnd, _T("regedit"), HELP_CONTENTS, 0);*/
|
||||
WinHelp(hWnd, _T("regedit"), HELP_FINDER, 0);
|
||||
/* WinHelp(hWnd, _T("regedit"), HELP_CONTENTS, 0);*/
|
||||
WinHelp(hWnd, _T("regedit"), HELP_FINDER, 0);
|
||||
break;
|
||||
case ID_HELP_ABOUT:
|
||||
#ifdef WINSHELLAPI
|
||||
/* ShellAbout(hWnd, szTitle, _T(""), LoadIcon(hInst, (LPCTSTR)IDI_REGEDIT));*/
|
||||
/* ShellAbout(hWnd, szTitle, _T(""), LoadIcon(hInst, (LPCTSTR)IDI_REGEDIT));*/
|
||||
#else
|
||||
ShowAboutBox(hWnd);
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
result = FALSE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
RegCloseKey(hKey);
|
||||
return result;
|
||||
}
|
||||
@ -526,15 +527,14 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||
static ChildWnd* pChildWnd = NULL;
|
||||
|
||||
switch (message) {
|
||||
case WM_CREATE:
|
||||
{
|
||||
pChildWnd = HeapAlloc(GetProcessHeap(), 0, sizeof(ChildWnd));
|
||||
_tcsncpy(pChildWnd->szPath, _T("My Computer"), MAX_PATH);
|
||||
hChildWnd = CreateWindowEx(0, szChildClass, _T("regedit child window"),
|
||||
/* WS_CHILD|WS_CLIPCHILDREN|WS_VISIBLE|WS_BORDER,*/
|
||||
WS_CHILD|WS_VISIBLE,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
|
||||
hWnd, (HMENU)0, hInst, pChildWnd);
|
||||
case WM_CREATE: {
|
||||
pChildWnd = HeapAlloc(GetProcessHeap(), 0, sizeof(ChildWnd));
|
||||
_tcsncpy(pChildWnd->szPath, _T("My Computer"), MAX_PATH);
|
||||
hChildWnd = CreateWindowEx(0, szChildClass, _T("regedit child window"),
|
||||
/* WS_CHILD|WS_CLIPCHILDREN|WS_VISIBLE|WS_BORDER,*/
|
||||
WS_CHILD|WS_VISIBLE,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
|
||||
hWnd, (HMENU)0, hInst, pChildWnd);
|
||||
}
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
@ -565,6 +565,6 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||
PostQuitMessage(0);
|
||||
default:
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -61,30 +61,28 @@ static void AddEntryToList(HWND hwndLV, LPTSTR Name, DWORD dwValType, void* ValB
|
||||
item.pszText = LPSTR_TEXTCALLBACK;
|
||||
item.iImage = 0;
|
||||
item.lParam = (LPARAM)dwValType;
|
||||
/* item.lParam = (LPARAM)ValBuf; */
|
||||
/* item.lParam = (LPARAM)ValBuf; */
|
||||
#if (_WIN32_IE >= 0x0300)
|
||||
item.iIndent = 0;
|
||||
#endif
|
||||
|
||||
index = ListView_InsertItem(hwndLV, &item);
|
||||
if (index != -1) {
|
||||
/* LPTSTR pszText = NULL; */
|
||||
/* LPTSTR pszText = NULL; */
|
||||
LPTSTR pszText = _T("value");
|
||||
switch (dwValType) {
|
||||
case REG_SZ:
|
||||
case REG_EXPAND_SZ:
|
||||
ListView_SetItemText(hwndLV, index, 2, ValBuf);
|
||||
break;
|
||||
case REG_DWORD:
|
||||
{
|
||||
case REG_DWORD: {
|
||||
TCHAR buf[64];
|
||||
wsprintf(buf, _T("0x%08X (%d)"), *(DWORD*)ValBuf, *(DWORD*)ValBuf);
|
||||
ListView_SetItemText(hwndLV, index, 2, buf);
|
||||
}
|
||||
/* lpsRes = convertHexToDWORDStr(lpbData, dwLen); */
|
||||
/* lpsRes = convertHexToDWORDStr(lpbData, dwLen); */
|
||||
break;
|
||||
case REG_BINARY:
|
||||
{
|
||||
case REG_BINARY: {
|
||||
unsigned int i;
|
||||
LPBYTE pData = (LPBYTE)ValBuf;
|
||||
LPTSTR strBinary = HeapAlloc(GetProcessHeap(), 0, dwCount * sizeof(TCHAR) * 3 + 1);
|
||||
@ -96,7 +94,7 @@ static void AddEntryToList(HWND hwndLV, LPTSTR Name, DWORD dwValType, void* ValB
|
||||
}
|
||||
break;
|
||||
default:
|
||||
/* lpsRes = convertHexToHexCSV(lpbData, dwLen); */
|
||||
/* lpsRes = convertHexToHexCSV(lpbData, dwLen); */
|
||||
ListView_SetItemText(hwndLV, index, 2, pszText);
|
||||
break;
|
||||
}
|
||||
@ -153,9 +151,9 @@ static void OnGetDispInfo(NMLVDISPINFO* plvdi)
|
||||
case REG_DWORD:
|
||||
plvdi->item.pszText = _T("REG_DWORD");
|
||||
break;
|
||||
/* case REG_DWORD_LITTLE_ENDIAN: */
|
||||
/* plvdi->item.pszText = _T("REG_DWORD_LITTLE_ENDIAN"); */
|
||||
/* break; */
|
||||
/* case REG_DWORD_LITTLE_ENDIAN: */
|
||||
/* plvdi->item.pszText = _T("REG_DWORD_LITTLE_ENDIAN"); */
|
||||
/* break; */
|
||||
case REG_DWORD_BIG_ENDIAN:
|
||||
plvdi->item.pszText = _T("REG_DWORD_BIG_ENDIAN");
|
||||
break;
|
||||
@ -199,97 +197,93 @@ static int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSor
|
||||
#endif
|
||||
|
||||
static void ListViewPopUpMenu(HWND hWnd, POINT pt)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (LOWORD(wParam)) {
|
||||
/* case ID_FILE_OPEN: */
|
||||
/* break; */
|
||||
default:
|
||||
switch (LOWORD(wParam)) {
|
||||
/* case ID_FILE_OPEN: */
|
||||
/* break; */
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (message) {
|
||||
case WM_COMMAND:
|
||||
switch (message) {
|
||||
case WM_COMMAND:
|
||||
if (!_CmdWndProc(hWnd, message, wParam, lParam)) {
|
||||
return CallWindowProc(g_orgListWndProc, hWnd, message, wParam, lParam);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case WM_NOTIFY:
|
||||
switch (((LPNMHDR)lParam)->code) {
|
||||
case LVN_GETDISPINFO:
|
||||
OnGetDispInfo((NMLVDISPINFO*)lParam);
|
||||
break;
|
||||
case NM_DBLCLK:
|
||||
{
|
||||
NMITEMACTIVATE* nmitem = (LPNMITEMACTIVATE)lParam;
|
||||
LVHITTESTINFO info;
|
||||
case NM_DBLCLK: {
|
||||
NMITEMACTIVATE* nmitem = (LPNMITEMACTIVATE)lParam;
|
||||
LVHITTESTINFO info;
|
||||
|
||||
if (nmitem->hdr.hwndFrom != hWnd) break;
|
||||
/* if (nmitem->hdr.idFrom != IDW_LISTVIEW) break; */
|
||||
/* if (nmitem->hdr.code != ???) break; */
|
||||
if (nmitem->hdr.hwndFrom != hWnd) break;
|
||||
/* if (nmitem->hdr.idFrom != IDW_LISTVIEW) break; */
|
||||
/* if (nmitem->hdr.code != ???) break; */
|
||||
#ifdef _MSC_VER
|
||||
switch (nmitem->uKeyFlags) {
|
||||
case LVKF_ALT: /* The ALT key is pressed. */
|
||||
/* properties dialog box ? */
|
||||
break;
|
||||
case LVKF_CONTROL: /* The CTRL key is pressed. */
|
||||
/* run dialog box for providing parameters... */
|
||||
break;
|
||||
case LVKF_SHIFT: /* The SHIFT key is pressed. */
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
info.pt.x = nmitem->ptAction.x;
|
||||
info.pt.y = nmitem->ptAction.y;
|
||||
if (ListView_HitTest(hWnd, &info) != -1) {
|
||||
LVITEM item;
|
||||
item.mask = LVIF_PARAM;
|
||||
item.iItem = info.iItem;
|
||||
if (ListView_GetItem(hWnd, &item)) {
|
||||
switch (nmitem->uKeyFlags) {
|
||||
case LVKF_ALT: /* The ALT key is pressed. */
|
||||
/* properties dialog box ? */
|
||||
break;
|
||||
case LVKF_CONTROL: /* The CTRL key is pressed. */
|
||||
/* run dialog box for providing parameters... */
|
||||
break;
|
||||
case LVKF_SHIFT: /* The SHIFT key is pressed. */
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
info.pt.x = nmitem->ptAction.x;
|
||||
info.pt.y = nmitem->ptAction.y;
|
||||
if (ListView_HitTest(hWnd, &info) != -1) {
|
||||
LVITEM item;
|
||||
item.mask = LVIF_PARAM;
|
||||
item.iItem = info.iItem;
|
||||
if (ListView_GetItem(hWnd, &item)) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case NM_RCLICK:
|
||||
{
|
||||
int idx;
|
||||
LV_HITTESTINFO lvH;
|
||||
NM_LISTVIEW* pNm = (NM_LISTVIEW*)lParam;
|
||||
lvH.pt.x = pNm->ptAction.x;
|
||||
lvH.pt.y = pNm->ptAction.y;
|
||||
idx = ListView_HitTest(hWnd, &lvH);
|
||||
if (idx != -1) {
|
||||
POINT pt;
|
||||
GetCursorPos(&pt);
|
||||
ListViewPopUpMenu(hWnd, pt);
|
||||
return idx;
|
||||
}
|
||||
case NM_RCLICK: {
|
||||
int idx;
|
||||
LV_HITTESTINFO lvH;
|
||||
NM_LISTVIEW* pNm = (NM_LISTVIEW*)lParam;
|
||||
lvH.pt.x = pNm->ptAction.x;
|
||||
lvH.pt.y = pNm->ptAction.y;
|
||||
idx = ListView_HitTest(hWnd, &lvH);
|
||||
if (idx != -1) {
|
||||
POINT pt;
|
||||
GetCursorPos(&pt);
|
||||
ListViewPopUpMenu(hWnd, pt);
|
||||
return idx;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return CallWindowProc(g_orgListWndProc, hWnd, message, wParam, lParam);
|
||||
}
|
||||
break;
|
||||
case WM_KEYDOWN:
|
||||
if (wParam == VK_TAB) {
|
||||
/*TODO: SetFocus(Globals.hDriveBar) */
|
||||
/*SetFocus(child->nFocusPanel? child->left.hWnd: child->right.hWnd); */
|
||||
}
|
||||
break;
|
||||
case WM_KEYDOWN:
|
||||
if (wParam == VK_TAB) {
|
||||
/*TODO: SetFocus(Globals.hDriveBar) */
|
||||
/*SetFocus(child->nFocusPanel? child->left.hWnd: child->right.hWnd); */
|
||||
}
|
||||
/* fall thru... */
|
||||
default:
|
||||
return CallWindowProc(g_orgListWndProc, hWnd, message, wParam, lParam);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -301,21 +295,21 @@ HWND CreateListView(HWND hwndParent, int id)
|
||||
/* Get the dimensions of the parent window's client area, and create the list view control. */
|
||||
GetClientRect(hwndParent, &rcClient);
|
||||
hwndLV = CreateWindowEx(WS_EX_CLIENTEDGE, WC_LISTVIEW, _T("List View"),
|
||||
WS_VISIBLE | WS_CHILD | LVS_REPORT,
|
||||
0, 0, rcClient.right, rcClient.bottom,
|
||||
hwndParent, (HMENU)id, hInst, NULL);
|
||||
WS_VISIBLE | WS_CHILD | LVS_REPORT,
|
||||
0, 0, rcClient.right, rcClient.bottom,
|
||||
hwndParent, (HMENU)id, hInst, NULL);
|
||||
ListView_SetExtendedListViewStyle(hwndLV, LVS_EX_FULLROWSELECT);
|
||||
|
||||
/* Initialize the image list, and add items to the control. */
|
||||
/*
|
||||
if (!InitListViewImageLists(hwndLV) ||
|
||||
!InitListViewItems(hwndLV, szName)) {
|
||||
DestroyWindow(hwndLV);
|
||||
return FALSE;
|
||||
}
|
||||
*/
|
||||
/*
|
||||
if (!InitListViewImageLists(hwndLV) ||
|
||||
!InitListViewItems(hwndLV, szName)) {
|
||||
DestroyWindow(hwndLV);
|
||||
return FALSE;
|
||||
}
|
||||
*/
|
||||
CreateListColumns(hwndLV);
|
||||
g_orgListWndProc = SubclassWindow(hwndLV, ListWndProc);
|
||||
g_orgListWndProc = SubclassWindow(hwndLV, ListWndProc);
|
||||
return hwndLV;
|
||||
}
|
||||
|
||||
@ -336,9 +330,9 @@ BOOL RefreshListView(HWND hwndLV, HKEY hKey, LPTSTR keyPath)
|
||||
ShowWindow(hwndLV, SW_HIDE);
|
||||
/* get size information and resize the buffers if necessary */
|
||||
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) {
|
||||
TCHAR* ValName = HeapAlloc(GetProcessHeap(), 0, ++max_val_name_len * sizeof(TCHAR) + BUF_HEAD_SPACE);
|
||||
@ -347,10 +341,10 @@ BOOL RefreshListView(HWND hwndLV, HKEY hKey, LPTSTR keyPath)
|
||||
DWORD dwValSize = max_val_size;
|
||||
DWORD dwIndex = 0L;
|
||||
DWORD dwValType;
|
||||
/* if (RegQueryValueEx(hNewKey, NULL, NULL, &dwValType, ValBuf, &dwValSize) == ERROR_SUCCESS) { */
|
||||
/* AddEntryToList(hwndLV, _T("(Default)"), dwValType, ValBuf, dwValSize); */
|
||||
/* } */
|
||||
/* dwValSize = max_val_size; */
|
||||
/* if (RegQueryValueEx(hNewKey, NULL, NULL, &dwValType, ValBuf, &dwValSize) == ERROR_SUCCESS) { */
|
||||
/* AddEntryToList(hwndLV, _T("(Default)"), dwValType, ValBuf, dwValSize); */
|
||||
/* } */
|
||||
/* dwValSize = max_val_size; */
|
||||
while (RegEnumValue(hNewKey, dwIndex, ValName, &dwValNameLen, NULL, &dwValType, ValBuf, &dwValSize) == ERROR_SUCCESS) {
|
||||
ValBuf[dwValSize] = 0;
|
||||
AddEntryToList(hwndLV, ValName, dwValType, ValBuf, dwValSize);
|
||||
@ -363,7 +357,7 @@ BOOL RefreshListView(HWND hwndLV, HKEY hKey, LPTSTR keyPath)
|
||||
HeapFree(GetProcessHeap(), 0, ValName);
|
||||
}
|
||||
/*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);
|
||||
RegCloseKey(hNewKey);
|
||||
}
|
||||
|
@ -67,42 +67,42 @@ TCHAR szChildClass[MAX_LOADSTRING];
|
||||
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
|
||||
{
|
||||
WNDCLASSEX wcFrame = {
|
||||
sizeof(WNDCLASSEX),
|
||||
CS_HREDRAW | CS_VREDRAW/*style*/,
|
||||
FrameWndProc,
|
||||
0/*cbClsExtra*/,
|
||||
0/*cbWndExtra*/,
|
||||
hInstance,
|
||||
LoadIcon(hInstance, MAKEINTRESOURCE(IDI_REGEDIT)),
|
||||
LoadCursor(0, IDC_ARROW),
|
||||
0/*hbrBackground*/,
|
||||
0/*lpszMenuName*/,
|
||||
szFrameClass,
|
||||
(HICON)LoadImage(hInstance, MAKEINTRESOURCE(IDI_REGEDIT), IMAGE_ICON,
|
||||
GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED)
|
||||
};
|
||||
sizeof(WNDCLASSEX),
|
||||
CS_HREDRAW | CS_VREDRAW/*style*/,
|
||||
FrameWndProc,
|
||||
0/*cbClsExtra*/,
|
||||
0/*cbWndExtra*/,
|
||||
hInstance,
|
||||
LoadIcon(hInstance, MAKEINTRESOURCE(IDI_REGEDIT)),
|
||||
LoadCursor(0, IDC_ARROW),
|
||||
0/*hbrBackground*/,
|
||||
0/*lpszMenuName*/,
|
||||
szFrameClass,
|
||||
(HICON)LoadImage(hInstance, MAKEINTRESOURCE(IDI_REGEDIT), IMAGE_ICON,
|
||||
GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED)
|
||||
};
|
||||
ATOM hFrameWndClass = RegisterClassEx(&wcFrame); /* register frame window class */
|
||||
|
||||
WNDCLASSEX wcChild = {
|
||||
sizeof(WNDCLASSEX),
|
||||
CS_HREDRAW | CS_VREDRAW/*style*/,
|
||||
ChildWndProc,
|
||||
0/*cbClsExtra*/,
|
||||
sizeof(HANDLE)/*cbWndExtra*/,
|
||||
hInstance,
|
||||
LoadIcon(hInstance, MAKEINTRESOURCE(IDI_REGEDIT)),
|
||||
LoadCursor(0, IDC_ARROW),
|
||||
0/*hbrBackground*/,
|
||||
0/*lpszMenuName*/,
|
||||
szChildClass,
|
||||
(HICON)LoadImage(hInstance, MAKEINTRESOURCE(IDI_REGEDIT), IMAGE_ICON,
|
||||
GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED)
|
||||
sizeof(WNDCLASSEX),
|
||||
CS_HREDRAW | CS_VREDRAW/*style*/,
|
||||
ChildWndProc,
|
||||
0/*cbClsExtra*/,
|
||||
sizeof(HANDLE)/*cbWndExtra*/,
|
||||
hInstance,
|
||||
LoadIcon(hInstance, MAKEINTRESOURCE(IDI_REGEDIT)),
|
||||
LoadCursor(0, IDC_ARROW),
|
||||
0/*hbrBackground*/,
|
||||
0/*lpszMenuName*/,
|
||||
szChildClass,
|
||||
(HICON)LoadImage(hInstance, MAKEINTRESOURCE(IDI_REGEDIT), IMAGE_ICON,
|
||||
GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED)
|
||||
|
||||
};
|
||||
};
|
||||
ATOM hChildWndClass = RegisterClassEx(&wcChild); /* register child windows class */
|
||||
hChildWndClass = hChildWndClass; /* warning eater */
|
||||
|
||||
hMenuFrame = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_REGEDIT_MENU));
|
||||
hMenuFrame = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_REGEDIT_MENU));
|
||||
|
||||
/* Initialize the Windows Common Controls DLL */
|
||||
InitCommonControls();
|
||||
@ -113,9 +113,9 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
|
||||
} */
|
||||
|
||||
hFrameWnd = CreateWindowEx(0, (LPCTSTR)(int)hFrameWndClass, szTitle,
|
||||
WS_OVERLAPPEDWINDOW | WS_EX_CLIENTEDGE,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
|
||||
NULL, hMenuFrame, hInstance, NULL/*lpParam*/);
|
||||
WS_OVERLAPPEDWINDOW | WS_EX_CLIENTEDGE,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
|
||||
NULL, hMenuFrame, hInstance, NULL/*lpParam*/);
|
||||
|
||||
if (!hFrameWnd) {
|
||||
return FALSE;
|
||||
@ -148,20 +148,20 @@ int APIENTRY WinMain(HINSTANCE hInstance,
|
||||
{
|
||||
MSG msg;
|
||||
HACCEL hAccel;
|
||||
/*
|
||||
int hCrt;
|
||||
FILE *hf;
|
||||
AllocConsole();
|
||||
hCrt = _open_osfhandle((long)GetStdHandle(STD_OUTPUT_HANDLE), _O_TEXT);
|
||||
hf = _fdopen(hCrt, "w");
|
||||
*stdout = *hf;
|
||||
setvbuf(stdout, NULL, _IONBF, 0);
|
||||
|
||||
wprintf(L"command line exit, hInstance = %d\n", hInstance);
|
||||
getch();
|
||||
FreeConsole();
|
||||
return 0;
|
||||
*/
|
||||
/*
|
||||
int hCrt;
|
||||
FILE *hf;
|
||||
AllocConsole();
|
||||
hCrt = _open_osfhandle((long)GetStdHandle(STD_OUTPUT_HANDLE), _O_TEXT);
|
||||
hf = _fdopen(hCrt, "w");
|
||||
*stdout = *hf;
|
||||
setvbuf(stdout, NULL, _IONBF, 0);
|
||||
|
||||
wprintf(L"command line exit, hInstance = %d\n", hInstance);
|
||||
getch();
|
||||
FreeConsole();
|
||||
return 0;
|
||||
*/
|
||||
|
||||
if (ProcessCmdLine(lpCmdLine)) {
|
||||
return 0;
|
||||
|
@ -29,7 +29,7 @@
|
||||
#define LIST_WINDOW 2003
|
||||
|
||||
#define MAX_LOADSTRING 100
|
||||
#define SPLIT_WIDTH 5
|
||||
#define SPLIT_WIDTH 5
|
||||
#define MAX_NAME_LEN 500
|
||||
|
||||
#define COUNT_OF(a) (sizeof(a)/sizeof(a[0]))
|
||||
@ -37,23 +37,23 @@
|
||||
/******************************************************************************/
|
||||
|
||||
enum OPTION_FLAGS {
|
||||
OPTIONS_AUTO_REFRESH = 0x01,
|
||||
OPTIONS_READ_ONLY_MODE = 0x02,
|
||||
OPTIONS_CONFIRM_ON_DELETE = 0x04,
|
||||
OPTIONS_SAVE_ON_EXIT = 0x08,
|
||||
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 hWnd;
|
||||
HWND hTreeWnd;
|
||||
HWND hListWnd;
|
||||
int nFocusPanel; /* 0: left 1: right */
|
||||
int nSplitPos;
|
||||
WINDOWPLACEMENT pos;
|
||||
TCHAR szPath[MAX_PATH];
|
||||
int nSplitPos;
|
||||
WINDOWPLACEMENT pos;
|
||||
TCHAR szPath[MAX_PATH];
|
||||
} ChildWnd;
|
||||
extern ChildWnd* pChildWnd;
|
||||
|
||||
|
@ -24,36 +24,36 @@
|
||||
#include "regproc.h"
|
||||
|
||||
static char *usage =
|
||||
"Usage:\n"
|
||||
" regedit filename\n"
|
||||
" regedit /E filename [regpath]\n"
|
||||
" regedit /D regpath\n"
|
||||
"\n"
|
||||
"filename - registry file name\n"
|
||||
"regpath - name of the registry key\n"
|
||||
"\n"
|
||||
"When is called without any switches adds contents of the specified\n"
|
||||
"registry file to the registry\n"
|
||||
"\n"
|
||||
"Switches:\n"
|
||||
" /E - exports contents of the specified registry key to the specified\n"
|
||||
" file. Exports the whole registry if no key is specified.\n"
|
||||
" /D - deletes specified registry key\n"
|
||||
" /S - silent execution, can be used with any other switch.\n"
|
||||
" The only existing mode, exists for compatibility with Windows regedit.\n"
|
||||
" /V - advanced mode, can be used with any other switch.\n"
|
||||
" Ignored, exists for compatibility with Windows regedit.\n"
|
||||
" /L - location of system.dat file. Can be used with any other switch.\n"
|
||||
" Ignored. Exists for compatibility with Windows regedit.\n"
|
||||
" /R - location of user.dat file. Can be used with any other switch.\n"
|
||||
" Ignored. Exists for compatibility with Windows regedit.\n"
|
||||
" /? - print this help. Any other switches are ignored.\n"
|
||||
" /C - create registry from. Not implemented.\n"
|
||||
"\n"
|
||||
"The switches are case-insensitive, can be prefixed either by '-' or '/'.\n"
|
||||
"This program is command-line compatible with Microsoft Windows\n"
|
||||
"regedit. The difference with Windows regedit - this application has\n"
|
||||
"command-line interface only.\n";
|
||||
"Usage:\n"
|
||||
" regedit filename\n"
|
||||
" regedit /E filename [regpath]\n"
|
||||
" regedit /D regpath\n"
|
||||
"\n"
|
||||
"filename - registry file name\n"
|
||||
"regpath - name of the registry key\n"
|
||||
"\n"
|
||||
"When is called without any switches adds contents of the specified\n"
|
||||
"registry file to the registry\n"
|
||||
"\n"
|
||||
"Switches:\n"
|
||||
" /E - exports contents of the specified registry key to the specified\n"
|
||||
" file. Exports the whole registry if no key is specified.\n"
|
||||
" /D - deletes specified registry key\n"
|
||||
" /S - silent execution, can be used with any other switch.\n"
|
||||
" The only existing mode, exists for compatibility with Windows regedit.\n"
|
||||
" /V - advanced mode, can be used with any other switch.\n"
|
||||
" Ignored, exists for compatibility with Windows regedit.\n"
|
||||
" /L - location of system.dat file. Can be used with any other switch.\n"
|
||||
" Ignored. Exists for compatibility with Windows regedit.\n"
|
||||
" /R - location of user.dat file. Can be used with any other switch.\n"
|
||||
" Ignored. Exists for compatibility with Windows regedit.\n"
|
||||
" /? - print this help. Any other switches are ignored.\n"
|
||||
" /C - create registry from. Not implemented.\n"
|
||||
"\n"
|
||||
"The switches are case-insensitive, can be prefixed either by '-' or '/'.\n"
|
||||
"This program is command-line compatible with Microsoft Windows\n"
|
||||
"regedit. The difference with Windows regedit - this application has\n"
|
||||
"command-line interface only.\n";
|
||||
|
||||
typedef enum {
|
||||
ACTION_UNDEF, ACTION_ADD, ACTION_EXPORT, ACTION_DELETE
|
||||
@ -70,8 +70,7 @@ BOOL PerformRegAction(REGEDIT_ACTION action, LPSTR s);
|
||||
*/
|
||||
void error_unknown_switch(char chu, char *s)
|
||||
{
|
||||
if (isalpha(chu))
|
||||
{
|
||||
if (isalpha(chu)) {
|
||||
fprintf(stderr,"%s: Undefined switch /%c!\n", getAppName(), chu);
|
||||
} else {
|
||||
fprintf(stderr,"%s: Alphabetic character is expected after '%c' "
|
||||
@ -87,8 +86,7 @@ BOOL ProcessCmdLine(LPSTR lpCmdLine)
|
||||
CHAR ch = *s; /* current character */
|
||||
|
||||
setAppName("regedit");
|
||||
while (ch && ((ch == '-') || (ch == '/')))
|
||||
{
|
||||
while (ch && ((ch == '-') || (ch == '/'))) {
|
||||
char chu;
|
||||
char ch2;
|
||||
|
||||
@ -96,14 +94,11 @@ BOOL ProcessCmdLine(LPSTR lpCmdLine)
|
||||
ch = *s;
|
||||
ch2 = *(s+1);
|
||||
chu = toupper(ch);
|
||||
if (!ch2 || isspace(ch2))
|
||||
{
|
||||
if (chu == 'S' || chu == 'V')
|
||||
{
|
||||
if (!ch2 || isspace(ch2)) {
|
||||
if (chu == 'S' || chu == 'V') {
|
||||
/* ignore these switches */
|
||||
} else {
|
||||
switch (chu)
|
||||
{
|
||||
switch (chu) {
|
||||
case 'D':
|
||||
action = ACTION_DELETE;
|
||||
break;
|
||||
@ -121,16 +116,13 @@ BOOL ProcessCmdLine(LPSTR lpCmdLine)
|
||||
}
|
||||
s++;
|
||||
} else {
|
||||
if (ch2 == ':')
|
||||
{
|
||||
switch (chu)
|
||||
{
|
||||
if (ch2 == ':') {
|
||||
switch (chu) {
|
||||
case 'L':
|
||||
/* fall through */
|
||||
case 'R':
|
||||
s += 2;
|
||||
while (*s && !isspace(*s))
|
||||
{
|
||||
while (*s && !isspace(*s)) {
|
||||
s++;
|
||||
}
|
||||
break;
|
||||
@ -146,8 +138,7 @@ BOOL ProcessCmdLine(LPSTR lpCmdLine)
|
||||
}
|
||||
/* skip spaces to the next parameter */
|
||||
ch = *s;
|
||||
while (ch && isspace(ch))
|
||||
{
|
||||
while (ch && isspace(ch)) {
|
||||
s++;
|
||||
ch = *s;
|
||||
}
|
||||
@ -164,75 +155,65 @@ BOOL ProcessCmdLine(LPSTR lpCmdLine)
|
||||
|
||||
BOOL PerformRegAction(REGEDIT_ACTION action, LPSTR s)
|
||||
{
|
||||
switch (action)
|
||||
{
|
||||
case ACTION_ADD:
|
||||
{
|
||||
CHAR filename[MAX_PATH];
|
||||
FILE *reg_file;
|
||||
switch (action) {
|
||||
case ACTION_ADD: {
|
||||
CHAR filename[MAX_PATH];
|
||||
FILE *reg_file;
|
||||
|
||||
get_file_name(&s, filename);
|
||||
if (!filename[0])
|
||||
{
|
||||
fprintf(stderr,"%s: No file name is specified\n", getAppName());
|
||||
fprintf(stderr,usage);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
while(filename[0])
|
||||
{
|
||||
reg_file = fopen(filename, "r");
|
||||
if (reg_file)
|
||||
{
|
||||
processRegLines(reg_file, doSetValue);
|
||||
} else {
|
||||
perror("");
|
||||
fprintf(stderr,"%s: Can't open file \"%s\"\n", getAppName(), filename);
|
||||
get_file_name(&s, filename);
|
||||
if (!filename[0]) {
|
||||
fprintf(stderr,"%s: No file name is specified\n", getAppName());
|
||||
fprintf(stderr,usage);
|
||||
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])
|
||||
{
|
||||
fprintf(stderr,"%s: No registry key is specified for removal\n",
|
||||
getAppName());
|
||||
fprintf(stderr,usage);
|
||||
exit(1);
|
||||
while(filename[0]) {
|
||||
reg_file = fopen(filename, "r");
|
||||
if (reg_file) {
|
||||
processRegLines(reg_file, doSetValue);
|
||||
} else {
|
||||
perror("");
|
||||
fprintf(stderr,"%s: Can't open file \"%s\"\n", getAppName(), filename);
|
||||
exit(1);
|
||||
}
|
||||
get_file_name(&s, filename);
|
||||
}
|
||||
break;
|
||||
}
|
||||
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])
|
||||
{
|
||||
fprintf(stderr,"%s: No file name is specified\n", getAppName());
|
||||
fprintf(stderr,usage);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (s[0])
|
||||
{
|
||||
case ACTION_DELETE: {
|
||||
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);
|
||||
if (!reg_key_name[0]) {
|
||||
fprintf(stderr,"%s: No registry key is specified for removal\n",
|
||||
getAppName());
|
||||
fprintf(stderr,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]) {
|
||||
fprintf(stderr,"%s: No file name is specified\n", getAppName());
|
||||
fprintf(stderr,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;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
fprintf(stderr,"%s: Unhandled action!\n", getAppName());
|
||||
exit(1);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -49,7 +49,7 @@ void processRegLines(FILE *in, CommandAPI command);
|
||||
* Generic prototypes
|
||||
*/
|
||||
char* getToken(char** str, const char* delims);
|
||||
void get_file_name(CHAR **command_line, CHAR *filename);
|
||||
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);
|
||||
|
@ -72,7 +72,7 @@ HKEY FindRegRoot(HWND hwndTV, HTREEITEM hItem, LPTSTR keyPath, int* pPathLen, in
|
||||
hKey = (HKEY)item.lParam;
|
||||
item.mask = TVIF_TEXT;
|
||||
item.hItem = hItem;
|
||||
/* item.pszText = &keyPath[*pPathLen]; */
|
||||
/* item.pszText = &keyPath[*pPathLen]; */
|
||||
item.pszText = keyPath;
|
||||
item.cchTextMax = max;
|
||||
if (TreeView_GetItem(hwndTV, &item)) {
|
||||
@ -150,7 +150,7 @@ static BOOL InitTreeViewImageLists(HWND hwndTV)
|
||||
|
||||
/* Create the image list. */
|
||||
if ((himl = ImageList_Create(CX_BITMAP, CY_BITMAP,
|
||||
FALSE, NUM_BITMAPS, 0)) == NULL)
|
||||
FALSE, NUM_BITMAPS, 0)) == NULL)
|
||||
return FALSE;
|
||||
|
||||
/* Add the open file, closed file, and document bitmaps. */
|
||||
@ -213,7 +213,7 @@ BOOL OnTreeExpanding(HWND hwndTV, NMTREEVIEW* pnmtv)
|
||||
if (errCode == ERROR_SUCCESS) {
|
||||
TCHAR SubName[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) {
|
||||
++dwCount;
|
||||
}
|
||||
@ -223,10 +223,9 @@ BOOL OnTreeExpanding(HWND hwndTV, NMTREEVIEW* pnmtv)
|
||||
cName = MAX_NAME_LEN;
|
||||
++dwIndex;
|
||||
}
|
||||
/*ShowWindow(hwndTV, SW_SHOWNOACTIVATE); */
|
||||
/*ShowWindow(hwndTV, SW_SHOWNOACTIVATE); */
|
||||
RegCloseKey(hNewKey);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
expanding = FALSE;
|
||||
return TRUE;
|
||||
@ -246,9 +245,9 @@ HWND CreateTreeView(HWND hwndParent, LPTSTR pHostName, int id)
|
||||
/* Get the dimensions of the parent window's client area, and create the tree view control. */
|
||||
GetClientRect(hwndParent, &rcClient);
|
||||
hwndTV = CreateWindowEx(WS_EX_CLIENTEDGE, WC_TREEVIEW, _T("Tree View"),
|
||||
WS_VISIBLE | WS_CHILD | TVS_HASLINES | TVS_HASBUTTONS | TVS_LINESATROOT,
|
||||
0, 0, rcClient.right, rcClient.bottom,
|
||||
hwndParent, (HMENU)id, hInst, NULL);
|
||||
WS_VISIBLE | WS_CHILD | TVS_HASLINES | TVS_HASBUTTONS | TVS_LINESATROOT,
|
||||
0, 0, rcClient.right, rcClient.bottom,
|
||||
hwndParent, (HMENU)id, hInst, NULL);
|
||||
/* Initialize the image list, and add items to the control. */
|
||||
if (!InitTreeViewImageLists(hwndTV) || !InitTreeViewItems(hwndTV, pHostName)) {
|
||||
DestroyWindow(hwndTV);
|
||||
|
Loading…
x
Reference in New Issue
Block a user