ReactOS  0.4.12-dev-57-g7050ac4
edit.c File Reference
#include "regedit.h"
#include <ndk/cmtypes.h>
Include dependency graph for edit.c:

Go to the source code of this file.

Macros

#define NTOS_MODE_USER
 

Typedefs

typedef enum _EDIT_MODE EDIT_MODE
 

Enumerations

enum  _EDIT_MODE { EDIT_MODE_DEC, EDIT_MODE_HEX }
 

Functions

void error (HWND hwnd, INT resId,...)
 
static void error_code_messagebox (HWND hwnd, DWORD error_code)
 
void warning (HWND hwnd, INT resId,...)
 
INT_PTR CALLBACK modify_string_dlgproc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
INT_PTR CALLBACK modify_multi_string_dlgproc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
LRESULT CALLBACK DwordEditSubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
INT_PTR CALLBACK modify_dword_dlgproc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
INT_PTR CALLBACK modify_binary_dlgproc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static BOOL CreateResourceColumns (HWND hwnd)
 
static VOID GetInterfaceType (INTERFACE_TYPE InterfaceType, LPWSTR pBuffer, DWORD dwLength)
 
static VOID ParseResources (HWND hwnd)
 
static BOOL OnResourceNotify (HWND hwndDlg, NMHDR *phdr)
 
static INT_PTR CALLBACK modify_resource_dlgproc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static BOOL CreateResourceListColumns (HWND hWndListView)
 
static VOID AddFullResourcesToList (HWND hwnd)
 
static BOOL OnResourceListNotify (HWND hwndDlg, NMHDR *phdr)
 
static INT_PTR CALLBACK modify_resource_list_dlgproc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
BOOL ModifyValue (HWND hwnd, HKEY hKey, LPCWSTR valueName, BOOL EditBin)
 
static LONG CopyKey (HKEY hDestKey, LPCWSTR lpDestSubKey, HKEY hSrcKey, LPCWSTR lpSrcSubKey)
 
static LONG MoveKey (HKEY hDestKey, LPCWSTR lpDestSubKey, HKEY hSrcKey, LPCWSTR lpSrcSubKey)
 
BOOL DeleteKey (HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath)
 
LONG RenameKey (HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpNewName)
 
LONG RenameValue (HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpDestValue, LPCWSTR lpSrcValue)
 
LONG QueryStringValue (HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpValueName, LPWSTR pszBuffer, DWORD dwBufferLen)
 
BOOL GetKeyName (LPWSTR pszDest, size_t iDestLength, HKEY hRootKey, LPCWSTR lpSubKey)
 

Variables

static const WCHAReditValueName
 
static WCHARstringValueData
 
static PVOID binValueData
 
static DWORD dwordValueData
 
static PCM_RESOURCE_LIST resourceValueData
 
static INT fullResourceIndex = -1
 
static DWORD valueDataLen
 
static EDIT_MODE dwordEditMode = EDIT_MODE_HEX
 

Macro Definition Documentation

◆ NTOS_MODE_USER

#define NTOS_MODE_USER

Definition at line 23 of file edit.c.

Typedef Documentation

◆ EDIT_MODE

Enumeration Type Documentation

◆ _EDIT_MODE

Enumerator
EDIT_MODE_DEC 
EDIT_MODE_HEX 

Definition at line 26 of file edit.c.

27 {
30 } EDIT_MODE;
enum _EDIT_MODE EDIT_MODE

Function Documentation

◆ AddFullResourcesToList()

static VOID AddFullResourcesToList ( HWND  hwnd)
static

Definition at line 977 of file edit.c.

Referenced by modify_resource_list_dlgproc().

978 {
979  PCM_FULL_RESOURCE_DESCRIPTOR pFullDescriptor;
980  WCHAR buffer[80];
981  LVITEMW item;
982  ULONG i;
983  INT iItem;
984 
985  pFullDescriptor = &resourceValueData->List[0];
986  for (i = 0; i < resourceValueData->Count; i++)
987  {
988  wsprintf(buffer, L"%lu", pFullDescriptor->BusNumber);
989 
990  item.mask = LVIF_TEXT;
991  item.iItem = i;
992  item.iSubItem = 0;
993  item.state = 0;
994  item.stateMask = 0;
995  item.pszText = buffer;
996  item.cchTextMax = (int)wcslen(item.pszText);
997 
998  iItem = ListView_InsertItem(hwnd, &item);
999  if (iItem != -1)
1000  {
1001  GetInterfaceType(pFullDescriptor->InterfaceType, buffer, 80);
1002  ListView_SetItemText(hwnd, iItem, 1, buffer);
1003  }
1004  pFullDescriptor = (PVOID)(pFullDescriptor->PartialResourceList.PartialDescriptors +
1005  pFullDescriptor->PartialResourceList.Count);
1006  }
1007 }
CM_FULL_RESOURCE_DESCRIPTOR List[1]
Definition: hwresource.cpp:165
__wchar_t WCHAR
Definition: xmlstorage.h:180
static VOID GetInterfaceType(INTERFACE_TYPE InterfaceType, LPWSTR pBuffer, DWORD dwLength)
Definition: edit.c:577
GLuint buffer
Definition: glext.h:5915
#define ListView_InsertItem(hwnd, pitem)
Definition: commctrl.h:2378
int32_t INT
Definition: typedefs.h:56
UINT stateMask
Definition: commctrl.h:2334
#define LVIF_TEXT
Definition: commctrl.h:2279
int cchTextMax
Definition: commctrl.h:2336
CM_PARTIAL_RESOURCE_LIST PartialResourceList
Definition: hwresource.cpp:160
GLenum GLclampf GLint i
Definition: glfuncs.h:14
int iSubItem
Definition: commctrl.h:2332
void * PVOID
Definition: retypes.h:9
static PCM_RESOURCE_LIST resourceValueData
Definition: edit.c:37
#define ListView_SetItemText(hwndLV, i, iSubItem_, pszText_)
Definition: commctrl.h:2661
LPWSTR pszText
Definition: commctrl.h:2335
UINT mask
Definition: commctrl.h:2330
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: hwresource.cpp:119
static const WCHAR L[]
Definition: oid.c:1087
UINT state
Definition: commctrl.h:2333
static ATOM item
Definition: dde.c:856
unsigned int ULONG
Definition: retypes.h:1
#define wsprintf
Definition: winuser.h:5731
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:29

◆ CopyKey()

static LONG CopyKey ( HKEY  hDestKey,
LPCWSTR  lpDestSubKey,
HKEY  hSrcKey,
LPCWSTR  lpSrcSubKey 
)
static

Definition at line 1365 of file edit.c.

Referenced by MoveKey().

1366 {
1367  LONG lResult;
1368  DWORD dwDisposition;
1369  HKEY hDestSubKey = NULL;
1370  HKEY hSrcSubKey = NULL;
1371  DWORD dwIndex, dwType, cbName, cbData;
1372  WCHAR szSubKey[256];
1373  WCHAR szValueName[256];
1374  BYTE szValueData[512];
1375 
1376  FILETIME ft;
1377 
1378  /* open the source subkey, if specified */
1379  if (lpSrcSubKey)
1380  {
1381  lResult = RegOpenKeyExW(hSrcKey, lpSrcSubKey, 0, KEY_ALL_ACCESS, &hSrcSubKey);
1382  if (lResult)
1383  goto done;
1384  hSrcKey = hSrcSubKey;
1385  }
1386 
1387  /* create the destination subkey */
1388  lResult = RegCreateKeyExW(hDestKey, lpDestSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL,
1389  &hDestSubKey, &dwDisposition);
1390  if (lResult)
1391  goto done;
1392 
1393  /* copy all subkeys */
1394  dwIndex = 0;
1395  do
1396  {
1397  cbName = sizeof(szSubKey) / sizeof(szSubKey[0]);
1398  lResult = RegEnumKeyExW(hSrcKey, dwIndex++, szSubKey, &cbName, NULL, NULL, NULL, &ft);
1399  if (lResult == ERROR_SUCCESS)
1400  {
1401  lResult = CopyKey(hDestSubKey, szSubKey, hSrcKey, szSubKey);
1402  if (lResult)
1403  goto done;
1404  }
1405  }
1406  while(lResult == ERROR_SUCCESS);
1407 
1408  /* copy all subvalues */
1409  dwIndex = 0;
1410  do
1411  {
1412  cbName = sizeof(szValueName) / sizeof(szValueName[0]);
1413  cbData = sizeof(szValueData) / sizeof(szValueData[0]);
1414  lResult = RegEnumValueW(hSrcKey, dwIndex++, szValueName, &cbName, NULL, &dwType, szValueData, &cbData);
1415  if (lResult == ERROR_SUCCESS)
1416  {
1417  lResult = RegSetValueExW(hDestSubKey, szValueName, 0, dwType, szValueData, cbData);
1418  if (lResult)
1419  goto done;
1420  }
1421  }
1422  while(lResult == ERROR_SUCCESS);
1423 
1424  lResult = ERROR_SUCCESS;
1425 
1426 done:
1427  if (hSrcSubKey)
1428  RegCloseKey(hSrcSubKey);
1429  if (hDestSubKey)
1430  RegCloseKey(hDestSubKey);
1431  if (lResult != ERROR_SUCCESS)
1432  SHDeleteKey(hDestKey, lpDestSubKey);
1433  return lResult;
1434 }
#define ERROR_SUCCESS
Definition: deptool.c:10
__wchar_t WCHAR
Definition: xmlstorage.h:180
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)
Definition: reg.c:1094
static LONG CopyKey(HKEY hDestKey, LPCWSTR lpDestSubKey, HKEY hSrcKey, LPCWSTR lpSrcSubKey)
Definition: edit.c:1365
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
LONG WINAPI RegEnumValueW(_In_ HKEY hKey, _In_ DWORD index, _Out_ LPWSTR value, _Inout_ PDWORD val_count, _Reserved_ PDWORD reserved, _Out_opt_ PDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ PDWORD count)
Definition: reg.c:2867
smooth NULL
Definition: ftsmooth.c:416
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
#define KEY_WRITE
Definition: nt_native.h:1031
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4917
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned char BYTE
Definition: ntddk_ex.h:96
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define SHDeleteKey
Definition: shlwapi.h:44
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
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)
Definition: reg.c:2541

◆ CreateResourceColumns()

static BOOL CreateResourceColumns ( HWND  hwnd)
static

Definition at line 439 of file edit.c.

Referenced by modify_resource_dlgproc().

