ReactOS 0.4.16-dev-91-g764881a
dialog.c File Reference
#include "progman.h"
#include <commdlg.h>
Include dependency graph for dialog.c:

Go to the source code of this file.

Classes

struct  _NEW_ITEM_CONTEXT
 
struct  _COPY_MOVE_CONTEXT
 
struct  _GROUP_ATTRIBUTES_CONTEXT
 
struct  _PICK_ICON_CONTEXT
 
struct  _PROGRAM_ATTRIBUTES_CONTEXT
 
struct  _EXECUTE_CONTEXT
 

Typedefs

typedef struct _NEW_ITEM_CONTEXT NEW_ITEM_CONTEXT
 
typedef struct _NEW_ITEM_CONTEXTPNEW_ITEM_CONTEXT
 
typedef struct _COPY_MOVE_CONTEXT COPY_MOVE_CONTEXT
 
typedef struct _COPY_MOVE_CONTEXTPCOPY_MOVE_CONTEXT
 
typedef struct _GROUP_ATTRIBUTES_CONTEXT GROUP_ATTRIBUTES_CONTEXT
 
typedef struct _GROUP_ATTRIBUTES_CONTEXTPGROUP_ATTRIBUTES_CONTEXT
 
typedef struct _PICK_ICON_CONTEXT PICK_ICON_CONTEXT
 
typedef struct _PICK_ICON_CONTEXTPPICK_ICON_CONTEXT
 
typedef struct _PROGRAM_ATTRIBUTES_CONTEXT PROGRAM_ATTRIBUTES_CONTEXT
 
typedef struct _PROGRAM_ATTRIBUTES_CONTEXTPPROGRAM_ATTRIBUTES_CONTEXT
 
typedef struct _EXECUTE_CONTEXT EXECUTE_CONTEXT
 
typedef struct _EXECUTE_CONTEXTPEXECUTE_CONTEXT
 

Functions

static VOID DIALOG_AddFilterItem (LPWSTR *p, UINT ids, LPCWSTR filter)
 
static BOOL DIALOG_Browse (HWND hWnd, LPCWSTR lpszzFilter, LPWSTR lpstrFile, INT nMaxFile)
 
static BOOL DIALOG_BrowsePrograms (HWND hWnd, LPWSTR lpszFile, INT nMaxFile)
 
static BOOL DIALOG_BrowseSymbols (HWND hWnd, LPWSTR lpszFile, INT nMaxFile)
 
LPCWSTR GroupFormatToFormatName (GROUPFORMAT Format)
 
static INT_PTR CALLBACK DIALOG_NEW_DlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
BOOL DIALOG_New (INT nDefault, PINT pnResult)
 
static INT_PTR CALLBACK DIALOG_COPY_MOVE_DlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
PROGGROUPDIALOG_CopyMove (PROGRAM *hProgram, BOOL bMove)
 
BOOL DIALOG_Delete (UINT ids_text_s, LPCWSTR lpszName)
 
BOOL ValidateEditContents (HWND hDlg, INT nIDEditItem)
 
static INT_PTR CALLBACK DIALOG_GROUP_DlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
BOOL DIALOG_GroupAttributes (GROUPFORMAT format, LPWSTR lpszTitle, LPWSTR lpszGrpFile, INT nSize)
 
static BOOL CALLBACK EnumPickIconResourceProc (HMODULE hModule, LPCWSTR lpszType, LPWSTR lpszName, LONG_PTR lParam)
 
static VOID DestroyIconList (HWND hDlgCtrl)
 
static INT_PTR CALLBACK DIALOG_SYMBOL_DlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static VOID DIALOG_Symbol (HWND hWnd, HICON *lphIcon, LPWSTR lpszIconFile, INT *lpnIconIndex, INT nSize)
 
static INT_PTR CALLBACK DIALOG_PROGRAM_DlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
BOOL DIALOG_ProgramAttributes (LPWSTR lpszTitle, LPWSTR lpszCmdLine, LPWSTR lpszWorkDir, LPWSTR lpszIconFile, HICON *lphIcon, INT *lpnIconIndex, INT *lpnHotKey, INT *lpnCmdShow, BOOL *lpbNewVDM, INT nSize)
 
static INT_PTR CALLBACK DIALOG_EXECUTE_DlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
VOID DIALOG_Execute (VOID)
 

Typedef Documentation

◆ COPY_MOVE_CONTEXT

◆ EXECUTE_CONTEXT

◆ GROUP_ATTRIBUTES_CONTEXT

◆ NEW_ITEM_CONTEXT

◆ PCOPY_MOVE_CONTEXT

◆ PEXECUTE_CONTEXT

◆ PGROUP_ATTRIBUTES_CONTEXT

◆ PICK_ICON_CONTEXT

◆ PNEW_ITEM_CONTEXT

◆ PPICK_ICON_CONTEXT

◆ PPROGRAM_ATTRIBUTES_CONTEXT

◆ PROGRAM_ATTRIBUTES_CONTEXT

Function Documentation

◆ DestroyIconList()

static VOID DestroyIconList ( HWND  hDlgCtrl)
static

Definition at line 530 of file dialog.c.

531{
532 HICON hIcon;
533 UINT count;
534
535 count = SendMessageA(hDlgCtrl, LB_GETCOUNT, 0, 0);
536 if (count == LB_ERR || count == 0)
537 return;
538
539 while (count-- > 0)
540 {
541 hIcon = (HICON)SendMessageA(hDlgCtrl, LB_GETITEMDATA, 0, 0);
543 SendMessageA(hDlgCtrl, LB_DELETESTRING, 0, 0);
544 }
545}
GLuint GLuint GLsizei count
Definition: gl.h:1545
static HICON
Definition: imagelist.c:80
HICON hIcon
Definition: msconfig.c:44
unsigned int UINT
Definition: ndis.h:50
#define LB_ERR
Definition: winuser.h:2435
#define LB_GETCOUNT
Definition: winuser.h:2041
#define LB_GETITEMDATA
Definition: winuser.h:2044
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LB_DELETESTRING
Definition: winuser.h:2035
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2097

Referenced by DIALOG_SYMBOL_DlgProc().

◆ DIALOG_AddFilterItem()

static VOID DIALOG_AddFilterItem ( LPWSTR p,
UINT  ids,
LPCWSTR  filter 
)
static

Definition at line 45 of file dialog.c.

46{
48 *p += wcslen(*p) + 1;
49 lstrcpyW(*p, filter);
50 *p += wcslen(*p) + 1;
51 **p = '\0';
52}
#define MAX_STRING_LEN
Definition: precomp.h:36
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
#define lstrcpyW
Definition: compat.h:749
GLuint * ids
Definition: glext.h:5907
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005
GLfloat GLfloat p
Definition: glext.h:8902
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
HINSTANCE hInstance
Definition: precomp.h:43
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)

