- Fix KiDispatchException to unmask KI_EXCEPTION_INTERNAL when setting the exception...
[reactos.git] / rosapps / sysutils / lsdd / lsdd.c
1 /* $Id$
2 *
3 * FILE : lsdd.c
4 * AUTHOR: Emanuele ALIBERTI
5 * DATE : 2000-08-04
6 * DESC : List DOS devices, i.e. symbolic links created
7 * in the \?? object manager's name space.
8 */
9 #include <stdio.h>
10 #include <stdlib.h>
11 #include <stdarg.h>
12
13 #include <windef.h>
14 #include <winbase.h>
15
16
17 #include <reactos/buildno.h>
18
19 #include "../win32err.h"
20
21 #define LINKS_SIZE 32768
22 #define DEVICE_SIZE 8192
23
24 static const LPWSTR error_prefix = L"lsdd: ";
25
26 static char SymbolicLinks [LINKS_SIZE];
27 static char DosDeviceName [DEVICE_SIZE];
28
29 static char DeviceNames [DEVICE_SIZE];
30 static char DeviceName [DEVICE_SIZE];
31
32
33 BOOL
34 STDCALL
35 GetNextString (
36 char * BufferIn,
37 char * BufferOut,
38 char ** Next
39 )
40 {
41 char * next = *Next;
42 char * w;
43
44 if ('\0' == *next) return FALSE;
45 for ( w = BufferOut;
46 ('\0' != *next);
47 next ++
48 )
49 {
50 *(w ++) = *next;
51 }
52 *w = '\0';
53 *Next = ++ next;
54 return TRUE;
55 }
56
57
58 int
59 main (int argc, char * argv [] )
60 {
61 printf (
62 "ReactOS/Win32 %s - List DOS Devices Utility\n"
63 "Written by E.Aliberti (%s)\n\n",
64 KERNEL_RELEASE_STR,
65 __DATE__
66 );
67
68 if (0 != QueryDosDevice (
69 NULL, /* dump full directory */
70 SymbolicLinks,
71 sizeof SymbolicLinks
72 )
73 )
74 {
75 char * NextDosDevice = SymbolicLinks;
76 char * NextDevice;
77
78 while (TRUE == GetNextString (
79 SymbolicLinks,
80 DosDeviceName,
81 & NextDosDevice
82 )
83 )
84 {
85 printf ("%s\n", DosDeviceName);
86 if (0 != QueryDosDevice (
87 DosDeviceName,
88 DeviceNames,
89 sizeof DeviceNames
90 )
91 )
92 {
93 NextDevice = DeviceNames;
94 while (TRUE == GetNextString (
95 DeviceNames,
96 DeviceName,
97 & NextDevice
98 )
99 )
100 {
101 printf (" -> \"%s\"\n", DeviceName);
102 }
103 }
104 else
105 {
106 PrintWin32Error (
107 error_prefix,
108 GetLastError ()
109 );
110 }
111 printf ("\n");
112 }
113 }
114 else
115 {
116 PrintWin32Error (
117 error_prefix,
118 GetLastError ()
119 );
120 return EXIT_FAILURE;
121 }
122 return EXIT_SUCCESS;
123 }
124
125
126 /* EOF */