440 {
441  WCHAR szText[80];
442  RECT rc;
443  LVCOLUMN lvC;
444  HWND hwndLV;
445  INT width;
446 
447  /* Create columns. */
448  lvC.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
449  lvC.pszText = szText;
450  lvC.fmt = LVCFMT_LEFT;
451 
452  hwndLV = GetDlgItem(hwnd, IDC_DMA_LIST);
454  GetClientRect(hwndLV, &rc);
455 
456  /* Load the column labels from the resource file. */
457  lvC.iSubItem = 0;
458  lvC.cx = (rc.right - rc.left) / 2;
459  LoadStringW(hInst, IDS_DMA_CHANNEL, szText, COUNT_OF(szText));
460  if (ListView_InsertColumn(hwndLV, 0, &lvC) == -1)
461  return FALSE;
462 
463  lvC.iSubItem = 1;
464  lvC.cx = (rc.right - rc.left) - lvC.cx;
465  LoadStringW(hInst, IDS_DMA_PORT, szText, COUNT_OF(szText));
466  if (ListView_InsertColumn(hwndLV, 1, &lvC) == -1)
467  return FALSE;
468 
469 
470  /* Interrupt list */
471  hwndLV = GetDlgItem(hwnd, IDC_IRQ_LIST);
473  GetClientRect(hwndLV, &rc);
474  width = (rc.right - rc.left) / 4;
475 
476  /* Load the column labels from the resource file. */
477  lvC.iSubItem = 0;
478  lvC.cx = width;
479  LoadStringW(hInst, IDS_INTERRUPT_VECTOR, szText, COUNT_OF(szText));
480  if (ListView_InsertColumn(hwndLV, 0, &lvC) == -1)
481  return FALSE;
482 
483  lvC.iSubItem = 1;
484  LoadStringW(hInst, IDS_INTERRUPT_LEVEL, szText, COUNT_OF(szText));
485  if (ListView_InsertColumn(hwndLV, 1, &lvC) == -1)
486  return FALSE;
487 
488  lvC.iSubItem = 2;
490  if (ListView_InsertColumn(hwndLV, 2, &lvC) == -1)
491  return FALSE;
492 
493  lvC.iSubItem = 3;
494  lvC.cx = (rc.right - rc.left) - 3 * width;
495  LoadStringW(hInst, IDS_INTERRUPT_TYPE, szText, COUNT_OF(szText));
496  if (ListView_InsertColumn(hwndLV, 3, &lvC) == -1)
497  return FALSE;
498 
499 
500  /* Memory list */
501  hwndLV = GetDlgItem(hwnd, IDC_MEMORY_LIST);
503  GetClientRect(hwndLV, &rc);
504  width = (rc.right - rc.left) / 3;
505 
506  /* Load the column labels from the resource file. */
507  lvC.iSubItem = 0;
508  lvC.cx = width;
509  LoadStringW(hInst, IDS_MEMORY_ADDRESS, szText, COUNT_OF(szText));
510  if (ListView_InsertColumn(hwndLV, 0, &lvC) == -1)
511  return FALSE;
512 
513  lvC.iSubItem = 1;
514  LoadStringW(hInst, IDS_MEMORY_LENGTH, szText, COUNT_OF(szText));
515  if (ListView_InsertColumn(hwndLV, 1, &lvC) == -1)
516  return FALSE;
517 
518  lvC.iSubItem = 2;
519  lvC.cx = (rc.right - rc.left) - 2 * width;
520  LoadStringW(hInst, IDS_MEMORY_ACCESS, szText, COUNT_OF(szText));
521  if (ListView_InsertColumn(hwndLV, 2, &lvC) == -1)
522  return FALSE;
523 
524 
525  /* Port list */
526  hwndLV = GetDlgItem(hwnd, IDC_PORT_LIST);
528  GetClientRect(hwndLV, &rc);
529  width = (rc.right - rc.left) / 3;
530 
531  /* Load the column labels from the resource file. */
532  lvC.iSubItem = 0;
533  lvC.cx = width;
534  LoadStringW(hInst, IDS_PORT_ADDRESS, szText, COUNT_OF(szText));
535  if (ListView_InsertColumn(hwndLV, 0, &lvC) == -1)
536  return FALSE;
537 
538  lvC.iSubItem = 1;
539  LoadStringW(hInst, IDS_PORT_LENGTH, szText, COUNT_OF(szText));
540  if (ListView_InsertColumn(hwndLV, 1, &lvC) == -1)
541  return FALSE;
542 
543  lvC.iSubItem = 2;
544  lvC.cx = (rc.right - rc.left) - 2 * width;
545  LoadStringW(hInst, IDS_PORT_ACCESS, szText, COUNT_OF(szText));
546  if (ListView_InsertColumn(hwndLV, 2, &lvC) == -1)
547  return FALSE;
548 
549  /* Device specific list */
550  hwndLV = GetDlgItem(hwnd, IDC_DEVICE_LIST);
552  GetClientRect(hwndLV, &rc);
553  width = (rc.right - rc.left) / 3;
554 
555  /* Load the column labels from the resource file. */
556  lvC.iSubItem = 0;
557  lvC.cx = width;
559  if (ListView_InsertColumn(hwndLV, 0, &lvC) == -1)
560  return FALSE;
561 
562  lvC.iSubItem = 1;
564  if (ListView_InsertColumn(hwndLV, 1, &lvC) == -1)
565  return FALSE;
566 
567  lvC.iSubItem = 2;
568  lvC.cx = (rc.right - rc.left) - 2 * width;
569  LoadStringW(hInst, IDS_SPECIFIC_DATASIZE, szText, COUNT_OF(szText));
570  if (ListView_InsertColumn(hwndLV, 2, &lvC) == -1)
571  return FALSE;
572 
573  return TRUE;
574 }
#define IDC_DEVICE_LIST
Definition: resource.h:284
#define IDC_MEMORY_LIST
Definition: resource.h:282
GLint GLint GLsizei width
Definition: gl.h:1546
#define TRUE
Definition: types.h:120
#define LVCF_WIDTH
Definition: commctrl.h:2557
#define LVCF_TEXT
Definition: commctrl.h:2558
#define IDS_PORT_ADDRESS
Definition: resource.h:214
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define IDS_SPECIFIC_DATASIZE
Definition: resource.h:219
#define LVS_EX_FULLROWSELECT
Definition: commctrl.h:2704
#define LVCFMT_LEFT
Definition: commctrl.h:2568
LONG left
Definition: windef.h:296
LONG right
Definition: windef.h:298
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
int32_t INT
Definition: typedefs.h:56
#define IDS_INTERRUPT_VECTOR
Definition: resource.h:207
#define LVCF_SUBITEM
Definition: commctrl.h:2559
#define LVCOLUMN
Definition: commctrl.h:2551
#define ListView_InsertColumn(hwnd, iCol, pcol)
Definition: commctrl.h:2606
static const WCHAR szText[]
Definition: dialog.c:139
#define IDS_MEMORY_LENGTH
Definition: resource.h:212
#define COUNT_OF(a)
Definition: main.h:33
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDC_DMA_LIST
Definition: resource.h:280
#define ListView_SetExtendedListViewStyle(hwndLV, dw)
Definition: commctrl.h:2695
#define IDS_MEMORY_ACCESS
Definition: resource.h:213
#define IDS_PORT_LENGTH
Definition: resource.h:215
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define IDS_INTERRUPT_TYPE
Definition: resource.h:210
#define LVCF_FMT
Definition: commctrl.h:2556
HINSTANCE hInst
Definition: dxdiag.c:13
#define IDC_PORT_LIST
Definition: resource.h:283
#define IDS_SPECIFIC_RESERVED2
Definition: resource.h:218
#define IDS_DMA_CHANNEL
Definition: resource.h:205
#define IDS_SPECIFIC_RESERVED1
Definition: resource.h:217
#define IDS_INTERRUPT_AFFINITY
Definition: resource.h:209
#define IDS_PORT_ACCESS
Definition: resource.h:216
#define IDS_MEMORY_ADDRESS
Definition: resource.h:211
#define IDC_IRQ_LIST
Definition: resource.h:281
#define IDS_INTERRUPT_LEVEL
Definition: resource.h:208
#define IDS_DMA_PORT
Definition: resource.h:206

◆ CreateResourceListColumns()

static BOOL CreateResourceListColumns ( HWND  hWndListView)
static

Definition at line 946 of file edit.c.

Referenced by modify_resource_list_dlgproc().

947 {
948  WCHAR szText[80];
949  RECT rc;
950  LVCOLUMN lvC;
951 
953 
954  GetClientRect(hWndListView, &rc);
955 
956  /* Create columns. */
957  lvC.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
958  lvC.pszText = szText;
959  lvC.fmt = LVCFMT_LEFT;
960 
961  /* Load the column labels from the resource file. */
962  lvC.iSubItem = 0;
963  lvC.cx = (rc.right - rc.left) / 2;
964  LoadStringW(hInst, IDS_BUSNUMBER, szText, COUNT_OF(szText));
965  if (ListView_InsertColumn(hWndListView, 0, &lvC) == -1)
966  return FALSE;
967 
968  lvC.iSubItem = 1;
969  lvC.cx = (rc.right - rc.left) - lvC.cx;
970  LoadStringW(hInst, IDS_INTERFACE, szText, COUNT_OF(szText));
971  if (ListView_InsertColumn(hWndListView, 1, &lvC) == -1)
972  return FALSE;
973 
974  return TRUE;
975 }
#define TRUE
Definition: types.h:120
#define LVCF_WIDTH
Definition: commctrl.h:2557
#define LVCF_TEXT
Definition: commctrl.h:2558
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define IDS_BUSNUMBER
Definition: resource.h:202
#define LVS_EX_FULLROWSELECT
Definition: commctrl.h:2704
#define LVCFMT_LEFT
Definition: commctrl.h:2568
LONG left
Definition: windef.h:296
LONG right
Definition: windef.h:298
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define LVCF_SUBITEM
Definition: commctrl.h:2559
#define LVCOLUMN
Definition: commctrl.h:2551
#define ListView_InsertColumn(hwnd, iCol, pcol)
Definition: commctrl.h:2606
static const WCHAR szText[]
Definition: dialog.c:139
#define COUNT_OF(a)
Definition: main.h:33
#define ListView_SetExtendedListViewStyle(hwndLV, dw)
Definition: commctrl.h:2695
#define IDS_INTERFACE
Definition: resource.h:203
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define LVCF_FMT
Definition: commctrl.h:2556
HINSTANCE hInst
Definition: dxdiag.c:13

◆ DeleteKey()

BOOL DeleteKey ( HWND  hwnd,
HKEY  hKeyRoot,
LPCWSTR  keyPath 
)

Definition at line 1456 of file edit.c.

Referenced by _CmdWndProc(), ChildWnd_CmdWndProc(), DECLARE_INTERFACE_(), and CRegistryKey::QueryInterface().

