ReactOS 0.4.16-dev-303-g11d5cb8
main.c
Go to the documentation of this file.
1/*
2 * Program Manager
3 *
4 * Copyright 1996 Ulrich Schmid
5 * Copyright 2002 Sylvain Petreolle
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 */
21
22/*
23 * PROJECT: ReactOS Program Manager
24 * COPYRIGHT: GPL - See COPYING in the top level directory
25 * FILE: base/shell/progman/main.c
26 * PURPOSE: ProgMan entry point & MDI window
27 * PROGRAMMERS: Ulrich Schmid
28 * Sylvain Petreolle
29 * Hermes Belusca-Maito (hermes.belusca@sfr.fr)
30 */
31
32#include "progman.h"
33
34#include <shellapi.h>
35
36#define WC_MDICLIENTA "MDICLIENT"
37#define WC_MDICLIENTW L"MDICLIENT"
38
39#ifdef UNICODE
40#define WC_MDICLIENT WC_MDICLIENTW
41#else
42#define WC_MDICLIENT WC_MDICLIENTA
43#endif
44
46
53
54
55#define BUFFER_SIZE 1024
56
57
58
59/*
60 * Memory management functions
61 */
64 IN SIZE_T dwBytes)
65{
66 return HeapAlloc(GetProcessHeap(), dwFlags, dwBytes);
67}
68
69BOOL
71{
72 return HeapFree(GetProcessHeap(), 0, lpMem);
73}
74
77 IN PVOID lpMem,
78 IN SIZE_T dwBytes)
79{
80 return HeapReAlloc(GetProcessHeap(), dwFlags, lpMem, dwBytes);
81}
82
85 IN PSIZE_T pdwBufferSize,
87 IN SIZE_T dwDataSize)
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}
107
108
109
110/*
111 * Debugging helpers
112 */
113VOID
116{
117 WCHAR Buffer[4096];
118
120 MessageBoxW(Globals.hMainWnd, Buffer, L"Information", MB_OK);
121}
122
123VOID
125{
127
128 va_start(args, szStr);
129 PrintStringV(szStr, args);
130 va_end(args);
131}
132
133VOID
135{
136 WCHAR Buffer[4096];
138
139 va_start(args, uID);
142 va_end(args);
143}
144
145VOID
147{
148 LPWSTR lpMsgBuf;
149
152 (LPWSTR)&lpMsgBuf, 0, NULL);
153
154 PrintString(L"%s: %s\n", Message, lpMsgBuf);
155 LocalFree(lpMsgBuf);
156}
157
159{
160 DWORD dwError;
161 LPWSTR lpMsgBuf = NULL;
162 WCHAR Buffer[4096];
163
164 dwError = GetLastError();
165
168 (LPWSTR)&lpMsgBuf, 0, NULL);
169 _snwprintf(Buffer, ARRAYSIZE(Buffer), L"Error %d: %s\n", dwError, lpMsgBuf);
170 LocalFree(lpMsgBuf);
171 return MessageBoxW(Globals.hMainWnd, Buffer, L"Error", MB_OK);
172}
173
174
175
176
177
178
179
180/* Copied and adapted from dll/win32/userenv/environment.c!GetUserAndDomainName */
181static
182BOOL
184 OUT LPWSTR* DomainName)
185{
186 BOOL bRet = TRUE;
187 HANDLE hToken;
188 DWORD cbTokenBuffer = 0;
189 PTOKEN_USER pUserToken;
190
191 LPWSTR lpUserName = NULL;
192 LPWSTR lpDomainName = NULL;
193 DWORD cbUserName = 0;
194 DWORD cbDomainName = 0;
195
196 SID_NAME_USE SidNameUse;
197
198 /* Get the process token */
200 return FALSE;
201
202 /* Retrieve token's information */
203 if (!GetTokenInformation(hToken, TokenUser, NULL, 0, &cbTokenBuffer))
204 {
206 {
207 CloseHandle(hToken);
208 return FALSE;
209 }
210 }
211
212 pUserToken = Alloc(HEAP_ZERO_MEMORY, cbTokenBuffer);
213 if (!pUserToken)
214 {
215 CloseHandle(hToken);
216 return FALSE;
217 }
218
219 if (!GetTokenInformation(hToken, TokenUser, pUserToken, cbTokenBuffer, &cbTokenBuffer))
220 {
221 Free(pUserToken);
222 CloseHandle(hToken);
223 return FALSE;
224 }
225
226 CloseHandle(hToken);
227
228 /* Retrieve the domain and user name */
230 pUserToken->User.Sid,
231 NULL,
232 &cbUserName,
233 NULL,
234 &cbDomainName,
235 &SidNameUse))
236 {
238 {
239 bRet = FALSE;
240 goto done;
241 }
242 }
243
244 lpUserName = Alloc(HEAP_ZERO_MEMORY, cbUserName * sizeof(WCHAR));
245 if (lpUserName == NULL)
246 {
247 bRet = FALSE;
248 goto done;
249 }
250
251 lpDomainName = Alloc(HEAP_ZERO_MEMORY, cbDomainName * sizeof(WCHAR));
252 if (lpDomainName == NULL)
253 {
254 bRet = FALSE;
255 goto done;
256 }
257
259 pUserToken->User.Sid,
260 lpUserName,
261 &cbUserName,
262 lpDomainName,
263 &cbDomainName,
264 &SidNameUse))
265 {
266 bRet = FALSE;
267 goto done;
268 }
269
270 *UserName = lpUserName;
271 *DomainName = lpDomainName;
272
273done:
274 if (bRet == FALSE)
275 {
276 if (lpUserName != NULL)
277 Free(lpUserName);
278
279 if (lpDomainName != NULL)
280 Free(lpDomainName);
281 }
282
283 Free(pUserToken);
284
285 return bRet;
286}
287
288
289
290
291
292
293static
294VOID
296{
297 LPWSTR caption;
298 SIZE_T size;
299
300 LPWSTR lpDomainName = NULL;
301 LPWSTR lpUserName = NULL;
302
303 if (GetUserAndDomainName(&lpUserName, &lpDomainName) && lpUserName && lpDomainName)
304 {
305 size = (256 + 3 + wcslen(lpDomainName) + wcslen(lpUserName) + 1) * sizeof(WCHAR);
306 caption = Alloc(HEAP_ZERO_MEMORY, size);
307 if (caption)
308 {
309 StringCbPrintfW(caption, size, L"%s - %s\\%s", szTitle, lpDomainName, lpUserName);
311 Free(caption);
312 }
313 else
314 {
316 }
317 }
318 else
319 {
321 }
322
323 if (lpUserName) Free(lpUserName);
324 if (lpDomainName) Free(lpDomainName);
325}
326
327
328
329
330static
331BOOL
333{
334 LPWSTR lpszTmp;
335 LPWSTR lpszSection;
336 LONG lRet;
337 WCHAR dummy[2];
338 LPWSTR lpszKeyValue;
339 const LPCWSTR lpszIniFile = L"progman.ini";
340 WCHAR szWinDir[MAX_PATH];
341 LPWSTR lpszKey;
342 DWORD Value;
343 HKEY hKey;
344 BOOL bIsIniMigrated;
346 LPWSTR lpszSections;
347 LPWSTR lpszData;
348 DWORD dwRet;
349 DWORD dwType;
350 LPWSTR lpszValue;
351
352 bIsIniMigrated = FALSE;
353 lpszSections = NULL;
354 lpszData = NULL;
355
356 /* Try to create/open the Program Manager user key */
358 L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Program Manager",
359 0,
360 NULL,
363 NULL,
364 &Globals.hKeyProgMan,
366 {
367 return FALSE;
368 }
369
370 /*
371 * TODO: Add the explanation for the migration...
372 */
373 dwSize = sizeof(Value);
374 lRet = RegQueryValueExW(Globals.hKeyProgMan, L"IniMigrated", NULL, &dwType, (LPBYTE)&Value, &dwSize);
375 if (lRet != ERROR_SUCCESS || dwType != REG_DWORD)
376 Value = 0;
377 bIsIniMigrated = !!Value;
378
379 if (bIsIniMigrated)
380 {
381 /* The migration was already done, just load the settings */
382 goto LoadSettings;
383 }
384
385 /* Perform the migration */
386
387 bIsIniMigrated = TRUE;
389 SetLastError(0);
390 GetPrivateProfileSectionW(L"Settings", dummy, dwSize, lpszIniFile);
392 goto MigrationDone;
393
394 SetLastError(0);
395 GetPrivateProfileSectionW(L"Groups", dummy, dwSize, lpszIniFile);
397 goto MigrationDone;
398
399 GetWindowsDirectoryW(szWinDir, ARRAYSIZE(szWinDir));
400 // NOTE: GCC complains we cannot use the "\u2022" (UNICODE Code Point) notation for specifying the bullet character,
401 // because it's only available in C++ or in C99. On the contrary MSVC is fine with it.
402 // Instead we use a hex specification for the character: "\x2022".
403 // Note also that the character "\x07" gives also a bullet, but a larger one.
405 L"The Program Manager has detected the presence of a legacy settings file PROGMAN.INI in the directory '%s' "
406 L"and is going to migrate its contents into the current-user Program Manager settings registry key:\n"
407 L"HKCU\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Program Manager"
408 L"\n\n"
409 L"\x2022 The migration operation will potentially overwrite all the existing current-user Program Manager settings in the registry by those stored in the PROGMAN.INI file.\n"
410 L"\n"
411 L"\x2022 The migration is done once, so that, at the next launch of the Program Manager, the new migrated settings are directly used.\n"
412 L"\n"
413 L"\x2022 It is possible to trigger later the migration by manually deleting the registry value \"IniMigrated\" under the current-user Program Manager settings registry key (specified above).\n"
414 L"\n"
415 L"Would you like to migrate its contents into the registry?",
416 szWinDir);
417
419 {
420 lpszSections = Alloc(0, dwSize * sizeof(WCHAR));
421 dwRet = GetPrivateProfileSectionNamesW(lpszSections, dwSize, lpszIniFile);
422 if (dwRet < dwSize - 2)
423 break;
424 Free(lpszSections);
425 }
426 lpszSection = lpszSections;
427 while (*lpszSection)
428 {
429 lRet = RegCreateKeyExW(Globals.hKeyProgMan,
430 lpszSection,
431 0,
432 NULL,
434 KEY_WRITE,
435 NULL,
436 &hKey,
437 NULL);
438 if (lRet == ERROR_SUCCESS)
439 {
441 {
442 lpszData = Alloc(0, dwSize * sizeof(WCHAR));
443 dwRet = GetPrivateProfileSectionW(lpszSection, lpszData, dwSize, lpszIniFile);
444 if (dwRet < dwSize - 2)
445 break;
446 Free(lpszData);
447 }
448 lpszKeyValue = lpszData;
449 while (*lpszKeyValue)
450 {
451 lpszKey = lpszKeyValue;
452 lpszValue = wcschr(lpszKeyValue, L'=');
453 lpszKeyValue += (wcslen(lpszKeyValue) + 1);
454 if (lpszValue)
455 {
456 *lpszValue = '\0';
457 ++lpszValue;
458 Value = wcstoul(lpszValue, &lpszTmp, 0);
459 if (lpszTmp - lpszValue >= wcslen(lpszValue))
460 {
461 lpszValue = (LPWSTR)&Value;
462 dwSize = sizeof(Value);
463 dwType = REG_DWORD;
464 }
465 else
466 {
467 dwSize = wcslen(lpszValue) * sizeof(WCHAR);
468 dwType = REG_SZ;
469 }
470 }
471 else
472 {
473 dwSize = 0;
474 dwType = REG_DWORD;
475 }
476 lRet = RegSetValueExW(hKey, lpszKey, 0, dwType, (LPBYTE)lpszValue, dwSize);
477 }
478 Free(lpszData);
480 lpszSection += (wcslen(lpszSection) + 1);
481 }
482 }
483 Free(lpszSections);
484
485MigrationDone:
486 Value = TRUE;
487 RegSetValueExW(Globals.hKeyProgMan, L"IniMigrated", 0, REG_DWORD, (LPBYTE)&Value, sizeof(Value));
488
489
491 /* Create the necessary registry keys for the Program Manager and load its settings from the registry */
492
493 lRet = RegCreateKeyExW(Globals.hKeyProgMan,
494 L"Settings",
495 0,
496 NULL,
499 NULL,
500 &Globals.hKeyPMSettings,
501 NULL);
502
503 lRet = RegCreateKeyExW(Globals.hKeyProgMan,
504 L"Common Groups",
505 0,
506 NULL,
509 NULL,
510 &Globals.hKeyPMCommonGroups,
511 NULL);
512
513 lRet = RegCreateKeyExW(Globals.hKeyProgMan,
514 L"Groups",
515 0,
516 NULL,
519 NULL,
520 &Globals.hKeyPMAnsiGroups,
521 NULL);
522
523 lRet = RegCreateKeyExW(Globals.hKeyProgMan,
524 L"UNICODE Groups",
525 0,
526 NULL,
529 NULL,
530 &Globals.hKeyPMUnicodeGroups,
531 NULL);
532
534 L"Program Groups",
535 0,
536 NULL,
539 NULL,
540 &Globals.hKeyAnsiGroups,
541 NULL);
542
544 L"UNICODE Program Groups",
545 0,
546 NULL,
549 NULL,
550 &Globals.hKeyUnicodeGroups,
551 NULL);
552
554 L"SOFTWARE\\Program Groups",
555 0,
556 NULL,
559 NULL,
560 &Globals.hKeyCommonGroups,
561 NULL);
562
563 dwSize = sizeof(Globals.bAutoArrange);
564 RegQueryValueExW(Globals.hKeyPMSettings, L"AutoArrange", NULL, &dwType, (LPBYTE)&Globals.bAutoArrange, &dwSize);
565
566 dwSize = sizeof(Globals.bMinOnRun);
567 RegQueryValueExW(Globals.hKeyPMSettings, L"MinOnRun", NULL, &dwType, (LPBYTE)&Globals.bMinOnRun, &dwSize);
568
569 dwSize = sizeof(Globals.bSaveSettings);
570 RegQueryValueExW(Globals.hKeyPMSettings, L"SaveSettings", NULL, &dwType, (LPBYTE)&Globals.bSaveSettings, &dwSize);
571
572 return TRUE;
573}
574
575static
576BOOL
578{
579 WINDOWPLACEMENT WndPl;
581 WCHAR buffer[100];
582
583 WndPl.length = sizeof(WndPl);
586 L"%d %d %d %d %d",
588 WndPl.rcNormalPosition.top,
591 WndPl.showCmd);
592
593 dwSize = wcslen(buffer) * sizeof(WCHAR);
594 RegSetValueExW(Globals.hKeyPMSettings, L"Window", 0, REG_SZ, (LPBYTE)buffer, dwSize);
595
596 return TRUE;
597}
598
599
600/***********************************************************************
601 *
602 * WinMain
603 */
604
605INT WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, INT nCmdShow)
606{
607 MSG msg;
609
610 /*
611 * Set our shutdown parameters: we want to shutdown the very last,
612 * but before any TaskMgr instance (which has a shutdown level of 1).
613 */
615
617 Globals.hGroups = NULL;
618 Globals.hActiveGroup = NULL;
619
620 /* Load Program Manager's settings */
622
623 /* Load the default icons */
628
629 /* Initialize the common controls */
630 icex.dwSize = sizeof(icex);
631 icex.dwICC = ICC_HOTKEY_CLASS | ICC_LISTVIEW_CLASSES; // | ICC_STANDARD_CLASSES;
633
634 /* Register the window classes */
635 if (!hPrevInstance) // FIXME: Unused on Win32!
636 {
637 if (!MAIN_RegisterMainWinClass()) goto Quit;
638 if (!GROUP_RegisterGroupWinClass()) goto Quit;
639 }
640
641 /* Set up the strings, the main window, the accelerators, the menu, and the MDI child window */
647
648 /* Load all the groups */
649 // MAIN_CreateGroups();
651
652 /* Load the Startup group: start the initial applications */
654
655 /* Message loop */
656 while (GetMessageW(&msg, NULL, 0, 0))
657 {
658 if (!TranslateMDISysAccel(Globals.hMDIWnd, &msg) &&
660 {
663 }
664 }
665
666Quit:
667
668 /* Save the settings, close the registry keys and quit */
669
670 // MAIN_SaveSettings();
671 RegCloseKey(Globals.hKeyCommonGroups);
672 RegCloseKey(Globals.hKeyUnicodeGroups);
673 RegCloseKey(Globals.hKeyAnsiGroups);
674 RegCloseKey(Globals.hKeyPMUnicodeGroups);
675 RegCloseKey(Globals.hKeyPMAnsiGroups);
676 RegCloseKey(Globals.hKeyPMCommonGroups);
677 RegCloseKey(Globals.hKeyPMSettings);
678 RegCloseKey(Globals.hKeyProgMan);
679
680 return 0;
681}
682
683/***********************************************************************
684 *
685 * MAIN_CreateGroups
686 */
687
688#if 0
689static VOID MAIN_CreateGroups(VOID)
690{
693 CHAR key[20], *ptr;
694
695 /* Initialize groups according the `Order' entry of `progman.ini' */
696 GetPrivateProfileStringA("Settings", "Order", "", buffer, sizeof(buffer), Globals.lpszIniFile);
697 ptr = buffer;
698 while (ptr < buffer + sizeof(buffer))
699 {
700 int num, skip, ret;
701 ret = sscanf(ptr, "%d%n", &num, &skip);
702 if (ret == 0)
704 if (ret != 1) break;
705
706 sprintf(key, "Group%d", num);
707 GetPrivateProfileStringA("Groups", key, "", szPath,
708 sizeof(szPath), Globals.lpszIniFile);
709 if (!szPath[0]) continue;
710
712
713 ptr += skip;
714 }
715 /* FIXME initialize other groups, not enumerated by `Order' */
716}
717#endif
718
720{
721}
722
723/***********************************************************************
724 *
725 * MAIN_AutoStart
726 */
727
729{
730 LONG lRet;
732 DWORD dwType;
733
734 PROGGROUP* hGroup;
735 PROGRAM* hProgram;
736
738
739 dwSize = sizeof(buffer);
740 lRet = RegQueryValueExW(Globals.hKeyPMSettings, L"Startup", NULL, &dwType, (LPBYTE)buffer, &dwSize);
741 if (lRet != ERROR_SUCCESS || dwType != REG_SZ)
742 return;
743
744 for (hGroup = Globals.hGroups; hGroup; hGroup = hGroup->hNext)
745 {
746 if (_wcsicmp(buffer, hGroup->hName) == 0)
747 {
748 for (hProgram = hGroup->hPrograms; hProgram; hProgram = hProgram->hNext)
749 PROGRAM_ExecuteProgram(hProgram);
750 }
751 }
752}
753
754/***********************************************************************
755 *
756 * MAIN_MainWndProc
757 */
758
760{
761 switch (uMsg)
762 {
763 case WM_INITMENU:
764 {
765 PROGGROUP* hActiveGroup = GROUP_ActiveGroup();
766 if (hActiveGroup)
767 {
768 if (PROGRAM_ActiveProgram(hActiveGroup))
769 {
775 }
776 else
777 {
778 if (!hActiveGroup->hWnd || IsIconic(hActiveGroup->hWnd))
780 else
782
787 }
788 }
789 else
790 {
796 }
797
799 MF_BYCOMMAND | (Globals.bAutoArrange ? MF_CHECKED : MF_UNCHECKED));
801 MF_BYCOMMAND | (Globals.bMinOnRun ? MF_CHECKED : MF_UNCHECKED));
803 MF_BYCOMMAND | (Globals.bSaveSettings ? MF_CHECKED : MF_UNCHECKED));
804 break;
805 }
806
807 case WM_DESTROY:
808 if (Globals.bSaveSettings)
811 break;
812
813 case WM_COMMAND:
816 break;
817 }
818
819 return DefFrameProcW(hWnd, Globals.hMDIWnd, uMsg, wParam, lParam);
820}
821
822
823/***********************************************************************
824 *
825 * MAIN_MenuCommand
826 */
827
829{
830#if 0
831 HLOCAL hActiveGroup = GROUP_ActiveGroup();
832 HLOCAL hActiveProgram = PROGRAM_ActiveProgram(hActiveGroup);
833 HWND hActiveGroupWnd = GROUP_GroupWnd(hActiveGroup);
834
835 switch(wParam)
836 {
837 /* Menu File */
838 case PM_NEW:
839 switch (DIALOG_New((hActiveGroupWnd && !IsIconic(hActiveGroupWnd)) ?
841 {
842 case PM_NEW_PROGRAM:
843 if (hActiveGroup) PROGRAM_NewProgram(hActiveGroup);
844 break;
845
846 case PM_NEW_GROUP:
848 break;
849 }
850 break;
851
852
853 case PM_DELETE:
854 if (hActiveProgram)
855 {
856 if (DIALOG_Delete(IDS_DELETE_PROGRAM_s, PROGRAM_ProgramName(hActiveProgram)))
857 PROGRAM_DeleteProgram(hActiveProgram, TRUE);
858 }
859 else if (hActiveGroup)
860 {
861 if (DIALOG_Delete(IDS_DELETE_GROUP_s, GROUP_GroupName(hActiveGroup)))
862 GROUP_DeleteGroup(hActiveGroup);
863 }
864 break;
865
866
867
868 case PM_SAVE_SETTINGS:
869 Globals.bSaveSettings = !Globals.bSaveSettings;
871 MF_BYCOMMAND | (Globals.bSaveSettings ?
873 WritePrivateProfileStringA("Settings", "SaveSettings",
874 Globals.bSaveSettings ? "1" : "0",
875 Globals.lpszIniFile);
876 WritePrivateProfileStringA(NULL,NULL,NULL,Globals.lpszIniFile); /* flush it */
877 break;
878
879
880 case PM_ARRANGE:
881
882 if (hActiveGroupWnd && !IsIconic(hActiveGroupWnd))
883 ArrangeIconicWindows(hActiveGroupWnd);
884 else
885 SendMessageW(Globals.hMDIWnd, WM_MDIICONARRANGE, 0, 0);
886 break;
887
888 }
889
890
891
892
893#endif
894
895 DWORD Value;
896
897 PROGGROUP* hActiveGroup;
898 PROGRAM* hActiveProgram;
899 HWND hActiveGroupWnd;
900
901 hActiveGroup = GROUP_ActiveGroup();
902 hActiveProgram = PROGRAM_ActiveProgram(hActiveGroup);
903 hActiveGroupWnd = (hActiveGroup ? hActiveGroup->hWnd : NULL);
904
905 switch (wParam)
906 {
907 /* Menu File */
908
909 case PM_NEW:
910 {
912 INT nResult;
913
914 if (!hActiveGroupWnd || IsIconic(hActiveGroupWnd))
915 Success = DIALOG_New(PM_NEW_GROUP, &nResult);
916 else
917 Success = DIALOG_New(PM_NEW_PROGRAM, &nResult);
918 if (!Success)
919 break;
920
921 if (nResult & 1)
922 {
924 BOOL bIsCommonGroup;
925
926 format = (nResult & 0xC) >> 2;
927 bIsCommonGroup = (nResult & 2) != 0;
928 GROUP_NewGroup(format, bIsCommonGroup);
929 }
930 else if (hActiveGroup)
931 {
932 PROGRAM_NewProgram(hActiveGroup);
933 }
934
935 break;
936 }
937
938 case PM_OPEN:
939 if (hActiveProgram)
940 PROGRAM_ExecuteProgram(hActiveProgram);
941 else if (hActiveGroupWnd)
942 OpenIcon(hActiveGroupWnd);
943 break;
944
945 case PM_MOVE:
946 case PM_COPY:
947 if (hActiveProgram)
948 PROGRAM_CopyMoveProgram(hActiveProgram, wParam == PM_MOVE);
949 break;
950
951 case PM_DELETE:
952 {
953 if (hActiveProgram)
954 {
955 if (DIALOG_Delete(IDS_DELETE_PROGRAM_s, hActiveProgram->hName))
956 PROGRAM_DeleteProgram(hActiveProgram, TRUE);
957 }
958 else if (hActiveGroup && DIALOG_Delete(IDS_DELETE_GROUP_s, hActiveGroup->hName))
959 {
960 GROUP_DeleteGroup(hActiveGroup);
961 }
962 break;
963 }
964
965 case PM_ATTRIBUTES:
966 if (hActiveProgram)
967 PROGRAM_ModifyProgram(hActiveProgram);
968 else if (hActiveGroup)
969 GROUP_ModifyGroup(hActiveGroup);
970 break;
971
972 case PM_EXECUTE:
974 break;
975
976 case PM_EXIT:
977 // MAIN_SaveSettings();
979 break;
980
981
982 /* Menu Options */
983
984 case PM_AUTO_ARRANGE:
985 Globals.bAutoArrange = !Globals.bAutoArrange;
987 MF_BYCOMMAND | (Globals.bAutoArrange ? MF_CHECKED : MF_UNCHECKED));
988 Value = Globals.bAutoArrange;
989 RegSetValueExW(Globals.hKeyPMSettings, L"AutoArrange", 0, REG_DWORD, (LPBYTE)&Value, sizeof(Value));
990 break;
991
992 case PM_MIN_ON_RUN:
993 Globals.bMinOnRun = !Globals.bMinOnRun;
995 MF_BYCOMMAND | (Globals.bMinOnRun ? MF_CHECKED : MF_UNCHECKED));
996 Value = Globals.bMinOnRun;
997 RegSetValueExW(Globals.hKeyPMSettings, L"MinOnRun", 0, REG_DWORD, (LPBYTE)&Value, sizeof(Value));
998 break;
999
1000 case PM_SAVE_SETTINGS:
1001 Globals.bSaveSettings = !Globals.bSaveSettings;
1003 MF_BYCOMMAND | (Globals.bSaveSettings ? MF_CHECKED : MF_UNCHECKED));
1004 Value = Globals.bSaveSettings;
1005 RegSetValueExW(Globals.hKeyPMSettings, L"SaveSettings", 0, REG_DWORD, (LPBYTE)&Value, sizeof(Value));
1006 break;
1007
1010 break;
1011
1012
1013 /* Menu Windows */
1014
1015 case PM_OVERLAP:
1016 SendMessageW(Globals.hMDIWnd, WM_MDICASCADE, 0, 0);
1017 break;
1018
1019 case PM_SIDE_BY_SIDE:
1021 break;
1022
1023 case PM_ARRANGE:
1024 if (!hActiveGroupWnd || IsIconic(hActiveGroupWnd))
1025 SendMessageW(Globals.hMDIWnd, WM_MDIICONARRANGE, 0, 0);
1026 else
1027 SendMessageA(hActiveGroup->hListView, LVM_ARRANGE, 0, 0);
1028 break;
1029
1030
1031 /* Menu Help */
1032
1033 case PM_CONTENTS:
1034 if (!WinHelpW(Globals.hMainWnd, L"progman.hlp", HELP_CONTENTS, 0))
1036 break;
1037
1038 case PM_ABOUT:
1039 ShellAboutW(hWnd, szTitle, NULL, Globals.hMainIcon);
1040 break;
1041
1042 default:
1044 break;
1045 }
1046
1047}
1048
1049/***********************************************************************
1050 *
1051 * MAIN_RegisterMainWinClass
1052 */
1053
1055{
1056 WNDCLASSW wndClass;
1057
1058 wndClass.style = CS_HREDRAW | CS_VREDRAW;
1059 wndClass.lpfnWndProc = MAIN_MainWndProc;
1060 wndClass.cbClsExtra = 0;
1061 wndClass.cbWndExtra = 0;
1062 wndClass.hInstance = Globals.hInstance;
1063 wndClass.hIcon = Globals.hMainIcon;
1064 wndClass.hCursor = LoadCursorW(NULL, IDC_ARROW);
1065 wndClass.hbrBackground = (HBRUSH)GetStockObject(NULL_BRUSH);
1066 wndClass.lpszMenuName = NULL;
1068
1069 return RegisterClassW(&wndClass);
1070}
1071
1072/***********************************************************************
1073 *
1074 * MAIN_CreateMainWindow
1075 */
1076
1078{
1079 INT left, top, right, bottom;
1080 INT width, height;
1081 INT nCmdShow;
1082 WCHAR buffer[100];
1083
1084 LONG lRet;
1085 DWORD dwSize;
1086 DWORD dwType;
1087
1088 Globals.hMDIWnd = NULL;
1089 Globals.hMainMenu = NULL;
1090
1091 /* Get the geometry of the main window */
1092 dwSize = sizeof(buffer);
1093 lRet = RegQueryValueExW(Globals.hKeyPMSettings, L"Window", NULL, &dwType, (LPBYTE)buffer, &dwSize);
1094 if (lRet != ERROR_SUCCESS || dwType != REG_SZ)
1095 buffer[0] = '\0';
1096
1097 if (swscanf(buffer, L"%d %d %d %d %d", &left, &top, &right, &bottom, &nCmdShow) == 5)
1098 {
1099 width = right - left;
1100 height = bottom - top;
1101 }
1102 else
1103 {
1105 nCmdShow = SW_SHOWNORMAL;
1106 }
1107
1108 /* Create the main window */
1111 szTitle,
1112 WS_OVERLAPPEDWINDOW, // /* | WS_CLIPSIBLINGS | WS_CLIPCHILDREN */
1113 left, top, width, height,
1114 NULL, NULL,
1116 NULL);
1117
1119 ShowWindow(Globals.hMainWnd, nCmdShow);
1121}
1122
1123/***********************************************************************
1124 *
1125 * MAIN_CreateMDIWindow
1126 */
1127
1129{
1131 RECT rect;
1132
1133 /* Get the geometry of the MDI window */
1135
1136 ccs.hWindowMenu = Globals.hWindowsMenu;
1138
1139 /* Create MDI Window */
1140 Globals.hMDIWnd =
1142 rect.left, rect.top,
1143 rect.right - rect.left, rect.bottom - rect.top,
1144 Globals.hMainWnd, 0,
1145 Globals.hInstance, &ccs);
1146
1147 /* Reset the background of the MDI client window (default: COLOR_APPWORKSPACE + 1) */
1149
1150 ShowWindow(Globals.hMDIWnd, SW_SHOW);
1151 UpdateWindow(Globals.hMDIWnd);
1152}
1153
1154/**********************************************************************/
1155/***********************************************************************
1156 *
1157 * MAIN_MessageBoxIDS
1158 */
1160{
1163
1166
1168}
1169
1170/***********************************************************************
1171 *
1172 * MAIN_MessageBoxIDS_s
1173 */
1175{
1179
1182 wsprintfW(newtext, text, str);
1183
1184 return MessageBoxW(Globals.hMainWnd, newtext, title, type);
1185}
1186
1187/***********************************************************************
1188 *
1189 * MAIN_ReplaceString
1190 */
1191
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}
char * va_list
Definition: acmsvcex.h:78
#define va_end(ap)
Definition: acmsvcex.h:90
#define va_start(ap, A)
Definition: acmsvcex.h:91
#define skip(...)
Definition: atltest.h:64
#define msg(x)
Definition: auth_time.c:54
void LoadSettings(void)
Definition: settings.c:53
HWND hWnd
Definition: settings.c:17
#define MAX_STRING_LEN
Definition: precomp.h:36
#define IDS_ERROR
Definition: resource.h:18
#define IDS_OUT_OF_MEMORY
Definition: resource.h:5
int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR cmdline, int cmdshow)
Definition: main.c:788
#define IDI_APPICON
Definition: resource.h:166
NOTEPAD_GLOBALS Globals
Definition: main.c:17
WCHAR szTitle[MAX_LOADSTRING]
Definition: main.c:30
#define PM_NEW
Definition: main.h:23
BOOL DIALOG_Delete(UINT ids_text_s, LPCWSTR lpszName)
Definition: dialog.c:361
BOOL DIALOG_New(INT nDefault, PINT pnResult)
Definition: dialog.c:233
VOID DIALOG_Execute(VOID)
Definition: dialog.c:1021
ATOM GROUP_RegisterGroupWinClass(VOID)
Definition: group.c:369
VOID GROUP_ModifyGroup(PROGGROUP *hGroup)
Definition: group.c:596
VOID GROUP_DeleteGroup(PROGGROUP *hGroup)
Definition: group.c:627
VOID GROUP_NewGroup(GROUPFORMAT format, BOOL bIsCommonGroup)
Definition: group.c:392
PROGGROUP * GROUP_ActiveGroup(VOID)
Definition: group.c:671
static VOID MAIN_CreateMainWindow(VOID)
Definition: main.c:1077
INT MAIN_MessageBoxIDS_s(UINT ids_text, LPCWSTR str, UINT ids_title, WORD type)
Definition: main.c:1174
static LRESULT CALLBACK MAIN_MainWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: main.c:759
static VOID MAIN_LoadGroups(VOID)
Definition: main.c:719
static VOID MAIN_AutoStart(VOID)
Definition: main.c:728
VOID PrintString(IN LPCWSTR szStr,...)
Definition: main.c:124
static ATOM MAIN_RegisterMainWinClass(VOID)
Definition: main.c:1054
#define BUFFER_SIZE
Definition: main.c:55
static VOID MAIN_MenuCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
Definition: main.c:828
static VOID MAIN_CreateMDIWindow(VOID)
Definition: main.c:1128
VOID PrintResourceString(IN UINT uID,...)
Definition: main.c:134
INT MAIN_MessageBoxIDS(UINT ids_text, UINT ids_title, WORD type)
Definition: main.c:1159
static BOOL MAIN_LoadSettings(VOID)
Definition: main.c:332
VOID MAIN_ReplaceString(LPWSTR *string, LPWSTR replace)
Definition: main.c:1192
static BOOL MAIN_SaveSettings(VOID)
Definition: main.c:577
static BOOL GetUserAndDomainName(OUT LPWSTR *UserName, OUT LPWSTR *DomainName)
Definition: main.c:183
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
int ShowLastWin32Error(VOID)
Definition: main.c:158
VOID PrintStringV(IN LPCWSTR szStr, IN va_list args)
Definition: main.c:114
static VOID MAIN_SetMainWindowTitle(VOID)
Definition: main.c:295
VOID PrintWin32Error(IN LPWSTR Message, IN DWORD ErrorCode)
Definition: main.c:146
PVOID AppendToBuffer(IN PVOID pBuffer, IN PSIZE_T pdwBufferSize, IN PVOID pData, IN SIZE_T dwDataSize)
Definition: main.c:84
#define WC_MDICLIENT
Definition: main.c:42
#define IDS_NOT_IMPLEMENTED
Definition: resource.h:59
#define PM_EXIT
Definition: resource.h:84
#define PM_CONTENTS
Definition: resource.h:101
#define PM_MIN_ON_RUN
Definition: resource.h:87
#define PM_OVERLAP
Definition: resource.h:91
#define IDI_GROUP_PERSONAL_ICON
Definition: resource.h:40
#define PM_ARRANGE
Definition: resource.h:93
#define PM_SAVE_SETTINGS
Definition: resource.h:88
#define PM_NEW_PROGRAM
Definition: resource.h:118
#define IDS_FILE_READ_ERROR_s
Definition: resource.h:60
#define IDS_WINHELP_ERROR
Definition: resource.h:64
#define PM_FIRST_CHILD
Definition: resource.h:94
#define PM_ABOUT
Definition: resource.h:102
#define PM_NEW_GROUP
Definition: resource.h:117
#define IDI_GROUP_COMMON_ICON
Definition: resource.h:41
#define PM_SAVE_SETTINGS_NOW
Definition: resource.h:89
#define PM_AUTO_ARRANGE
Definition: resource.h:86
#define PM_SIDE_BY_SIDE
Definition: resource.h:92
#define PM_EXECUTE
Definition: resource.h:83
#define PM_COPY
Definition: resource.h:80
#define IDS_DELETE_PROGRAM_s
Definition: resource.h:56
#define IDA_ACCEL
Definition: resource.h:47
#define PM_OPEN
Definition: resource.h:78
#define IDS_DELETE_GROUP_s
Definition: resource.h:55
#define PM_DELETE
Definition: resource.h:81
#define PM_ATTRIBUTES
Definition: resource.h:82
#define PM_MOVE
Definition: resource.h:79
#define RegCloseKey(hKey)
Definition: registry.h:49
HINSTANCE hInstance
Definition: charmap.c:19
Definition: bufpool.h:45
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:900
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define ERROR_SUCCESS
Definition: deptool.c:10
WORD ATOM
Definition: dimm.idl:113
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
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
BOOL WINAPI LookupAccountSidW(LPCWSTR pSystemName, PSID pSid, LPWSTR pAccountName, LPDWORD pdwAccountName, LPWSTR pDomainName, LPDWORD pdwDomainName, PSID_NAME_USE peUse)
Definition: misc.c:537
BOOL WINAPI GetTokenInformation(HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength)
Definition: security.c:411
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:294
#define CloseHandle
Definition: compat.h:739
#define wcschr
Definition: compat.h:17
#define GetProcessHeap()
Definition: compat.h:736
#define SetLastError(x)
Definition: compat.h:752
#define HeapAlloc
Definition: compat.h:733
#define HeapReAlloc
Definition: compat.h:734
#define GetCurrentProcess()
Definition: compat.h:759
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define CALLBACK
Definition: compat.h:35
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2352
BOOL WINAPI SetProcessShutdownParameters(IN DWORD dwLevel, IN DWORD dwFlags)
Definition: proc.c:949
DWORD WINAPI GetPrivateProfileSectionNamesW(LPWSTR buffer, DWORD size, LPCWSTR filename)
Definition: profile.c:1641
INT WINAPI GetPrivateProfileStringA(LPCSTR section, LPCSTR entry, LPCSTR def_val, LPSTR buffer, UINT len, LPCSTR filename)
Definition: profile.c:1204
INT WINAPI GetPrivateProfileSectionW(LPCWSTR section, LPWSTR buffer, DWORD len, LPCWSTR filename)
Definition: profile.c:1351
BOOL WINAPI DECLSPEC_HOTPATCH WritePrivateProfileStringA(LPCSTR section, LPCSTR entry, LPCSTR string, LPCSTR filename)
Definition: profile.c:1484
DWORD WINAPI FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:583
const WCHAR * text
Definition: package.c:1794
static const WCHAR Message[]
Definition: register.c:74
@ Success
Definition: eventcreate.c:712
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
FxAutoRegKey hKey
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLsizeiptr size
Definition: glext.h:5919
GLuint buffer
Definition: glext.h:5915
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
GLuint GLuint num
Definition: glext.h:9618
DWORD GRPFILE_ReadGroupFile(LPCWSTR lpszPath, BOOL bIsCommonGroup)
Definition: grpfile.c:65
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
_Check_return_ _CRTIMP int __cdecl swscanf(_In_z_ const wchar_t *_Src, _In_z_ _Scanf_format_string_ const wchar_t *_Format,...)
_CRTIMP int __cdecl _vsnwprintf(wchar_t *_Dest, size_t _Count, const wchar_t *_Format, va_list _Args)
_Check_return_ _CRTIMP int __cdecl sscanf(_In_z_ const char *_Src, _In_z_ _Scanf_format_string_ const char *_Format,...)
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define REG_SZ
Definition: layer.c:22
enum _SID_NAME_USE SID_NAME_USE
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
int _snwprintf(wchar_t *buffer, size_t count, const wchar_t *format,...)
LPCWSTR szPath
Definition: env.c:37
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
static PVOID ptr
Definition: dispmode.c:27
#define sprintf(buf, format,...)
Definition: sprintf.c:55
unsigned int UINT
Definition: ndis.h:50
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4436
#define KEY_READ
Definition: nt_native.h:1023
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
#define KEY_WRITE
Definition: nt_native.h:1031
#define L(x)
Definition: ntvdm.h:50
#define LOWORD(l)
Definition: pedump.c:82
#define WS_CHILD
Definition: pedump.c:617
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define WS_VSCROLL
Definition: pedump.c:627
long LONG
Definition: pedump.c:60
#define WS_HSCROLL
Definition: pedump.c:628
#define WS_CLIPCHILDREN
Definition: pedump.c:619
VOID PROGRAM_CopyMoveProgram(PROGRAM *hProgram, BOOL bMove)
Definition: program.c:236
VOID PROGRAM_ModifyProgram(PROGRAM *hProgram)
Definition: program.c:116
VOID STRING_LoadStrings(VOID)
Definition: string.c:36
VOID PROGRAM_DeleteProgram(PROGRAM *hProgram, BOOL bUpdateGrpFile)
Definition: program.c:289
VOID STRING_LoadMenus(VOID)
Definition: string.c:41
PROGRAM * PROGRAM_ActiveProgram(PROGGROUP *hGroup)
Definition: program.c:331
VOID PROGRAM_ExecuteProgram(PROGRAM *hProgram)
Definition: program.c:274
#define STRING_MAIN_WIN_CLASS_NAME
Definition: progman.h:251
enum _GROUPFORMAT GROUPFORMAT
#define MAX_PATHNAME_LEN
Definition: progman.h:54
VOID PROGRAM_NewProgram(PROGGROUP *hGroup)
Definition: program.c:80
static char title[]
Definition: ps.c:92
#define LVM_ARRANGE
Definition: commctrl.h:2537
#define ICC_HOTKEY_CLASS
Definition: commctrl.h:64
#define ICC_LISTVIEW_CLASSES
Definition: commctrl.h:58
PVOID pBuffer
INT replace(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], DWORD dwFlags, BOOL *doMore)
Definition: replace.c:38
const WCHAR * str
#define REG_DWORD
Definition: sdbapi.c:596
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define LANG_NEUTRAL
Definition: nls.h:22
#define MAKELANGID(p, s)
Definition: nls.h:15
#define SUBLANG_DEFAULT
Definition: nls.h:168
#define args
Definition: format.c:66
BOOL WINAPI ShellAboutW(HWND hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff, HICON hIcon)
& rect
Definition: startmenu.cpp:1413
STRSAFEAPI StringCbPrintfW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:557
HINSTANCE hInstance
Definition: notepad.h:60
HWND hMainWnd
Definition: notepad.h:61
PROGRAM * hPrograms
Definition: progman.h:139
LPWSTR hName
Definition: progman.h:138
HWND hWnd
Definition: progman.h:116
PROGGROUP * hNext
Definition: progman.h:115
PROGRAM * hNext
Definition: progman.h:85
SID_AND_ATTRIBUTES User
Definition: setypes.h:1010
RECT rcNormalPosition
Definition: winuser.h:3298
LPCWSTR lpszClassName
Definition: winuser.h:3188
LPCWSTR lpszMenuName
Definition: winuser.h:3187
HBRUSH hbrBackground
Definition: winuser.h:3186
HICON hIcon
Definition: winuser.h:3184
HINSTANCE hInstance
Definition: winuser.h:3183
int cbClsExtra
Definition: winuser.h:3181
UINT style
Definition: winuser.h:3179
WNDPROC lpfnWndProc
Definition: winuser.h:3180
int cbWndExtra
Definition: winuser.h:3182
HCURSOR hCursor
Definition: winuser.h:3185
Definition: match.c:390
Definition: format.c:58
Definition: copy.c:22
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1830
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
ULONG_PTR * PSIZE_T
Definition: typedefs.h:80
unsigned char * LPBYTE
Definition: typedefs.h:53
ULONG_PTR SIZE_T
Definition: typedefs.h:80
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
#define OUT
Definition: typedefs.h:40
int ret
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:449
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:445
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define WINAPI
Definition: msvc.h:6
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define NULL_BRUSH
Definition: wingdi.h:901
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define SW_SHOWNORMAL
Definition: winuser.h:773
#define CS_VREDRAW
Definition: winuser.h:658
#define WM_MDITILE
Definition: winuser.h:1821
#define SetClassLongPtrW
Definition: winuser.h:5277
LRESULT WINAPI DefFrameProcW(_In_ HWND, _In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define MF_BYCOMMAND
Definition: winuser.h:202
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define COLOR_WINDOW
Definition: winuser.h:921
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
UINT WINAPI ArrangeIconicWindows(_In_ HWND)
BOOL WINAPI GetMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
BOOL WINAPI GetWindowPlacement(_In_ HWND, _Inout_ WINDOWPLACEMENT *)
#define WM_MDICASCADE
Definition: winuser.h:1822
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define HELP_CONTENTS
Definition: winuser.h:2408
#define WM_COMMAND
Definition: winuser.h:1743
#define CS_HREDRAW
Definition: winuser.h:653
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
#define IDC_ARROW
Definition: winuser.h:687
BOOL WINAPI WinHelpW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_ UINT, _In_ ULONG_PTR)
BOOL WINAPI OpenIcon(_In_ HWND)
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define MF_CHECKED
Definition: winuser.h:132
#define WM_INITMENU
Definition: winuser.h:1748
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2157
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
#define IDI_WINLOGO
Definition: winuser.h:709
#define MF_UNCHECKED
Definition: winuser.h:204
BOOL WINAPI IsIconic(_In_ HWND)
DWORD WINAPI CheckMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define WM_MDIICONARRANGE
Definition: winuser.h:1823
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI TranslateMDISysAccel(_In_ HWND, _In_ LPMSG)
#define MF_ENABLED
Definition: winuser.h:128
BOOL WINAPI UpdateWindow(_In_ HWND)
#define MB_OK
Definition: winuser.h:793
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4319
#define CW_USEDEFAULT
Definition: winuser.h:225
HACCEL WINAPI LoadAcceleratorsW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
int WINAPI TranslateAcceleratorW(_In_ HWND, _In_ HACCEL, _In_ LPMSG)
#define SW_SHOW
Definition: winuser.h:778
#define WM_DESTROY
Definition: winuser.h:1612
#define MDITILE_VERTICAL
Definition: winuser.h:2192
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define GCLP_HBRBACKGROUND
Definition: winuser.h:672
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2127
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define MF_GRAYED
Definition: winuser.h:129
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION Free
Definition: exfuncs.h:815
#define TOKEN_QUERY
Definition: setypes.h:928
@ TokenUser
Definition: setypes.h:966
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
char CHAR
Definition: xmlstorage.h:175