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/setshare.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 '')
-rw-r--r-- | private/nw/ndsutils/setshare.c | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/private/nw/ndsutils/setshare.c b/private/nw/ndsutils/setshare.c new file mode 100644 index 000000000..92caf2ee8 --- /dev/null +++ b/private/nw/ndsutils/setshare.c @@ -0,0 +1,88 @@ +/*** + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + SetShare.c + +Abstract: + + This is a command line test utility for setting the + shareable bit on a file on a Netware server. + +Author: + + Cory West [corywest] 25-April-96 + +***/ + +#include "ndsapi32.h" + +int +_cdecl main( + int argc, + char **argv +) { + + NTSTATUS Status; + int ReturnCode = 0; + IO_STATUS_BLOCK IoStatusBlock; + HANDLE hFile; + + // + // Check the command line arguments for a file. + // + + if ( argc < 1 ) { + printf( "Usage: setshare [path to file]\n" ); + return -1; + } + + // + // Open the file. + // + + hFile = CreateFile( argv[1], // file name + GENERIC_READ, // read access + 0, // exclusive + NULL, // no security specifications + OPEN_EXISTING, // do not create + 0, // no attributes that we care about + NULL ); // no template + + if ( hFile == INVALID_HANDLE_VALUE ) { + printf( "Couldn't open the request file. Error = %08lx\n", Status ); + return -1; + } + + // + // Tell the redirector to set the shareable bit. + // + + Status = NtFsControlFile( hFile, + NULL, + NULL, + NULL, + &IoStatusBlock, + FSCTL_NWR_SET_SHAREBIT, + NULL, + 0, + NULL, + 0 ); + + if ( !NT_SUCCESS( Status ) ) { + printf( "A parameter was not correct. This only works for a file\n" ); + printf( "on a Netware volume. Status = %08lx\n", Status ); + ReturnCode = -1; + } + + CloseHandle( hFile ); + + // + // The bit actually gets set when you close the file. + // + + return ReturnCode; + +} |