1457 {
1458  WCHAR msg[128], caption[128];
1459  BOOL result = FALSE;
1460  LONG lRet;
1461  HKEY hKey;
1462 
1463  lRet = RegOpenKeyExW(hKeyRoot, keyPath, 0, KEY_READ|KEY_SET_VALUE, &hKey);
1464  if (lRet != ERROR_SUCCESS)
1465  {
1466  error_code_messagebox(hwnd, lRet);
1467  return FALSE;
1468  }
1469 
1472 
1473  if (MessageBoxW(g_pChildWnd->hWnd, msg, caption, MB_ICONQUESTION | MB_YESNO) != IDYES)
1474  goto done;
1475 
1476  lRet = SHDeleteKey(hKeyRoot, keyPath);
1477  if (lRet != ERROR_SUCCESS)
1478  {
1479  error(hwnd, IDS_BAD_KEY, keyPath);
1480  goto done;
1481  }
1482  result = TRUE;
1483 
1484 done:
1485  RegCloseKey(hKey);
1486  return result;
1487 }
void error(HWND hwnd, INT resId,...)
Definition: edit.c:42
#define TRUE
Definition: types.h:120
ChildWnd * g_pChildWnd
Definition: childwnd.c:23
#define IDS_BAD_KEY
Definition: resource.h:144
#define ERROR_SUCCESS
Definition: deptool.c:10
#define IDYES
Definition: winuser.h:829
#define KEY_SET_VALUE
Definition: nt_native.h:1017
#define KEY_READ
Definition: nt_native.h:1023
__wchar_t WCHAR
Definition: xmlstorage.h:180
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define MB_YESNO
Definition: winuser.h:811
long LONG
Definition: pedump.c:60
UINT msg
Definition: msvc.h:92
static void error_code_messagebox(HWND hwnd, DWORD error_code)
Definition: edit.c:65
#define MB_ICONQUESTION
Definition: winuser.h:783
#define COUNT_OF(a)
Definition: main.h:33
unsigned int BOOL
Definition: ntddk_ex.h:94
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
#define IDS_QUERY_DELETE_KEY_CONFIRM
Definition: resource.h:157
HWND hWnd
Definition: main.h:59
#define IDS_QUERY_DELETE_KEY_ONE
Definition: resource.h:155
HINSTANCE hInst
Definition: dxdiag.c:13
#define SHDeleteKey
Definition: shlwapi.h:44
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
GLuint64EXT * result
Definition: glext.h:11304

◆ DwordEditSubclassProc()

LRESULT CALLBACK DwordEditSubclassProc ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 233 of file edit.c.

Referenced by modify_dword_dlgproc().

