ReactOS 0.4.15-dev-8102-g108db8f
progman.h File Reference
#include <stdio.h>
#include <stdlib.h>
#include <windef.h>
#include <winbase.h>
#include <winreg.h>
#include <wingdi.h>
#include <winuser.h>
#include <shellapi.h>
#include <commctrl.h>
#include <richedit.h>
#include <windowsx.h>
#include <strsafe.h>
#include "resource.h"
Include dependency graph for progman.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _PROGRAM
 
struct  _PROGGROUP
 
struct  _GLOBALS
 

Macros

#define WIN32_NO_STATUS
 
#define MAX_STRING_LEN   255
 
#define MAX_PATHNAME_LEN   1024
 
#define MAX_LANGUAGE_NUMBER   (PM_LAST_LANGUAGE - PM_FIRST_LANGUAGE)
 
#define DEFAULTICON   OIC_WINLOGO
 
#define DEF_GROUP_WIN_XPOS   100
 
#define DEF_GROUP_WIN_YPOS   100
 
#define DEF_GROUP_WIN_WIDTH   300
 
#define DEF_GROUP_WIN_HEIGHT   200
 
#define EnableDlgItem(hDlg, nID, bEnable)    EnableWindow(GetDlgItem((hDlg), (nID)), (bEnable))
 
#define STRING_MAIN_WIN_CLASS_NAME   L"PMMain"
 
#define STRING_GROUP_WIN_CLASS_NAME   L"PMGroup"
 

Typedefs

typedef struct _PROGRAM PROGRAM
 
typedef struct _PROGRAMPPROGRAM
 
typedef struct _PROGGROUP PROGGROUP
 
typedef struct _PROGGROUPPPROGGROUP
 
typedef enum _GROUPFORMAT GROUPFORMAT
 
typedef struct _GLOBALS GLOBALS
 
typedef struct _GLOBALSPGLOBALS
 

Enumerations

enum  _GROUPFORMAT { Win_311 = 0x0 , NT_Ansi = 0x1 , NT_Unicode = 0x2 }
 

Functions

PVOID Alloc (IN DWORD dwFlags, IN SIZE_T dwBytes)
 
BOOL Free (IN PVOID lpMem)
 
PVOID ReAlloc (IN DWORD dwFlags, IN PVOID lpMem, IN SIZE_T dwBytes)
 
PVOID AppendToBuffer (IN PVOID pBuffer, IN PSIZE_T pdwBufferSize, IN PVOID pData, IN SIZE_T dwDataSize)
 
INT MAIN_MessageBoxIDS (UINT ids_text, UINT ids_title, WORD type)
 
INT MAIN_MessageBoxIDS_s (UINT ids_text, LPCWSTR str, UINT ids_title, WORD type)
 
VOID MAIN_ReplaceString (LPWSTR *string, LPWSTR replace)
 
DWORD GRPFILE_ReadGroupFile (LPCWSTR lpszPath, BOOL bIsCommonGroup)
 
BOOL GRPFILE_WriteGroupFile (PROGGROUP *hGroup)
 
ATOM GROUP_RegisterGroupWinClass (VOID)
 
PROGGROUPGROUP_AddGroup (GROUPFORMAT format, BOOL bIsCommonGroup, LPCWSTR lpszName, LPCWSTR lpszGrpFile, INT left, INT top, INT right, INT bottom, INT xMin, INT yMin, INT nCmdShow, WORD cxIcon, WORD cyIcon, BOOL bOverwriteFileOk, BOOL bSuppressShowWindow)
 
VOID GROUP_NewGroup (GROUPFORMAT format, BOOL bIsCommonGroup)
 
VOID GROUP_ModifyGroup (PROGGROUP *hGroup)
 
VOID GROUP_DeleteGroup (PROGGROUP *hGroup)
 
VOID GROUP_ShowGroupWindow (PROGGROUP *hGroup)
 
PROGGROUPGROUP_ActiveGroup (VOID)
 
PROGRAMPROGRAM_AddProgram (PROGGROUP *hGroup, HICON hIcon, LPCWSTR lpszName, INT x, INT y, LPCWSTR lpszCmdLine, LPCWSTR lpszIconFile, INT nIconIndex, LPCWSTR lpszWorkDir, INT nHotKey, INT nCmdShow, BOOL bNewVDM)
 
VOID PROGRAM_NewProgram (PROGGROUP *hGroup)
 
VOID PROGRAM_ModifyProgram (PROGRAM *hProgram)
 
VOID PROGRAM_CopyMoveProgram (PROGRAM *hProgram, BOOL bMove)
 
VOID PROGRAM_DeleteProgram (PROGRAM *hProgram, BOOL bUpdateGrpFile)
 
VOID PROGRAM_ExecuteProgram (PROGRAM *hProgram)
 
PROGRAMPROGRAM_ActiveProgram (PROGGROUP *hGroup)
 
BOOL DIALOG_New (INT nDefault, PINT pnResult)
 
PROGGROUPDIALOG_CopyMove (PROGRAM *hProgram, BOOL bMove)
 
BOOL DIALOG_Delete (UINT ids_text_s, LPCWSTR lpszName)
 
BOOL DIALOG_GroupAttributes (GROUPFORMAT format, LPWSTR lpszTitle, LPWSTR lpszGrpFile, INT nSize)
 
BOOL DIALOG_ProgramAttributes (LPWSTR lpszTitle, LPWSTR lpszCmdLine, LPWSTR lpszWorkDir, LPWSTR lpszIconFile, HICON *lphIcon, INT *lpnIconIndex, INT *lpnHotKey, INT *lpnCmdShow, BOOL *lpbNewVDM, INT nSize)
 
VOID DIALOG_Execute (VOID)
 
VOID STRING_LoadStrings (VOID)
 
VOID STRING_LoadMenus (VOID)
 

Variables

GLOBALS Globals
 
WCHAR szTitle [256]
 

Macro Definition Documentation

◆ DEF_GROUP_WIN_HEIGHT

#define DEF_GROUP_WIN_HEIGHT   200

Definition at line 65 of file progman.h.

◆ DEF_GROUP_WIN_WIDTH

#define DEF_GROUP_WIN_WIDTH   300

Definition at line 64 of file progman.h.

◆ DEF_GROUP_WIN_XPOS

#define DEF_GROUP_WIN_XPOS   100

Definition at line 62 of file progman.h.

◆ DEF_GROUP_WIN_YPOS

#define DEF_GROUP_WIN_YPOS   100

Definition at line 63 of file progman.h.

◆ DEFAULTICON

#define DEFAULTICON   OIC_WINLOGO

Definition at line 60 of file progman.h.

◆ EnableDlgItem

#define EnableDlgItem (   hDlg,
  nID,
  bEnable 
)     EnableWindow(GetDlgItem((hDlg), (nID)), (bEnable))

