Initialize DescriptorTranslated->u.Interrupt.Level before calling HalGetInterruptVect...
[reactos.git] / rosapps / sysutils / ldd.c
1 /* $Id$
2 *
3 * FILE : ldd.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 char SymbolicLinks [LINKS_SIZE];
25 static char DosDeviceName [DEVICE_SIZE];
26
27 static char DeviceNames [DEVICE_SIZE];
28 static char DeviceName [DEVICE_SIZE];
29
30
31 BOOL
32 STDCALL
33 GetNextString (
34 char * BufferIn,
35 char * BufferOut,
36 char ** Next
37 )
38 {
39 char * next = *Next;
40 char * w;
41
42 if ('\0' == *next) return FALSE;
43 for ( w = BufferOut;
44 ('\0' != *next);
45 next ++
46 )
47 {
48 *(w ++) = *next;
49 }
50 *w = '\0';
51 *Next = ++ next;
52 return TRUE;
53 }
54
55
56 int
57 main (int argc, char * argv [] )
58 {
59 printf (
60 "ReactOS %s - List DOS Devices Utility\n"
61 "Written by E.Aliberti (%s)\n\n",
62 KERNEL_RELEASE_STR,
63 __DATE__
64 );
65
66 if (0 != QueryDosDevice (
67 NULL, /* dump full directory */
68 SymbolicLinks,
69 sizeof SymbolicLinks
70 )
71 )
72 {
73 char * NextDosDevice = SymbolicLinks;
74 char * NextDevice;
75
76 while (TRUE == GetNextString (
77 SymbolicLinks,
78 DosDeviceName,
79 & NextDosDevice
80 )
81 )
82 {
83 printf ("%s\n", DosDeviceName);
84 if (0 != QueryDosDevice (
85 DosDeviceName,
86 DeviceNames,
87 sizeof DeviceNames
88 )
89 )
90 {
91 NextDevice = DeviceNames;
92 while (TRUE == GetNextString (
93 DeviceNames,
94 DeviceName,
95 & NextDevice
96 )
97 )
98 {
99 printf (" -> \"%s\"\n", DeviceName);
100 }
101 }
102 else
103 {
104 PrintWin32Error (
105 L"ldd: ",
106 GetLastError ()
107 );
108 }
109 printf ("\n");
110 }
111 }
112 else
113 {
114 PrintWin32Error (
115 L"ldd: ",
116 GetLastError ()
117 );
118 return EXIT_FAILURE;
119 }
120 return EXIT_SUCCESS;
121 }
122
123
124 /* EOF */