234 {
235  WNDPROC oldwndproc;
236 
237  oldwndproc = (WNDPROC)GetWindowLongPtr(hwnd, GWLP_USERDATA);
238 
239  switch (uMsg)
240  {
241  case WM_CHAR:
243  {
244  if (isdigit((int) wParam & 0xff) || iscntrl((int) wParam & 0xff))
245  {
246  break;
247  }
248  else
249  {
250  return 0;
251  }
252  }
253  else if (dwordEditMode == EDIT_MODE_HEX)
254  {
255  if (isxdigit((int) wParam & 0xff) || iscntrl((int) wParam & 0xff))
256  {
257  break;
258  }
259  else
260  {
261  return 0;
262  }
263  }
264  else
265  {
266  break;
267  }
268  }
269 
270  return CallWindowProcW(oldwndproc, hwnd, uMsg, wParam, lParam);
271 }
static EDIT_MODE dwordEditMode
Definition: edit.c:40
#define WM_CHAR
Definition: winuser.h:1693
WPARAM wParam
Definition: combotst.c:138
#define GWLP_USERDATA
Definition: treelist.c:63
#define isdigit(c)
Definition: acclib.h:68
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2859
_Check_return_ _CRTIMP int __cdecl iscntrl(_In_ int _C)
#define isxdigit(c)
Definition: acclib.h:70
LRESULT WINAPI CallWindowProcW(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define GetWindowLongPtr
Definition: treelist.c:73
LPARAM lParam
Definition: combotst.c:139

◆ error()

void error ( HWND  hwnd,
INT  resId,
  ... 
)

Definition at line 42 of file edit.c.

Referenced by DeleteKey(), and ModifyValue().

43 {
44  va_list ap;
45  WCHAR title[256];
46  WCHAR errfmt[1024];
47  WCHAR errstr[1024];
49 
50  hInstance = GetModuleHandle(0);
51 
52  if (!LoadStringW(hInstance, IDS_ERROR, title, COUNT_OF(title)))
53  wcscpy(title, L"Error");
54 
55  if (!LoadStringW(hInstance, resId, errfmt, COUNT_OF(errfmt)))
56  wcscpy(errfmt, L"Unknown error string!");
57 
58  va_start(ap, resId);
59  _vsnwprintf(errstr, COUNT_OF(errstr), errfmt, ap);
60  va_end(ap);
61 
62  MessageBoxW(hwnd, errstr, title, MB_OK | MB_ICONERROR);
63 }
__wchar_t WCHAR
Definition: xmlstorage.h:180
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
HINSTANCE hInstance
Definition: charmap.c:20
#define va_end(ap)
Definition: acmsvcex.h:90
char * va_list
Definition: acmsvcex.h:78
#define COUNT_OF(a)
Definition: main.h:33
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1087
#define MB_ICONERROR
Definition: winuser.h:781
_CRTIMP int __cdecl _vsnwprintf(wchar_t *_Dest, size_t _Count, const wchar_t *_Format, va_list _Args)
#define GetModuleHandle
Definition: winbase.h:3641
#define va_start(ap, A)
Definition: acmsvcex.h:91
#define MB_OK
Definition: winuser.h:784
#define IDS_ERROR
Definition: resource.h:18
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32
const char * errstr(int errcode)
static char title[]
Definition: ps.c:92

◆ error_code_messagebox()

static void error_code_messagebox ( HWND  hwnd,
DWORD  error_code 
)
static

Definition at line 65 of file edit.c.

Referenced by DeleteKey().

66 {
67  WCHAR title[256];
68  if (!LoadStringW(hInst, IDS_ERROR, title, COUNT_OF(title)))
69  wcscpy(title, L"Error");
70  ErrorMessageBox(hwnd, title, error_code);
71 }
int ErrorMessageBox(HWND hWnd, LPCWSTR lpTitle, DWORD dwErrorCode,...)
Definition: error.c:24
__wchar_t WCHAR
Definition: xmlstorage.h:180
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
static int error_code[8]
Definition: odbccp32.c:58
#define COUNT_OF(a)
Definition: main.h:33
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1087
HINSTANCE hInst
Definition: dxdiag.c:13
#define IDS_ERROR
Definition: resource.h:18
static char title[]
Definition: ps.c:92

◆ GetInterfaceType()

static VOID GetInterfaceType ( INTERFACE_TYPE  InterfaceType,
LPWSTR  pBuffer,
DWORD  dwLength 
)
static

Definition at line 577 of file edit.c.

Referenced by AddFullResourcesToList(), and ParseResources().

580 {
581 // LPWSTR lpInterfaceType;
582 
583  switch (InterfaceType)
584  {
587 // lpInterfaceType = L"Undefined";
588  break;
589  case Internal:
591 // lpInterfaceType = L"Internal";
592  break;
593  case Isa:
595 // lpInterfaceType = L"Isa";
596  break;
597  case Eisa:
599 // lpInterfaceType = L"Eisa";
600  break;
601  case MicroChannel:
603 // lpInterfaceType = L"MicroChannel";
604  break;
605  case TurboChannel:
607 // lpInterfaceType = L"TurboChannel";
608  break;
609  case PCIBus:
611 // lpInterfaceType = L"PCIBus";
612  break;
613  case VMEBus:
615 // lpInterfaceType = L"VMEBus";
616  break;
617  case NuBus:
619 // lpInterfaceType = L"NuBus";
620  break;
621  case PCMCIABus:
623 // lpInterfaceType = L"PCMCIABus";
624  break;
625  case CBus:
627 // lpInterfaceType = L"CBus";
628  break;
629  case MPIBus:
631 // lpInterfaceType = L"MPIBus";
632  break;
633  case MPSABus:
635 // lpInterfaceType = L"MPSABus";
636  break;
637  case ProcessorInternal:
639 // lpInterfaceType = L"ProcessorInternal";
640  break;
641  case InternalPowerBus:
643 // lpInterfaceType = L"InternalPowerBus";
644  break;
645  case PNPISABus:
647 // lpInterfaceType = L"PNPISABus";
648  break;
649  case PNPBus:
651 // lpInterfaceType = L"PNPBus";
652  break;
653  default:
655 // lpInterfaceType = L"Unknown interface type";
656  break;
657  }
658 
659 // wcscpy(pBuffer, lpInterfaceType);
660 }
#define IDS_BUS_TURBOCHANNEL
Definition: resource.h:234
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define IDS_BUS_CBUS
Definition: resource.h:239
PVOID pBuffer
#define IDS_BUS_MPIBUS
Definition: resource.h:240
#define IDS_BUS_MPSABUS
Definition: resource.h:241
static DWORD DWORD * dwLength
Definition: fusion.c:83
#define IDS_BUS_ISA
Definition: resource.h:231
#define IDS_BUS_NUBUS
Definition: resource.h:237
#define IDS_BUS_PCIBUS
Definition: resource.h:235
#define IDS_BUS_INTERNAL
Definition: resource.h:230
#define IDS_BUS_PNPISABUS
Definition: resource.h:244
HINSTANCE hInst
Definition: dxdiag.c:13
#define IDS_BUS_EISA
Definition: resource.h:232
#define IDS_BUS_PROCESSORINTERNAL
Definition: resource.h:242
#define IDS_BUS_MICROCHANNEL
Definition: resource.h:233
#define IDS_BUS_UNDEFINED
Definition: resource.h:229
#define IDS_BUS_VMEBUS
Definition: resource.h:236
#define IDS_BUS_INTERNALPOWERBUS
Definition: resource.h:243
#define IDS_BUS_PCMCIABUS
Definition: resource.h:238
#define IDS_BUS_UNKNOWNTYPE
Definition: resource.h:246
#define IDS_BUS_PNPBUS
Definition: resource.h:245

◆ GetKeyName()

BOOL GetKeyName ( LPWSTR  pszDest,
size_t  iDestLength,
HKEY  hRootKey,
LPCWSTR  lpSubKey 
)

Definition at line 1588 of file edit.c.

Referenced by CopyKeyName(), ExportRegistryFile(), FindNext(), and ScControl().

1589 {
1590  LPCWSTR pszRootKey;
1591 
1592  if (hRootKey == HKEY_CLASSES_ROOT)
1593  pszRootKey = L"HKEY_CLASSES_ROOT";
1594  else if (hRootKey == HKEY_CURRENT_USER)
1595  pszRootKey = L"HKEY_CURRENT_USER";
1596  else if (hRootKey == HKEY_LOCAL_MACHINE)
1597  pszRootKey = L"HKEY_LOCAL_MACHINE";
1598  else if (hRootKey == HKEY_USERS)
1599  pszRootKey = L"HKEY_USERS";
1600  else if (hRootKey == HKEY_CURRENT_CONFIG)
1601  pszRootKey = L"HKEY_CURRENT_CONFIG";
1602  else if (hRootKey == HKEY_DYN_DATA)
1603  pszRootKey = L"HKEY_DYN_DATA";
1604  else
1605  return FALSE;
1606 
1607  if (lpSubKey[0])
1608  _snwprintf(pszDest, iDestLength, L"%s\\%s", pszRootKey, lpSubKey);
1609  else
1610  _snwprintf(pszDest, iDestLength, L"%s", pszRootKey);
1611  return TRUE;
1612 }
#define HKEY_USERS
Definition: winreg.h:13
#define TRUE
Definition: types.h:120
#define HKEY_CURRENT_USER
Definition: winreg.h:11
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define HKEY_DYN_DATA
Definition: winreg.h:16
#define HKEY_CURRENT_CONFIG
Definition: winreg.h:15
int _snwprintf(wchar_t *buffer, size_t count, const wchar_t *format,...)
static const WCHAR L[]
Definition: oid.c:1087
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

◆ modify_binary_dlgproc()

INT_PTR CALLBACK modify_binary_dlgproc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 388 of file edit.c.

Referenced by ModifyValue().

389 {
390  HWND hwndValue;
391  UINT len;
392 
394 
395  switch(uMsg)
396  {
397  case WM_INITDIALOG:
398  if (editValueName && wcscmp(editValueName, L""))
399  {
401  }
402  else
403  {
404  WCHAR buffer[255];
406  SetDlgItemTextW(hwndDlg, IDC_VALUE_NAME, buffer);
407  }
408  hwndValue = GetDlgItem(hwndDlg, IDC_VALUE_DATA);
410  /* reset the hex edit control's font */
411  SendMessageW(hwndValue, WM_SETFONT, 0, 0);
412  SetFocus(hwndValue);
413  return FALSE;
414  case WM_COMMAND:
415  switch (LOWORD(wParam))
416  {
417  case IDOK:
418  if ((hwndValue = GetDlgItem(hwndDlg, IDC_VALUE_DATA)))
419  {
420  len = (UINT) HexEdit_GetBufferSize(hwndValue);
421  if (len > 0 && binValueData)
423  else
424  binValueData = HeapAlloc(GetProcessHeap(), 0, len + 1);
425  HexEdit_CopyBuffer(hwndValue, binValueData, len);
426  valueDataLen = len;
427  }
428  EndDialog(hwndDlg, IDOK);
429  break;
430  case IDCANCEL:
431  EndDialog(hwndDlg, IDCANCEL);
432  return TRUE;
433  }
434  }
435  return FALSE;
436 }
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
#define IDS_DEFAULT_VALUE_NAME
Definition: resource.h:128
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
__wchar_t WCHAR
Definition: xmlstorage.h:180
static UINT
Definition: edit.c:2325
static const WCHAR * editValueName
Definition: edit.c:33
GLuint buffer
Definition: glext.h:5915
HWND WINAPI SetFocus(_In_opt_ HWND)
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
static DWORD valueDataLen
Definition: edit.c:39
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
static PVOID binValueData
Definition: edit.c:35
#define IDC_VALUE_DATA
Definition: resource.h:250
#define COUNT_OF(a)
Definition: main.h:33
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
unsigned int UINT
Definition: ndis.h:50
#define HexEdit_LoadBuffer(hWnd, Buffer, Size)
Definition: hexedit.h:24
static const WCHAR L[]
Definition: oid.c:1087
GLenum GLsizei len
Definition: glext.h:6722
#define WM_COMMAND
Definition: winuser.h:1716
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define HexEdit_CopyBuffer(hWnd, Buffer, nMax)
Definition: hexedit.h:30
HINSTANCE hInst
Definition: dxdiag.c:13
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define HeapReAlloc
Definition: compat.h:393
#define IDC_VALUE_NAME
Definition: resource.h:249
#define WM_SETFONT
Definition: winuser.h:1632
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1715
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define HexEdit_GetBufferSize(hWnd)
Definition: hexedit.h:33

◆ modify_dword_dlgproc()

INT_PTR CALLBACK modify_dword_dlgproc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 274 of file edit.c.

Referenced by ModifyValue().

275 {
276  WNDPROC oldproc;
277  HWND hwndValue;
278  WCHAR ValueString[32];
280  DWORD Base;
281  DWORD Value = 0;
282 
284 
285  switch(uMsg)
286  {
287  case WM_INITDIALOG:
289 
290  /* subclass the edit control */
291  hwndValue = GetDlgItem(hwndDlg, IDC_VALUE_DATA);
292  oldproc = (WNDPROC)GetWindowLongPtr(hwndValue, GWLP_WNDPROC);
293  SetWindowLongPtr(hwndValue, GWLP_USERDATA, (DWORD_PTR)oldproc);
295 
296  if (editValueName && wcscmp(editValueName, L""))
297  {
299  }
300  else
301  {
302  WCHAR buffer[255];
304  SetDlgItemTextW(hwndDlg, IDC_VALUE_NAME, buffer);
305  }
307  swprintf(ValueString, L"%lx", dwordValueData);
308  SetDlgItemTextW(hwndDlg, IDC_VALUE_DATA, ValueString);
309  SendMessage(GetDlgItem(hwndDlg, IDC_VALUE_DATA), EM_SETSEL, 0, -1);
311  return FALSE;
312 
313  case WM_COMMAND:
314  switch (LOWORD(wParam))
315  {
316  case IDC_FORMAT_HEX:
318  {
320  if ((hwndValue = GetDlgItem(hwndDlg, IDC_VALUE_DATA)))
321  {
322  if (GetWindowTextLength(hwndValue))
323  {
324  if (GetWindowTextW(hwndValue, ValueString, 32))
325  {
326  Value = wcstoul (ValueString, &Remainder, 10);
327  }
328  }
329  }
330  swprintf(ValueString, L"%lx", Value);
331  SetDlgItemTextW(hwndDlg, IDC_VALUE_DATA, ValueString);
332  return TRUE;
333  }
334  break;
335 
336  case IDC_FORMAT_DEC:
338  {
340  if ((hwndValue = GetDlgItem(hwndDlg, IDC_VALUE_DATA)))
341  {
342  if (GetWindowTextLength(hwndValue))
343  {
344  if (GetWindowTextW(hwndValue, ValueString, 32))
345  {
346  Value = wcstoul (ValueString, &Remainder, 16);
347  }
348  }
349  }
350  swprintf(ValueString, L"%lu", Value);
351  SetDlgItemTextW(hwndDlg, IDC_VALUE_DATA, ValueString);
352  return TRUE;
353  }
354  break;
355 
356  case IDOK:
357  if ((hwndValue = GetDlgItem(hwndDlg, IDC_VALUE_DATA)))
358  {
359  if (GetWindowTextLength(hwndValue))
360  {
361  if (!GetWindowTextW(hwndValue, ValueString, 32))
362  {
363  EndDialog(hwndDlg, IDCANCEL);
364  return TRUE;
365  }
366 
367  Base = (dwordEditMode == EDIT_MODE_HEX) ? 16 : 10;
368  dwordValueData = wcstoul (ValueString, &Remainder, Base);
369  }
370  else
371  {
372  EndDialog(hwndDlg, IDCANCEL);
373  return TRUE;
374  }
375  }
376  EndDialog(hwndDlg, IDOK);
377  return TRUE;
378 
379  case IDCANCEL:
380  EndDialog(hwndDlg, IDCANCEL);
381  return TRUE;
382  }
383  }
384  return FALSE;
385 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2327
static EDIT_MODE dwordEditMode
Definition: edit.c:40
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
#define IDS_DEFAULT_VALUE_NAME
Definition: resource.h:128
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
__wchar_t WCHAR
Definition: xmlstorage.h:180
_In_opt_ ULONG Base
Definition: rtlfuncs.h:2327
static const WCHAR * editValueName
Definition: edit.c:33
GLuint buffer
Definition: glext.h:5915
HWND WINAPI SetFocus(_In_opt_ HWND)
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define SetWindowLongPtr
Definition: treelist.c:70
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define IDC_FORMAT_DEC
Definition: resource.h:254
#define GWLP_USERDATA
Definition: treelist.c:63
LRESULT CALLBACK DwordEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:233
#define IDC_VALUE_DATA
Definition: resource.h:250
#define COUNT_OF(a)
Definition: main.h:33
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDC_FORMAT_HEX
Definition: resource.h:253
#define swprintf(buf, format,...)
Definition: sprintf.c:56
#define EM_SETSEL
Definition: winuser.h:1979
#define BN_CLICKED
Definition: winuser.h:1886
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1087
#define WM_COMMAND
Definition: winuser.h:1716
uint32_t DWORD_PTR
Definition: typedefs.h:63
#define GWLP_WNDPROC
Definition: treelist.c:66
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2859
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
HINSTANCE hInst
Definition: dxdiag.c:13
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1378
#define IDC_VALUE_NAME
Definition: resource.h:249
#define SendMessage
Definition: winuser.h:5709
#define HIWORD(l)
Definition: typedefs.h:246
#define GetWindowTextLength
Definition: winuser.h:5665
BOOL WINAPI CheckRadioButton(_In_ HWND, _In_ int, _In_ int, _In_ int)
#define GetWindowLongPtr
Definition: treelist.c:73
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1715
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
static DWORD dwordValueData
Definition: edit.c:36
_In_ LARGE_INTEGER _Out_opt_ PLARGE_INTEGER Remainder
Definition: rtlfuncs.h:3046

◆ modify_multi_string_dlgproc()

INT_PTR CALLBACK modify_multi_string_dlgproc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 165 of file edit.c.

Referenced by ModifyValue().

166 {
167  WCHAR* valueData;
168  HWND hwndValue;
169  int len;
170 
172 
173  switch(uMsg)
174  {
175  case WM_INITDIALOG:
176  if (editValueName && wcscmp(editValueName, L""))
177  {
179  }
180  else
181  {
182  WCHAR buffer[255];
184  SetDlgItemTextW(hwndDlg, IDC_VALUE_NAME, buffer);
185  }
188  return FALSE;
189  case WM_COMMAND:
190  switch (LOWORD(wParam))
191  {
192  case IDOK:
193  if ((hwndValue = GetDlgItem(hwndDlg, IDC_VALUE_DATA)))
194  {
195  if ((len = GetWindowTextLength(hwndValue)))
196  {
197  if (stringValueData)
198  {
199  if ((valueData = HeapReAlloc(GetProcessHeap(), 0, stringValueData, (len + 1) * sizeof(WCHAR))))
200  {
201  stringValueData = valueData;
202  if (!GetWindowTextW(hwndValue, stringValueData, len + 1))
203  *stringValueData = 0;
204  }
205  }
206  else
207  {
208  if ((valueData = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR))))
209  {
210  stringValueData = valueData;
211  if (!GetWindowTextW(hwndValue, stringValueData, len + 1))
212  *stringValueData = 0;
213  }
214  }
215  }
216  else
217  {
218  if (stringValueData)
219  *stringValueData = 0;
220  }
221  }
222  EndDialog(hwndDlg, IDOK);
223  break;
224  case IDCANCEL:
225  EndDialog(hwndDlg, IDCANCEL);
226  return TRUE;
227  }
228  }
229  return FALSE;
230 }
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
#define IDS_DEFAULT_VALUE_NAME
Definition: resource.h:128
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const WCHAR * editValueName
Definition: edit.c:33
GLuint buffer
Definition: glext.h:5915
HWND WINAPI SetFocus(_In_opt_ HWND)
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define IDC_VALUE_DATA
Definition: resource.h:250
#define COUNT_OF(a)
Definition: main.h:33
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
static const WCHAR L[]
Definition: oid.c:1087
GLenum GLsizei len
Definition: glext.h:6722
#define WM_COMMAND
Definition: winuser.h:1716
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
HINSTANCE hInst
Definition: dxdiag.c:13
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1378
#define HeapReAlloc
Definition: compat.h:393
static WCHAR * stringValueData
Definition: edit.c:34
#define IDC_VALUE_NAME
Definition: resource.h:249
#define GetWindowTextLength
Definition: winuser.h:5665
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1715
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82

