Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

rtflush.c

Go to the documentation of this file.
00001 /*++ 00002 00003 Copyright (c) 1992 Microsoft Corporation 00004 00005 Module Name: 00006 00007 rtflush.c 00008 00009 Abstract: 00010 00011 NT level registry test program, basic non-error paths. 00012 00013 Flush a key. 00014 00015 rtflush <KeyPath> 00016 00017 Will flush the key named by <KeyPath> 00018 00019 Example: 00020 00021 rtflush \REGISTRY\MACHINE\TEST\bigkey 00022 00023 Author: 00024 00025 Bryan Willman (bryanwi) 10-Jan-92 00026 00027 Revision History: 00028 00029 --*/ 00030 00031 #include "cmp.h" 00032 #include <stdio.h> 00033 #include <stdlib.h> 00034 #include <string.h> 00035 00036 #define WORK_SIZE 1024 00037 00038 void __cdecl main(int, char *); 00039 void processargs(); 00040 00041 UNICODE_STRING WorkName; 00042 WCHAR workbuffer[WORK_SIZE]; 00043 00044 void 00045 __cdecl main( 00046 int argc, 00047 char *argv[] 00048 ) 00049 { 00050 NTSTATUS status; 00051 OBJECT_ATTRIBUTES ObjectAttributes; 00052 HANDLE BaseHandle; 00053 00054 // 00055 // Process args 00056 // 00057 00058 WorkName.MaximumLength = WORK_SIZE; 00059 WorkName.Length = 0L; 00060 WorkName.Buffer = &(workbuffer[0]); 00061 00062 processargs(argc, argv); 00063 00064 00065 // 00066 // Set up and open KeyPath 00067 // 00068 00069 printf("rtflush: starting\n"); 00070 00071 InitializeObjectAttributes( 00072 &ObjectAttributes, 00073 &WorkName, 00074 0, 00075 (HANDLE)NULL, 00076 NULL 00077 ); 00078 ObjectAttributes.Attributes |= OBJ_CASE_INSENSITIVE; 00079 00080 status = NtOpenKey( 00081 &BaseHandle, 00082 MAXIMUM_ALLOWED, 00083 &ObjectAttributes 00084 ); 00085 if (!NT_SUCCESS(status)) { 00086 printf("rtflush: t0: %08lx\n", status); 00087 exit(1); 00088 } 00089 00090 status = NtFlushKey(BaseHandle); 00091 if (!NT_SUCCESS(status)) { 00092 printf("rtflush: t0: %08lx\n", status); 00093 exit(1); 00094 } 00095 00096 NtClose(BaseHandle); 00097 exit(0); 00098 } 00099 00100 00101 void 00102 processargs( 00103 int argc, 00104 char *argv[] 00105 ) 00106 { 00107 ANSI_STRING temp; 00108 00109 if ( (argc != 2) ) 00110 { 00111 printf("Usage: %s <KeyPath>\n", 00112 argv[0]); 00113 exit(1); 00114 } 00115 00116 RtlInitAnsiString( 00117 &temp, 00118 argv[1] 00119 ); 00120 00121 RtlAnsiStringToUnicodeString( 00122 &WorkName, 00123 &temp, 00124 FALSE 00125 ); 00126 00127 return; 00128 }

Generated on Sat May 15 19:41:40 2004 for test by doxygen 1.3.7