From: Emanuele Aliberti Date: Fri, 4 Aug 2000 21:49:31 +0000 (+0000) Subject: Simple utility to list the so called "DOS Devices", that is X-Git-Tag: backups/FreeLoader@12428~619 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=65ecb0b98b4422cd29ca44325521e37ad96f92c2;hp=66d2f292ef0c607e08bb9559b31cf13139adf8c1 Simple utility to list the so called "DOS Devices", that is symbolic links in the \?? directory of the Ob name space. svn path=/trunk/; revision=1285 --- diff --git a/rosapps/sysutils/ldd.c b/rosapps/sysutils/ldd.c new file mode 100644 index 00000000000..bcfc44cc5e5 --- /dev/null +++ b/rosapps/sysutils/ldd.c @@ -0,0 +1,117 @@ +/* $Id: ldd.c,v 1.1 2000/08/04 21:49:31 ea Exp $ + * + * FILE : ldd.c + * AUTHOR: Emanuele ALIBERTI + * DATE : 2000-08-04 + * DESC : List DOS devices, i.e. symbolic links created + * in the \?? object manager's name space. + */ +#include +#include +#include + +#include "win32err.h" + +#define LINKS_SIZE 32768 +#define DEVICE_SIZE 8192 + +static char SymbolicLinks [LINKS_SIZE]; +static char DosDeviceName [DEVICE_SIZE]; + +static char DeviceNames [DEVICE_SIZE]; +static char DeviceName [DEVICE_SIZE]; + + +BOOL +STDCALL +GetNextString ( + char * BufferIn, + char * BufferOut, + char ** Next + ) +{ + char * next = *Next; + char * w; + + if ('\0' == *next) return FALSE; + for ( w = BufferOut; + ('\0' != *next); + next ++ + ) + { + *(w ++) = *next; + } + *w = '\0'; + *Next = ++ next; + return TRUE; +} + + +int +main (int argc, char * argv [] ) +{ + printf ( + "ReactOS W32 - List DOS Devices\n" + "Written by E.Aliberti (%s)\n\n", + __DATE__ + ); + + if (0 != QueryDosDevice ( + NULL, /* dump full directory */ + SymbolicLinks, + sizeof SymbolicLinks + ) + ) + { + char * NextDosDevice = SymbolicLinks; + char * NextDevice; + + while (TRUE == GetNextString ( + SymbolicLinks, + DosDeviceName, + & NextDosDevice + ) + ) + { + printf ("%s\n", DosDeviceName); + if (0 != QueryDosDevice ( + DosDeviceName, + DeviceNames, + sizeof DeviceNames + ) + ) + { + NextDevice = DeviceNames; + while (TRUE == GetNextString ( + DeviceNames, + DeviceName, + & NextDevice + ) + ) + { + printf (" %s\n", DeviceName); + } + } + else + { + PrintWin32Error ( + L"ldd: ", + GetLastError () + ); + } + printf ("\n"); + } + } + else + { + PrintWin32Error ( + L"ldd: ", + GetLastError () + ); + return EXIT_FAILURE; + } + return EXIT_SUCCESS; +} + + +/* EOF */