◆ modify_resource_dlgproc()

static INT_PTR CALLBACK modify_resource_dlgproc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 918 of file edit.c.

Referenced by modify_resource_list_dlgproc(), ModifyValue(), and OnResourceListNotify().

919 {
921 
922  switch(uMsg)
923  {
924  case WM_INITDIALOG:
925  CreateResourceColumns(hwndDlg);
926  ParseResources(hwndDlg);
927  return FALSE;
928 
929  case WM_NOTIFY:
930  return OnResourceNotify(hwndDlg, (NMHDR *)lParam);
931 
932  case WM_COMMAND:
933  switch (LOWORD(wParam))
934  {
935  case IDOK:
936  EndDialog(hwndDlg, IDOK);
937  break;
938  case IDCANCEL:
939  EndDialog(hwndDlg, IDCANCEL);
940  return TRUE;
941  }
942  }
943  return FALSE;
944 }
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
#define WM_COMMAND
Definition: winuser.h:1716
static BOOL CreateResourceColumns(HWND hwnd)
Definition: edit.c:439
static VOID ParseResources(HWND hwnd)
Definition: edit.c:664
static BOOL OnResourceNotify(HWND hwndDlg, NMHDR *phdr)
Definition: edit.c:862
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1715
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define WM_NOTIFY
Definition: richedit.h:61

◆ modify_resource_list_dlgproc()

static INT_PTR CALLBACK modify_resource_list_dlgproc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1039 of file edit.c.

Referenced by ModifyValue().

1040 {
1042 
1043  switch(uMsg)
1044  {
1045  case WM_INITDIALOG:
1048  return FALSE;
1049 
1050  case WM_NOTIFY:
1051  return OnResourceListNotify(hwndDlg, (NMHDR *)lParam);
1052 
1053  case WM_COMMAND:
1054  switch (LOWORD(wParam))
1055  {
1056  case IDC_SHOW_RESOURCE:
1057  if (fullResourceIndex != -1)
1059  break;
1060  case IDOK:
1061  EndDialog(hwndDlg, IDOK);
1062  break;
1063  case IDCANCEL:
1064  EndDialog(hwndDlg, IDCANCEL);
1065  return TRUE;
1066  }
1067  }
1068  return FALSE;
1069 }
static INT_PTR CALLBACK modify_resource_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:918
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define IDD_EDIT_RESOURCE
Definition: resource.h:279
static INT fullResourceIndex
Definition: edit.c:38
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
#define DialogBoxW(i, t, p, f)
Definition: winuser.h:4268
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
static VOID AddFullResourcesToList(HWND hwnd)
Definition: edit.c:977
#define IDC_SHOW_RESOURCE
Definition: resource.h:277
#define WM_COMMAND
Definition: winuser.h:1716
static BOOL OnResourceListNotify(HWND hwndDlg, NMHDR *phdr)
Definition: edit.c:1010
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define IDCANCEL
Definition: winuser.h:825
static BOOL CreateResourceListColumns(HWND hWndListView)
Definition: edit.c:946
#define IDC_RESOURCE_LIST
Definition: resource.h:276
#define WM_INITDIALOG
Definition: winuser.h:1715
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define WM_NOTIFY
Definition: richedit.h:61

◆ modify_string_dlgproc()

INT_PTR CALLBACK modify_string_dlgproc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 96 of file edit.c.

Referenced by ModifyValue().

97 {
98  WCHAR* valueData;
99  HWND hwndValue;
100  int len;
101 
103 
104  switch(uMsg)
105  {
106  case WM_INITDIALOG:
107  if (editValueName && wcscmp(editValueName, L""))
108  {
110  }
111  else
112  {
113  WCHAR buffer[255];
115  SetDlgItemTextW(hwndDlg, IDC_VALUE_NAME, buffer);
116  }
118  SendMessage(GetDlgItem(hwndDlg, IDC_VALUE_DATA), EM_SETSEL, 0, -1);
120  return FALSE;
121  case WM_COMMAND:
122  switch (LOWORD(wParam))
123  {
124  case IDOK:
125  if ((hwndValue = GetDlgItem(hwndDlg, IDC_VALUE_DATA)))
126  {
127  if ((len = GetWindowTextLength(hwndValue)))
128  {
129  if (stringValueData)
130  {
131  if ((valueData = HeapReAlloc(GetProcessHeap(), 0, stringValueData, (len + 1) * sizeof(WCHAR))))
132  {
133  stringValueData = valueData;
134  if (!GetWindowTextW(hwndValue, stringValueData, len + 1))
135  *stringValueData = 0;
136  }
137  }
138  else
139  {
140  if ((valueData = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR))))
141  {
142  stringValueData = valueData;
143  if (!GetWindowTextW(hwndValue, stringValueData, len + 1))
144  *stringValueData = 0;
145  }
146  }
147  }
148  else
149  {
150  if (stringValueData)
151  *stringValueData = 0;
152  }
153  }
154  EndDialog(hwndDlg, IDOK);
155  break;
156  case IDCANCEL:
157  EndDialog(hwndDlg, IDCANCEL);
158  return TRUE;
159  }
160  }
161  return FALSE;
162 }
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
#define IDS_DEFAULT_VALUE_NAME
Definition: resource.h:128
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const WCHAR * editValueName
Definition: edit.c:33
GLuint buffer
Definition: glext.h:5915
HWND WINAPI SetFocus(_In_opt_ HWND)
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define IDC_VALUE_DATA
Definition: resource.h:250
#define COUNT_OF(a)
Definition: main.h:33
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define EM_SETSEL
Definition: winuser.h:1979
static const WCHAR L[]
Definition: oid.c:1087
GLenum GLsizei len
Definition: glext.h:6722
#define WM_COMMAND
Definition: winuser.h:1716
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
HINSTANCE hInst
Definition: dxdiag.c:13
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1378
#define HeapReAlloc
Definition: compat.h:393
static WCHAR * stringValueData
Definition: edit.c:34
#define IDC_VALUE_NAME
Definition: resource.h:249
#define SendMessage
Definition: winuser.h:5709
#define GetWindowTextLength
Definition: winuser.h:5665
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1715
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82

◆ ModifyValue()

BOOL ModifyValue ( HWND  hwnd,
HKEY  hKey,
LPCWSTR  valueName,
BOOL  EditBin 
)

Definition at line 1072 of file edit.c.

Referenced by _CmdWndProc().

