File tree Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change
1
+ #ifndef UNICODE
2
+ #define UNICODE
3
+ #define _UNICODE
4
+ #endif
5
+ #include <stdlib.h>
6
+ #include <stdio.h>
7
+ #include <windows.h>
8
+ #ifdef __TINYC__
9
+ LPWSTR * WINAPI CommandLineToArgvW (LPCWSTR ,int * );
10
+ BOOL WINAPI PathStripToRootW (wchar_t * );
11
+ BOOL WINAPI PathIsRootW (wchar_t * );
12
+ #else
13
+ #include <shellapi.h>
14
+ #include <setupapi.h>
15
+ #endif
16
+
17
+ int main (int argc ,char * argv []) {
18
+ wchar_t root [1000 ];
19
+ unsigned int type ;
20
+ unsigned int i ;
21
+ if ( argc < 2 )
22
+ GetCurrentDirectoryW (sizeof (root ),root );
23
+ else {
24
+ wchar_t * * wargv = CommandLineToArgvW (GetCommandLineW (), & argc );
25
+ wcscpy (root ,wargv [1 ]);
26
+ }
27
+ if (GetDriveTypeW (root ) == 1 ) {
28
+ if (!PathStripToRootW (root ))
29
+ return 1 ;
30
+ }
31
+ switch (GetDriveTypeW (root )) {
32
+ case (2 ) : printf ("REMOVABLE\n" ); break ;
33
+ case (3 ) : printf ("FIXED\n" ); break ;
34
+ case (4 ) : printf ("REMOTE\n" ); break ;
35
+ case (5 ) : printf ("CDROM\n" ); break ;
36
+ case (6 ) : printf ("RAMDISK\n" ); break ;
37
+ }
38
+ return 1 ;
39
+ }
You can’t perform that action at this time.
0 commit comments