Referenced by DIALOG_BrowsePrograms(), and DIALOG_BrowseSymbols().

◆ DIALOG_Browse()

static BOOL DIALOG_Browse ( HWND  hWnd,
LPCWSTR  lpszzFilter,
LPWSTR  lpstrFile,
INT  nMaxFile 
)
static

Definition at line 56 of file dialog.c.

57{
58 OPENFILENAMEW openfilename;
59 WCHAR szDir[MAX_PATH];
60
61 ZeroMemory(&openfilename, sizeof(openfilename));
62
63 GetCurrentDirectoryW(ARRAYSIZE(szDir), szDir);
64
65 openfilename.lStructSize = sizeof(openfilename);
66 openfilename.hwndOwner = hWnd;
67 openfilename.hInstance = Globals.hInstance;
68 openfilename.lpstrFilter = lpszzFilter;
69 openfilename.lpstrFile = lpstrFile;
70 openfilename.nMaxFile = nMaxFile;
71 openfilename.lpstrInitialDir = szDir;
72 openfilename.Flags = OFN_EXPLORER;
73 openfilename.lpstrDefExt = L"exe";
74 openfilename.lpstrCustomFilter = NULL;
75 openfilename.nMaxCustFilter = 0;
76 openfilename.nFilterIndex = 0;
77 openfilename.lpstrFileTitle = NULL;
78 openfilename.nMaxFileTitle = 0;
79 openfilename.lpstrTitle = NULL;
80 openfilename.nFileOffset = 0;
81 openfilename.nFileExtension = 0;
82 openfilename.lCustData = 0;
83 openfilename.lpfnHook = NULL;
84 openfilename.lpTemplateName = NULL;
85
86 return GetOpenFileNameW(&openfilename);
87}
HWND hWnd
Definition: settings.c:17
#define OFN_EXPLORER
Definition: commdlg.h:104
#define NULL
Definition: types.h:112
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
BOOL WINAPI GetOpenFileNameW(OPENFILENAMEW *ofn)
Definition: filedlg.c:4736
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:756
#define MAX_PATH
Definition: compat.h:34
#define L(x)
Definition: ntvdm.h:50
HINSTANCE hInstance
Definition: commdlg.h:362
HWND hwndOwner
Definition: commdlg.h:361
DWORD Flags
Definition: commdlg.h:373
DWORD nMaxFileTitle
Definition: commdlg.h:370
WORD nFileExtension
Definition: commdlg.h:375
LPCWSTR lpTemplateName
Definition: commdlg.h:379
LPWSTR lpstrFile
Definition: commdlg.h:367
DWORD nMaxCustFilter
Definition: commdlg.h:365
LPCWSTR lpstrInitialDir
Definition: commdlg.h:371
LPOFNHOOKPROC lpfnHook
Definition: commdlg.h:378
WORD nFileOffset
Definition: commdlg.h:374
LPCWSTR lpstrTitle
Definition: commdlg.h:372
LPWSTR lpstrFileTitle
Definition: commdlg.h:369
LPWSTR lpstrCustomFilter
Definition: commdlg.h:364
LPCWSTR lpstrDefExt
Definition: commdlg.h:376
LPARAM lCustData
Definition: commdlg.h:377
DWORD lStructSize
Definition: commdlg.h:360
DWORD nMaxFile
Definition: commdlg.h:368
LPCWSTR lpstrFilter
Definition: commdlg.h:363
DWORD nFilterIndex
Definition: commdlg.h:366
#define ZeroMemory
Definition: winbase.h:1712
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by DIALOG_BrowsePrograms(), and DIALOG_BrowseSymbols().

◆ DIALOG_BrowsePrograms()

static BOOL DIALOG_BrowsePrograms ( HWND  hWnd,
LPWSTR  lpszFile,
INT  nMaxFile 
)
static

Definition at line 91 of file dialog.c.

92{
93 WCHAR szzFilter[2 * MAX_STRING_LEN + 100];
94 LPWSTR p = szzFilter;
95
96 DIALOG_AddFilterItem(&p, IDS_PROGRAMS , L"*.exe;*.pif;*.com;*.bat;*.cmd");
98
99 return DIALOG_Browse(hWnd, szzFilter, lpszFile, nMaxFile);
100}
static BOOL DIALOG_Browse(HWND hWnd, LPCWSTR lpszzFilter, LPWSTR lpstrFile, INT nMaxFile)
Definition: dialog.c:56
static VOID DIALOG_AddFilterItem(LPWSTR *p, UINT ids, LPCWSTR filter)
Definition: dialog.c:45
#define IDS_ALL_FILES
Definition: resource.h:68
#define IDS_PROGRAMS
Definition: resource.h:69
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by DIALOG_EXECUTE_DlgProc(), and DIALOG_PROGRAM_DlgProc().

◆ DIALOG_BrowseSymbols()

static BOOL DIALOG_BrowseSymbols ( HWND  hWnd,
LPWSTR  lpszFile,
INT  nMaxFile 
)
static

Definition at line 104 of file dialog.c.

105{
106 WCHAR szzFilter[5 * MAX_STRING_LEN + 100];
107 LPWSTR p = szzFilter;
108
109 DIALOG_AddFilterItem(&p, IDS_SYMBOL_FILES, L"*.ico;*.exe;*.dll");
114
115 return DIALOG_Browse(hWnd, szzFilter, lpszFile, nMaxFile);
116}
#define IDS_SYMBOL_FILES
Definition: resource.h:71
#define IDS_LIBRARIES_DLL
Definition: resource.h:70
#define IDS_SYMBOLS_ICO
Definition: resource.h:72

Referenced by DIALOG_SYMBOL_DlgProc().

◆ DIALOG_COPY_MOVE_DlgProc()

