xref: /reactos/dll/win32/storprop/disk.c (revision 1734f297)
1 /*
2  * PROJECT:     ReactOS system libraries
3  * LICENSE:     GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4  * PURPOSE:     Storage device properties
5  * COPYRIGHT:   2021 Eric Kohl (eric.kohl@reactos.org)
6  */
7 
8 #include "precomp.h"
9 
10 #define NDEBUG
11 #include <debug.h>
12 
13 
14 static
15 INT_PTR
16 CALLBACK
17 DiskPropPageDialog(
18     _In_ HWND hwnd,
19     _In_ UINT uMsg,
20     _In_ WPARAM wParam,
21     _In_ LPARAM lParam)
22 {
23     DPRINT1("DiskPropPageDialog()\n");
24 
25     switch (uMsg)
26     {
27         case WM_INITDIALOG:
28             return TRUE; //OnInitDialog(hwnd, wParam, lParam);
29 
30         case WM_COMMAND:
31             EndDialog(hwnd, 0); //OnCommand(hwnd, wParam, lParam);
32             break;
33 /*
34         case WM_NOTIFY:
35             OnNotify(hwnd, wParam, lParam);
36             break;
37 
38         case WM_DESTROY:
39             OnDestroy(hwnd);
40             break;
41 */
42     }
43 
44     return FALSE;
45 }
46 
47 
48 /*
49  * @unimplemented
50  */
51 DWORD
52 WINAPI
53 DiskClassInstaller(
54     _In_ DI_FUNCTION InstallFunction,
55     _In_ HDEVINFO DeviceInfoSet,
56     _In_ PSP_DEVINFO_DATA DeviceInfoData OPTIONAL)
57 {
58     SP_ADDPROPERTYPAGE_DATA AddPropertyPageData = {0};
59     PROPSHEETPAGE Page;
60     HPROPSHEETPAGE PageHandle;
61 
62     DPRINT1("DiskClassInstaller(%u %p %p)\n",
63            InstallFunction, DeviceInfoSet, DeviceInfoData);
64 
65     if (InstallFunction == DIF_ADDPROPERTYPAGE_ADVANCED)
66     {
67         if (DeviceInfoData == NULL)
68             return ERROR_DI_DO_DEFAULT;
69 
70         AddPropertyPageData.ClassInstallHeader.cbSize = sizeof(SP_CLASSINSTALL_HEADER);
71         if (SetupDiGetClassInstallParamsW(DeviceInfoSet,
72                                           DeviceInfoData,
73                                           (PSP_CLASSINSTALL_HEADER)&AddPropertyPageData,
74                                           sizeof(SP_ADDPROPERTYPAGE_DATA),
75                                           NULL))
76         {
77             DPRINT1("\n");
78             if (AddPropertyPageData.NumDynamicPages >= MAX_INSTALLWIZARD_DYNAPAGES)
79                 return ERROR_SUCCESS;
80 
81             ZeroMemory(&Page, sizeof(PROPSHEETPAGE));
82             Page.dwSize = sizeof(PROPSHEETPAGE);
83             Page.dwFlags = PSP_USECALLBACK;
84             Page.hInstance = hInstance;
85             Page.pszTemplate = MAKEINTRESOURCE(IDD_DISK_POLICIES);
86             Page.pfnDlgProc = DiskPropPageDialog;
87             Page.pfnCallback = NULL; //DiskPropPageCallback;
88             Page.lParam = (LPARAM)NULL;
89 
90             PageHandle = CreatePropertySheetPage(&Page);
91             if (PageHandle == NULL)
92             {
93                 DPRINT1("CreatePropertySheetPage() failed!\n");
94                 return ERROR_SUCCESS;
95             }
96 
97             AddPropertyPageData.DynamicPages[AddPropertyPageData.NumDynamicPages] = PageHandle;
98             AddPropertyPageData.NumDynamicPages++;
99             DPRINT1("Pages: %ld\n", AddPropertyPageData.NumDynamicPages);
100 
101             if (!SetupDiSetClassInstallParamsW(DeviceInfoSet,
102                                                DeviceInfoData,
103                                                (PSP_CLASSINSTALL_HEADER)&AddPropertyPageData,
104                                                sizeof(SP_ADDPROPERTYPAGE_DATA)))
105             {
106                 DPRINT1("SetupDiSetClassInstallParamsW() failed (Error %lu)\n", GetLastError());
107             }
108         }
109 
110         return ERROR_SUCCESS;
111     }
112 
113     return ERROR_DI_DO_DEFAULT;
114 }
115 
116 /* EOF */
117