1073 {
1074  DWORD type;
1075  LONG lRet;
1076  BOOL result = FALSE;
1077 
1078  if (!hKey)
1079  return FALSE;
1080 
1081  editValueName = valueName;
1082 
1083  lRet = RegQueryValueExW(hKey, valueName, 0, &type, 0, &valueDataLen);
1084  if (lRet != ERROR_SUCCESS && (valueName == NULL || !valueName[0]))
1085  {
1086  lRet = ERROR_SUCCESS; /* Allow editing of (Default) values which don't exist */
1087  type = REG_SZ;
1088  valueDataLen = 0;
1090  binValueData = NULL;
1091  }
1092 
1093  if (lRet != ERROR_SUCCESS)
1094  {
1095  error(hwnd, IDS_BAD_VALUE, valueName);
1096  goto done;
1097  }
1098 
1099  if (EditBin == FALSE && ((type == REG_SZ) || (type == REG_EXPAND_SZ)))
1100  {
1101  if (valueDataLen > 0)
1102  {
1104  {
1106  goto done;
1107  }
1108  lRet = RegQueryValueExW(hKey, valueName, 0, 0, (LPBYTE)stringValueData, &valueDataLen);
1109  if (lRet != ERROR_SUCCESS)
1110  {
1111  error(hwnd, IDS_BAD_VALUE, valueName);
1112  goto done;
1113  }
1114  }
1115  else
1116  {
1118  }
1119 
1121  {
1122  if (stringValueData)
1123  {
1124  lRet = RegSetValueExW(hKey, valueName, 0, type, (LPBYTE)stringValueData, (DWORD) (wcslen(stringValueData) + 1) * sizeof(WCHAR));
1125  }
1126  else
1127  {
1128  lRet = RegSetValueExW(hKey, valueName, 0, type, NULL, 0);
1129  }
1130  if (lRet == ERROR_SUCCESS)
1131  result = TRUE;
1132  }
1133  }
1134  else if (EditBin == FALSE && type == REG_MULTI_SZ)
1135  {
1136  if (valueDataLen > 0)
1137  {
1138  size_t llen, listlen, nl_len;
1139  LPWSTR src, lines = NULL;
1140 
1141  if (!(stringValueData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, valueDataLen + sizeof(WCHAR))))
1142  {
1144  goto done;
1145  }
1146  lRet = RegQueryValueExW(hKey, valueName, 0, 0, (LPBYTE)stringValueData, &valueDataLen);
1147  if (lRet != ERROR_SUCCESS)
1148  {
1149  error(hwnd, IDS_BAD_VALUE, valueName);
1150  goto done;
1151  }
1152 
1153  /* convert \0 to \r\n */
1154  src = stringValueData;
1155  nl_len = wcslen(L"\r\n") * sizeof(WCHAR);
1156  listlen = sizeof(WCHAR);
1157  lines = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, listlen + sizeof(WCHAR));
1158  while(*src != L'\0')
1159  {
1160  llen = wcslen(src);
1161  if(llen == 0)
1162  break;
1163  listlen += (llen * sizeof(WCHAR)) + nl_len;
1164  lines = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, lines, listlen);
1165  wcscat(lines, src);
1166  wcscat(lines, L"\r\n");
1167  src += llen + 1;
1168  }
1169  HeapFree(GetProcessHeap(), 0, stringValueData);
1170  stringValueData = lines;
1171  }
1172  else
1173  {
1174  stringValueData = NULL;
1175  }
1176 
1178  {
1179  if (stringValueData)
1180  {
1181  /* convert \r\n to \0 */
1182  BOOL EmptyLines = FALSE;
1183  LPWSTR src, lines, nl;
1184  size_t linechars, buflen, c_nl, dest;
1185 
1186  src = stringValueData;
1187  buflen = sizeof(WCHAR);
1188  lines = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, buflen + sizeof(WCHAR));
1189  c_nl = wcslen(L"\r\n");
1190  dest = 0;
1191  while(*src != L'\0')
1192  {
1193  if((nl = wcsstr(src, L"\r\n")))
1194  {
1195  linechars = nl - src;
1196  if(nl == src)
1197  {
1198  EmptyLines = TRUE;
1199  src = nl + c_nl;
1200  continue;
1201  }
1202  }
1203  else
1204  {
1205  linechars = wcslen(src);
1206  }
1207  if(linechars > 0)
1208  {
1209  buflen += ((linechars + 1) * sizeof(WCHAR));
1210  lines = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, lines, buflen);
1211  memcpy((lines + dest), src, linechars * sizeof(WCHAR));
1212  dest += linechars;
1213  lines[dest++] = L'\0';
1214  }
1215  else
1216  {
1217  EmptyLines = TRUE;
1218  }
1219  src += linechars + (nl != NULL ? c_nl : 0);
1220  }
1221  lines[++dest] = L'\0';
1222 
1223  if(EmptyLines)
1224  {
1226  }
1227 
1228  lRet = RegSetValueExW(hKey, valueName, 0, type, (LPBYTE)lines, (DWORD) buflen);
1229  HeapFree(GetProcessHeap(), 0, lines);
1230  }
1231  else
1232  {
1233  lRet = RegSetValueExW(hKey, valueName, 0, type, NULL, 0);
1234  }
1235  if (lRet == ERROR_SUCCESS)
1236  result = TRUE;
1237  }
1238  }
1239  else if (EditBin == FALSE && type == REG_DWORD)
1240  {
1241  lRet = RegQueryValueExW(hKey, valueName, 0, 0, (LPBYTE)&dwordValueData, &valueDataLen);
1242  if (lRet != ERROR_SUCCESS)
1243  {
1244  error(hwnd, IDS_BAD_VALUE, valueName);
1245  goto done;
1246  }
1247 
1249  {
1250  lRet = RegSetValueExW(hKey, valueName, 0, type, (LPBYTE)&dwordValueData, sizeof(DWORD));
1251  if (lRet == ERROR_SUCCESS)
1252  result = TRUE;
1253  }
1254  }
1255  else if (EditBin == FALSE && type == REG_RESOURCE_LIST)
1256  {
1257  if (valueDataLen > 0)
1258  {
1260  if (resourceValueData == NULL)
1261  {
1263  goto done;
1264  }
1265 
1266  lRet = RegQueryValueExW(hKey, valueName, 0, 0, (LPBYTE)resourceValueData, &valueDataLen);
1267  if (lRet != ERROR_SUCCESS)
1268  {
1269  error(hwnd, IDS_BAD_VALUE, valueName);
1270  goto done;
1271  }
1272  }
1273  else
1274  {
1276  }
1277 
1279  {
1280  }
1281  }
1282  else if (EditBin == FALSE && type == REG_FULL_RESOURCE_DESCRIPTOR)
1283  {
1284  if (valueDataLen > 0)
1285  {
1287  if (resourceValueData == NULL)
1288  {
1290  goto done;
1291  }
1292 
1293  lRet = RegQueryValueExW(hKey, valueName, 0, 0, (LPBYTE)&resourceValueData->List[0], &valueDataLen);
1294  if (lRet != ERROR_SUCCESS)
1295  {
1296  error(hwnd, IDS_BAD_VALUE, valueName);
1297  goto done;
1298  }
1299 
1300  resourceValueData->Count = 1;
1301  fullResourceIndex = 0;
1302  }
1303  else
1304  {
1306  }
1307 
1309  {
1310  }
1311  }
1312  else if ((EditBin != FALSE) || (type == REG_NONE) || (type == REG_BINARY))
1313  {
1314  if(valueDataLen > 0)
1315  {
1317  {
1319  goto done;
1320  }
1321 
1322  /* Use the unicode version, so editing strings in binary mode is correct */
1323  lRet = RegQueryValueExW(hKey, valueName,
1324  0, 0, (LPBYTE)binValueData, &valueDataLen);
1325  if (lRet != ERROR_SUCCESS)
1326  {
1328  error(hwnd, IDS_BAD_VALUE, valueName);
1329  goto done;
1330  }
1331  }
1332  else
1333  {
1334  binValueData = NULL;
1335  }
1336 
1338  {
1339  /* Use the unicode version, so editing strings in binary mode is correct */
1340  lRet = RegSetValueExW(hKey, valueName,
1341  0, type, (LPBYTE)binValueData, valueDataLen);
1342  if (lRet == ERROR_SUCCESS)
1343  result = TRUE;
1344  }
1345  if(binValueData != NULL)
1347  }
1348  else
1349  {
1350  error(hwnd, IDS_UNSUPPORTED_TYPE, type);
1351  }
1352 
1353 done:
1354  if (resourceValueData)
1357 
1358  if (stringValueData)
1359  HeapFree(GetProcessHeap(), 0, stringValueData);
1360  stringValueData = NULL;
1361 
1362  return result;
1363 }
static INT_PTR CALLBACK modify_resource_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:918
void error(HWND hwnd, INT resId,...)
Definition: edit.c:42
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
#define ERROR_SUCCESS
Definition: deptool.c:10
#define IDD_EDIT_BIN_DATA
Definition: resource.h:257
CM_FULL_RESOURCE_DESCRIPTOR List[1]
Definition: hwresource.cpp:165
#define REG_BINARY
Definition: nt_native.h:1496
__wchar_t WCHAR
Definition: xmlstorage.h:180
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)
#define IDD_EDIT_RESOURCE
Definition: resource.h:279
static INT fullResourceIndex
Definition: edit.c:38
#define IDD_EDIT_STRING
Definition: resource.h:248
INT_PTR CALLBACK modify_multi_string_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:165
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static const WCHAR * editValueName
Definition: edit.c:33
#define WCHAR
Definition: msvc.h:43
static DWORD valueDataLen
Definition: edit.c:39
GLuint const GLubyte GLvoid * src
Definition: s_context.h:57
static PVOID binValueData
Definition: edit.c:35
static INT_PTR CALLBACK modify_resource_list_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:1039
unsigned char * LPBYTE
Definition: typedefs.h:52
long LONG
Definition: pedump.c:60
#define IDS_MULTI_SZ_EMPTY_STRING
Definition: resource.h:126
#define REG_MULTI_SZ
Definition: nt_native.h:1501
#define IDD_EDIT_RESOURCE_LIST
Definition: resource.h:275
smooth NULL
Definition: ftsmooth.c:416
#define REG_RESOURCE_LIST
Definition: nt_native.h:1502
#define REG_FULL_RESOURCE_DESCRIPTOR
Definition: nt_native.h:1503
#define DialogBoxW(i, t, p, f)
Definition: winuser.h:4268
static PCM_RESOURCE_LIST resourceValueData
Definition: edit.c:37
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4917
unsigned int BOOL
Definition: ntddk_ex.h:94
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4134
#define IDS_TOO_BIG_VALUE
Definition: resource.h:123
GLfloat CONST GLvector4f CONST GLfloat GLvector4f * dest
Definition: m_xform.h:122
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1087
#define IDS_BAD_VALUE
Definition: resource.h:11
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
INT_PTR CALLBACK modify_string_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:96
INT_PTR CALLBACK modify_binary_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:388
#define IDD_EDIT_MULTI_STRING
Definition: resource.h:256
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
#define HeapReAlloc
Definition: compat.h:393
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static WCHAR * stringValueData
Definition: edit.c:34
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define IDS_UNSUPPORTED_TYPE
Definition: resource.h:122
unsigned int ULONG
Definition: retypes.h:1
INT_PTR CALLBACK modify_dword_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:274
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define REG_NONE
Definition: nt_native.h:1492
void warning(HWND hwnd, INT resId,...)
Definition: edit.c:73
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define IDD_EDIT_DWORD
Definition: resource.h:252
GLuint64EXT * result
Definition: glext.h:11304
#define REG_DWORD
Definition: sdbapi.c:539
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define HeapFree(x, y, z)
Definition: compat.h:394
static DWORD dwordValueData
Definition: edit.c:36
#define REG_SZ
Definition: layer.c:22

◆ MoveKey()

static LONG MoveKey ( HKEY  hDestKey,
LPCWSTR  lpDestSubKey,
HKEY  hSrcKey,
LPCWSTR  lpSrcSubKey 
)
static

Definition at line 1436 of file edit.c.

Referenced by RenameKey().

1437 {
1438  LONG lResult;
1439 
1440  if (!lpSrcSubKey)
1441  return ERROR_INVALID_FUNCTION;
1442 
1443  if (_wcsicmp(lpDestSubKey, lpSrcSubKey) == 0)
1444  {
1445  /* Destination name equals source name */
1446  return ERROR_SUCCESS;
1447  }
1448 
1449  lResult = CopyKey(hDestKey, lpDestSubKey, hSrcKey, lpSrcSubKey);
1450  if (lResult == ERROR_SUCCESS)
1451  SHDeleteKey(hSrcKey, lpSrcSubKey);
1452 
1453  return lResult;
1454 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
static LONG CopyKey(HKEY hDestKey, LPCWSTR lpDestSubKey, HKEY hSrcKey, LPCWSTR lpSrcSubKey)
Definition: edit.c:1365
long LONG
Definition: pedump.c:60
#define SHDeleteKey
Definition: shlwapi.h:44
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)

◆ OnResourceListNotify()

static BOOL OnResourceListNotify ( HWND  hwndDlg,
NMHDR phdr 
)
static

Definition at line 1010 of file edit.c.

Referenced by modify_resource_list_dlgproc().

1011 {
1012  LPNMLISTVIEW lpnmlv = (LPNMLISTVIEW)phdr;
1013 
1014  switch (phdr->idFrom)
1015  {
1016  case IDC_RESOURCE_LIST:
1017  switch(phdr->code)
1018  {
1019  case NM_CLICK:
1020  fullResourceIndex = lpnmlv->iItem;
1021  EnableWindow(GetDlgItem(hwndDlg, IDC_SHOW_RESOURCE), (lpnmlv->iItem != -1));
1022  break;
1023 
1024  case NM_DBLCLK:
1025  if (lpnmlv->iItem != -1)
1026  {
1027  fullResourceIndex = lpnmlv->iItem;
1029  }
1030  break;
1031  }
1032  break;
1033  }
1034 
1035  return FALSE;
1036 }
static INT_PTR CALLBACK modify_resource_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:918
#define IDD_EDIT_RESOURCE
Definition: resource.h:279
static INT fullResourceIndex
Definition: edit.c:38
UINT code
Definition: winuser.h:3112
UINT_PTR idFrom
Definition: winuser.h:3111
#define DialogBoxW(i, t, p, f)
Definition: winuser.h:4268
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDC_SHOW_RESOURCE
Definition: resource.h:277
#define NM_CLICK
Definition: commctrl.h:130
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define NM_DBLCLK
Definition: commctrl.h:131
struct tagNMLISTVIEW * LPNMLISTVIEW
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define IDC_RESOURCE_LIST
Definition: resource.h:276

◆ OnResourceNotify()

static BOOL OnResourceNotify ( HWND  hwndDlg,
NMHDR phdr 
)
static

Definition at line 862 of file edit.c.

Referenced by modify_resource_dlgproc().

863 {
864  LPNMLISTVIEW lpnmlv = (LPNMLISTVIEW)phdr;
865 
866  switch (phdr->idFrom)
867  {
868  case IDC_PORT_LIST:
869  case IDC_MEMORY_LIST:
870  case IDC_DMA_LIST:
871  case IDC_IRQ_LIST:
872  case IDC_DEVICE_LIST:
873  switch(phdr->code)
874  {
875  case NM_CLICK:
876  if (lpnmlv->iItem != -1)
877  {
879  LVITEMW item;
880 
881  item.mask = LVIF_PARAM;
882  item.iItem = lpnmlv->iItem;
883  item.iSubItem = 0;
884 
885  if (ListView_GetItem(phdr->hwndFrom, &item))
886  {
887  pDescriptor = (PCM_PARTIAL_RESOURCE_DESCRIPTOR)item.lParam;
888 
891 
893  (pDescriptor->ShareDisposition == CmResourceShareShared));
894 
897 
900  }
901  }
902  else
903  {
908  }
909  break;
910  }
911  break;
912  }
913 
914  return FALSE;
915 }
#define IDC_DEVICE_LIST
Definition: resource.h:284
#define IDC_MEMORY_LIST
Definition: resource.h:282
#define IDC_UNDETERMINED
Definition: resource.h:285
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR * PCM_PARTIAL_RESOURCE_DESCRIPTOR
UINT code
Definition: winuser.h:3112
#define IDC_DEVICE_EXCLUSIVE
Definition: resource.h:287
UINT_PTR idFrom
Definition: winuser.h:3111
int iSubItem
Definition: commctrl.h:2332
LPARAM lParam
Definition: commctrl.h:2338
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDC_DMA_LIST
Definition: resource.h:280
#define IDC_SHARED
Definition: resource.h:286
UINT mask
Definition: commctrl.h:2330
HWND hwndFrom
Definition: winuser.h:3110
#define NM_CLICK
Definition: commctrl.h:130
#define IDC_DRIVER_EXCLUSIVE
Definition: resource.h:288
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
static ATOM item
Definition: dde.c:856
struct tagNMLISTVIEW * LPNMLISTVIEW
#define IDC_PORT_LIST
Definition: resource.h:283
#define ListView_GetItem(hwnd, pitem)
Definition: commctrl.h:2364
#define LVIF_PARAM
Definition: commctrl.h:2281
#define IDC_IRQ_LIST
Definition: resource.h:281

◆ ParseResources()

static VOID ParseResources ( HWND  hwnd)
static

Definition at line 664 of file edit.c.

Referenced by modify_resource_dlgproc().

665 {
666  PCM_FULL_RESOURCE_DESCRIPTOR pFullDescriptor;
667  PCM_PARTIAL_RESOURCE_LIST pPartialResourceList;
669  ULONG i;
670  HWND hwndLV;
671 
672  WCHAR buffer[80];
673  LVITEMW item;
674  INT iItem;
675 
676  pFullDescriptor = &resourceValueData->List[0];
677  for (i = 0; i < fullResourceIndex; i++)
678  {
679  pFullDescriptor = (PVOID)(pFullDescriptor->PartialResourceList.PartialDescriptors +
680  pFullDescriptor->PartialResourceList.Count);
681  }
682  pPartialResourceList = &pFullDescriptor->PartialResourceList;
683 
684  /* Interface type */
685  GetInterfaceType(pFullDescriptor->InterfaceType, buffer, 80);
686  SetDlgItemTextW(hwnd, IDC_INTERFACETYPE, buffer);
687 
688  /* Busnumber */
689  SetDlgItemInt(hwnd, IDC_BUSNUMBER, (UINT)pFullDescriptor->BusNumber, FALSE);
690 
691  /* Version */
692  SetDlgItemInt(hwnd, IDC_VERSION, (UINT)pPartialResourceList->Version, FALSE);
693 
694  /* Revision */
695  SetDlgItemInt(hwnd, IDC_REVISION, (UINT)pPartialResourceList->Revision, FALSE);
696 
697  for (i = 0; i < pPartialResourceList->Count; i++)
698  {
699  pDescriptor = &pPartialResourceList->PartialDescriptors[i];
700 
701  switch (pDescriptor->Type)
702  {
703  case CmResourceTypePort:
704  hwndLV = GetDlgItem(hwnd, IDC_PORT_LIST);
705 
706 #ifdef _M_AMD64
707  wsprintf(buffer, L"0x%016I64x", pDescriptor->u.Port.Start.QuadPart);
708 #else
709  wsprintf(buffer, L"0x%08lx", pDescriptor->u.Port.Start.u.LowPart);
710 #endif
711 
712  item.mask = LVIF_TEXT | LVIF_PARAM;
713  item.iItem = 1000;
714  item.iSubItem = 0;
715  item.state = 0;
716  item.stateMask = 0;
717  item.pszText = buffer;
718  item.cchTextMax = (int)wcslen(item.pszText);
719  item.lParam = (LPARAM)pDescriptor;
720 
721  iItem = ListView_InsertItem(hwndLV, &item);
722  if (iItem != -1)
723  {
724  wsprintf(buffer, L"0x%lx", pDescriptor->u.Port.Length);
725  ListView_SetItemText(hwndLV, iItem, 1, buffer);
726 
727  if (pDescriptor->Flags & CM_RESOURCE_PORT_IO)
728  LoadStringW(hInst, IDS_PORT_PORT_IO, buffer, COUNT_OF(buffer));
729  else
730  LoadStringW(hInst, IDS_PORT_MEMORY_IO, buffer, COUNT_OF(buffer));
731  ListView_SetItemText(hwndLV, iItem, 2, buffer);
732  }
733  break;
734 
736  hwndLV = GetDlgItem(hwnd, IDC_IRQ_LIST);
737 
738  wsprintf(buffer, L"%lu", pDescriptor->u.Interrupt.Vector);
739 
740  item.mask = LVIF_TEXT | LVIF_PARAM;
741  item.iItem = 1000;
742  item.iSubItem = 0;
743  item.state = 0;
744  item.stateMask = 0;
745  item.pszText = buffer;
746  item.cchTextMax = (int)wcslen(item.pszText);
747  item.lParam = (LPARAM)pDescriptor;
748 
749  iItem = ListView_InsertItem(hwndLV, &item);
750  if (iItem != -1)
751  {
752  wsprintf(buffer, L"%lu", pDescriptor->u.Interrupt.Level);
753  ListView_SetItemText(hwndLV, iItem, 1, buffer);
754 
755  wsprintf(buffer, L"0x%08lx", pDescriptor->u.Interrupt.Affinity);
756  ListView_SetItemText(hwndLV, iItem, 2, buffer);
757 
758  if (pDescriptor->Flags & CM_RESOURCE_INTERRUPT_LATCHED)
760  else
762 
763  ListView_SetItemText(hwndLV, iItem, 3, buffer);
764  }
765  break;
766 
768  hwndLV = GetDlgItem(hwnd, IDC_MEMORY_LIST);
769 
770 #ifdef _M_AMD64
771  wsprintf(buffer, L"0x%016I64x", pDescriptor->u.Memory.Start.QuadPart);
772 #else
773  wsprintf(buffer, L"0x%08lx", pDescriptor->u.Memory.Start.u.LowPart);
774 #endif
775 
776  item.mask = LVIF_TEXT | LVIF_PARAM;
777  item.iItem = 1000;
778  item.iSubItem = 0;
779  item.state = 0;
780  item.stateMask = 0;
781  item.pszText = buffer;
782  item.cchTextMax = (int)wcslen(item.pszText);
783  item.lParam = (LPARAM)pDescriptor;
784 
785  iItem = ListView_InsertItem(hwndLV, &item);
786  if (iItem != -1)
787  {
788  wsprintf(buffer, L"0x%lx", pDescriptor->u.Memory.Length);
789  ListView_SetItemText(hwndLV, iItem, 1, buffer);
790 
792  {
794  LoadStringW(hInst, IDS_MEMORY_READ_ONLY, buffer, COUNT_OF(buffer));
795  break;
796 
798  LoadStringW(hInst, IDS_MEMORY_WRITE_ONLY, buffer, COUNT_OF(buffer));
799  break;
800 
801  default:
802  LoadStringW(hInst, IDS_MEMORY_READ_WRITE, buffer, COUNT_OF(buffer));
803  break;
804  }
805 
806  ListView_SetItemText(hwndLV, iItem, 2, buffer);
807  }
808  break;
809 
810  case CmResourceTypeDma:
811  hwndLV = GetDlgItem(hwnd, IDC_DMA_LIST);
812 
813  wsprintf(buffer, L"%lu", pDescriptor->u.Dma.Channel);
814 
815  item.mask = LVIF_TEXT | LVIF_PARAM;
816  item.iItem = 1000;
817  item.iSubItem = 0;
818  item.state = 0;
819  item.stateMask = 0;
820  item.pszText = buffer;
821  item.cchTextMax = (int)wcslen(item.pszText);
822  item.lParam = (LPARAM)pDescriptor;
823 
824  iItem = ListView_InsertItem(hwndLV, &item);
825  if (iItem != -1)
826  {
827  wsprintf(buffer, L"%lu", pDescriptor->u.Dma.Port);
828  ListView_SetItemText(hwndLV, iItem, 1, buffer);
829  }
830  break;
831 
833  hwndLV = GetDlgItem(hwnd, IDC_DEVICE_LIST);
834 
835  wsprintf(buffer, L"0x%08lx", pDescriptor->u.DeviceSpecificData.Reserved1);
836 
837  item.mask = LVIF_TEXT | LVIF_PARAM;
838  item.iItem = 1000;
839  item.iSubItem = 0;
840  item.state = 0;
841  item.stateMask = 0;
842  item.pszText = buffer;
843  item.cchTextMax = (int)wcslen(item.pszText);
844  item.lParam = (LPARAM)pDescriptor;
845 
846  iItem = ListView_InsertItem(hwndLV, &item);
847  if (iItem != -1)
848  {
849  wsprintf(buffer, L"0x%08lx", pDescriptor->u.DeviceSpecificData.Reserved2);
850  ListView_SetItemText(hwndLV, iItem, 1, buffer);
851 
852  wsprintf(buffer, L"0x%lx", pDescriptor->u.DeviceSpecificData.DataSize);
853  ListView_SetItemText(hwndLV, iItem, 2, buffer);
854  }
855  break;
856  }
857  }
858 }
#define IDC_DEVICE_LIST
Definition: resource.h:284
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@374::@379 Memory
#define IDC_MEMORY_LIST
Definition: resource.h:282
#define CmResourceTypeDeviceSpecific
Definition: hwresource.cpp:127
#define IDS_PORT_MEMORY_IO
Definition: resource.h:222
#define IDS_PORT_PORT_IO
Definition: resource.h:221
#define IDS_MEMORY_READ_WRITE
Definition: resource.h:227
CM_FULL_RESOURCE_DESCRIPTOR List[1]
Definition: hwresource.cpp:165
__wchar_t WCHAR
Definition: xmlstorage.h:180
static INT fullResourceIndex
Definition: edit.c:38
static VOID GetInterfaceType(INTERFACE_TYPE InterfaceType, LPWSTR pBuffer, DWORD dwLength)
Definition: edit.c:577
GLuint buffer
Definition: glext.h:5915
#define ListView_InsertItem(hwnd, pitem)
Definition: commctrl.h:2378
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@374 u
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
int32_t INT
Definition: typedefs.h:56
UINT stateMask
Definition: commctrl.h:2334
#define CmResourceTypePort
Definition: hwresource.cpp:123
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@374::@376 Port
#define CM_RESOURCE_MEMORY_WRITE_ONLY
Definition: cmtypes.h:122
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define LVIF_TEXT
Definition: commctrl.h:2279
int cchTextMax
Definition: commctrl.h:2336
CM_PARTIAL_RESOURCE_LIST PartialResourceList
Definition: hwresource.cpp:160
GLenum GLclampf GLint i
Definition: glfuncs.h:14
int iSubItem
Definition: commctrl.h:2332
LPARAM lParam
Definition: commctrl.h:2338
#define IDS_MEMORY_READ_ONLY
Definition: resource.h:225
#define CM_RESOURCE_MEMORY_READ_ONLY
Definition: cmtypes.h:121
void * PVOID
Definition: retypes.h:9
static LPARAM
Definition: edit.c:2325
static PCM_RESOURCE_LIST resourceValueData
Definition: edit.c:37
#define ListView_SetItemText(hwndLV, i, iSubItem_, pszText_)
Definition: commctrl.h:2661
#define IDC_VERSION
Definition: resource.h:291
#define COUNT_OF(a)
Definition: main.h:33
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDC_DMA_LIST
Definition: resource.h:280
LPWSTR pszText
Definition: commctrl.h:2335
unsigned int UINT
Definition: ndis.h:50
#define IDS_INTERRUPT_EDGE_SENSITIVE
Definition: resource.h:223
#define IDC_INTERFACETYPE
Definition: resource.h:289
UINT mask
Definition: commctrl.h:2330
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@374::@377 Interrupt
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: hwresource.cpp:119
BOOL WINAPI SetDlgItemInt(_In_ HWND, _In_ int, _In_ UINT, _In_ BOOL)
static const WCHAR L[]
Definition: oid.c:1087
#define IDS_INTERRUPT_LEVEL_SENSITIVE
Definition: resource.h:224
#define IDC_BUSNUMBER
Definition: resource.h:290
UINT state
Definition: commctrl.h:2333
HINSTANCE hInst
Definition: dxdiag.c:13
static ATOM item
Definition: dde.c:856
#define CM_RESOURCE_PORT_IO
Definition: cmtypes.h:109
#define IDC_PORT_LIST
Definition: resource.h:283
#define CmResourceTypeInterrupt
Definition: hwresource.cpp:124
#define LVIF_PARAM
Definition: commctrl.h:2281
#define CM_RESOURCE_INTERRUPT_LATCHED
Definition: cmtypes.h:144
unsigned int ULONG
Definition: retypes.h:1
#define IDC_IRQ_LIST
Definition: resource.h:281
#define CmResourceTypeMemory
Definition: hwresource.cpp:125
#define wsprintf
Definition: winuser.h:5731
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@374::@383 DeviceSpecificData
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@374::@380 Dma
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define IDS_MEMORY_WRITE_ONLY
Definition: resource.h:226
#define CmResourceTypeDma
Definition: hwresource.cpp:126
#define IDC_REVISION
Definition: resource.h:292
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:29