Definition at line 71 of file progman.h.

◆ MAX_LANGUAGE_NUMBER

#define MAX_LANGUAGE_NUMBER   (PM_LAST_LANGUAGE - PM_FIRST_LANGUAGE)

Definition at line 55 of file progman.h.

◆ MAX_PATHNAME_LEN

#define MAX_PATHNAME_LEN   1024

Definition at line 54 of file progman.h.

◆ MAX_STRING_LEN

#define MAX_STRING_LEN   255

Definition at line 53 of file progman.h.

◆ STRING_GROUP_WIN_CLASS_NAME

#define STRING_GROUP_WIN_CLASS_NAME   L"PMGroup"

Definition at line 252 of file progman.h.

◆ STRING_MAIN_WIN_CLASS_NAME

#define STRING_MAIN_WIN_CLASS_NAME   L"PMMain"

Definition at line 251 of file progman.h.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 38 of file progman.h.

Typedef Documentation

◆ GLOBALS

◆ GROUPFORMAT

◆ PGLOBALS

◆ PPROGGROUP

Definition at line 79 of file progman.h.

◆ PPROGRAM

Definition at line 78 of file progman.h.

◆ PROGGROUP

Definition at line 79 of file progman.h.

◆ PROGRAM

Definition at line 78 of file progman.h.

Enumeration Type Documentation

◆ _GROUPFORMAT

Enumerator
Win_311 
NT_Ansi 
NT_Unicode 

Definition at line 105 of file progman.h.

