21#define IDI_SHELL_FOLDER 4
22#define IDI_SHELL_FOLDER_OPEN 5
23#define IDI_SHELL_MY_COMPUTER 16
45 (*pKeyPath)[*pPathLen] =
L'\\';
53 item.pszText = *pKeyPath + *pPathLen;
54 maxLen = *pMaxLen - *pPathLen;
64 if (!newStr)
return FALSE;
75 int pathLen = 0, maxLen;
114 if (
RegQueryInfoKeyW(
hKey, 0, 0, 0, &dwChildren, 0, 0, 0, 0, 0, 0, 0) !=
ERROR_SUCCESS)
138 DWORD dwCount, dwIndex, dwMaxSubKeyLen;
160 if (
RegQueryInfoKeyW(
hKey, 0, 0, 0, &dwCount, &dwMaxSubKeyLen, 0, 0, 0, 0, 0, 0) !=
ERROR_SUCCESS)
194 DWORD dwPhysicalSize = 0;
195 DWORD dwActualSize = 0;
196 DWORD dwNewPhysicalSize;
198 DWORD dwStep = 10000;
204 if (dwActualSize + dwMaxSubKeyLen + 1 > dwPhysicalSize)
206 dwNewPhysicalSize = dwActualSize + dwMaxSubKeyLen + 1 + dwStep;
215 dwPhysicalSize = dwNewPhysicalSize;
216 pszNodes = pszNewNodes;
220 tvItem.
hItem = childItem;
221 tvItem.
pszText = &pszNodes[dwActualSize];
222 tvItem.
cchTextMax = dwPhysicalSize - dwActualSize;
226 dwActualSize += (
DWORD)
wcslen(&pszNodes[dwActualSize]) + 1;
230 pszNodes[dwActualSize] =
L'\0';
242 childItem = nextItem;
247 for (dwIndex = 0; dwIndex < dwCount; dwIndex++)
249 DWORD cName = dwMaxSubKeyLen, dwSubCount;
277 if (
RegQueryInfoKeyW(hSubKey, 0, 0, 0, &dwSubCount, 0, 0, 0, 0, 0, 0, 0) !=
ERROR_SUCCESS)
368 item.hItem = hNewItem;
498 DWORD dwCount, dwIndex, dwMaxSubKeyLen;
505 static int expanding;
506 if (expanding)
return FALSE;
516 if (!keyPath)
goto done;
528 errCode =
RegQueryInfoKeyW(hNewKey, 0, 0, 0, &dwCount, &dwMaxSubKeyLen, 0, 0, 0, 0, 0, 0);
532 if (!
Name)
goto done;
534 for (dwIndex = 0; dwIndex < dwCount; dwIndex++)
536 DWORD cName = dwMaxSubKeyLen, dwSubCount;
543 errCode =
RegQueryInfoKeyW(
hKey, 0, 0, 0, &dwSubCount, 0, 0, 0, 0, 0, 0, 0);
565 WCHAR szNewKeyFormat[128];
578 if (pszKeyPath[0] ==
L'\0')
589 wsprintf(szNewKey, szNewKeyFormat, iIndex++);
694 if (ptvdi->item.pszText)
710 nRenResult =
RenameKey(hRootKey, keyPath, ptvdi->item.pszText);
744 if (!hwndTV)
return NULL;
770 WCHAR szPathPart[128];
781 keyPath +=
wcslen(szBuffer);
795 copyLength = (
s - keyPath) *
sizeof(
WCHAR);
799 copyLength =
sizeof(szPathPart);
801 StringCbCopyNW(szPathPart,
sizeof(szPathPart), keyPath, copyLength);
807 StringCbCopyW(szPathPart,
sizeof(szPathPart),
L"HKEY_CLASSES_ROOT");
809 StringCbCopyW(szPathPart,
sizeof(szPathPart),
L"HKEY_CURRENT_USER");
811 StringCbCopyW(szPathPart,
sizeof(szPathPart),
L"HKEY_LOCAL_MACHINE");
815 StringCbCopyW(szPathPart,
sizeof(szPathPart),
L"HKEY_CURRENT_CONFIG");
823 memset(&tvi, 0,
sizeof(tvi));
824 tvi.
hItem = hChildItem;
831 if (!
_wcsicmp(szBuffer, szPathPart))
844 keyPath =
s ?
s + 1 :
L"";
VOID UpdateAddress(HTREEITEM hItem, HKEY hRootKey, LPCWSTR pszPath, BOOL bSelectNone)
LONG RenameKey(HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpNewName)
int InfoMessageBox(HWND hWnd, UINT uType, LPCWSTR lpTitle, LPCWSTR lpMessage,...)
int ErrorMessageBox(HWND hWnd, LPCWSTR lpTitle, DWORD dwErrorCode,...)
#define ID_EDIT_PERMISSIONS
BOOL DeleteNode(HWND hwndTV, HTREEITEM hItem)
static BOOL InitTreeViewImageLists(HWND hwndTV)
HWND CreateTreeView(HWND hwndParent, LPWSTR pHostName, HMENU id)
static HTREEITEM AddEntryToTree(HWND hwndTV, HTREEITEM hParent, LPWSTR label, HKEY hKey, DWORD dwChildren)
void DestroyTreeView(HWND hwndTV)
BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem)
BOOL SelectNode(HWND hwndTV, LPCWSTR keyPath)
BOOL TreeWndNotifyProc(HWND hWnd, WPARAM wParam, LPARAM lParam, BOOL *Result)
BOOL OnTreeExpanding(HWND hwndTV, NMTREEVIEW *pnmtv)
LPCWSTR GetItemPath(HWND hwndTV, HTREEITEM hItem, HKEY *phRootKey)
HWND StartKeyRename(HWND hwndTV)
static BOOL get_item_path(HWND hwndTV, HTREEITEM hItem, HKEY *phKey, LPWSTR *pKeyPath, int *pPathLen, int *pMaxLen)
static BOOL InitTreeViewItems(HWND hwndTV, LPWSTR pHostName)
BOOL RefreshTreeView(HWND hwndTV)
HTREEITEM InsertNode(HWND hwndTV, HTREEITEM hItem, LPWSTR name)
#define IDI_SHELL_MY_COMPUTER
#define IDI_SHELL_FOLDER_OPEN
BOOL CreateNewKey(HWND hwndTV, HTREEITEM hItem)
#define RegCloseKey(hKey)
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
LONG WINAPI RegEnumKeyExW(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
LONG WINAPI RegQueryInfoKeyW(HKEY hKey, LPWSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
INT WINAPI ImageList_GetImageCount(HIMAGELIST himl)
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
#define HeapFree(x, y, z)
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
GLenum GLuint GLenum GLsizei const GLchar * buf
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
int _snwprintf(wchar_t *buffer, size_t count, const wchar_t *format,...)
static const WCHAR label[]
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
#define REG_OPTION_NON_VOLATILE
#define REG_OPENED_EXISTING_KEY
#define UNREFERENCED_PARAMETER(P)
_Out_opt_ int _Out_opt_ int * cy
#define TreeView_Select(hwnd, hitem, code)
#define TreeView_SelectItem(hwnd, hitem)
#define TreeView_Expand(hwnd, hitem, code)
#define TreeView_GetChild(hwnd, hitem)
#define TVN_BEGINLABELEDIT
#define TVIS_EXPANDEDONCE
#define TreeView_EnsureVisible(hwnd, hitem)
#define TreeView_GetItemState(hwndTV, hti, mask)
#define TreeView_GetParent(hwnd, hitem)
#define TVS_SHOWSELALWAYS
#define TreeView_GetImageList(hwnd, iImage)
#define TreeView_GetSelection(hwnd)
#define TreeView_GetItem(hwnd, pitem)
struct _TREEITEM * HTREEITEM
#define TreeView_GetRoot(hwnd)
#define TreeView_GetNextSibling(hwnd, hitem)
#define ImageList_AddIcon(himl, hicon)
#define TVN_ITEMEXPANDING
#define TreeView_EditLabel(hwnd, hitem)
#define TreeView_SetImageList(hwnd, himl, iImage)
#define TreeView_InsertItem(hwnd, lpis)
#define TVIF_SELECTEDIMAGE
#define TreeView_SetItem(hwnd, pitem)
#define TreeView_DeleteItem(hwnd, hitem)
DWORD WINAPI GetVersion()
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
STRSAFEAPI StringCbCopyNW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc, size_t cbToCopy)
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
STRSAFEAPI StringCbCatW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
SIZE_T WINAPI HeapSize(HANDLE, DWORD, LPCVOID)
#define HKEY_LOCAL_MACHINE
#define HKEY_CURRENT_CONFIG
#define HKEY_CURRENT_USER
#define HKEY_CLASSES_ROOT
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE hInst, _In_ LPCWSTR name, _In_ UINT type, _In_ int cx, _In_ int cy, _In_ UINT fuLoad)
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define MAKEINTRESOURCEW(i)
BOOL WINAPI DestroyWindow(_In_ HWND)
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
int WINAPI GetSystemMetrics(_In_ int)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI DestroyIcon(_In_ HICON)
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO