diff --git a/progmgr/dialog.c b/progmgr/dialog.c index 83bc611..bf8c378 100644 --- a/progmgr/dialog.c +++ b/progmgr/dialog.c @@ -32,7 +32,7 @@ WCHAR szDlgTitle[64]; \* * * */ BOOL CALLBACK NewGroupDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARAM lParam) { - GROUP grp = { + static GROUP grp = { .dwSignature = GRP_SIGNATURE, .wVersion = GRP_VERSION, .wChecksum = 0, @@ -59,6 +59,14 @@ BOOL CALLBACK NewGroupDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARAM // TODO: // fix minor GDI font/region leak + // Reset the group structure + grp.dwSignature = GRP_SIGNATURE; + grp.wVersion = GRP_VERSION; + grp.wChecksum = 0; + grp.dwFlags = 0; + grp.cItems = 0; + grp.iItems = NULL; + // Set the window title LoadString(hAppInstance, IDS_DLT_GRP_NEW, szDlgTitle, ARRAYSIZE(szDlgTitle)); SetWindowText(hWndDlg, szDlgTitle); @@ -110,7 +118,6 @@ BOOL CALLBACK NewGroupDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARAM break; case IDD_OK: - // Check that all the applicable fields are filled out, // and if not then set the focus to the offending field if (!(bOKEnabled = GetDlgItemText(hWndDlg, IDD_NAME, (LPWSTR)&szBuffer, ARRAYSIZE(szBuffer)))) @@ -178,13 +185,13 @@ BOOL CALLBACK NewGroupDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARAM \* * * */ BOOL CALLBACK NewItemDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARAM lParam) { - ITEM itm = { + static ITEM itm = { .szName = L"", .szExecPath = L"", .szWorkPath = L"", .dwFlags = 0, .uiHotkeyModifiers = 0, - .uiHotkeyModifiers = 0, + .uiHotkeyVirtualKey = 0, .szIconPath = L"", .iIconIndex = 0, }; @@ -197,7 +204,6 @@ BOOL CALLBACK NewItemDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARAM l switch (message) { - case WM_INITDIALOG: // TODO: // actually create an item and add it to the GROUP structure @@ -205,6 +211,11 @@ BOOL CALLBACK NewItemDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARAM l // require a valid group to be selected or else the dialog won't // let you press OK + // Reset the item structure + itm.dwFlags = 0; + itm.uiHotkeyModifiers = 0; + itm.uiHotkeyVirtualKey = 0; + // Set the window title LoadString(hAppInstance, IDS_DLT_ITEM_NEW, szDlgTitle, ARRAYSIZE(szDlgTitle)); SetWindowText(hWndDlg, szDlgTitle); diff --git a/progmgr/progmgr.c b/progmgr/progmgr.c index dcd2330..705fac9 100644 --- a/progmgr/progmgr.c +++ b/progmgr/progmgr.c @@ -167,7 +167,6 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, } #ifdef PROGMGR_NO_CRT - #pragma function(memset) void *memset(char* dst, int value, size_t count) { while (count--) { *dst++ = value; } @@ -184,5 +183,4 @@ void __stdcall wWinMainCRTStartup() { int code = wWinMain(GetModuleHandle(0), 0, 0, 0); ExitProcess(code); } - -#endif \ No newline at end of file +#endif