106{
107 Win_311 = 0x0,
108 NT_Ansi = 0x1, // 0x02
109 NT_Unicode = 0x2, // 0x03
@ NT_Ansi
Definition: progman.h:108
@ NT_Unicode
Definition: progman.h:109
@ Win_311
Definition: progman.h:107
enum _GROUPFORMAT GROUPFORMAT

Function Documentation

◆ Alloc()

PVOID Alloc ( IN DWORD  dwFlags,
IN SIZE_T  dwBytes 
)

Definition at line 63 of file main.c.

65{
66 return HeapAlloc(GetProcessHeap(), dwFlags, dwBytes);
67}
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176

Referenced by AppendToBuffer(), COMBOEX_Create(), COMBOEX_NotifyItem(), CompareFileName(), create_taskdialog_template(), CreatePropertySheetPageA(), CreatePropertySheetPageW(), DATETIME_Create(), DATETIME_SetFormatA(), DPA_CreateEx(), DrawStatusTextA(), DSA_Create(), Ext2MapExtent(), GetUserAndDomainName(), GROUP_AddGroup(), heap_strdupAtoW(), heap_strdupW(), InitFunctionPtrs(), FxLookasideList::InitObjectAlloc(), FxPagedLookasideListFromPool::InitPagedAlloc(), LISTVIEW_EndEditLabelT(), LISTVIEW_InsertColumnT(), LISTVIEW_InsertItemT(), LISTVIEW_NCCreate(), load_string(), MAIN_LoadSettings(), MAIN_ReplaceString(), MAIN_SetMainWindowTitle(), MakeDragList(), NATIVEFONT_Create(), notify_dispinfoT(), PROGRAM_AddProgram(), PropertySheetA(), PropertySheetW(), PROPSHEET_CollectSheetInfoA(), PROPSHEET_CreateDialog(), PROPSHEET_CreatePage(), PROPSHEET_DialogProc(), PROPSHEET_InsertPage(), PROPSHEET_RemovePage(), PROPSHEET_SetTitleW(), ranges_add(), ranges_clone(), ranges_create(), ranges_del(), REBAR_InsertBandT(), REBAR_NCCreate(), set_sub_item(), SetWindowSubclass(), STATUSBAR_SetParts(), STATUSBAR_SetTextT(), STATUSBAR_WMCreate(), STATUSBAR_WMSetText(), SYSLINK_AppendDocItem(), SYSLINK_ParseText(), SYSLINK_SetItem(), SysLinkWindowProc(), TAB_Create(), TAB_InsertItemT(), taskdialog_add_buttons(), taskdialog_add_control(), textdupTtoW(), TOOLBAR_Cust_AddButton(), TOOLBAR_CustomizeDialogProc(), TOOLBAR_DeleteButton(), TOOLBAR_InsertImageList(), TOOLBAR_NCCreate(), TOOLBAR_Restore(), TOOLBAR_Save(), TOOLBAR_SaveRestoreA(), TOOLBAR_TTGetDispInfo(), TOOLTIPS_AddToolT(), TOOLTIPS_Create(), TOOLTIPS_DelToolT(), TOOLTIPS_SetTitleT(), TOOLTIPS_SetToolInfoT(), TOOLTIPS_UpdateTipTextT(), TRACKBAR_Create(), UDFBuildLongAllocDescs(), UDFBuildShortAllocDescs(), and ValidateEditContents().

◆ AppendToBuffer()

PVOID AppendToBuffer ( IN PVOID  pBuffer,
IN PSIZE_T  pdwBufferSize,
IN PVOID  pData,
IN SIZE_T  dwDataSize 
)

Definition at line 84 of file main.c.

88{
89 PVOID pTmp;
90 SIZE_T dwBufferSize;
91
92 dwBufferSize = dwDataSize + *pdwBufferSize;
93
94 if (pBuffer)
95 pTmp = ReAlloc(0, pBuffer, dwBufferSize);
96 else
97 pTmp = Alloc(0, dwBufferSize);
98
99 if (!pTmp)
100 return NULL;
101
102 memcpy((PVOID)((ULONG_PTR)pTmp + *pdwBufferSize), pData, dwDataSize);
103 *pdwBufferSize = dwBufferSize;
104
105 return pTmp;
106}
PVOID ReAlloc(IN DWORD dwFlags, IN PVOID lpMem, IN SIZE_T dwBytes)
Definition: main.c:76
PVOID Alloc(IN DWORD dwFlags, IN SIZE_T dwBytes)
Definition: main.c:63
#define NULL
Definition: types.h:112
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
PVOID pBuffer
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1830
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint32_t ULONG_PTR
Definition: typedefs.h:65

◆ 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
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
HINSTANCE hInstance
Definition: precomp.h:43
PROGRAM * Program
Definition: dialog.c:257
PROGGROUP * hToGroup
Definition: dialog.c:258
int32_t INT_PTR
Definition: typedefs.h:64
int ret
LONG_PTR LPARAM
Definition: windef.h:208
#define IDOK
Definition: winuser.h:830
#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:817
#define MB_DEFBUTTON2
Definition: winuser.h:799
#define IDYES
Definition: winuser.h:835

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
#define TRUE
Definition: types.h:120
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
#define L(x)
Definition: ntvdm.h:50
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_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
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
GROUPFORMAT format
Definition: dialog.c:405
*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_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
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define MAX_PATHNAME_LEN
Definition: progman.h:54
_CRTIMP wchar_t *__cdecl wcsncpy(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by PROGRAM_ModifyProgram(), and PROGRAM_NewProgram().

◆ Free()

BOOL Free ( IN PVOID  lpMem)

Definition at line 70 of file main.c.

71{
72 return HeapFree(GetProcessHeap(), 0, lpMem);
73}
#define HeapFree(x, y, z)
Definition: compat.h:735

◆ GROUP_ActiveGroup()

PROGGROUP * GROUP_ActiveGroup ( VOID  )

Definition at line 671 of file group.c.

672{
673 return Globals.hActiveGroup;
674}

Referenced by DIALOG_NEW_DlgProc(), MAIN_MainWndProc(), and MAIN_MenuCommand().

◆ GROUP_AddGroup()

PROGGROUP * GROUP_AddGroup ( GROUPFORMAT  format,
BOOL  bIsCommonGroup,
LPCWSTR  lpszName,
LPCWSTR  lpszGrpFile,
INT  left,
INT  top,
INT  right,
INT  bottom,
INT  xMin,
INT  yMin,
INT  nCmdShow,
WORD  cxIcon,
WORD  cyIcon,
BOOL  bOverwriteFileOk,
BOOL  bSuppressShowWindow 
)

Definition at line 435 of file group.c.

440{
441 PROGGROUP* hGroup;
442 PROGGROUP* hPrior;
443 PROGGROUP** p;
444 LPWSTR hName;
445 LPWSTR hGrpFile;
446 LPCWSTR GroupFileName;
447 INT skip;
448 INT width;
449 INT height;
450 INT seqnum;
452 WINDOWPLACEMENT WndPl;
453
454 WndPl.length = sizeof(WndPl);
455
456 // FIXME: Use system default position in case we don't place the window at a given (x,y) coordinate.
457
458 if (bIsCommonGroup)
459 {
460 if (swscanf(lpszGrpFile,
461 L"%d %d %d %d %d %d %d %n",
462 &WndPl.rcNormalPosition.left,
463 &WndPl.rcNormalPosition.top,
464 &WndPl.rcNormalPosition.right,
466 &WndPl.ptMinPosition.x,
467 &WndPl.ptMinPosition.y,
468 &WndPl.showCmd,
469 &skip) == 7)
470 {
474 GroupFileName = &lpszGrpFile[skip];
475 }
476 else
477 {
478#if 0 // FIXME!
481 WndPl.rcNormalPosition.right = 0;
482 WndPl.rcNormalPosition.bottom = 0;
485 WndPl.showCmd = SW_SHOWNORMAL;
486 GroupFileName = lpszGrpFile;
487#else
489 WndPl.ptMinPosition.x = xMin;
490 WndPl.ptMinPosition.y = yMin;
491 WndPl.rcNormalPosition.left = left;
492 WndPl.rcNormalPosition.top = top;
495 width = right - left;
496 height = bottom - top;
497 WndPl.showCmd = nCmdShow;
498 GroupFileName = lpszGrpFile;
499#endif
500 }
501 }
502 else
503 {
505 WndPl.ptMinPosition.x = xMin;
506 WndPl.ptMinPosition.y = yMin;
507 WndPl.rcNormalPosition.left = left;
508 WndPl.rcNormalPosition.top = top;
511 width = right - left;
512 height = bottom - top;
513 WndPl.showCmd = nCmdShow;
514 GroupFileName = lpszGrpFile;
515 }
516
517 hGroup = Alloc(HEAP_ZERO_MEMORY, sizeof(*hGroup));
518 hName = Alloc(HEAP_ZERO_MEMORY, (wcslen(lpszName) + 1) * sizeof(WCHAR));
519 hGrpFile = Alloc(HEAP_ZERO_MEMORY, (wcslen(GroupFileName) + 1) * sizeof(WCHAR));
520 if (!hGroup || !hName || !hGrpFile)
521 {
523 if (hGroup) Free(hGroup);
524 if (hName) Free(hName);
525 if (hGrpFile) Free(hGrpFile);
526 return NULL;
527 }
528 memcpy(hName , lpszName , (wcslen(lpszName) + 1) * sizeof(WCHAR));
529 memcpy(hGrpFile, GroupFileName, (wcslen(GroupFileName) + 1) * sizeof(WCHAR));
530
531 Globals.hActiveGroup = hGroup;
532
533 seqnum = 1;
534 hPrior = NULL;
535 for (p = &Globals.hGroups; *p; p = &hPrior->hNext)
536 {
537 hPrior = *p;
538 if (hPrior->seqnum >= seqnum)
539 seqnum = hPrior->seqnum + 1;
540 }
541 *p = hGroup;
542
543 hGroup->hPrior = hPrior;
544 hGroup->hNext = NULL;
545 hGroup->format = format;
546 hGroup->bIsCommonGroup = bIsCommonGroup;
547 hGroup->hName = hName;
548 hGroup->hGrpFile = hGrpFile;
549 hGroup->bOverwriteFileOk = bOverwriteFileOk;
550 hGroup->seqnum = seqnum;
551 hGroup->nCmdShow = nCmdShow;
552#if 0
553 hGroup->x = x;
554 hGroup->y = y;
555 hGroup->width = width;
556 hGroup->height = height;
557#endif
558 hGroup->iconx = cxIcon;
559 hGroup->icony = cyIcon;
560 hGroup->hPrograms = NULL;
561 hGroup->hActiveProgram = NULL;
562 hGroup->TagsSize = 0;
563 hGroup->Tags = NULL;
564
566 mcs.szTitle = lpszName;
567 mcs.hOwner = NULL;
568 mcs.x = WndPl.rcNormalPosition.left;
569 mcs.y = WndPl.rcNormalPosition.top;
570 mcs.cx = width;
571 mcs.cy = height;
572 mcs.style = 0;
573 mcs.lParam = (LPARAM)hGroup;
574
575 hGroup->hWnd = (HWND)SendMessageW(Globals.hMDIWnd, WM_MDICREATE, 0, (LPARAM)&mcs);
576
577 SetWindowPlacement(hGroup->hWnd, &WndPl);
578
579#if 1
580 if (!bSuppressShowWindow) /* FIXME shouldn't be necessary */
581#endif
582 UpdateWindow(hGroup->hWnd);
583
584 return hGroup;
585}
static struct myctx * mcs
Definition: adnstest.c:53
#define skip(...)
Definition: atltest.h:64
#define IDS_ERROR
Definition: resource.h:18
#define IDS_OUT_OF_MEMORY
Definition: resource.h:5
INT MAIN_MessageBoxIDS(UINT ids_text, UINT ids_title, WORD type)
Definition: main.c:1159
HANDLE HWND
Definition: compat.h:19
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
GLdouble GLdouble right
Definition: glext.h:10859
GLint left
Definition: glext.h:7726
GLint GLint bottom
Definition: glext.h:7726
GLfloat GLfloat p
Definition: glext.h:8902
_Check_return_ _CRTIMP int __cdecl swscanf(_In_z_ const wchar_t *_Src, _In_z_ _Scanf_format_string_ const wchar_t *_Format,...)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define STRING_GROUP_WIN_CLASS_NAME
Definition: progman.h:252
INT nCmdShow
Definition: progman.h:131
PROGRAM * hPrograms
Definition: progman.h:139
INT seqnum
Definition: progman.h:130
BOOL bOverwriteFileOk
Definition: progman.h:128
PROGRAM * hActiveProgram
Definition: progman.h:140
INT height
Definition: progman.h:135
INT width
Definition: progman.h:134
BOOL bIsCommonGroup
Definition: progman.h:126
LPWSTR hName
Definition: progman.h:138
INT iconx
Definition: progman.h:136
HWND hWnd
Definition: progman.h:116
PVOID Tags
Definition: progman.h:143
PROGGROUP * hPrior
Definition: progman.h:114
GROUPFORMAT format
Definition: progman.h:125
INT icony
Definition: progman.h:137
PROGGROUP * hNext
Definition: progman.h:115
SIZE_T TagsSize
Definition: progman.h:142
LPWSTR hGrpFile
Definition: progman.h:129
RECT rcNormalPosition
Definition: winuser.h:3295
POINT ptMinPosition
Definition: winuser.h:3293
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
int32_t INT
Definition: typedefs.h:58
#define SW_SHOWNORMAL
Definition: winuser.h:770
#define WM_MDICREATE
Definition: winuser.h:1812
BOOL WINAPI UpdateWindow(_In_ HWND)
#define MB_OK
Definition: winuser.h:790
#define CW_USEDEFAULT
Definition: winuser.h:225
BOOL WINAPI SetWindowPlacement(_In_ HWND hWnd, _In_ const WINDOWPLACEMENT *)
#define WPF_SETMINPOSITION
Definition: winuser.h:2533
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION Free
Definition: exfuncs.h:815
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by GROUP_NewGroup().

◆ GROUP_DeleteGroup()

VOID GROUP_DeleteGroup ( PROGGROUP hGroup)

Definition at line 627 of file group.c.

628{
629 if (Globals.hActiveGroup == hGroup)
630 Globals.hActiveGroup = NULL;
631
632 if (hGroup->hPrior)
633 hGroup->hPrior->hNext = hGroup->hNext;
634 else
635 Globals.hGroups = hGroup->hNext;
636
637 if (hGroup->hNext)
638 hGroup->hNext->hPrior = hGroup->hPrior;
639
640 while (hGroup->hPrograms)
642
643 /* FIXME Update progman.ini */
644
645 SendMessageW(Globals.hMDIWnd, WM_MDIDESTROY, (WPARAM)hGroup->hWnd, 0);
646
647 if (hGroup->Tags)
648 Free(hGroup->Tags);
649 Free(hGroup->hName);
650 Free(hGroup->hGrpFile);
651 Free(hGroup);
652}
#define FALSE
Definition: types.h:117
VOID PROGRAM_DeleteProgram(PROGRAM *hProgram, BOOL bUpdateGrpFile)
Definition: program.c:289
UINT_PTR WPARAM
Definition: windef.h:207
#define WM_MDIDESTROY
Definition: winuser.h:1813

Referenced by MAIN_MenuCommand().

◆ GROUP_ModifyGroup()

VOID GROUP_ModifyGroup ( PROGGROUP hGroup)

Definition at line 596 of file group.c.

597{
598 WCHAR Dest[MAX_PATHNAME_LEN]; // szName
599 WCHAR szGrpFile[MAX_PATHNAME_LEN]; // szFile
600
601 wcsncpy(Dest, hGroup->hName, ARRAYSIZE(Dest));
602 wcsncpy(szGrpFile, hGroup->hGrpFile, ARRAYSIZE(szGrpFile));
603
604 if (!DIALOG_GroupAttributes(hGroup->format, Dest, szGrpFile, MAX_PATHNAME_LEN))
605 return;
606
607 if (wcscmp(szGrpFile, hGroup->hGrpFile))
608 hGroup->bOverwriteFileOk = FALSE;
609
610 MAIN_ReplaceString(&hGroup->hName, Dest);
611 MAIN_ReplaceString(&hGroup->hGrpFile, szGrpFile);
612
614
615 /* FIXME Delete old GrpFile if GrpFile changed */
616
617 /* FIXME Update progman.ini */
618
619 SetWindowTextW(hGroup->hWnd, Dest);
620}
BOOL DIALOG_GroupAttributes(GROUPFORMAT format, LPWSTR lpszTitle, LPWSTR lpszGrpFile, INT nSize)
Definition: dialog.c:484
VOID MAIN_ReplaceString(LPWSTR *string, LPWSTR replace)
Definition: main.c:1192
BOOL GRPFILE_WriteGroupFile(PROGGROUP *hGroup)
Definition: grpfile.c:358
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)

Referenced by MAIN_MenuCommand().

◆ GROUP_NewGroup()

VOID GROUP_NewGroup ( GROUPFORMAT  format,
BOOL  bIsCommonGroup 
)

Definition at line 392 of file group.c.

393{
395 WCHAR szGrpFile[MAX_PATHNAME_LEN] = L"";
397
398 // ZeroMemory(szTitle, sizeof(szTitle));
399 // ZeroMemory(szGrpFile, sizeof(szGrpFile));
400
402 return;
403
404 /*
405 * Just check whether the group file does exist. If it does, close the handle, because GRPFILE_ReadGroupFile will
406 * reopen the file for loading. If it doesn't exist, we create a new one.
407 */
410 {
411 /* File doesn't exist */
412 PROGGROUP* hGroup = GROUP_AddGroup(format, bIsCommonGroup, szTitle, szGrpFile,
415 0, 0, SW_SHOWNORMAL, 0, 0, FALSE, FALSE);
416 if (hGroup)
418 }
419 else
420 {
421 /* File exist */
423 GRPFILE_ReadGroupFile(szGrpFile, bIsCommonGroup);
424 }
425
426 /* FIXME Update progman.ini */
427}
PROGGROUP * GROUP_AddGroup(GROUPFORMAT format, BOOL bIsCommonGroup, LPCWSTR lpszName, LPCWSTR lpszGrpFile, INT left, INT top, INT right, INT bottom, INT xMin, INT yMin, INT nCmdShow, WORD cxIcon, WORD cyIcon, BOOL bOverwriteFileOk, BOOL bSuppressShowWindow)
Definition: group.c:435
#define CloseHandle
Definition: compat.h:739
#define OPEN_EXISTING
Definition: compat.h:775
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define GENERIC_READ
Definition: compat.h:135
#define CreateFileW
Definition: compat.h:741
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define FILE_SHARE_READ
Definition: compat.h:136
DWORD GRPFILE_ReadGroupFile(LPCWSTR lpszPath, BOOL bIsCommonGroup)
Definition: grpfile.c:65
TCHAR szTitle[MAX_LOADSTRING]
Definition: magnifier.c:35
_In_ HANDLE hFile
Definition: mswsock.h:90
#define DEF_GROUP_WIN_HEIGHT
Definition: progman.h:65
#define DEF_GROUP_WIN_XPOS
Definition: progman.h:62
#define DEF_GROUP_WIN_YPOS
Definition: progman.h:63
#define DEF_GROUP_WIN_WIDTH
Definition: progman.h:64

Referenced by MAIN_MenuCommand().

◆ GROUP_RegisterGroupWinClass()

ATOM GROUP_RegisterGroupWinClass ( VOID  )

Definition at line 369 of file group.c.

370{
371 WNDCLASSW wndClass;
372
373 wndClass.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;
375 wndClass.cbClsExtra = 0;
376 wndClass.cbWndExtra = sizeof(LONG_PTR);
377 wndClass.hInstance = Globals.hInstance;
380 wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
381 wndClass.lpszMenuName = NULL;
383
384 return RegisterClassW(&wndClass);
385}
static LRESULT CALLBACK GROUP_GroupWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: group.c:117
#define IDI_GROUP_ICON
Definition: resource.h:43
LPCWSTR lpszClassName
Definition: winuser.h:3185
LPCWSTR lpszMenuName
Definition: winuser.h:3184
HBRUSH hbrBackground
Definition: winuser.h:3183
HICON hIcon
Definition: winuser.h:3181
HINSTANCE hInstance
Definition: winuser.h:3180
int cbClsExtra
Definition: winuser.h:3178
UINT style
Definition: winuser.h:3176
WNDPROC lpfnWndProc
Definition: winuser.h:3177
int cbWndExtra
Definition: winuser.h:3179
HCURSOR hCursor
Definition: winuser.h:3182
#define LONG_PTR
Definition: treelist.c:79
#define CS_VREDRAW
Definition: winuser.h:658
#define COLOR_WINDOW
Definition: winuser.h:918
#define CS_HREDRAW
Definition: winuser.h:653
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
#define IDC_ARROW
Definition: winuser.h:687
#define CS_DBLCLKS
Definition: winuser.h:651
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2136
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2106

Referenced by wWinMain().

◆ GROUP_ShowGroupWindow()

VOID GROUP_ShowGroupWindow ( PROGGROUP hGroup)

Definition at line 660 of file group.c.

661{
662 ShowWindow(hGroup->hWnd, hGroup->nCmdShow);
663 UpdateWindow(hGroup->hWnd);
664}
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)