◆ QueryStringValue()

LONG QueryStringValue ( HKEY  hKey,
LPCWSTR  lpSubKey,
LPCWSTR  lpValueName,
LPWSTR  pszBuffer,
DWORD  dwBufferLen 
)

Definition at line 1554 of file edit.c.

1555 {
1556  LONG lResult;
1557  HKEY hSubKey = NULL;
1558  DWORD cbData, dwType;
1559 
1560  if (lpSubKey)
1561  {
1562  lResult = RegOpenKeyW(hKey, lpSubKey, &hSubKey);
1563  if (lResult != ERROR_SUCCESS)
1564  goto done;
1565  hKey = hSubKey;
1566  }
1567 
1568  cbData = (dwBufferLen - 1) * sizeof(*pszBuffer);
1569  lResult = RegQueryValueExW(hKey, lpValueName, NULL, &dwType, (LPBYTE) pszBuffer, &cbData);
1570  if (lResult != ERROR_SUCCESS)
1571  goto done;
1572  if (dwType != REG_SZ)
1573  {
1574  lResult = -1;
1575  goto done;
1576  }
1577 
1578  pszBuffer[cbData / sizeof(*pszBuffer)] = L'\0';
1579 
1580 done:
1581  if (lResult != ERROR_SUCCESS)
1582  pszBuffer[0] = L'\0';
1583  if (hSubKey)
1584  RegCloseKey(hSubKey);
1585  return lResult;
1586 }
#define ERROR_SUCCESS
Definition: deptool.c:10
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
long LONG
Definition: pedump.c:60
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3311
smooth NULL
Definition: ftsmooth.c:416
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4134
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1087
#define REG_SZ
Definition: layer.c:22

◆ RenameKey()

LONG RenameKey ( HKEY  hKey,
LPCWSTR  lpSubKey,
LPCWSTR  lpNewName 
)

Definition at line 1489 of file edit.c.

Referenced by ChildWndProc().

1490 {
1491  LPCWSTR s;
1492  LPWSTR lpNewSubKey = NULL;
1493  LONG Ret = 0;
1494 
1495  if (!lpSubKey)
1496  return Ret;
1497 
1498  s = wcsrchr(lpSubKey, L'\\');
1499  if (s)
1500  {
1501  s++;
1502  lpNewSubKey = (LPWSTR) HeapAlloc(GetProcessHeap(), 0, (s - lpSubKey + wcslen(lpNewName) + 1) * sizeof(WCHAR));
1503  if (lpNewSubKey != NULL)
1504  {
1505  memcpy(lpNewSubKey, lpSubKey, (s - lpSubKey) * sizeof(WCHAR));
1506  wcscpy(lpNewSubKey + (s - lpSubKey), lpNewName);
1507  lpNewName = lpNewSubKey;
1508  }
1509  else
1510  return ERROR_NOT_ENOUGH_MEMORY;
1511  }
1512 
1513  Ret = MoveKey(hKey, lpNewName, hKey, lpSubKey);
1514 
1515  if (lpNewSubKey)
1516  {
1517  HeapFree(GetProcessHeap(), 0, lpNewSubKey);
1518  }
1519  return Ret;
1520 }
__wchar_t WCHAR
Definition: xmlstorage.h:180
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
_Check_return_ _CRTIMP _CONST_RETURN wchar_t *__cdecl wcsrchr(_In_z_ const wchar_t *_Str, _In_ wchar_t _Ch)
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1087
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLdouble s
Definition: gl.h:2039
static LONG MoveKey(HKEY hDestKey, LPCWSTR lpDestSubKey, HKEY hSrcKey, LPCWSTR lpSrcSubKey)
Definition: edit.c:1436
WCHAR * LPWSTR
Definition: xmlstorage.h:184
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ RenameValue()

LONG RenameValue ( HKEY  hKey,
LPCWSTR  lpSubKey,
LPCWSTR  lpDestValue,
LPCWSTR  lpSrcValue 
)

Definition at line 1522 of file edit.c.

Referenced by ListWndNotifyProc().

1523 {
1524  LONG lResult;
1525  HKEY hSubKey = NULL;
1526  DWORD dwType, cbData;
1527  BYTE data[512];
1528 
1529  if (lpSubKey)
1530  {
1531  lResult = RegOpenKeyW(hKey, lpSubKey, &hSubKey);
1532  if (lResult != ERROR_SUCCESS)
1533  goto done;
1534  hKey = hSubKey;
1535  }
1536 
1537  cbData = sizeof(data);
1538  lResult = RegQueryValueExW(hKey, lpSrcValue, NULL, &dwType, data, &cbData);
1539  if (lResult != ERROR_SUCCESS)
1540  goto done;
1541 
1542  lResult = RegSetValueExW(hKey, lpDestValue, 0, dwType, data, cbData);
1543  if (lResult != ERROR_SUCCESS)
1544  goto done;
1545 
1546  RegDeleteValue(hKey, lpSrcValue);
1547 
1548 done:
1549  if (hSubKey)
1550  RegCloseKey(hSubKey);
1551  return lResult;
1552 }
#define ERROR_SUCCESS
Definition: deptool.c:10
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3311
smooth NULL
Definition: ftsmooth.c:416
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4917
#define RegDeleteValue
Definition: winreg.h:508
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4134
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
unsigned char BYTE
Definition: ntddk_ex.h:96

◆ warning()

void warning ( HWND  hwnd,
INT  resId,
  ... 
)

Definition at line 73 of file edit.c.

Referenced by ModifyValue().

74 {
75  va_list ap;
76  WCHAR title[256];
77  WCHAR errfmt[1024];
78  WCHAR errstr[1024];
80 
81  hInstance = GetModuleHandle(0);
82 
83  if (!LoadStringW(hInstance, IDS_WARNING, title, COUNT_OF(title)))
84  wcscpy(title, L"Warning");
85 
86  if (!LoadStringW(hInstance, resId, errfmt, COUNT_OF(errfmt)))
87  wcscpy(errfmt, L"Unknown error string!");
88 
89  va_start(ap, resId);
90  _vsnwprintf(errstr, COUNT_OF(errstr), errfmt, ap);
91  va_end(ap);
92 
93  MessageBoxW(hwnd, errstr, title, MB_OK | MB_ICONSTOP);
94 }
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MB_ICONSTOP
Definition: winuser.h:797
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
HINSTANCE hInstance
Definition: charmap.c:20
#define va_end(ap)
Definition: acmsvcex.h:90
#define IDS_WARNING
Definition: resource.h:125
char * va_list
Definition: acmsvcex.h:78
#define COUNT_OF(a)
Definition: main.h:33
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1087
_CRTIMP int __cdecl _vsnwprintf(wchar_t *_Dest, size_t _Count, const wchar_t *_Format, va_list _Args)
#define GetModuleHandle
Definition: winbase.h:3641
#define va_start(ap, A)
Definition: acmsvcex.h:91
#define MB_OK
Definition: winuser.h:784
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32
const char * errstr(int errcode)
static char title[]
Definition: ps.c:92

Variable Documentation

◆ binValueData

PVOID binValueData
static

Definition at line 35 of file edit.c.

◆ dwordEditMode

EDIT_MODE dwordEditMode = EDIT_MODE_HEX
static

Definition at line 40 of file edit.c.

Referenced by DwordEditSubclassProc(), and modify_dword_dlgproc().

◆ dwordValueData

DWORD dwordValueData
static

Definition at line 36 of file edit.c.

Referenced by modify_dword_dlgproc(), and ModifyValue().

◆ editValueName

◆ fullResourceIndex

INT fullResourceIndex = -1
static

◆ resourceValueData

PCM_RESOURCE_LIST resourceValueData
static

Definition at line 37 of file edit.c.

◆ stringValueData

WCHAR* stringValueData
static

Definition at line 34 of file edit.c.

Referenced by modify_multi_string_dlgproc(), modify_string_dlgproc(), and ModifyValue().

◆ valueDataLen

DWORD valueDataLen
static

Definition at line 39 of file edit.c.

Referenced by modify_binary_dlgproc(), and ModifyValue().