ReactOS 0.4.15-dev-8135-g1bc6c90
vcdcontroltool.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Virtual CD Control Tool
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: modules/rosapps/applications/vcdcontroltool/vcdcontroltool.c
5 * PURPOSE: main dialog implementation
6 * COPYRIGHT: Copyright 2018 Pierre Schweitzer
7 *
8 */
9
10#define WIN32_NO_STATUS
11#include <stdarg.h>
12#include <windef.h>
13#include <winbase.h>
14#include <winuser.h>
15#include <wingdi.h>
16#include <winsvc.h>
17#include <winreg.h>
18#include <commctrl.h>
19#include <commdlg.h>
20#include <wchar.h>
21#include <ndk/rtltypes.h>
22#include <ndk/rtlfuncs.h>
23
24#include <vcdioctl.h>
25#define IOCTL_CDROM_BASE FILE_DEVICE_CD_ROM
26#define IOCTL_CDROM_EJECT_MEDIA CTL_CODE(IOCTL_CDROM_BASE, 0x0202, METHOD_BUFFERED, FILE_READ_ACCESS)
27
28#include "resource.h"
29
34/* FIXME: to improve, ugly hack */
36
37static
40{
41 /* Just open the device */
42 return CreateFile(L"\\\\.\\\\VirtualCdRom", GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
44}
45
46static
49{
50 WCHAR Device[255];
51
52 /* Make name */
53 wsprintf(Device, L"\\\\.\\%c:", Letter);
54
55 /* And open */
58}
59
60static
61VOID
63{
64 HWND hListView;
65 WCHAR szFormat[50];
66 WCHAR szText[MAX_PATH + 50];
67 WCHAR szImage[MAX_PATH];
68 HANDLE hMaster, hLet;
70 DRIVES_LIST Drives;
71 BOOLEAN Res;
73 LVITEMW lvItem;
74 LRESULT lResult;
75 INT iSelected;
76
77 /* Get our list view */
78 hListView = GetDlgItem(hWnd, IDC_MAINDEVICES);
79
80 /* Purge it */
81 SendMessage(hListView, LVM_DELETEALLITEMS, 0, 0);
82
83 /* Now, query the driver for all the devices */
84 hMaster = OpenMaster();
85 if (hMaster != INVALID_HANDLE_VALUE)
86 {
87 Res = DeviceIoControl(hMaster, IOCTL_VCDROM_ENUMERATE_DRIVES, NULL, 0, &Drives, sizeof(Drives), &BytesRead, NULL);
88 CloseHandle(hMaster);
89
90 if (Res)
91 {
92 /* Loop to add all the devices to the list */
93 iSelected = -1;
94 for (i = 0; i < Drives.Count; ++i)
95 {
96 /* We'll query device one by one */
97 hLet = OpenLetter(Drives.Drives[i]);
98 if (hLet != INVALID_HANDLE_VALUE)
99 {
100 /* Get info about the mounted image */
102 if (Res)
103 {
104 /* First of all, add our driver letter to the list */
105 ZeroMemory(&lvItem, sizeof(LVITEMW));
106 lvItem.mask = LVIF_TEXT;
107 lvItem.pszText = szText;
108 lvItem.iItem = i;
109 szText[0] = Drives.Drives[i];
110 szText[1] = L':';
111 szText[2] = 0;
112
113 /* If it worked, we'll complete with the info about the device:
114 * (mounted? which image?)
115 */
116 lResult = SendMessage(hListView, LVM_INSERTITEM, 0, (LPARAM)&lvItem);
117 if (lResult != -1)
118 {
119 /* If it matches arg, that's the letter to select at the end */
120 if (Drives.Drives[i] == Letter)
121 {
122 iSelected = lResult;
123 }
124
125 /* We'll fill second column with info */
126 lvItem.iSubItem = 1;
127
128 /* Gather the image path */
129 if (Image.Length != 0)
130 {
131 memcpy(szImage, Image.Path, Image.Length);
132 szImage[(Image.Length / sizeof(WCHAR))] = L'\0';
133 }
134
135 /* It's not mounted... */
136 if (Image.Mounted == 0)
137 {
138 /* If we don't have an image, set default text instead */
139 if (Image.Length == 0)
140 {
141 szImage[0] = 0;
142 LoadString(hInstance, IDS_NONE, szImage, sizeof(szImage) / sizeof(WCHAR));
143 szImage[(sizeof(szImage) / sizeof(WCHAR)) - 1] = L'\0';
144 }
145
146 /* Display the last known image */
147 szFormat[0] = 0;
148 LoadString(hInstance, IDS_NOMOUNTED, szFormat, sizeof(szFormat) / sizeof(WCHAR));
149 szFormat[(sizeof(szFormat) / sizeof(WCHAR)) - 1] = L'\0';
150
151 swprintf(szText, szFormat, szImage);
152 lvItem.pszText = szText;
153 }
154 else
155 {
156 /* Mounted, just display the image path */
157 lvItem.pszText = szImage;
158 }
159
160 /* Set text */
161 SendMessage(hListView, LVM_SETITEM, lResult, (LPARAM)&lvItem);
162 }
163 }
164
165 /* Don't leak our device */
166 CloseHandle(hLet);
167 }
168 }
169
170 /* If we had something to select, then just do it */
171 if (iSelected != -1)
172 {
173 ZeroMemory(&lvItem, sizeof(LVITEMW));
174
175 lvItem.mask = LVIF_STATE;
176 lvItem.iItem = iSelected;
179 SendMessage(hListView, LVM_SETITEMSTATE, iSelected, (LPARAM)&lvItem);
180 }
181 }
182 }
183}
184
185VOID
187{
188 HWND hControl;
189
190 /* If started, disable start button */
192 EnableWindow(hControl, !Started);
193
194 /* If started, enable stop button */
196 EnableWindow(hControl, Started);
197}
198
201{
203 SC_HANDLE hMgr, hSvc;
205 WCHAR szText[2 * MAX_PATH];
206 HWND hControl;
208
209 hDriverWnd = hDlg;
210
211 /* Open service manager */
213 if (hMgr != NULL)
214 {
215 /* Open our service */
217 if (hSvc != NULL)
218 {
219 /* Probe its config size */
220 if (!QueryServiceConfig(hSvc, NULL, 0, &dwSize) &&
222 {
223 /* And get its config */
224 pConfig = HeapAlloc(GetProcessHeap(), 0, dwSize);
225
226 if (QueryServiceConfig(hSvc, pConfig, dwSize, &dwSize))
227 {
228 /* Display name & driver */
229 wsprintf(szText, L"%s:\n(%s)", pConfig->lpDisplayName, pConfig->lpBinaryPathName);
231 SendMessage(hControl, WM_SETTEXT, 0, (LPARAM)szText);
232 }
233
234 HeapFree(GetProcessHeap(), 0, pConfig);
235 }
236
237 /* Get its status */
238 if (QueryServiceStatus(hSvc, &Status))
239 {
240 if (Status.dwCurrentState != SERVICE_RUNNING &&
241 Status.dwCurrentState != SERVICE_START_PENDING)
242 {
244 }
245 else
246 {
248 }
249 }
250
251 CloseServiceHandle(hSvc);
252 }
253
254 CloseServiceHandle(hMgr);
255 }
256
257 /* FIXME: we don't allow uninstall/install */
258 {
260 EnableWindow(hControl, FALSE);
262 EnableWindow(hControl, FALSE);
263 }
264
265 /* Display our sub window */
266 ShowWindow(hDlg, SW_SHOW);
267
268 return TRUE;
269}
270
271static
272VOID
274{
275 SC_HANDLE hMgr, hSvc;
276
277 /* Open the SC manager */
279 if (hMgr != NULL)
280 {
281 /* Open the service matching our driver */
282 hSvc = OpenService(hMgr, L"Vcdrom", SERVICE_START);
283 if (hSvc != NULL)
284 {
285 /* Start it */
286 /* FIXME: improve */
287 StartService(hSvc, 0, NULL);
288
289 CloseServiceHandle(hSvc);
290
291 /* Refresh the list in case there were persistent mounts */
293
294 /* Update buttons */
296 }
297
298 CloseServiceHandle(hMgr);
299 }
300}
301
302static
303VOID
305{
306 SC_HANDLE hMgr, hSvc;
308
309 /* Open the SC manager */
311 if (hMgr != NULL)
312 {
313 /* Open the service matching our driver */
314 hSvc = OpenService(hMgr, L"Vcdrom", SERVICE_STOP);
315 if (hSvc != NULL)
316 {
317 /* Stop it */
318 /* FIXME: improve */
320
321 CloseServiceHandle(hSvc);
322
323 /* Refresh the list to clear it */
325
326 /* Update buttons */
328 }
329
330 CloseServiceHandle(hMgr);
331 }
332}
333
334static
338{
339 WORD Msg;
340
341 /* Dispatch the message for the controls we manage */
342 Msg = LOWORD(wParam);
343 switch (Msg)
344 {
345 case IDC_DRIVEROK:
347 return TRUE;
348
349 case IDC_DRIVERSTART:
350 StartDriver();
351 return TRUE;
352
353 case IDC_DRIVERSTOP:
354 StopDriver();
355 return TRUE;
356 }
357
358 return FALSE;
359}
360
361static
368{
369 /* Dispatch the message */
370 switch (Message)
371 {
372 case WM_INITDIALOG:
373 return QueryDriverInfo(hDlg);
374
375 case WM_COMMAND:
377
378 case WM_CLOSE:
379 return DestroyWindow(hDlg);
380 }
381
382 return FALSE;
383}
384
385static
386VOID
388{
389 /* Just create a new window with our driver control dialog */
392 NULL,
394 0);
395}
396
397static
401{
402 HWND hEditText;
403
404 hMountWnd = hDlg;
405
406 /* Set the file name that was passed when creating dialog */
407 hEditText = GetDlgItem(hMountWnd, IDC_MOUNTIMAGE);
408 SendMessage(hEditText, WM_SETTEXT, 0, lParam);
409
410 /* Show our window */
411 ShowWindow(hDlg, SW_SHOW);
412
413 return TRUE;
414}
415
417DWORD
419{
420 return (a > b ? b : a);
421}
422
423static
424VOID
426{
427 HWND hControl;
428 WCHAR szFileName[MAX_PATH];
429 MOUNT_PARAMETERS MountParams;
430 UNICODE_STRING NtPathName;
431 HANDLE hLet;
433 BOOLEAN bPersist, Res;
434 WCHAR szKeyName[256];
435 HKEY hKey;
436
437 /* Zero our input structure */
438 ZeroMemory(&MountParams, sizeof(MOUNT_PARAMETERS));
439
440 /* Do we have to suppress UDF? */
441 hControl = GetDlgItem(hMountWnd, IDC_MOUNTUDF);
442 if (SendMessage(hControl, BM_GETCHECK, 0, 0) == BST_CHECKED)
443 {
444 MountParams.Flags |= MOUNT_FLAG_SUPP_UDF;
445 }
446
447 /* Do we have to suppress Joliet? */
449 if (SendMessage(hControl, BM_GETCHECK, 0, 0) == BST_CHECKED)
450 {
451 MountParams.Flags |= MOUNT_FLAG_SUPP_JOLIET;
452 }
453
454 /* Should the mount be persistent? */
456 bPersist = (SendMessage(hControl, BM_GETCHECK, 0, 0) == BST_CHECKED);
457
458 /* Get the file name */
460 GetWindowText(hControl, szFileName, sizeof(szFileName) / sizeof(WCHAR));
461
462 /* Get NT path for the driver */
463 if (RtlDosPathNameToNtPathName_U(szFileName, &NtPathName, NULL, NULL))
464 {
465 /* Copy it in the parameter structure */
466 wcsncpy(MountParams.Path, NtPathName.Buffer, 255);
467 MountParams.Length = Min(NtPathName.Length, 255 * sizeof(WCHAR));
468 RtlFreeHeap(RtlGetProcessHeap(), 0, NtPathName.Buffer);
469
470 /* Open the device */
471 hLet = OpenLetter(wMountLetter);
472 if (hLet != INVALID_HANDLE_VALUE)
473 {
474 /* And issue the mount IOCTL */
475 Res = DeviceIoControl(hLet, IOCTL_VCDROM_MOUNT_IMAGE, &MountParams, sizeof(MountParams), NULL, 0, &BytesRead, NULL);
476
477 CloseHandle(hLet);
478
479 /* Refresh the list so that our mount appears */
481
482 /* If mount succeed and has to persistent, write it to registry */
483 if (Res && bPersist)
484 {
485 wsprintf(szKeyName, L"SYSTEM\\CurrentControlSet\\Services\\Vcdrom\\Parameters\\Device%c", wMountLetter);
487 {
488 wcsncpy(szKeyName, MountParams.Path, MountParams.Length);
489 szKeyName[MountParams.Length / sizeof(WCHAR)] = 0;
490 RegSetValueExW(hKey, L"IMAGE", 0, REG_SZ, (BYTE *)szKeyName, MountParams.Length);
491
492 szKeyName[0] = wMountLetter;
493 szKeyName[1] = L':';
494 szKeyName[2] = 0;
495 RegSetValueExW(hKey, L"DRIVE", 0, REG_SZ, (BYTE *)szKeyName, 3 * sizeof(WCHAR));
496
498 }
499 }
500 }
501 }
502
504}
505
506static
510{
511 WORD Msg;
512
513 /* Dispatch the message for the controls we manage */
514 Msg = LOWORD(wParam);
515 switch (Msg)
516 {
517 case IDC_MOUNTCANCEL:
519 return TRUE;
520
521 case IDC_MOUNTOK:
522 PerformMount();
523 return TRUE;
524 }
525
526 return FALSE;
527}
528
529static
536{
537 /* Dispatch the message */
538 switch (Message)
539 {
540 case WM_INITDIALOG:
541 return SetMountFileName(hDlg, lParam);
542
543 case WM_COMMAND:
545
546 case WM_CLOSE:
547 return DestroyWindow(hDlg);
548 }
549
550 return FALSE;
551}
552
553static
554VOID
556{
558 BOOLEAN Res;
560 HANDLE hMaster;
561
562 /* Open the driver */
563 hMaster = OpenMaster();
564 if (hMaster != INVALID_HANDLE_VALUE)
565 {
566 /* Issue the create IOCTL */
567 Res = DeviceIoControl(hMaster, IOCTL_VCDROM_CREATE_DRIVE, NULL, 0, &Letter, sizeof(WCHAR), &BytesRead, NULL);
568 CloseHandle(hMaster);
569
570 /* If it failed, reset the drive letter */
571 if (!Res)
572 {
573 Letter = 0;
574 }
575
576 /* Refresh devices list. If it succeed, we pass the created drive letter
577 * So that, user can directly click on "mount" to mount an image, without
578 * needing to select appropriate device.
579 */
581 }
582}
583
584static
585WCHAR
587{
588 INT iItem;
589 HWND hListView;
590 LVITEM lvItem;
591 WCHAR szText[255];
592
593 /* Get the select device in the list view */
594 hListView = GetDlgItem(hWnd, IDC_MAINDEVICES);
595 iItem = SendMessage(hListView, LVM_GETNEXTITEM, -1, LVNI_SELECTED);
596 /* If there's one... */
597 if (iItem != -1)
598 {
599 ZeroMemory(&lvItem, sizeof(LVITEM));
600 lvItem.pszText = szText;
601 lvItem.cchTextMax = sizeof(szText) / sizeof(WCHAR);
602 szText[0] = 0;
603
604 /* Get the item text, it will be the drive letter */
605 SendMessage(hListView, LVM_GETITEMTEXT, iItem, (LPARAM)&lvItem);
606 return szText[0];
607 }
608
609 /* Nothing selected */
610 return 0;
611}
612
613static
614VOID
616{
617 WCHAR szFilter[255];
618 WCHAR szFileName[MAX_PATH];
619 OPENFILENAMEW ImageOpen;
620
621 /* Get the selected drive letter
622 * FIXME: I make it global, because I don't know how to pass
623 * it properly to the later involved functions.
624 * Feel free to improve (without breaking ;-))
625 */
627 /* We can only mount if we have a device */
628 if (wMountLetter != 0)
629 {
630 /* First of all, we need an image to mount */
631 ZeroMemory(&ImageOpen, sizeof(OPENFILENAMEW));
632
633 ImageOpen.lStructSize = sizeof(ImageOpen);
634 ImageOpen.hwndOwner = NULL;
635 ImageOpen.lpstrFilter = szFilter;
636 ImageOpen.lpstrFile = szFileName;
637 ImageOpen.nMaxFile = MAX_PATH;
639
640 /* Get our filter (only supported images) */
641 szFileName[0] = 0;
642 szFilter[0] = 0;
644 szFilter[(sizeof(szFilter) / sizeof(WCHAR)) - 1] = L'\0';
645
646 /* Get the image name */
647 if (!GetOpenFileName(&ImageOpen))
648 {
649 /* The user canceled... */
650 return;
651 }
652
653 /* Start the mount dialog, so that user can select mount options */
656 NULL,
658 (LPARAM)szFileName);
659 }
660}
661
662static
663VOID
665{
667 HANDLE hLet;
669
670 /* Get the select drive letter */
672 if (Letter != 0)
673 {
674 /* Open it */
675 hLet = OpenLetter(Letter);
676 if (hLet != INVALID_HANDLE_VALUE)
677 {
678 /* And ask the driver for a remount */
680
681 CloseHandle(hLet);
682
683 /* Refresh the list, to display the fact the image is now mounted.
684 * Make sure it's selected as it was previously selected.
685 */
687 }
688 }
689}
690
691static
692VOID
694{
696 HANDLE hLet;
698
699 /* Get the select drive letter */
701 if (Letter != 0)
702 {
703 /* Open it */
704 hLet = OpenLetter(Letter);
705 if (hLet != INVALID_HANDLE_VALUE)
706 {
707 /* And ask the driver for an ejection */
709
710 CloseHandle(hLet);
711
712 /* Refresh the list, to display the fact the image is now unmounted but
713 * still known by the driver
714 * Make sure it's selected as it was previously selected.
715 */
717 }
718 }
719}
720
721static
722VOID
724{
726 HANDLE hLet;
728
729 /* Get the select drive letter */
731 if (Letter != 0)
732 {
733 /* Open it */
734 hLet = OpenLetter(Letter);
735 if (hLet != INVALID_HANDLE_VALUE)
736 {
737 /* And ask the driver for a deletion */
739
740 CloseHandle(hLet);
741
742 /* Refresh the list, to make the device disappear */
744 }
745 }
746}
747
748static
752{
753 WORD Msg;
754
755 /* Dispatch the message for the controls we manage */
756 Msg = LOWORD(wParam);
757 switch (Msg)
758 {
759 case IDC_MAINCONTROL:
761 return TRUE;
762
763 case IDC_MAINOK:
765 return TRUE;
766
767 case IDC_MAINADD:
768 AddDrive();
769 return TRUE;
770
771 case IDC_MAINMOUNT:
772 MountImage();
773 return TRUE;
774
775 case IDC_MAINREMOUNT:
776 RemountImage();
777 return TRUE;
778
779 case IDC_MAINEJECT:
780 EjectDrive();
781 return TRUE;
782
783 case IDC_MAINREMOVE:
784 RemoveDrive();
785 return TRUE;
786 }
787
788 return FALSE;
789}
790
791static
793{
794 HWND hEditText;
795 static const WCHAR szText[] = { L'0', 0 };
796
797 /* Simply set '0' in all the edittext controls we
798 * manage regarding statistics.
799 */
800 hEditText = GetDlgItem(hWnd, IDC_MAINSECTORS);
801 SendMessage(hEditText, WM_SETTEXT, 0, (LPARAM)szText);
802
803 hEditText = GetDlgItem(hWnd, IDC_MAINSIZE);
804 SendMessage(hEditText, WM_SETTEXT, 0, (LPARAM)szText);
805
806 hEditText = GetDlgItem(hWnd, IDC_MAINFREE);
807 SendMessage(hEditText, WM_SETTEXT, 0, (LPARAM)szText);
808
809 hEditText = GetDlgItem(hWnd, IDC_MAINTOTAL);
810 SendMessage(hEditText, WM_SETTEXT, 0, (LPARAM)szText);
811}
812
813static
816{
818 LPNMHDR NmHdr;
819 WCHAR szText[255];
820 HWND hEditText;
821 DWORD ClusterSector, SectorSize, FreeClusters, Clusters, Sectors;
822
823 NmHdr = (LPNMHDR)lParam;
824
825 /* We only want notifications on click on our devices list */
826 if (NmHdr->code == NM_CLICK &&
827 NmHdr->idFrom == IDC_MAINDEVICES)
828 {
829 /* Get the newly selected device */
831 if (Letter != 0)
832 {
833 /* Setup its name */
834 szText[0] = Letter;
835 szText[1] = L':';
836 szText[2] = 0;
837
838 /* And get its capacities */
839 if (GetDiskFreeSpace(szText, &ClusterSector, &SectorSize, &FreeClusters, &Clusters))
840 {
841 /* Nota: the application returns the total amount of clusters and sectors
842 * So, compute it
843 */
844 Sectors = ClusterSector * Clusters;
845
846 /* And now, update statistics about the device */
847 hEditText = GetDlgItem(hWnd, IDC_MAINSECTORS);
848 wsprintf(szText, L"%ld", Sectors);
849 SendMessage(hEditText, WM_SETTEXT, 0, (LPARAM)szText);
850
851 hEditText = GetDlgItem(hWnd, IDC_MAINSIZE);
852 wsprintf(szText, L"%ld", SectorSize);
853 SendMessage(hEditText, WM_SETTEXT, 0, (LPARAM)szText);
854
855 hEditText = GetDlgItem(hWnd, IDC_MAINFREE);
856 wsprintf(szText, L"%ld", FreeClusters);
857 SendMessage(hEditText, WM_SETTEXT, 0, (LPARAM)szText);
858
859 hEditText = GetDlgItem(hWnd, IDC_MAINTOTAL);
860 wsprintf(szText, L"%ld", Clusters);
861 SendMessage(hEditText, WM_SETTEXT, 0, (LPARAM)szText);
862
863 return TRUE;
864 }
865 }
866
867 /* We failed somewhere, make sure we're at 0 */
868 ResetStats();
869
870 return TRUE;
871 }
872
873 return FALSE;
874}
875
876static
879{
880 WCHAR szText[255];
881 LVCOLUMNW lvColumn;
882 HWND hListView;
883
884 hWnd = hDlg;
885 hListView = GetDlgItem(hDlg, IDC_MAINDEVICES);
886
887 /* Select the whole line, not just the first column */
889
890 /* Set up the first column */
891 ZeroMemory(&lvColumn, sizeof(LVCOLUMNW));
892 lvColumn.pszText = szText;
894 lvColumn.fmt = LVCFMT_LEFT;
895 lvColumn.cx = 100;
896 szText[0] = 0;
897 LoadString(hInstance, IDS_DRIVE, szText, sizeof(szText) / sizeof(WCHAR));
898 szText[(sizeof(szText) / sizeof(WCHAR)) - 1] = L'\0';
899 SendMessage(hListView, LVM_INSERTCOLUMNW, 0, (LPARAM)&lvColumn);
900
901 /* Set up the second column */
902 szText[0] = 0;
903 lvColumn.cx = 350;
904 LoadString(hInstance, IDS_MAPPEDIMAGE, szText, sizeof(szText) / sizeof(WCHAR));
905 szText[(sizeof(szText) / sizeof(WCHAR)) - 1] = L'\0';
906 SendMessage(hListView, LVM_INSERTCOLUMNW, 1, (LPARAM)&lvColumn);
907
908 /* Make sure stats are at 0 */
909 ResetStats();
910
911 /* And populate our device list */
913
914 return TRUE;
915}
916
917static
924{
925 /* Dispatch the message */
926 switch (Message)
927 {
928 case WM_INITDIALOG:
929 return CreateListViewColumns(hDlg);
930
931 case WM_COMMAND:
932 return HandleCommand(wParam, lParam);
933
934 case WM_NOTIFY:
935 return HandleNotify(lParam);
936
937 case WM_CLOSE:
938 return DestroyWindow(hDlg);
939
940 case WM_DESTROY:
942 return TRUE;
943 }
944
945 return FALSE;
946}
947
948INT
949WINAPI
951 HINSTANCE hPrev,
952 LPWSTR Cmd,
953 int iCmd)
954{
955 MSG Msg;
956
958
959 /* Just start our main window */
962 NULL,
964 0);
965 /* And dispatch messages in case of a success */
966 if (hWnd != NULL)
967 {
968 while (GetMessageW(&Msg, NULL, 0, 0) != 0)
969 {
972 }
973 }
974
975 return 0;
976}
WCHAR Letter
unsigned char BOOLEAN
@ Started
Definition: acpisys.h:14
#define IDS_NONE
Definition: resource.h:133
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:608
#define RegCloseKey(hKey)
Definition: registry.h:49
#define Min(a, b)
Definition: cdprocs.h:74
struct @1637 Msg[]
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define OFN_EXPLORER
Definition: commdlg.h:104
#define OFN_HIDEREADONLY
Definition: commdlg.h:107
#define OFN_FILEMUSTEXIST
Definition: commdlg.h:106
#define GetOpenFileName
Definition: commdlg.h:665
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define ERROR_SUCCESS
Definition: deptool.c:10
BOOL WINAPI DeviceIoControl(IN HANDLE hDevice, IN DWORD dwIoControlCode, IN LPVOID lpInBuffer OPTIONAL, IN DWORD nInBufferSize OPTIONAL, OUT LPVOID lpOutBuffer OPTIONAL, IN DWORD nOutBufferSize OPTIONAL, OUT LPDWORD lpBytesReturned OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: deviceio.c:136
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
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
#define CloseHandle
Definition: compat.h:739
#define GetProcessHeap()
Definition: compat.h:736
#define OPEN_EXISTING
Definition: compat.h:775
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define HeapAlloc
Definition: compat.h:733
#define GENERIC_READ
Definition: compat.h:135
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define CALLBACK
Definition: compat.h:35
#define FILE_SHARE_READ
Definition: compat.h:136
#define swprintf
Definition: precomp.h:40
static const WCHAR Message[]
Definition: register.c:74
NTSTATUS FreeClusters(PNTFS_VCB Vcb, PNTFS_ATTR_CONTEXT AttrContext, ULONG AttrOffset, PFILE_RECORD_HEADER FileRecord, ULONG ClustersToFree)
Definition: attrib.c:1057
HINSTANCE hInst
Definition: dxdiag.c:13
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
FxAutoRegKey hKey
Status
Definition: gdiplustypes.h:25
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define REG_SZ
Definition: layer.c:22
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define IDS_MAPPEDIMAGE
Definition: resource.h:34
#define IDC_MAINOK
Definition: resource.h:8
#define IDC_MOUNTCANCEL
Definition: resource.h:21
#define IDC_DRIVEROK
Definition: resource.h:26
#define IDS_NOMOUNTED
Definition: resource.h:35
#define IDD_DRIVERWINDOW
Definition: resource.h:5
#define IDC_MOUNTOK
Definition: resource.h:20
#define IDC_MAINMOUNT
Definition: resource.h:16
#define IDC_MAINREMOVE
Definition: resource.h:15
#define IDC_MAINDEVICES
Definition: resource.h:9
#define IDC_MOUNTJOLIET
Definition: resource.h:24
#define IDC_MAINREMOUNT
Definition: resource.h:18
#define IDD_MOUNTWINDOW
Definition: resource.h:4
#define IDC_MAINCONTROL
Definition: resource.h:19
#define IDC_DRIVERSTOP
Definition: resource.h:29
#define IDC_MAINSIZE
Definition: resource.h:11
#define IDC_MAINTOTAL
Definition: resource.h:13
#define IDC_MOUNTIMAGE
Definition: resource.h:22
#define IDS_FILTER
Definition: resource.h:37
#define IDC_MOUNTPERSIST
Definition: resource.h:25
#define IDC_MAINFREE
Definition: resource.h:12
#define IDC_DRIVERREMOVE
Definition: resource.h:30
#define IDC_DRIVERSTART
Definition: resource.h:28
#define IDS_DRIVE
Definition: resource.h:33
#define IDD_MAINWINDOW
Definition: resource.h:3
#define IDC_MAINSECTORS
Definition: resource.h:10
#define IDC_MAINADD
Definition: resource.h:14
#define IDC_DRIVERINFO
Definition: resource.h:31
#define IDC_MAINEJECT
Definition: resource.h:17
#define IDC_MOUNTUDF
Definition: resource.h:23
#define IDC_DRIVERINSTALL
Definition: resource.h:27
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
LPTSTR szFilter
Definition: mplay32.c:30
unsigned int UINT
Definition: ndis.h:50
NTSYSAPI BOOLEAN NTAPI RtlDosPathNameToNtPathName_U(_In_opt_z_ PCWSTR DosPathName, _Out_ PUNICODE_STRING NtPathName, _Out_opt_ PCWSTR *NtFileNamePart, _Out_opt_ PRTL_RELATIVE_NAME_U DirectoryInfo)
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define KEY_CREATE_SUB_KEY
Definition: nt_native.h:1018
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
#define KEY_SET_VALUE
Definition: nt_native.h:1017
#define IOCTL_STORAGE_LOAD_MEDIA
Definition: ntddstor.h:110
#define L(x)
Definition: ntvdm.h:50
#define LOWORD(l)
Definition: pedump.c:82
#define LVM_DELETEALLITEMS
Definition: commctrl.h:2413
#define LVM_GETITEMTEXT
Definition: commctrl.h:2682
#define LVIF_STATE
Definition: commctrl.h:2312
#define LVNI_SELECTED
Definition: commctrl.h:2424
#define LVM_SETITEMSTATE
Definition: commctrl.h:2672
#define LVM_SETITEM
Definition: commctrl.h:2399
#define LVM_INSERTITEM
Definition: commctrl.h:2406
#define LVCF_WIDTH
Definition: commctrl.h:2587
#define LVM_GETNEXTITEM
Definition: commctrl.h:2433
#define NM_CLICK
Definition: commctrl.h:130
#define LVS_EX_FULLROWSELECT
Definition: commctrl.h:2734
#define LVIS_SELECTED
Definition: commctrl.h:2319
#define LVITEM
Definition: commctrl.h:2375
#define LVM_INSERTCOLUMNW
Definition: commctrl.h:2632
#define LVIF_TEXT
Definition: commctrl.h:2309
#define LVCF_FMT
Definition: commctrl.h:2586
#define LVCF_SUBITEM
Definition: commctrl.h:2589
#define LVCFMT_LEFT
Definition: commctrl.h:2598
#define LVCF_TEXT
Definition: commctrl.h:2588
#define LVIS_FOCUSED
Definition: commctrl.h:2318
#define LVM_SETEXTENDEDLISTVIEWSTYLE
Definition: commctrl.h:2724
#define WM_NOTIFY
Definition: richedit.h:61
@ Cmd
Definition: sacdrv.h:278
BOOL WINAPI QueryServiceStatus(SC_HANDLE hService, LPSERVICE_STATUS lpServiceStatus)
Definition: scm.c:2845
BOOL WINAPI ControlService(SC_HANDLE hService, DWORD dwControl, LPSERVICE_STATUS lpServiceStatus)
Definition: scm.c:622
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
Definition: scm.c:580
_CRTIMP wchar_t *__cdecl wcsncpy(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)
WCHAR Drives[26]
Definition: vcdioctl.h:21
USHORT Count
Definition: vcdioctl.h:20
WCHAR Path[255]
Definition: vcdioctl.h:10
LPWSTR lpBinaryPathName
Definition: winsvc.h:159
LPWSTR pszText
Definition: commctrl.h:2567
LPWSTR pszText
Definition: commctrl.h:2365
UINT state
Definition: commctrl.h:2363
UINT mask
Definition: commctrl.h:2360
UINT stateMask
Definition: commctrl.h:2364
UINT_PTR idFrom
Definition: winuser.h:3158
UINT code
Definition: winuser.h:3159
HWND hwndOwner
Definition: commdlg.h:361
DWORD Flags
Definition: commdlg.h:373
LPWSTR lpstrFile
Definition: commdlg.h:367
DWORD lStructSize
Definition: commdlg.h:360
DWORD nMaxFile
Definition: commdlg.h:368
LPCWSTR lpstrFilter
Definition: commdlg.h:363
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
int32_t INT_PTR
Definition: typedefs.h:64
int32_t INT
Definition: typedefs.h:58
INT WINAPI wWinMain(HINSTANCE hInst, HINSTANCE hPrev, LPWSTR Cmd, int iCmd)
static INT_PTR CALLBACK DriverDialogProc(HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam)
static INT_PTR HandleCommand(WPARAM wParam, LPARAM lParam)
#define IOCTL_CDROM_EJECT_MEDIA
static VOID RemoveDrive(VOID)
static VOID MountImage(VOID)
static INT_PTR HandleMountCommand(WPARAM wParam, LPARAM lParam)
static VOID AddDrive(VOID)
WCHAR wMountLetter
static INT_PTR HandleNotify(LPARAM lParam)
VOID SetServiceState(BOOLEAN Started)
static VOID RefreshDevicesList(WCHAR Letter)
static HANDLE OpenLetter(WCHAR Letter)
static INT_PTR CreateListViewColumns(HWND hDlg)
static INT_PTR CALLBACK MountDialogProc(HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam)
static INT_PTR CALLBACK MainDialogProc(HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam)
static VOID StartDriver(VOID)
HINSTANCE hInstance
static VOID EjectDrive(VOID)
INT_PTR QueryDriverInfo(HWND hDlg)
static WCHAR GetSelectedDriveLetter(VOID)
static INT_PTR HandleDriverCommand(WPARAM wParam, LPARAM lParam)
static VOID DriverControl(VOID)
HWND hMountWnd
static VOID StopDriver(VOID)
static VOID PerformMount(VOID)
HWND hDriverWnd
static INT_PTR SetMountFileName(HWND hDlg, LPARAM lParam)
static VOID ResetStats(VOID)
static HANDLE OpenMaster(VOID)
static VOID RemountImage(VOID)
HWND hWnd
#define IOCTL_VCDROM_DELETE_DRIVE
Definition: vcdioctl.h:3
#define MOUNT_FLAG_SUPP_UDF
Definition: vcdioctl.h:15
#define IOCTL_VCDROM_GET_IMAGE_PATH
Definition: vcdioctl.h:6
#define MOUNT_FLAG_SUPP_JOLIET
Definition: vcdioctl.h:16
#define IOCTL_VCDROM_MOUNT_IMAGE
Definition: vcdioctl.h:4
#define IOCTL_VCDROM_CREATE_DRIVE
Definition: vcdioctl.h:2
#define IOCTL_VCDROM_ENUMERATE_DRIVES
Definition: vcdioctl.h:5
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesRead
Definition: wdfiotarget.h:870
#define FORCEINLINE
Definition: wdftypes.h:67
#define ZeroMemory
Definition: winbase.h:1712
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define GetDiskFreeSpace
Definition: winbase.h:3807
#define CreateFile
Definition: winbase.h:3749
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
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define RegCreateKeyEx
Definition: winreg.h:501
#define SERVICE_START
Definition: winsvc.h:57
#define QueryServiceConfig
Definition: winsvc.h:580
#define SERVICE_QUERY_STATUS
Definition: winsvc.h:55
#define OpenSCManager
Definition: winsvc.h:575
#define SC_MANAGER_CONNECT
Definition: winsvc.h:14
#define StartService
Definition: winsvc.h:585
#define SERVICE_STOP
Definition: winsvc.h:58
#define SERVICE_START_PENDING
Definition: winsvc.h:22
#define SERVICE_RUNNING
Definition: winsvc.h:24
#define SERVICE_CONTROL_STOP
Definition: winsvc.h:36
#define SERVICE_QUERY_CONFIG
Definition: winsvc.h:53
#define OpenService
Definition: winsvc.h:576
HWND WINAPI CreateDialogParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define WM_CLOSE
Definition: winuser.h:1621
BOOL WINAPI TranslateMessage(_In_ const MSG *)
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI GetMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define WM_COMMAND
Definition: winuser.h:1740
#define WM_INITDIALOG
Definition: winuser.h:1739
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define WM_SETTEXT
Definition: winuser.h:1617
struct tagNMHDR * LPNMHDR
#define SendMessage
Definition: winuser.h:5843
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define wsprintf
Definition: winuser.h:5865
#define GetWindowText
Definition: winuser.h:5798
#define LoadString
Definition: winuser.h:5819
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
#define SW_SHOW
Definition: winuser.h:775
#define WM_DESTROY
Definition: winuser.h:1609
BOOL WINAPI DestroyWindow(_In_ HWND)
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define BST_CHECKED
Definition: winuser.h:197
#define BM_GETCHECK
Definition: winuser.h:1918
_In_ ULONG SectorSize
Definition: halfuncs.h:291
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
unsigned char BYTE
Definition: xxhash.c:193