◆ GRPFILE_ReadGroupFile()

DWORD GRPFILE_ReadGroupFile ( LPCWSTR  lpszPath,
BOOL  bIsCommonGroup 
)

Definition at line 65 of file grpfile.c.

66{
67#if 0
68 CHAR szPath_gr[MAX_PATHNAME_LEN];
69 BOOL bFileNameModified = FALSE;
71 HLOCAL hBuffer, hGroup;
72 INT size;
73
74 /* if `.gr' file exists use that */
75 GRPFILE_ModifyFileName(szPath_gr, lpszPath, MAX_PATHNAME_LEN, TRUE);
76 if (OpenFile(szPath_gr, &dummy, OF_EXIST) != HFILE_ERROR)
77 {
78 lpszPath = szPath_gr;
79 bFileNameModified = TRUE;
80 }
81
82 /* Read the whole file into a buffer */
83 if (!GRPFILE_ReadFileToBuffer(lpszPath, &hBuffer, &size))
84 {
86 return(0);
87 }
88
89 /* Interpret buffer */
90 hGroup = GRPFILE_ScanGroup(LocalLock(hBuffer), size,
91 lpszPath, bFileNameModified);
92 if (!hGroup)
94
95 LocalFree(hBuffer);
96
97 return(hGroup);
98
99#else
100 return ERROR_SUCCESS;
101#endif
102}
#define IDS_GRPFILE_READ_ERROR_s
Definition: resource.h:62
HFILE WINAPI OpenFile(LPCSTR lpFileName, LPOFSTRUCT lpReOpenBuff, UINT uStyle)
Definition: create.c:368
unsigned int BOOL
Definition: ntddk_ex.h:94
GLsizeiptr size
Definition: glext.h:5919
LPVOID NTAPI LocalLock(HLOCAL hMem)
Definition: heapmem.c:1616
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
#define OF_EXIST
Definition: winbase.h:127
#define HFILE_ERROR
Definition: winbase.h:111
char CHAR
Definition: xmlstorage.h:175

Referenced by GROUP_NewGroup().

◆ GRPFILE_WriteGroupFile()

BOOL GRPFILE_WriteGroupFile ( PROGGROUP hGroup)

Definition at line 358 of file grpfile.c.

359{
360#if 0
362 PROGGROUP *group = LocalLock(hGroup);
364 HFILE file;
365 BOOL ret;
366
367 GRPFILE_ModifyFileName(szPath, LocalLock(group->hGrpFile),
369 group->bFileNameModified);
370
371 /* Try not to overwrite original files */
372
373 /* group->bOverwriteFileOk == TRUE only if a file has the modified format */
374 if (!group->bOverwriteFileOk &&
376 {
377 /* Original file exists, try `.gr' extension */
378 GRPFILE_ModifyFileName(szPath, LocalLock(group->hGrpFile),
381 {
382 /* File exists. Do not overwrite */
384 IDS_INFO, MB_OK);
385 return FALSE;
386 }
387 /* Inform about the modified file name */
388 if (IDCANCEL ==
391 return FALSE;
392 }
393
394 {
395 /* Warn about the (possible) incompatibility */
398 "Group files written by this DRAFT Program Manager "
399 "possibly cannot be read by the Microsoft Program Manager!!\n"
400 "Are you sure to write %s?", szPath);
401 if (IDOK != MessageBoxA(Globals.hMainWnd, msg, "WARNING",
403 }
404
405 /* Open file */
406 file = _lcreat(szPath, 0);
407 if (file != HFILE_ERROR)
408 {
409 ret = GRPFILE_DoWriteGroupFile(file, group);
410 _lclose(file);
411 }
412 else ret = FALSE;
413
414 if (!ret)
416
417 return(ret);
418
419#else
420 return TRUE;
421#endif
422}
#define msg(x)
Definition: auth_time.c:54
#define IDS_FILE_WRITE_ERROR_s
Definition: resource.h:61
#define IDS_SAVE_GROUP_AS_s
Definition: resource.h:67
#define IDS_INFO
Definition: resource.h:53
#define IDS_FILE_NOT_OVERWRITTEN_s
Definition: resource.h:66
GLboolean GLuint group
Definition: glext.h:11120
int WINAPI _lclose(HFILE hFile)
Definition: lfile.c:138
HFILE WINAPI _lcreat(LPCSTR lpPathName, int iAttribute)
Definition: lfile.c:116
LPCWSTR szPath
Definition: env.c:37
Definition: fci.c:127
int HFILE
Definition: windef.h:298
#define IDCANCEL
Definition: winuser.h:831
int WINAPI MessageBoxA(_In_opt_ HWND hWnd, _In_opt_ LPCSTR lpText, _In_opt_ LPCSTR lpCaption, _In_ UINT uType)
int WINAPIV wsprintfA(_Out_ LPSTR, _In_ _Printf_format_string_ LPCSTR,...)
#define MB_OKCANCEL
Definition: winuser.h:804
#define MB_ICONINFORMATION
Definition: winuser.h:802

Referenced by GROUP_ModifyGroup(), GROUP_NewGroup(), PROGRAM_CopyMoveProgram(), PROGRAM_DeleteProgram(), PROGRAM_ModifyProgram(), and PROGRAM_NewProgram().

◆ MAIN_MessageBoxIDS()

INT MAIN_MessageBoxIDS ( UINT  ids_text,
UINT  ids_title,
WORD  type 
)

Definition at line 1159 of file main.c.

1160{
1163
1166
1168}
#define MAX_STRING_LEN
Definition: precomp.h:36
NOTEPAD_GLOBALS Globals
Definition: main.c:17
const WCHAR * text
Definition: package.c:1799
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static char title[]
Definition: ps.c:92
HINSTANCE hInstance
Definition: notepad.h:60
HWND hMainWnd
Definition: notepad.h:61
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)

Referenced by DIALOG_COPY_MOVE_DlgProc(), DIALOG_EXECUTE_DlgProc(), DIALOG_GROUP_DlgProc(), DIALOG_NEW_DlgProc(), DIALOG_PROGRAM_DlgProc(), DIALOG_SYMBOL_DlgProc(), GROUP_AddGroup(), MAIN_MenuCommand(), MAIN_ReplaceString(), and PROGRAM_AddProgram().

◆ MAIN_MessageBoxIDS_s()

INT MAIN_MessageBoxIDS_s ( UINT  ids_text,
LPCWSTR  str,
UINT  ids_title,
WORD  type 
)

Definition at line 1174 of file main.c.

1175{
1179
1182 wsprintfW(newtext, text, str);
1183
1184 return MessageBoxW(Globals.hMainWnd, newtext, title, type);
1185}
const WCHAR * str
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)

Referenced by DIALOG_Delete(), GRPFILE_ReadGroupFile(), and GRPFILE_WriteGroupFile().

◆ MAIN_ReplaceString()

VOID MAIN_ReplaceString ( LPWSTR string,
LPWSTR  replace 
)

Definition at line 1192 of file main.c.

1193{
1194 LPWSTR newstring;
1195
1196 newstring = Alloc(HEAP_ZERO_MEMORY, (wcslen(replace) + 1) * sizeof(WCHAR));
1197 if (newstring)
1198 {
1199 wcscpy(newstring, replace);
1200 *string = newstring;
1201 }
1202 else
1203 {
1205 }
1206}
INT replace(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], DWORD dwFlags, BOOL *doMore)
Definition: replace.c:47
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)

Referenced by GROUP_ModifyGroup(), and PROGRAM_ModifyProgram().

◆ PROGRAM_ActiveProgram()

PROGRAM * PROGRAM_ActiveProgram ( PROGGROUP hGroup)

Definition at line 331 of file program.c.

332{
333 if (!hGroup) return NULL;
334 if (IsIconic(hGroup->hWnd)) return NULL;
335 return hGroup->hActiveProgram;
336}
BOOL WINAPI IsIconic(_In_ HWND)

Referenced by MAIN_MainWndProc(), and MAIN_MenuCommand().

◆ PROGRAM_AddProgram()

PROGRAM * PROGRAM_AddProgram ( PROGGROUP hGroup,
HICON  hIcon,
LPCWSTR  lpszName,
INT  x,
INT  y,
LPCWSTR  lpszCmdLine,
LPCWSTR  lpszIconFile,
INT  nIconIndex,
LPCWSTR  lpszWorkDir,
INT  nHotKey,
INT  nCmdShow,
BOOL  bNewVDM 
)

Definition at line 157 of file program.c.

160{
161 PROGRAM* hProgram;
162 PROGRAM* hPrior;
163 PROGRAM** p;
164 LPWSTR hCmdLine;
165 LPWSTR hIconFile;
166 LPWSTR hName;
167 LPWSTR hWorkDir;
168 LVITEMW lvItem;
169 INT iItem;
170
171 hProgram = Alloc(HEAP_ZERO_MEMORY, sizeof(*hProgram));
172 hName = Alloc(HEAP_ZERO_MEMORY, (wcslen(lpszName) + 1) * sizeof(WCHAR));
173 hCmdLine = Alloc(HEAP_ZERO_MEMORY, (wcslen(lpszCmdLine) + 1) * sizeof(WCHAR));
174 hIconFile = Alloc(HEAP_ZERO_MEMORY, (wcslen(lpszIconFile) + 1) * sizeof(WCHAR));
175 hWorkDir = Alloc(HEAP_ZERO_MEMORY, (wcslen(lpszWorkDir) + 1) * sizeof(WCHAR));
176 if (!hProgram || !hName || !hCmdLine || !hIconFile || !hWorkDir)
177 {
179 if (hProgram) Free(hProgram);
180 if (hName) Free(hName);
181 if (hCmdLine) Free(hCmdLine);
182 if (hIconFile) Free(hIconFile);
183 if (hWorkDir) Free(hWorkDir);
184 return NULL;
185 }
186 memcpy(hName , lpszName , (wcslen(lpszName) + 1) * sizeof(WCHAR));
187 memcpy(hCmdLine , lpszCmdLine , (wcslen(lpszCmdLine) + 1) * sizeof(WCHAR));
188 memcpy(hIconFile, lpszIconFile, (wcslen(lpszIconFile) + 1) * sizeof(WCHAR));
189 memcpy(hWorkDir , lpszWorkDir , (wcslen(lpszWorkDir) + 1) * sizeof(WCHAR));
190
191 hGroup->hActiveProgram = hProgram;
192
193 hPrior = NULL;
194 for (p = &hGroup->hPrograms; *p; p = &hPrior->hNext)
195 hPrior = *p;
196 *p = hProgram;
197
198 hProgram->hGroup = hGroup;
199 hProgram->hPrior = hPrior;
200 hProgram->hNext = NULL;
201 hProgram->hName = hName;
202 hProgram->hCmdLine = hCmdLine;
203 hProgram->hIconFile = hIconFile;
204 hProgram->nIconIndex = nIconIndex;
205 hProgram->hWorkDir = hWorkDir;
206 hProgram->hIcon = hIcon;
207 hProgram->nCmdShow = nCmdShow;
208 hProgram->nHotKey = nHotKey;
209 hProgram->bNewVDM = bNewVDM;
210 hProgram->TagsSize = 0;
211 hProgram->Tags = NULL;
212
213 ZeroMemory(&lvItem, sizeof(lvItem));
214 lvItem.mask = LVIF_PARAM | LVIF_IMAGE | LVIF_TEXT;
215 lvItem.pszText = (LPWSTR)lpszName;
216 lvItem.lParam = (LPARAM)hProgram;
217 lvItem.iImage = ImageList_ReplaceIcon(hGroup->hListLarge, -1, hIcon);
219
220 lvItem.iItem = SendMessageA(hGroup->hListView, LVM_GETITEMCOUNT, 0, 0);
221 iItem = SendMessageW(hGroup->hListView, LVM_INSERTITEMW, 0, (LPARAM)&lvItem);
222 hProgram->iItem = iItem;
223 if (x != -1 && y != -1)
225
226 return hProgram;
227}
INT WINAPI ImageList_ReplaceIcon(HIMAGELIST himl, INT nIndex, HICON hIcon)
Definition: imagelist.c:2779
HICON hIcon
Definition: msconfig.c:44
#define LVM_GETITEMCOUNT
Definition: commctrl.h:2306
#define LVM_SETITEMPOSITION
Definition: commctrl.h:2480
#define LVIF_PARAM
Definition: commctrl.h:2311
#define LVIF_TEXT
Definition: commctrl.h:2309
#define LVIF_IMAGE
Definition: commctrl.h:2310
#define LVM_INSERTITEMW
Definition: commctrl.h:2404
HIMAGELIST hListLarge
Definition: progman.h:119
HWND hListView
Definition: progman.h:118
INT nCmdShow
Definition: progman.h:98
LPWSTR hName
Definition: progman.h:93
LPWSTR hCmdLine
Definition: progman.h:94
INT nHotKey
Definition: progman.h:97
PROGRAM * hPrior
Definition: progman.h:84
BOOL bNewVDM
Definition: progman.h:99
PROGRAM * hNext
Definition: progman.h:85
LPWSTR hWorkDir
Definition: progman.h:96
HICON hIcon
Definition: progman.h:92
SIZE_T TagsSize
Definition: progman.h:101
PVOID Tags
Definition: progman.h:102
INT nIconIndex
Definition: progman.h:91
LPWSTR hIconFile
Definition: progman.h:95
PROGGROUP * hGroup
Definition: progman.h:83
INT iItem
Definition: progman.h:88
LPWSTR pszText
Definition: commctrl.h:2365
UINT mask
Definition: commctrl.h:2360
LPARAM lParam
Definition: commctrl.h:2368
int iImage
Definition: commctrl.h:2367
#define ZeroMemory
Definition: winbase.h:1712
#define MAKELPARAM(l, h)
Definition: winuser.h:4008
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2084

