]>
glassweightruler.freedombox.rocks Git - Ventoy.git/blob - Plugson/src/Core/ventoy_disk_windows.c
1 /******************************************************************************
2 * ventoy_disk.c ---- ventoy disk
3 * Copyright (c) 2021, longpanda <admin@ventoy.net>
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 3 of the
8 * License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, see <http://www.gnu.org/licenses/>.
23 #include <ventoy_define.h>
24 #include <ventoy_disk.h>
25 #include <ventoy_util.h>
26 #include <fat_filelib.h>
28 static int g_disk_num
= 0;
29 ventoy_disk
*g_disk_list
= NULL
;
31 int ventoy_disk_init(void)
34 DWORD Drives
= GetLogicalDrives();
36 vlog("ventoy disk init ...\n");
38 g_disk_list
= zalloc(sizeof(ventoy_disk
) * MAX_DISK
);
44 if (CheckRuntimeEnvironment(Letter
, g_disk_list
+ g_disk_num
) == 0)
46 g_disk_list
[g_disk_num
].devname
[0] = Letter
;
48 vlog("%C: is ventoy disk\n", Letter
);
52 memset(g_disk_list
+ g_disk_num
, 0, sizeof(ventoy_disk
));
53 vlog("%C: is NOT ventoy disk\n", Letter
);
64 void ventoy_disk_exit(void)
66 vlog("ventoy disk exit ...\n");
68 check_free(g_disk_list
);
73 const ventoy_disk
* ventoy_get_disk_list(int *num
)
79 const ventoy_disk
* ventoy_get_disk_node(int id
)
81 if (id
>= 0 && id
< g_disk_num
)
83 return g_disk_list
+ id
;