static INT_PTR CALLBACK DIALOG_COPY_MOVE_DlgProc ( HWND  hDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 265 of file dialog.c.

266{
267 PROGGROUP* hGrpItem;
268 PROGGROUP* hGroup;
269
270 PCOPY_MOVE_CONTEXT pCopyMove;
271 INT iItem;
272
274
275 pCopyMove = (PCOPY_MOVE_CONTEXT)GetWindowLongPtrW(hDlg, 8);
276
277 switch (uMsg)
278 {
279 case WM_INITDIALOG:
280 {
281 pCopyMove = (PCOPY_MOVE_CONTEXT)lParam;
282 SetWindowLongPtrW(hDlg, 8, lParam);
283
284 if (pCopyMove->bMove)
285 {
287 SetWindowTextW(hDlg, text);
290 }
291
292 /* List all the group names but the source group, in case we are doing a move */
293 for (hGroup = Globals.hGroups; hGroup; hGroup = hGroup->hNext)
294 {
295 if (!pCopyMove->bMove || hGroup != pCopyMove->Program->hGroup)
296 {
297 iItem = SendDlgItemMessageW(hDlg, PM_TO_GROUP, CB_ADDSTRING, 0, (LPARAM)hGroup->hName);
298 if (iItem != CB_ERR && iItem != CB_ERRSPACE)
300 }
301 }
303 SetDlgItemTextW(hDlg, PM_PROGRAM , pCopyMove->Program->hName);
304 SetDlgItemTextW(hDlg, PM_FROM_GROUP, pCopyMove->Program->hGroup->hName);
305 break;
306 }
307
308 case WM_COMMAND:
309 switch (LOWORD(wParam))
310 {
311 case IDHELP:
313 return TRUE;
314
315 case IDOK:
316 {
317 /* Get the selected group */
318 iItem = SendDlgItemMessageW(hDlg, PM_TO_GROUP, CB_GETCURSEL, 0, 0);
319 hGrpItem = (PROGGROUP *)SendDlgItemMessageW(hDlg, PM_TO_GROUP, CB_GETITEMDATA, iItem, 0);
320 /* Check that it is indeed in the group list */
321 for (hGroup = Globals.hGroups; hGroup && hGroup != hGrpItem; hGroup = hGroup->hNext)
322 ;
323 if (pCopyMove->bMove)
324 {
325 if (hGrpItem == pCopyMove->Program->hGroup)
326 hGrpItem = NULL;
327 }
328 pCopyMove->hToGroup = hGrpItem;
329 EndDialog(hDlg, IDOK);
330 return TRUE;
331 }
332
333 case IDCANCEL:
334 EndDialog(hDlg, IDCANCEL);
335 return TRUE;
336 }
337 return FALSE;
338 }
339
340 return FALSE;
341}
#define IDS_ERROR
Definition: resource.h:18
struct _COPY_MOVE_CONTEXT * PCOPY_MOVE_CONTEXT
INT MAIN_MessageBoxIDS(UINT ids_text, UINT ids_title, WORD type)
Definition: main.c:1159
#define IDS_NOT_IMPLEMENTED
Definition: resource.h:59
#define IDS_MOVE_PROGRAM_1
Definition: resource.h:57
#define IDS_MOVE_PROGRAM_2
Definition: resource.h:58
#define PM_TO_GROUP
Definition: resource.h:128
#define PM_PROGRAM
Definition: resource.h:126
#define PM_FROM_GROUP
Definition: resource.h:127
#define PM_COPY_MOVE_TXT
Definition: resource.h:125
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
const WCHAR * text
Definition: package.c:1794
#define LOWORD(l)
Definition: pedump.c:82
#define IDHELP
Definition: resource_2.h:8
PROGRAM * Program
Definition: dialog.c:257
PROGGROUP * hToGroup
Definition: dialog.c:258
LPWSTR hName
Definition: progman.h:138
PROGGROUP * hNext
Definition: progman.h:115
LPWSTR hName
Definition: progman.h:93
PROGGROUP * hGroup
Definition: progman.h:83
int32_t INT
Definition: typedefs.h:58
LONG_PTR LPARAM
Definition: windef.h:208
#define CB_SETITEMDATA
Definition: winuser.h:1969
#define GetWindowLongPtrW
Definition: winuser.h:4832
#define IDCANCEL
Definition: winuser.h:834
#define CB_ERRSPACE
Definition: winuser.h:2439
#define WM_COMMAND
Definition: winuser.h:1743
#define CB_ERR
Definition: winuser.h:2438
#define CB_SETCURSEL
Definition: winuser.h:1964
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define WM_INITDIALOG
Definition: winuser.h:1742
#define IDOK
Definition: winuser.h:833
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define CB_ADDSTRING
Definition: winuser.h:1939
#define CB_GETITEMDATA
Definition: winuser.h:1953
#define MB_OK
Definition: winuser.h:793
#define CB_GETCURSEL
Definition: winuser.h:1946
#define SetWindowLongPtrW
Definition: winuser.h:5358
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)

Referenced by DIALOG_CopyMove().

◆ DIALOG_CopyMove()

PROGGROUP * DIALOG_CopyMove ( PROGRAM hProgram,
BOOL  bMove 
)

Definition at line 343 of file dialog.c.

344{
345 COPY_MOVE_CONTEXT CopyMove;
346 INT_PTR ret;
347
348 CopyMove.bMove = bMove;
349 CopyMove.Program = hProgram;
350 CopyMove.hToGroup = NULL;
352
353 return (ret == IDOK ? CopyMove.hToGroup : NULL);
354}
static INT_PTR CALLBACK DIALOG_COPY_MOVE_DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:265
#define IDD_COPY_MOVE
Definition: resource.h:108
int32_t INT_PTR
Definition: typedefs.h:64
int ret
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)

Referenced by PROGRAM_CopyMoveProgram().

◆ DIALOG_Delete()

BOOL DIALOG_Delete ( UINT  ids_text_s,
LPCWSTR  lpszName 
)

Definition at line 361 of file dialog.c.

362{
363 return (MAIN_MessageBoxIDS_s(ids_text_s, lpszName, IDS_DELETE, MB_YESNO | MB_DEFBUTTON2) == IDYES);
364}
#define IDS_DELETE
Definition: resource.h:40
INT MAIN_MessageBoxIDS_s(UINT ids_text, LPCWSTR str, UINT ids_title, WORD type)
Definition: main.c:1174
#define MB_YESNO
Definition: winuser.h:820
#define MB_DEFBUTTON2
Definition: winuser.h:802
#define IDYES
Definition: winuser.h:838

Referenced by MAIN_MenuCommand().

◆ DIALOG_Execute()

VOID DIALOG_Execute ( VOID  )

Definition at line 1021 of file dialog.c.

1022{
1023 EXECUTE_CONTEXT ExecuteContext;
1024 LONG lRet;
1025 DWORD dwSize;
1026 DWORD dwType;
1027
1028 ExecuteContext.hKeyPMRecentFilesList = NULL;
1029 ExecuteContext.bCheckBinaryType = TRUE;
1030
1031 lRet = RegCreateKeyExW(Globals.hKeyProgMan,
1032 L"Recent File List",
1033 0,
1034 NULL,
1035 0,
1037 NULL,
1038 &ExecuteContext.hKeyPMRecentFilesList,
1039 NULL);
1040 if (lRet == ERROR_SUCCESS)
1041 {
1042 dwSize = sizeof(ExecuteContext.dwMaxFiles);
1043 lRet = RegQueryValueExW(ExecuteContext.hKeyPMRecentFilesList,
1044 L"Max Files",
1045 NULL,
1046 &dwType,
1047 (LPBYTE)&ExecuteContext.dwMaxFiles,
1048 &dwSize);
1049 if (lRet != ERROR_SUCCESS || dwType != REG_DWORD)
1050 {
1051 ExecuteContext.dwMaxFiles = 4;
1052 dwSize = sizeof(ExecuteContext.dwMaxFiles);
1053 lRet = RegSetValueExW(ExecuteContext.hKeyPMRecentFilesList,
1054 L"Max Files",
1055 0,
1056 REG_DWORD,
1057 (LPBYTE)&ExecuteContext.dwMaxFiles,
1058 sizeof(ExecuteContext.dwMaxFiles));
1059 }
1060
1061 dwSize = sizeof(ExecuteContext.bCheckBinaryType);
1062 lRet = RegQueryValueExW(Globals.hKeyPMSettings,
1063 L"CheckBinaryType",
1064 NULL,
1065 &dwType,
1066 (LPBYTE)&ExecuteContext.bCheckBinaryType,
1067 &dwSize);
1068 if (lRet != ERROR_SUCCESS || dwType != REG_DWORD)
1069 {
1070 ExecuteContext.bCheckBinaryType = TRUE;
1071 }
1072 }
1073
1075
1076 if (ExecuteContext.hKeyPMRecentFilesList)
1077 RegCloseKey(ExecuteContext.hKeyPMRecentFilesList);
1078}
static INT_PTR CALLBACK DIALOG_EXECUTE_DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:925
#define IDD_EXECUTE
Definition: resource.h:112
#define RegCloseKey(hKey)
Definition: registry.h:49
#define ERROR_SUCCESS
Definition: deptool.c:10
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:1096
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:4882
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
unsigned long DWORD
Definition: ntddk_ex.h:95
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define KEY_READ
Definition: nt_native.h:1023
#define KEY_WRITE
Definition: nt_native.h:1031
long LONG
Definition: pedump.c:60
#define REG_DWORD
Definition: sdbapi.c:596
BOOL bCheckBinaryType
Definition: dialog.c:919
HKEY hKeyPMRecentFilesList
Definition: dialog.c:917
DWORD dwMaxFiles
Definition: dialog.c:918
unsigned char * LPBYTE
Definition: typedefs.h:53

Referenced by MAIN_MenuCommand().

◆ DIALOG_EXECUTE_DlgProc()

static INT_PTR CALLBACK DIALOG_EXECUTE_DlgProc ( HWND  hDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 925 of file dialog.c.

926{
927 WCHAR szFile[MAX_PATHNAME_LEN]; // filename
928 DWORD BinaryType;
929 PEXECUTE_CONTEXT pExecuteContext;
930
931 pExecuteContext = (PEXECUTE_CONTEXT)GetWindowLongPtrW(hDlg, 8);
932
933 switch (uMsg)
934 {
935 case WM_INITDIALOG:
936 {
937 pExecuteContext = (PEXECUTE_CONTEXT)lParam;
938 SetWindowLongPtrW(hDlg, 8, lParam);
939
941
942 if (pExecuteContext->bCheckBinaryType)
943 {
946 }
947 else
948 {
950 }
951
952 break;
953 }
954
955 case WM_COMMAND:
956 switch (LOWORD(wParam))
957 {
958 case PM_SYMBOL:
960 return TRUE;
961
962 case PM_NEW_VDM:
964 return TRUE;
965
966 case PM_BROWSE:
967 {
968 szFile[0] = '\0';
969 if (DIALOG_BrowsePrograms(hDlg, szFile, ARRAYSIZE(szFile)))
970 {
971 SetWindowTextW(GetDlgItem(hDlg, PM_COMMAND), szFile);
972 SetFocus(GetDlgItem(hDlg, IDOK));
973 if (pExecuteContext->bCheckBinaryType &&
974 (!GetBinaryTypeW(szFile, &BinaryType) || BinaryType != SCS_WOW_BINARY) )
975 {
978 }
979 else
980 {
983 }
984 }
985 return TRUE;
986 }
987
988 case PM_COMMAND:
989 {
991 {
993 }
994 return FALSE;
995 }
996
997 case IDHELP:
999 return TRUE;
1000
1001 case IDOK:
1002 {
1003 GetDlgItemTextW(hDlg, PM_COMMAND, szFile, ARRAYSIZE(szFile));
1005 if (Globals.bMinOnRun)
1007 EndDialog(hDlg, IDOK);
1008 return TRUE;
1009 }
1010
1011 case IDCANCEL:
1012 EndDialog(hDlg, IDCANCEL);
1013 return TRUE;
1014 }
1015 return FALSE;
1016 }
1017
1018 return FALSE;
1019}
BOOL ValidateEditContents(HWND hDlg, INT nIDEditItem)
Definition: dialog.c:368
static BOOL DIALOG_BrowsePrograms(HWND hWnd, LPWSTR lpszFile, INT nMaxFile)
Definition: dialog.c:91
struct _EXECUTE_CONTEXT * PEXECUTE_CONTEXT
#define PM_NEW_VDM
Definition: resource.h:148
#define PM_BROWSE
Definition: resource.h:149
#define PM_SYMBOL
Definition: resource.h:147
#define PM_COMMAND
Definition: resource.h:146
BOOL WINAPI GetBinaryTypeW(LPCWSTR lpApplicationName, LPDWORD lpBinaryType)
Definition: vdm.c:1243
#define EnableDlgItem(hDlg, nID, bEnable)
Definition: eventvwr.h:55
#define MAX_PATHNAME_LEN
Definition: progman.h:54
HINSTANCE WINAPI ShellExecuteW(HWND hwnd, LPCWSTR lpVerb, LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd)
Definition: shlexec.cpp:2482
#define HIWORD(l)
Definition: typedefs.h:247
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2263
#define SCS_WOW_BINARY
Definition: winbase.h:242
#define SW_SHOWNORMAL
Definition: winuser.h:773
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define BST_UNCHECKED
Definition: winuser.h:199
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
HWND WINAPI SetFocus(_In_opt_ HWND)
BOOL WINAPI CloseWindow(_In_ HWND)
#define SW_SHOWMINNOACTIVE
Definition: winuser.h:780
#define BST_CHECKED
Definition: winuser.h:197
#define CBN_EDITCHANGE
Definition: winuser.h:1978

Referenced by DIALOG_Execute().

◆ DIALOG_GROUP_DlgProc()

static INT_PTR CALLBACK DIALOG_GROUP_DlgProc ( HWND  hDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 414 of file dialog.c.

415{
416 PGROUP_ATTRIBUTES_CONTEXT pGroupAttributes;
417
418 pGroupAttributes = (PGROUP_ATTRIBUTES_CONTEXT)GetWindowLongPtrW(hDlg, 8);
419
420 switch (uMsg)
421 {
422 case WM_INITDIALOG:
423 {
424 DWORD evMask;
425
426 pGroupAttributes = (PGROUP_ATTRIBUTES_CONTEXT)lParam;
427 SetWindowLongPtrW(hDlg, 8, lParam);
428
429 /* Configure Richedit control for sending notification changes */
432
433 SetDlgItemTextW(hDlg, PM_DESCRIPTION, pGroupAttributes->lpszTitle);
434
435 if (pGroupAttributes->format != Win_311)
436 {
438 }
439 else
440 {
441 EnableDlgItem(hDlg, PM_FILE, TRUE);
442 SetDlgItemTextW(hDlg, PM_FILE, pGroupAttributes->lpszGrpFile);
443 }
444
446 break;
447 }
448
449 case WM_COMMAND:
450 switch (LOWORD(wParam))
451 {
452 case IDHELP:
454 return TRUE;
455
456 case PM_DESCRIPTION:
457 {
458 if (HIWORD(wParam) == EN_CHANGE)
460 return FALSE;
461 }
462
463 case IDOK:
464 {
465 GetDlgItemTextW(hDlg, PM_DESCRIPTION, pGroupAttributes->lpszTitle, pGroupAttributes->nSize);
466 if (pGroupAttributes->format)
467 *pGroupAttributes->lpszGrpFile = '\0';
468 else
469 GetDlgItemTextW(hDlg, PM_FILE, pGroupAttributes->lpszGrpFile, pGroupAttributes->nSize);
470 EndDialog(hDlg, IDOK);
471 return TRUE;
472 }
473
474 case IDCANCEL:
475 EndDialog(hDlg, IDCANCEL);
476 return TRUE;
477 }
478 return FALSE;
479 }
480
481 return FALSE;
482}
struct _GROUP_ATTRIBUTES_CONTEXT * PGROUP_ATTRIBUTES_CONTEXT
#define PM_DESCRIPTION
Definition: resource.h:131
#define PM_FILE
Definition: resource.h:132
@ Win_311
Definition: progman.h:107
#define ENM_CHANGE
Definition: richedit.h:468
#define EM_GETEVENTMASK
Definition: richedit.h:92
#define EM_SETEVENTMASK
Definition: richedit.h:102
GROUPFORMAT format
Definition: dialog.c:405
#define EN_CHANGE
Definition: winuser.h:2025

Referenced by DIALOG_GroupAttributes().

◆ DIALOG_GroupAttributes()

BOOL DIALOG_GroupAttributes ( GROUPFORMAT  format,
LPWSTR  lpszTitle,
LPWSTR  lpszGrpFile,
INT  nSize 
)

Definition at line 484 of file dialog.c.

485{
486 INT_PTR ret;
487 GROUP_ATTRIBUTES_CONTEXT GroupAttributes;
488
489 GroupAttributes.format = format;
490 GroupAttributes.nSize = nSize;
491 GroupAttributes.lpszTitle = lpszTitle;
492 GroupAttributes.lpszGrpFile = lpszGrpFile;
493
495
496 return (ret == IDOK);
497}
static INT_PTR CALLBACK DIALOG_GROUP_DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:414
#define IDD_GROUP
Definition: resource.h:109
Definition: format.c:58
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2084

Referenced by GROUP_ModifyGroup(), and GROUP_NewGroup().

◆ DIALOG_New()

BOOL DIALOG_New ( INT  nDefault,
PINT  pnResult 
)

Definition at line 233 of file dialog.c.

234{
235 INT_PTR ret;
236 NEW_ITEM_CONTEXT NewItem;
237
238 *pnResult = 0;
239
240 NewItem.nDefault = nDefault;
241 NewItem.nResult = 0;
243 if (ret == IDOK)
244 *pnResult = NewItem.nResult;
245
246 return (ret == IDOK);
247}
static INT_PTR CALLBACK DIALOG_NEW_DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:149
#define IDD_NEW
Definition: resource.h:107

Referenced by MAIN_MenuCommand().

◆ DIALOG_NEW_DlgProc()

static INT_PTR CALLBACK DIALOG_NEW_DlgProc ( HWND  hDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 149 of file dialog.c.

150{
151 PNEW_ITEM_CONTEXT pNewItem;
153 INT iItem;
154
155 pNewItem = (PNEW_ITEM_CONTEXT)GetWindowLongPtrW(hDlg, 8);
156
157 switch (uMsg)
158 {
159 case WM_INITDIALOG:
160 {
161 pNewItem = (PNEW_ITEM_CONTEXT)lParam;
162 SetWindowLongPtrW(hDlg, 8, lParam);
163
164 for (format = Win_311; format <= NT_Unicode; ++format)
165 {
167 if (iItem != CB_ERR && iItem != CB_ERRSPACE)
169 }
170
174
176
177 SendMessageW(hDlg, WM_COMMAND, pNewItem->nDefault, 0);
178 break;
179 }
180
181 case WM_COMMAND:
182 switch (LOWORD(wParam))
183 {
184 case PM_NEW_GROUP:
185 {
191 return TRUE;
192 }
193
194 case PM_NEW_PROGRAM:
195 {
201 return TRUE;
202 }
203
204 case IDHELP:
206 return TRUE;
207
208 case IDOK:
209 {
210 iItem = SendDlgItemMessageW(hDlg, PM_FORMAT, CB_GETCURSEL, 0, 0);
211
214
215 pNewItem->nResult = !!IsDlgButtonChecked(hDlg, PM_NEW_GROUP);
216 pNewItem->nResult |= (!!IsDlgButtonChecked(hDlg, PM_COMMON_GROUP) << 1);
217 pNewItem->nResult |= (format << 2);
218
219 EndDialog(hDlg, IDOK);
220 return TRUE;
221 }
222
223 case IDCANCEL:
224 EndDialog(hDlg, IDCANCEL);
225 return TRUE;
226 }
227 return FALSE;
228 }
229
230 return FALSE;
231}
struct _NEW_ITEM_CONTEXT * PNEW_ITEM_CONTEXT
LPCWSTR GroupFormatToFormatName(GROUPFORMAT Format)
Definition: dialog.c:125
PROGGROUP * GROUP_ActiveGroup(VOID)
Definition: group.c:671
#define PM_FORMAT_TXT
Definition: resource.h:121
#define PM_NEW_PROGRAM
Definition: resource.h:118
#define PM_PERSONAL_GROUP
Definition: resource.h:119
#define PM_COMMON_GROUP
Definition: resource.h:120
#define PM_NEW_GROUP
Definition: resource.h:117
#define PM_FORMAT
Definition: resource.h:122
#define min(a, b)
Definition: monoChain.cc:55
@ NT_Unicode
Definition: progman.h:109
enum _GROUPFORMAT GROUPFORMAT
#define max(a, b)
Definition: svc.c:63
BOOL WINAPI CheckRadioButton(_In_ HWND, _In_ int, _In_ int, _In_ int)
#define CB_INSERTSTRING
Definition: winuser.h:1960
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by DIALOG_New().

◆ DIALOG_PROGRAM_DlgProc()

static INT_PTR CALLBACK DIALOG_PROGRAM_DlgProc ( HWND  hDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 723 of file dialog.c.

724{
727 DWORD evMask;
728 DWORD dwBinaryType;
729 PPROGRAM_ATTRIBUTES_CONTEXT pProgramAttributes;
730
731 pProgramAttributes = (PPROGRAM_ATTRIBUTES_CONTEXT)GetWindowLongPtrW(hDlg, 8);
732
733 switch (uMsg)
734 {
735 case WM_INITDIALOG:
736 {
737 pProgramAttributes = (PPROGRAM_ATTRIBUTES_CONTEXT)lParam;
738 SetWindowLongPtrW(hDlg, 8, lParam);
739
742
743 SetDlgItemTextW(hDlg, PM_DESCRIPTION , pProgramAttributes->lpszTitle);
744 SetDlgItemTextW(hDlg, PM_COMMAND_LINE, pProgramAttributes->lpszCmdLine);
745 SetDlgItemTextW(hDlg, PM_DIRECTORY , pProgramAttributes->lpszWorkDir);
746
747 /* 0x0F 0x06 */
749 SendDlgItemMessageW(hDlg, PM_HOT_KEY, HKM_SETHOTKEY, *pProgramAttributes->lpnHotKey, 0);
750
754
755 CheckDlgButton(hDlg, PM_SYMBOL, *pProgramAttributes->lpnCmdShow == SW_SHOWMINNOACTIVE);
756
757 if (pProgramAttributes->bCheckBinaryType &&
758 (!GetBinaryTypeW(pProgramAttributes->lpszCmdLine, &dwBinaryType) || dwBinaryType != SCS_WOW_BINARY) )
759 {
762 }
763 else
764 {
766 CheckDlgButton(hDlg, PM_NEW_VDM, *pProgramAttributes->lpbNewVDM);
767 }
768 SendDlgItemMessageW(hDlg, PM_ICON, STM_SETICON, (WPARAM)pProgramAttributes->hTmpIcon, 0);
769 break;
770 }
771
772 case WM_COMMAND:
773 switch (LOWORD(wParam))
774 {
775 case PM_NEW_VDM:
777 return TRUE;
778
779 case PM_BROWSE:
780 {
781 filename[0] = '\0';
783 {
785 if (pProgramAttributes->bCheckBinaryType &&
786 (!GetBinaryTypeW(filename, &dwBinaryType) || dwBinaryType != SCS_WOW_BINARY))
787 {
790 }
791 else
792 {
795 }
796 }
797 return TRUE;
798 }
799
800 case IDHELP:
802 return TRUE;
803
804 case PM_SYMBOL:
806 return TRUE;
807
808 case PM_OTHER_SYMBOL:
809 {
810 DIALOG_Symbol(hDlg,
811 &pProgramAttributes->hTmpIcon,
812 pProgramAttributes->lpszTmpIconFile,
813 &pProgramAttributes->nTmpIconIndex,
815
816 SendDlgItemMessageW(hDlg, PM_ICON, STM_SETICON, (WPARAM)pProgramAttributes->hTmpIcon, 0);
817 return TRUE;
818 }
819
820 case PM_COMMAND_LINE:
821 {
822 if (HIWORD(wParam) == EN_CHANGE)
823 {
827 }
828 return FALSE;
829 }
830
831 case IDOK:
832 {
833 GetDlgItemTextW(hDlg, PM_DESCRIPTION , pProgramAttributes->lpszTitle , pProgramAttributes->nSize);
834 GetDlgItemTextW(hDlg, PM_COMMAND_LINE, pProgramAttributes->lpszCmdLine, pProgramAttributes->nSize);
835 GetDlgItemTextW(hDlg, PM_DIRECTORY , pProgramAttributes->lpszWorkDir, pProgramAttributes->nSize);
836 if (pProgramAttributes->hTmpIcon)
837 {
838#if 0
839 if (*pProgramAttributes->lphIcon)
840 DestroyIcon(*pProgramAttributes->lphIcon);
841#endif
842 *pProgramAttributes->lphIcon = pProgramAttributes->hTmpIcon;
843 *pProgramAttributes->lpnIconIndex = pProgramAttributes->nTmpIconIndex;
844 lstrcpynW(pProgramAttributes->lpszIconFile, pProgramAttributes->lpszTmpIconFile, pProgramAttributes->nSize);
845 }
846 *pProgramAttributes->lpnHotKey = SendDlgItemMessageW(hDlg, PM_HOT_KEY, HKM_GETHOTKEY, 0, 0);
848 *pProgramAttributes->lpbNewVDM = IsDlgButtonChecked(hDlg, PM_NEW_VDM);
849 EndDialog(hDlg, IDOK);
850 return TRUE;
851 }
852
853 case IDCANCEL:
854 EndDialog(hDlg, IDCANCEL);
855 return TRUE;
856 }
857 return FALSE;
858 }
859
860 return FALSE;
861}
struct _PROGRAM_ATTRIBUTES_CONTEXT * PPROGRAM_ATTRIBUTES_CONTEXT
static VOID DIALOG_Symbol(HWND hWnd, HICON *lphIcon, LPWSTR lpszIconFile, INT *lpnIconIndex, INT nSize)
Definition: dialog.c:680
#define PM_DIRECTORY
Definition: resource.h:136
#define PM_ICON
Definition: resource.h:138
#define PM_COMMAND_LINE
Definition: resource.h:135
#define PM_OTHER_SYMBOL
Definition: resource.h:139
#define PM_HOT_KEY
Definition: resource.h:137
#define lstrcpynW
Definition: compat.h:738
unsigned int BOOL
Definition: ntddk_ex.h:94
const char * filename
Definition: ioapi.h:137
#define HKCOMB_S
Definition: commctrl.h:2228
#define HKCOMB_A
Definition: commctrl.h:2230
#define HKCOMB_C
Definition: commctrl.h:2229
#define HOTKEYF_CONTROL
Definition: commctrl.h:2224
#define HKM_SETHOTKEY
Definition: commctrl.h:2236
#define HKM_SETRULES
Definition: commctrl.h:2238
#define HKCOMB_NONE
Definition: commctrl.h:2227
#define HKM_GETHOTKEY
Definition: commctrl.h:2237
#define HOTKEYF_ALT
Definition: commctrl.h:2225
_In_ BOOL bEnable
Definition: winddi.h:3426
UINT_PTR WPARAM
Definition: windef.h:207
#define STM_SETICON
Definition: winuser.h:2095
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)

Referenced by DIALOG_ProgramAttributes().

◆ DIALOG_ProgramAttributes()

BOOL DIALOG_ProgramAttributes ( LPWSTR  lpszTitle,
LPWSTR  lpszCmdLine,
LPWSTR  lpszWorkDir,
LPWSTR  lpszIconFile,
HICON lphIcon,
INT lpnIconIndex,
INT lpnHotKey,
INT lpnCmdShow,
BOOL lpbNewVDM,
INT  nSize 
)

Definition at line 864 of file dialog.c.

866{
867 INT_PTR ret;
868 WCHAR szTmpIconFile[MAX_PATHNAME_LEN];
869 PROGRAM_ATTRIBUTES_CONTEXT ProgramAttributes;
871 DWORD dwType;
872
873 ProgramAttributes.nSize = nSize;
874 ProgramAttributes.lpszTitle = lpszTitle;
875 ProgramAttributes.lpszCmdLine = lpszCmdLine;
876 ProgramAttributes.lpszWorkDir = lpszWorkDir;
877 ProgramAttributes.lpszIconFile = lpszIconFile;
878 ProgramAttributes.lpnCmdShow = lpnCmdShow;
879 ProgramAttributes.lpnHotKey = lpnHotKey;
880 ProgramAttributes.lpbNewVDM = lpbNewVDM;
881 ProgramAttributes.lphIcon = lphIcon;
882 ProgramAttributes.lpnIconIndex = lpnIconIndex;
883
884 dwSize = sizeof(ProgramAttributes.bCheckBinaryType);
885 if (RegQueryValueExW(Globals.hKeyPMSettings,
886 L"CheckBinaryType",
887 0,
888 &dwType,
889 (LPBYTE)&ProgramAttributes.bCheckBinaryType,
891 || dwType != REG_DWORD)
892 {
893 ProgramAttributes.bCheckBinaryType = TRUE;
894 }
895
896#if 0
897 ProgramAttributes.hTmpIcon = NULL;
898#else
899 ProgramAttributes.hTmpIcon = *lphIcon;
900#endif
901 ProgramAttributes.nTmpIconIndex = *lpnIconIndex;
902 ProgramAttributes.lpszTmpIconFile = szTmpIconFile;
903 wcsncpy(szTmpIconFile, lpszIconFile, ARRAYSIZE(szTmpIconFile));
904
906 return (ret == IDOK);
907}
static INT_PTR CALLBACK DIALOG_PROGRAM_DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:723
#define IDD_PROGRAM
Definition: resource.h:110
_CRTIMP wchar_t *__cdecl wcsncpy(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)

Referenced by PROGRAM_ModifyProgram(), and PROGRAM_NewProgram().

◆ DIALOG_Symbol()

static VOID DIALOG_Symbol ( HWND  hWnd,
HICON lphIcon,
LPWSTR  lpszIconFile,
INT lpnIconIndex,
INT  nSize 
)
static

Definition at line 680 of file dialog.c.

681{
682 PICK_ICON_CONTEXT IconContext;
683
684 IconContext.Index = *lpnIconIndex;
685 StringCchCopyNW(IconContext.szName, ARRAYSIZE(IconContext.szName), lpszIconFile, nSize);
686
688 return;
689
690 StringCchCopyNW(lpszIconFile, nSize, IconContext.szName, ARRAYSIZE(IconContext.szName));
691 *lpnIconIndex = IconContext.Index;
692 *lphIcon = IconContext.hIcon;
693}
static INT_PTR CALLBACK DIALOG_SYMBOL_DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:571
#define IDD_SYMBOL
Definition: resource.h:111
STRSAFEAPI StringCchCopyNW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc, size_t cchToCopy)
Definition: strsafe.h:236

Referenced by DIALOG_PROGRAM_DlgProc().

◆ DIALOG_SYMBOL_DlgProc()

static INT_PTR CALLBACK DIALOG_SYMBOL_DlgProc ( HWND  hDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 571 of file dialog.c.

572{
574 PPICK_ICON_CONTEXT pIconContext;
575
576 pIconContext = (PPICK_ICON_CONTEXT)GetWindowLongPtrW(hDlg, 8);
577
578 switch (uMsg)
579 {
580 case WM_INITDIALOG:
581 {
582 pIconContext = (PPICK_ICON_CONTEXT)lParam;
583 SetWindowLongPtrW(hDlg, 8, lParam);
584
585 pIconContext->hDlgCtrl = GetDlgItem(hDlg, PM_SYMBOL_LIST);
586 SetDlgItemTextW(hDlg, PM_ICON_FILE, pIconContext->szName);
587 SendMessageA(pIconContext->hDlgCtrl, LB_SETITEMHEIGHT, 0, 32);
588
589 pIconContext->hLibrary = LoadLibraryExW(pIconContext->szName, NULL, /* NT6+: LOAD_LIBRARY_AS_IMAGE_RESOURCE | */ LOAD_LIBRARY_AS_DATAFILE);
590 if (pIconContext->hLibrary)
591 {
592 EnumResourceNamesW(pIconContext->hLibrary,
595 (LONG_PTR)pIconContext->hDlgCtrl);
596 FreeLibrary(pIconContext->hLibrary);
597 pIconContext->hLibrary = NULL;
598 }
599 SendMessageA(pIconContext->hDlgCtrl, LB_SETCURSEL, pIconContext->Index, 0);
600 return TRUE;
601 }
602
603 case WM_MEASUREITEM:
604 {
606 measure->itemWidth = 32;
607 measure->itemHeight = 32;
608 return TRUE;
609 }
610
611 case WM_DRAWITEM:
612 {
614
615 if (dis->itemState & ODS_SELECTED)
616 FillRect(dis->hDC, &dis->rcItem, (HBRUSH)(COLOR_HIGHLIGHT + 1));
617 else
618 FillRect(dis->hDC, &dis->rcItem, (HBRUSH)(COLOR_WINDOW + 1));
619
620 DrawIcon(dis->hDC, dis->rcItem.left, dis->rcItem.top, (HICON)dis->itemData);
621 return TRUE;
622 }
623
624 case WM_COMMAND:
625 switch (LOWORD(wParam))
626 {
627 case PM_BROWSE:
628 {
629 filename[0] = '\0';
631 return TRUE;
632
633 if (_wcsnicmp(pIconContext->szName, filename, ARRAYSIZE(pIconContext->szName)) == 0)
634 return TRUE;
635
637 DestroyIconList(pIconContext->hDlgCtrl);
638 pIconContext->hLibrary = LoadLibraryExW(filename, NULL, /* NT6+: LOAD_LIBRARY_AS_IMAGE_RESOURCE | */ LOAD_LIBRARY_AS_DATAFILE);
639 if (pIconContext->hLibrary)
640 {
641 EnumResourceNamesW(pIconContext->hLibrary,
644 (LONG_PTR)pIconContext->hDlgCtrl);
645 FreeLibrary(pIconContext->hLibrary);
646 pIconContext->hLibrary = NULL;
647 }
648 SendMessageA(pIconContext->hDlgCtrl, LB_SETCURSEL, 0, 0);
649 return TRUE;
650 }
651
652 case IDHELP:
654 return TRUE;
655
656 case IDOK:
657 {
658 INT nCurSel = SendMessageW(pIconContext->hDlgCtrl, LB_GETCURSEL, 0, 0);
659 GetDlgItemTextW(hDlg, PM_ICON_FILE, pIconContext->szName, ARRAYSIZE(pIconContext->szName));
660 pIconContext->hIcon = (HICON)SendMessageA(pIconContext->hDlgCtrl, LB_GETITEMDATA, nCurSel, 0);
661 pIconContext->hIcon = CopyIcon(pIconContext->hIcon);
662 DestroyIconList(pIconContext->hDlgCtrl);
663 EndDialog(hDlg, IDOK);
664 return TRUE;
665 }
666
667 case IDCANCEL:
668 DestroyIconList(pIconContext->hDlgCtrl);
669 EndDialog(hDlg, IDCANCEL);
670 return TRUE;
671 }
672 return FALSE;
673 }
674
675 return FALSE;
676}
static BOOL CALLBACK EnumPickIconResourceProc(HMODULE hModule, LPCWSTR lpszType, LPWSTR lpszName, LONG_PTR lParam)
Definition: dialog.c:509
static VOID DestroyIconList(HWND hDlgCtrl)
Definition: dialog.c:530
struct _PICK_ICON_CONTEXT * PPICK_ICON_CONTEXT
static BOOL DIALOG_BrowseSymbols(HWND hWnd, LPWSTR lpszFile, INT nMaxFile)
Definition: dialog.c:104
#define PM_SYMBOL_LIST
Definition: resource.h:143
#define PM_ICON_FILE
Definition: resource.h:142
#define FreeLibrary(x)
Definition: compat.h:748
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
Definition: loader.c:288
BOOL WINAPI EnumResourceNamesW(HMODULE hmod, LPCWSTR type, ENUMRESNAMEPROCW lpfun, LONG_PTR lparam)
Definition: res.c:358
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define RT_GROUP_ICON
Definition: pedump.c:375
_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)
HMODULE hLibrary
Definition: dialog.c:549
WCHAR szName[MAX_PATH]
Definition: dialog.c:551
ULONG_PTR itemData
Definition: winuser.h:3096
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
#define LOAD_LIBRARY_AS_DATAFILE
Definition: winbase.h:342
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
#define ODS_SELECTED
Definition: winuser.h:2548
#define COLOR_WINDOW
Definition: winuser.h:921
#define COLOR_HIGHLIGHT
Definition: winuser.h:929
BOOL WINAPI DrawIcon(_In_ HDC, _In_ int, _In_ int, _In_ HICON)
Definition: cursoricon.c:2062
HICON WINAPI CopyIcon(_In_ HICON)
Definition: cursoricon.c:2055
#define WM_DRAWITEM
Definition: winuser.h:1648
#define LB_SETITEMHEIGHT
Definition: winuser.h:2069
#define WM_MEASUREITEM
Definition: winuser.h:1649
struct tagMEASUREITEMSTRUCT * PMEASUREITEMSTRUCT
struct tagDRAWITEMSTRUCT * PDRAWITEMSTRUCT
#define LB_SETCURSEL
Definition: winuser.h:2066
#define LB_GETCURSEL
Definition: winuser.h:2042
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by DIALOG_Symbol().

◆ EnumPickIconResourceProc()

static BOOL CALLBACK EnumPickIconResourceProc ( HMODULE  hModule,
LPCWSTR  lpszType,
LPWSTR  lpszName,
LONG_PTR  lParam 
)
static

Definition at line 509 of file dialog.c.

510{
511 HICON hIcon;
512 HWND hDlgCtrl = (HWND)lParam;
513 WCHAR szName[100];
514
515 if (IS_INTRESOURCE(lpszName))
516 StringCbPrintfW(szName, sizeof(szName), L"%u", (unsigned)(UINT_PTR)lpszName);
517 else
518 StringCbCopyW(szName, sizeof(szName), lpszName);
519
520 hIcon = (HICON)LoadImageW(hModule, lpszName, IMAGE_ICON, 32, 32, LR_DEFAULTCOLOR);
521 if (hIcon == NULL)
522 return TRUE;
523
524 SendMessageW(hDlgCtrl, LB_ADDSTRING, 0, (LPARAM)hIcon);
525 return TRUE;
526}
HMODULE hModule
Definition: animate.c:44
HANDLE HWND
Definition: compat.h:19
static unsigned(__cdecl *hash_bstr)(bstr_t s)
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
static const WCHAR szName[]
Definition: powrprof.c:45
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:166
STRSAFEAPI StringCbPrintfW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:557
#define IMAGE_ICON
Definition: winuser.h:212
#define IS_INTRESOURCE(i)
Definition: winuser.h:580
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE hInst, _In_ LPCWSTR name, _In_ UINT type, _In_ int cx, _In_ int cy, _In_ UINT fuLoad)
Definition: cursoricon.c:2247
#define LB_ADDSTRING
Definition: winuser.h:2034
#define LR_DEFAULTCOLOR
Definition: winuser.h:1090

Referenced by DIALOG_SYMBOL_DlgProc().

◆ GroupFormatToFormatName()

LPCWSTR GroupFormatToFormatName ( GROUPFORMAT  Format)

Definition at line 125 of file dialog.c.

126{
127 static const LPCWSTR FormatNames[] =
128 {
129 L"Windows 3.1",
130 L"NT Ansi",
131 L"NT Unicode"
132 };
133
134 if (Format > NT_Unicode)
135 return NULL;
136 else
137 return FormatNames[Format];
138}

Referenced by DIALOG_NEW_DlgProc().

◆ ValidateEditContents()

BOOL ValidateEditContents ( HWND  hDlg,
INT  nIDEditItem 
)

Definition at line 368 of file dialog.c.

369{
370 BOOL Enable = FALSE;
371 LPWSTR psz;
372 INT Length, n;
373 HWND Edit;
374
375 Edit = GetDlgItem(hDlg, nIDEditItem);
377
378 if (Length <= 0)
379 return FALSE;
380
381 psz = Alloc(0, (Length + 1) * sizeof(WCHAR));
382 if (psz)
383 {
384 GetWindowTextW(Edit, psz, Length + 1);
385 for (n = 0; n < Length && !Enable; ++n)
386 Enable = (psz[n] != ' ');
387 Free(psz);
388 }
389 else
390 {
391 Enable = TRUE;
392 }
393
394 return Enable;
395}
PVOID Alloc(IN DWORD dwFlags, IN SIZE_T dwBytes)
Definition: main.c:63
GLdouble n
Definition: glext.h:7729
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:142
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1384
int WINAPI GetWindowTextLengthW(_In_ HWND)
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION Free
Definition: exfuncs.h:815

Referenced by DIALOG_EXECUTE_DlgProc(), DIALOG_GROUP_DlgProc(), and DIALOG_PROGRAM_DlgProc().