Referenced by PROGRAM_CopyMoveProgram(), and PROGRAM_NewProgram().

◆ PROGRAM_CopyMoveProgram()

VOID PROGRAM_CopyMoveProgram ( PROGRAM hProgram,
BOOL  bMove 
)

Definition at line 236 of file program.c.

237{
238 PROGGROUP* hGroup;
239
240 hGroup = DIALOG_CopyMove(hProgram, bMove);
241 if (!hGroup)
242 return;
243
244 /* FIXME: shouldn't be necessary */
245 OpenIcon(hGroup->hWnd);
246
247 if (!PROGRAM_AddProgram(hGroup,
248 hProgram->hIcon,
249 hProgram->hName,
250 hProgram->x,
251 hProgram->y,
252 hProgram->hCmdLine,
253 hProgram->hIconFile,
254 hProgram->nIconIndex,
255 hProgram->hWorkDir,
256 hProgram->nHotKey,
257 hProgram->nCmdShow,
258 hProgram->bNewVDM))
259 {
260 return;
261 }
262
264
265 if (bMove)
266 PROGRAM_DeleteProgram(hProgram, TRUE);
267}
PROGGROUP * DIALOG_CopyMove(PROGRAM *hProgram, BOOL bMove)
Definition: dialog.c:343
VOID PROGRAM_DeleteProgram(PROGRAM *hProgram, BOOL bUpdateGrpFile)
Definition: program.c:289
PROGRAM * PROGRAM_AddProgram(PROGGROUP *hGroup, HICON hIcon, LPCWSTR lpszName, INT x, INT y, LPCWSTR lpszCmdLine, LPCWSTR lpszIconFile, INT nIconIndex, LPCWSTR lpszWorkDir, INT nHotKey, INT nCmdShow, BOOL bNewVDM)
Definition: program.c:157
INT y
Definition: progman.h:90
INT x
Definition: progman.h:89
BOOL WINAPI OpenIcon(_In_ HWND)

Referenced by MAIN_MenuCommand().

◆ PROGRAM_DeleteProgram()

VOID PROGRAM_DeleteProgram ( PROGRAM hProgram,
BOOL  bUpdateGrpFile 
)

Definition at line 289 of file program.c.

290{
292
293 group = hProgram->hGroup;
294 if (hProgram->hGroup->hActiveProgram == hProgram)
296
297 SendMessageA(group->hListView, LVM_DELETEITEM, hProgram->iItem, 0);
298
299 if (hProgram->hPrior)
300 hProgram->hPrior->hNext = hProgram->hNext;
301 else
302 hProgram->hGroup->hPrograms = hProgram->hNext;
303
304 if (hProgram->hNext)
305 hProgram->hNext->hPrior = hProgram->hPrior;
306
307 if (bUpdateGrpFile)
309
310#if 0
311 DestroyWindow(program->hWnd);
312 if (program->hIcon)
313 DestroyIcon(program->hIcon);
314#endif
315
316 if (hProgram->Tags)
317 Free(hProgram->Tags);
318 Free(hProgram->hName);
319 Free(hProgram->hCmdLine);
320 Free(hProgram->hIconFile);
321 Free(hProgram->hWorkDir);
322 Free(hProgram);
323}
GLuint program
Definition: glext.h:6723
#define LVM_DELETEITEM
Definition: commctrl.h:2410
BOOL WINAPI DestroyWindow(_In_ HWND)

