2005-04-05 19:22:30 +00:00
|
|
|
/* $Id$
|
2000-08-04 21:49:31 +00:00
|
|
|
*
|
|
|
|
* 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 <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2005-04-05 19:22:30 +00:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#include <windef.h>
|
|
|
|
#include <winbase.h>
|
|
|
|
|
2000-08-04 21:49:31 +00:00
|
|
|
|
2000-09-11 20:17:02 +00:00
|
|
|
#include <reactos/buildno.h>
|
|
|
|
|
2000-08-04 21:49:31 +00:00
|
|
|
#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 (
|
2000-09-11 20:17:02 +00:00
|
|
|
"ReactOS %s - List DOS Devices Utility\n"
|
2000-08-04 21:49:31 +00:00
|
|
|
"Written by E.Aliberti (%s)\n\n",
|
2000-09-11 20:17:02 +00:00
|
|
|
KERNEL_RELEASE_STR,
|
2000-08-04 21:49:31 +00:00
|
|
|
__DATE__
|
|
|
|
);
|
|
|
|
|
|
|
|
if (0 != QueryDosDevice (
|
|
|
|
NULL, /* dump full directory */
|
|
|
|
SymbolicLinks,
|
|
|
|
sizeof SymbolicLinks
|
|
|
|
)
|
|
|
|
)
|
|
|
|
{
|
|
|
|
char * NextDosDevice = SymbolicLinks;
|
|
|
|
char * NextDevice;
|
2005-05-07 21:24:31 +00:00
|
|
|
|
2000-08-04 21:49:31 +00:00
|
|
|
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
|
|
|
|
)
|
|
|
|
)
|
|
|
|
{
|
2001-01-13 18:17:17 +00:00
|
|
|
printf (" -> \"%s\"\n", DeviceName);
|
2000-08-04 21:49:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
PrintWin32Error (
|
2005-05-07 21:24:31 +00:00
|
|
|
L"ldd: ",
|
2000-08-04 21:49:31 +00:00
|
|
|
GetLastError ()
|
|
|
|
);
|
|
|
|
}
|
|
|
|
printf ("\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
PrintWin32Error (
|
2005-05-07 21:24:31 +00:00
|
|
|
L"ldd: ",
|
2000-08-04 21:49:31 +00:00
|
|
|
GetLastError ()
|
|
|
|
);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* EOF */
|