diff options
author | Adam <you@example.com> | 2020-05-17 05:51:50 +0200 |
---|---|---|
committer | Adam <you@example.com> | 2020-05-17 05:51:50 +0200 |
commit | e611b132f9b8abe35b362e5870b74bce94a1e58e (patch) | |
tree | a5781d2ec0e085eeca33cf350cf878f2efea6fe5 /private/nw/ndsutils/volinfo.c | |
download | NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.gz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.bz2 NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.lz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.xz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.zst NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.zip |
Diffstat (limited to 'private/nw/ndsutils/volinfo.c')
-rw-r--r-- | private/nw/ndsutils/volinfo.c | 119 |
1 files changed, 119 insertions, 0 deletions
diff --git a/private/nw/ndsutils/volinfo.c b/private/nw/ndsutils/volinfo.c new file mode 100644 index 000000000..1e2d838a3 --- /dev/null +++ b/private/nw/ndsutils/volinfo.c @@ -0,0 +1,119 @@ +/*** + +Copyright (c) 1995 Microsoft Corporation + +Module Name: + + VolInfo.c + +Abstract: + + A command line NDS utility for resolving volume objects. + +Author: + + Cory West [corywest] 25-Oct-95 + +***/ + +#include "ndsapi32.h" + +int +_cdecl main( + int argc, + char **argv +) { + + NTSTATUS Status; + HANDLE hNdsTree; + OEM_STRING OemArg; + + UNICODE_STRING NdsTree; + WCHAR TreeBuffer[48]; // Max nds tree name length. + + UNICODE_STRING Volume; + WCHAR VolumeBuffer[256]; // Max nds name length. + + UNICODE_STRING HostServer, HostVolume; + WCHAR HostServerBuffer[48]; + WCHAR HostVolumeBuffer[256]; + + // + // Who do we want to monkey with? + // + + if ( argc != 3 ) { + printf( "Usage: volinfo [tree name] [volume object]\n" ); + return -1; + } + + // + // Get the tree. + // + + OemArg.Length = strlen( argv[1] ); + OemArg.MaximumLength = OemArg.Length; + OemArg.Buffer = argv[1]; + + NdsTree.Length = 0; + NdsTree.MaximumLength = sizeof( TreeBuffer ); + NdsTree.Buffer = TreeBuffer; + + RtlOemStringToUnicodeString( &NdsTree, &OemArg, FALSE ); + + // + // Open up a handle to the tree. + // + + Status = NwNdsOpenTreeHandle( &NdsTree, + &hNdsTree ); + + if ( !NT_SUCCESS( Status ) ) { + printf( "The supplied tree name is invalid or the tree is unavailable.\n" ); + return -1; + } + + // + // Get the volume information. + // + + OemArg.Length = strlen( argv[2] ); + OemArg.MaximumLength = OemArg.Length; + OemArg.Buffer = argv[2]; + + Volume.Length = 0; + Volume.MaximumLength = sizeof( VolumeBuffer ); + Volume.Buffer = VolumeBuffer; + + RtlOemStringToUnicodeString( &Volume, &OemArg, FALSE ); + + // + // Set up the reply strings. + // + + HostServer.Length = 0; + HostServer.MaximumLength = sizeof( HostServerBuffer ); + HostServer.Buffer = HostServerBuffer; + + HostVolume.Length = 0; + HostVolume.MaximumLength = sizeof( HostVolumeBuffer ); + HostVolume.Buffer = HostVolumeBuffer; + + Status = NwNdsGetVolumeInformation( hNdsTree, + &Volume, + &HostServer, + &HostVolume ); + + + CloseHandle( hNdsTree ); + + if ( NT_SUCCESS( Status )) { + printf( "Host Server: %wZ\n", &HostServer ); + printf( "Host Volume: %wZ\n", &HostVolume ); + return 0; + } + + printf( "Unable to complete the requested operation: 0x%08lx\n", Status ); + return -1; + +} |