summaryrefslogtreecommitdiffstats
path: root/private/nw/test/testnw.c
diff options
context:
space:
mode:
Diffstat (limited to 'private/nw/test/testnw.c')
-rw-r--r--private/nw/test/testnw.c124
1 files changed, 124 insertions, 0 deletions
diff --git a/private/nw/test/testnw.c b/private/nw/test/testnw.c
new file mode 100644
index 000000000..7c95555f1
--- /dev/null
+++ b/private/nw/test/testnw.c
@@ -0,0 +1,124 @@
+#include <nt.h>
+#include <ntrtl.h>
+#include <nturtl.h>
+#define WIN32_CONSOLE_APP
+#include <windows.h>
+#include <stdio.h>
+#include <ntddnwfs.h>
+
+#define CANCEL
+
+
+BOOLEAN test1();
+
+int
+_cdecl
+main(
+ int argc,
+ char *argv[]
+ )
+{
+ UCHAR error = FALSE;
+ DefineDosDevice(DDD_RAW_TARGET_PATH, "R:", "\\Device\\NwRdr\\R:\\NETWARE311");
+ printf( "Test1...\n" );
+ if (!test1()) {
+ printf("Error: Test 1 failed\n");
+ error = TRUE;
+ }
+ return error;
+}
+
+
+
+BOOLEAN
+test1()
+{
+ HANDLE FileHandle;
+ NTSTATUS Status;
+ OBJECT_ATTRIBUTES ObjectAttributes;
+ UNICODE_STRING UnicodeString;
+ IO_STATUS_BLOCK IoStatus;
+
+ NWR_REQUEST_PACKET Input;
+
+ printf( "test 1: opening\n");
+
+ RtlInitUnicodeString( &UnicodeString, L"\\Device\\NwRdr" );
+
+ InitializeObjectAttributes( &ObjectAttributes,
+ &UnicodeString,
+ 0,
+ NULL,
+ NULL
+ );
+/* Status = NtCreateFile( &FileHandle,
+ FILE_LIST_DIRECTORY | SYNCHRONIZE,
+ &ObjectAttributes,
+ &IoStatus,
+ (PLARGE_INTEGER) NULL,
+ 0L,
+ 0L,
+ FILE_CREATE,
+ FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_ALERT,
+ (PVOID) NULL,
+ 0L );
+*/
+ Status = NtOpenFile ( &FileHandle,
+ FILE_LIST_DIRECTORY | SYNCHRONIZE,
+ &ObjectAttributes,
+ &IoStatus,
+ FILE_SHARE_READ,
+ FILE_DIRECTORY_FILE);
+
+ if (Status != STATUS_SUCCESS) {
+ printf( "test 1: Wrong return value %X - open \n",Status);
+ return FALSE;
+ }
+
+ if (IoStatus.Status != STATUS_SUCCESS) {
+ printf( "test 2: Wrong I/O Status value %X - open \n",IoStatus.Status);
+ return FALSE;
+ }
+
+ printf( "test 1: opened device successfully\n");
+
+ Input.Version = REQUEST_PACKET_VERSION;
+ Input.Parameters.DebugValue.DebugFlags = 0xffffffff;
+
+ NtFsControlFile( FileHandle,
+ NULL,
+ NULL,
+ NULL,
+ &IoStatus,
+ FSCTL_NWR_DEBUG,
+ &Input,
+ sizeof(Input),
+ NULL,
+ 0);
+
+ if (Status != STATUS_SUCCESS) {
+ printf( "test 1: Wrong return value %X - SetDebug \n",Status);
+ return FALSE;
+ }
+
+ if (IoStatus.Status != STATUS_SUCCESS) {
+ printf( "test 2: Wrong I/O Status value %X - SetDebug \n",IoStatus.Status);
+ return FALSE;
+ }
+
+ printf( "test 1: set debug trace level successfully\n");
+
+ //
+ // Now close the device
+ //
+
+ printf("test 1: closing device\n");
+
+ Status = NtClose( FileHandle );
+ if (Status != STATUS_SUCCESS) {
+ printf( "test 1: Wrong return value %lX - close \n",Status);
+ return FALSE;
+ }
+ return TRUE;
+}
+