Referenced by GROUP_DeleteGroup(), MAIN_MenuCommand(), and PROGRAM_CopyMoveProgram().

◆ PROGRAM_ExecuteProgram()

VOID PROGRAM_ExecuteProgram ( PROGRAM hProgram)

Definition at line 274 of file program.c.

275{
276 // TODO: Use a (private?) shell API with which one can use hProgram->bNewVDM
277
278 ShellExecuteW(NULL, NULL, hProgram->hCmdLine, NULL, hProgram->hWorkDir, hProgram->nCmdShow);
279
280 if (Globals.bMinOnRun)
282}
HINSTANCE WINAPI ShellExecuteW(HWND hwnd, LPCWSTR lpVerb, LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd)
Definition: shlexec.cpp:2486
BOOL WINAPI CloseWindow(_In_ HWND)

Referenced by GROUP_GroupWndProc(), MAIN_AutoStart(), and MAIN_MenuCommand().

◆ PROGRAM_ModifyProgram()

VOID PROGRAM_ModifyProgram ( PROGRAM hProgram)

Definition at line 116 of file program.c.

117{
118 LVITEMW lvItem;
120 WCHAR szWorkDir[MAX_PATHNAME_LEN];
121 WCHAR szCmdLine[MAX_PATHNAME_LEN];
122 WCHAR szIconFile[MAX_PATHNAME_LEN];
123
124 lstrcpynW(szName , hProgram->hName , ARRAYSIZE(szName));
125 lstrcpynW(szCmdLine , hProgram->hCmdLine , ARRAYSIZE(szCmdLine));
126 lstrcpynW(szIconFile, hProgram->hIconFile, ARRAYSIZE(szIconFile));
127 lstrcpynW(szWorkDir , hProgram->hWorkDir , ARRAYSIZE(szWorkDir));
128
129 if (!DIALOG_ProgramAttributes(szName, szCmdLine, szWorkDir, szIconFile,
130 &hProgram->hIcon, &hProgram->nIconIndex,
131 &hProgram->nHotKey, &hProgram->nCmdShow,
132 &hProgram->bNewVDM, MAX_PATHNAME_LEN))
133 {
134 return;
135 }
136
137 MAIN_ReplaceString(&hProgram->hName , szName);
138 MAIN_ReplaceString(&hProgram->hCmdLine , szCmdLine);
139 MAIN_ReplaceString(&hProgram->hIconFile, szIconFile);
140 MAIN_ReplaceString(&hProgram->hWorkDir , szWorkDir);
141
142 ZeroMemory(&lvItem, sizeof(lvItem));
143 lvItem.mask = LVIF_TEXT;
144 lvItem.iSubItem = 0;
145 lvItem.pszText = szName;
146 SendMessageW(hProgram->hGroup->hListView, LVM_SETITEMTEXTW, hProgram->iItem, (LPARAM)&lvItem);
147
149}
BOOL DIALOG_ProgramAttributes(LPWSTR lpszTitle, LPWSTR lpszCmdLine, LPWSTR lpszWorkDir, LPWSTR lpszIconFile, HICON *lphIcon, INT *lpnIconIndex, INT *lpnHotKey, INT *lpnCmdShow, BOOL *lpbNewVDM, INT nSize)
Definition: dialog.c:864
#define lstrcpynW
Definition: compat.h:738
static const WCHAR szName[]
Definition: powrprof.c:45
#define LVM_SETITEMTEXTW
Definition: commctrl.h:2687
int iSubItem
Definition: commctrl.h:2362

Referenced by MAIN_MenuCommand().

◆ PROGRAM_NewProgram()

VOID PROGRAM_NewProgram ( PROGGROUP hGroup)

Definition at line 80 of file program.c.

81{
83 INT nIconIndex = 0;
84 INT nHotKey = 0;
85 INT nCmdShow = SW_SHOWNORMAL;
86 BOOL bNewVDM = FALSE;
88 WCHAR szCmdLine[MAX_PATHNAME_LEN] = L"";
89 WCHAR szIconFile[MAX_PATHNAME_LEN] = L"";
90 WCHAR szWorkDir[MAX_PATHNAME_LEN] = L"";
91
92 if (!DIALOG_ProgramAttributes(szTitle, szCmdLine, szWorkDir, szIconFile,
93 &hIcon, &nIconIndex, &nHotKey, &nCmdShow, &bNewVDM,
95 {
96 return;
97 }
98
99 if (!hIcon)
101
102 if (!PROGRAM_AddProgram(hGroup, hIcon, szTitle, -1, -1, szCmdLine, szIconFile,
103 nIconIndex, szWorkDir, nHotKey, nCmdShow, bNewVDM))
104 {
105 return;
106 }
107
109}
static HICON
Definition: imagelist.c:84
#define IDI_WINLOGO
Definition: winuser.h:709

Referenced by MAIN_MenuCommand().

◆ ReAlloc()

◆ STRING_LoadMenus()

VOID STRING_LoadMenus ( VOID  )

Definition at line 41 of file string.c.

42{
44
45 /* Create the menu */
47 Globals.hFileMenu = GetSubMenu(hMainMenu, 0);
48 Globals.hOptionMenu = GetSubMenu(hMainMenu, 1);
49 Globals.hWindowsMenu = GetSubMenu(hMainMenu, 2);
50 Globals.hLanguageMenu = GetSubMenu(hMainMenu, 3);
51
52 if (Globals.hMDIWnd)
54 else
56
57 /* Destroy the old menu */
58 if (Globals.hMainMenu)
59 DestroyMenu(Globals.hMainMenu);
60 Globals.hMainMenu = hMainMenu;
61}
#define MAIN_MENU
Definition: resources.h:12
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
HMENU hMainMenu
Definition: mplay32.c:25
#define WM_MDISETMENU
Definition: winuser.h:1822
BOOL WINAPI SetMenu(_In_ HWND, _In_opt_ HMENU)
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
BOOL WINAPI DestroyMenu(_In_ HMENU)
HMENU WINAPI LoadMenuW(_In_opt_ HINSTANCE, _In_ LPCWSTR)

Referenced by wWinMain().

◆ STRING_LoadStrings()

VOID STRING_LoadStrings ( VOID  )

Definition at line 36 of file string.c.

37{
39}
#define IDS_PROGRAM_MANAGER
Definition: resource.h:50
WCHAR szTitle[256]
Definition: string.c:34

Referenced by wWinMain().

Variable Documentation

◆ Globals

GLOBALS Globals
extern

Definition at line 13 of file clipbrd.c.

◆ szTitle

WCHAR szTitle[256]
extern

Definition at line 35 of file magnifier.c.